/* The child's page (Task 16). The look is DESIGN.md: a white page, ink #22352E, Mukta for everything
   the child sees, Playpen Sans (and Playpen Sans Deva) for what Tara writes on the board, JetBrains Mono for usernames
   and PINs. The class screen is one 1440 by 900 stage, as the v3 class screens were drawn, scaled to fit the window.
   Light only, by decision. */
:root {
  color-scheme: light;
  --surface: #FFFFFF; --hover: #F5F7F4;
  --ink: #22352E; --ink-2: #34483F; --on-ink: #FFFFFF; --text-2: #5E6B65; --text-3: #7C8882; --ink-rgb: 34 53 46;
  --line: #E3E8E2; --control: #C8D0C9; --control-strong: #95A39B;
  --accent: #B57452; --accent-soft: #FBF0E9; --warn: #8A5300; --bad: #B3261E;
  --board-ink: #231e16; --label-pill: #fff4d6; --cast-shadow: #41538f;
  --shadow-sheet: 0 0 0 1px rgb(var(--ink-rgb) / .09), 0 1px 2px rgb(var(--ink-rgb) / .05), 0 10px 30px rgb(var(--ink-rgb) / .07);
  --sans: "Mukta", system-ui, -apple-system, "Segoe UI", sans-serif;
  --read: "Mukta", system-ui, sans-serif;
  --hand: "Playpen Sans", "Playpen Sans Deva", "Mukta", sans-serif;
  --code: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --label: ui-monospace, Menlo, monospace;
  --enter: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--surface); color: var(--ink); }
body { font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, p, dl, dd { margin: 0; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.primary { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px;
  border: 0; border-radius: 12px; background: var(--ink); color: var(--on-ink); font: 600 15px/1 var(--sans);
  cursor: pointer; transition: background .12s; }
.primary:hover { background: var(--ink-2); }
.primary:disabled { opacity: .5; cursor: default; }
.primary.big { height: 60px; padding: 0 40px; font: 600 22px/1 var(--read); }
.link { padding: 0; border: 0; background: none; color: var(--ink); font: 600 17px/1 var(--read); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--control-strong); text-underline-offset: 4px; }

/* ---------------------------------------------------------------- sign in */
.signin-form { width: min(380px, calc(100% - 32px)); margin: 18vh auto 48px; display: grid; gap: 8px; }
.brand { margin-bottom: 28px; font: 600 24px/1 var(--sans); letter-spacing: -.01em; }
.signin-form label { margin-top: 10px; color: var(--text-2); font: 600 15px/1.2 var(--sans); }
.code { height: 56px; padding: 0 16px; border: 1.5px solid var(--control-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: 500 22px/1 var(--code); font-feature-settings: "tnum"; }
.code:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgb(var(--ink-rgb) / .12); }
.signin-form .primary { height: 56px; margin-top: 22px; font-size: 17px; }
.msg { min-height: 26px; color: var(--warn); font: 500 17px/1.4 var(--read); }

/* ---------------------------------------------------------------- the class: one 1440 by 900 stage */
body.classpage { overflow: hidden; }
.stage { position: absolute; left: 0; top: 0; width: 1440px; height: 900px; overflow: hidden;
  transform-origin: 0 0; background: var(--surface); }

/* Tara: 240 px tall at left 56, bottom 24, her canvas scaled from her 600 by 600 Rive stage (v3 class screens).
   On Home she is 343 px tall. */
.tara { position: absolute; left: 56px; bottom: 24px; width: 212px; height: 240px; }
.tara canvas { position: absolute; width: 324px; height: 324px; left: -57px; top: -49px; pointer-events: none; }
[data-view="home"] .tara { width: 301px; height: 343px; }
[data-view="home"] .tara canvas { width: 464px; height: 464px; left: -82px; top: -70px; }

/* Her words, in her bubble just above her head: bottom 282, left 40, 330 px wide. They light up as she says them. */
.bubble { position: absolute; left: 40px; bottom: 282px; width: 330px; padding: 16px 20px; border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow-sheet); font: 500 20px/1.4 var(--read); color: var(--ink); }
.bubble::after { content: ""; position: absolute; left: 112px; bottom: -9px; width: 18px; height: 18px;
  background: var(--surface); transform: rotate(45deg); box-shadow: 3px 3px 5px -3px rgb(var(--ink-rgb) / .14); }
[data-view="home"] .bubble { bottom: 381px; }
.bubble .sw { color: var(--text-3); transition: color .12s; }
.bubble .sw.on { color: var(--ink); }
/* Fix 7: while Tara works on her reply her bubble holds only a soft "…", in the dim word colour. */
.bubble .thinking { color: var(--text-3); letter-spacing: .12em; }

/* Everything else sits in the middle of the space to Tara's right: x 400 to 1400, so its centre is x 900. */
.content { position: absolute; left: 400px; width: 1000px; top: 40px; bottom: 150px; display: none;
  place-items: center; text-align: center; }
[data-view="home"] .v-home, [data-view="ready"] .v-ready, [data-view="class"] .v-class,
[data-view="safety"] .v-safety, [data-view="notice"] .v-notice, [data-view="ended"] .v-ended { display: grid; }
[data-view="ended"] .v-ended { align-items: end; }
[data-view="home"] .v-home { align-content: center; gap: 28px; }  /* Start class, and under it Sign out */
.content h1 { font: 600 32px/1.2 var(--read); letter-spacing: -.01em; }

/* Get ready */
.ready { display: grid; gap: 32px; justify-items: center; }
.devices { display: grid; grid-template-columns: auto auto; gap: 16px 28px; align-items: center; text-align: left; }
.devices dt { color: var(--text-2); font: 600 15px/1 var(--sans); }
.devices dd { display: flex; align-items: center; gap: 12px; font: 500 20px/1.3 var(--read); }
.meter { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; }
.meter i { width: 5px; height: 6px; border-radius: 2px; background: var(--control); transition: height .08s; }
.meter i.on { background: var(--accent); }
#mic.blocked .meter { display: none; }

/* The board: what Tara writes, in the hand (Playpen Sans), one ink */
.board { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  width: 1000px; max-height: 100%; color: var(--board-ink); }
.board > div:empty { display: none; }
.b-pill { padding: 6px 10px; border-radius: 999px; background: var(--label-pill); box-shadow: inset 0 0 0 1.2px var(--board-ink);
  font: 700 15px/1 var(--label); letter-spacing: .04em; }
.b-line { max-width: 900px; font: 400 34px/1.3 var(--hand); }

/* M2's look A (Gourav's pick of 22 November), copied from the mock-up: the picture (one of our figures) over the
   table, Tara's lines in a 280 px column beside them. */
.b-side { display: flex; align-items: center; justify-content: center; gap: 44px; }
.b-main { display: flex; flex-direction: column; align-items: center; gap: 34px; }
.b-col { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.b-side > div:empty, .b-main > div:empty, .b-col > div:empty { display: none; }
.b-side.beside .b-col { width: 280px; align-items: stretch; text-align: left; }
.b-side.beside .b-words:not(:empty) { display: grid; gap: 18px; }
.b-side.beside .b-line { max-width: none; font: 400 32px/1.3 var(--hand); }
/* The picture on the board: board.js sizes it (pieceSize). M3's Task 5 removed the part of the child's book, so a
   picture is always one of our figures (.b-figure, below). */
.b-piece { position: relative; margin: 0; padding: 10px; background: #FFFFFF;
  box-shadow: -9px 9px 0 var(--cast-shadow); }
.b-piece img { display: block; }
.b-piece.enter { animation: fade .18s var(--enter) both; animation-delay: .15s; }
/* One of our own figures (Own content, C9b; Look 2, "Clean diagram", Gourav 23 November): the figure on white paper with
   the hand's flat blue shadow, and its title in a cream pill UNDER it, centred, in Mukta (teaching figures are the one
   place a label is not in the draughtsman's capitals: DESIGN.md). If the picture cannot be loaded the pill stays
   alone. */
.b-figure { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 0; background: none;
  box-shadow: none; }
.b-figure img { padding: 10px; background: #FFFFFF; box-shadow: -9px 9px 0 var(--cast-shadow); box-sizing: content-box; }
.b-figure .b-title { position: static; max-width: 100%; text-transform: none; white-space: normal; text-align: center;
  font: 600 18px/1.25 var(--read); letter-spacing: 0; padding: 7px 16px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
/* A table: a T in the board's ink, headings 700, cells 400; board.js sets the columns (270 px each for one or two).
   --fit (1 unless the board is too tall for its space; board.js, fitBoard) makes the type and the rows smaller
   together; the 3 px rules stay. A cell keeps 6 px above and below its words, so rows whose words wrap onto two or
   three lines stay apart (a one-line row is 58 px tall anyway, as in the mock-up). */
.b-table-in { display: grid; }
.b-tc { display: flex; align-items: center; justify-content: center; min-height: calc(58px * var(--fit, 1));
  padding: calc(6px * var(--fit, 1)) calc(14px * var(--fit, 1)); font: 400 calc(30px * var(--fit, 1))/1.15 var(--hand);
  text-align: center; overflow-wrap: anywhere; }
.b-th { min-height: calc(56px * var(--fit, 1)); font-weight: 700; border-bottom: 3px solid var(--board-ink); }
.b-rule { border-right: 3px solid var(--board-ink); }
.cols-3 .b-tc { font-size: calc(26px * var(--fit, 1)); }
.cols-4 .b-tc { font-size: calc(22px * var(--fit, 1)); }
/* M3, a question that counts. Gourav's pick of 23 November, look A, "Tara's board", copied from the mock-up: the
   question in Tara's hand (34 px, the board's line size), word by word, centred; beside a figure, left-aligned in
   the 280 px column. Its buttons stand in one row of equal widths under everything, as the class page's answer
   buttons (white, a 1.5 px ring, 12 px corners, Mukta 600 at 24 px, 72 px tall); a pressed one keeps the accent ring
   and fill, and the others fade when locked. A long label wraps inside its button, which grows taller (never under
   72 px): the row never runs past the board's 1000 px. */
.b-q { max-width: 900px; font: 400 34px/1.3 var(--hand); text-wrap: balance; }
.b-side.beside .b-q { max-width: none; }
.b-choices-in { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 20px; max-width: 1000px; }
.b-choices-in.enter { animation: fade .18s var(--enter) both; }
.b-choice { min-width: 150px; min-height: 72px; padding: 10px 28px; border: 1.5px solid var(--control-strong);
  border-radius: 12px; background: var(--surface); color: var(--ink); font: 600 24px/1.2 var(--read);
  overflow-wrap: anywhere; cursor: pointer; transition: background .12s, box-shadow .12s, transform .08s; }
.b-choice:hover:not(:disabled) { background: var(--hover); }
.b-choice:active:not(:disabled) { transform: translateY(1px); }
.b-choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.b-choice:disabled { cursor: default; }
.b-choice:disabled:not([aria-pressed="true"]) { opacity: .4; }
/* C9b part 2, a tell-back (Gourav's pick of 24 November, A, "under a line", copied from the mock-up): what is on the
   board stays as it was, in the middle; under it (28 px, the board's gap) a thin rule in the board's ink, 2 px at 32
   percent, 560 px wide; and 22 px under the rule the question in Tara's hand (34 px), centred. The rule draws in from
   its middle (240 ms, board.js TELL_BACK). With nothing above the question there is no rule (board.js hides it). The
   hand's letters reach about 4 px past a 34 px line at 1.3, and the question is the board's last line: 4 px under it
   keep its letters inside the board's space when the board is fitted to the last pixel. */
.b-under { display: flex; flex-direction: column; align-items: center; gap: 22px; padding-bottom: 4px; }
.b-rl { width: 560px; height: 0; border-top: 2px solid rgb(35 30 22 / .32); }
.b-rl.enter { animation: rule .24s var(--enter) both; }
@keyframes rule { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Tara writes word by word, left to right: each word wipes in (board.js sets its delay and its length) */
.w { display: inline-block; animation-name: wipe; animation-timing-function: cubic-bezier(.4, .2, .6, 1);
  animation-fill-mode: both; }
@keyframes wipe {
  from { clip-path: inset(-.35em 100% -.35em -.1em); }
  to { clip-path: inset(-.35em -.1em -.35em -.1em); }
}

/* M3 (plan 4b): the microphone help card. It sits over the board, in the same place (the board stays drawn under it,
   hidden, so it keeps its fit and takes no tap), while the class is paused for a blocked microphone. No box (DESIGN.md:
   the screen has no boxes): a title, the steps for this browser, one main button in ink, and a quiet line. Mukta, at
   the children's sizes. */
.v-class > .board, .v-class > .mic-help { grid-area: 1 / 1; }
.v-class.helping > .board { visibility: hidden; }
.mic-help { display: grid; gap: 26px; justify-items: center; width: 640px; max-width: 100%; }
.mh-steps { justify-self: stretch; display: grid; gap: 12px; margin: 0; padding: 0 0 0 1.5em; text-align: left;
  color: var(--ink); font: 500 24px/1.4 var(--read); }
.mh-steps li { padding-left: .25em; }
.mh-steps li::marker { color: var(--text-2); font-weight: 600; }
.mh-note { min-height: 28px; margin-top: -10px; color: var(--warn); font: 500 20px/1.4 var(--read); }
.mh-note:empty { visibility: hidden; }
.mh-grown-up { margin-top: -18px; color: var(--text-2); font: 500 18px/1.4 var(--read); }

/* Vedic's words, under the content, as they are heard */
.heard { position: absolute; left: 400px; width: 1000px; bottom: 36px; display: grid; gap: 6px; justify-items: center;
  text-align: center; opacity: 0; transition: opacity .2s; }
.heard.on { opacity: 1; }
.stage:not([data-view="class"]) .heard { display: none; }
.heard .who { color: var(--text-2); font: 500 12.5px/1 var(--code); letter-spacing: .08em; text-transform: uppercase; }
.heard p { max-width: 900px; color: var(--text-2); font: 500 22px/1.35 var(--read); }
.heard.final p { color: var(--ink); }

/* The calm screen (C12): two plain choices, nothing else */
.choices { display: grid; gap: 18px; justify-items: stretch; }
.choice { min-width: 360px; height: 64px; padding: 0 32px; border: 1.5px solid var(--control-strong); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: 600 22px/1 var(--read); cursor: pointer; transition: background .12s; }
.choice:hover:not(:disabled) { background: var(--hover); }
.choice:disabled { opacity: .5; cursor: default; }

.notice { display: grid; gap: 28px; justify-items: center; }

/* The quiet End button, top right; and "Tap to hear Tara" when the browser holds the sound back */
.end { position: absolute; top: 24px; right: 40px; height: 44px; padding: 0 18px; border: 1.5px solid var(--control-strong);
  border-radius: 999px; background: var(--surface); color: var(--ink); font: 600 15px/1 var(--sans); cursor: pointer; }
.end:hover:not(:disabled) { background: var(--hover); }
/* M3c: "Recording", top left, level with End, while a recorded class runs: a small red dot and one quiet word */
.rec-mark { position: absolute; top: 34px; left: 40px; display: flex; align-items: center; gap: 8px; color: var(--text-2);
  font: 500 15px/24px var(--sans); }
.rec-mark i { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.hear { position: absolute; left: 900px; top: 48px; transform: translateX(-50%); }
/* Fix 3b: "I'm back", while the class is paused and the camera is off; the camera's video is never shown */
.imback { position: absolute; left: 900px; top: 124px; transform: translateX(-50%); }
.facecheck { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .w, .b-piece.enter, .b-choices-in.enter, .b-rl.enter { animation: none; }
  .meter i, .bubble .sw, .heard, .b-choice, .primary, .choice { transition: none; }
}
