/* Tessa: warm whiteboard (light) and chalkboard (dark) themes. */
:root {
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Kalam", "Segoe Print", "Comic Sans MS", cursive;
  --accent: #ff6a3d;
  --accent-2: #7c5cff;
  --lvl: 0;
  --mic: 0;
}

:root[data-theme="light"] {
  --board: #fbfaf6;
  --board-dot: rgba(36, 41, 51, 0.11);
  --c-ink: #20242c;
  --c-blue: #1f5fbf;
  --c-red: #d9363e;
  --c-green: #2c8746;
  --c-orange: #dd6418;
  --c-teal: #0f7886;
  --c-gray: #737b85;
  --c-student: #7c3aed;
  --c-hl: rgba(255, 210, 0, 0.42);
  --ui: rgba(255, 255, 255, 0.84);
  --ui-solid: #ffffff;
  --ui-border: rgba(24, 28, 36, 0.09);
  --ui-text: #1d2129;
  --ui-muted: #69707b;
  --ui-hover: rgba(24, 28, 36, 0.055);
  --ui-active: #1d2129;
  --ui-active-text: #ffffff;
  --shadow: 0 1px 2px rgba(16, 20, 28, 0.06), 0 12px 32px -10px rgba(16, 20, 28, 0.22);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --board: #18211d;
  --board-dot: rgba(255, 255, 255, 0.075);
  --c-ink: #eef1ea;
  --c-blue: #8fcbff;
  --c-red: #ff8f88;
  --c-green: #97e2a7;
  --c-orange: #ffbf7e;
  --c-teal: #77dbe0;
  --c-gray: #a7b1aa;
  --c-student: #cbb8ff;
  --c-hl: rgba(255, 226, 92, 0.3);
  --ui: rgba(30, 37, 33, 0.84);
  --ui-solid: #1f2723;
  --ui-border: rgba(255, 255, 255, 0.09);
  --ui-text: #eef1ea;
  --ui-muted: #9ca69f;
  --ui-hover: rgba(255, 255, 255, 0.07);
  --ui-active: #eef1ea;
  --ui-active-text: #18211d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -10px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--board);
  color: var(--ui-text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
svg { display: block; }

/* ------------------------------------------------------------------ board */
.board {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background-color: var(--board);
  background-image: radial-gradient(circle at 1.5px 1.5px, var(--board-dot) 1.3px, transparent 1.6px);
  background-size: 34px 34px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.board.panning, .board.panning-ready { cursor: grabbing; }
.board[data-tool="pen"], .board[data-tool="highlighter"] { cursor: crosshair; }
.board[data-tool="eraser"] { cursor: cell; }

.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.overlay, .ink-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
}
.overlay { z-index: 5; }
.ink-layer { z-index: 6; }
.ink-pen { fill: var(--c-student); }
.ink-hl { fill: var(--c-hl); mix-blend-mode: multiply; }
:root[data-theme="dark"] .ink-hl { mix-blend-mode: screen; }

.pen-cursor {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.25s ease;
  --pen: var(--c-ink);
}
.pen-cursor.on { opacity: 1; }
.pen-cursor svg { margin: -33px 0 0 -30px; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.2)); }

.board-hint {
  position: absolute;
  left: 0;
  top: 150px;
  width: 1280px;
  display: grid;
  gap: 2px;
  text-align: center;
  font-family: var(--font-hand);
  color: var(--c-gray);
  opacity: 0.5;
  pointer-events: none;
}
.board-hint span:first-child { font-size: 46px; font-weight: 700; }
.board-hint span:last-child { font-size: 28px; }
body:not(.started) .board-hint { opacity: 0; }

/* ------------------------------------------------------------------ blocks */
.block {
  position: absolute;
  left: 0;
  top: 0;
  width: max-content;
  font-family: var(--font-hand);
  color: var(--c-ink);
}
.block .w { display: inline-block; }
.block .w.m { padding: 0 1px; }

.b-title {
  position: relative;
  display: inline-block;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 16px;
}
.b-title-line {
  position: absolute;
  left: -4px;
  bottom: -12px;
  width: 1px;
  height: 1px;
  overflow: visible;
}

.block-section { width: 1280px; }
.section-title { font-size: 52px; font-weight: 700; line-height: 1.1; color: var(--c-ink); }
.section-line { margin-top: 2px; overflow: visible; }

.block-notes { max-width: 580px; font-size: 25px; line-height: 1.42; }
.block-notes .line { display: flex; gap: 10px; align-items: baseline; }
.block-notes .marker { font-weight: 700; min-width: 16px; }
.block-notes .marker.num { min-width: 26px; }
.block-notes.style-definition .line:first-child .body { font-size: 29px; font-weight: 700; }
.block-notes.style-callout { position: absolute; }
.callout-box { position: absolute; left: -12px; top: -12px; overflow: visible; z-index: -1; pointer-events: none; }

.block .katex { font-size: 1.08em; }
.block-math .math-line { display: flex; align-items: center; gap: 24px; min-height: 52px; }
.block-math .tex { font-size: 25px; }
.block-math .katex-display { margin: 4px 0; text-align: left; }
.block-math .katex-display > .katex { text-align: left; }
.math-note { font-size: 21px; line-height: 1.25; color: var(--c-teal); max-width: 300px; }

.diagram-svg, .plot-svg, .sketch-svg, .section-line { overflow: visible; }
.node-label { font-family: var(--font-hand); font-size: 24px; font-weight: 700; fill: var(--c-ink); }
.node-detail { font-family: var(--font-hand); font-size: 17px; fill: var(--c-gray); }
.edge-label {
  font-family: var(--font-hand);
  font-size: 18px;
  fill: var(--c-gray);
  paint-order: stroke;
  stroke: var(--board);
  stroke-width: 7px;
  stroke-linejoin: round;
}

.plot-svg text { font-family: var(--font-hand); }
.plot-grid line { stroke: var(--c-gray); stroke-opacity: 0.2; stroke-dasharray: 2 7; }
.tick { font-size: 15px; fill: var(--c-gray); }
.axis-label { font-size: 19px; fill: var(--c-ink); font-weight: 700; }
.curve { fill: none; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.shade { opacity: 0.2; }
.guide line { stroke: var(--c-gray); stroke-width: 1.6; stroke-dasharray: 7 6; }
.guide-label { font-size: 16px; fill: var(--c-gray); paint-order: stroke; stroke: var(--board); stroke-width: 5px; }
.pt-label { font-size: 18px; font-weight: 700; paint-order: stroke; stroke: var(--board); stroke-width: 5px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 20px; margin: 0 0 0 58px; }
.legend-item i { display: inline-block; width: 22px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 8px; }
.sliders { display: grid; gap: 4px; margin: 10px 0 0 58px; width: 500px; }
.slider { display: grid; grid-template-columns: auto 56px 1fr; align-items: center; gap: 10px; font-size: 21px; cursor: default; }
.slider-name { font-weight: 700; }
.slider-val { color: var(--c-blue); font-weight: 700; }
.slider input { width: 100%; accent-color: var(--c-blue); cursor: pointer; }

.sketch-text { font-family: var(--font-hand); paint-order: stroke; stroke: var(--board); stroke-width: 5px; stroke-linejoin: round; }
.sketch-label {
  font-family: var(--font-hand);
  font-size: 19px;
  font-weight: 700;
  paint-order: stroke;
  stroke: var(--board);
  stroke-width: 6px;
  stroke-linejoin: round;
}

.table-wrap { position: relative; }
.table-lines { position: absolute; left: -4px; top: -4px; pointer-events: none; overflow: visible; }
.hand-table { border-collapse: collapse; font-size: 22px; line-height: 1.3; }
.hand-table th, .hand-table td { padding: 8px 20px; text-align: left; vertical-align: top; max-width: 300px; }
.hand-table th { font-weight: 700; color: var(--c-blue); }

.image-frame { position: relative; width: 560px; height: 420px; display: grid; place-items: center; }
.image-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  font-size: 23px;
  color: var(--c-gray);
  border: 2.5px dashed color-mix(in srgb, var(--c-gray) 45%, transparent);
  border-radius: 18px;
}
.image-placeholder .scribble {
  fill: none;
  stroke: var(--c-gray);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
}
.image-placeholder.busy .scribble { animation: scribble 1.7s ease-in-out infinite; }
.image-placeholder.failed { border-style: dotted; opacity: 0.6; }
@keyframes scribble {
  0% { stroke-dashoffset: 260; }
  55% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -260; }
}
/* The page makes the picture's white paper transparent, so it sits right on the board. */
.illustration { width: 100%; height: 100%; object-fit: contain; }
.img-region { position: absolute; pointer-events: none; }
:root[data-theme="dark"] .illustration { filter: invert(1) hue-rotate(180deg) saturate(1.15) brightness(1.1); }
.image-caption { max-width: 560px; margin-top: 8px; text-align: center; font-size: 21px; color: var(--c-gray); }

.hl-note {
  font-family: var(--font-hand);
  font-size: 23px;
  font-weight: 700;
  paint-order: stroke;
  stroke: var(--board);
  stroke-width: 7px;
  stroke-linejoin: round;
}

/* ------------------------------------------------------------------ chrome */
.glass {
  background: var(--ui);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--ui-border);
  box-shadow: var(--shadow);
}

.topbar {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.presence {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 20px 7px 8px;
  border-radius: 999px;
}
.who .name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.who .status { font-size: 12.5px; color: var(--ui-muted); min-width: 120px; transition: color 0.2s; }
body[data-mode="speaking"] .who .status { color: var(--accent); }
body[data-mode="hearing"] .who .status { color: var(--c-student); }

/* Tessa's orb: breathes with her voice, swirls while thinking. */
.orb {
  position: relative;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffe0bf 0%, #ff8a5c 38%, #ff5a36 62%, #7c5cff 112%);
  transform: scale(calc(1 + var(--lvl) * 0.18));
  box-shadow: 0 0 calc(4px + var(--lvl) * 30px) rgba(255, 106, 61, calc(0.25 + var(--lvl) * 0.45));
}
.orb i { position: absolute; inset: 0; border-radius: 50%; }
.orb i:nth-child(1) {
  background: conic-gradient(from 0deg, transparent 0 25%, rgba(124, 92, 255, 0.55) 45%, transparent 70%);
  animation: spin 7s linear infinite;
  mix-blend-mode: soft-light;
}
.orb i:nth-child(2) { background: radial-gradient(circle at 70% 75%, rgba(255, 255, 255, 0.5), transparent 42%); }
.orb i:nth-child(3) {
  inset: -6px;
  border: 2px solid rgba(255, 106, 61, 0.5);
  opacity: calc(var(--lvl) * 1.3);
  transform: scale(calc(0.92 + var(--lvl) * 0.3));
}
body[data-mode="thinking"] .orb i:nth-child(1) { animation-duration: 1.1s; mix-blend-mode: normal; }
body[data-mode="drawing"] .orb i:nth-child(1) { animation-duration: 2.2s; }
body[data-mode="hearing"] .orb i:nth-child(3) { border-color: var(--c-student); }
body[data-mode="offline"] .orb, body[data-mode="muted"] .orb { filter: grayscale(0.9); opacity: 0.6; }
body[data-mode="listening"] .orb { animation: breathe 4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.045); } }

.top-actions { display: flex; gap: 2px; padding: 4px; border-radius: 15px; }
.icon-btn {
  height: 38px;
  min-width: 38px;
  padding: 0 9px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 600;
}
.icon-btn:hover { background: var(--ui-hover); }
.record-btn { font-variant-numeric: tabular-nums; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c-red); flex: none; }
.record-btn.recording { color: var(--c-red); }
.record-btn.recording .rec-dot { background: var(--c-red); animation: rec-pulse 1.2s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: 0.35; } }
.icon-btn b:empty { display: none; }
.icon-btn b {
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: inline-grid;
  place-items: center;
}
.icon-btn svg, .dock svg, .dropzone svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* dock */
.dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 24px;
  max-width: calc(100vw - 24px);
}
.mic {
  position: relative;
  width: 50px;
  height: 50px;
  flex: none;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(140deg, #ff8456, #ff5a36);
  box-shadow: 0 0 0 calc(var(--mic) * 9px) rgba(255, 106, 61, 0.22), 0 6px 16px -6px rgba(255, 90, 54, 0.7);
  transition: box-shadow 0.08s linear, background 0.2s;
}
.mic svg { width: 22px; height: 22px; stroke-width: 2; }
.mic .i-off { display: none; }
.mic.muted { background: var(--ui-hover); color: var(--ui-muted); box-shadow: none; }
.mic.muted .i-on { display: none; }
.mic.muted .i-off { display: block; }

.type {
  display: flex;
  align-items: center;
  width: min(400px, 36vw);
  height: 46px;
  padding: 0 5px 0 15px;
  border-radius: 15px;
  background: var(--ui-hover);
}
.type input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ui-text);
  font: 15px var(--font-ui);
}
.type input::placeholder { color: var(--ui-muted); }
.send {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 11px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: transparent;
  color: var(--ui-muted);
}
.type:focus-within { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); }
.type:focus-within .send { background: var(--ui-active); color: var(--ui-active-text); }

.sep { width: 1px; height: 26px; background: var(--ui-border); margin: 0 3px; flex: none; }
.tools { display: flex; gap: 2px; }
.tools button, .tool-btn {
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ui-muted);
  background: transparent;
  transition: background 0.15s, color 0.15s;
}
.tools button:hover, .tool-btn:hover { background: var(--ui-hover); color: var(--ui-text); }
.tools button.active { background: var(--ui-active); color: var(--ui-active-text); }
.tools button[data-tool="pen"].active { background: var(--c-student); color: #fff; }
#follow-btn.attention { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
#follow-btn .dot { fill: currentColor; }

/* captions */
.captions {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 25;
  width: min(860px, calc(100vw - 32px));
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  pointer-events: none;
}
.cap {
  margin: 0;
  max-width: 100%;
  padding: 8px 16px;
  border-radius: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.cap.on { opacity: 1; transform: none; }
.cap-tessa {
  font-size: 19px;
  font-weight: 500;
  line-height: 1.42;
  color: var(--ui-text);
  background: var(--ui);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  text-wrap: balance;
}
.cap-student {
  font-size: 14.5px;
  color: var(--c-student);
  background: color-mix(in srgb, var(--ui) 80%, transparent);
  backdrop-filter: blur(10px);
}

/* lesson panel */
.panel {
  position: fixed;
  top: 84px;
  left: 16px;
  bottom: 96px;
  width: 350px;
  max-width: calc(100vw - 32px);
  z-index: 28;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  transform: translateX(calc(-100% - 28px));
  transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1);
}
body.panel-open .panel { transform: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 12px; }
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--ui-hover); }
.tabs button {
  border: 0;
  background: transparent;
  padding: 6px 13px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ui-muted);
  cursor: pointer;
}
.tabs button.active { background: var(--ui-solid); color: var(--ui-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.tab-body { display: none; flex: 1; overflow: auto; padding: 8px 14px 16px; }
.tab-body.active { display: block; }
.dropzone {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  border: 1.5px dashed color-mix(in srgb, var(--ui-muted) 55%, transparent);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ui-muted);
}
.dropzone b { color: var(--ui-text); font-size: 14px; }
.dropzone:hover { border-color: var(--accent); }
.dropzone svg { flex: none; margin-top: 2px; color: var(--accent); }
.empty { color: var(--ui-muted); font-size: 13px; line-height: 1.5; margin: 14px 4px; }
.docs { display: grid; gap: 12px; margin-top: 14px; }
.doc { padding: 14px; border-radius: 16px; background: var(--ui-solid); border: 1px solid var(--ui-border); }
.doc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.doc-file { font-size: 12px; color: var(--ui-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { flex: none; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--ui-hover); color: var(--ui-muted); }
.doc-ready .pill { background: color-mix(in srgb, var(--c-green) 16%, transparent); color: var(--c-green); }
.doc-reading .pill { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.doc-error .pill { background: color-mix(in srgb, var(--c-red) 14%, transparent); color: var(--c-red); }
@keyframes pulse { 50% { opacity: 0.55; } }
.doc-title { font-weight: 700; font-size: 15px; margin-top: 6px; letter-spacing: -0.01em; }
.doc-title:empty, .doc-summary:empty { display: none; }
.doc-summary { font-size: 13px; color: var(--ui-muted); line-height: 1.5; margin-top: 4px; }
.topics { display: grid; gap: 4px; margin-top: 10px; }
.topic {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 7px 8px;
  cursor: pointer;
  font-size: 13.5px;
}
.topic:hover { background: var(--ui-hover); }
.topic .n {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--ui-hover);
  color: var(--ui-muted);
}
.topic.visited .n { background: var(--accent); color: #fff; }
.transcript { display: grid; gap: 12px; font-size: 13.5px; line-height: 1.5; }
.t-row b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ui-muted); margin-bottom: 2px; }
.t-student span { color: var(--c-student); }

/* lesson plan */
.plan {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 31;
  width: min(420px, calc(100vw - 460px));
  min-width: 260px;
  border-radius: 22px;
  overflow: hidden;
}
.plan[hidden] { display: none; }
.plan.bump { animation: plan-bump 0.6s ease; }
.plan.planning .plan-ring svg { animation: plan-spin 1.1s linear infinite; }
.plan.planning .plan-now { animation: plan-breathe 1.6s ease-in-out infinite; }
@keyframes plan-spin { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } }
@keyframes plan-breathe { 50% { opacity: 0.55; } }
@keyframes plan-bump { 30% { transform: translateX(-50%) scale(1.03); } }
.plan-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 14px 7px 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.plan-ring { position: relative; width: 38px; height: 38px; flex: none; display: grid; place-items: center; }
.plan-ring svg { position: absolute; inset: 0; width: 38px; height: 38px; transform: rotate(-90deg); }
.plan-ring circle { fill: none; stroke-width: 3.2; }
.plan-ring .track { stroke: var(--ui-hover); }
.plan-ring .arc { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray 0.6s ease; }
.plan-ring b { font-size: 10.5px; font-weight: 700; letter-spacing: -0.02em; }
.plan-text { flex: 1; min-width: 0; display: grid; }
.plan-title { font-size: 11.5px; font-weight: 600; color: var(--ui-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-now { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-head .chev { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ui-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s; }
.plan.open .chev { transform: rotate(180deg); }
.plan-steps {
  list-style: none;
  margin: 0;
  padding: 0 14px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
.plan.open .plan-steps { max-height: 420px; padding: 2px 14px 12px; }
.step { display: flex; gap: 11px; padding: 7px 0; position: relative; }
.step + .step::before {
  content: "";
  position: absolute;
  left: 7px;
  top: -9px;
  height: 16px;
  border-left: 2px solid var(--ui-border);
}
.step .dot {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--ui-border);
  background: var(--ui-solid);
}
.step.done .dot { border-color: var(--c-green); background: var(--c-green); box-shadow: inset 0 0 0 3px var(--ui-solid); }
.step.current .dot { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.step .st { display: grid; gap: 1px; min-width: 0; }
.step b { font-size: 13.5px; font-weight: 600; }
.step small { font-size: 12px; color: var(--ui-muted); line-height: 1.4; }
.step.done b { color: var(--ui-muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ui-muted) 60%, transparent); }
.step.current b { color: var(--accent); }
.step.todo small, .step.done small { display: none; }

/* settings */
.popover {
  position: fixed;
  top: 76px;
  right: 16px;
  z-index: 40;
  width: 310px;
  padding: 16px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.popover.on { opacity: 1; pointer-events: auto; transform: none; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; font-weight: 600; color: var(--ui-muted); margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
select {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--ui-border);
  background: var(--ui-solid);
  color: var(--ui-text);
  padding: 0 10px;
  font: 13.5px var(--font-ui);
}
.small {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 0;
  background: var(--ui-active);
  color: var(--ui-active-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.small.wide { width: 100%; background: var(--ui-hover); color: var(--ui-text); }
.small.wide + .small.wide { margin-top: 6px; }
.small.wide.confirm { background: var(--c-red); color: #fff; }
.segmented { display: flex; padding: 3px; border-radius: 11px; background: var(--ui-hover); }
.segmented button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 7px 0;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ui-muted);
  cursor: pointer;
}
.segmented button.active { background: var(--ui-solid); color: var(--ui-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.cost-total { display: flex; align-items: baseline; gap: 8px; }
.cost-total b { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.cost-total span { font-size: 11.5px; color: var(--ui-muted); }
.cost-breakdown { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.cost-breakdown li { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ui-muted); }
.cost-breakdown b { color: var(--ui-text); font-weight: 600; }
.meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ui-muted); padding-top: 10px; border-top: 1px solid var(--ui-border); }
.meta b { color: var(--ui-text); font-weight: 600; }
.keys { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 11.5px; color: var(--ui-muted); }
kbd {
  font: 600 10.5px var(--font-ui);
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--ui-border);
  background: var(--ui-solid);
  color: var(--ui-text);
}

/* start screen */
.start {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: color-mix(in srgb, var(--board) 45%, transparent);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.start.gone { opacity: 0; visibility: hidden; }
.start-card {
  width: min(470px, 100%);
  padding: 34px 30px 24px;
  border-radius: 30px;
  text-align: center;
  background: var(--ui-solid);
  border: 1px solid var(--ui-border);
  box-shadow: var(--shadow), 0 50px 90px -40px rgba(0, 0, 0, 0.35);
}
.orb.big { width: 84px; height: 84px; margin: 0 auto; animation: breathe 4s ease-in-out infinite; }
.start h1 { font-family: var(--font-hand); font-size: 60px; line-height: 1; margin: 14px 0 0; letter-spacing: -0.01em; }
.lede { max-width: 360px; margin: 10px auto 22px; color: var(--ui-muted); font-size: 15.5px; line-height: 1.55; }
.voice-pick .label { font-size: 12px; font-weight: 600; color: var(--ui-muted); margin-bottom: 8px; text-align: left; }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip {
  display: grid;
  gap: 1px;
  padding: 9px 6px;
  border-radius: 13px;
  border: 1px solid var(--ui-border);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
}
.chip span { font-size: 11.5px; color: var(--ui-muted); }
.chip:hover { background: var(--ui-hover); }
.chip.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.primary {
  width: 100%;
  height: 52px;
  margin-top: 20px;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font: 600 16px var(--font-ui);
  color: #fff;
  background: linear-gradient(140deg, #ff7a4d, #ff5a36 55%, #f0462a);
  box-shadow: 0 10px 24px -10px rgba(255, 90, 54, 0.8);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: scale(0.99); }
.primary:disabled { filter: grayscale(0.6); opacity: 0.7; cursor: default; }
.ghost {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--ui-text);
  font-weight: 600;
  cursor: pointer;
}
.ghost:hover { background: var(--ui-hover); }
.note { font-size: 12.5px; color: var(--ui-muted); margin: 12px 0 0; }

/* overlays */
.drop-overlay {
  position: fixed;
  inset: 10px;
  z-index: 60;
  display: grid;
  place-items: center;
  border-radius: 26px;
  border: 3px dashed var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-family: var(--font-hand);
  font-size: 40px;
  font-weight: 700;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
body.dragging .drop-overlay { opacity: 1; }
.takeover { position: fixed; inset: 0; z-index: 70; display: none; place-items: center; background: rgba(0, 0, 0, 0.2); }
.takeover.on { display: grid; }
.takeover > div { padding: 24px; border-radius: 22px; width: min(360px, calc(100vw - 32px)); text-align: center; }
.takeover p { margin: 0; font-size: 15px; }
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 80;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ui-active-text);
  background: var(--ui-active);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, -14px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

body:not(.started) .dock, body:not(.started) .captions { opacity: 0; pointer-events: none; }
.dock, .captions { transition: opacity 0.4s ease; }

/* small screens */
@media (max-width: 760px) {
  .topbar { top: 10px; left: 10px; right: 10px; }
  .icon-btn.labelled span { display: none; }
  .plan { top: 66px; width: calc(100vw - 20px); }
  .dock { bottom: 10px; flex-wrap: wrap; justify-content: center; border-radius: 20px; width: calc(100vw - 20px); }
  .type { order: 3; width: 100%; }
  .sep { display: none; }
  .captions { bottom: 150px; }
  .cap-tessa { font-size: 16px; }
  .panel { top: 70px; left: 10px; bottom: 150px; }
  .popover { top: 66px; right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .orb, .orb i, .orb.big { animation: none !important; }
}
