@property --state { syntax: "<color>"; inherits: true; initial-value: #34D8FF; }
:root {
  --cool: #34D8FF; --warm: #FF7A2E; --bg: #020308;
  --text-strong: #F2FAFF; --text: #D6E6F2; --text-body: #E2EEF6; --text-2: #A8BBCB;
  --text-btn: #B4C6D4; --muted: #7D93A6; --tab: #8DA2B4; --on-cool: #021018; --on-warm: #1C0B02;
  --listening: #4FF2A8; --thinking: #B49CFF; --danger: #FF5C6C;
  --panel: #050a12; --console: #050b15; --dock: #050b14;
  --border: rgba(160, 190, 210, 0.14); --border-cool: rgba(52, 216, 255, 0.26);
  --card: rgba(52, 216, 255, 0.05); --btn: rgba(160, 190, 210, 0.07); --btn-hover: rgba(160, 190, 210, 0.14);
  --brand: "Michroma", sans-serif; --display: "Saira", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace; --body: "Inter", system-ui, sans-serif;
  --state: #34D8FF;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--body); display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--cool); }
svg.i { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

header { height: 64px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 32px; border-bottom: 1px solid var(--border); }
.brand { font-family: var(--brand); font-size: 20px; letter-spacing: 0.24em; color: var(--text-strong); }
.brand-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.3em; color: var(--muted); padding-top: 2px; }
.chips { margin-left: auto; display: flex; gap: 26px; align-items: center; }
.chip { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--text-2); white-space: nowrap; }
.chip i { width: 5px; height: 5px; border-radius: 50%; background: var(--tone, var(--cool)); box-shadow: 0 0 8px var(--tone, var(--cool)); }
.chip.blink i { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.clock { margin-left: 40px; text-align: right; line-height: 1; }
.clock .t { font-family: var(--display); font-weight: 600; font-size: 28px; color: var(--text-strong); }
.clock .t span { color: var(--warm); }
.clock .d { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--muted); margin-top: 4px; text-transform: uppercase; }

main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; padding: 12px 32px 16px; }
.center { display: flex; flex-direction: column; min-height: 0; min-width: 0; gap: 9px; }
.stage { flex: 1; min-height: 0; display: flex; }
#stage { width: 100%; height: 100%; display: block; transition: --state 0.4s; }
#stage text { font-family: var(--mono); }
#stage .st { stroke: var(--state); }
#stage .sf { fill: var(--state); }
#stage .ss { stop-color: var(--state); }

.console { height: 56px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 6px 0 24px; background: var(--console); border: 1px solid var(--border-cool); border-radius: 28px; }
.console .prompt { font-family: var(--mono); font-weight: 500; font-size: 14px; color: var(--cool); }
.console input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text-body); font-size: 15px; caret-color: var(--cool); }
.console input::placeholder { color: var(--muted); }
.send { height: 44px; padding: 0 22px; border: 0; border-radius: 22px; background: var(--warm); color: var(--on-warm); font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.18em; display: flex; align-items: center; gap: 10px; cursor: pointer; box-shadow: 0 0 18px rgba(255, 122, 46, 0.35); }
.send:hover { background: #FF8E4D; box-shadow: 0 0 22px rgba(255, 122, 46, 0.5); }

.dock-wrap { flex: none; display: flex; justify-content: center; }
.dock { display: flex; align-items: center; padding: 5px; min-height: 56px; background: var(--dock); border: 1px solid var(--border); border-radius: 28px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.db { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border: 0; border-radius: 20px; background: transparent; color: var(--text-btn); font-family: var(--display); font-weight: 500; font-size: 12px; letter-spacing: 0.18em; cursor: pointer; white-space: nowrap; }
.db:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-strong); }
.db .ind { width: 6px; height: 6px; border-radius: 50%; background: rgba(160, 190, 210, 0.14); margin-left: 6px; }
.db.on .ind { background: var(--cool); box-shadow: 0 0 6px var(--cool); }
.db.on svg.i { color: var(--cool); }
.db.primary { height: 46px; padding: 0 22px 0 7px; gap: 12px; border-radius: 23px; background: var(--cool); color: var(--on-cool); font-weight: 600; font-size: 13px; letter-spacing: 0.2em; box-shadow: 0 0 18px rgba(52, 216, 255, 0.4); }
.db.primary:hover { background: #5DE0FF; color: var(--on-cool); }
.db.primary .badge { width: 32px; height: 32px; border-radius: 50%; background: #04131C; color: var(--cool); display: grid; place-items: center; }
.divider { width: 1px; height: 24px; background: var(--border); margin: 0 6px; flex: none; }

.side { background: var(--panel); border: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.accent { height: 2px; flex: none; background: linear-gradient(90deg, var(--cool), var(--warm)); }
.tabs { display: flex; height: 50px; flex: none; border-bottom: 1px solid var(--border); }
.tab { flex: 1; background: none; border: 0; cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.24em; color: var(--tab); }
.tab span { display: inline-block; position: relative; padding: 15px 0 13px; }
.tab.on { color: var(--text-strong); }
.tab.on span::after { content: ""; position: absolute; left: 0; right: 0.24em; bottom: -1px; height: 2px; background: var(--cool); }
.pane { flex: 1; min-height: 0; display: none; flex-direction: column; }
.pane.on { display: flex; }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.28em; color: var(--muted); text-transform: uppercase; }
.ghost { background: none; border: 0; color: var(--muted); font-family: var(--mono); font-size: 10px; padding: 2px 8px; cursor: pointer; }
.ghost:hover { background: var(--btn); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(160, 190, 210, 0.2) transparent; }

.msg { padding: 6px 14px 4px; }
.msg.you { padding-left: 48px; }
.msg.dev { padding-right: 40px; }
.who { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: 0.2em; }
.who time { font-family: var(--mono); font-weight: 400; font-size: 10px; letter-spacing: 0; color: var(--muted); }
.msg.you .who { justify-content: flex-end; color: var(--warm); }
.msg.dev .who { color: var(--cool); }
.bubble { margin-top: 6px; padding: 12px 16px; font-size: 14.5px; line-height: 1.45; color: var(--text-body); white-space: pre-wrap; overflow-wrap: anywhere; width: fit-content; max-width: 100%; }
.msg.dev .bubble { margin-left: 30px; background: rgba(52, 216, 255, 0.06); border: 1px solid rgba(52, 216, 255, 0.18); }
.msg.you .bubble { margin-left: auto; text-align: right; background: rgba(255, 122, 46, 0.06); border: 1px solid rgba(255, 122, 46, 0.18); }
.via { font-family: var(--mono); font-size: 10px; color: var(--muted); margin: 4px 0 0 30px; }
.note { font-family: var(--mono); font-size: 10.5px; line-height: 1.5; color: var(--muted); text-align: center; padding: 8px 18px 6px; }

.card { margin: 10px 14px 0; background: var(--card); border: 1px solid var(--border); padding: 10px 14px 12px; }
.card:first-child { margin-top: 14px; }
.card:last-child { margin-bottom: 14px; }
.card .label { margin-bottom: 6px; }
.big { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--text-strong); }
.hint { font-size: 11px; line-height: 1.45; color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.btn { background: var(--btn); border: 0; color: var(--text); font-family: var(--display); font-weight: 500; font-size: 12px; padding: 5px 10px; cursor: pointer; text-align: center; text-decoration: none; }
.btn:hover { background: var(--btn-hover); }
.btn.on { background: var(--cool); color: var(--on-cool); }
.seg { display: flex; gap: 4px; margin-top: 8px; }
.seg .btn { flex: 1; padding: 4px 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid3 .btn { padding: 5px 2px; }
.brain { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-weight: 500; font-size: 12px; }
.brain i { width: 6px; height: 6px; border-radius: 50%; background: var(--tone); }
.brain b { margin-left: auto; font-family: var(--mono); font-weight: 400; font-size: 10px; color: var(--tone); }
select { flex: 1; min-width: 0; background: var(--console); color: var(--text-body); border: 1px solid var(--border); padding: 5px 6px; font-size: 12px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; }
label.check input { accent-color: var(--cool); }

footer { height: 36px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 32px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 10.5px; color: var(--text-2); white-space: nowrap; }
footer .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--warm); flex: none; animation: blink 1.6s ease-in-out infinite; }
#status { overflow: hidden; text-overflow: ellipsis; }
.busy { width: 140px; height: 2px; flex: none; background: rgba(160, 190, 210, 0.15); position: relative; overflow: hidden; margin-left: 6px; display: none; }
.busy.on { display: block; }
.busy::after { content: ""; position: absolute; top: 0; height: 100%; width: 25%; background: var(--warm); animation: slide 2s linear infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(400%); } }
.lock { margin-left: auto; display: flex; align-items: center; gap: 8px; letter-spacing: 0.16em; }
.lock svg.i { color: var(--warm); width: 13px; height: 13px; }

@media (max-width: 1180px) { .chip.extra { display: none; } }
@media (max-width: 960px) {
  body { height: auto; min-height: 100vh; overflow: auto; }
  header, footer { padding: 0 16px; }
  .chips, .brand-sub { display: none; }
  .clock { margin-left: auto; }
  main { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 10px 16px 16px; }
  .stage { flex: none; }
  #stage { height: auto; }
  .side { height: 560px; }
}
@media (max-width: 600px) {
  .db .txt, .send .txt, .lock .txt { display: none; }
  .db { padding: 0 13px; }
  .db.primary { padding: 0 7px; }
  .clock .t { font-size: 22px; }
}

/* Lock screen: shown on every page load until the password is accepted. */
.gate { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle at 40% 45%, rgba(52, 216, 255, 0.08), transparent 55%), radial-gradient(circle at 60% 55%, rgba(255, 122, 46, 0.06), transparent 50%), var(--bg); }
.gate[hidden] { display: none; }
.gate-box { width: 100%; max-width: 380px; text-align: center; }
.gate-box .brand { margin-top: 18px; font-size: 26px; }
.gate-box .brand-sub { margin: 8px 0 28px; }
.gate-box form { display: flex; gap: 8px; height: 52px; padding: 5px 5px 5px 20px; background: var(--console); border: 1px solid var(--border-cool); border-radius: 26px; }
.gate-box input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text-body); font-size: 15px; caret-color: var(--cool); letter-spacing: 0.2em; }
.gate-box input::placeholder { letter-spacing: 0; color: var(--muted); }
.gate-box .send { height: 40px; padding: 0 18px; }
.gate-msg { min-height: 20px; margin-top: 14px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.gate-msg.bad { color: var(--danger); }
.gate-lock { margin-top: 26px; display: flex; justify-content: center; align-items: center; gap: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--text-2); }
.gate-lock svg.i { color: var(--warm); width: 13px; height: 13px; }

/* Voice enrollment window */
.modal { position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 3, 8, 0.8); }
.modal[hidden] { display: none; }
.modal-box { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--border); padding: 18px 22px 20px; }
.modal-title { font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: 0.2em; color: var(--cool); }
.modal-box .hint { margin-top: 6px; font-size: 12px; }
.sentence { margin: 14px 0 12px; padding: 20px 14px; background: var(--card); border: 1px solid var(--border); text-align: center; font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--text-strong); min-height: 70px; }
.meter { height: 3px; background: rgba(160, 190, 210, 0.15); margin-bottom: 10px; }
.meter i { display: block; height: 100%; width: 0; background: var(--listening); transition: width 0.08s; }
.modal-status { text-align: center; font-size: 12px; color: var(--muted); min-height: 18px; }
.modal-buttons { display: flex; justify-content: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn.primary { background: var(--cool); color: var(--on-cool); font-weight: 600; padding: 6px 18px; }
.btn.primary:hover { background: #5DE0FF; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.state-line { font-size: 12px; line-height: 1.45; }
.ok { color: var(--listening); }
.warn { color: var(--warm); }
.bad { color: var(--danger); }
.msg.guest .who { color: var(--thinking); }
.msg.guest .bubble { background: rgba(180, 156, 255, 0.06); border-color: rgba(180, 156, 255, 0.2); }
