@font-face { font-family: Lexend; src: url(/assets/fonts/Lexend-400-latin.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }

/* Tokens: a dark, technical palette with one accent per teacher state. */
:root {
  --bg0: #04060d; --bg1: #0a1022; --ink: #e9eeff; --muted: #93a0c4; --faint: #5d6a8f;
  --panel: rgba(12, 18, 38, 0.82); --panel-2: rgba(255, 255, 255, 0.04); --line: rgba(140, 170, 255, 0.16); --line-2: rgba(140, 170, 255, 0.3);
  --blue: #5b8cff; --cyan: #22d3ee; --violet: #a78bfa; --pink: #f472b6; --green: #34d399; --amber: #fbbf24; --red: #fb7185;
  --accent: var(--blue); --accent-2: var(--violet);
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --r: 20px;
  --px: 0; --py: 0;
}
body[data-mode='hearing'] { --accent: var(--cyan); --accent-2: var(--green); }
body[data-mode='thinking'] { --accent: var(--violet); --accent-2: var(--pink); }
body[data-mode='teaching'] { --accent: #60a5fa; --accent-2: var(--cyan); }
body[data-mode='paused'] { --accent: var(--amber); --accent-2: var(--red); }

* { box-sizing: border-box; }
/* One screen, no page scroll: the page is exactly the viewport and every
   region inside it shrinks to fit (dvh follows phone browser bars). */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0; font-family: Lexend, system-ui, sans-serif; color: var(--ink);
  height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: radial-gradient(1200px 800px at 70% -10%, #13204a 0%, transparent 60%), radial-gradient(900px 700px at -10% 110%, #1a0f3d 0%, transparent 55%), linear-gradient(180deg, var(--bg1), var(--bg0));
  background-attachment: fixed;
}
button, input { font: inherit; color: inherit; }

/* The 2.5D scene */
.scene { position: fixed; inset: -60px; pointer-events: none; z-index: 0; }
.layer { position: absolute; inset: 0; will-change: transform; }
#space { width: 100%; height: 100%; }
/* Soft glows from gradients alone: a blur filter on big moving layers costs a repaint a frame. */
.aurora i { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; opacity: 0.34; will-change: transform; animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { left: -8%; top: -12%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 80%, transparent) 0%, color-mix(in srgb, var(--accent) 30%, transparent) 35%, transparent 70%); }
.aurora i:nth-child(2) { right: -10%; top: 10%; background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 80%, transparent) 0%, color-mix(in srgb, var(--accent-2) 30%, transparent) 35%, transparent 70%); animation-duration: 28s; }
.aurora i:nth-child(3) { left: 30%; bottom: -25%; background: radial-gradient(circle, #3b2a8fcc 0%, #3b2a8f4d 35%, transparent 68%); animation-duration: 34s; }
@keyframes drift { to { transform: translate3d(6vw, 4vh, 0) scale(1.12); } }
.floor {
  top: 55%; bottom: -40%; left: -30%; right: -30%; transform-origin: 50% 0;
  opacity: 0.35; overflow: hidden;
  transform: perspective(600px) rotateX(68deg);
  mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
}
/* The grid moves by transform (the compositor), not background-position (a repaint a frame). */
.floor::before {
  content: ''; position: absolute; left: 0; right: 0; top: -64px; bottom: 0; will-change: transform;
  background-image: linear-gradient(var(--line-2) 1px, transparent 1px), linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 64px 64px;
  animation: floor 6s linear infinite;
}
@keyframes floor { to { transform: translateY(64px); } }
.vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 50%, rgba(2, 3, 8, 0.75) 100%); }

/* The edge glow: the room listens (Siri-like) */
.edge-glow { position: fixed; inset: 0; pointer-events: none; z-index: 30; opacity: 0; transition: opacity 0.4s ease; box-shadow: inset 0 0 40px 2px var(--accent), inset 0 0 120px 10px color-mix(in srgb, var(--accent-2) 45%, transparent); }
body[data-mode='hearing'] .edge-glow { opacity: 0.9; animation: breathe 1.6s ease-in-out infinite; }
body[data-mode='thinking'] .edge-glow { opacity: 0.35; }
@keyframes breathe { 50% { opacity: 0.55; } }

/* HUD */
.hud { position: relative; z-index: 10; display: flex; align-items: center; gap: 16px; padding: clamp(8px, 1.6vh, 14px) clamp(12px, 2vw, 24px); min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 500; letter-spacing: 0.01em; white-space: nowrap; }
.brand b { font-weight: 700; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--accent)); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent); }
.hud-mid { display: flex; gap: 10px; min-width: 0; flex: 1; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);  font-size: 14px; min-width: 0; }
.chip #status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); flex: none; }
body[data-mode='hearing'] .chip .dot, body[data-mode='thinking'] .chip .dot { animation: blink 0.9s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.metric { font-family: var(--mono); font-size: 12px; color: var(--muted); max-width: 46ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric:empty { display: none; }
.controls { display: flex; gap: 8px; }
.ctl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ctl { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel);  border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 14px; transition: border-color 0.2s, box-shadow 0.2s; }
.ctl:hover { border-color: var(--accent); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.ctl[aria-pressed='false'] { color: var(--faint); }
.ctl:focus-visible, .start:focus-visible, .ask button:focus-visible, .ask input:focus-visible, .chips button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* The stage */
.stage { position: relative; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 25vw, 360px); grid-template-rows: minmax(0, 1fr); gap: clamp(12px, 1.6vw, 22px); padding: 4px clamp(12px, 2vw, 24px) clamp(10px, 2vh, 22px); width: 100%; max-width: 1680px; margin: 0 auto; min-height: 0; perspective: 1400px; }
.holo-wrap { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
/* The board is fitted to 16:9 inside this box by fitBoard() in scene.js. */
.holo-box { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.panel { position: relative; transform-style: preserve-3d; }

/* The holo board: glass, corners, a slow scan line */
.holo {
  position: relative; border-radius: var(--r); overflow: hidden;
  background: linear-gradient(160deg, rgba(20, 30, 64, 0.9), rgba(8, 12, 28, 0.94));
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.03) inset, 0 0 60px -10px color-mix(in srgb, var(--accent) 35%, transparent); 
  transition: box-shadow 0.5s ease;
}
.holo::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(600px 300px at calc(50% + var(--px) * 30%) calc(0% + var(--py) * 20%), rgba(255, 255, 255, 0.07), transparent 70%); }
#board { width: 100%; height: 100%; display: block; position: relative; }
.corner { position: absolute; width: 18px; height: 18px; border: 2px solid var(--accent); opacity: 0.8; transition: border-color 0.5s; }
.corner.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.corner.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.corner.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.corner.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }
.scan { position: absolute; left: 0; right: 0; height: 120px; top: -120px; pointer-events: none; will-change: transform; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 10%, transparent), transparent); animation: scan 7s linear infinite; }
@keyframes scan { to { transform: translateY(calc(100% + 900px)); } }
.holo.flash-success { animation: flash-ok 0.9s ease; }
.holo.flash-error { animation: flash-bad 0.9s ease; }
@keyframes flash-ok { 30% { box-shadow: 0 0 0 2px var(--green), 0 0 70px 6px color-mix(in srgb, var(--green) 55%, transparent); } }
@keyframes flash-bad { 30% { box-shadow: 0 0 0 2px var(--red), 0 0 70px 6px color-mix(in srgb, var(--red) 50%, transparent); } }

.caption { flex: none; height: 3.2em; overflow: hidden; margin: clamp(8px, 1.4vh, 16px) 6px 0; font-size: clamp(15px, min(1.5vw, 2.4vh), 22px); line-height: 1.6; color: var(--faint); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.caption span { transition: color 0.15s, text-shadow 0.15s; }
.caption .said { color: var(--ink); }
.caption .said:last-of-type { text-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent); }

/* The side panel */
.side { display: flex; flex-direction: column; gap: clamp(8px, 1.4vh, 14px); min-width: 0; min-height: 0; }
.presence { flex: none; display: flex; align-items: center; gap: 14px; padding: clamp(8px, 1.4vh, 14px); border-radius: var(--r); background: var(--panel); border: 1px solid var(--line);  }
.orb-slot { position: relative; display: grid; place-items: center; }
.orb-slot.live { width: clamp(64px, 11vh, 104px); height: clamp(64px, 11vh, 104px); flex: none; }
.orb { width: 100%; height: 100%; display: block; }
.orb-fallback { border-radius: 50%; background: radial-gradient(circle at 38% 35%, #fff 0%, var(--accent) 22%, var(--accent-2) 60%, transparent 72%); filter: drop-shadow(0 0 22px var(--accent)); }
.ripple { position: absolute; inset: 14%; border-radius: 50%; border: 2px solid var(--accent); pointer-events: none; }
.ripple-success { border-color: var(--green); }
.ripple-error { border-color: var(--red); }
.presence-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.presence .label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.presence .state { font-size: 18px; font-weight: 600; }
.meter { height: 4px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 10px var(--accent); transition: width 80ms linear; }

.ask { display: flex; gap: 8px; }
.ask input { flex: 1; min-width: 0; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel);  outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.ask input::placeholder { color: var(--faint); }
.ask input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.ask button { border: 0; border-radius: 14px; padding: 0 18px; cursor: pointer; font-weight: 600; color: #050816; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 22px -6px var(--accent); }
/* Suggestions: as many as fit in two rows; on phones one row to swipe. */
.chips { flex: none; display: flex; flex-wrap: wrap; gap: 8px; max-height: 76px; overflow: hidden; }
.ask { flex: none; }
.chips button { border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; background: var(--panel-2); color: var(--muted); font-size: 13px; cursor: pointer; text-align: left; transition: color 0.2s, border-color 0.2s, transform 0.2s; }
.chips button:hover { color: var(--ink); border-color: var(--accent); transform: translateY(-1px); }
.chips.next button { color: var(--ink); border-color: rgba(34, 211, 238, 0.45); background: rgba(34, 211, 238, 0.08); animation: chip-in 0.35s ease-out both; }
.chips.next button:nth-child(2) { animation-delay: 0.06s; }
.chips.next button:nth-child(3) { animation-delay: 0.12s; }
.chips.next button:nth-child(4) { animation-delay: 0.18s; }
@keyframes chip-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .chips.next button { animation: none; } }
/* The newest lines are on top; older ones fade out at the bottom instead of scrolling the page. */
.log { flex: 1 1 auto; min-height: 0; list-style: none; margin: 0; padding: 0 2px 4px 0; display: flex; flex-direction: column; gap: 8px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; mask-image: linear-gradient(to bottom, transparent, #000 18%); }
.log::-webkit-scrollbar { display: none; }
.log li { flex: none; }
.log li:first-child { margin-top: auto; }
.log li { padding: 10px 13px; border-radius: 14px; font-size: 14px; background: var(--panel); border: 1px solid var(--line);  max-width: 92%; }
.log li.from-you { align-self: flex-end; border-color: transparent; color: #050816; background: linear-gradient(135deg, var(--cyan), var(--blue)); }
.log li.from-you .said { all: unset; cursor: text; border-bottom: 1px dashed rgba(5, 8, 22, 0.35); }
.log li.from-you .said:hover, .log li.from-you .said:focus-visible { border-bottom-color: #050816; outline: none; }
.log li.from-you .fix { font: inherit; color: #050816; background: rgba(255, 255, 255, 0.75); border: 0; border-radius: 8px; padding: 2px 6px; width: min(60vw, 420px); max-width: 100%; }
.log li.from-you .was { display: block; margin-top: 3px; font-size: 11px; opacity: 0.7; }
.log li.from-you .or { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; opacity: 0.85; }
.log li.from-you .or button { font: inherit; color: #050816; background: rgba(255, 255, 255, 0.5); border: 0; border-radius: 999px; padding: 2px 9px; cursor: pointer; }
.log li.from-you .or button:hover { background: rgba(255, 255, 255, 0.8); }

/* The start screen */
.hero { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(6px, 1.6vh, 14px); padding: 16px; text-align: center; background: radial-gradient(ellipse at center, transparent 30%, rgba(4, 6, 13, 0.55) 85%); }
body:not(.started) .stage, body:not(.started) .hud-mid, body:not(.started) .controls { opacity: 0; pointer-events: none; }
.hero-orb { width: min(42vmin, 340px); aspect-ratio: 1; flex: none; }
.hero h1 { margin: 6px 0 0; font-size: clamp(30px, 5vw, 56px); font-weight: 700; letter-spacing: -0.02em; background: linear-gradient(90deg, #fff, #c7d2fe 40%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .sub { margin: 0; max-width: 46ch; color: var(--muted); font-size: clamp(15px, 1.8vw, 18px); }
.start { position: relative; margin-top: 12px; border: 0; border-radius: 999px; padding: 16px 34px; cursor: pointer; font-size: 18px; font-weight: 700; color: #050816; background: linear-gradient(135deg, var(--cyan), var(--blue) 50%, var(--violet)); box-shadow: 0 10px 40px -8px var(--blue), 0 0 0 1px rgba(255, 255, 255, 0.2) inset; transition: transform 0.2s, box-shadow 0.2s; }
.start::after { content: ''; position: absolute; inset: -6px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--cyan) 60%, transparent); animation: halo 2.2s ease-out infinite; }
@keyframes halo { from { opacity: 0.9; transform: scale(0.96); } to { opacity: 0; transform: scale(1.18); } }
.start:hover { transform: translateY(-2px); box-shadow: 0 16px 50px -8px var(--blue); }
.warm, .tip { margin: 0; font-size: 13px; color: var(--faint); font-family: var(--mono); }
.warm[hidden] { display: none; }

/* Tablets and phones, portrait: one column, the board as wide as the screen. */
@media (max-width: 860px) and (orientation: portrait), (max-width: 640px) {
  .stage { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .holo-box { flex: none; width: 100%; }
  .caption { height: auto; max-height: 4.8em; -webkit-line-clamp: 3; font-size: clamp(14px, 4vw, 18px); }
  .metric, .ctl .lbl, .brand > span:last-child { display: none; }
  .ctl { padding: 8px 10px; }
  .hud { gap: 10px; }
  .hud-mid { justify-content: flex-start; }
  .presence { padding: 8px 10px; gap: 10px; }
  .presence .label { display: none; }
  .presence .state { font-size: 15px; }
  .orb-slot.live { width: 56px; height: 56px; }
  .chips { flex-wrap: nowrap; max-height: none; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chips::-webkit-scrollbar { display: none; }
  .chips button { flex: none; }
  .ask input { padding: 11px 14px; }
}
/* Short screens (phones in landscape, small laptops): less chrome. */
@media (max-height: 520px) {
  .chips, .presence .label, .metric { display: none; }
  .stage { grid-template-columns: minmax(0, 1fr) clamp(220px, 30vw, 300px); }
  .orb-slot.live { width: 48px; height: 48px; }
  .caption { -webkit-line-clamp: 1; height: 1.6em; }
  .hero h1 { font-size: 26px; } .hero .sub, .tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .aurora i, .floor::before, .scan, .start::after, body[data-mode] .edge-glow, .chip .dot { animation: none !important; }
}

/* Videos to watch next: a compact row of YouTube cards that open in a new tab. */
.videos { flex: none; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.videos .v-head { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.v-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.v-row::-webkit-scrollbar { display: none; }
.v-card { flex: 0 0 auto; width: clamp(190px, 46%, 240px); display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: center; padding: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: border-color 0.2s, transform 0.2s; }
.v-card:hover, .v-card:focus-visible { border-color: var(--accent); transform: translateY(-1px); }
.v-card img { width: 84px; height: 47px; object-fit: cover; border-radius: 8px; background: #0b1024; }
.v-card .v-t { font-size: 12.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.v-card .v-m { grid-column: 2; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -4px; }
@media (max-height: 640px) { .videos { display: none; } }
.v-source .v-w { width: 84px; height: 47px; display: grid; place-items: center; border-radius: 8px; background: #f1f3f8; color: #111; font: 700 26px Georgia, 'Times New Roman', serif; }
