/* Cleo — three looks on one layout.
 *
 * Picked by Rui on 2026-11-09 from the design canvas: Hologram Loom (the
 * default), Star Codex and Observation Deck, switched in Settings -> Look.
 * The markup is shared; `data-theme` on <html> picks the tokens below and
 * the few rules each look adds. The rules that carried over from the first
 * design still hold:
 *
 *   One accent, one job.  The accent marks machine state -- connected,
 *   listening, waiting. Green is him being heard; coral is something wrong.
 *
 *   The instrument has its own face.  Status, readouts and labels are set in
 *   the theme's display face; her words are set in a humanist sans, because
 *   a companion whose speech renders like a readout reads as one.
 *
 *   Every number on screen is real.
 *
 * Fonts are served from static/fonts (all SIL OFL), never fetched from
 * Google: loading them from there would tell Google every time the page
 * opens, and nothing about her is meant to leave the machine.
 */

@font-face { font-family: "Inter"; src: url("/static/fonts/inter.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Oxanium"; src: url("/static/fonts/oxanium.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("/static/fonts/cinzel.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/static/fonts/ibm-plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/static/fonts/ibm-plex-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("/static/fonts/chakra-petch-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("/static/fonts/chakra-petch-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("/static/fonts/chakra-petch-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/* --- tokens: Hologram Loom, the default -------------------------------- */

:root {
  --bg: #0a141c;
  --bg-rgb: 10 20 28;
  --card: rgb(10 30 34 / 0.55);
  --sheet: rgb(8 18 24 / 0.97);
  --line-rgb: 143 185 180;
  --line: rgb(var(--line-rgb) / 0.16);
  --line-accent: rgb(var(--accent-rgb) / 0.25);
  --key-line: rgb(var(--accent-rgb) / 0.45);

  --text: #E9FBF9;
  --soft: #CDEBE7;
  --muted: #8FB9B4;
  --dim: #6f9692;
  --faint: #4f6e6a;
  --past: #86a9a5;
  --brand: #BFF6F0;

  --accent: #46E3D4;
  --accent-rgb: 70 227 212;
  --accent-dim: #1d5752;
  --amber: #F0B977;
  --amber-rgb: 240 185 119;
  --ok: #68d6a0;
  --ok-rgb: 104 214 160;
  --warn: #e8847f;
  --warn-rgb: 232 132 127;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", sans-serif;
  --mono: "Oxanium", "Inter", ui-sans-serif, system-ui, sans-serif;
  --display: "Oxanium", "Inter", ui-sans-serif, system-ui, sans-serif;

  --backdrop:
    radial-gradient(40% 55% at 50% 45%, rgb(70 227 212 / 0.18) 0%, rgb(7 9 11 / 0) 70%),
    radial-gradient(60% 22% at 50% 100%, rgb(140 131 120 / 0.30) 0%, rgb(7 9 11 / 0) 100%),
    linear-gradient(160deg, #0c2433 0%, #0a141c 40%, #0b0f12 70%, #17130f 100%);
  --page-bottom: #15120f;
  --backdrop-narrow:
    radial-gradient(70% 45% at 50% 46%, rgb(70 227 212 / 0.20) 0%, rgb(7 9 11 / 0) 70%),
    radial-gradient(60% 30% at 50% 100%, rgb(140 131 120 / 0.28) 0%, rgb(0 0 0 / 0) 100%),
    linear-gradient(180deg, #0c2230 0%, #0a141c 45%, #0b0f12 75%, #15120f 100%);
  --deco-wide: url("/static/themes/loom-wide.svg");
  --deco-narrow: url("/static/themes/loom-narrow.svg");

  /* Her frame: a capsule inside an orbit. The wrap is the orbit's box; the
     frame sits in it at these fractions (the mockup's 460x700 drawing). */
  --wrap-ratio: 0.76;
  --fx: 0.1487;
  --fy: 0.04;
  --fw: 0.7026;
  --fh: 0.89;
  --stage-pad: 0px;
  --bezel: 0px;
  --frame-bg: none;
  --frame-radius: 9999px;
  --inner-radius: 9999px;
  --frame-shadow: 0 0 0 1.5px rgb(70 227 212 / 0.6), 0 0 80px rgb(70 227 212 / 0.35);

  --console-w: clamp(260px, 21vw, 400px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* --- tokens: Star Codex ------------------------------------------------- */

html[data-theme="codex"] {
  --bg: #0A1422;
  --bg-rgb: 10 20 34;
  --card: rgb(10 20 34 / 0.6);
  --sheet: rgb(9 17 29 / 0.97);
  --line-rgb: 240 185 119;
  --line: rgb(var(--line-rgb) / 0.16);

  --text: #F6EFE2;
  --soft: #E2D8C8;
  --muted: #C9BFAF;
  --dim: #9a9185;
  --faint: #6f695f;
  --past: #a9a092;
  --brand: #F6EFE2;

  --accent: #F0B977;
  --accent-rgb: 240 185 119;
  --accent-dim: #6b5233;

  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --display: "Cinzel", Georgia, serif;

  --backdrop:
    radial-gradient(45% 40% at 90% 95%, rgb(240 185 119 / 0.30) 0%, rgb(0 0 0 / 0) 70%),
    radial-gradient(50% 55% at 4% 72%, rgb(74 112 170 / 0.45) 0%, rgb(0 0 0 / 0) 70%),
    radial-gradient(40% 40% at 78% 8%, rgb(118 92 170 / 0.22) 0%, rgb(0 0 0 / 0) 70%),
    radial-gradient(55% 50% at 50% 28%, #23406a 0%, rgb(10 20 34 / 0) 70%),
    linear-gradient(170deg, #1b3354 0%, #0b1626 48%, #050910 100%);
  --backdrop-narrow:
    radial-gradient(70% 34% at 88% 92%, rgb(240 185 119 / 0.30) 0%, rgb(0 0 0 / 0) 70%),
    radial-gradient(80% 45% at 4% 64%, rgb(74 112 170 / 0.45) 0%, rgb(0 0 0 / 0) 70%),
    radial-gradient(70% 30% at 90% 6%, rgb(118 92 170 / 0.24) 0%, rgb(0 0 0 / 0) 70%),
    radial-gradient(90% 50% at 50% 30%, #23406a 0%, rgb(10 20 34 / 0) 70%),
    linear-gradient(180deg, #1b3354 0%, #0b1626 50%, #050910 100%);
  --page-bottom: #050910;
  --deco-wide: url("/static/themes/codex-wide.svg");
  --deco-narrow: url("/static/themes/codex-narrow.svg");

  /* A lancet arch, rimmed in gold. */
  --wrap-ratio: 0.62;
  --fx: 0;
  --fy: 0;
  --fw: 1;
  --fh: 1;
  --bezel: 7px;
  --frame-bg: linear-gradient(160deg, #F0B977, #8C8378 45%, #5E574F);
  --frame-radius: 50% 50% 0 0 / 37% 37% 0 0;
  --inner-radius: 50% 50% 0 0 / 36% 36% 0 0;
  --frame-shadow: 0 30px 70px rgb(0 0 0 / 0.45);
}

/* --- tokens: Observation Deck ------------------------------------------- */

html[data-theme="deck"] {
  --bg: #14171a;
  --bg-rgb: 20 23 26;
  --card: rgb(20 23 26 / 0.85);
  --sheet: rgb(18 21 24 / 0.98);
  --line-rgb: 201 206 211;
  --line: rgb(var(--line-rgb) / 0.14);
  --key-line: rgb(0 0 0 / 0.35);

  --text: #F4F1EC;
  --soft: #D6D0C7;
  --muted: #A9A196;
  --dim: #8a8379;
  --faint: #645e57;
  --past: #a39c92;
  --brand: #E7E3DC;

  --accent: #46E3D4;
  --accent-rgb: 70 227 212;
  --accent-dim: #22514d;

  --mono: "Chakra Petch", "Inter", ui-sans-serif, system-ui, sans-serif;
  --display: "Chakra Petch", "Inter", ui-sans-serif, system-ui, sans-serif;

  --backdrop: radial-gradient(90% 60% at 50% 0%, #2a2f35 0%, #14171a 55%, #0c0e10 100%);
  --backdrop-narrow: radial-gradient(120% 70% at 50% 0%, #2a2f35 0%, #14171a 55%, #0c0e10 100%);
  --deco-wide: none;
  --deco-narrow: none;
  --page-bottom: #0c0e10;

  /* A steel-rimmed arch with two amber lamps. */
  --wrap-ratio: 0.72;
  --fx: 0;
  --fy: 0;
  --fw: 1;
  --fh: 1;
  --bezel: 11px;
  --frame-bg: linear-gradient(160deg, #c9ced3 0%, #6f757b 32%, #2f3438 60%, #9aa1a8 100%);
  --frame-radius: 50% 50% 30px 30px / 36% 36% 30px 30px;
  --inner-radius: 50% 50% 20px 20px / 35% 35% 20px 20px;
  --frame-shadow: 0 40px 80px rgb(0 0 0 / 0.6), inset 0 0 0 1px rgb(255 255 255 / 0.25);
}

/* --- base ---------------------------------------------------------------- */

* { box-sizing: border-box; }

/* Must out-rank every display rule below. The `hidden` attribute only sets
   display:none at user-agent level, so any `display:` would otherwise win. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--page-bottom, var(--bg));
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.muted { color: var(--dim); }
.small { font-size: 12px; }
.error { color: var(--warn); font-size: 12px; font-family: var(--mono); }
.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }

button {
  font: 11px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--accent-dim);
  padding: 11px 16px;
  background: rgb(var(--accent-rgb) / 0.07);
  color: var(--accent);
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.25s;
  -webkit-tap-highlight-color: transparent;
}
button:hover:not(:disabled) { background: rgb(var(--accent-rgb) / 0.14); border-color: var(--accent); }
button:disabled { opacity: 0.35; cursor: default; }

button.ghost {
  border-color: rgb(var(--line-rgb) / 0.32);
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
}

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-dim); }
a:hover { border-bottom-color: var(--accent); }

input, select {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 10px 12px;
  background: rgb(0 0 0 / 0.35);
  border: 1px solid rgb(var(--line-rgb) / 0.24);
  border-radius: 8px;
  color: var(--text);
  font: 14px/1.4 var(--sans);
  letter-spacing: normal;
  text-transform: none;
  transition: border-color 0.15s;
}
input::placeholder { color: var(--faint); }
/* The open list is drawn by the OS: told it is dark, it stops being a white
   and blue box under a dark page. */
select { color-scheme: dark; }
select option { background: var(--bg); color: var(--text); }
input:focus, select:focus { outline: none; border-color: rgb(var(--accent-rgb) / 0.55); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgb(var(--line-rgb) / 0.2); border-radius: 4px; }
::selection { background: rgb(var(--accent-rgb) / 0.24); }

/* --- sign in --------------------------------------------------------- */

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 0%, rgb(var(--accent-rgb) / 0.08), transparent 62%), var(--backdrop);
  overflow-y: auto;
  height: 100%;
}

.gate-card {
  width: 100%;
  max-width: 360px;
  padding: 34px 30px;
  position: relative;
  background: rgb(var(--bg-rgb) / 0.6);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.gate-card h1 {
  margin: 0 0 8px;
  font: 600 16px/1 var(--display);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--brand);
}
.gate-card > p { margin: 0 0 24px; font-size: 13px; line-height: 1.6; }

form label {
  display: block;
  font: 10px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 16px;
}

#auth-form button { width: 100%; margin-top: 8px; border-radius: 8px; padding: 13px 16px; }
#auth-toggle-wrap { margin: 18px 0 0; font-size: 12px; }

/* --- the page: a desktop ------------------------------------------------- */

.app {
  position: fixed;
  inset: 0;
  isolation: isolate;
  display: grid;
  grid-template-columns: var(--console-w) minmax(0, 1fr) var(--console-w);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "top  top   top"
    "left stage right"
    "bar  bar   bar";
  gap: 14px 28px;
  padding: calc(16px + var(--safe-top)) max(28px, calc((100vw - 1680px) / 2)) calc(16px + var(--safe-bottom));
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--deco-wide) center / cover no-repeat, var(--backdrop);
}

.console   { grid-area: left; }
.telemetry { grid-area: right; }
html[data-theme="codex"] .console,
html[data-theme="deck"] .console { grid-area: right; }
html[data-theme="codex"] .telemetry,
html[data-theme="deck"] .telemetry { grid-area: left; }

/* --- the bar along the top ------------------------------------------------ */

.topbar {
  grid-area: top;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
}

.brand-wrap { display: flex; align-items: baseline; gap: 18px; min-width: 0; }
.brand {
  font: 600 22px/1 var(--display);
  letter-spacing: 0.5em;
  margin-right: -0.5em;
  text-transform: uppercase;
  color: var(--brand);
}
.brand-sub {
  font: 11px/1 var(--mono);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.brand-sub:empty { display: none; }

.nav-slot { display: flex; justify-content: center; min-width: 0; }
.nav-slot:empty { display: none; }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font: 12px/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.status .sep { margin-right: 8px; color: var(--dim); }
.st-cost { display: none; }

.state {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  transition: color 0.25s;
}

#state-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 28vw;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
  transition: background 0.25s, box-shadow 0.25s;
}

.app[data-state="listening"] .state { color: var(--accent); }
.app[data-state="listening"] .dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.app[data-state="hearing"] .state { color: var(--ok); }
.app[data-state="hearing"] .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 1.6s ease-in-out infinite; }
.app[data-state="speaking"] .state { color: var(--accent); }
.app[data-state="speaking"] .dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.app[data-state="error"] .state { color: var(--warn); }
.app[data-state="error"] .dot { background: var(--warn); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* The console's tabs, when they sit in the bar. */
.nav-slot .tabs {
  height: auto;
  padding: 0;
  border: none;
  gap: 24px;
  align-items: center;
  overflow: visible;
}
.nav-slot .tab {
  padding: 0 0 5px;
  font: 13px/1 var(--mono);
  letter-spacing: 0.22em;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.nav-slot .tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.nav-slot .close { display: none; }

/* Session and cost as a ledger (Star Codex shows it; the others do not). */
.ledger-strip { display: none; margin: 0; }

/* --- her ------------------------------------------------------------------ */

.stage {
  grid-area: stage;
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  container: stage / size;
}

.stage-fill { display: none; }

/* The frame takes whatever height the words below it leave, at its own
   shape, centred. Sized from this box rather than from the window, so the
   same rules serve a phone, a laptop and a 27-inch screen. */
.frame-box {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  container: framebox / size;
}

.frame-wrap {
  position: relative;
  width: min(100cqw, calc(100cqh * var(--wrap-ratio)));
  aspect-ratio: var(--wrap-ratio);
}

.orbit {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.frame {
  position: absolute;
  left: calc(var(--fx) * 100%);
  top: calc(var(--fy) * 100%);
  width: calc(var(--fw) * 100%);
  height: calc(var(--fh) * 100%);
  padding: var(--bezel);
  border-radius: var(--frame-radius);
  background: var(--frame-bg);
  box-shadow: var(--frame-shadow);
}

.frame-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--inner-radius);
  overflow: hidden;
  overflow: clip;
  background: #0a1422;
}

/* Her face, whichever is in use, fills the frame. */
.avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Her live face. The still, the idle loops and Anam's video are all drawn in
   one 9:16 box, cover-fitted to the frame and anchored 30% down: the three
   then line up to the pixel, whatever shape the theme gives the frame.
   Anam's 768x1152 is cropped to its own centre 9:16, which is exactly what
   the idle clips were made from. */
.anam-stage { container-type: size; overflow: hidden; }
.anam-stage .media {
  position: absolute;
  left: 50%;
  top: 30%;
  width: max(100cqw, calc(100cqh * 9 / 16));
  aspect-ratio: 9 / 16;
  transform: translate(-50%, -30%);
}
.anam-stage img,
.anam-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.anam-stage video { opacity: 0; transition: opacity 0.35s ease; }
/* Simli crops her closer than the idle clips: face 1.37x larger, lower and a
   touch left (measured 2026-11-10 against all 15 clips, in this box). While a
   Simli session opens and runs, the still and the idle clips push in to its
   framing (anam.js _framing), so the cross-fade to her live face lines up;
   they pull back out after the hand-back. The origin is the point the two
   framings share, so the zoom never uncovers an edge. */
.anam-stage .media > img,
.anam-stage .media > .idle-layer { transform-origin: var(--push-x, 51.5%) var(--push-y, 13.6%); }
.anam-stage .media > img { transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1); }
.anam-stage .media > .idle-layer {
  transition: opacity 0.33s linear, transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.anam-stage[data-provider="simli"].live-framing .media > img,
.anam-stage[data-provider="simli"].live-framing .media > .idle-layer { transform: scale(var(--push-scale, 1.37)); }
.anam-stage video.on { opacity: 1; }
.anam-stage video.cut { transition: none; }
/* Her last live frame, dissolving into the idle loop when a session ends
   (anam.js): a stream that has stopped shows black, this never does. */
.anam-stage canvas.anam-freeze {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.7s ease;
  pointer-events: none;
}
.anam-stage canvas.anam-freeze.on { opacity: 1; transition: none; }

/* --- the exchange happening now ---------------------------------------- */

.caption {
  /* The frame's box, worked out from the stage exactly as the frame is. */
  --ww: min(100cqw, 100cqh * var(--wrap-ratio));
  --wh: calc(var(--ww) / var(--wrap-ratio));
  --cap-in: 24px;
  position: absolute;
  z-index: 6;
  left: calc(var(--stage-pad) + (100cqw - var(--ww)) / 2 + var(--ww) * var(--fx) + var(--bezel) + var(--cap-in));
  width: calc(var(--ww) * var(--fw) - 2 * (var(--bezel) + var(--cap-in)));
  bottom: calc((100cqh - var(--wh)) / 2 + var(--wh) * (1 - var(--fy) - var(--fh)) + var(--bezel) + 18px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

/* A shade at the foot of the frame, so the words read over her. */
html[data-theme="codex"] .frame-inner::after,
html[data-theme="deck"] .frame-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, rgb(10 20 34 / 0) 55%, rgb(10 20 34 / 0.92) 100%);
}

/* Loom: a glass panel hovering over the projector pad. */
html[data-theme="loom"] .caption {
  width: calc(var(--ww) * 0.8);
  left: calc(var(--stage-pad) + (100cqw - var(--ww) * 0.8) / 2);
  bottom: calc((100cqh - var(--wh)) / 2 + var(--wh) * 0.03);
  padding: 12px 18px;
  border-radius: 16px;
  background: rgb(10 30 34 / 0.72);
  border: 1px solid rgb(70 227 212 / 0.35);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  text-align: left;
}
html[data-theme="loom"] .cap-hint { text-align: center; }

.cap-kicker { display: none; }

.cap-you {
  font: 12px/1.5 var(--mono);
  letter-spacing: 0.06em;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cap-tag { text-transform: uppercase; letter-spacing: 0.16em; }
#cap-you-text { color: var(--soft); letter-spacing: 0; font-family: var(--sans); }

/* Her reply as it is spoken. The newest words sit at the bottom and stay in
   view; older ones scroll up under a fade rather than pushing the box up. The
   line being said is bright, what she has already said is dimmed. */
.cap-her {
  margin: 0;
  font: 400 18px/1.45 var(--sans);
  color: var(--text);
  max-height: calc(18px * 1.45 * 3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
          mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
}
.cap-her:empty { display: none; }
.cap-her .flow { display: block; }
.cap-her .past { color: var(--past); }
.cap-her.cut .flow::after {
  content: " \2039 cut \203A";
  color: var(--faint);
  font: 12px var(--mono);
}

.cap-hint {
  margin: 0;
  font: 11px/1.4 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

/* --- the wait, named --------------------------------------------------- */

.readout {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 11px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}

.readout-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgb(var(--line-rgb) / 0.22);
  overflow: hidden;
  position: relative;
}

/* Indeterminate on purpose. There is no honest estimate of when the next
   line lands, so the bar says "working" and the counter says how long. */
.readout-bar i {
  position: absolute;
  top: 0; bottom: 0;
  width: 32%;
  background: var(--accent);
  border-radius: 2px;
  animation: sweep 1.3s ease-in-out infinite;
}

@keyframes sweep {
  from { left: -32%; }
  to   { left: 100%; }
}

#readout-time { color: var(--accent); font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; text-transform: none; }

.readout.error { color: var(--warn); }
.readout.error .readout-bar { visibility: hidden; }
.readout.error #readout-time { display: none; }
#readout-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readout.error #readout-label { white-space: normal; letter-spacing: 0.06em; text-transform: none; line-height: 1.4; }

/* --- his own picture --------------------------------------------------- */

/* Mirrored, because an unmirrored self-view is the thing everyone finds
   subtly wrong about video calls. */
.selfview {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22%;
  max-width: 180px;
  min-width: 96px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transform: scaleX(-1);
  border-radius: 12px;
  border: 1px solid rgb(var(--accent-rgb) / 0.35);
  background: #06080d;
  box-shadow: 0 6px 22px rgb(0 0 0 / 0.55);
  z-index: 6;
  opacity: 0.92;
  transition: opacity 0.25s ease, box-shadow 0.4s ease;
}
.selfview.looked {
  box-shadow: 0 6px 22px rgb(0 0 0 / 0.55), 0 0 0 2px rgb(var(--accent-rgb) / 0.75);
}

/* --- the controls -------------------------------------------------------- */

.bar { grid-area: bar; position: relative; z-index: 7; min-width: 0; }

.dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.key {
  width: 50px;
  height: 50px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--key-line);
  background: rgb(var(--bg-rgb) / 0.8);
  color: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
}
.key:hover:not(:disabled) { background: rgb(var(--accent-rgb) / 0.10); border-color: rgb(var(--accent-rgb) / 0.7); }

.key svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.key svg.fill { fill: currentColor; stroke: none; }

.key.on,
.key.active {
  color: var(--accent);
  border-color: rgb(var(--accent-rgb) / 0.7);
  background: rgb(var(--accent-rgb) / 0.12);
}

#mute-toggle .when-on { display: none; }
#mute-toggle.on .when-on { display: block; }
#mute-toggle.on .when-off { display: none; }
#mute-toggle.on { color: var(--warn); border-color: rgb(var(--warn-rgb) / 0.55); background: rgb(var(--warn-rgb) / 0.10); }

/* The microphone: the one control that matters, so the one that is large.
   Off it is grey and unlit; only a live mic glows. Off had the same bright
   accent as on, and read as listening when it wasn't (Rui, 2026-11-09). */
.key.mic {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgb(var(--text-rgb, 230 230 230) / 0.22);
  background: rgb(var(--bg-rgb) / 0.9);
  color: rgb(var(--text-rgb, 230 230 230) / 0.5);
  box-shadow: none;
  transition: background 0.25s, border-color 0.25s, color 0.25s, box-shadow 0.25s;
}
.key.mic:not(.on):hover:not(:disabled) {
  border-color: rgb(var(--accent-rgb) / 0.6);
  color: var(--text);
  background: rgb(var(--bg-rgb) / 0.9);
}
.key.mic svg { width: 28px; height: 28px; stroke-width: 1.8; }
.key.mic.on {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 6px rgb(var(--accent-rgb) / 0.16), 0 0 30px rgb(var(--accent-rgb) / 0.55);
}
.key.mic .when-muted { display: none; }
.key.mic.muted .when-muted { display: block; }
.key.mic.muted .when-live { display: none; }
/* Muted: the mic is open and nothing has to start again, but nothing he says
   reaches her. Coral, like her own mute: both mean "silence on purpose". */
.key.mic.on.muted {
  border-color: rgb(var(--warn-rgb) / 0.7);
  background: rgb(var(--warn-rgb) / 0.12);
  color: var(--warn);
  box-shadow: none;
}
.app[data-state="hearing"] .key.mic.on:not(.muted) {
  border-color: var(--ok);
  box-shadow: 0 0 0 6px rgb(var(--ok-rgb) / 0.18), 0 0 26px rgb(var(--ok-rgb) / 0.35);
}

/* A frame actually reached her. Without the pulse there is no telling "she
   looked and said nothing" from "she never saw it". */
#eyes-toggle.looked { animation: eyes-pulse 0.9s ease-out; }
@keyframes eyes-pulse {
  0%   { box-shadow: 0 0 0 0 rgb(var(--accent-rgb) / 0.55); }
  100% { box-shadow: 0 0 0 14px rgb(var(--accent-rgb) / 0); }
}

/* Typing. Always there on a desktop, among the controls. */
.k-type { display: none; }

.composer {
  flex: 0 1 560px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 54px;
  padding: 0 8px 0 22px;
  border-radius: 27px;
  background: rgb(var(--bg-rgb) / 0.75);
  border: 1px solid rgb(var(--accent-rgb) / 0.35);
  transition: border-color 0.15s;
}
.composer:focus-within { border-color: rgb(var(--accent-rgb) / 0.7); }

#composer-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 15px;
}
#composer-input:focus { border: none; }

#composer-send {
  flex: none;
  height: 38px;
  padding: 0 14px;
  border-radius: 19px;
  border: none;
  background: rgb(var(--accent-rgb) / 0.12);
}

.more-wrap { position: relative; }

.menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 9;
  min-width: 188px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--sheet);
  border: 1px solid var(--line-accent);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.6);
  animation: menu-in 0.14s ease-out;
}

@keyframes menu-in {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.menu button {
  border: none;
  background: transparent;
  color: var(--soft);
  text-align: left;
  padding: 13px 12px;
  letter-spacing: 0.14em;
  border-radius: 8px;
}
.menu button:hover:not(:disabled) { background: rgb(var(--accent-rgb) / 0.08); }
.menu button.on { color: var(--accent); }
.menu button.on::after { content: " · on"; color: var(--dim); }
.menu .danger-item { color: var(--warn); }
/* Room tone volume (ambience.js): a row in the menu, not a toggle. */
.menu-range { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  color: var(--soft); letter-spacing: 0.14em; }
.menu-range label { white-space: nowrap; font: 11px/1 var(--mono); letter-spacing: 0.16em;
  text-transform: uppercase; }
.menu-range input { flex: 1; min-width: 90px; accent-color: var(--accent); }

/* On a desktop the console's tabs are in the bar already. */
.phone-only { display: none; }

/* --- the console --------------------------------------------------------- */

.console {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tabs {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  height: 60px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  flex: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab {
  border: none;
  border-bottom: 1.5px solid transparent;
  background: none;
  padding: 0 0 15px;
  color: var(--dim);
  letter-spacing: 0.14em;
  flex: none;
}
.tab:hover:not(:disabled) { background: none; color: var(--soft); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
#memory-count { color: var(--faint); margin-left: 4px; }
.tab.on #memory-count { color: var(--muted); }

.close {
  display: none;
  margin-left: auto;
  align-self: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font: 24px/1 var(--sans);
  letter-spacing: 0;
}
.close:hover:not(:disabled) { background: none; color: var(--text); }

.console-title {
  flex: none;
  margin: 0 0 16px;
  font: 400 13px/1 var(--display);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}
.console-title:empty { display: none; }

.pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 10px 4px 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgb(var(--line-rgb) / 0.28) transparent;
}

/* The log. */
.transcript {
  display: flex;
  flex-direction: column;
  gap: 18px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px);
          mask-image: linear-gradient(to bottom, transparent 0, #000 28px);
}

/* Pushes a short log to the bottom, next to her latest words. */
.transcript::before { content: ""; margin-top: auto; }

.line .speaker {
  font: 11px/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.line .speaker .when { color: var(--dim); letter-spacing: 0.1em; }
.line.her .speaker { color: var(--accent); }

.line .text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.5;
  color: var(--soft);
}
.line.her .text { font-size: 15px; color: var(--text); }

.line.her.cut .text::after {
  content: " \2039 cut \203A";
  color: var(--faint);
  font: 11px var(--mono);
}

.line .tone {
  font: 10px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 7px;
}

.line.system {
  color: var(--dim);
  font: 11px/1.5 var(--mono);
  letter-spacing: 0.06em;
  text-align: center;
  padding: 2px 0;
}

/* Memory and settings. */
.note {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--dim);
}
.note:empty { display: none; }

.memory ul { list-style: none; margin: 14px 0 0; padding: 0; }

.memory li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--soft);
}

.memory .k {
  display: block;
  font: 10px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 5px;
}

.memory .passing {
  font: 9px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-left: 6px;
}

.memory .forget {
  background: none;
  border: none;
  color: var(--dim);
  padding: 2px 6px;
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0;
  flex: none;
}
.memory .forget:hover { color: var(--warn); background: none; }

.set {
  display: block;
  margin: 18px 0 0;
  font: 10px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.set:first-of-type { margin-top: 4px; }
.set + .note { margin-top: 8px; }
div.set { margin-bottom: 8px; }

/* Voices she knows: a row each, with a count and the buttons. */
.voiceprints { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.vp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(0 0 0 / 0.2);
}
.vp-name { flex: 1; min-width: 0; font-size: 14px; color: var(--text); }
.vp-count { display: block; font: 10px/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.vp-row button { flex: none; border-radius: 8px; padding: 8px 10px; }
.vp-row button.recording { color: var(--warn); border-color: rgb(var(--warn-rgb) / 0.6); background: rgb(var(--warn-rgb) / 0.1); }
.vp-prompt { margin: 2px 0 8px; font-size: 13px; line-height: 1.5; color: var(--soft); }
.vp-add { display: flex; gap: 6px; }
.vp-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgb(224 108 108 / 0.5);
  border-radius: 10px;
  background: rgb(224 108 108 / 0.08);
}
.vp-confirm .vp-name { font-size: 13px; }
.vp-confirm button { flex: none; width: auto; border-radius: 8px; padding: 8px 10px; }
.vp-add input { flex: 1; min-width: 0; margin-top: 0; }

/* "She is an AI", where it is always seen (EU AI Act Art. 50(1)). */
.ai-tag {
  align-self: center;
  margin-left: 8px;
  padding: 1px 6px;
  border: 1px solid rgb(var(--accent-rgb) / 0.45);
  border-radius: 4px;
  font: 600 9px/1.4 var(--mono);
  letter-spacing: 0.14em;
  color: var(--dim);
}
.ai-note { margin-top: -6px; }
.gate-card label.check { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; }
.gate-card label.check input { width: auto; margin: 0; }

/* Sign in with Google / GitHub, under the form. */
.oauth-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.oauth-buttons .button-link { justify-content: center; min-height: 42px; }

/* Settings -> Your data. */
.button-link {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  min-height: 36px;
  border: 1px solid var(--key-line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.button-link:hover { border-color: rgb(var(--accent-rgb) / 0.7); }
button.danger, .vp-add button.danger { color: #e06c6c; border-color: rgb(224 108 108 / 0.5); }
.data-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.data-actions > * { flex: 1 1 auto; justify-content: center; border-radius: 8px; padding: 8px 12px; }
.data-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid rgb(224 108 108 / 0.5);
  border-radius: 10px;
  background: rgb(224 108 108 / 0.08);
}
.data-confirm p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text); }
.data-confirm input { margin: 0; }
.data-confirm .data-actions { margin: 0; }
.app.admin #data-delete { display: none; }   /* the admin's account is not deleted from here */

/* Crisis lines: plain and readable in every look, above everything. */
.care-card {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  z-index: 50;
  width: min(560px, calc(100vw - 32px));
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgb(var(--accent-rgb) / 0.6);
  background: rgb(var(--bg-rgb) / 0.97);
  color: var(--text);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.5);
  font-size: 14px;
  line-height: 1.5;
}
.care-card .care-h { margin: 0 0 8px; font-weight: 600; }
.care-card .care-urgent { display: none; margin: 0 0 8px; font-weight: 700; }
.care-card.urgent .care-urgent { display: block; }
.care-card.urgent .care-h { display: none; }
.care-card ul { margin: 0 0 12px; padding-left: 18px; }
.care-card li { margin: 4px 0; }
.care-card a { color: var(--accent); }
.care-card button { padding: 8px 14px; border-radius: 8px; }

/* The admin's alone (Rui): costs, Insights, her brain/voice/face settings.
   Hidden until /api/me says this account is the admin. */
.app:not(.admin) [data-admin-only] { display: none !important; }

/* Onboarding (onboarding.js): the welcome form and the guided tour, in the
   look's own tokens. */
.onb { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 16px;
  background: rgb(0 0 0 / 0.55); backdrop-filter: blur(3px); overflow-y: auto; }
.onb-sheet { width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px 20px;
  background: var(--sheet); color: var(--text); border: 1px solid var(--line-accent); border-radius: 14px;
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.5); }
.onb-sheet h2 { margin: 0 0 6px; font: 600 22px/1.25 var(--display); letter-spacing: 0.02em; }
.onb-lede { margin: 0 0 16px; color: var(--soft); }
.onb-label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; letter-spacing: 0.03em; }
.onb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.onb-chip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--soft); font: inherit; font-size: 14px; cursor: pointer; }
.onb-chip[aria-pressed="true"] { border-color: var(--accent); color: var(--text);
  background: rgb(var(--accent-rgb) / 0.16); }
.onb-field { display: block; }
.onb-sheet input[type=text], .onb-sheet textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: rgb(var(--bg-rgb) / 0.6); color: var(--text); font: inherit;
  font-size: 16px; resize: vertical; }
.onb-sheet input[type=text]:focus, .onb-sheet textarea:focus { outline: 2px solid rgb(var(--accent-rgb) / 0.5); outline-offset: 1px; }
.onb-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.onb-error { min-height: 1em; margin: 8px 0 0; color: var(--warn); font-size: 13px; }
.onb-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.onb-skip, .onb-save, .tour-row button { padding: 9px 16px; border-radius: 8px; font: inherit; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--soft); }
.onb-save, .tour-next { border-color: var(--accent); background: rgb(var(--accent-rgb) / 0.18); color: var(--text); }
.onb-kept { margin: 10px 0 0; padding-left: 18px; color: var(--soft); }
.onb-sheet > input[type=text] { margin-top: 8px; }
.onb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.onb-tags:empty { display: none; }
.onb-tag { display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px 5px 12px; border-radius: 999px;
  border: 1px solid var(--accent); background: rgb(var(--accent-rgb) / 0.16); color: var(--text); font-size: 14px; }
.onb-tag-x { border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer;
  padding: 0 6px; }
.onb-tag-x:hover { color: var(--text); }
.onb-review { margin: 12px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; }
.onb-review dt { color: var(--muted); font-size: 13px; letter-spacing: 0.03em; padding-top: 2px; }
.onb-review dd { margin: 0; color: var(--text); white-space: pre-wrap; }
.onb-kept li { margin: 4px 0; }
.onb-sheet > .onb-save:last-child { margin-top: 16px; }
.tour { position: fixed; inset: 0; z-index: 9000; }
.tour.no-spot { background: rgb(0 0 0 / 0.6); }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgb(0 0 0 / 0.6);
  outline: 2px solid rgb(var(--accent-rgb) / 0.8); transition: all 0.25s ease; pointer-events: none; }
.tour-card { position: fixed; box-sizing: border-box; padding: 16px; border-radius: 12px; background: var(--sheet);
  color: var(--text); border: 1px solid var(--line-accent); box-shadow: 0 20px 60px rgb(0 0 0 / 0.5);
  transition: top 0.25s ease, left 0.25s ease; }
.tour-count { color: var(--muted); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.tour-title { margin: 4px 0 6px; font: 600 18px/1.3 var(--display); }
.tour-text { margin: 0; color: var(--soft); font-size: 15px; line-height: 1.5; }
.tour-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-gap { flex: 1; }
.tour-skip { border: 0 !important; padding-left: 0 !important; color: var(--muted) !important; }
.tour-row button:disabled { opacity: 0.4; cursor: default; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } }

/* Affection (affection.py): a moment that mattered shows as a pulse in her
   frame, warm or cool. Never a number. */
.frame.affection-up { animation: affection-up 3s ease-out; }
.frame.affection-down { animation: affection-down 3s ease-out; }
@keyframes affection-up {
  0%, 100% { box-shadow: var(--frame-shadow); }
  35% { box-shadow: var(--frame-shadow), 0 0 42px 6px rgb(255 190 140 / 0.45); }
}
@keyframes affection-down {
  0%, 100% { box-shadow: var(--frame-shadow); filter: none; }
  35% { box-shadow: var(--frame-shadow), 0 0 42px 6px rgb(120 150 190 / 0.35); filter: saturate(0.7); }
}
@media (prefers-reduced-motion: reduce) {
  .frame.affection-up, .frame.affection-down { animation-duration: 1.2s; }
}
.aff-acct { padding: 10px 0; border-top: 1px solid var(--line); }
.aff-head { display: flex; justify-content: space-between; gap: 8px; }
.aff-score { color: var(--muted); font-variant-numeric: tabular-nums; }
.aff-bar { position: relative; height: 6px; margin: 8px 0; border-radius: 3px; background: rgb(var(--line-rgb) / 0.16); }
.aff-bar i { position: absolute; top: 0; height: 100%; border-radius: 3px; }
.aff-bar i.up { background: var(--accent); }
.aff-bar i.down { background: var(--warn); }
.aff-bar b { position: absolute; left: 50%; top: -2px; width: 1px; height: 10px; background: var(--muted); }
.aff-test, .aff-ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.aff-test input[type=range] { flex: 1 1 160px; accent-color: var(--accent); }
.aff-v { min-width: 64px; color: var(--muted); font-variant-numeric: tabular-nums; }
.aff-history { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; color: var(--muted); }
.aff-history li { padding: 2px 0; }
.aff-d { display: inline-block; min-width: 28px; color: var(--text); font-variant-numeric: tabular-nums; }
/* A fresh invite link: shown once, so it stands out until copied. */
.inv-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgb(var(--accent-rgb) / 0.55);
  border-radius: 10px;
  background: rgb(var(--accent-rgb) / 0.08);
}
.inv-link input { margin: 0; font: 12px/1.4 var(--mono); }
.inv-link .vp-add button { padding: 8px 12px; }
.vp-add button { flex: none; border-radius: 8px; padding: 0 12px; }

#settings-panel #set-save { width: 100%; margin: 20px 0 10px; border-radius: 8px; padding: 13px 16px; }

/* Settings on their way: the menus say "Loading…" and breathe, so an empty
   moment reads as busy rather than broken. */
#settings-panel.loading select:not(#set-theme) { animation: settings-wait 1.2s ease-in-out infinite; }
@keyframes settings-wait { 50% { opacity: 0.45; } }

/* Add a voice: the field takes the room, the two buttons sit at its end. */
.voice-add { display: flex; gap: 6px; align-items: stretch; margin-top: 10px; }
.voice-add input { flex: 1; min-width: 0; margin-top: 0; }
.voice-add button { flex: none; border-radius: 8px; padding: 0 12px; }

button.ghost.danger {
  width: 100%;
  border-radius: 8px;
  border-color: rgb(224 108 108 / 0.35);
  color: rgb(224 138 138 / 0.9);
}
button.ghost.danger:hover:not(:disabled) {
  border-color: rgb(224 108 108 / 0.75);
  color: #f0b4b4;
  background: rgb(224 108 108 / 0.08);
}
button.ghost.danger.arming {
  border-color: rgb(224 108 108 / 0.9);
  color: #f3c0c0;
  background: rgb(224 108 108 / 0.14);
}

/* --- insights: what she costs ------------------------------------------- */

.insights .ins-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.insights .ins-kicker {
  font: 10px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.insights .ins-head button { padding: 7px 10px; border-radius: 6px; }

/* The three numbers that answer "what is this costing me". */
.ins-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.ins-hero div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 10px 10px;
  min-width: 0;
  background: var(--card);
}
.ins-hero b {
  display: block;
  font: 500 19px/1.1 var(--sans);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ins-hero span {
  display: block;
  margin-top: 6px;
  font: 9.5px/1.35 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.ins-sec { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.ins-sec h3 {
  margin: 0 0 10px;
  font: 10.5px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.ins-sec h3 small { color: var(--dim); letter-spacing: 0.08em; margin-left: 6px; }

.ins-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.ins-row + .ins-row { border-top: 1px solid var(--line); }
.ins-row .ins-k { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.ins-row .ins-v { flex: none; color: var(--text); text-align: right; }
.ins-row .ins-v small { color: var(--dim); font-size: 11px; margin-right: 8px; }
.ins-row .ins-k .ins-detail { display: block; margin-top: 2px; color: var(--dim); font-size: 11px; }

/* Used of a limit. The label says the numbers; the bar is the glance. */
.ins-gauge { margin: 4px 0 12px; }
.ins-gauge .bar {
  height: 6px;
  border-radius: 3px;
  background: rgb(var(--line-rgb) / 0.14);
  overflow: hidden;
}
.ins-gauge .bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}
.ins-gauge.over .bar i { background: var(--warn); }
.ins-gauge .lbl {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 12.5px;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.ins-gauge .lbl span:last-child { color: var(--dim); }
.ins-alert { margin: 0 0 12px; font-size: 12.5px; line-height: 1.5; color: var(--warn); }

.ins-limit { display: flex; gap: 6px; align-items: stretch; margin: 2px 0 6px; }
.ins-limit label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font: 10px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}
.ins-limit input { width: 92px; flex: none; margin: 0 0 0 auto; padding: 8px 10px; text-align: right; }
.ins-limit button { flex: none; border-radius: 8px; padding: 0 14px; }

/* Per-day bars: one series, so no legend -- the title names it. Thin bars
   with rounded tops on a shared baseline, 2px apart. */
.ins-chart { margin: 14px 0 4px; }
.ins-chart .title {
  display: flex;
  justify-content: space-between;
  font: 9.5px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}
.ins-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 64px;
  border-bottom: 1px solid rgb(var(--line-rgb) / 0.32);
}
.ins-bars button {
  flex: 1;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ins-bars button:hover:not(:disabled), .ins-bars button:focus-visible { background: rgb(var(--accent-rgb) / 0.06); }
.ins-bars i {
  display: block;
  width: 70%;
  max-width: 14px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  opacity: 0.6;
}
.ins-bars button.today i { opacity: 1; }
.ins-bars button.sel i { opacity: 1; box-shadow: 0 0 0 1px var(--text); }
.ins-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font: 9.5px/1 var(--mono);
  color: var(--faint);
}
.ins-sub {
  margin: 16px 0 2px;
  font: 9.5px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.ins-readout { margin-top: 8px; font-size: 12px; color: var(--soft); font-variant-numeric: tabular-nums; min-height: 1.4em; }

/* --- the telemetry -------------------------------------------------------- */

.telemetry {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}
.telemetry::-webkit-scrollbar { display: none; }

/* Parts only some looks have; each look turns its own on. */
.rings, .sky, .spend-plate, .mic-row, .scope, .mouth, .readouts, .tele-head { display: none; }

.tele-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgb(var(--accent-rgb) / 0.25);
  background: var(--card);
}

.tele { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.tele div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; min-width: 0; }
.tele dt {
  flex: none;
  font: 11px/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.tele dd {
  margin: 0;
  min-width: 0;
  font-size: 14px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meter {
  height: 6px;
  border-radius: 3px;
  background: rgb(var(--line-rgb) / 0.2);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ok);
  border-radius: 3px;
  transition: width 0.08s linear;
}

/* Dials: the session clock (one turn an hour) and the month's Claude spend
   against his limit. */
.rings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.ring-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 10px;
  border-radius: 20px;
  border: 1px solid rgb(var(--accent-rgb) / 0.25);
  background: var(--card);
}
.ring { width: 84px; height: 84px; }
.ring circle { fill: none; stroke: rgb(var(--accent-rgb) / 0.18); stroke-width: 6; }
.ring .ring-val {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 0 214;
  transition: stroke-dasharray 0.6s ease;
}
.ring-card.amber .ring circle { stroke: rgb(var(--amber-rgb) / 0.2); }
.ring-card.amber .ring .ring-val { stroke: var(--amber); }
.ring-num { font: 18px/1 var(--display); color: var(--text); font-variant-numeric: tabular-nums; }
.ring-k { font: 10px/1.2 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); text-align: center; }

/* --- waking her up ------------------------------------------------------ */

.booting {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
.booting.gone { opacity: 0; }

.iris {
  width: clamp(96px, 18vmin, 150px);
  height: clamp(96px, 18vmin, 150px);
  overflow: visible;
}
.iris circle { fill: none; stroke-linecap: butt; transform-origin: 60px 60px; }

.blade {
  stroke: var(--accent);
  stroke-width: 6;
  stroke-dasharray: 36 10;
  animation: iris-spin 3.4s linear infinite;
}
.blade.thin {
  stroke: rgb(var(--accent-rgb) / 0.45);
  stroke-width: 3;
  stroke-dasharray: 18 16;
  animation: iris-spin 2.6s linear infinite reverse;
}
@keyframes iris-spin { to { transform: rotate(360deg); } }

.booting-text {
  margin: 0;
  font: 11px/1 var(--mono);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  animation: booting-fade 2.4s ease-in-out infinite;
}
@keyframes booting-fade { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.9; } }

/* ==========================================================================
   Hologram Loom
   ========================================================================== */

html[data-theme="loom"] .orbit-wide { display: block; }

html[data-theme="loom"] .console {
  padding-left: 20px;
  border-left: 1px solid rgb(var(--accent-rgb) / 0.35);
}

html[data-theme="loom"] .rings { display: grid; }
html[data-theme="loom"] .tele [data-row="turns"],
html[data-theme="loom"] .tele [data-row="felt"] { display: none; }

html[data-theme="loom"] .key { color: #BFF6F0; background: rgb(10 30 34 / 0.8); }
html[data-theme="loom"] .key.mic {
  border: 1.5px solid rgb(191 246 240 / 0.18);
  background: radial-gradient(circle at 50% 40%, #2a3436, #161d1f 60%, #0c1112);
  color: rgb(191 246 240 / 0.45);
  box-shadow: none;
}
html[data-theme="loom"] .key.mic:not(.on):hover:not(:disabled) {
  border-color: rgb(70 227 212 / 0.55);
  color: #BFF6F0;
  background: radial-gradient(circle at 50% 40%, #2a3436, #161d1f 60%, #0c1112);
}
html[data-theme="loom"] .key.mic.on {
  border-color: transparent;
  background: radial-gradient(circle at 50% 40%, #8af0e6, #46E3D4 55%, #1e8f86);
  color: #062022;
  box-shadow: 0 0 0 6px rgb(70 227 212 / 0.2), 0 0 40px rgb(70 227 212 / 0.85);
}
html[data-theme="loom"] .key.mic.on.muted {
  background: radial-gradient(circle at 50% 40%, #f3b1ad, #e8847f 55%, #9b4a46);
  color: #2a0d0b;
  box-shadow: none;
}
html[data-theme="loom"] .app[data-state="hearing"] .key.mic.on:not(.muted) {
  background: radial-gradient(circle at 50% 40%, #a8f0c9, #68d6a0 55%, #2f8a5e);
  box-shadow: 0 0 0 6px rgb(104 214 160 / 0.2), 0 0 36px rgb(104 214 160 / 0.6);
}

/* Loom's dock order: mute, the box, the mic, eyes, more. */
html[data-theme="loom"] .k-mute { order: 1; }
html[data-theme="loom"] .composer { order: 2; }
html[data-theme="loom"] .key.mic { order: 3; }
html[data-theme="loom"] .k-eyes { order: 4; }
html[data-theme="loom"] .more-wrap { order: 5; }

/* ==========================================================================
   Star Codex
   ========================================================================== */

html[data-theme="codex"] .brand { font-size: 24px; letter-spacing: 0.4em; margin-right: -0.4em; }

html[data-theme="codex"] .topbar {
  padding-bottom: 14px;
  border-bottom: 1px solid rgb(240 185 119 / 0.25);
}
html[data-theme="codex"] .nav-slot .tab {
  font: 13px/1 var(--display);
  letter-spacing: 0.2em;
  text-transform: none;
  color: var(--muted);
}
html[data-theme="codex"] .nav-slot .tab.on { color: var(--accent); border-bottom-color: transparent; }

/* The ledger: session time, this session, this month. */
html[data-theme="codex"] .status .st-clock { display: none; }
html[data-theme="codex"] .status { font-size: 11px; letter-spacing: 0.14em; }
html[data-theme="codex"] .ledger-strip {
  display: flex;
  align-items: stretch;
  border: 1px solid rgb(240 185 119 / 0.35);
  border-radius: 12px;
  overflow: hidden;
  background: rgb(10 20 34 / 0.55);
}
.ledger-strip div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 16px;
}
.ledger-strip div + div { border-left: 1px solid rgb(240 185 119 / 0.25); }
.ledger-strip dt { font: 10px/1.2 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.ledger-strip dd { margin: 0; font: 16px/1.2 var(--mono); color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger-strip dd.amber { color: var(--amber); }
.ledger-strip small { font-size: 11px; color: var(--muted); }

html[data-theme="codex"] .console-title { color: var(--accent); }

/* Today's codex: every line numbered in Roman numerals. */
html[data-theme="codex"] .transcript { counter-reset: codex; }
html[data-theme="codex"] .line:not(.system) {
  counter-increment: codex;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
}
html[data-theme="codex"] .line:not(.system)::before {
  content: counter(codex, upper-roman);
  grid-row: 1 / span 3;
  font: 15px/1.1 var(--display);
  color: #8C8378;
}
html[data-theme="codex"] .line.her::before { color: var(--accent); }
html[data-theme="codex"] .line .speaker { font-size: 11px; letter-spacing: 0.08em; }
html[data-theme="codex"] .line.her .speaker { color: var(--accent); }

/* What she remembers. */
html[data-theme="codex"] .sky { display: flex; }
.sky { flex-direction: column; gap: 14px; }
.sky-head {
  margin: 0;
  font: 400 13px/1 var(--display);
  letter-spacing: 0.24em;
  color: var(--accent);
}
.sky-map {
  width: 100%;
  height: auto;
  max-height: 44vh;
  border-radius: 18px;
  background: rgb(10 20 34 / 0.6);
  border: 1px solid rgb(240 185 119 / 0.25);
}
html[data-theme="codex"] .tele-card { border-color: rgb(240 185 119 / 0.25); }
html[data-theme="codex"] .tele [data-row="face"],
html[data-theme="codex"] .tele [data-row="turns"] { display: none; }
html[data-theme="codex"] .telemetry { justify-content: flex-start; }

html[data-theme="codex"] .cap-kicker { display: block; }
html[data-theme="codex"] .cap-kicker::before {
  content: "— She speaks —";
  font: 11px/1 var(--display);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
}
html[data-theme="codex"] .cap-her { color: #F6EFE2; }

html[data-theme="codex"] .key {
  border-color: rgb(240 185 119 / 0.6);
  background: rgb(10 20 34 / 0.8);
  color: #F0B977;
}
html[data-theme="codex"] .key.mic {
  width: 66px;
  height: 66px;
  border: 2px solid rgb(246 239 226 / 0.2);
  background: radial-gradient(circle at 50% 35%, #1d2633, #0A1018);
  color: rgb(246 239 226 / 0.45);
  box-shadow: none;
}
html[data-theme="codex"] .key.mic:not(.on):hover:not(:disabled) {
  border-color: rgb(240 185 119 / 0.6);
  color: #F6EFE2;
  background: radial-gradient(circle at 50% 35%, #1d2633, #0A1018);
}
html[data-theme="codex"] .key.mic.on {
  border-color: #F0B977;
  background: radial-gradient(circle at 50% 35%, #2a3a52, #0A1422);
  color: #F6EFE2;
  box-shadow: 0 0 0 6px rgb(240 185 119 / 0.22), 0 0 34px rgb(240 185 119 / 0.6);
}
html[data-theme="codex"] .composer {
  background: rgb(10 20 34 / 0.85);
  border-color: rgb(240 185 119 / 0.45);
}

/* Codex's dock order: the box, the mic, mute, eyes, more. */
html[data-theme="codex"] .composer { order: 1; }
html[data-theme="codex"] .key.mic { order: 2; }
html[data-theme="codex"] .k-mute { order: 3; }
html[data-theme="codex"] .k-eyes { order: 4; }
html[data-theme="codex"] .more-wrap { order: 5; }

/* ==========================================================================
   Observation Deck
   ========================================================================== */

html[data-theme="deck"] .brand { font-size: 24px; letter-spacing: 0.34em; margin-right: 0; }

/* Live, how long, and what it has cost, on a lit pill. */
html[data-theme="deck"] .status {
  padding: 7px 14px;
  border: 1px solid rgb(70 227 212 / 0.45);
  border-radius: 999px;
  background: rgb(70 227 212 / 0.08);
  color: #BFF6F0;
  letter-spacing: 0.18em;
}
html[data-theme="deck"] .st-cost { display: inline; }
html[data-theme="deck"] .status .sep { color: rgb(191 246 240 / 0.5); }
html[data-theme="deck"] .state { color: #BFF6F0; }

/* The tabs as a segmented control on a taupe plate. */
html[data-theme="deck"] .nav-slot .tabs {
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: rgb(140 131 120 / 0.18);
  border: 1px solid rgb(201 206 211 / 0.18);
}
html[data-theme="deck"] .nav-slot .tab {
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: #D6D0C7;
}
html[data-theme="deck"] .nav-slot .tab.on { background: #8C8378; color: #14171a; }
html[data-theme="deck"] .nav-slot .tab.on #memory-count { color: #26282B; }

/* The arch's two amber lamps. */
html[data-theme="deck"] .frame::before,
html[data-theme="deck"] .frame::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 64px;
  margin-top: -32px;
  border-radius: 4px;
  background: #F0B977;
  box-shadow: 0 0 16px #F0B977;
  transition: box-shadow 0.3s;
}
html[data-theme="deck"] .frame::before { left: -4px; }
html[data-theme="deck"] .frame::after { right: -4px; }
html[data-theme="deck"] .app[data-state="speaking"] .frame::before,
html[data-theme="deck"] .app[data-state="speaking"] .frame::after { box-shadow: 0 0 26px #F0B977, 0 0 6px #fff3e0; }

/* The telemetry slab. */
html[data-theme="deck"] .telemetry { justify-content: stretch; }
html[data-theme="deck"] .tele-card {
  flex: 1;
  gap: 18px;
  padding: 22px;
  border: none;
  border-radius: 22px;
  background: linear-gradient(180deg, #8C8378 0%, #6E665D 100%);
  color: #1b1d20;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25), 0 18px 40px rgb(0 0 0 / 0.45);
}
html[data-theme="deck"] .tele-head {
  display: block;
  font: 12px/1 var(--mono);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #26282B;
}
html[data-theme="deck"] .tele { gap: 14px; }
html[data-theme="deck"] .tele div {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgb(38 40 43 / 0.25);
}
html[data-theme="deck"] .tele dt { font-size: 10px; color: #33302c; }
html[data-theme="deck"] .tele dd { font-size: 15px; font-weight: 500; color: #1b1d20; }
html[data-theme="deck"] .tele [data-row="face"],
html[data-theme="deck"] .tele [data-row="turns"],
html[data-theme="deck"] .tele [data-row="felt"] { display: none; }
html[data-theme="deck"] .mic-row { display: flex; flex-direction: column; gap: 8px; }
html[data-theme="deck"] .mic-k { font: 10px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: #33302c; }
html[data-theme="deck"] #t-mic { margin-left: 6px; color: #26282B; }
html[data-theme="deck"] .meter { background: rgb(38 40 43 / 0.3); }
html[data-theme="deck"] .meter i { background: #26282B; }
html[data-theme="deck"] .spend-plate {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding: 14px;
  border-radius: 14px;
  background: rgb(38 40 43 / 0.85);
  color: #E7E3DC;
}
.sp-k { font: 10px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: #F0B977; }
.sp-v { font: 500 20px/1.3 var(--sans); font-variant-numeric: tabular-nums; }
.sp-line { font-size: 12px; color: #B9B2A8; font-variant-numeric: tabular-nums; }
.sp-line b { font-weight: 500; color: #E7E3DC; }

/* The log on a dark card. */
html[data-theme="deck"] .console {
  padding: 22px;
  border-radius: 22px;
  background: rgb(20 23 26 / 0.85);
  border: 1px solid rgb(201 206 211 / 0.16);
}
html[data-theme="deck"] .console-title { color: #A9A196; font-size: 12px; }
html[data-theme="deck"] .line .speaker { font-size: 10px; color: #A9A196; }
html[data-theme="deck"] .line.her { padding-left: 12px; border-left: 2px solid var(--accent); }
html[data-theme="deck"] .line.her .speaker { color: var(--accent); }

html[data-theme="deck"] .caption { text-align: left; }
html[data-theme="deck"] .cap-kicker { display: block; }
html[data-theme="deck"] .cap-kicker::before {
  content: "Cleo";
  font: 10px/1 var(--mono);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}
html[data-theme="deck"] .cap-her { color: #F4F1EC; }
html[data-theme="deck"] .cap-hint { color: #A9A196; }

/* The control slab, under an amber light bar. */
html[data-theme="deck"] .bar { padding-top: 22px; }
html[data-theme="deck"] .bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgb(240 185 119 / 0) 0%, #F0B977 15%, #F0B977 85%, rgb(240 185 119 / 0) 100%);
  box-shadow: 0 0 18px rgb(240 185 119 / 0.6);
}
html[data-theme="deck"] .dock {
  gap: 14px;
  padding: 14px 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #8C8378 0%, #6E665D 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25);
}
html[data-theme="deck"] .key {
  border-radius: 14px;
  border: 1px solid rgb(0 0 0 / 0.35);
  background: linear-gradient(180deg, #4a4f55, #2b2f33);
  color: #E7E3DC;
}
html[data-theme="deck"] .key:hover:not(:disabled) { background: linear-gradient(180deg, #555b62, #31363b); }
html[data-theme="deck"] .key.on,
html[data-theme="deck"] .key.active { color: var(--accent); border-color: rgb(70 227 212 / 0.6); }
html[data-theme="deck"] #mute-toggle.on { color: var(--warn); border-color: rgb(var(--warn-rgb) / 0.6); }
html[data-theme="deck"] .key.mic {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgb(191 246 240 / 0.18);
  background: radial-gradient(circle at 50% 35%, #2a2e31, #141719);
  color: rgb(191 246 240 / 0.42);
  box-shadow: none;
}
html[data-theme="deck"] .key.mic:not(.on):hover:not(:disabled) {
  border-color: rgb(70 227 212 / 0.55);
  color: #BFF6F0;
  background: radial-gradient(circle at 50% 35%, #2a2e31, #141719);
}
html[data-theme="deck"] .key.mic.on {
  border-color: #46E3D4;
  background: radial-gradient(circle at 50% 35%, #2b3a3f, #151a1d);
  color: #BFF6F0;
  box-shadow: 0 0 0 6px rgb(70 227 212 / 0.16), 0 0 30px rgb(70 227 212 / 0.7);
}
html[data-theme="deck"] .composer {
  flex: 1 1 320px;
  height: 50px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  gap: 14px;
}
html[data-theme="deck"] #composer-input {
  height: 50px;
  padding: 0 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, #2b2f33, #1f2226);
  border: 1px solid rgb(0 0 0 / 0.4);
}
html[data-theme="deck"] #composer-input:focus { border: 1px solid rgb(70 227 212 / 0.5); }
html[data-theme="deck"] #composer-send {
  height: 50px;
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid rgb(0 0 0 / 0.4);
  background: #26282B;
  color: #F0B977;
  font: 13px/1 var(--mono);
  letter-spacing: 0.2em;
}

/* Deck's dock order: the mic, the box, mute, eyes, more. */
html[data-theme="deck"] .key.mic { order: 1; }
html[data-theme="deck"] .composer { order: 2; }
html[data-theme="deck"] .k-mute { order: 3; }
html[data-theme="deck"] .k-eyes { order: 4; }
html[data-theme="deck"] .more-wrap { order: 5; }

/* --- a desktop that is not very tall ------------------------------------- */

@media (min-width: 761px) and (max-height: 760px) {
  .app { row-gap: 12px; padding-top: calc(14px + var(--safe-top)); padding-bottom: calc(14px + var(--safe-bottom)); }
  .ring { width: 64px; height: 64px; }
  .ring-card { padding: 12px 8px; gap: 8px; }
  .tele-card { padding: 14px; gap: 10px; }
  html[data-theme="deck"] .tele-card { padding: 16px; gap: 12px; }
  html[data-theme="deck"] .tele div { padding-bottom: 10px; }
  html[data-theme="deck"] .bar { padding-top: 16px; }
  html[data-theme="deck"] .dock { padding: 10px 14px; }
}

/* --- phones ------------------------------------------------------------
   Her face is the page: the bar, her frame and her words, the controls.
   The console becomes a sheet that slides over her when asked for. */
@media (max-width: 760px) {
  .app {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: var(--safe-top) 0 var(--safe-bottom);
  }

  .backdrop { background: var(--deco-narrow) center / cover no-repeat, var(--backdrop-narrow); }

  .topbar {
    flex: none;
    flex-wrap: nowrap;
    padding: 10px 18px 6px;
    gap: 12px;
  }
  .brand { font-size: 18px; letter-spacing: 0.42em; }
  .nav-slot, .ledger-strip { display: none !important; }
  .status { font-size: 11px; letter-spacing: 0.16em; }
  #state-text { max-width: 34vw; }

  .stage { flex: 1 1 auto; padding: 0 4px; --stage-pad: 4px; }
  .caption { --cap-in: 16px; }
  .cap-her { font-size: 16px; max-height: calc(16px * 1.45 * 3); }
  .cap-you { font-size: 11px; }

  .telemetry { display: none; }

  .bar { flex: none; padding: 8px 14px 10px; }
  .dock { flex-wrap: wrap; justify-content: space-between; gap: 10px 0; }
  .key { width: 46px; height: 46px; }
  .key.mic { width: 68px; height: 68px; }
  .k-type { display: flex; }
  .phone-only { display: block; }

  /* Typing raises a keyboard, so the box is only there when asked for, on
     its own row above the keys. */
  .composer { display: none; order: -1 !important; flex: 1 1 100%; height: 48px; }
  .app.typing .composer { display: flex; }

  /* Every look keeps the same key order on a phone, thumb positions fixed. */
  .k-type { order: 1 !important; }
  .k-mute { order: 2 !important; }
  .key.mic { order: 3 !important; }
  .k-eyes { order: 4 !important; }
  .more-wrap { order: 5 !important; }

  .console {
    position: fixed;
    inset: 0;
    z-index: 20;
    padding: var(--safe-top) 0 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: var(--sheet) !important;
    -webkit-backdrop-filter: blur(14px);
            backdrop-filter: blur(14px);
    display: none;
    animation: sheet-in 0.18s ease-out;
  }
  .app.console-open .console { display: flex; }
  .tabs { padding: 0 8px 0 20px; gap: 16px; height: 60px; }
  .close { display: block; }
  .console-title { display: none; }
  .pane { padding: 20px 20px calc(24px + var(--safe-bottom)); }

  .selfview { width: 28%; min-width: 84px; }

  /* Loom: a capsule in its orbit, a caption box, the keys on an arc. */
  html[data-theme="loom"] {
    --wrap-ratio: 0.56;
    --fx: 0.04;
    --fy: 0.012;
    --fw: 0.92;
    --fh: 0.936;
  }
  html[data-theme="loom"] .orbit-wide { display: none; }
  html[data-theme="loom"] .orbit-narrow { display: block; }
  html[data-theme="loom"] .caption { width: calc(var(--ww) * 0.86); left: calc(var(--stage-pad) + (100cqw - var(--ww) * 0.86) / 2); padding: 10px 14px; }
  html[data-theme="loom"] .cap-her { font-size: 15px; max-height: calc(15px * 1.45 * 3); color: #E9FBF9; }
  html[data-theme="loom"] .dock { align-items: flex-start; }
  html[data-theme="loom"] .k-type,
  html[data-theme="loom"] .more-wrap { margin-top: 18px; }
  html[data-theme="loom"] .k-mute,
  html[data-theme="loom"] .k-eyes { margin-top: 6px; }
  html[data-theme="loom"] .key.mic { margin-top: -2px; }
  html[data-theme="loom"] .app.typing .composer { margin-bottom: 4px; }

  /* Codex: a centred title over the constellations. */
  html[data-theme="codex"] .topbar {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 18px 8px;
    border-bottom: none;
  }
  html[data-theme="codex"] .brand { font-size: 22px; letter-spacing: 0.36em; margin-right: -0.36em; }
  html[data-theme="codex"] .brand-wrap { justify-content: center; }
  html[data-theme="codex"] .status { font-size: 10px; color: #D9CDB8; }
  html[data-theme="codex"] .status .st-clock,
  html[data-theme="codex"] .st-cost { display: inline; }
  html[data-theme="codex"] { --wrap-ratio: 0.5625; }
  html[data-theme="codex"] .dock { justify-content: center; gap: 10px 16px; }

  /* Deck: the words sit inside the arch, over a shade at its foot. */
  html[data-theme="deck"] { --wrap-ratio: 0.5625; --bezel: 9px; }
  html[data-theme="deck"] .topbar { position: relative; }
  html[data-theme="deck"] .brand-wrap { flex-direction: column; align-items: flex-start; gap: 4px; }
  html[data-theme="deck"] .brand { font-size: 20px; letter-spacing: 0.32em; }
  html[data-theme="deck"] .brand-sub { font-size: 9.5px; letter-spacing: 0.2em; }
  html[data-theme="deck"] .status {
    position: absolute;
    top: 8px;
    right: 14px;
    padding: 4px 10px;
    font-size: 10px;
    letter-spacing: 0.14em;
    gap: 6px;
  }
  html[data-theme="deck"] .status .sep { margin-right: 6px; }
  html[data-theme="deck"] #state-text { max-width: 92px; }
  html[data-theme="deck"] .frame::before,
  html[data-theme="deck"] .frame::after { width: 6px; height: 46px; margin-top: -23px; }
  html[data-theme="deck"] .frame::before { left: -3px; }
  html[data-theme="deck"] .frame::after { right: -3px; }
  html[data-theme="deck"] .bar { margin: 0 4px; padding: 10px 0 8px; }
  html[data-theme="deck"] .dock { padding: 12px 14px; }
  html[data-theme="deck"] .key { width: 46px; height: 46px; }
  html[data-theme="deck"] .key.mic { width: 66px; height: 66px; }
  html[data-theme="deck"] .composer { height: 46px; }
  html[data-theme="deck"] #composer-input,
  html[data-theme="deck"] #composer-send { height: 46px; }
}

@keyframes sheet-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .dot, .blade, .blade.thin, .booting-text, .readout-bar i,
  .menu, .console, #eyes-toggle.looked { animation: none !important; }
  .readout-bar i { left: 0; width: 100%; opacity: 0.5; }
  #settings-panel.loading select { animation: none; opacity: 0.6; }
}

/* Her idle loops, between the still and the live video (idle.js). A clip
   swaps in on its first frame, which is the still, so the swap is a cut. */
.anam-stage .idle-layer { transition: opacity 0.33s linear; }

/* Her face hidden (More -> Hide her face): a ring where she was, breathing
   while she speaks, and her words where they always are. */
.app.face-off .frame-wrap,
.app.face-off .selfview { visibility: hidden; }
.app.face-off .frame-box::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(34cqw, 34cqh);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1.5px solid rgb(var(--accent-rgb) / 0.55);
  box-shadow: 0 0 40px rgb(var(--accent-rgb) / 0.2), inset 0 0 30px rgb(var(--accent-rgb) / 0.12);
}
.app.face-off .frame-box::after {
  content: "Voice only";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(42% + min(17cqw, 17cqh) + 18px);
  text-align: center;
  font: 11px/1 var(--mono);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--dim);
}
.app.face-off[data-state="speaking"] .frame-box::before { animation: voice-breathe 1.4s ease-in-out infinite; }
@keyframes voice-breathe {
  50% { box-shadow: 0 0 70px rgb(var(--accent-rgb) / 0.45), inset 0 0 40px rgb(var(--accent-rgb) / 0.25);
        border-color: rgb(var(--accent-rgb) / 0.9); }
}
@media (prefers-reduced-motion: reduce) {
  .app.face-off[data-state="speaking"] .frame-box::before { animation: none; }
}
/* The idle clips take z-index 1 and 2 while one fades into the next
   (idle.js), so the layers above them say where they stand: the frozen last
   frame over the clips, the live video over everything. */
.anam-stage canvas.anam-freeze { z-index: 3; }
.anam-stage #anam-video { z-index: 4; }

/* The backdrop fades out under the console, so what is in it reads cleanly
   (Rui, 2026-11-09: the circuitry ran through the settings). Soft edges, so
   it is a dimming of the room rather than a box. */
@media (min-width: 761px) {
  html[data-theme="loom"] .console,
  html[data-theme="codex"] .console { position: relative; isolation: isolate; }
  html[data-theme="loom"] .console::before,
  html[data-theme="codex"] .console::before {
    content: "";
    position: absolute;
    inset: -24px -28px -24px -48px;
    z-index: -1;
    pointer-events: none;
    background: rgb(var(--bg-rgb) / 0.9);
    -webkit-mask-image: radial-gradient(120% 100% at 45% 50%, #000 60%, transparent 100%);
            mask-image: radial-gradient(120% 100% at 45% 50%, #000 60%, transparent 100%);
  }
}

.vp-family { display: flex; align-items: center; gap: 6px; margin: 6px 0 10px; color: var(--muted); font-size: 14px; }

/* Insights -> Conversation (floor_stats.py). */
.floor-stats { display: grid; gap: 6px; margin: 8px 0 0; }
.floor-stats div { display: flex; justify-content: space-between; gap: 12px; }
.floor-stats dt { color: var(--muted); }
.floor-stats dd { margin: 0; text-align: right; }
