:root {
  color-scheme: dark;
  --bg: #080809;
  --panel: #121214;
  --panel-2: #1a1a1e;
  --line: rgba(255,255,255,.09);
  --text: #f5f5f7;
  --muted: #8c8c96;
  --accent: #b5ff3d;
  --danger: #ff5d65;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 90% 0%, rgba(181,255,61,.11), transparent 28rem),
    linear-gradient(180deg, #101013 0%, #080809 62%);
}
button, input { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
.login-view { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 390px); }
.brand-mark {
  width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px;
  background: var(--accent); color: #111; font-size: 34px; font-weight: 800; transform: rotate(-8deg);
  box-shadow: 0 16px 48px rgba(181,255,61,.2);
}
.eyebrow { color: var(--accent); margin: 28px 0 8px; font-weight: 800; font-size: 12px; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(30px, 8vw, 44px); line-height: 1; letter-spacing: -.04em; }
.muted { color: var(--muted); line-height: 1.5; margin: 16px 0 34px; }
label { display: block; margin-bottom: 9px; color: #c7c7cd; font-size: 14px; }
input {
  width: 100%; border: 1px solid var(--line); border-radius: 15px; padding: 16px;
  background: var(--panel); color: var(--text); outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181,255,61,.11); }
.primary {
  width: 100%; border: 0; border-radius: 15px; background: var(--accent); color: #111;
  padding: 16px; margin-top: 12px; font-weight: 850;
}
.error { color: var(--danger); min-height: 20px; font-size: 13px; }
.remote-view { width: min(100%, 550px); min-height: 100dvh; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom)); }
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
header .eyebrow { margin: 0 0 7px; }
header h1 { font-size: 30px; }
.power {
  width: 58px; height: 58px; border-radius: 50%; border: 1px solid rgba(255,93,101,.28);
  color: var(--danger); background: rgba(255,93,101,.08); font-size: 28px;
}
.power:active { background: var(--danger); color: white; transform: scale(.95); }
.banner {
  display: flex; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid var(--line);
  border-radius: 12px; color: var(--muted); font-size: 13px; background: rgba(255,255,255,.025);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 12px var(--danger); }
.banner.online .dot { background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.device-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 14px 0; }
.device-tab {
  text-align: left; padding: 13px; min-height: 65px; border: 1px solid var(--line); border-radius: 15px;
  background: var(--panel); overflow: hidden;
}
.device-tab.active { border-color: rgba(181,255,61,.6); background: rgba(181,255,61,.08); }
.device-tab strong, .device-tab small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-tab small { color: var(--muted); margin-top: 5px; }
.quick-row, .playback-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.quick-row button, .playback-row button, .rocker button {
  border: 1px solid var(--line); background: linear-gradient(160deg, #1b1b1f, #111113);
  border-radius: 16px; min-height: 61px;
}
button[data-key]:active { transform: scale(.94); border-color: rgba(181,255,61,.5); background: rgba(181,255,61,.08); }
.button-icon { display: block; font-size: 22px; line-height: 1; }
button small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.control-grid { display: grid; grid-template-columns: 74px 1fr 74px; align-items: center; gap: 15px; margin: 22px 0; }
.rocker { background: var(--panel); border: 1px solid var(--line); padding: 5px; border-radius: 28px; }
.rocker button { width: 100%; border: 0; background: transparent; border-radius: 22px; }
.rocker button span { font-size: 22px; }
.dpad {
  aspect-ratio: 1; position: relative; border-radius: 50%; border: 1px solid var(--line);
  background: radial-gradient(circle, #222226 0 29%, #17171a 30% 67%, #111113 68%);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.07), 0 22px 50px rgba(0,0,0,.35);
}
.dpad button { position: absolute; border: 0; background: transparent; font-size: 26px; }
.dpad .up { top: 3%; left: 35%; width: 30%; height: 28%; }
.dpad .down { bottom: 3%; left: 35%; width: 30%; height: 28%; }
.dpad .left { left: 3%; top: 35%; width: 28%; height: 30%; font-size: 38px; }
.dpad .right { right: 3%; top: 35%; width: 28%; height: 30%; font-size: 38px; }
.dpad .ok {
  width: 38%; height: 38%; top: 31%; left: 31%; border-radius: 50%; background: var(--accent);
  color: #111; font-size: 15px; font-weight: 900; box-shadow: 0 0 28px rgba(181,255,61,.15);
}
.playback-row button { min-height: 50px; color: #d7d7dc; }
.sleep-timer { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.025); }
.sleep-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.sleep-heading .eyebrow { margin: 0 0 5px; }
.sleep-heading strong { font-size: 14px; }
.timer-cancel { border: 0; background: transparent; color: var(--danger); font-size: 12px; padding: 10px; }
.timer-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.timer-actions button { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 54px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(160deg, #1b1b1f, #111113); }
.timer-actions button:active { transform: scale(.96); border-color: rgba(181,255,61,.5); }
.timer-actions span { color: var(--accent); font-size: 20px; }
.timer-actions strong { font-size: 14px; }
.toast {
  position: fixed; z-index: 5; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  padding: 11px 16px; max-width: calc(100vw - 36px); border-radius: 999px; background: #eee; color: #111;
  font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: white; }
.logout { display: block; margin: 30px auto 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
@media (max-width: 370px) {
  .remote-view { padding-left: 12px; padding-right: 12px; }
  .control-grid { grid-template-columns: 64px 1fr 64px; gap: 9px; }
}
