/* Leo HUD
   Idea: Leo is a hologram in a dark room. The hologram is the voice.
   Ice blue is you. Amber is Leo. Everything else stays quiet.
   To restyle, change the tokens in :root. */

@font-face { font-family: "Rajdhani"; font-weight: 500; font-display: swap; src: url("fonts/rajdhani-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Rajdhani"; font-weight: 600; font-display: swap; src: url("fonts/rajdhani-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Rajdhani"; font-weight: 700; font-display: swap; src: url("fonts/rajdhani-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Hind Guntur"; font-weight: 400; font-display: swap; src: url("fonts/hind-guntur-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2212,U+FEFF,U+FFFD; }
@font-face { font-family: "Hind Guntur"; font-weight: 500; font-display: swap; src: url("fonts/hind-guntur-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2212,U+FEFF,U+FFFD; }
@font-face { font-family: "Hind Guntur"; font-weight: 600; font-display: swap; src: url("fonts/hind-guntur-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2212,U+FEFF,U+FFFD; }
@font-face { font-family: "Hind Guntur"; font-weight: 400; font-display: swap; src: url("fonts/hind-guntur-telugu-400-normal.woff2") format("woff2"); unicode-range: U+0951-0952,U+0964-0965,U+0C00-0C7F,U+1CDA,U+1CF2,U+200C-200D,U+25CC; }
@font-face { font-family: "Hind Guntur"; font-weight: 500; font-display: swap; src: url("fonts/hind-guntur-telugu-500-normal.woff2") format("woff2"); unicode-range: U+0951-0952,U+0964-0965,U+0C00-0C7F,U+1CDA,U+1CF2,U+200C-200D,U+25CC; }
@font-face { font-family: "Hind Guntur"; font-weight: 600; font-display: swap; src: url("fonts/hind-guntur-telugu-600-normal.woff2") format("woff2"); unicode-range: U+0951-0952,U+0964-0965,U+0C00-0C7F,U+1CDA,U+1CF2,U+200C-200D,U+25CC; }

:root {
  --night: #060403;
  --night-up: #1C1007;
  --ink: #FFF2E0;
  --dim: #BFA283;
  --rule: rgba(255, 176, 100, .22);
  --you: #7FD4FF;
  --leo: #FFB45C;
  --warn: #FF8E7A;
  --display: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --body: "Hind Guntur", "Nirmala UI", "Noto Sans Telugu", "Segoe UI", system-ui, sans-serif;
  --step--1: .8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 2.44rem;
  --side: 19rem;
  --gutter: clamp(1rem, 2.4vw, 2rem);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 var(--step-0)/1.5 var(--body);
  background: var(--night);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  -webkit-font-smoothing: antialiased;
}
h2, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#hologram { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.bar, .deck { position: relative; z-index: 1; }
.no-hologram .stage-space { background: radial-gradient(circle at center, #FFE2AE 0, var(--leo) 5%, rgba(255, 180, 92, .12) 22%, transparent 45%); }

/* ── top bar ─────────────────────────────────────────────────────── */
.bar {
  display: grid;
  grid-template-columns: var(--side) 1fr var(--side);
  align-items: center;
  gap: var(--gutter);
  padding: calc(.7rem + env(safe-area-inset-top)) var(--gutter) .7rem;
}
.brand { display: flex; align-items: center; gap: .6rem; }
.mark { width: 1.7rem; height: 1.7rem; fill: none; stroke: var(--leo); stroke-width: 1.6; }
.mark .core { fill: #FFE2AE; stroke: none; }
.name { font: 700 var(--step-2)/1 var(--display); letter-spacing: .04em; }
.state {
  justify-self: center;
  font: 600 var(--step-1)/1.1 var(--display);
  letter-spacing: .02em;
  color: var(--dim);
  transition: color .3s;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body[data-voice="listening"] .state { color: var(--you); }
body[data-voice="speaking"] .state, body[data-voice="thinking"] .state { color: var(--leo); }
.bar-right { justify-self: end; display: flex; align-items: center; gap: 1rem; }
.clock { text-align: right; font-family: var(--display); line-height: 1.05; }
.clock time { display: block; font-weight: 600; font-size: var(--step-2); font-variant-numeric: tabular-nums; }
.clock span { font-size: var(--step--1); font-weight: 500; color: var(--dim); }

/* ── three columns: readouts | hologram | conversation ──────────── */
.deck {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr) minmax(18rem, 24rem);
  gap: var(--gutter);
  padding: 0 var(--gutter) calc(var(--gutter) + env(safe-area-inset-bottom));
  min-height: 0;
}

/* readouts: plain text beside the hologram */
.readouts { overflow-y: auto; padding-right: .25rem; display: flex; flex-direction: column; gap: 1.5rem; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.readouts h2 { font: 600 var(--step-0)/1.2 var(--display); letter-spacing: .03em; color: var(--dim); padding-bottom: .35rem; border-bottom: 1px solid var(--rule); margin-bottom: .5rem; }
.count { font: 500 var(--step-0)/1.1 var(--display); color: var(--dim); margin-bottom: .5rem; }
.count span { font-weight: 700; font-size: var(--step-3); color: var(--ink); font-variant-numeric: tabular-nums; margin-right: .2rem; }
dl > div { display: flex; align-items: baseline; gap: .5rem; padding: .16rem 0; font-size: .92rem; }
dt { color: var(--dim); flex: none; }
dl > div::before { content: ""; order: 1; flex: 1; border-bottom: 1px dotted var(--rule); transform: translateY(-.25em); }
dd { order: 2; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; max-width: 62%; }
.note { font-size: var(--step--1); color: var(--dim); margin-top: .5rem; }
.note.warn { color: var(--warn); }
.events li { padding: .3rem 0; font-size: .92rem; border-bottom: 1px dotted var(--rule); }
.events li:last-child { border-bottom: 0; }
.events time { display: block; font: 600 var(--step--1)/1.2 var(--display); color: var(--leo); letter-spacing: .02em; }
.events .empty { color: var(--dim); border: 0; font-size: var(--step--1); }
.foot { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; margin-top: auto; }

/* stage: the hologram is drawn on the canvas, centred on .stage-space */
.stage { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; justify-items: center; min-height: 0; padding-bottom: .5rem; }
.stage-space { width: 100%; min-height: 8rem; }
.controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.hint { min-height: 1.4em; margin-top: .6rem; font-size: var(--step--1); color: var(--dim); text-align: center; max-width: 34rem; }
.hint.warn { color: var(--warn); }

.talk {
  appearance: none; cursor: pointer;
  font: 700 var(--step-1)/1 var(--display); letter-spacing: .04em;
  color: var(--night); background: var(--leo);
  border: 0; border-radius: 999px;
  padding: .95rem 2.2rem .85rem;
  box-shadow: 0 0 0 1px rgba(255, 180, 92, .35), 0 0 34px rgba(255, 180, 92, .28);
  transition: transform .15s, box-shadow .2s, background .2s;
}
.talk:hover { box-shadow: 0 0 0 1px rgba(255, 180, 92, .6), 0 0 46px rgba(255, 180, 92, .45); }
.talk:active { transform: scale(.97); }
.talk[disabled] { opacity: .6; cursor: progress; }
body:not([data-voice="off"]) .talk#talk { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule); }
body:not([data-voice="off"]) .talk#talk:hover { box-shadow: inset 0 0 0 1.5px var(--warn); color: var(--warn); }

.quiet {
  appearance: none; cursor: pointer; background: none; border: 0; padding: .45rem .2rem;
  font: 600 var(--step-0)/1 var(--display); letter-spacing: .02em; color: var(--dim);
  text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: .3em;
}
.quiet:hover { color: var(--ink); }
.quiet[aria-pressed="true"] { color: var(--warn); }

/* conversation */
.talkpane { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; min-height: 0; position: relative; }
.log { overflow-y: auto; display: flex; flex-direction: column; gap: .9rem; padding: .25rem .5rem 1rem 0; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.log li { max-width: 60ch; padding-left: .85rem; border-left: 2px solid var(--rule); overflow-wrap: anywhere; }
.log li .who { display: block; font: 600 var(--step--1)/1.2 var(--display); letter-spacing: .03em; margin-bottom: .1rem; }
.log li.you { border-left-color: var(--you); }
.log li.you .who { color: var(--you); }
.log li.leo { border-left-color: var(--leo); }
.log li.leo .who { color: var(--leo); }
.log li.alert { border-left-color: var(--warn); }
.log li.alert .who { color: var(--warn); }
.log li.live { opacity: .7; }
.log .para { display: block; white-space: pre-wrap; }
.log .para + .para, .log .code + .para { margin-top: .5rem; }
.log a { color: var(--leo); text-underline-offset: .2em; }
.log code { font: .85em/1.4 ui-monospace, "Cascadia Code", Consolas, monospace; background: rgba(255, 180, 92, .1); padding: .05em .3em; border-radius: .25rem; }
.code { margin: .5rem 0 0; border: 1px solid var(--rule); border-radius: .5rem; background: rgba(10, 6, 3, .8); overflow: hidden; }
.code figcaption { display: flex; justify-content: space-between; align-items: center; padding: .25rem .7rem; font-size: var(--step--1); color: var(--dim); border-bottom: 1px solid var(--rule); }
.code button { appearance: none; cursor: pointer; border: 0; background: none; color: var(--leo); font-size: inherit; padding: .2rem 0; }
.code button:hover { text-decoration: underline; }
.code pre { margin: 0; padding: .6rem .7rem; max-height: 22rem; overflow: auto; overflow-wrap: normal; white-space: pre; font: .8rem/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.log li .meta { display: block; font-size: .72rem; color: var(--dim); margin-top: .15rem; }
.empty-log { position: absolute; inset: 0 0 4.5rem 0; display: grid; place-items: center; text-align: center; color: var(--dim); font-size: .95rem; padding: 0 1.5rem; pointer-events: none; }
.log:not(:empty) + .empty-log { display: none; }

.ask { display: flex; gap: .5rem; padding-top: .75rem; border-top: 1px solid var(--rule); }
.ask input {
  flex: 1; min-width: 0; background: rgba(10, 6, 3, .55); border: 1px solid var(--rule); border-radius: .5rem;
  padding: .7rem .9rem .55rem; outline: none;
}
.ask input::placeholder { color: var(--dim); }
.ask input:focus { border-color: var(--you); }
.ask button {
  appearance: none; cursor: pointer; border: 1px solid var(--rule); border-radius: .5rem; background: transparent;
  font: 600 var(--step-0)/1 var(--display); letter-spacing: .03em; padding: 0 1.1rem; color: var(--ink);
}
.ask button:hover { border-color: var(--you); color: var(--you); }
.ask button[disabled] { opacity: .5; cursor: progress; }

:focus-visible { outline: 2px solid var(--you); outline-offset: 3px; border-radius: 4px; }

/* lock screen */
.lock { border: 1px solid var(--rule); border-radius: .75rem; background: #120B06; color: var(--ink); padding: 2rem; width: min(24rem, calc(100vw - 2rem)); }
.lock::backdrop { background: rgba(4, 2, 1, .82); backdrop-filter: blur(6px); }
.lock h2 { font: 700 var(--step-2)/1.1 var(--display); margin-bottom: .4rem; }
.lock p { color: var(--dim); font-size: .95rem; }
.lock input { width: 100%; margin: 1.1rem 0 .4rem; background: var(--night); border: 1px solid var(--rule); border-radius: .5rem; padding: .7rem .9rem .55rem; outline: none; }
.lock input:focus { border-color: var(--you); }
.lock .talk { width: 100%; margin-top: 1rem; }

.lock input[hidden] { display: none; }
.lock #lock-again { margin-top: 0; }

/* the safety question: the one loud thing on the screen while it is open */
.confirm {
  width: min(34rem, 100%); margin-bottom: 1rem; padding: 1rem 1.2rem .9rem;
  border: 1.5px solid var(--warn); border-radius: .75rem; background: rgba(10, 6, 3, .9);
  box-shadow: 0 0 40px rgba(255, 142, 122, .18);
}
.confirm[hidden] { display: none; }
.confirm-title { font: 600 var(--step-0)/1.2 var(--display); letter-spacing: .03em; color: var(--warn); margin-bottom: .3rem; }
.confirm #confirm-text { font-size: 1.02rem; }
.confirm-actions { display: flex; align-items: center; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; }
.confirm-actions button {
  appearance: none; cursor: pointer; border-radius: 999px; padding: .55rem 1.1rem .45rem;
  font: 600 var(--step-0)/1 var(--display); letter-spacing: .02em; border: 1.5px solid var(--rule); background: transparent; color: var(--ink);
}
.confirm-actions #confirm-yes { background: var(--warn); border-color: var(--warn); color: var(--night); }
.confirm-actions #confirm-no:hover { border-color: var(--ink); }
.confirm-actions span { margin-left: auto; font-size: var(--step--1); color: var(--dim); font-variant-numeric: tabular-nums; }
.confirm .note { margin-top: .5rem; }

/* the startup check, shown once after unlock */
.log li.check { border-left-color: var(--leo); max-width: 60ch; }
.log li.check .who { color: var(--leo); }
.checks { margin-top: .4rem; }
.checks div { display: flex; align-items: baseline; gap: .5rem; padding: .12rem 0; font-size: .9rem; opacity: 0; transform: translateY(4px); animation: check-in .35s ease-out forwards; }
.checks dt { color: var(--ink); font-weight: 500; }
.checks div::before { content: ""; order: 1; flex: 1; min-width: .5rem; border-bottom: 1px dotted var(--rule); transform: translateY(-.25em); }
.checks dt { flex: none; }
.checks dd { order: 2; color: var(--dim); max-width: 72%; text-align: right; font-weight: 400; }
.checks .bad dt, .checks .bad dd { color: var(--warn); }
.checks .soft dd { color: var(--leo); }
@keyframes check-in { to { opacity: 1; transform: none; } }

.switch { display: flex; align-items: center; gap: .5rem; font-size: var(--step--1); color: var(--dim); cursor: pointer; padding: .3rem 0; }
.switch[hidden] { display: none; }
.switch input { accent-color: var(--leo); width: 1rem; height: 1rem; }

.only-small { display: none; }

/* ── medium screens: conversation narrows ────────────────────────── */
@media (max-width: 1180px) {
  :root { --side: 15.5rem; }
  .deck { grid-template-columns: var(--side) minmax(0, 1fr) minmax(16rem, 20rem); }
}

/* ── phone and small tablets: hologram on top, conversation below ─────── */
@media (max-width: 860px) {
  body { overflow: hidden; }
  .only-small { display: inline-block; }
  .bar { grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; }
  .mark { display: none; }
  .bar-right { gap: .75rem; }
  .state { font-size: var(--step-0); }
  .clock span { display: none; }
  .clock time { font-size: var(--step-1); }
  .deck { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(13.5rem, 38vh) minmax(0, 1fr); gap: .5rem; }
  .stage, .talkpane { min-width: 0; }
  .stage { grid-row: 1; }
  .talkpane { grid-row: 2; }
  .talk { font-size: var(--step-0); padding: .8rem 1.8rem .7rem; }
  .readouts {
    position: fixed; z-index: 5; inset: 0; padding: calc(4.2rem + env(safe-area-inset-top)) var(--gutter) 2rem;
    background: rgba(10, 6, 3, .96); display: none;
  }
  body[data-readouts="open"] .readouts { display: flex; }
  body[data-readouts="open"] .bar { z-index: 6; }
  .ask input { font-size: 16px; }   /* stops the phone from zooming in */
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .checks div { animation: none; opacity: 1; transform: none; }
}
