/* TV Assistant — design system
   Navy-black surfaces, one ice-blue signal accent. Newsreader (serif) for display and the
   assistant's voice, Geist for interface, Geist Mono for system data. Always dark. Hairlines over containers. Motion 150–250ms, ease-out. */

:root {
  /* surfaces */
  --bg: #03050a;
  --bg-1: #080b13;
  --bg-2: #0f141e;
  --bg-3: #171d29;
  --line: rgba(185, 200, 235, 0.08);
  --line-2: rgba(185, 200, 235, 0.13);
  --line-3: rgba(185, 200, 235, 0.24);
  /* text */
  --fg: #eef1f7;
  --fg-2: #a8afc0;
  --fg-3: #737b8e;
  --on-fg: #03050a;
  /* signal (live, active, focus) and status */
  --signal: #8adcff;
  --signal-dim: rgba(138, 220, 255, 0.13);
  --ok: #6fcf97;
  --err: #f08a76;
  --scrim: rgba(3, 5, 10, 0.66);
  --shadow: rgba(0, 0, 0, 0.75);
  /* type */
  --serif: "Newsreader", "Iowan Old Style", Charter, Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  /* shape & motion */
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 150ms;
  --med: 240ms;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 14px/1.5 var(--sans); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; overflow: hidden; transition: background var(--med), color var(--med);
  font-feature-settings: "ss01", "cv11";
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--signal-dim); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0; }
.serif { font-family: var(--serif); font-optical-sizing: auto; letter-spacing: -0.01em; }
.muted { color: var(--fg-2); }
.faint { color: var(--fg-3); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon.solid { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }

/* ================================================================= shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); height: 100%; }
.sidebar { display: flex; flex-direction: column; padding: 20px 12px 16px; border-right: 1px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 24px; }
.brand-mark { width: 26px; height: 26px; color: var(--fg); }
.brand-name { font: 500 19px/1 var(--serif); letter-spacing: -0.015em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 10px; border-radius: var(--r-s);
  color: var(--fg-2); font-weight: 500; transition: background var(--fast), color var(--fast); position: relative; }
.nav-item:hover { background: var(--bg-2); color: var(--fg); }
.nav-item.on { background: var(--bg-2); color: var(--fg); }
.nav-item.on::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: var(--signal); }
.sidebar-foot { display: block; width: 100%; margin-top: auto; padding: 12px 10px; border-top: 1px solid var(--line); text-align: left; border-radius: 0 0 var(--r-s) var(--r-s); transition: background var(--fast); }
.sidebar-foot:hover { background: var(--bg-2); }
.conn { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.conn-sub { display: block; margin-top: 2px; color: var(--fg-3); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-3); flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--err); }
.dot.wait { background: var(--signal); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 32px; border-bottom: 1px solid var(--line); flex: none; }
.topbar h1 { margin: 0; font: 500 21px/1 var(--serif); letter-spacing: -0.015em; }
.topbar .grow { flex: 1; }
.now { display: flex; align-items: center; gap: 8px; max-width: 420px; height: 32px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: border-color var(--fast); }
.now:hover { border-color: var(--line-2); }
.now b { color: var(--fg); font-weight: 500; }

.views { position: relative; flex: 1; min-height: 0; }
.view { position: absolute; inset: 0; overflow-y: auto; display: none; }
.view.on { display: block; animation: enter var(--med) var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }
.page { max-width: 1080px; margin: 0 auto; padding: 32px 32px 64px; }

/* ================================================================= primitives */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--r-s);
  background: var(--bg-2); color: var(--fg); font-weight: 500; white-space: nowrap;
  transition: background var(--fast), transform var(--fast), opacity var(--fast); }
.btn:hover { background: var(--bg-3); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--fg); color: var(--on-fg); }
.btn.primary:hover { background: #ffffff; }
.btn.quiet { background: none; color: var(--fg-2); }
.btn.quiet:hover { background: var(--bg-2); color: var(--fg); }
.btn.sq { width: 36px; padding: 0; }
.btn.lg { height: 44px; padding: 0 18px; }
.btn.danger:hover { color: var(--err); }

.field { width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-s); border: 1px solid var(--line-2); background: var(--bg-1); color: var(--fg);
  transition: border-color var(--fast); }
.field::placeholder { color: var(--fg-3); }
.field:focus { outline: none; border-color: rgba(242, 180, 92, 0.55); }
textarea.field { height: auto; padding: 10px 12px; resize: none; line-height: 1.5; }
select.field { appearance: none; padding-right: 32px;
  background: var(--bg-1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a9' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.lbl { display: block; margin-bottom: 6px; color: var(--fg-2); font-size: 12px; font-weight: 500; }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg-1); border: 1px solid var(--line); }
.seg button { height: 28px; padding: 0 12px; border-radius: 7px; color: var(--fg-2); font-weight: 500; font-size: 13px; transition: background var(--fast), color var(--fast); }
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--bg-3); color: var(--fg); }

.toggle { display: inline-flex; align-items: center; gap: 10px; color: var(--fg-2); cursor: pointer; user-select: none; }
.toggle input { appearance: none; width: 30px; height: 18px; margin: 0; border-radius: 99px; background: var(--bg-3); position: relative; transition: background var(--fast); cursor: pointer; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--fg-2); transition: transform var(--med) var(--ease), background var(--fast); }
.toggle input:checked { background: var(--signal); }
.toggle input:checked::after { transform: translateX(12px); background: #fff; }

.section { padding: 24px 0; border-top: 1px solid var(--line); }
.section:first-child { border-top: 0; padding-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font: 500 20px/1.2 var(--serif); letter-spacing: -0.012em; }
.section-head p { margin: 0; color: var(--fg-3); }
.section-head .grow { flex: 1; }
.eyebrow { font: 500 11px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3); white-space: nowrap; }
.note { color: var(--fg-3); font-size: 12.5px; line-height: 1.55; }
.note b { color: var(--fg-2); font-weight: 500; }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; font: 500 10.5px/1 var(--mono); letter-spacing: 0.02em; color: var(--fg-3); border: 1px solid var(--line-2); }
.tag.signal { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 40%, transparent); }

/* ================================================================= cards
   One surface per group of controls: title and hint on top, the main action in the footer. */
.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head h2 { margin: 0; font: 500 20px/1.2 var(--serif); letter-spacing: -0.012em; }
.card-head p { margin: 4px 0 0; color: var(--fg-3); font-size: 13px; line-height: 1.45; }
.card-foot { display: flex; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.card-sub { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.card-note { margin-top: 14px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.grow { flex: 1; }

/* ================================================================= assistant */
.view-chat.on { display: flex; flex-direction: column; }
.chat-scroll { flex: 1; overflow-y: auto; }
.thread { max-width: 720px; margin: 0 auto; padding: 40px 32px 24px; display: flex; flex-direction: column; gap: 28px; }
.empty { padding: 8vh 0 0; }
.empty h2 { margin: 20px 0 10px; font: 400 42px/1.08 var(--serif); letter-spacing: -0.025em; }
.empty h2 em { font-style: italic; color: var(--signal); }
.empty p { margin: 0 0 32px; color: var(--fg-2); max-width: 470px; font-size: 15px; }
.empty .brand-mark { width: 32px; height: 32px; color: var(--fg-2); }
.prompts { border-top: 1px solid var(--line); }
.prompt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 4px; border-bottom: 1px solid var(--line); text-align: left; color: var(--fg); transition: padding var(--med) var(--ease), color var(--fast); }
.prompt .icon { color: var(--fg-3); transition: color var(--fast); }
.prompt span { flex: 1; }
.prompt small { color: var(--fg-3); font-size: 12.5px; }
.prompt .go { opacity: 0; transform: translateX(-4px); transition: opacity var(--fast), transform var(--med) var(--ease); }
.prompt:hover { padding-left: 10px; }
.prompt:hover .icon { color: var(--signal); }
.prompt:hover .go { opacity: 1; transform: none; color: var(--fg-2); }

.msg { animation: enter var(--med) var(--ease); }
.msg.me { align-self: flex-end; max-width: 78%; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--bg-2); white-space: pre-wrap; word-wrap: break-word; }
.msg.ai { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; max-width: 100%; }
.msg.ai .who { width: 22px; height: 22px; margin-top: 1px; color: var(--fg-2); }
.msg.ai .text { white-space: pre-wrap; word-wrap: break-word; font: 400 17.5px/1.6 var(--serif); letter-spacing: -0.003em; }
.msg.ai.err .text { color: var(--err); }
.receipts { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding-left: 12px; border-left: 1px solid var(--line-2); }
.receipt { display: flex; align-items: center; gap: 8px; color: var(--fg-2); font: 400 12px/1.5 var(--mono); }
.receipt .icon { width: 13px; height: 13px; stroke-width: 2; }
.receipt.ok .icon { color: var(--ok); }
.receipt.fail { color: var(--err); }
.receipt.info .icon { color: var(--signal); }
.working { display: flex; align-items: center; gap: 10px; color: var(--fg-2); font-size: 14px; }
.working .bar { position: relative; width: 56px; height: 2px; border-radius: 2px; background: var(--bg-3); overflow: hidden; }
.working .bar::after { content: ""; position: absolute; inset: 0; width: 40%; border-radius: 2px; background: var(--signal); animation: sweep 1.2s var(--ease) infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.composer-wrap { flex: none; padding: 0 32px 20px; }
.composer-inner { max-width: 720px; margin: 0 auto; }
.quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 0 10px; mask-image: linear-gradient(90deg, #000 92%, transparent); }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line-2);
  color: var(--fg-2); font-size: 13px; font-weight: 500; transition: color var(--fast), border-color var(--fast), background var(--fast); }
.quick button:hover { color: var(--fg); border-color: var(--line-3); }
.quick button:active { background: var(--bg-2); }
.quick .icon { width: 14px; height: 14px; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 16px; background: var(--bg-1); border: 1px solid var(--line-2);
  transition: border-color var(--fast); }
.composer:focus-within { border-color: var(--line-3); }
.composer textarea { flex: 1; min-height: 36px; max-height: 160px; padding: 8px 6px; border: 0; background: none; resize: none; outline: none; font-size: 15px; line-height: 1.45; }
.composer textarea::placeholder { color: var(--fg-3); }
.composer .btn { width: 36px; height: 36px; padding: 0; border-radius: 10px; }
.composer .send { background: var(--fg); color: var(--on-fg); }
.composer .send:disabled { background: var(--bg-3); color: var(--fg-3); opacity: 1; }
.composer .mic { background: none; color: var(--fg-2); }
.composer .mic:hover { background: var(--bg-2); color: var(--fg); }
.composer .mic.live { background: var(--signal-dim); color: var(--signal); }
.composer-meta { display: flex; align-items: center; justify-content: space-between; padding: 10px 4px 0; font-size: 12.5px; }

/* ================================================================= voice
   Voice is the main control. The reactor shows the state: slow idle drift, faster rings while
   listening, bars that follow each word (hearing) and the reply (speaking), a sweeping scan (thinking). */
@keyframes breathe { 50% { transform: scale(1.06); } }

.voice { position: fixed; inset: 0; z-index: 70; display: grid; grid-template-rows: auto 1fr auto auto; opacity: 0; transition: opacity var(--med) var(--ease);
  padding: max(16px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse 55% 42% at 50% 36%, rgba(120, 210, 255, 0.12), transparent 70%),
              radial-gradient(ellipse 80% 50% at 50% 105%, rgba(46, 80, 170, 0.22), transparent 70%), var(--bg); }
.voice.on { opacity: 1; }
.voice-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vchip { height: 32px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--fg-2); font-size: 13px; font-weight: 500; }
.vchip:hover { color: var(--fg); border-color: var(--line-3); }
.v-state { font: 500 11px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-3); }
.voice[data-state="listening"] .v-state, .voice[data-state="hearing"] .v-state { color: var(--signal); }
.vclose { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--fg-2); background: var(--bg-2); }
.vclose:hover { color: var(--fg); }
.voice-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; min-height: 0; text-align: center; }
.v-text { max-width: 640px; min-height: 120px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.v-heard { margin: 0; font: 400 26px/1.3 var(--serif); letter-spacing: -0.01em; color: var(--fg-2); transition: color var(--med); }
.v-heard.final { color: var(--fg-3); font-size: 18px; }
.v-reply { margin: 0; font: 400 24px/1.45 var(--serif); color: var(--fg); animation: enter var(--med) var(--ease); }
.v-reply:empty, .v-heard:empty { display: none; }
.v-reply.err { color: var(--err); }
.v-receipts { margin: 0; padding: 0; border: 0; align-items: center; }
.v-hints { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 0 18px; justify-content: safe center; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.v-hints::-webkit-scrollbar { display: none; }
.v-hints button { flex: none; height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--fg-2); font-size: 13px; transition: color var(--fast), border-color var(--fast); }
.v-hints button:hover { color: var(--fg); border-color: var(--line-3); }
.voice[data-state="thinking"] .v-hints, .voice[data-state="speaking"] .v-hints { opacity: 0.35; pointer-events: none; }
.voice-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; max-width: 520px; width: 100%; margin: 0 auto; }
.vside { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--fg-3); font-size: 11.5px; font-weight: 500; transition: color var(--fast); }
.vside .icon { width: 20px; height: 20px; }
.vside[aria-pressed="true"] { color: var(--fg); }
.vside[aria-pressed="true"] .icon { color: var(--signal); }
.vmic { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--fg); color: var(--on-fg);
  box-shadow: 0 0 0 6px rgba(138, 220, 255, 0.08), 0 10px 34px -8px rgba(120, 210, 255, 0.55); transition: transform var(--fast), background var(--fast); }
.vmic .icon { width: 26px; height: 26px; stroke-width: 1.8; }
.vmic:active { transform: scale(0.95); }
.voice[data-state="listening"] .vmic, .voice[data-state="hearing"] .vmic { background: var(--signal); color: #04121c; }
.orb { display: grid; place-items: center; border-radius: 50%; }
.orb .reactor { width: 280px; height: 280px; }

.reactor { --lvl: 0; position: relative; display: grid; place-items: center; width: 220px; height: 220px; }
.reactor svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.reactor circle { fill: none; transform-box: view-box; transform-origin: 50% 50%; }
.r-glow { fill: rgba(120, 210, 255, 0.06) !important; }
.r-ticks { stroke: rgba(170, 230, 255, 0.4); stroke-width: 3.2; stroke-dasharray: 0.9 4.07; animation: spin 48s linear infinite; }
.r-arc1 { stroke: rgba(190, 238, 255, 0.85); stroke-width: 1.5; stroke-dasharray: 92 26 14 26 150 38 32 162.4; animation: spin 16s linear infinite; }
.r-arc2 { stroke: rgba(225, 248, 255, 0.5); stroke-width: 4.5; stroke-dasharray: 2 5.8; animation: spin 26s linear infinite reverse; }
.r-arc3 { stroke: rgba(170, 230, 255, 0.7); stroke-width: 1.2; stroke-dasharray: 40 15 8 15 60 15 8 15.5; animation: spin 9s linear infinite reverse; }
.r-thin { stroke: rgba(170, 230, 255, 0.28); stroke-width: 0.6; }
.r-bars line { stroke: rgba(200, 242, 255, 0.85); stroke-width: 1.5; stroke-linecap: round; }
.r-core { width: 30%; height: 30%; border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #eafaff 26%, #a9e8ff 55%, rgba(110, 200, 255, 0.35) 78%, rgba(110, 200, 255, 0) 100%);
  box-shadow: 0 0 34px 8px rgba(140, 220, 255, 0.45), 0 0 90px 26px rgba(90, 170, 255, 0.18);
  transform: scale(calc(1 + var(--lvl) * 0.2)); transition: transform 90ms linear; animation: breathe 4s ease-in-out infinite; }
.voice[data-state="listening"] .r-arc1, .voice[data-state="hearing"] .r-arc1 { animation-duration: 6s; }
.voice[data-state="listening"] .r-arc3, .voice[data-state="hearing"] .r-arc3 { animation-duration: 3.5s; }
.voice[data-state="listening"] .r-core, .voice[data-state="hearing"] .r-core { animation: none; }
.voice[data-state="thinking"] .r-arc1 { animation-duration: 1.8s; }
.voice[data-state="thinking"] .r-arc2 { animation-duration: 3s; }
.voice[data-state="thinking"] .r-arc3 { animation-duration: 1.2s; }
.voice[data-state="thinking"] .r-core { animation: breathe 1.1s ease-in-out infinite; }
.voice[data-state="speaking"] .r-core { animation: none; box-shadow: 0 0 46px 12px rgba(150, 225, 255, 0.6), 0 0 120px 34px rgba(90, 170, 255, 0.25); }
.voice[data-state="error"] .reactor { filter: grayscale(0.7) brightness(0.8); }

.home-reactor { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 8px auto 32px; color: var(--signal);
  font: 500 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.home-reactor .reactor { width: 200px; height: 200px; transition: transform var(--med) var(--ease); }
.home-reactor:hover .reactor { transform: scale(1.03); }
.home-reactor:active .reactor { transform: scale(0.98); }

.dock { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 4px 0 2px; }
.dock-side { display: flex; flex-direction: column; align-items: center; gap: 5px; justify-self: center; color: var(--fg-3); font-size: 11px; font-weight: 500; transition: color var(--fast); }
button.dock-side:hover { color: var(--fg); }
.dock-side .icon { width: 20px; height: 20px; }
.dock-mic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; color: #04121c;
  background: radial-gradient(circle at 50% 35%, #ffffff, #bfeeff 55%, #8adcff);
  box-shadow: 0 0 0 7px rgba(138, 220, 255, 0.08), 0 0 34px -4px rgba(138, 220, 255, 0.55); transition: transform var(--fast), box-shadow var(--fast); }
.dock-mic:hover { box-shadow: 0 0 0 9px rgba(138, 220, 255, 0.12), 0 0 44px -4px rgba(138, 220, 255, 0.7); }
.dock-mic:active { transform: scale(0.95); }
.dock-mic .icon { width: 26px; height: 26px; stroke-width: 1.8; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================= remote */
.remote-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 40px; align-items: start; }
.device-note { margin: 16px 8px 0; text-align: center; }
.device { --fg: #eef1f7; --fg-2: #a8afc0; --fg-3: #737b8e; --on-fg: #03050a; --line: rgba(185, 200, 235, 0.08); --line-2: rgba(185, 200, 235, 0.13);
  color: var(--fg); position: relative; padding: 26px 28px 30px; border-radius: 44px;
  background: linear-gradient(180deg, #1c2230 0%, #121722 55%, #0d111a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.6), 0 30px 60px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.6); }
.device-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.led { width: 6px; height: 6px; border-radius: 50%; background: #2a3142; transition: background 80ms, box-shadow 80ms; }
.led.on { background: var(--signal); box-shadow: 0 0 8px var(--signal); }
.key { position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: var(--fg-2);
  background: linear-gradient(180deg, #232a39, #181e2a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 0 rgba(0, 0, 0, 0.8), 0 3px 6px -2px rgba(0, 0, 0, 0.7);
  transition: transform 80ms, box-shadow 80ms, color var(--fast), background 80ms; }
.key:hover { color: var(--fg); }
.key:active, .key.pressed { transform: translateY(1px); background: linear-gradient(180deg, #1a2030, #151a25); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6); color: var(--fg); }
.key:disabled { opacity: 0.35; cursor: not-allowed; }
.key small { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font: 500 9.5px/1 var(--mono); letter-spacing: 0.06em; color: var(--fg-3); white-space: nowrap; }
.key.sm { width: 40px; height: 40px; }
.key-row { display: flex; justify-content: space-between; align-items: center; }

.dpad { position: relative; width: 236px; height: 236px; margin: 0 auto 30px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #1f2533, #121722 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -2px 6px rgba(0, 0, 0, 0.5), 0 2px 0 rgba(0, 0, 0, 0.8), 0 10px 24px -10px rgba(0, 0, 0, 0.9); }
.dpad::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity 120ms;
  background: radial-gradient(circle at var(--px, 50%) var(--py, 50%), rgba(255, 255, 255, 0.09), transparent 38%); }
.dpad.press::after { opacity: 1; }
.dpad .arrow { position: absolute; display: grid; place-items: center; color: var(--fg-3); transition: color var(--fast); }
.dpad .arrow:hover { color: var(--fg); }
.dpad .arrow .icon { width: 22px; height: 22px; }
.dpad .up { top: 0; left: 28%; width: 44%; height: 30%; }
.dpad .down { bottom: 0; left: 28%; width: 44%; height: 30%; }
.dpad .left { left: 0; top: 28%; width: 30%; height: 44%; }
.dpad .right { right: 0; top: 28%; width: 30%; height: 44%; }
.dpad .ok { position: absolute; left: 50%; top: 50%; width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%;
  font: 500 13px/1 var(--mono); letter-spacing: 0.08em; color: var(--fg-2);
  background: linear-gradient(180deg, #272e3e, #1b2130);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 6px #11151f, 0 0 0 7px rgba(255, 255, 255, 0.04), 0 4px 10px -2px rgba(0, 0, 0, 0.8);
  transition: transform 80ms, color var(--fast); }
.dpad .ok:hover { color: var(--fg); }
.dpad .ok:active { transform: scale(0.97); }

.rockers { display: grid; grid-template-columns: 56px 1fr 56px; gap: 18px; align-items: center; margin: 34px 0 30px; }
.rocker { display: flex; flex-direction: column; align-items: center; width: 56px; height: 148px; border-radius: 28px; overflow: hidden;
  background: linear-gradient(180deg, #232a39, #171d29); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 0 rgba(0, 0, 0, 0.8), 0 3px 6px -2px rgba(0, 0, 0, 0.7); }
.rocker button { flex: 1; width: 100%; display: grid; place-items: center; color: var(--fg-2); transition: background 80ms, color var(--fast); }
.rocker button:hover { color: var(--fg); }
.rocker button:active { background: rgba(0, 0, 0, 0.35); }
.rocker span { font: 500 9.5px/1 var(--mono); letter-spacing: 0.08em; color: var(--fg-3); padding: 2px 0; }
.rocker-mid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 12px; justify-items: center; }

.numpad-display { display: flex; align-items: baseline; justify-content: space-between; height: 44px; padding: 0 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.numpad-display output { font: 500 26px/1 var(--mono); letter-spacing: 0.12em; color: var(--fg); white-space: nowrap; }
.numpad-display output.blank { color: var(--fg-3); }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 0; justify-items: center; }
.numpad .key { width: 54px; height: 40px; border-radius: 20px; font: 500 16px/1 var(--mono); }
.numpad .key.go { color: var(--on-fg); background: var(--fg); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8); }

.app-glyph { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; font: 600 15px/1 var(--sans); color: #fff; flex: none; }
.inline-form { display: flex; gap: 8px; }
.app-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 6px 14px; border-radius: 12px; background: var(--bg-2);
  font-weight: 500; font-size: 13px; transition: background var(--fast), transform var(--fast); }
.app-tile:hover { background: var(--bg-3); }
.app-tile:active { transform: scale(0.98); }
.app-tile .app-glyph { width: 40px; height: 40px; border-radius: 11px; font-size: 17px; }

/* ================================================================= studio */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.tv-caption { margin: 12px 2px 0; }
.studio-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 14px; border-radius: 12px;
  background: var(--signal-dim); border: 1px solid color-mix(in srgb, var(--signal) 35%, transparent); font-size: 13px; }
.studio-bar .grow { flex: 1; }
.studio-bar .mono { color: var(--signal); font-size: 13px; }
.dot.live { background: var(--signal); animation: pulse 1.4s ease-in-out infinite; }
.tv { --line-2: rgba(185, 200, 235, 0.13); position: relative; padding: 10px; border-radius: 14px; background: #050506; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 40px 80px -40px rgba(0, 0, 0, 0.95); }
.tv canvas { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 4px; background: #000; touch-action: none; }
.inspector { display: flex; flex-direction: column; }
.inspector .seg { align-self: flex-start; flex-wrap: wrap; }
.panel { display: none; flex-direction: column; gap: 18px; animation: enter var(--med) var(--ease); }
.panel.on { display: flex; }
.modebar { display: flex; flex-wrap: wrap; gap: 16px 28px; margin-bottom: 24px; }
.mode-group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mode-row { display: grid; grid-template-columns: repeat(5, 84px); gap: 6px; }
.mode-row button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 74px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-1); color: var(--fg-2); font-size: 12.5px; font-weight: 500; white-space: nowrap;
  transition: color var(--fast), border-color var(--fast), background var(--fast); }
.mode-row button .icon { width: 20px; height: 20px; }
.mode-row button:hover { color: var(--fg); border-color: var(--line-2); }
.mode-row button.on { color: var(--fg); border-color: color-mix(in srgb, var(--signal) 55%, transparent); background: var(--signal-dim); }
.mode-row button.on .icon { color: var(--signal); }
.moods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mood { display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--fg-2); font-size: 12px; }
.mood i { display: block; height: 36px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line-2); }
.mood.on { color: var(--fg); }
.mood.on i { box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 3px var(--fg); }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swatch { display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--fg-2); font-size: 12px; }
.swatch i { display: block; height: 36px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line-2); transition: box-shadow var(--fast); }
.swatch.on { color: var(--fg); }
.swatch.on i { box-shadow: inset 0 0 0 1px var(--line-2), 0 0 0 2px var(--bg-1), 0 0 0 3px var(--fg); }
.inks { display: flex; gap: 8px; flex-wrap: wrap; }
.ink { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-3); transition: transform var(--fast); }
.ink.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--fg); }
.dropzone { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-m); border: 1px dashed var(--line-2); color: var(--fg-2); cursor: pointer; transition: border-color var(--fast), color var(--fast); }
.dropzone:hover { border-color: var(--line-3); color: var(--fg); }
input[type="range"] { width: 100%; accent-color: var(--fg); }
.gen-status { display: flex; align-items: center; gap: 10px; min-height: 20px; color: var(--fg-2); font-size: 13px; }

/* ================================================================= explore */

/* ================================================================= routines */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.cols > *, .studio > *, .remote-layout > * { min-width: 0; }  /* let long lines truncate instead of widening the grid */
.row-item { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.rows .row-item:last-child { border-bottom: 0; }
.row-item .grow { flex: 1; min-width: 0; }
.row-title { font: 500 17px/1.3 var(--serif); letter-spacing: -0.008em; }
.row-sub { margin-top: 3px; color: var(--fg-3); font: 400 12px/1.5 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .acts { display: flex; gap: 2px; opacity: 0.6; transition: opacity var(--fast); }
.row-item:hover .acts { opacity: 1; }
.time-big { font: 500 20px/1 var(--mono); letter-spacing: -0.02em; min-width: 64px; }
.empty-row { padding: 12px 0; color: var(--fg-3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

/* ================================================================= live */
.screen-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #050506; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06); display: grid; place-items: center; color: var(--fg-3); font-size: 13px; text-align: center; padding: 16px; }
.screen-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.timeline { position: relative; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; }
.stat { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; min-width: 0; }
.stat:nth-child(odd) { border-right: 1px solid var(--line); }
.stat:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
.stat .v { font: 400 20px/1.2 var(--serif); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v.mono { font: 500 15px/1.35 var(--mono); }
.stat .v .dot { display: inline-block; margin: 0 8px 0 1px; vertical-align: 0.15em; }
#statusPanel { gap: 26px; }
#statusPanel .section-head { margin-bottom: 12px; }
.event { display: grid; grid-template-columns: 64px 16px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 9px 0; }
.event time { font: 400 12px/1 var(--mono); color: var(--fg-3); text-align: right; }
.event .pip { position: relative; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: var(--ok); align-self: center; }
.event .pip.bad { background: var(--err); }
.event .pip::before { content: ""; position: absolute; left: 3px; top: 12px; width: 1px; height: 22px; background: var(--line-2); }
.event:last-child .pip::before { display: none; }
.event .what { color: var(--fg); }
.event .what em { font-style: normal; color: var(--err); }

/* ================================================================= overlays */
.toast { position: fixed; z-index: 60; left: 50%; bottom: 28px; transform: translate(-50%, 12px); max-width: min(92vw, 440px); padding: 10px 16px; border-radius: 10px;
  background: var(--fg); color: var(--on-fg); font-weight: 500; font-size: 13.5px; box-shadow: 0 12px 32px -8px var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity var(--med) var(--ease), transform var(--med) var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); color: #fff; }
.scrim { position: fixed; inset: 0; z-index: 50; display: none; background: var(--scrim); }
.scrim.on { display: block; animation: fade var(--med) var(--ease); }
@keyframes fade { from { opacity: 0; } }
.dialog { position: fixed; z-index: 51; left: 50%; top: 50%; width: min(92vw, 400px); transform: translate(-50%, -50%); padding: 24px; border-radius: var(--r-l);
  background: var(--bg-1); box-shadow: 0 0 0 1px var(--line-2), 0 30px 80px -20px var(--shadow); display: none; flex-direction: column; gap: 14px; }
.dialog.on { display: flex; animation: pop var(--med) var(--ease); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); } }
.dialog h2 { margin: 0; font: 500 23px/1.2 var(--serif); letter-spacing: -0.015em; }
.dialog p { margin: 0; color: var(--fg-2); }
.dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.drawer { position: fixed; z-index: 51; top: 0; right: 0; bottom: 0; width: min(100vw, 440px); padding: 24px; overflow-y: auto; background: var(--bg-1);
  box-shadow: -1px 0 0 var(--line-2), -30px 0 80px -20px var(--shadow); display: none; flex-direction: column; gap: 16px; }
.drawer.on { display: flex; animation: slide var(--med) var(--ease); }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { margin: 0; font: 500 23px/1.2 var(--serif); letter-spacing: -0.015em; }
.step { display: grid; grid-template-columns: 22px 140px minmax(0, 1fr) 32px; gap: 8px; align-items: center; }
.step-n { font: 500 11px/1 var(--mono); color: var(--fg-3); text-align: center; }
.drawer-foot { margin-top: auto; display: flex; gap: 8px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--line); }
details.adv summary { cursor: pointer; color: var(--fg-3); font-size: 12.5px; list-style: none; }
details.adv summary::-webkit-details-marker { display: none; }

.tabbar { display: none; }

/* ================================================================= responsive */
@media (max-width: 1080px) {
  .studio { grid-template-columns: 1fr; }
  .remote-layout { grid-template-columns: 320px minmax(0, 1fr); gap: 36px; }
  .cols { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 820px) {
  .remote-layout { grid-template-columns: 1fr; gap: 24px; }
  .device { max-width: 360px; margin: 0 auto; width: 100%; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { height: auto; min-height: 52px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; }
  .now { max-width: 58vw; }
  .page { padding: 20px 16px calc(92px + env(safe-area-inset-bottom)); }
  .thread { padding: 24px 16px 16px; gap: 22px; }
  .empty { padding-top: 3vh; }
  .empty h2 { font-size: 34px; }
  .prompt small { display: none; }
  .composer-wrap { padding: 0 12px calc(72px + env(safe-area-inset-bottom)); }
  .msg.me { max-width: 88%; }
  .step { grid-template-columns: 18px 1fr 1fr 32px; }
  .modebar { flex-direction: column; gap: 16px; margin-bottom: 18px; }
  .mode-row { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .mode-row button { height: 64px; font-size: 11px; gap: 6px; }
  .card { padding: 16px; border-radius: 14px; }
  .orb .reactor { width: 230px; height: 230px; }
  .home-reactor .reactor { width: 180px; height: 180px; }
  .voice-stage { gap: 28px; }
  .v-heard { font-size: 22px; }
  .v-reply { font-size: 20px; }
  .drawer { width: 100vw; }
  .tabbar { display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent); border-top: 1px solid var(--line); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; color: var(--fg-3); font-size: 10.5px; font-weight: 500; }
  .tabbar button.on { color: var(--fg); }
  .tabbar button.on .icon { color: var(--signal); }
  .tabbar .icon { width: 20px; height: 20px; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
