/* The whiteboard player (whiteboard.js), 2026-11-06.

   A board of its own: a dark slate on the dark themes, white paper on the white one, with a
   faint dot grid so it reads as a board and not a card. Written by hand, like the sign-in
   page's board: ITC Ronda, each letter's outline traced and then filled (whiteboard.js
   sets the dash and the opacities as the pen moves), by a pencil whose point is on the
   letter being written (2026-11-09). The ink has four jobs, each its own colour: the
   working (the page's ink), what you DO (gold: both-sides operations, arrows between lines,
   the answer box), what to LOOK AT (teal: circles, and the notes that name things, with
   their arrows), and what goes (red: crossings-out). Figures inside take the same --fig-*
   tokens the learner's figure cards use. */

.wb { display: flex; flex-direction: column; gap: 14px; }

.wb-board {
  --wb-paper: color-mix(in srgb, var(--paper) 70%, #000 30%);
  --wb-ink: var(--ink);
  --wb-do: var(--accent-ink);
  --wb-look: #57c7d0;
  --wb-gone: var(--heart);
  --wb-right: #4ade80;
  --wb-mark: rgba(246, 189, 0, 0.26);
  position: relative; border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  background-color: var(--wb-paper);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1.2px);
  background-size: 22px 22px;
  padding: 6px;
}
:root[data-theme="white"] .wb-board {
  --wb-paper: #ffffff;
  --wb-look: #0e7490;
  --wb-right: #15803d;
  --wb-mark: rgba(246, 189, 0, 0.32);
  --fig-text: #1e293b; --fig-axis: #475569; --fig-gold: #a16207; --fig-teal: #0e7490;
  --fig-faint: rgba(71, 85, 105, 0.35); --fig-shade: rgba(14, 116, 144, 0.45);
}
.wb-svg { display: block; width: 100%; height: auto; max-height: 70vh; }
/* The board being taught: the pencil's body leans out over the slate's edge as a hand's
   does, so the slate doesn't cut it off. */
.wb-board.wb-live, .wb-board.wb-live .wb-svg { overflow: visible; }

/* The wait while a board is written (whiteboard.js, loader): a small board a pencil draws
   on, where the real board will be; the chat eases the card to the real board's height when
   it arrives (home-tutor.js, tcSettleHeight). */
.wb-loader { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 12px;
  min-height: min(46vh, 320px); padding: 0 0 6px; animation: wb-loader-in .24s ease-out; }
/* The slate sits exactly where the real board's will, full width from the top; the room for
   the pencil to lean over the drawing is inside the SVG (LOAD_TOP), so it never leaves it. */
.wb-loader .wb-board { width: 100%; overflow: visible; }
.wb-loader .wb-svg { overflow: visible; }
.wb-loader .wb-board, .wb-loader .wb-loader-text { transition: opacity .18s ease-out; }
.wb-loader.hush .wb-loader-text { opacity: 0; }
.wb-loader.leaving .wb-board, .wb-loader.leaving .wb-loader-text { opacity: 0; }
/* The words for a screen reader: present, never seen. */
.wb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.wb-loader-text { display: inline-flex; align-items: baseline; gap: 7px; margin: 0; min-height: 1.5em;
  font: 400 20px/1.5 "ITC Ronda", Poppins, system-ui, sans-serif; color: var(--ink); transition: opacity .15s; }
.wb-loader-dots { display: inline-flex; gap: 4px; }
.wb-loader-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-ink); opacity: .3;
  animation: wb-loader-dot 1.2s ease-in-out infinite; }
.wb-loader-dots i:nth-child(2) { animation-delay: .2s; }
.wb-loader-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes wb-loader-dot { 0%, 70%, 100% { opacity: .3; } 35% { opacity: 1; } }
@keyframes wb-loader-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.wb { animation: wb-in .2s ease-out; }
@keyframes wb-in { from { opacity: 0; } to { opacity: 1; } }
.wb-loader-axis { stroke: color-mix(in srgb, var(--wb-ink) 62%, transparent); stroke-width: 2.8; }
.wb-loader-side { stroke: var(--wb-ink); stroke-width: 3; }
.wb-loader-tick { stroke: var(--k-good, #2fa67c); stroke-width: 4; }
.wb-loader-plot { stroke: var(--wb-look); stroke-width: 3; }
/* The pencil (whiteboard.js, pencilNode): a yellow hexagonal body in three facets, the
   sharpened wood with its scalloped paint edge, graphite, a crimped ferrule and a rubber,
   with one warm dark outline round the lot that reads on the slate and on white paper. A
   pencil is an object, so its colours are fixed, never the ink's (which change with the
   theme: the gold ink token is olive on white). Its shadow is a soft ellipse on the board. */
.wb-loader-pen-wood { fill: #eac89c; }
.wb-loader-pen-wood-under { fill: #d2a66e; }
.wb-loader-pen-light { fill: #ffe178; }
.wb-loader-pen-body { fill: var(--accent); }  /* the brand gold, the same on every theme */
.wb-loader-pen-dark { fill: #c48e06; }
.wb-loader-pen-metal-light { fill: #e3e7eb; }
.wb-loader-pen-metal { fill: #b4bbc3; }
.wb-loader-pen-metal-dark { fill: #7d858e; }
.wb-loader-pen-crimp { fill: none; stroke: #5f6770; stroke-width: .9; }
.wb-loader-pen-rubber { fill: #f2a4b5; }
.wb-loader-pen-rubber-light { fill: #ffc9d4; }
.wb-loader-pen-rubber-dark { fill: #d3808f; }
.wb-loader-pen-lead { fill: #6e6e6e; }
.wb-loader-pen-lines { fill: none; stroke: #3b2a12; stroke-opacity: .55; stroke-width: .8; }
.wb-loader-pen-edge { fill: none; stroke: #3b2a12; stroke-width: 1; stroke-linejoin: round; stroke-linecap: round; }
.wb-loader-shade { opacity: 1; }
:root[data-theme="white"] .wb-loader-shade { opacity: .6; }
@media (prefers-reduced-motion: reduce) { .wb-loader, .wb { animation: none; } }
@media (prefers-reduced-motion: reduce) { .wb-loader-dots i { animation: none; opacity: .6; } }
.wb-hand { font-family: "ITC Ronda", Poppins, "Segoe UI", system-ui, sans-serif; font-weight: 400; stroke-width: 0.9; stroke-linejoin: round; }
.wb-ink { fill: var(--wb-ink); stroke: var(--wb-ink); }
.wb-words { fill: color-mix(in srgb, var(--wb-ink) 82%, transparent); stroke: color-mix(in srgb, var(--wb-ink) 82%, transparent); }
.wb-op { fill: var(--wb-do); stroke: var(--wb-do); }
.wb-note { fill: var(--wb-look); stroke: var(--wb-look); }
.wb-stroke { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wb-fracbar { stroke: var(--wb-ink); stroke-width: 2.4; fill: none; }
.wb-arrow { stroke: var(--wb-do); stroke-width: 3; }
.wb-circle { stroke: var(--wb-look); stroke-width: 3.2; }
.wb-cross { stroke: var(--wb-gone); stroke-width: 3.6; }
.wb-box { stroke: var(--wb-do); stroke-width: 3.4; }
.wb-underline { stroke: var(--wb-do); stroke-width: 3; }
.wb-note-arrow { stroke: var(--wb-look); stroke-width: 2.4; }
.wb-highlight { fill: var(--wb-mark); }
.wb-tick { stroke: var(--wb-right); stroke-width: 3.8; }
/* A colour the teacher chose, to tie things together (a term and what it becomes). */
.wb-hand.wb-c-gold { fill: var(--wb-do); stroke: var(--wb-do); }
.wb-hand.wb-c-teal { fill: var(--wb-look); stroke: var(--wb-look); }
.wb-hand.wb-c-red { fill: var(--wb-gone); stroke: var(--wb-gone); }
.wb-hand.wb-c-green { fill: var(--wb-right); stroke: var(--wb-right); }
.wb-stroke.wb-c-gold { stroke: var(--wb-do); }
.wb-stroke.wb-c-teal { stroke: var(--wb-look); }
.wb-stroke.wb-c-red { stroke: var(--wb-gone); }
.wb-stroke.wb-c-green { stroke: var(--wb-right); }
.wb-highlight.wb-c-gold { fill: color-mix(in srgb, var(--wb-do) 30%, transparent); }
.wb-highlight.wb-c-teal { fill: color-mix(in srgb, var(--wb-look) 30%, transparent); }
.wb-highlight.wb-c-red { fill: color-mix(in srgb, var(--wb-gone) 30%, transparent); }
.wb-highlight.wb-c-green { fill: color-mix(in srgb, var(--wb-right) 30%, transparent); }

/* ---- the teacher's line ------------------------------------------------- */
/* Said a word at a time (whiteboard.js, tell): every word holds its place from the start,
   so the line never reflows, and each shows as it is said. */
.wb-caption { position: relative; min-height: 76px; padding: 2px 4px; }
.wb-count { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.wb-say { margin: 0; font-size: 20px; line-height: 1.45; color: var(--ink); max-width: 60ch; }
.wb-say .w { opacity: 0; transition: opacity .16s ease-out; }
.wb-say .w.said { opacity: 1; }
/* The board stops and asks: the question takes the teacher's line's place. */
.wb-caption.asking .wb-say { display: none; }
.wb-ask[hidden] { display: none; }
.wb-ask-q { margin: 0 0 10px; font: 400 21px/1.35 "ITC Ronda", Poppins, system-ui, sans-serif; color: var(--ink); max-width: 60ch; }
.wb-ask-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wb-ask-btn { min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); font: 600 16px Poppins, system-ui, sans-serif; cursor: pointer; }
.wb-ask-btn:hover:not(:disabled) { border-color: var(--accent); }
.wb-ask-btn:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.wb-ask-btn:disabled { cursor: default; }
.wb-ask-go { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.wb-ask-btn.right { border-color: var(--wb-right, #4ade80); box-shadow: inset 0 0 0 1.5px var(--wb-right, #4ade80); }
.wb-ask-btn.wrong { opacity: .6; text-decoration: line-through; }
.wb-ask-word { font-size: 16px; color: var(--ink); }

/* ---- controls ------------------------------------------------------------ */
.wb-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wb-btn, .wb-speed {
  display: inline-grid; place-items: center; height: 44px; min-width: 44px; padding: 0 10px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit;
}
.wb-btn svg { width: 22px; height: 22px; fill: currentColor; }
.wb-btn:hover, .wb-speed:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.wb-btn:focus-visible, .wb-speed:focus-visible, .wb-text summary:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.wb-main { min-width: 56px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.wb-main:hover { filter: brightness(1.05); }
.wb-speed { font-size: 14px; font-weight: 600; min-width: 54px; }
/* Read aloud (whiteboard.js, the voice): solid while it is on, as Play is, and its icon has
   sound waves, so it doesn't rest on a tint that vanishes on the white theme. */
.wb-voice[hidden] { display: none; }  /* nothing on this device or server can read aloud */
.wb-voice.on { color: var(--on-accent); border-color: var(--accent); background: var(--accent); }
.wb-dots { display: flex; gap: 6px; flex: 1; justify-content: center; min-width: 80px; }
.wb-dots span { width: 9px; height: 9px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 18%, transparent); transition: background .2s, transform .2s; }
.wb-dots span.done { background: color-mix(in srgb, var(--accent) 60%, transparent); }
.wb-dots span.now { background: var(--accent); transform: scale(1.3); }

/* ---- the text version ---------------------------------------------------- */
.wb-text { border-top: 1px solid var(--line); padding-top: 10px; color: var(--muted); font-size: 14px; }
.wb-text summary { cursor: pointer; font-weight: 600; color: var(--ink); width: max-content; }
.wb-text ol { margin: 10px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; line-height: 1.5; }
.wb-text p { margin: 0; color: var(--ink); }
.wb-text ul { margin: 4px 0 0; padding-left: 18px; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .wb-say { font-size: 17px; }
  .wb-board { border-radius: 14px; padding: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .wb-dots span { transition: none; }
  .wb-say .w { transition: none; }
}
