/* Gurva's classroom: a pale wall, a greenboard in a wooden frame, a notebook to write in, and the
   teacher herself as the one bright thing on the page. Baloo 2 is her voice (the speech bubble);
   Hind is everything else, maths included. Both have Devanagari. */

@font-face { font-family: "Baloo 2"; font-weight: 600; font-display: swap; src: url("/static/vendor/fonts/baloo-2-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+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Baloo 2"; font-weight: 600; font-display: swap; src: url("/static/vendor/fonts/baloo-2-devanagari-600-normal.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09; }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url("/static/vendor/fonts/baloo-2-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url("/static/vendor/fonts/baloo-2-devanagari-700-normal.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09; }
@font-face { font-family: "Hind"; font-weight: 400; font-display: swap; src: url("/static/vendor/fonts/hind-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+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hind"; font-weight: 400; font-display: swap; src: url("/static/vendor/fonts/hind-devanagari-400-normal.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09; }
@font-face { font-family: "Hind"; font-weight: 500; font-display: swap; src: url("/static/vendor/fonts/hind-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+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hind"; font-weight: 500; font-display: swap; src: url("/static/vendor/fonts/hind-devanagari-500-normal.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09; }
@font-face { font-family: "Hind"; font-weight: 600; font-display: swap; src: url("/static/vendor/fonts/hind-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+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hind"; font-weight: 600; font-display: swap; src: url("/static/vendor/fonts/hind-devanagari-600-normal.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09; }
@font-face { font-family: "Noto Sans"; font-weight: 400; font-display: swap; src: url("/static/vendor/fonts/noto-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Noto Sans Devanagari"; font-weight: 400; font-display: swap; src: url("/static/vendor/fonts/noto-sans-devanagari-devanagari-400-normal.woff2") format("woff2"); }

:root {
  --wall: #EAF1F4;
  --wall-2: #D5E2E8;
  --paper: #FFFDF6;
  --ink: #1F2A2E;
  --ink-2: #4E5F66;
  --board: #1E3A2F;
  --board-hi: #26483B;
  --frame: #9C6B43;
  --frame-2: #7A5233;
  --chalk: #F3F1E7;
  --chalk-2: #B9C7BB;
  --chalk-yellow: #F4D35E;
  --chalk-blue: #A9D8F2;
  --marigold: #E9A23B;
  --marigold-2: #B9740F;
  --maroon: #7E2A35;
  --maroon-2: #64202A;
  --pen: #1E4FD8;
  --rule: #D3DFF4;
  --margin: #E9A9A9;
  --ui: "Hind", "Noto Sans", "Noto Sans Devanagari", system-ui, sans-serif;
  --voice: "Baloo 2", "Hind", "Noto Sans Devanagari", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; height: 100dvh; display: flex; flex-direction: column;
  background: var(--wall); color: var(--ink); font: 400 17px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; }
.maths { font-variant-numeric: tabular-nums; }

/* ── Top ───────────────────────────────────────────────────────────────────────────────── */
.top {
  flex: none; display: flex; align-items: baseline; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 18px 6px;
}
.wordmark { font: 700 26px/1.1 var(--voice); color: var(--maroon); }
.topic { color: var(--ink-2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lang-toggle {
  margin-left: auto; align-self: center; flex: none; border: 1.5px solid var(--wall-2); background: var(--paper);
  border-radius: 999px; padding: 4px 16px 2px; font-weight: 500; font-size: 16px;
}
.lang-toggle:hover { border-color: var(--maroon); }

/* ── The teacher's tile and speech bubble ─────────────────────────────────────────────── */
.tile {
  position: relative; aspect-ratio: 1; border-radius: 28px; overflow: hidden;
  background: radial-gradient(circle at 50% 36%, #FFF8EA 0%, #F6E7CB 55%, #EBD4AE 100%);
  box-shadow: 0 1px 0 rgba(122, 82, 51, 0.18);
  transition: box-shadow 200ms ease;
}
/* her portrait, drawn by teacher.js (WebGL), or the picture itself where there is no WebGL */
.teacher-canvas { display: block; width: 100%; height: 100%; }
.teacher-still { position: absolute; max-width: none; height: auto; }
.tile:has(.teacher-canvas), .tile:has(.teacher-still) { background: #D9DDE2; }
.tile.is-listening { box-shadow: 0 0 0 4px var(--marigold); animation: ring 1.6s ease-in-out infinite; }
@keyframes ring { 50% { box-shadow: 0 0 0 7px rgba(233, 162, 59, 0.45); } }

.bubble {
  position: relative; margin: 0; background: var(--paper); border-radius: 22px; padding: 14px 18px 12px;
  font: 600 20px/1.42 var(--voice); color: var(--ink);
  box-shadow: 0 1px 0 var(--wall-2), 0 10px 26px rgba(31, 42, 46, 0.08);
  overflow-wrap: anywhere;
}
.bubble::before {
  content: ""; position: absolute; width: 18px; height: 18px; background: var(--paper);
  left: 34px; top: -8px; transform: rotate(45deg); border-radius: 4px 0 0 0;
}
.caption { margin: 0; min-height: 1.42em; }
.dots { display: none; gap: 6px; padding: 8px 0 4px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--chalk-2); animation: dot 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 30% { transform: translateY(-5px); background: var(--board-hi); } }
.bubble.thinking .caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bubble.thinking .dots { display: flex; }
/* more of the turn below: its bottom fades (the bubble scrolls) */
.bubble.more::after {
  content: ""; display: block; position: sticky; bottom: -12px; height: 34px; margin: -34px -18px -12px;
  background: linear-gradient(rgba(255, 253, 246, 0), var(--paper) 85%); pointer-events: none;
}

.under { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; padding-left: 6px; }
.quiet {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 2px;
  color: var(--maroon); font-weight: 500; font-size: 15px;
}
.quiet svg { width: 18px; height: 18px; fill: currentColor; }
.quiet:hover { color: var(--maroon-2); text-decoration: underline; text-underline-offset: 3px; }
.cam-state { font-size: 14px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.cam-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9AA8AD; }
.cam-state.on::before { background: #2E8A57; }
.cam-state.cue::before { background: var(--marigold); }
.note { color: var(--ink-2); font-size: 13px; }
.sees { margin: 8px 0 0; padding: 4px 12px; border-radius: 10px; background: #FFF1C9; color: #5E4206; font-size: 14px; width: fit-content; }

/* ── Start ─────────────────────────────────────────────────────────────────────────────── */
.start {
  flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  /* centred when it fits; when it doesn't, from the top, so the top of the panel can be scrolled to */
  gap: 28px 40px; align-content: center; align-content: safe center; justify-content: center; padding: 12px 24px 32px;
  max-width: 1040px; width: 100%; margin: 0 auto;
}
.hello { display: flex; flex-direction: column; align-items: center; gap: 18px; align-self: center; }
.hello .tile { width: min(340px, 100%); }
.hello-bubble { max-width: 380px; font-size: 22px; }
.hello-bubble::before { left: calc(50% - 9px); }
.setup {
  background: var(--paper); border-radius: 24px; padding: 24px 24px 20px;
  box-shadow: 0 1px 0 var(--wall-2), 0 14px 34px rgba(31, 42, 46, 0.07);
  display: flex; flex-direction: column; gap: 18px; min-width: 0;
}
.langs { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.langs legend, .field-name { font-weight: 600; margin-bottom: 8px; padding: 0; }
.lang-opt { position: relative; }
.lang-opt input { position: absolute; opacity: 0; inset: 0; }
.lang-opt span {
  display: block; text-align: center; padding: 12px 10px 9px; border-radius: 14px; border: 1.5px solid var(--wall-2);
  font: 600 20px/1.3 var(--voice); background: var(--paper);
}
.lang-opt input:checked + span { background: var(--maroon); border-color: var(--maroon); color: var(--chalk); }
.lang-opt input:focus-visible + span { outline: 3px solid var(--pen); outline-offset: 2px; }
.modes { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modes legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.mode-opt { position: relative; }
.mode-opt input { position: absolute; opacity: 0; inset: 0; }
.mode-opt span {
  display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px 14px 10px; border-radius: 14px;
  border: 1.5px solid var(--wall-2); background: var(--paper); cursor: pointer;
}
.mode-opt b { font: 600 18px/1.3 var(--voice); color: var(--ink); }
.mode-opt small { color: var(--ink-2); font-size: 14px; line-height: 1.4; }
.mode-opt input:checked + span { border-color: var(--maroon); box-shadow: inset 0 0 0 1.5px var(--maroon); background: #FBF1F1; }
.mode-opt input:focus-visible + span { outline: 3px solid var(--pen); outline-offset: 2px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick .pick-chapter { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field select {
  width: 100%; min-width: 0; appearance: none; -webkit-appearance: none; border: 1.5px solid var(--wall-2); border-radius: 14px;
  padding: 12px 40px 10px 14px; background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%237E2A35' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center / 22px no-repeat;
}
.field select:disabled { opacity: 0.5; }
.field small { color: var(--ink-2); font-size: 14px; line-height: 1.45; margin-top: 6px; }
.switches { display: flex; flex-direction: column; gap: 14px; }
.switch { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: start; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 48px; height: 28px; margin: 0; }
.knob { width: 48px; height: 28px; border-radius: 999px; background: #C3CFD4; position: relative; transition: background 160ms ease; margin-top: 1px; }
.knob::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 160ms ease;
}
.switch input:checked + .knob { background: var(--marigold); }
.switch input:checked + .knob::after { transform: translateX(20px); }
.switch input:focus-visible + .knob { outline: 3px solid var(--pen); outline-offset: 2px; }
.switch-text b { display: block; font-weight: 600; line-height: 1.35; }
.switch-text small { display: block; color: var(--ink-2); font-size: 14px; line-height: 1.45; margin-top: 2px; }
.go {
  border: 0; border-radius: 16px; background: var(--maroon); color: var(--chalk); padding: 15px 20px 12px;
  font: 700 21px/1.2 var(--voice);
}
.go:hover { background: var(--maroon-2); }
.go:disabled { opacity: 0.55; cursor: default; }
.msg { margin: 0; min-height: 0; color: var(--maroon); font-size: 15px; }
.msg:empty { display: none; }
/* Carry on: a bookmark left in the book, a marigold ribbon down its edge. */
.resume {
  position: relative; display: grid; gap: 10px; padding: 14px 16px 16px 22px; border-radius: 16px;
  background: #FDF4E3; border: 1.5px solid #F1D7A6;
}
.resume::before {
  content: ""; position: absolute; left: 0; top: -1.5px; width: 9px; height: 46px; background: var(--marigold);
  border-radius: 14px 0 0 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
}
.resume-title { margin: 0; font: 600 15px/1.3 var(--ui); color: var(--marigold-2); }
.resume-where { margin: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.resume-where b { font: 600 19px/1.3 var(--voice); color: var(--ink); overflow-wrap: anywhere; }
.resume-where span { color: var(--ink-2); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.resume-go { justify-self: start; padding: 12px 26px 10px; font-size: 19px; }

/* The Pilot Ground School, by invitation: the key's panel in place of its chapters, a padlock on a maroon-edged card. */
.pick.locked > .field:first-child { grid-column: 1 / -1; }
.pilot-lock {
  display: grid; gap: 10px; padding: 14px 16px 16px; border-radius: 16px; background: #F8F1F1; border: 1.5px solid #E5CDD1; min-width: 0;
}
.pilot-lock-title { margin: 0; display: flex; align-items: center; gap: 8px; font: 600 19px/1.3 var(--voice); color: var(--ink); }
.pilot-lock-title svg { width: 20px; height: 20px; fill: var(--maroon); flex: none; margin-top: -2px; }
.pilot-lock-note { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; }
.pilot-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.pilot-key { font: 600 18px/1.3 var(--ui); letter-spacing: 0.06em; text-transform: uppercase; }
.pilot-key::placeholder { letter-spacing: 0.04em; }
.pilot-go { padding: 12px 22px 10px; font-size: 19px; }
.pilot-on { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; margin-top: -8px; }
.pilot-lang { margin: 0; font-size: 15px; color: var(--ink-2); }
.pilot-note { margin: 0; flex-basis: 100%; font-size: 15px; color: var(--board); font-weight: 500; }
.pilot-note:empty { display: none; }
.own-lang { margin: -8px 0 0; font-size: 15px; color: var(--ink-2); }

/* The student's own label, like the name label on a school notebook's cover: a double maroon frame,
   the name written in blue pen on a dotted line. */
.who, .label-form {
  border: 2px solid var(--maroon); border-radius: 14px; background: var(--paper);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px rgba(126, 42, 53, 0.32);
}
.who { display: grid; gap: 10px; padding: 13px 16px 12px; }
.who-lead { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.who-lead b { color: var(--ink); font-weight: 600; }
.who-known { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; }
.who-initial {
  width: 46px; height: 46px; border-radius: 50%; background: var(--marigold); color: var(--ink);
  display: grid; place-items: center; font: 700 22px/1 var(--voice); padding-top: 3px;
}
.who-lines { min-width: 0; }
.who-name { margin: 0; display: flex; align-items: baseline; gap: 8px; border-bottom: 1.5px dotted #9A7F84; padding-bottom: 1px; }
.who-label, .lf > span { font-size: 13px; color: var(--ink-2); flex: none; }
.who-name b { font: 600 21px/1.25 var(--voice); color: var(--pen); overflow-wrap: anywhere; min-width: 0; }
.who-more { margin: 5px 0 0; font-size: 14px; line-height: 1.4; color: var(--ink-2); overflow-wrap: anywhere; }
.who-more:empty { display: none; }
.who-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.who-msg { margin: 0; font-size: 14px; line-height: 1.45; color: var(--board); }
.who-msg:empty { display: none; }
.who.is-known .who-actions { padding-left: 58px; }
.who-make {
  border: 1.5px solid var(--maroon); background: var(--paper); color: var(--maroon); border-radius: 999px;
  padding: 8px 18px 6px; font-weight: 600; font-size: 16px;
}
@media (hover: hover) { .who-make:hover { background: var(--maroon); color: var(--chalk); } }

/* The profile, opened over the page: a sheet of the notebook. */
.sheet {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  width: min(560px, calc(100% - 32px)); max-width: none; max-height: min(88dvh, 880px);
}
.sheet[open] { display: flex; }
.sheet::backdrop { background: rgba(30, 58, 47, 0.55); }
.sheet-card {
  flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--paper); border-radius: 22px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(31, 42, 46, 0.25);
}
.sheet-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 16px 14px 12px 22px; border-bottom: 1px solid var(--rule); }
.sheet-head h2 { margin: 0; flex: 1; font: 700 24px/1.2 var(--voice); color: var(--maroon); }
.sheet-head h2:focus { outline: none; }
.sheet-close { flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; background: none; color: var(--ink-2); display: grid; place-items: center; }
.sheet-close:hover { background: var(--wall); color: var(--ink); }
.sheet-close svg { width: 22px; height: 22px; fill: currentColor; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 22px 20px; display: flex; flex-direction: column; gap: 20px; }
.sheet-note { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.sheet-foot { flex: none; display: flex; padding: 12px 22px 16px; border-top: 1px solid var(--rule); }
.sheet-foot .go { flex: 1; }

.label-form { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 8px 18px; padding: 12px 16px 14px; }
.lf { display: flex; align-items: baseline; gap: 8px; min-width: 0; border-bottom: 1.5px dotted #9A7F84; }
.lf:focus-within { border-bottom: 1.5px solid var(--pen); box-shadow: 0 1.5px 0 var(--pen); }
.lf input, .lf select {
  flex: 1; min-width: 0; border: 0; border-radius: 0; background: transparent; padding: 6px 0 1px;
  font: 600 21px/1.3 var(--voice); color: var(--pen);
}
.lf input:focus, .lf select:focus { outline: none; }
.lf select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 26px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%237E2A35' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 2px center / 20px no-repeat;
}
.lf select.unset { color: var(--ink-2); font: 500 17px/1.3 var(--ui); }
.text-in { width: 100%; border: 1.5px solid var(--wall-2); border-radius: 14px; padding: 11px 14px 9px; background: var(--paper); }
.text-in::placeholder { color: #65747A; }

.teach { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.teach legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-block; border: 1.5px solid var(--maroon); color: var(--maroon); background: var(--paper);
  border-radius: 999px; padding: 7px 15px 5px; font-weight: 600; font-size: 15px;
}
.chip input:checked + span { background: var(--maroon); color: var(--chalk); }
.chip input:checked + span::before { content: "✓ "; }
.chip input:focus-visible + span { outline: 3px solid var(--pen); outline-offset: 2px; }

/* The lessons, as dated lines in the notebook: the date in the red margin, what was done in blue pen. */
.lessons h3 { margin: 0; font: 600 19px/1.3 var(--voice); color: var(--ink); }
.lessons h3:focus { outline: none; }
.lessons-note, .lessons-empty { margin: 2px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.lessons-list { list-style: none; margin: 10px 0 0; padding: 0; position: relative; border-top: 1px solid var(--rule); }
.lessons-list:empty { display: none; }
.lessons-list::before { content: ""; position: absolute; left: 78px; top: 0; bottom: 0; width: 2px; background: var(--margin); }
.l-item { display: grid; grid-template-columns: 78px minmax(0, 1fr); border-bottom: 1px solid var(--rule); }
.l-date { padding: 11px 12px 8px 0; text-align: right; font-size: 13px; line-height: 1.3; color: var(--maroon); font-variant-numeric: tabular-nums; }
.l-main {
  min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 9px 6px 8px 16px; border: 0; background: none;
  text-align: left; border-radius: 0;
}
@media (hover: hover) { .l-main:not(:disabled):hover { background: #F4F7FD; } }
.l-main:disabled { cursor: default; }
.l-ch { font-size: 14px; font-weight: 600; color: var(--ink-2); overflow-wrap: anywhere; }
.l-what { font: 600 17px/1.35 var(--voice); color: var(--pen); overflow-wrap: anywhere; }

.forget { border-top: 1px dashed var(--wall-2); padding-top: 12px; }
.forget-ask { margin-top: 8px; padding: 12px 14px; border-radius: 14px; background: #FBF1F1; color: var(--maroon-2); }
.forget-ask p { margin: 0 0 10px; font-size: 14px; line-height: 1.45; }
.forget-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.forget-yes { border: 0; border-radius: 999px; background: var(--maroon); color: var(--chalk); padding: 9px 18px 7px; font-weight: 600; }
.forget-yes:hover { background: var(--maroon-2); }

/* ── Lesson ────────────────────────────────────────────────────────────────────────────── */
.lesson {
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 1fr); gap: 22px;
  padding: 6px 22px max(18px, env(safe-area-inset-bottom)); width: 100%; max-width: 1280px; margin: 0 auto;
}
.side { min-height: 0; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; padding-bottom: 4px; }
.side .tile { width: 100%; flex: none; }
.talk { min-width: 0; }
.desk { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

/* The greenboard, in its wooden frame. */
.board {
  flex: 1; min-height: 0; display: flex; flex-direction: column; color: var(--chalk);
  background:
    radial-gradient(90% 70% at 22% 12%, rgba(255, 255, 255, 0.055), transparent 60%),
    radial-gradient(70% 60% at 85% 90%, rgba(255, 255, 255, 0.035), transparent 65%),
    var(--board);
  border: 6px solid var(--frame); border-radius: 14px; overflow: hidden;   /* nothing spills onto the buttons below */
  box-shadow: inset 0 0 0 1px var(--frame-2), inset 0 0 26px rgba(0, 0, 0, 0.28), 0 8px 20px rgba(30, 58, 47, 0.16);
}
.question { flex: none; padding: 14px 20px 12px; border-bottom: 2px dashed rgba(243, 241, 231, 0.22); position: relative; }
.q-label { display: block; font-size: 14px; color: var(--chalk-2); font-weight: 500; }
.q-text { margin: 2px 0 0; font-size: 22px; line-height: 1.4; font-weight: 500; text-shadow: 0 0 1px rgba(243, 241, 231, 0.35); }
.question.long .q-text { font-size: 18px; }
.question.clamped .q-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.q-more { border: 0; background: none; color: var(--chalk-yellow); padding: 2px 0 0; font-size: 14px; font-weight: 500; }

.log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 18px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.entry { display: flex; flex-direction: column; gap: 4px; max-width: 100%; }
.entry.empty { display: none; }
.entry .said { margin: 0; color: var(--chalk-2); font-size: 16px; line-height: 1.45; max-width: 62ch; }
.entry.teacher.current .said { display: none; }
.entry .bl { font-size: 23px; line-height: 1.4; font-weight: 500; overflow-wrap: anywhere; text-shadow: 0 0 1px rgba(243, 241, 231, 0.3); }
.entry.teacher.check .bl:not(.quote) { color: var(--chalk-yellow); }
.entry .bl.quote {
  color: var(--chalk-blue); font-size: 20px; padding: 2px 12px; width: fit-content; max-width: 100%;
  border: 1.5px dashed rgba(169, 216, 242, 0.55); border-radius: 10px;
}
.entry.student { align-self: flex-end; align-items: flex-end; text-align: right; }
.entry.student .said { color: var(--chalk-blue); opacity: 0.85; }
.entry.student .bl { color: var(--chalk-blue); }
.entry .tag { font-size: 13px; color: var(--chalk-2); }
.entry.note { align-self: center; text-align: center; color: var(--chalk-2); font-size: 15px; max-width: 46ch; }

.status { flex: none; padding: 10px 14px 8px; border-radius: 14px; background: var(--paper); border-left: 5px solid var(--maroon); color: var(--maroon); font-size: 15px; }
.status.info { border-left-color: var(--board); color: var(--board); }

.extras { flex: none; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.extras:empty { display: none; }
.extras .q { width: 100%; font-size: 15px; color: var(--ink-2); font-weight: 500; }
.extras button {
  border: 1.5px solid var(--maroon); background: var(--paper); color: var(--maroon); border-radius: 999px;
  padding: 8px 16px 6px; font-weight: 600; font-size: 16px;
}
.extras button.on { background: var(--maroon); color: var(--chalk); }
@media (hover: hover) { .extras button:hover { background: var(--maroon); color: var(--chalk); } }
/* A question's four options, to tap: one per line; then the right one green, a wrong pick red. */
.extras .opts { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.extras .opts button.opt { width: 100%; text-align: left; border-radius: 14px; padding: 11px 14px 9px; font-weight: 500;
  font-size: 16px; line-height: 1.35; }
.extras .opts button.opt:disabled { cursor: default; }
.extras .opts button.opt.chosen { background: var(--maroon); color: var(--chalk); }
.extras .opts button.opt.right { background: #E2F1E3; border-color: #2E7D32; color: #1B5E20; font-weight: 600; }
.extras .opts button.opt.wrong { background: #FBE6E5; border-color: #B3261E; color: #8C1D18; }
@media (hover: hover) {
  .extras .opts button.opt:disabled:hover { background: var(--paper); color: var(--maroon); }
  .extras .opts button.opt.right:hover { background: #E2F1E3; color: #1B5E20; }
  .extras .opts button.opt.wrong:hover { background: #FBE6E5; color: #8C1D18; }
  .extras .opts button.opt.chosen:hover { background: var(--maroon); color: var(--chalk); }
}

/* The student's notebook: ruled paper with a red margin, written in blue pen. */
.answer { flex: none; display: flex; gap: 12px; align-items: flex-end; }
.notebook {
  flex: 1; min-width: 0; background: var(--paper); border-radius: 18px; position: relative;
  padding: 6px 8px 6px 46px; box-shadow: 0 1px 0 var(--wall-2), 0 6px 18px rgba(31, 42, 46, 0.06);
}
.notebook::before { content: ""; position: absolute; left: 32px; top: 0; bottom: 0; width: 2px; background: var(--margin); }
.pending { display: flex; align-items: flex-end; gap: 10px; border-bottom: 1px solid var(--rule); padding-bottom: 4px; }
.pending ol { flex: 1; margin: 0; padding: 0; list-style: none; color: var(--pen); font-size: 19px; }
.pending li { border-bottom: 1px solid var(--rule); padding: 3px 0 1px; }
.pending li:last-child { border-bottom: 0; }
.heard { margin: 0; padding: 6px 0 2px; color: var(--pen); font-style: italic; font-size: 17px; border-bottom: 1px solid var(--rule); }
.input { display: flex; align-items: center; gap: 8px; }
.line {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 0 8px; font-size: 20px; color: var(--pen);
  border-bottom: 1px solid var(--rule); border-radius: 0;
}
.line::placeholder { color: #65747A; font-size: 17px; }
.line:focus { outline: none; border-bottom-color: var(--pen); }
.send {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--maroon); color: var(--chalk);
  display: grid; place-items: center;
}
.send svg { width: 20px; height: 20px; fill: currentColor; margin-left: 2px; }
.send:hover { background: var(--maroon-2); }
.send:disabled, .line:disabled { opacity: 0.45; cursor: default; }

.mic {
  flex: none; width: 66px; height: 66px; border-radius: 50%; border: 2.5px solid var(--marigold); background: var(--paper);
  color: var(--marigold-2); display: grid; place-items: center; transition: background 160ms ease, color 160ms ease;
}
.mic svg { width: 30px; height: 30px; fill: currentColor; }
.mic.on { background: var(--marigold); color: var(--ink); animation: ring 1.6s ease-in-out infinite; }
.mic.paused { border-style: dashed; color: var(--ink-2); border-color: var(--ink-2); }
.mic:disabled { opacity: 0.4; cursor: default; animation: none; }

/* The student's own picture, as in a video call: Gurva is watching, and says in a few words what she
   sees. The video never leaves the device. */
.faces { position: relative; flex: none; }
.me {
  position: absolute; right: 12px; bottom: 12px; width: 118px; border-radius: 14px; overflow: hidden;
  background: var(--board); box-shadow: 0 0 0 3px var(--paper), 0 6px 16px rgba(31, 42, 46, 0.22);
  transition: box-shadow 200ms ease;
}
.me-video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transform: scaleX(-1); background: var(--board); }
.me-state {
  display: block; padding: 3px 8px 2px; background: var(--paper); color: var(--ink-2);
  font-size: 12px; line-height: 1.3; font-weight: 500; text-align: center; min-height: 1.3em;
}
.me.cue { box-shadow: 0 0 0 3px var(--marigold), 0 6px 16px rgba(31, 42, 46, 0.22); }
.me.cue .me-state { background: #FFF1C9; color: #5E4206; }
.me.hand { box-shadow: 0 0 0 3px #2E8A57, 0 6px 16px rgba(31, 42, 46, 0.22); }
.me.hand .me-state { background: #E3F4EA; color: #1D5E3A; }

.overlay { position: fixed; inset: 0; background: rgba(30, 58, 47, 0.55); display: grid; place-items: center; padding: 16px; z-index: 10; }
.overlay-card { background: var(--paper); border-radius: 24px; padding: 26px; width: min(380px, 100%); text-align: center; display: flex; flex-direction: column; gap: 6px; }
.overlay-card h2 { margin: 0; font: 700 26px/1.2 var(--voice); color: var(--maroon); }
.overlay-card p { margin: 0; }
.timer { font: 700 48px/1.2 var(--voice); color: var(--board); font-variant-numeric: tabular-nums; }
.overlay-card .go { margin-top: 12px; }

/* ── Phones ────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .top { padding-left: 14px; padding-right: 14px; }
  .wordmark { font-size: 24px; }
  .start { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 16px; padding: 4px 14px 24px; }
  .hello { gap: 14px; }
  .hello .tile { width: 168px; border-radius: 24px; }
  .hello-bubble { font-size: 19px; text-align: center; }
  .setup { padding: 18px 16px 16px; gap: 16px; border-radius: 22px; }
  .who { padding: 12px 14px 11px; }
  .who.is-known .who-actions { padding-left: 0; }

  /* the profile fills the screen, its title and Save always in reach */
  .sheet { width: 100%; height: 100%; max-height: 100%; margin: 0; }
  .sheet-card { border-radius: 0; }
  .sheet-head { padding-top: max(12px, env(safe-area-inset-top)); padding-left: 18px; }
  .sheet-body { padding: 14px 16px 18px; gap: 18px; }
  .sheet-foot { padding: 10px 16px max(14px, env(safe-area-inset-bottom)); }
  .label-form { grid-template-columns: minmax(0, 1fr); }
  .lessons-list::before { left: 64px; }
  .l-item { grid-template-columns: 64px minmax(0, 1fr); }
  .l-main { padding-left: 14px; }

  .lesson { display: flex; flex-direction: column; gap: 10px; padding: 2px 10px max(10px, env(safe-area-inset-bottom)); }
  .side { flex: none; flex-direction: row; align-items: flex-start; gap: 10px; overflow: visible; padding: 0; }
  .side .tile { width: 104px; border-radius: 22px; }
  .side .tile.is-listening { box-shadow: 0 0 0 3px var(--marigold); }
  .faces { width: 104px; display: flex; flex-direction: column; gap: 8px; }
  .me { position: static; width: 104px; border-radius: 16px; }
  .me-state { font-size: 11px; padding: 2px 4px 1px; }
  .desk { flex: 1; }
  .talk { flex: 1; }
  .bubble { font-size: 17px; line-height: 1.4; padding: 10px 14px 8px; border-radius: 18px; max-height: 38vh; overflow-y: auto; }
  .bubble::before { left: -7px; top: 26px; width: 14px; height: 14px; border-radius: 0 0 0 3px; }
  .under { margin-top: 4px; gap: 12px; padding-left: 4px; }
  .quiet { font-size: 14px; }
  .question { padding: 10px 14px 8px; }
  .q-text { font-size: 19px; }
  .question.long .q-text { font-size: 16px; }
  .log { padding: 10px 14px 14px; gap: 12px; }
  .entry .bl { font-size: 20px; }
  .entry .bl.quote { font-size: 18px; }
  .entry .said { font-size: 15px; }
  .board { border-width: 5px; border-radius: 12px; }
  .extras .opts { gap: 6px; }
  .extras .opts button.opt { padding: 8px 12px 6px; font-size: 15px; border-radius: 12px; }
  .answer { gap: 10px; }
  .notebook { padding-left: 38px; border-radius: 16px; }
  .notebook::before { left: 26px; }
  .line { font-size: 18px; }
  .line::placeholder { font-size: 15px; }
  .mic { width: 60px; height: 60px; }
  .mic svg { width: 28px; height: 28px; }
}

@media (max-width: 380px) {
  .topic { display: none; }
  .pilot-form { grid-template-columns: 1fr; }
  .pilot-go { justify-self: start; }
}

/* ── The teacher designer ("Meet your teacher"), only while it is switched on ──────────────────────── */
/* the "AI teacher" mark: always on the teacher's tile while the designer is on (data-ai, set by app.js) */
.tile[data-ai]::after {
  content: attr(data-ai); position: absolute; left: 10px; bottom: 10px; z-index: 1; pointer-events: none;
  padding: 3px 10px 1px; border-radius: 999px; background: rgba(31, 42, 46, 0.78); color: #FFFFFF;
  font: 600 13px/1.4 var(--ui); letter-spacing: 0.02em;
}
.designer { width: min(880px, calc(100% - 32px)); }
.designer-count { flex: none; color: var(--ink-2); font-size: 14px; padding-right: 8px; }
.designer-body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px 22px 20px;
  display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 22px; align-items: start; align-content: start;
}
.designer-preview { margin: 0; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; }
.designer-tile { width: 100%; background: #E4E9EE; }
.designer-face { position: absolute; inset: 0; }
.designer-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.designer-caption { display: flex; flex-direction: column; gap: 10px; }
.designer-name-shown { font: 700 22px/1.2 var(--voice); color: var(--maroon); text-align: center; overflow-wrap: anywhere; }
.designer-say { font-size: 18px; }
.designer-say:empty { display: none; }
.designer-say::before { left: calc(50% - 9px); }
.designer-step { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.designer-step-title { margin: 0; font: 700 21px/1.25 var(--voice); color: var(--ink); }
.designer-step-title:focus { outline: none; }
.designer-fields { display: flex; flex-direction: column; gap: 18px; }
.designer-group legend { font-weight: 600; }
.designer-note { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.designer-summary { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; font-size: 16px; }
.designer-summary dt { color: var(--ink-2); }
.designer-summary dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 50%; margin-right: 7px; vertical-align: -2px;
  box-shadow: inset 0 0 0 1.5px rgba(31, 42, 46, 0.25); }
.designer-foot { gap: 14px; align-items: center; flex-wrap: wrap; }
.designer-foot .go { flex: 1 1 180px; }
@media (max-width: 760px) {
  .designer { width: 100%; }   /* full screen, as the profile is on a phone */
  .designer-body { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 16px; gap: 16px; }
  .designer-preview { position: static; flex-direction: row; align-items: center; }
  .designer-tile { width: 120px; flex: none; border-radius: 20px; }
  .designer-tile[data-ai]::after { left: 6px; bottom: 6px; font-size: 11px; padding: 2px 7px 0; }
  .designer-caption { flex: 1; min-width: 0; }
  .designer-name-shown { text-align: left; }
  .designer-say::before { left: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .tile.is-listening, .mic.on, .dots i { animation: none; }
  .log { scroll-behavior: auto; }
}

/* the book's powers and limits (x^(3/2), ∫₀^(π/2)) raised and lowered on the board */
.maths sup, .maths sub, #question sup, #question sub { font-size: 0.68em; line-height: 0; }
