/* ===== CHALK HANDWRITING FACE =====
   Caveat, SIL Open Font License 1.1 - see fonts/OFL.txt. Google Fonts build
   v23, latin + latin-ext subsets. One variable file covers the whole 400-700
   axis, so weights 500 and 700 share a source.
   Loaded from our own origin on purpose: the CSP style-src does not list
   fonts.googleapis.com, the SW cannot usefully cache a cross-origin font, and
   a font request is a third-party disclosure of every child's IP address. */
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/caveat-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/caveat-latin.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;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; }

/* Dark-mode base colours — mirrors Tailwind's bg-slate-50 / dark:bg-gray-900.
   Applied here so the page has the correct background even when the Tailwind
   CDN is unavailable (offline). */
body { background-color: #f8fafc; }
html.dark body { background-color: #111827; }

/* ===== PAGE-LOAD SPINNER =====
   Rendered on <html> pseudo-elements so it shows through body opacity:0.
   Both pieces fade out when protect.js removes the ps-loading class, and the
   body fades in simultaneously — a clean crossfade from spinner to app. */
@keyframes ps-spin { to { transform: rotate(360deg); } }

/* Dark overlay + centred pencil emoji */
html::before {
  content: '✏️';
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: #111827;
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease-out;
}
html:not(.dark)::before { background: #f8fafc; }
html.ps-loading::before {
  opacity: 1;
  pointer-events: all;
}

/* Spinning indigo ring around the emoji */
html::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border: 3px solid rgba(129, 140, 248, 0.2);
  border-top-color: #818cf8;
  border-radius: 50%;
  animation: ps-spin 0.85s linear infinite;
  z-index: 9001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease-out;
}
html.ps-loading::after {
  opacity: 1;
}

/* ===== CONTENT PROTECTION ===== */
/* Text selection is enabled app-wide for now; individual controls
   (buttons, tabs, chips) still opt out via user-select: none below. */
body { -webkit-user-select: text; user-select: text; }

/* Coming-soon subject cards */
button.track-card:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

/* ===== TOGGLE SWITCH ===== */
.toggle-bg  { transition: background-color 0.2s ease; }
.toggle-dot { transition: transform 0.2s ease; }

/* ===== PARENT DASHBOARD TABS ===== */
.pd-tab { transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
/* Opacity-only, no transform: an element that is EVER transform-animated can
   stay on its own Chromium compositing layer for a while after the animation
   ends, even once the CSS transform value itself has reverted to none (the
   "backwards"/"forwards" fill-mode distinction does not prevent this - it only
   controls the CSS value, not the compositor's promotion cooldown). Any input
   under such a layer can have its native autofill/suggestion popover silently
   stop registering clicks for that whole cooldown window. Dropping the
   translateY slide removes the trigger entirely instead of racing its timing.
   See also engine/protect.js and the screen-auth/reset-password/family-setup
   card restructure for the same underlying bug. */
.pd-tab-content { animation: fadeSlideIn 0.2s ease both; }

/* ===== SCREEN TRANSITIONS ===== */
.screen { animation: fadeSlideIn 0.3s ease both; }
.screen.hidden { display: none !important; }
@keyframes fadeSlideIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white; font-weight: 600; padding: 0.5rem 1.25rem;
  border-radius: 0.75rem; border: none; cursor: pointer;
  transition: all 0.2s; box-shadow: 0 2px 8px rgba(59,130,246,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(59,130,246,0.45); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: #e2e8f0; color: #374151; font-weight: 600;
  padding: 0.5rem 1.25rem; border-radius: 0.75rem; border: none;
  cursor: pointer; transition: all 0.2s;
}
.dark .btn-secondary { background: #374151; color: #e5e7eb; }
.btn-secondary:hover { background: #cbd5e1; }
.dark .btn-secondary:hover { background: #4b5563; }

/* The last-question finishing button. Green, and larger than an ordinary
   primary: at the end of an exam this is the only thing a child is looking for,
   and it competes with a small ✓ Submit pill up in the toolbar that they have
   been ignoring for forty questions. Applied on top of .btn-primary by
   renderExamQuestion(), so it only has to override what differs. */
.btn-finish {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.4) !important;
  padding: 0.625rem 1.5rem;
  font-size: 1rem;
}
.btn-finish:hover { box-shadow: 0 4px 16px rgba(34, 197, 94, 0.5) !important; }

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white; font-weight: 600; padding: 0.5rem 1.25rem;
  border-radius: 0.75rem; border: none; cursor: pointer; transition: all 0.2s;
}
.btn-danger:hover { transform: translateY(-1px); filter: brightness(1.1); }

.btn-ghost {
  background: transparent; color: #6b7280; padding: 0.375rem 0.75rem;
  min-height: 2.75rem;
  border-radius: 0.5rem; border: 1px solid #e5e7eb; cursor: pointer;
  font-size: 0.8rem; transition: all 0.2s;
  display: inline-flex; align-items: center;
}
.dark .btn-ghost { border-color: #4b5563; color: #9ca3af; }
.btn-ghost:hover { background: #f3f4f6; border-color: #d1d5db; }
.dark .btn-ghost:hover { background: #374151; }

.back-btn {
  display: inline-flex; align-items: center; gap: 0.25rem;
  color: #6b7280; font-size: 0.875rem; font-weight: 500;
  cursor: pointer; background: none; border: none; padding: 0;
  transition: color 0.2s;
}
.back-btn:hover { color: #1d4ed8; }
.dark .back-btn { color: #9ca3af; }
.dark .back-btn:hover { color: #60a5fa; }

/* Parent dashboard action row.
   These used to be six pill buttons in six different pastel colours, which read
   as six unrelated things and matched nothing else in the app. Same shape
   language as .nav-btn in the student bottom bar instead: icon over a small
   label, one neutral surface, and colour reserved for the two buttons where it
   carries meaning - the primary action, and the privileged one. */
/* ⚠ Deliberately NOT a .pd-action, and deliberately not IN that row.
   Handing the device to a child is the most frequent thing a parent does on
   this screen, and as one of seven identical tiles it read as a settings item
   - parents could not find it, which is why there is an onboarding nudge
   pointing at it at all. Promoting it inside the row would have meant a second
   loud colour competing with "Add child" and breaking the one shape language
   that row exists to have, so it is lifted OUT and sits above: full width on a
   phone, a stated purpose, and a direction to travel in. */
.pd-switch {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  padding: 0.75rem 1rem; border-radius: 1rem; text-align: left;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: 1px solid #4338ca; color: #fff; cursor: pointer;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.30);
  transition: box-shadow 0.15s, transform 0.15s, filter 0.15s;
}
/* Same reason as .pd-action.hidden: style.css loads after the Tailwind CDN, so
   a bare display:flex here would outrank Tailwind's .hidden. */
.pd-switch.hidden { display: none; }
.pd-switch:hover  { filter: brightness(1.08); box-shadow: 0 4px 16px rgba(79, 70, 229, 0.40); transform: translateY(-1px); }
.pd-switch:active { transform: translateY(0); }
.pd-switch:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 2px; }
.pd-switch-ico   { font-size: 1.5rem; line-height: 1; flex: 0 0 auto; }
.pd-switch-text  { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; flex: 1 1 auto; }
.pd-switch-title { font-size: 0.9rem; font-weight: 800; line-height: 1.2; }
/* Not white at full strength: the subtitle is support, and at 0.85 it still
   clears 4.5:1 against this gradient. */
.pd-switch-sub   { font-size: 0.7rem; font-weight: 500; line-height: 1.35; color: rgba(255, 255, 255, 0.85); }
.pd-switch-go    { font-size: 1.15rem; font-weight: 700; flex: 0 0 auto; opacity: 0.9; }
#pd-children-grid .pd-child-card { background: #f0f7ff; color: #1e293b; }
.dark #pd-children-grid .pd-child-card { background: #273449; color: #e2e8f0; }
.pd-child-card:focus-visible { outline: 3px solid #6366f1; outline-offset: 3px; }
.pd-child-today { padding: 0.75rem; border-radius: 0.75rem; background: #e0f2fe; color: #0c4a6e; font-size: 0.875rem; }
.dark .pd-child-today { background: #23445c; color: #e0f2fe; }
.pd-child-subjects { color: #475569; }
.dark .pd-child-subjects { color: #cbd5e1; }
.pd-subject-chip { padding: 0.3rem 0.5rem; border-radius: 0.5rem; font-size: 0.75rem; background: #e2e8f0; color: #334155; }
.dark .pd-subject-chip { background: #334155; color: #e2e8f0; }
.pd-child-next { margin-top: 1rem; font-size: 0.8rem; color: #475569; }
.dark .pd-child-next { color: #cbd5e1; }
.pd-child-open { display: block; margin-top: 0.75rem; font-size: 0.875rem; font-weight: 700; color: #4338ca; }
.dark .pd-child-open { color: #c7d2fe; }
.pd-weekly-details { padding: 1rem; border: 1px solid #cbd5e1; border-radius: 1rem; background: #f8fafc; color: #334155; }
.pd-weekly-details > summary { cursor: pointer; font-weight: 700; }
.dark .pd-weekly-details { background: #273449; color: #e2e8f0; border-color: #52647e; }
/* Full width is right on a phone, where it is the first thing under the family
   card. On a wider screen a full-bleed bar reads as a banner, not a button. */
@media (min-width: 640px) {
  .pd-switch { width: auto; min-width: 21rem; }
}
.dark .pd-switch { border-color: #6366f1; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }

.pd-action {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.25rem; min-width: 4.5rem; padding: 0.5rem 0.4rem;
  border-radius: 0.875rem; background: #fff; border: 1px solid #e5e7eb;
  color: #475569; font-size: 0.65rem; font-weight: 600; line-height: 1;
  cursor: pointer; transition: all 0.15s; flex: 0 0 auto; position: relative;
}
.pd-action .ico { font-size: 1.15rem; line-height: 1; }
/* style.css loads after the Tailwind CDN, so a bare `display:flex` here would
   outrank Tailwind's `.hidden` and reveal the Admin button to every parent.
   Two classes beats one, whichever sheet ends up last. */
.pd-action.hidden { display: none; }
.pd-action:hover { background: #f8fafc; border-color: #cbd5e1; transform: translateY(-1px); }
.pd-action:active { transform: translateY(0); }
.dark .pd-action { background: #1f2937; border-color: #374151; color: #cbd5e1; }
.dark .pd-action:hover { background: #374151; border-color: #4b5563; }

.pd-action.is-primary { background: #4f46e5; border-color: #6366f1; color: #fff; }
.pd-action.is-primary:hover { background: #4f46e5; border-color: #4f46e5; }
.dark .pd-action.is-primary { background: #4f46e5; border-color: #6366f1; color: #fff; }
.dark .pd-action.is-primary:hover { background: #4f46e5; }

/* Credit balance on the Shop button. .pd-action is already position:relative. */
.pd-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: #f59e0b; color: #fff;
  font-size: 0.625rem; font-weight: 800; line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.pd-badge.hidden { display: none; }

.pd-action.is-alert { border-color: #fecaca; color: #dc2626; }
.pd-action.is-alert:hover { background: #fef2f2; border-color: #fca5a5; }
.dark .pd-action.is-alert { border-color: #7f1d1d; color: #f87171; background: #1f2937; }
.dark .pd-action.is-alert:hover { background: #450a0a; }

/* ═══════════ HEADER CONTROLS ═══════════
   One component for every button in the app header. They used to be eight
   separate ad-hoc pills - four different paddings, four different font sizes,
   six different pastel backgrounds - so the row's total width depended on which
   ones happened to be visible and how big the device's system font was. On a
   Samsung (One UI ships a larger default text size than stock Android) the row
   grew past the viewport and the branding was pushed out of view.

   Fixed height, fixed icon box, one neutral surface. Colour is spent only where
   it means something: the parent/teacher switch, install, and logout. */
.hdr-btn {
  display: inline-flex; align-items: center; gap: 0.375rem;
  /* 0.55rem, not the 0.6 it started at: with all eight controls showing the
     labelled toolbar came out 2px wider than the space the max-w-6xl container
     leaves it, and wrapped the whole row for the sake of two pixels. */
  height: 2.25rem; padding: 0 0.55rem;
  flex: 0 0 auto;                       /* never squash below its own size */
  border: 1px solid #e5e7eb; border-radius: 999px;
  background: #f8fafc; color: #475569;
  font-size: 0.75rem; font-weight: 600; line-height: 1;
  cursor: pointer; transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* Two classes, so it outranks Tailwind's single-class `.flex` that the show/hide
   code in auth.js and app.js adds alongside `.hidden`. Without this the Teacher
   and Admin buttons would be visible to every account. */
.hdr-btn.hidden { display: none !important; }
.hdr-btn .hdr-ico { font-size: 1rem; line-height: 1; flex: 0 0 auto; }
.hdr-btn .hdr-word { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.5; }
/* Leave room for descenders (g, p, y). Only variable-length labels need clipping. */
.hdr-btn.is-logout .hdr-word { overflow: visible; max-width: none; flex-shrink: 0; }
.hdr-btn .hdr-mobile-word { line-height: 1.5; }
/* The account chip is the only label whose width is user data, and at the 7rem
   cap a long Mauritian name ("Priyanka Ramgoolam") made it 161px - enough on
   its own to push the full eight-button toolbar past the 1152px the max-w-6xl
   container ever gets, so the row wrapped even on a 4K monitor. 4.5rem brings
   the worst case to 1114px and it fits; the name still reads. */
.hdr-btn.is-profile .hdr-word { max-width: 4.5rem; }
.hdr-btn:hover { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.hdr-btn:active { transform: scale(0.96); }
/* ── Labelled pills, or one "Menu" button ──
   The width at which the words fit is measured, not guessed: with all eight
   controls visible (an admin parent with the install prompt showing) the
   labelled toolbar needs ~810px at its widest - the account chip's name can run
   to the 7rem cap - and the branding beside it another 234px, plus the row gap
   and the container's own padding. That is ~1090px before anything wraps, which
   is why the pills only appear at 1100px.

   ⚠ Below that they are HIDDEN, not shrunk. Three approaches have now been
   tried on this row and only the third answers the actual complaint:

   1. Labelled pills on phones (the original). Seven controls took TWO rows at
      every width from 360 to 428 and made the header 136px tall.
   2. Icon-only squares. One tidy 94px row - and unusable: reported back as
      "the top icons are not intuitive on mobile, we don't know what each one
      does". Which is exactly what an emoji on its own is. 🔒 could be a lock, a
      password or a private mode; 💬 could be chat, comments or feedback. Saving
      42px of header was not worth making every control a guess.
   3. One labelled Menu button opening a sheet where each action has its name
      AND a line of description. The header is a single 94px row, and nothing
      in it has to be guessed at.

   Also learned the hard way: `#hdr-actions { flex-shrink: 0 }` to stop a
   five-pixel wrap at 1024 stopped it by letting the row OVERFLOW instead - at
   768 and 820 the toolbar ran to 876px and Logout sat off the right edge,
   invisible because the page-level overflow guard clipped it. The toolbar must
   be allowed to wrap; a two-row header is survivable, a control you cannot
   reach is not. */
#hdr-menu-btn { display: none; }
.hdr-btn.is-menu { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.dark .hdr-btn.is-menu { background: rgba(79,70,229,0.25); border-color: rgba(99,102,241,0.45); color: #c7d2fe; }
.hdr-btn.is-menu .hdr-ico { font-size: 1.05rem; }
.hdr-menu-word { font-weight: 700; }

/* The mobile-only Logout twin. Hidden at every width where the labelled pills
   are showing, or there would be two Log out buttons side by side. */
#header-logout-mobile { display: none; }
.hdr-mobile-word { font-weight: 700; white-space: nowrap; }

@media (max-width: 1099px) {
  /* Everything except the two controls that stay: the Menu button, and the
     Logout twin. :not() keeps this to one rule - the alternative was a second
     rule re-showing them and racing its own hide. */
  header #hdr-actions .hdr-btn:not(#hdr-menu-btn):not(#header-logout-mobile) { display: none !important; }
  #hdr-menu-btn { display: inline-flex; }
  /* ⚠ `.hidden` has to keep winning here: showScreen() and auth.js hide this
     button on the auth screens and when nobody is signed in. Two classes beats
     the id? No - an id (1,0,0) outranks any number of classes, so this rule is
     scoped to :not(.hidden) rather than relying on order. */
  #header-logout-mobile:not(.hidden) { display: inline-flex; }
  /* A finger needs a bigger target than a mouse pointer: 36px is under the 44px
     both platforms ask for. */
  @media (pointer: coarse) {
    #hdr-menu-btn, #header-logout-mobile { height: 2.5rem; }
  }
}

/* ── The menu sheet ──
   Bottom-anchored on a phone (the header is the furthest point from a thumb),
   a normal centred card from 640px up where reach is not the issue. */
.hdr-menu-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  border-radius: 1.25rem 1.25rem 0 0;
  max-height: 85vh;
  padding-bottom: env(safe-area-inset-bottom);
  animation: hdrSheetUp 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
@keyframes hdrSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .hdr-menu-sheet { animation: none; } }
@supports (max-height: 85dvh) { .hdr-menu-sheet { max-height: 85dvh; } }

@media (min-width: 640px) {
  .hdr-menu-sheet {
    left: auto; right: 1rem; bottom: auto; top: 4.5rem;
    width: 22rem; max-width: calc(100vw - 2rem);
    border-radius: 1rem;
    animation-name: hdrSheetDrop;
  }
  @keyframes hdrSheetDrop {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

.hdr-menu-item {
  display: flex; align-items: center; gap: 0.875rem; width: 100%;
  padding: 0.75rem 0.875rem; border: none; background: none; border-radius: 0.875rem;
  text-align: left; cursor: pointer; transition: background-color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.hdr-menu-item:hover  { background: #f1f5f9; }
.dark .hdr-menu-item:hover { background: #374151; }
.hdr-menu-item:active { background: #e2e8f0; }
.dark .hdr-menu-item:active { background: #4b5563; }
.hdr-menu-item .mi-ico {
  font-size: 1.35rem; line-height: 1; flex: 0 0 2.5rem; height: 2.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 0.75rem; background: #f1f5f9;
}
.dark .hdr-menu-item .mi-ico { background: #374151; }
.hdr-menu-item .mi-label { font-size: 0.875rem; font-weight: 700; color: #1e293b; line-height: 1.2; }
.dark .hdr-menu-item .mi-label { color: #f1f5f9; }
.hdr-menu-item .mi-desc  { font-size: 0.6875rem; color: #64748b; line-height: 1.3; margin-top: 0.125rem; }
.dark .hdr-menu-item .mi-desc { color: #94a3b8; }
/* Sign out sits under a divider: it is the one row nobody wants to hit by
   accident on the way to something else. */
.hdr-menu-item.is-danger { margin-top: 0.25rem; border-top: 1px solid #e5e7eb; border-radius: 0 0 0.875rem 0.875rem; }
.dark .hdr-menu-item.is-danger { border-top-color: #374151; }
.hdr-menu-item.is-danger .mi-label { color: #dc2626; }
.dark .hdr-menu-item.is-danger .mi-label { color: #f87171; }
.hdr-menu-item.is-danger .mi-ico { background: #fee2e2; }
.dark .hdr-menu-item.is-danger .mi-ico { background: rgba(220,38,38,0.2); }
.dark .hdr-btn { background: #374151; border-color: #4b5563; color: #d1d5db; }
.dark .hdr-btn:hover { background: #4b5563; border-color: #6b7280; color: #e5e7eb; }

.hdr-btn.is-parent  { background: #ede9fe; border-color: #ddd6fe; color: #6d28d9; }
.dark .hdr-btn.is-parent { background: rgba(124,58,237,0.22); border-color: rgba(139,92,246,0.4); color: #ddd6fe; }
.hdr-btn.is-teacher { background: #dcfce7; border-color: #bbf7d0; color: #15803d; }
.dark .hdr-btn.is-teacher { background: rgba(22,163,74,0.22); border-color: rgba(34,197,94,0.4); color: #bbf7d0; }
.hdr-btn.is-install { background: #dcfce7; border-color: #bbf7d0; color: #15803d; }
.dark .hdr-btn.is-install { background: rgba(22,163,74,0.22); border-color: rgba(34,197,94,0.4); color: #bbf7d0; }
.hdr-btn.is-profile { background: #e0e7ff; border-color: #c7d2fe; color: #4338ca; }
.dark .hdr-btn.is-profile { background: rgba(79,70,229,0.25); border-color: rgba(99,102,241,0.45); color: #c7d2fe; }
.hdr-btn.is-logout  { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.dark .hdr-btn.is-logout { background: rgba(220,38,38,0.2); border-color: rgba(248,113,113,0.4); color: #fca5a5; }

/* Streak / XP read-outs. Same height as the buttons so the row has one
   baseline whichever of them happen to be visible. */
.hdr-stat {
  display: inline-flex; align-items: center; gap: 0.3rem;
  height: 2.25rem; padding: 0 0.6rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; line-height: 1; flex: 0 0 auto;
}
.hdr-stat-streak { background: #ffedd5; color: #ea580c; }
.dark .hdr-stat-streak { background: rgba(234,88,12,0.22); color: #fdba74; }
.hdr-stat-xp { background: #f3e8ff; color: #7e22ce; gap: 0.4rem; }
/* updateXPBar() fills this; before a student is signed in it is empty, and an
   empty pill in the toolbar reads as a control that failed to load. */
.hdr-stat-xp:empty { display: none; }
.dark .hdr-stat-xp { background: rgba(126,34,206,0.25); color: #e9d5ff; }
.hdr-stat-word { font-size: 0.7rem; font-weight: 600; opacity: 0.85; }

/* The child's level. Same shape as the credits chip, and mutually exclusive
   with it - a child sees a level, a parent sees credits. */
.hdr-stat-level {
  background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe;
  cursor: pointer; transition: background-color 0.15s, border-color 0.15s;
}
.hdr-stat-level:hover { background: #ddd6fe; border-color: #c4b5fd; }
.dark .hdr-stat-level { background: rgba(109,40,217,0.28); color: #ddd6fe; border-color: rgba(139,92,246,0.45); }
.dark .hdr-stat-level:hover { background: rgba(109,40,217,0.42); }

/* The credit balance. A button, not a read-out - it opens the Shop, which is
   the only place the number means anything. */
.hdr-stat-credits {
  background: #fef3c7; color: #b45309; border: 1px solid #fde68a;
  cursor: pointer; transition: background-color 0.15s, border-color 0.15s;
}
.hdr-stat-credits:hover { background: #fde68a; border-color: #fcd34d; }
.dark .hdr-stat-credits { background: rgba(180,83,9,0.25); color: #fcd34d; border-color: rgba(217,119,6,0.45); }
.dark .hdr-stat-credits:hover { background: rgba(180,83,9,0.4); }
/* Two classes, so it outranks .hdr-stat's own display when app.js hides it for
   a student session or a database with no credits deployed. */
.hdr-stat.hidden { display: none !important; }

/* The streak chip exists twice - beside the branding on a phone, in the action
   row from 640px up - so exactly one of them must be showing at any width.
   Done with ids, not Tailwind's `hidden`/`sm:flex`, because .hdr-stat is a
   single class in a sheet that loads after the CDN and would outrank both. */
#streak-display { display: none; }
@media (min-width: 640px) { #streak-display { display: inline-flex; } }

/* A streak and an XP level belong to a CHILD. In a parent session DB holds
   whichever child is currently loaded, so those chips were showing a parent
   somebody else's numbers. A parent's header read-out is their credit balance
   instead - see _renderCreditChip(), which sets this class. !important and an
   id because both rules above are ids too. */
body.is-parent-session #streak-display,
body.is-parent-session #streak-display-m,
body.is-parent-session #xp-display { display: none !important; }

/* .icon-btn is gone: the three header controls that used it (Search, Forum,
   Theme) are .hdr-btn now, and it had no other caller anywhere in the repo. */

/* ===== TRACK CARDS ===== */
.track-card {
  background: white; border-radius: 1.25rem; padding: 1.5rem;
  text-align: left; border: 2px solid transparent;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  cursor: pointer; transition: all 0.25s; width: 100%;
}
.dark .track-card { background: #1e293b; }
.track-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
#btn-exam-mode:hover   { border-color: #3b82f6; }
#btn-chapter-mode:hover{ border-color: #22c55e; }

/* ===== CHIPS / BADGES ===== */
.chip {
  display: inline-flex; align-items: center; padding: 0.2rem 0.65rem;
  border-radius: 9999px; font-size: 0.7rem; font-weight: 600;
}
.chip.blue   { background:#dbeafe; color:#1d4ed8; }
.chip.purple { background:#ede9fe; color:#6d28d9; }
.chip.green  { background:#dcfce7; color:#15803d; }
.chip.amber  { background:#fef3c7; color:#92400e; }
.chip.gray   { background:#f1f5f9; color:#475569; }
.dark .chip.blue   { background:#1e3a5f; color:#93c5fd; }
.dark .chip.purple { background:#2e1065; color:#c4b5fd; }
.dark .chip.green  { background:#052e16; color:#86efac; }
.dark .chip.amber  { background:#451a03; color:#fcd34d; }
.dark .chip.gray   { background:#1e293b; color:#94a3b8; }

/* ===== EXAM OPTION ===== */
.exam-opt {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem; border-radius: 0.875rem;
  border: 2px solid #e5e7eb; cursor: pointer;
  transition: all 0.2s; -webkit-user-select: none; user-select: none;
}
.dark .exam-opt { border-color: #374151; }
.exam-opt:hover { border-color: #3b82f6; background: #eff6ff; }
.dark .exam-opt:hover { background: #1e3a5f; }
.exam-opt input[type=radio] { accent-color: #3b82f6; width: 1.1rem; height: 1.1rem; }
.exam-opt:has(input:checked) { border-color: #3b82f6; background: #eff6ff; }
.dark .exam-opt:has(input:checked) { background: #1e3a5f; border-color: #3b82f6; }

/* ===== EXAM CONFIG (chalkboard theme) ===== */
#screen-exam-config { background: #1a2318; }
.dark #screen-exam-config { background: linear-gradient(145deg,#111 0%,#0a0f0a 60%,#0d1410 100%); }
.exam-cfg-outer { max-width: 560px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.exam-cfg-intro { color: rgba(240,236,220,.65); font-size: .9rem; margin-bottom: 1.5rem; }
.exam-cfg-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }
.exam-cfg-card {
  display: block; cursor: pointer; border-radius: 1rem;
  border: 1.5px solid rgba(240,236,220,.15);
  background: rgba(255,255,255,.06);
  transition: border-color .18s, background .18s;
}
.exam-cfg-card:hover { border-color: rgba(240,236,220,.38); background: rgba(255,255,255,.11); }
.exam-cfg-card:has(input:checked) { border-color: #86efac; background: rgba(134,239,172,.1); }
.exam-cfg-card input[type=radio] { position: absolute; opacity: 0; width: 0; height: 0; }
.exam-cfg-body { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; }
.exam-cfg-icon { font-size: 1.8rem; flex-shrink: 0; }
.exam-cfg-text { flex: 1; min-width: 0; }
.exam-cfg-name { font-family: 'Caveat', cursive; font-size: 1.25rem; color: #f0ece8; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.exam-cfg-badge { font-family: sans-serif; font-size: .68rem; font-weight: 700; background: rgba(134,239,172,.25); color: #86efac; border-radius: 999px; padding: .1rem .55rem; }
.exam-cfg-desc { font-size: .82rem; color: rgba(240,236,220,.6); margin-top: .1rem; }
.exam-cfg-start {
  width: 100%; padding: .85rem; border-radius: 1rem; border: none; cursor: pointer;
  font-family: 'Caveat', cursive; font-size: 1.35rem; font-weight: 700;
  background: linear-gradient(135deg,#4ade80,#22c55e); color: #052e16;
  transition: opacity .15s;
}
.exam-cfg-start:hover { opacity: .9; }

/* ===== MCQ OPTIONS ===== */
.mcq-opt {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; padding: 0.75rem 1rem; border-radius: 0.75rem;
  border: 2px solid #e5e7eb; cursor: pointer; text-align: left;
  background: white; transition: all 0.18s; margin-bottom: 0.5rem;
  font-size: 0.95rem; color: #374151;
}
.dark .mcq-opt { background: #1e293b; border-color: #374151; color: #e5e7eb; }
.mcq-opt:hover:not(.disabled) { border-color: #93c5fd; background: #eff6ff; }
.dark .mcq-opt:hover:not(.disabled) { background: #1e3a5f; border-color: #60a5fa; }
.mcq-opt.selected { border-color: #3b82f6; background: #eff6ff; }
.dark .mcq-opt.selected { background: #1e3a5f; border-color: #60a5fa; }
.mcq-opt.correct { border-color: #22c55e; background: #f0fdf4 !important; }
.dark .mcq-opt.correct { background: #052e16 !important; }
.mcq-opt.wrong { border-color: #ef4444; background: #fef2f2 !important; }
.dark .mcq-opt.wrong { background: #450a0a !important; }
.mcq-opt.disabled { cursor: not-allowed; pointer-events: none; }

/* Correct/wrong must NOT be signalled by colour alone: red/green is the exact
   pair a deuteranope cannot separate, and prefers-reduced-motion (below)
   strips the pulse/shake, leaving hue as the only channel. The glyph is a
   flex child pushed to the trailing edge, so it never reflows option text. */
.mcq-opt.correct::after,
.mcq-opt.wrong::after {
  margin-left: auto; flex-shrink: 0;
  font-weight: 800; font-size: 1.05rem; line-height: 1;
}
.mcq-opt.correct::after { content: '\2713'; color: #16a34a; }
.mcq-opt.wrong::after   { content: '\2717'; color: #dc2626; }
.dark .mcq-opt.correct::after { color: #4ade80; }
.dark .mcq-opt.wrong::after   { color: #f87171; }
/* Read-aloud: the option currently being spoken. A Grade 1 child is following
   the voice with their eyes, so this must read at a glance from arm's length.
   ⚠ Amber, not blue/green/red: those three already mean chosen, right and
   wrong on this same element, and a fourth meaning in the same hue would be
   read as one of them. ⚠ Colour is not the only channel - the box also grows
   and lifts, so it still reads for a child who cannot separate the hues.
   ⚠ !important, because .correct/.wrong set background the same way: a
   question being re-read after it was answered must still show what is being
   spoken now. */
.mcq-opt.tts-reading {
  border-color: #f59e0b !important;
  background: #fffbeb !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.28);
  transform: scale(1.015);
}
.dark .mcq-opt.tts-reading {
  border-color: #fbbf24 !important;
  background: #422006 !important;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3);
}
.mcq-opt.tts-reading .opt-letter { background: #f59e0b; color: white; }
/* The scale is decoration; the border, ground and ring carry the meaning. */
@media (prefers-reduced-motion: reduce) {
  .mcq-opt.tts-reading { transform: none; }
}
.opt-letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: #e2e8f0; font-weight: 700; font-size: 0.75rem;
  color: #475569; flex-shrink: 0;
}
.dark .opt-letter { background: #374151; color: #cbd5e1; }
.selected .opt-letter { background: #3b82f6; color: white; }
.correct .opt-letter { background: #22c55e; color: white; }
.wrong .opt-letter { background: #ef4444; color: white; }

/* ===== NUMERIC INPUT ===== */
.num-input {
  width: 100%; padding: 0.75rem 1rem; border-radius: 0.75rem;
  border: 2px solid #e5e7eb; font-size: 1.1rem; font-weight: 500;
  color: #1e293b; background: white; outline: none; transition: border-color 0.2s;
}
.dark .num-input { background: #1e293b; border-color: #374151; color: #f1f5f9; }
.num-input:focus { border-color: #3b82f6; }
.num-input.correct { border-color: #22c55e; background: #f0fdf4; }
.dark .num-input.correct { background: #052e16; }
.num-input.wrong { border-color: #ef4444; background: #fef2f2; }
.dark .num-input.wrong { background: #450a0a; }

/* ===== NAVIGATION GRID ===== */
.nav-btn {
  width: 2rem; height: 2rem; border-radius: 0.375rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.15s;
}
.nav-btn.unanswered { background: #e2e8f0; color: #475569; }
.dark .nav-btn.unanswered { background: #374151; color: #d1d5db; }
.nav-btn.answered { background: #bbf7d0; color: #166534; }
.dark .nav-btn.answered { background: #052e16; color: #86efac; }
.nav-btn.flagged { background: #fecaca; color: #991b1b; }
.dark .nav-btn.flagged { background: #450a0a; color: #fca5a5; }
.nav-btn.current { background: #3b82f6; color: white; }
.nav-btn:hover { transform: scale(1.1); }

.nav-legend { display: inline-block; width: 1.1rem; height: 1.1rem; border-radius: 0.25rem; }

/* ===== MASTERY BAR ===== */
.mastery-item { padding: 0.5rem 0; }
.mastery-bar-bg { height: 6px; background: #e2e8f0; border-radius: 9999px; overflow: hidden; }
.dark .mastery-bar-bg { background: #374151; }
.mastery-bar-fill { height: 100%; border-radius: 9999px; transition: width 1s ease; }

/* ═══════════ CHAPTER PRACTICE ═══════════
   The card is an <article> with a transparent full-bleed <button> (.ch-hit)
   layered over it, NOT a <button> itself. It used to be a button containing
   the flag button, and a nested <button> makes the HTML parser close the outer
   one - so the icon, title, bar and CTA all escaped the card and the screen
   rendered as a row of empty boxes with loose text under them. Keep .ch-hit
   above .ch-body in z-order and the whole card stays one tap target. */

.ch-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.ch-header-text { min-width: 12rem; flex: 1; }
.ch-title    { font-size: 1.5rem; font-weight: 800; color: #1f2937; line-height: 1.2; }
.dark .ch-title { color: #fff; }
.ch-subtitle { font-size: 0.8rem; color: #64748b; margin-top: 0.2rem; }

.ch-search-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; flex: 0 0 auto;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  color: #4f46e5; background: #eef2ff; border: 1px solid #c7d2fe;
  padding: 0.55rem 0.9rem; border-radius: 0.75rem; transition: background 0.15s;
}
.ch-search-btn:hover { background: #e0e7ff; }
.dark .ch-search-btn { color: #c7d2fe; background: rgba(49,46,129,0.4); border-color: #4338ca; }
.dark .ch-search-btn:hover { background: rgba(55,48,163,0.6); }
@media (max-width: 380px) { .ch-search-btn span { display: none; } }

/* ── Summary strip ── */
.ch-summary {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 640px) { .ch-summary { grid-template-columns: repeat(3, auto) 1fr; align-items: center; } }
.ch-summary:empty { display: none; }
.ch-sum-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 0.875rem;
  padding: 0.55rem 0.9rem; min-width: 4.5rem;
}
.dark .ch-sum-tile { background: #1e293b; border-color: #334155; }
.ch-sum-num { font-size: 1.15rem; font-weight: 800; color: #334155; line-height: 1.1; }
.dark .ch-sum-num { color: #e2e8f0; }
.ch-sum-num.good { color: #15803d; }
.dark .ch-sum-num.good { color: #4ade80; }
.ch-sum-lbl { font-size: 0.6rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.ch-sum-bar { grid-column: 1 / -1; }
@media (min-width: 640px) { .ch-sum-bar { grid-column: auto; padding-left: 0.5rem; } }
.ch-sum-bar-head {
  display: flex; justify-content: space-between; font-size: 0.7rem;
  font-weight: 600; color: #64748b; margin-bottom: 0.3rem;
}
.ch-sum-pct { color: #15803d; font-weight: 800; }

/* ── Grid ──
   auto-fill + minmax keeps every card the same width at every breakpoint
   without four separate column counts to keep in step. */
.ch-grid {
  display: grid; gap: 0.875rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}
@media (max-width: 400px) { .ch-grid { grid-template-columns: 1fr; } }

/* ── Card ── */
.ch-card {
  position: relative; display: flex; border-radius: 1rem;
  background: #f0f7ff; color: #1e293b; border: 1px solid #cbdcf0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}
.dark .ch-card { background: #273449; color: #f1f5f9; border-color: #52647e; }
/* Subject colour as a left spine - set per-pack via --ch-accent. */
.ch-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--ch-accent, #6366f1);
}
.ch-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.09); border-color: #a5b4fc; }
.dark .ch-card:hover { border-color: #4f46e5; }
.ch-card:has(.ch-hit:focus-visible) { outline: 2px solid #6366f1; outline-offset: 2px; }

.ch-hit {
  position: absolute; inset: 0; z-index: 1;
  background: none; border: 0; padding: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: inherit;
}
/* Fallback for browsers without :has() - the ring lands just inside the card
   rather than around it, but a keyboard user is never left without one. */
.ch-hit:focus-visible { outline: 2px solid #6366f1; outline-offset: -3px; }
.ch-hit:focus:not(:focus-visible) { outline: none; }

.ch-body {
  position: relative; z-index: 0; pointer-events: none;
  display: flex; flex-direction: column; flex: 1;
  padding: 0.9rem 0.9rem 0.8rem 1.1rem; min-height: 10.5rem;
}
.ch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.ch-icon { font-size: 1.75rem; line-height: 1; }
.ch-badge {
  font-size: 0.6rem; font-weight: 700; color: #92400e; background: #fde68a;
  border-radius: 9999px; padding: 0.15rem 0.5rem; white-space: nowrap;
}
.dark .ch-badge { color: #fcd34d; background: rgba(120,53,15,0.55); }

.ch-name {
  font-size: 0.9rem; font-weight: 700; color: #1f2937;
  margin-top: 0.5rem; line-height: 1.3;
}
.dark .ch-name { color: #f1f5f9; }
.ch-part { font-size: 0.65rem; color: #64748b; margin-top: 0.1rem; }
/* Pushes the status/bar/footer block to the bottom so every card in a row
   lines its progress up, however long the titles are. */
.ch-spacer { flex: 1; min-height: 0.5rem; }

/* ── "Have I done this one?" ──
   A done-ness badge and a last-practised stamp. The card already carried an
   accuracy percentage, but accuracy answers "how well", never "have I". */
.ch-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 0.4rem;
  margin-bottom: 0.3rem;
}
.ch-done {
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.02em;
  padding: 0.1rem 0.4rem; border-radius: 999px; white-space: nowrap;
}
.ch-done.is-mastered { background: #dcfce7; color: #15803d; }
.dark .ch-done.is-mastered { background: rgba(22,163,74,0.25); color: #86efac; }
.ch-done.is-worked   { background: #dbeafe; color: #1d4ed8; }
.dark .ch-done.is-worked { background: rgba(37,99,235,0.25); color: #93c5fd; }
.ch-done.is-started  { background: #f1f5f9; color: #64748b; }
.dark .ch-done.is-started { background: #374151; color: #cbd5e1; }
.ch-when { font-size: 0.6rem; font-weight: 600; color: #94a3b8; white-space: nowrap; }
.dark .ch-when { color: #94a3b8; }

/* ── Filter row above the grid ── */
.ch-filters {
  display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 0.875rem;
}
.ch-filter {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.7rem; font-weight: 700; line-height: 1;
  padding: 0.45rem 0.7rem; border-radius: 999px;
  background: #f1f5f9; color: #475569; border: 1px solid transparent;
  cursor: pointer; transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.dark .ch-filter { background: #374151; color: #cbd5e1; }
.ch-filter:hover { background: #e2e8f0; }
.dark .ch-filter:hover { background: #4b5563; }
.ch-filter.on { background: #4f46e5; color: #fff; border-color: #6366f1; }
.dark .ch-filter.on { background: #4f46e5; color: #fff; }
.ch-filter-n {
  font-size: 0.6rem; font-weight: 800; padding: 0.05rem 0.3rem;
  border-radius: 999px; background: rgba(0,0,0,0.08);
}
.dark .ch-filter-n { background: rgba(255,255,255,0.15); }
.ch-filter.on .ch-filter-n { background: rgba(255,255,255,0.25); }

.ch-sum-of { font-size: 0.7rem; font-weight: 700; color: #94a3b8; }
.ch-sum-last { font-size: 0.6rem; font-weight: 600; color: #64748b; margin-top: 0.3rem; }
.dark .ch-sum-last { color: #94a3b8; }

.ch-status { color: #334155; font-size: 0.8rem; line-height: 1.5; font-weight: 600; display: block; margin-bottom: 0.45rem; overflow-wrap: anywhere; }
.dark .ch-status { color: #e2e8f0; }
.ch-status.new  { color: #64748b; }
.ch-status.low  { color: #1d4ed8; }
.ch-status.mid  { color: #b45309; }
.ch-status.good { color: #15803d; }
.ch-status.lock { color: #b45309; }
.ch-status.resume { color: #ea580c; }
.dark .ch-status.low { color: #60a5fa; } .dark .ch-status.mid { color: #fbbf24; }
.dark .ch-status.good { color: #4ade80; } .dark .ch-status.lock { color: #fcd34d; }
.dark .ch-status.resume { color: #fb923c; }

.ch-bar { height: 5px; border-radius: 9999px; background: #e2e8f0; overflow: hidden; }
.dark .ch-bar { background: #334155; }
.ch-bar-fill { height: 100%; border-radius: 9999px; transition: width 0.6s ease; }
.ch-bar-fill.low { background: #3b82f6; } .ch-bar-fill.mid { background: #f59e0b; }
.ch-bar-fill.good { background: #22c55e; }

.ch-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 0.55rem; }
.ch-star { color: #cbd5e1; font-size: 0.8rem; letter-spacing: -0.05em; }
.dark .ch-star { color: #475569; }
.ch-star.on { color: #fbbf24; }
.ch-cta { font-size: 0.7rem; font-weight: 700; color: #4f46e5; }
.dark .ch-cta { color: #a5b4fc; }
.ch-card:hover .ch-cta { text-decoration: underline; }

/* Flag: a real sibling button, above .ch-hit, so it is clickable and the card
   no longer needs a nested button to carry it. */
.ch-flag {
  position: absolute; top: 0.4rem; right: 0.4rem; z-index: 2;
  background: none; border: 0; cursor: pointer; line-height: 1;
  font-size: 0.85rem; color: #64748b; padding: 0.3rem;
  border-radius: 9999px; transition: color 0.15s, background 0.15s;
}
.ch-flag:hover { color: #dc2626; background: rgba(248,113,113,0.1); }
.ch-flag.on { color: #dc2626; }
.dark .ch-flag { color: #94a3b8; }
.dark .ch-flag.on { color: #f87171; }

/* Discard-and-restart: sits left of the flag, same pill treatment, only
   rendered at all when the chapter actually has paused progress. */
.ch-restart {
  position: absolute; top: 0.4rem; right: 2.1rem; z-index: 2;
  background: none; border: 0; cursor: pointer; line-height: 1;
  font-size: 0.9rem; color: #64748b; padding: 0.3rem;
  border-radius: 9999px; transition: color 0.15s, background 0.15s;
}
.ch-restart:hover { color: #ea580c; background: rgba(234,88,12,0.1); }
.dark .ch-restart { color: #94a3b8; }
.dark .ch-restart:hover { color: #fb923c; }

/* Bonus + locked + paused variants */
.ch-card.is-bonus { background: linear-gradient(135deg, #fffbeb, #fef3c7); border-color: #fcd34d; }
.dark .ch-card.is-bonus { background: #342a20; border-color: #a77e44; }
.ch-card.is-bonus::before { background: #f59e0b; }
.ch-card.is-locked { border-style: dashed; }
.ch-card.is-locked::before { background: #cbd5e1; }
.ch-card.is-locked:hover { transform: none; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.ch-card.is-locked .ch-hit { cursor: not-allowed; }
/* Paused wins over the bonus tint if a chapter is somehow both - the
   actionable "come back to this" state matters more than the badge. */
.ch-card.is-paused { background: linear-gradient(135deg, #fff7ed, #ffedd5); border-color: #fdba74; }
.dark .ch-card.is-paused { background: #372b28; border-color: #b87957; }
.ch-card.is-paused::before { background: #ea580c; }
.ch-card.is-locked .ch-cta { color: #64748b; }

/* Section divider between the main chapters and the bonus ones */
.ch-section { display: flex; align-items: center; gap: 0.75rem; margin: 1.75rem 0 0.25rem; }
.ch-section-line { flex: 1; height: 1px; background: #fcd34d; opacity: 0.5; }
.ch-section-label { font-size: 0.7rem; font-weight: 800; color: #b45309; text-transform: uppercase; letter-spacing: 0.06em; }
.dark .ch-section-label { color: #fbbf24; }
.ch-section-note { text-align: center; font-size: 0.7rem; color: #64748b; margin-bottom: 0.9rem; }

.ch-empty { text-align: center; padding: 3rem 1rem; }

/* ===== DIFF BUTTONS ===== */
.diff-btn {
  padding: 0.5rem 0.75rem; border-radius: 0.625rem;
  border: 2px solid #e5e7eb; background: white;
  font-size: 0.8rem; font-weight: 500; color: #374151;
  cursor: pointer; transition: all 0.2s; text-align: left;
}
.dark .diff-btn { background: #1e293b; border-color: #374151; color: #e5e7eb; }
.diff-btn:hover { border-color: #93c5fd; background: #eff6ff; }
.dark .diff-btn:hover { background: #1e3a5f; border-color: #60a5fa; }
.diff-btn.active { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; font-weight: 700; }
.dark .diff-btn.active { background: #1e3a5f; color: #93c5fd; border-color: #60a5fa; }

/* ===== STAT TILES ===== */
.stat-tile { background: white; border-radius: 1rem; padding: 1rem; box-shadow: 0 1px 6px rgba(0,0,0,0.06); text-align: center; }
.dark .stat-tile { background: #1e293b; }
.stat-num { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.7rem; color: #6b7280; margin-top: 0.25rem; }

/* ===== BADGE DISPLAY - collectible stickers =====
   A badge is the one thing on this screen a nine-year-old is meant to WANT, and
   it was a bare emoji on a flat card. Each is now drawn as a die-cut sticker: a
   pastel disc with a cream rim, a gloss highlight and a soft shadow, so a row
   of them reads as a collection rather than a table of icons.
   ⚠ A locked badge is an EMPTY SLOT in the album, not the same art at 35%
   opacity - a faded picture reads as broken, a dashed hole reads as "yours to
   win". Opacity is applied to the ICON only, never the whole tile: at .35 the
   label fell to 1.7:1 and could not be read at all. */
#badges-grid {
  /* Overrides the authored `flex flex-wrap`: with two-line names ("Speed
     Demon") a flex row leaves the discs on a ragged baseline. */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr));
  gap: 1rem .4rem;
}
.badge-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  width: auto; padding: 0; text-align: center;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.badge-icon {
  position: relative;
  display: grid; place-items: center;
  width: 3.4rem; height: 3.4rem; flex: none;
  font-size: 1.7rem; line-height: 1;
  border-radius: 50%;
  /* Two stops so the disc has a light source; the ring is a shadow rather than
     a border so it never eats into the 3.4rem the emoji is centred in. */
  background: radial-gradient(circle at 32% 26%, var(--badge-a, #fff2c4) 0%, var(--badge-b, #f7c948) 72%);
  box-shadow: 0 0 0 3px #fffdf6, 0 3px 8px rgba(84,52,0,.26);
}
/* The gloss: one soft ellipse across the top-left quarter. */
.badge-icon::before {
  content: ''; position: absolute; left: 14%; top: 8%; width: 52%; height: 34%;
  border-radius: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,.85), rgba(255,255,255,0));
  pointer-events: none;
}
/* Positional, and deliberately so: the palette only has to look varied, and a
   badge that moves position simply borrows a different pastel. */
.badge-item:nth-child(5n+1) .badge-icon { --badge-a:#fff3c9; --badge-b:#f6c343; }
.badge-item:nth-child(5n+2) .badge-icon { --badge-a:#e2f3ff; --badge-b:#7cc4f5; }
.badge-item:nth-child(5n+3) .badge-icon { --badge-a:#ffe6ef; --badge-b:#f490b6; }
.badge-item:nth-child(5n+4) .badge-icon { --badge-a:#e6fbe8; --badge-b:#7bd68b; }
.badge-item:nth-child(5n+5) .badge-icon { --badge-a:#efe7ff; --badge-b:#b198f0; }
/* #badges-grid only ever renders inside #screen-dashboard, which is a
   chalkboard in BOTH themes - so the caption is chalk in both. The old rule
   was slate #374151 with a .dark twin, i.e. near-black text on dark green for
   every child on the light theme. */
.badge-name {
  font-size: .68rem; font-weight: 700; line-height: 1.25;
  color: rgba(240,236,220,.92); letter-spacing: .01em;
}

.badge-item:hover { transform: translateY(-4px); }
.badge-item:hover .badge-icon { box-shadow: 0 0 0 3px #fffdf6, 0 7px 16px rgba(84,52,0,.32); }

/* The empty slot: a dashed hole with the art as a flat silhouette. The
   silhouette is drawn with a zero-radius text-shadow over transparent text
   rather than filter/opacity - a filter or an opacity on this span also dims
   its ::after, which is where the padlock lives. */
.badge-item.locked .badge-icon {
  background: none;
  box-shadow: none;
  border: 2px dashed rgba(240,236,220,.34);
  color: transparent;
  text-shadow: 0 0 0 rgba(240,236,220,.42);
}
.badge-item.locked .badge-icon::before { content: none; }
/* The padlock is the only thing at full strength, so the slot says why. */
.badge-item.locked::after {
  content: '🔒'; position: absolute;
  top: 2.35rem; left: 50%; margin-left: .72rem;
  font-size: .78rem; line-height: 1;
}
.badge-item.locked .badge-name { color: rgba(240,236,220,.7); font-weight: 600; }
.badge-item.locked:hover { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .badge-item, .badge-item:hover { transition: none; transform: none; }
}

/* ===== SCRATCHPAD ===== */
.scratchpad {
  width: 100%; border: 1.5px solid #e2e8f0; border-radius: 0.625rem;
  cursor: crosshair; display: block; touch-action: none;
  background: #fafafa;
}
.dark .scratchpad { border-color: #374151; background: #1e293b; }

/* ===== BADGE ANIMATION ===== */
@keyframes badgePop {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.badge-pop { animation: badgePop 0.6s cubic-bezier(.34,1.56,.64,1) both; }

/* ===== FEEDBACK STATES ===== */
.feedback-correct { background: #f0fdf4; border: 1.5px solid #86efac; color: #15803d; }
.dark .feedback-correct { background: #052e16; border-color: #166534; color: #86efac; }
.feedback-wrong { background: #fef2f2; border: 1.5px solid #fca5a5; color: #991b1b; }
.dark .feedback-wrong { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }

/* ===== RESULTS BANNER ===== */
.banner-a  { background: linear-gradient(135deg,#22c55e,#16a34a); }
.banner-b  { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.banner-c  { background: linear-gradient(135deg,#f59e0b,#d97706); }
.banner-f  { background: linear-gradient(135deg,#ef4444,#b91c1c); }

/* ===== PROGRESS BAR ANIMATION ===== */
@keyframes progressShimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

/* ===== PICTOGRAM TABLE ===== */
.picto-wrap { margin: 10px 0; }
.picto-table { border-collapse: collapse; font-size: 0.88rem; margin-bottom: 8px; }
.picto-table th { background: #f1f5f9; font-weight: 700; color: #334155; padding: 5px 12px; border: 1px solid #cbd5e1; text-align: left; }
.picto-table td { padding: 5px 12px; border: 1px solid #e2e8f0; vertical-align: middle; }
.dark .picto-table th { background: #1e293b; color: #cbd5e1; border-color: #475569; }
.dark .picto-table td { border-color: #334155; color: #e2e8f0; }
.picto-sym { font-size: 1.25rem; letter-spacing: 4px; line-height: 1.6; }
.picto-key { display: inline-block; margin-top: 4px; font-size: 0.82rem; background: #fef9c3; border: 1px solid #fde68a; padding: 3px 10px; border-radius: 6px; color: #713f12; font-weight: 600; }
.dark .picto-key { background: #422006; border-color: #92400e; color: #fde68a; }

/* ===== SYMMETRY GRID ===== */
.sym-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sym-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.5px; color: #4f46e5; text-transform: uppercase; }
.dark .sym-label { color: #a5b4fc; }
.sym-grid {
  display: grid;
  gap: 3px;
  width: 100%;
  max-width: 336px;
  -webkit-user-select: none; user-select: none;
}
.sym-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  transition: background 0.12s, transform 0.1s;
  min-width: 0;
}
.dark .sym-cell { border-color: #475569; }
.sym-given  { background: #6366f1; border-color: #4f46e5; }
.dark .sym-given { background: #818cf8; }
.sym-axis-v,
.sym-axis-h { background: repeating-linear-gradient(45deg, #fbbf24 0 3px, #fef3c7 3px 6px); border-color: #f59e0b; cursor: default; }
.sym-empty  { background: #f8fafc; }
.dark .sym-empty { background: #1e293b; }
.sym-clickable { cursor: pointer; background: #e2e8f0; }
.dark .sym-clickable { background: #334155; }
.sym-clickable:hover { background: #bfdbfe; transform: scale(1.07); border-color: #93c5fd; }
.dark .sym-clickable:hover { background: #1e3a5f; }
.sym-clickable.sym-selected { background: #a5b4fc; border-color: #6366f1; }
.dark .sym-clickable.sym-selected { background: #4338ca; border-color: #818cf8; }
.sym-correct { background: #22c55e !important; border-color: #16a34a !important; }
.sym-missed  { background: #f97316 !important; border-color: #ea580c !important; }
.sym-wrong   { background: #ef4444 !important; border-color: #dc2626 !important; }
.sym-legend {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  justify-content: center; font-size: 0.68rem; color: #64748b; margin-top: 4px;
}
.sym-legend-item { display: flex; align-items: center; gap: 4px; }
.sym-legend-dot  { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* ===== TOAST ===== */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(4rem);
  background: #1e293b; color: white; padding: 0.75rem 1.5rem;
  border-radius: 9999px; font-size: 0.875rem; font-weight: 500;
  z-index: 9999; transition: transform 0.3s ease, opacity 0.3s ease; opacity: 0;
  pointer-events: none; white-space: nowrap; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
body.has-bottom-nav #toast { bottom: calc(4.5rem + env(safe-area-inset-bottom)); }

/* ===== PULSE FOR TIMER LOW ===== */
@keyframes timerPulse {
  0%, 100% { color: #ef4444; }
  50% { color: #fca5a5; }
}
.timer-low { animation: timerPulse 0.8s ease infinite; }

/* ===== NUMPAD TOGGLE ===== */
.numpad-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 0.5rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-user-select: none; user-select: none;
}
.numpad-toggle:hover { background: #e2e8f0; color: #334155; }
.numpad-toggle.active { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.dark .numpad-toggle { background: #1e293b; color: #94a3b8; border-color: #334155; }
.dark .numpad-toggle:hover { background: #334155; color: #e2e8f0; }
.dark .numpad-toggle.active { background: #1e3a5f; color: #60a5fa; border-color: #3b82f6; }

/* ===== NUMBER PAD ===== */
.num-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-top: 0.625rem;
  max-width: 240px;
}
.num-pad-btn {
  padding: 0.7rem 0.25rem;
  border-radius: 0.625rem;
  background: #f8fafc;
  color: #1e293b;
  border: 1.5px solid #e2e8f0;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s;
  text-align: center;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.dark .num-pad-btn { background: #1e293b; color: #f1f5f9; border-color: #374151; }
.num-pad-btn:hover  { background: #eff6ff; border-color: #93c5fd; }
.dark .num-pad-btn:hover { background: #1e3a5f; border-color: #60a5fa; }
.num-pad-btn:active { transform: scale(0.91); background: #dbeafe; }
.dark .num-pad-btn:active { background: #1e3a5f; }
.num-pad-del  { background: #fef2f2; color: #b91c1c !important; border-color: #fecaca !important; font-size: 1.2rem; }
.dark .num-pad-del { background: #450a0a !important; color: #f87171 !important; border-color: #7f1d1d !important; }
.num-pad-del:hover  { background: #fee2e2 !important; }
.num-pad-clear { background: #f0fdf4; color: #15803d !important; border-color: #86efac !important; font-size: 0.85rem; }
.dark .num-pad-clear { background: #052e16 !important; color: #86efac !important; border-color: #166534 !important; }
.num-pad-space { font-size: 0.7rem; color: #64748b; }
.dark .num-pad-space { color: #94a3b8; }
.num-pad-minus { font-size: 1.3rem; }
.num-pad-4col  { grid-template-columns: repeat(4, 1fr); max-width: 300px; }
/* The algebra pad (type 'expr'). Five columns fit a 360px phone once main's
   px-4 is taken off, and the taller key keeps every target over 44px on its
   SHORTEST side - at 59px wide the height is what decides it. */
.num-pad-5col  { grid-template-columns: repeat(5, 1fr); max-width: 320px; }
.num-pad-5col .num-pad-btn { padding: 0.85rem 0.2rem; font-size: 1.05rem; }
.num-pad-sym   {
  background: #fef3c7; color: #92400e !important;
  border-color: #fcd34d !important;
  font-size: 1.25rem; font-weight: 800;
}
.dark .num-pad-sym { background: #451a03 !important; color: #fcd34d !important; border-color: #d97706 !important; }
.num-pad-sym:hover { background: #fde68a !important; }
.dark .num-pad-sym:hover { background: #78350f !important; }
.sym-hint {
  font-size: 0.72rem; color: #64748b; margin-top: 0.35rem;
  padding: 0.35rem 0.6rem; background: #f8fafc;
  border-radius: 0.5rem; border: 1px dashed #e2e8f0;
  max-width: 300px;
}
.dark .sym-hint { background: #0f172a; border-color: #334155; color: #94a3b8; }

/* ===== SYMBOL KEYBOARD ===== */
.sym-keyboard {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.375rem; margin-top: 0.5rem;
}
.sym-label {
  font-size: 0.7rem; color: #64748b; font-weight: 500;
  margin-right: 0.125rem; white-space: nowrap;
}
.dark .sym-label { color: #94a3b8; }
.sym-btn {
  padding: 0.3rem 0.7rem; border-radius: 0.5rem;
  background: #e0e7ff; color: #3730a3;
  border: 1.5px solid #a5b4fc;
  font-size: 0.85rem; font-weight: 700; cursor: pointer;
  font-family: ui-monospace, monospace;
  transition: all 0.15s; line-height: 1.4;
  -webkit-user-select: none; user-select: none;
}
.dark .sym-btn { background: #1e1b4b; color: #a5b4fc; border-color: #4338ca; }
.sym-btn:hover { background: #c7d2fe; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(99,102,241,0.3); }
.dark .sym-btn:hover { background: #312e81; }
.sym-btn:active { transform: translateY(0); }

/* ===== SYLLABUS BROWSER ===== */
#syllabus-list .chip { font-size: 0.65rem; padding: 2px 8px; }

/* ===== FORMULA MODAL ===== */
#formula-modal { -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
#formula-list li { background: #f8fafc; border-radius: 6px; padding: 6px 10px; }
.dark #formula-list li { background: #1f2937; }

/* ===== HELP BUTTON ===== */
.btn-help {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; font-weight: 600; padding: 0.5rem 1.25rem;
  border-radius: 0.75rem; border: none; cursor: pointer;
  transition: all 0.2s; box-shadow: 0 2px 8px rgba(99,102,241,0.35);
  width: 100%;
}
.btn-help:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99,102,241,0.45); }

/* ===== HELP MODAL ===== */
#help-modal { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#help-bullets li { padding: 2px 0; line-height: 1.5; }
#help-video-frame { min-height: 200px; }

/* ===== CHIP COLOURS ===== */
.chip.red    { background:#fee2e2; color:#991b1b; }
.dark .chip.red { background:#7f1d1d; color:#fca5a5; }

/* ===== XP DISPLAY ===== */
#xp-display { gap: 6px; }

/* ===== AVATAR GRID ===== */
.avatar-opt { cursor: pointer; transition: border-color 0.15s, background 0.15s; }

/* ===== PARENT DASHBOARD TABLE ===== */
#pd-chapters td { white-space: nowrap; padding-right: 12px; }

/* iOS Safari's 100vh includes the area behind the address bar, so a
   `min-h-screen` section is taller than the screen actually is and adds a
   phantom scroll the user cannot get rid of. 100dvh is the real visible
   height. Guarded by @supports so nothing changes on browsers without it, and
   qualified with `body` so it outranks Tailwind's own .min-h-screen whichever
   order the CDN injects its stylesheet in. */
/* iOS Safari ZOOMS THE PAGE IN when a form control whose font-size is under
   16px receives focus - and it does not zoom back out afterwards. The child or
   parent is left on a magnified, sideways-scrolling page and has to pinch out by
   hand. Nine controls here use Tailwind's `text-sm` (14px): the assignment
   subject/chapter/difficulty selects, the assignment note, the reminder time,
   the report textarea, and the name/family-name/password fields on the Account
   & Settings page.

   Only the small ones are raised - a blanket `input { font-size:16px }` would
   SHRINK the deliberately large login username (text-xl) and PIN (text-2xl).
   `pointer: coarse` scopes it to touch devices so desktop keeps its 14px.
   guest.html already sets 16px by hand and needs nothing.

   Element+class beats Tailwind's single class, and style.css loads after the
   CDN, so this wins either way. */
@media (pointer: coarse) {
  input.text-sm, select.text-sm, textarea.text-sm,
  input.text-xs, select.text-xs, textarea.text-xs { font-size: 16px; }
}

@supports (min-height: 100dvh) {
  body .min-h-screen { min-height: 100dvh; }
}

/* ═══════════ AUTH / SIGN-IN SCREEN ═══════════
   The sign-in card sits under a 🎓 at text-7xl plus a text-4xl wordmark plus a
   subtitle - roughly 200px of decoration before the first input. On a phone in
   landscape, or any short viewport, that pushed the actual Sign In button below
   the fold with no visual cue that there was anything to scroll to; the reports
   of "the login button is almost outside the screen" are this plus the landing
   nav overflow fixed above.

   The logo is sized off the viewport HEIGHT rather than a width breakpoint,
   because that is the axis that actually runs out. clamp() with vh units means
   there is no cliff at a breakpoint and no device left un-handled. */
#screen-auth .auth-logo   { font-size: clamp(2.5rem, 9vh, 4.5rem); line-height: 1; }
#screen-auth .auth-title  { font-size: clamp(1.375rem, 4.5vh, 2.25rem); }
#screen-auth .auth-shell  { padding-top: max(3.5rem, env(safe-area-inset-top)); padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
@media (max-height: 700px) {
  #screen-auth .auth-brand { margin-bottom: 1rem; }
  #screen-auth .auth-sub   { display: none; }
}

/* Four typed digits stay big; the placeholder words do not have to be, and at
   text-2xl + tracking-widest they did not fit the field on a 360px phone. */
.pin-field::-webkit-input-placeholder { font-size: 0.85rem; letter-spacing: normal; font-family: inherit; }
.pin-field::placeholder { font-size: 0.85rem; letter-spacing: normal; }

/* The role tabs are three two-line buttons in a row inside a max-w-sm card.
   "👨‍👩‍👧 / Parent" is the widest and drives the row; on a narrow phone at a large
   system font scale the words used to wrap to a third line and knock the three
   tabs out of alignment. */
.auth-tab { min-width: 0; overflow: hidden; }
.auth-tab br + * , .auth-tab { white-space: normal; }
@media (max-width: 360px) { .auth-tab { font-size: 0.65rem; padding-left: 0.25rem; padding-right: 0.25rem; } }

/* ===== MOBILE CARD CAROUSEL =====
   The landing page stacks 17 full-height cards on a phone (5 subjects,
   6 features, 3 audiences, 3 plans), which is a very long scroll for content
   most visitors only skim. Under 640px each of those grids becomes a
   one-card-at-a-time swipe track with dots underneath; at 640px and up the
   original grid is untouched.

   Scroll-snap does the swiping natively - the JS in app.js only keeps the dots
   in sync and handles taps on them. Dots are hidden on desktop. */
.mcar-dots { display: none; }

@media (max-width: 640px) {
  [data-carousel] {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  [data-carousel]::-webkit-scrollbar { display: none; }
  [data-carousel] > * {
    flex: 0 0 100%;
    min-width: 0;
    scroll-snap-align: start;
  }

  .mcar-dots {
    display: flex; justify-content: center; align-items: center;
    /* gap is 0 because the dots supply their own spacing as padding - see below. */
    gap: 0; margin: 0;
  }
  /* An 8px dot is an 8px tap target, which is a fifth of the 44px every mobile
     guideline asks for, and these sit at the bottom of a swipeable card where a
     miss scrolls the page instead. Pad the button out to 16x44 and paint only
     the content box: the dot LOOKS exactly as it did (8px, with the same 8px of
     air between neighbours, now supplied by 4px of padding on each side) and
     MEASURES 5.5x the area. box-sizing must be stated - Tailwind preflight sets
     border-box globally, which would eat the padding instead of adding to it. */
  .mcar-dot {
    box-sizing: content-box;
    width: 0.5rem; height: 0.5rem;
    padding: 1.125rem 0.25rem; border: none; border-radius: 50%;
    background: rgba(255, 255, 255, 0.28); background-clip: content-box;
    cursor: pointer;
    transition: background 0.2s, width 0.2s;
  }
  .mcar-dot.active { background: #fff; width: 1.25rem; border-radius: 99px; }

  /* Trim the generous desktop section spacing - it is a big share of the
     remaining scroll once the cards are side by side. */
  #screen-landing section { padding-bottom: 2.5rem !important; }
  #screen-landing section h2 { margin-bottom: 0.75rem !important; }
}

/* ===== RESPONSIVE FIX ===== */
@media (max-width: 640px) {
  .track-card { padding: 1.25rem; }
  .btn-primary, .btn-secondary { font-size: 0.85rem; }
  #xp-display { display: none !important; }

  /* The icon-only rule for the buttons lives in its own @media (max-width:
     1099px) block further up - it is not a phone-only decision, tablets need it
     too. Only the streak/XP chip sizing is phone-specific. */
  header .hdr-stat { height: 2.25rem; padding: 0 0.5rem; font-size: 0.75rem; }

  /* Backstop against a stray wide element scrolling the page sideways.
     ⚠ Deliberately NOT on html/body: overflow-x there makes them a scroll
     container, and on iOS Safari that is a well-known way to kill
     `position: sticky` - which is exactly what our app header uses. The header
     is a sibling of #screen-landing, not a descendant, so scoping it here
     protects the long marketing page without touching the sticky header. */
  #screen-landing { max-width: 100%; overflow-x: hidden; }
}

/* ===== GAMIFICATION / INTERACTIVE PRACTICE ===== */

/* ═══════════ FRACTIONS & BLANKS ═══════════
   "2/5" typed inline reads as a division to a child; a Grade 4 book stacks it.
   Built by _prettyMath() at render time - the stored question text is
   unchanged, so nothing about answer checking is affected. */
.frac {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: -0.62em; margin: 0 0.2em; line-height: 1.08;
  font-weight: 700;
  /* A child reads a fraction as one object. Letting it break across a line, or
     letting a text-selection drag pick up half of it, both undo that. */
  white-space: nowrap;
  -webkit-user-select: none; user-select: none;
}
/* The two halves are set at the surrounding size, not smaller: at 0.8em inside
   an already-small option row the bar became a hairline and the whole thing read
   as a smudge on a phone. */
.frac .fr-n { padding: 0 0.3em; }
.frac .fr-d { padding: 0 0.3em; border-top: 2px solid currentColor; }
/* The bar is the whole point - it is what tells a Grade 4 child this is a
   fraction and not a division sign. Keep it visible when the fraction is inside
   a small-print row (an explanation, a review line, an option label). */
.text-xs .frac .fr-d, .text-\[11px\] .frac .fr-d { border-top-width: 1.5px; }

/* Mixed number: "2 1/2" is printed 2½ in a book, tight against the fraction,
   not with a word space in between. */
.frac-mixed { font-weight: 700; margin-right: 0.05em; }
.frac-mixed + .frac { margin-left: 0; }

/* The answer blank. Numbered ① ② when a question has more than one, so the
   options ("10 and 6") can be matched to the right box. */
.q-box {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5em; height: 1.5em; padding: 0 0.15em;
  border: 2px dashed #6366f1; border-radius: 0.3em;
  background: #eef2ff; color: #4338ca;
  font-weight: 800; font-size: 0.85em; vertical-align: middle;
}
.dark .q-box { background: rgba(49,46,129,0.45); border-color: #818cf8; color: #c7d2fe; }
/* Inside a stacked fraction the box is the numerator or denominator, so it must
   not push the bar out of line. */
.frac .q-box { min-width: 1.3em; height: 1.3em; border-width: 1.5px; }

/* ═══════════ PRACTICE QUESTION PAGE ═══════════
   Single column, in the order a child uses it: status → question → answer →
   tools → act. The old layout was a 2/3 + 1/3 grid whose sidebar (level card,
   formulas, session stats, scratchpad) collapsed BELOW the answer buttons on
   every phone, and whose Hint and Report buttons were crammed into the same
   flex row as the chapter title. */

/* ⚠ No padding-bottom reserve. That 5.5rem existed to stop the FIXED action bar
   covering the last of the content; the bar is sticky now and takes its own
   space in flow, so the reserve became a 5.5rem hole between the content and
   the bar on every screen. */
.pr-wrap { display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 900px) { .pr-wrap { max-width: 46rem; margin: 0 auto; } }

/* ── Status block ── */
.pr-head {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 1rem;
  padding: 0.65rem 0.9rem 0.7rem;
}
.pr-head-right { display: flex; align-items: center; gap: 0.4rem; flex: 0 0 auto; }
.dark .pr-head { background: #1e293b; border-color: #334155; }
.pr-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }
.pr-chapter { font-size: 1rem; font-weight: 800; color: #1f2937; line-height: 1.25; min-width: 0; }
.dark .pr-chapter { color: #f8fafc; }
.pr-counter {
  flex: 0 0 auto; font-size: 0.7rem; font-weight: 700; color: #4f46e5;
  background: #eef2ff; border-radius: 9999px; padding: 0.2rem 0.6rem; white-space: nowrap;
}
.dark .pr-counter { color: #c7d2fe; background: rgba(49,46,129,0.5); }
.pr-head-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.pr-sess { display: flex; gap: 0.7rem; font-size: 0.72rem; color: #64748b; white-space: nowrap; }
.pr-sess b { color: #475569; font-weight: 700; }
.dark .pr-sess b { color: #e2e8f0; }
/* Was a whole sidebar card repeating what the difficulty chip already says. */
.pr-level { font-size: 0.7rem; color: #64748b; margin-top: 0.5rem; line-height: 1.45; }
.pr-level b { color: #64748b; font-weight: 700; }
.dark .pr-level b { color: #cbd5e1; }
.pr-level b::after { content: ' - '; font-weight: 400; }
.pr-level:empty, .pr-level.hidden { display: none; }

/* ── Question card ── */
.pr-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 1rem; padding: 1.1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.dark .pr-card { background: #1e293b; border-color: #334155; }
.pr-q {
  font-size: 1.05rem; line-height: 1.6; font-weight: 500; color: #1f2937;
}
.dark .pr-q { color: #f1f5f9; }
.pr-answers { margin-top: 1.1rem; }
.pr-answers:empty { margin-top: 0; }
/* Two columns for SHORT options on a wide screen only. renderAnswerArea() adds
   .pr-answers-pair after measuring the option text - see the note there. Below
   700px one option per row stays right: a 360px phone splits into two 160px
   cells, which is narrower than the tap target guidance and wraps "November to
   April" onto three lines. */
@media (min-width: 700px) {
  .pr-answers-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .pr-answers-pair .mcq-opt { margin-bottom: 0; height: 100%; }
}
.pr-feedback { margin-top: 1rem; padding: 1rem; border-radius: 0.875rem; }

.pr-hint {
  margin-bottom: 0.9rem; padding: 0.75rem 0.85rem; font-size: 0.85rem;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 0.875rem; color: #92400e;
}
.dark .pr-hint { background: rgba(69,26,3,0.5); border-color: #b45309; color: #fcd34d; }
.pr-hint-head {
  display: flex; justify-content: space-between; gap: 0.5rem;
  font-weight: 700; font-size: 0.75rem; margin-bottom: 0.3rem;
}

/* ── Tool row ── */
.pr-tools {
  display: grid; gap: 0.4rem; grid-template-columns: 1.25fr 1fr 1fr;
}
.pr-help-tray {
  display: grid; gap: 0.4rem;
  grid-template-columns: repeat(3, minmax(4.2rem, 1fr));
  padding: 0.55rem; border: 1px solid #e0e7ff; border-radius: 0.9rem;
  background: #f8faff;
}
.pr-help-tray.hidden { display: none; }
.dark .pr-help-tray { background: #172033; border-color: #334155; }
@media (max-width: 380px) { .pr-help-tray { grid-template-columns: repeat(2, minmax(4.2rem, 1fr)); } }
@media (max-width: 640px) {
  /* On a phone, the question and answer deserve the available attention.
     Budget at 360×740, measured: header+breadcrumb 85, toolbar 42, head, then
     the card. Every row saved here is a line of a word problem that fits above
     the fixed Check bar. */
  .pr-sess, .pr-level, .pr-head-meta { display: none; }
  .pr-head .practice-progress-outer { margin-bottom: 0; }
  .pr-card { padding: 0.9rem 0.95rem; }
  .pr-answers { margin-top: 0.75rem; }
  .mcq-opt { padding: 0.65rem 0.9rem; }
}
.pr-tool {
  position: relative; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0.15rem; cursor: pointer;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 0.75rem;
  padding: 0.5rem 0.25rem; transition: all 0.15s;
  font: inherit; color: #64748b;
}
.dark .pr-tool { background: #1e293b; border-color: #334155; color: #94a3b8; }
.pr-tool:hover:not(:disabled) { border-color: #a5b4fc; color: #4f46e5; background: #f8faff; }
.dark .pr-tool:hover:not(:disabled) { background: #263449; color: #c7d2fe; }
.pr-tool:disabled { opacity: 0.35; cursor: not-allowed; }
.pr-tool.hidden { display: none; }
.pr-tool-ico { font-size: 1.1rem; line-height: 1; }
.pr-tool-lbl { font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; text-align: center; }
.pr-tool-badge {
  position: absolute; top: 0.15rem; right: 0.3rem;
  font-size: 0.6rem; font-weight: 800; color: #b45309;
}
.pr-tool-primary {
  color: #4338ca; border-color: #a5b4fc; background: #eef2ff;
}
.dark .pr-tool-primary { color: #c7d2fe; border-color: #6366f1; background: rgba(49,46,129,0.5); }
.pr-tool.is-on { border-color: #6366f1; color: #4f46e5; background: #eef2ff; }
.dark .pr-tool.is-on { background: rgba(49,46,129,0.5); color: #c7d2fe; border-color: #4f46e5; }
.pr-tool.is-report:hover { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }
.dark .pr-tool.is-report:hover { background: rgba(69,10,10,0.4); color: #f87171; }
.pr-tool-report-visible { border-color: #fecaca; color: #b91c1c; background: #fff7f7; }
.pr-tool-report-visible:hover:not(:disabled) { border-color: #f87171; color: #991b1b; background: #fef2f2; }
.dark .pr-tool-report-visible { border-color: #7f1d1d; color: #fca5a5; background: rgba(69,10,10,0.28); }
.pr-tool.muted { color: #64748b; }

/* ── Scratchpad panel ── */
.pr-scratch {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 1rem; padding: 0.75rem;
}
.dark .pr-scratch { background: #1e293b; border-color: #334155; }
.pr-scratch-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.68rem; font-weight: 600; color: #64748b; margin-bottom: 0.45rem;
}
.pr-scratch-clear {
  font-size: 0.68rem; font-weight: 700; color: #dc2626; cursor: pointer;
  background: none; border: 0; padding: 0.1rem 0.3rem;
}
.pr-scratch-clear:hover { color: #dc2626; }

/* ── Number Helper panel ── */
.pr-tools-4 { grid-template-columns: 1.25fr 1fr 1fr 1fr; }
.nh-panel {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 1rem;
  padding: 0.75rem; display: flex; flex-direction: column; gap: 0.55rem;
}
.dark .nh-panel { background: #1e293b; border-color: #334155; }
.nh-head { display: flex; align-items: center; justify-content: space-between; }
.nh-head-title { font-size: 0.8rem; font-weight: 700; color: #4338ca; }
.dark .nh-head-title { color: #a5b4fc; }
.nh-head-note { font-size: 0.62rem; color: #94a3b8; }
.nh-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; min-height: 1.4rem; }
.nh-chip {
  cursor: pointer; font-size: 0.78rem; font-weight: 700;
  background: #eef2ff; color: #4338ca; border: 1px solid #a5b4fc;
  border-radius: 0.45rem; padding: 0.15rem 0.5rem; transition: background 0.1s;
}
.dark .nh-chip { background: #1e2d4d; color: #a5b4fc; border-color: #4f46e5; }
.nh-chip:hover { background: #e0e7ff; }
.nh-inputs { display: flex; align-items: center; gap: 0.4rem; }
.nh-input {
  flex: 1; min-width: 0; padding: 0.3rem 0.4rem; border-radius: 0.5rem;
  border: 1px solid #d1d5db; font: inherit; font-size: 0.82rem; text-align: center;
  background: #fff; color: inherit;
}
.dark .nh-input { background: #0f172a; border-color: #334155; color: #e2e8f0; }
.nh-sep { font-size: 0.75rem; color: #94a3b8; white-space: nowrap; }
.nh-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.nh-table tbody tr { border-bottom: 1px solid #f1f5f9; }
.dark .nh-table tbody tr { border-color: #0f172a; }
.nh-table tbody tr:last-child { border-bottom: none; }
.nh-table td { padding: 0.2rem 0.3rem; }
.nh-op { color: #64748b; font-weight: 700; width: 2.4rem; }
.dark .nh-op { color: #94a3b8; }
.nh-expr { color: #475569; }
.dark .nh-expr { color: #94a3b8; }
.nh-val { font-weight: 700; color: #1e293b; text-align: right; }
.dark .nh-val { color: #e2e8f0; }
.nh-na { color: #cbd5e1; font-weight: 400; }

/* ── Sticky action bar ──
   One primary button at a time: Check Answer becomes Next. Skip stays a quiet
   secondary so it is never mistaken for the main action. */
/* ⚠ STICKY, not fixed. `position: fixed` pinned this bar to the bottom of the
   VIEWPORT however short the question was, so on a desktop browser the primary
   action floated in empty space far below the thing it acts on - measured
   2026-09-08 with a one-line MCQ: 449px of empty gap at 1920x1080 and 809px at
   2560x1440, putting Check Answer ~620px below the last option. On a phone it
   was right, because the content fills the screen; the bug only appears when
   the viewport is taller than the content.
   Sticky gives both behaviours from one rule: in flow directly under the
   content when the page does not scroll, pinned to the bottom when it does.
   ⚠ `margin-inline` cancels <main class="px-4">, keeping the bar edge-to-edge
   exactly as the fixed version was. Do not remove it without re-measuring at
   360px - an inset bar reads as a card, not a toolbar.
   ⚠ Sticky breaks inside an ancestor with overflow hidden/auto. body carries
   `overflow-x: clip`, which per CSS Overflow 3 leaves overflow-y visible and
   creates no scroll container - that is the reason `clip` was chosen over
   `hidden`, and the sticky header depends on it too. */
.pr-actions {
  position: sticky; bottom: 0; z-index: 40;
  margin-inline: -1rem;
  background: rgba(255,255,255,0.94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 1px solid #e5e7eb;
  padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom));
}
.dark .pr-actions { background: rgba(15,23,42,0.94); border-color: #334155; }
/* Fixed lanes, NOT flex. With flex, Check Answer stretched across the whole bar
   and Next then appeared in exactly the same place - so the tap that submitted
   an answer, repeated once, skipped the feedback. The third column is sized
   whether or not Next is in the DOM, so the two never share a position. */
.pr-actions-inner {
  display: grid; grid-template-columns: auto 1fr 6.75rem;
  gap: 0.6rem; align-items: center; max-width: 46rem; margin: 0 auto;
}
#practice-skip-btn   { grid-column: 1; }
#practice-submit-btn { grid-column: 2; }
#practice-verdict    { grid-column: 2; }
#practice-next-btn   { grid-column: 3; }
@media (max-width: 360px) { .pr-actions-inner { grid-template-columns: auto 1fr 5.5rem; } }

/* Fills the lane Check Answer leaves, so the bar is not lopsided and the result
   is stated in words next to the button rather than only in colour. */
.pr-verdict { font-size: 0.85rem; font-weight: 700; }
.pr-verdict.hidden { display: none; }
.pr-verdict.is-right { color: #15803d; }
.pr-verdict.is-wrong { color: #b91c1c; }
.dark .pr-verdict.is-right { color: #4ade80; }
.dark .pr-verdict.is-wrong { color: #fca5a5; }

.pr-next {
  padding: 0.8rem 0.5rem; border: 0; border-radius: 0.875rem; cursor: pointer;
  font-size: 0.9rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 3px 12px rgba(79,70,229,0.35); transition: all 0.15s;
}
.pr-next:hover:not(:disabled) { filter: brightness(1.06); }
.pr-next:active:not(:disabled) { transform: translateY(1px); }
.pr-next:disabled { opacity: 0.55; cursor: default; }
.pr-next.hidden { display: none; }
.pr-primary {
  flex: 1; padding: 0.8rem 1rem; border: 0; border-radius: 0.875rem; cursor: pointer;
  font-size: 0.95rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 3px 12px rgba(79,70,229,0.35); transition: all 0.15s;
}
.pr-primary:hover { filter: brightness(1.06); box-shadow: 0 5px 16px rgba(79,70,229,0.45); }
.pr-primary:active { transform: translateY(1px); }
.pr-primary.hidden { display: none; }
.pr-skip {
  flex: 0 0 auto; padding: 0.8rem 1rem; border-radius: 0.875rem; cursor: pointer;
  font-size: 0.8rem; font-weight: 600; color: #64748b;
  background: transparent; border: 1px solid #e5e7eb; transition: all 0.15s;
}
.pr-skip:hover { background: #f1f5f9; color: #334155; }
.dark .pr-skip { color: #94a3b8; border-color: #334155; }
.dark .pr-skip:hover { background: #1e293b; color: #e2e8f0; }
.pr-skip.hidden { display: none; }
/* The student tab bar is deliberately NOT shown while a question is open
   ('practice' is not in _BOTTOM_NAV_SCREENS): two stacked fixed bars covered
   the bottom 155px of a 740px phone, so only two of four options were visible
   on first paint and the explanation landed under the bars after Check. The
   action bar therefore sits at bottom: 0. If the nav is ever restored here,
   these offsets put the bar back above it. */
/* Still correct for a sticky bar: `bottom` is the offset it sticks AT, so this
   parks it above the tab bar rather than under it. The .pr-wrap reserve is gone
   with the fixed positioning that needed it. */
body.has-bottom-nav .pr-actions { bottom: calc(4rem + env(safe-area-inset-bottom)); }
/* Native scrollIntoView honours this, so the feedback clears the fixed bar. */
#practice-feedback { scroll-margin-bottom: 7rem; }

/* ── Chalkboard Practice Theme ──────────────────────────────────────────────
   Everything scoped to #screen-practice so no other screen is touched.
   ⚠ Never add transform/filter here - fixed descendants (pr-actions) would
   lose their viewport anchor and slide off-screen (see CLAUDE.md CSS traps). */
#screen-practice {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 34px,
      rgba(180,180,180,.08) 34px,
      rgba(180,180,180,.08) 35px
    ),
    #1e1e1e;
  min-height: 100vh;
}
/* Top nav buttons */
#screen-practice .back-btn {
  background: rgba(240,236,220,.1); border: 1px solid rgba(240,236,220,.25);
  color: #f0ece8;
}
#screen-practice .back-btn:hover { background: rgba(240,236,220,.2); }
#screen-practice .btn-ghost { color: rgba(240,236,220,.7); border-color: rgba(240,236,220,.22); }
#screen-practice .btn-ghost:hover { background: rgba(240,236,220,.1); color: #f0ece8; border-color: rgba(240,236,220,.45); }
#screen-practice .btn-ghost:disabled { opacity: .35; }
/* Status header */
#screen-practice .pr-head { background: rgba(0,0,0,.2); border-color: rgba(240,236,220,.14); }
#screen-practice .pr-chapter { font-family: 'Caveat', cursive; font-size: 1.25rem; color: #f0ece8; }
#screen-practice .pr-counter { background: rgba(240,236,220,.14); color: rgba(240,236,220,.9); }
#screen-practice .pr-sess { color: rgba(240,236,220,.6); }
#screen-practice .pr-sess b { color: rgba(240,236,220,.9); }
#screen-practice .practice-progress-outer { background: rgba(240,236,220,.12); }
#screen-practice .practice-progress-inner { background: rgba(240,236,220,.65); }
#screen-practice .pr-level { background: rgba(240,236,220,.07); border-color: rgba(240,236,220,.14); color: rgba(240,236,220,.8); }
/* Question card - the writing area of the blackboard */
/* ⚠ The rules from here to .pr-feedback below are SHARED with the admin
   question manager's pupil preview (#qm-preview-board). A preview drawn by
   a second copy of these rules is a preview of the copy, not of the screen
   the child sees - so extend the selector list, never duplicate the block. */
#screen-practice .pr-card, #qm-preview-board .pr-card {
  background: rgba(0,0,0,.25);
  border: 1.5px solid rgba(240,236,220,.18);
  box-shadow: inset 0 2px 10px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.2);
}
#screen-practice .pr-q, #qm-preview-board .pr-q { color: #f0ece8; font-size: 1.1rem; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
#screen-practice .pr-hint, #qm-preview-board .pr-hint { background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.3); color: rgba(251,191,36,.9); }
/* MCQ answer options */
#screen-practice .mcq-opt, #qm-preview-board .mcq-opt { background: rgba(240,236,220,.07); border-color: rgba(240,236,220,.25); color: #f0ece8; }
#screen-practice .mcq-opt:hover:not(.disabled), #qm-preview-board .mcq-opt:hover:not(.disabled) { background: rgba(240,236,220,.14); border-color: rgba(240,236,220,.5); }
#screen-practice .mcq-opt.selected, #qm-preview-board .mcq-opt.selected { background: rgba(240,236,220,.17); border-color: rgba(240,236,220,.65); }
#screen-practice .mcq-opt.correct, #qm-preview-board .mcq-opt.correct { background: rgba(34,197,94,.2) !important; border-color: #4ade80 !important; }
#screen-practice .mcq-opt.wrong, #qm-preview-board .mcq-opt.wrong { background: rgba(239,68,68,.2)  !important; border-color: #f87171 !important; }
#screen-practice .mcq-opt.correct::after, #qm-preview-board .mcq-opt.correct::after { color: #4ade80; }
#screen-practice .mcq-opt.wrong::after, #qm-preview-board .mcq-opt.wrong::after { color: #f87171; }
#screen-practice .opt-letter, #qm-preview-board .opt-letter { background: rgba(240,236,220,.14); color: #f0ece8; border-color: rgba(240,236,220,.28); }
#screen-practice .mcq-opt.selected .opt-letter, #qm-preview-board .mcq-opt.selected .opt-letter { background: rgba(240,236,220,.28); }
/* Numeric input */
#screen-practice .num-input, #qm-preview-board .num-input { background: rgba(240,236,220,.08); border-color: rgba(240,236,220,.3); color: #f0ece8; }
#screen-practice .num-input::placeholder, #qm-preview-board .num-input::placeholder { color: rgba(240,236,220,.35); }
#screen-practice .num-input:focus, #qm-preview-board .num-input:focus { border-color: rgba(240,236,220,.65); }
#screen-practice .num-input.correct, #qm-preview-board .num-input.correct { border-color: #4ade80; background: rgba(34,197,94,.15); }
#screen-practice .num-input.wrong, #qm-preview-board .num-input.wrong { border-color: #f87171; background: rgba(239,68,68,.15); }
/* Typed-answer helpers. The board is dark in BOTH themes, so anything in the
   answer area that inherits the sheet colour is black on a blackboard. */
#screen-practice .expr-hint, #qm-preview-board .expr-hint { color: rgba(240,236,220,.82); }
#screen-practice .slot-label, #qm-preview-board .slot-label { color: rgba(240,236,220,.85); }
#screen-practice .slot-score, #qm-preview-board .slot-score { color: #f0ece8; }
#screen-practice .answer-unsupported, #qm-preview-board .answer-unsupported { color: #f0ece8; background: rgba(240,236,220,.08); border-color: rgba(240,236,220,.4); }
/* Feedback block */
#screen-practice .pr-feedback, #qm-preview-board .pr-feedback { border: 1px solid rgba(240,236,220,.12); background: rgba(0,0,0,.18); color: #f0ece8; }
/* Tools row */
#screen-practice .pr-tool { background: rgba(240,236,220,.08); border-color: rgba(240,236,220,.2); color: rgba(240,236,220,.82); }
#screen-practice .pr-tool:hover { background: rgba(240,236,220,.16); color: #f0ece8; }
#screen-practice .pr-tool-primary { background: rgba(99,102,241,.3); border-color: rgba(99,102,241,.5); color: #f0ece8; }
#screen-practice .pr-tool-badge { background: rgba(240,236,220,.2); color: #f0ece8; }
/* Scratchpad */
#screen-practice .pr-scratch { background: rgba(0,0,0,.2); border-color: rgba(240,236,220,.15); }
#screen-practice .pr-scratch-head { color: rgba(240,236,220,.6); }
#screen-practice .pr-scratch-clear { color: rgba(240,100,100,.9); }
/* Sticky action bar */
#screen-practice .pr-actions {
  background: rgba(13,43,15,.96);
  border-top: 1px solid rgba(240,236,220,.18);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#screen-practice .pr-primary {
  background: rgba(240,236,220,.92); color: #1a3a1c;
  box-shadow: 0 3px 12px rgba(0,0,0,.4);
}
#screen-practice .pr-primary:hover { filter: brightness(1.05); }
#screen-practice .pr-skip { background: transparent; border-color: rgba(240,236,220,.28); color: rgba(240,236,220,.6); }
#screen-practice .pr-skip:hover { background: rgba(240,236,220,.1); color: #f0ece8; border-color: rgba(240,236,220,.5); }
#screen-practice .pr-next { background: rgba(34,197,94,.22); border-color: rgba(34,197,94,.45); color: #86efac; }
#screen-practice .pr-next:hover { background: rgba(34,197,94,.38); }
#screen-practice #practice-verdict { color: #f0ece8; }
/* Error note */
#screen-practice #practice-error-note { color: rgba(240,236,220,.45); }
#screen-practice #practice-error-note b { color: rgba(240,236,220,.65); }

/* ── Exam Prev / Next row ──
   Sticky, not fixed: it rides just above the bottom tab bar while the question
   card is taller than the screen, then settles into its normal place at the
   end of the card. Measured before this on a 360px phone at 130% font: the row
   sat at 641-688px with the tab bar starting at 661px - half a button showing,
   and a child who does not think to scroll sees a broken Next. Only below the
   lg breakpoint, where the navigator sidebar has stacked under the card. */
@media (max-width: 1023px) {
  #exam-nav-row {
    position: sticky; bottom: 0.5rem; z-index: 30;
    background: rgba(255,255,255,0.94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    margin: 0 -1.5rem -1.5rem; padding: 0.6rem 1.5rem 1.5rem; border-radius: 0 0 1rem 1rem;
  }
  .dark #exam-nav-row { background: rgba(31,41,55,0.94); }
  body.has-bottom-nav #exam-nav-row { bottom: calc(var(--tabbar-h, 3.75rem) + env(safe-area-inset-bottom) + 0.5rem); }
}

/* Question progress bar */
.practice-progress-outer {
  height: 6px; background: #e2e8f0; border-radius: 99px; overflow: hidden;
  margin-bottom: 12px;
}
.dark .practice-progress-outer { background: #374151; }
.practice-progress-inner {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
  border-radius: 99px;
  transition: width 0.45s cubic-bezier(.34,1.56,.64,1);
  min-width: 4px;
}

/* Feedback pop (correct) */
@keyframes feedbackPop {
  0%   { opacity: 0; transform: scale(0.88) translateY(6px); }
  55%  { transform: scale(1.03) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
/* Feedback shake (wrong) */
@keyframes feedbackShake {
  0%, 100% { transform: translateX(0); }
  18%  { transform: translateX(-9px); }
  36%  { transform: translateX(9px); }
  54%  { transform: translateX(-5px); }
  72%  { transform: translateX(5px); }
}
.feedback-pop   { animation: feedbackPop   0.38s cubic-bezier(.34,1.56,.64,1) both; }
.feedback-shake { animation: feedbackShake 0.45s ease both; }

@keyframes feedbackEncourage {
  0%   { opacity: 0; transform: translateY(5px); }
  100% { opacity: 1; transform: translateY(0); }
}
.feedback-encourage { animation: feedbackEncourage 0.26s ease-out both; }
.feedback-buddy { display: inline-block; flex: 0 0 auto; }
@media (prefers-reduced-motion: reduce) {
  .feedback-pop, .feedback-shake, .feedback-encourage, .mcq-opt.correct, .mcq-opt.wrong { animation: none; }
}
.kid-calm .feedback-pop, .kid-calm .feedback-shake, .kid-calm .feedback-encourage,
.kid-calm .mcq-opt.correct, .kid-calm .mcq-opt.wrong { animation: none !important; }

/* ── History & Geography: Interactive Map ─────────────────────────────── */
.geo-map-card { border: 1px solid #99f6e4; border-radius: 1.25rem; padding: 1rem; background: linear-gradient(145deg,#ecfeff,#f0fdf4); box-shadow: 0 2px 12px rgba(13,148,136,.10); }
.dark .geo-map-card { background: linear-gradient(145deg,rgba(6,78,59,.30),rgba(30,41,59,.72)); border-color: rgba(45,212,191,.35); }
.geo-map-head { display:flex; align-items:flex-start; justify-content:space-between; gap:.75rem; margin-bottom:.75rem; }
.geo-map-head h3 { font-size:1rem; line-height:1.25; font-weight:800; color:#115e59; }
.dark .geo-map-head h3 { color:#99f6e4; }
.geo-map-head p,.geo-map-note { font-size:.72rem; line-height:1.4; color:#0f766e; margin-top:.2rem; }
.dark .geo-map-head p,.dark .geo-map-note { color:#99f6e4; }
.geo-map-bonus { flex:0 0 auto; font-size:.65rem; font-weight:800; white-space:nowrap; padding:.25rem .5rem; border-radius:99px; color:#0f766e; background:#ccfbf1; }
.dark .geo-map-bonus { background:rgba(13,148,136,.25); color:#99f6e4; }
.geo-map-construction { display:flex; align-items:flex-start; gap:.45rem; margin:0 0 .7rem; padding:.55rem .65rem; border:1px solid #fcd34d; border-radius:.75rem; background:#fffbeb; color:#92400e; font-size:.72rem; line-height:1.42; }
.geo-map-construction > span:first-child { font-size:1rem; line-height:1.1; }.dark .geo-map-construction { background:rgba(120,53,15,.25); border-color:rgba(251,191,36,.5); color:#fde68a; }
.geo-island-tabs { display:flex; gap:.4rem; margin-bottom:.65rem; }
.geo-island-tab { border:1px solid #99f6e4; background:rgba(255,255,255,.7); color:#115e59; border-radius:.65rem; padding:.4rem .65rem; font-size:.72rem; font-weight:800; transition:transform .15s,background .15s,color .15s; }
.geo-island-tab:hover,.geo-island-tab.is-active { background:#115e59; border-color:#115e59; color:#fff; transform:translateY(-1px); }
.dark .geo-island-tab { background:#1e293b; color:#ccfbf1; border-color:rgba(45,212,191,.35); }.dark .geo-island-tab:hover,.dark .geo-island-tab.is-active { background:#14b8a6; color:#042f2e; }
.geo-map-filters { display:flex; flex-wrap:wrap; gap:.4rem; margin-bottom:.85rem; }
.geo-filter { border:1px solid #99f6e4; background:#fff; color:#115e59; border-radius:99px; padding:.35rem .6rem; font-size:.7rem; font-weight:700; transition:transform .15s,background .15s,color .15s; }
.geo-filter:hover,.geo-filter.is-active { background:#0f766e; border-color:#0f766e; color:#fff; transform:translateY(-1px); }
.dark .geo-filter { background:#1e293b; color:#ccfbf1; border-color:rgba(45,212,191,.35); }
.dark .geo-filter.is-active,.dark .geo-filter:hover { background:#14b8a6; color:#042f2e; }
.geo-map-layout { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(11rem,.75fr); gap:.75rem; align-items:stretch; }
.geo-map-wrap { position:relative; overflow:hidden; min-height:0; aspect-ratio:.86; border-radius:1rem; background:linear-gradient(135deg,#bae6fd,#cffafe 55%,#99f6e4); border:1px solid rgba(14,116,144,.18); }
.dark .geo-map-wrap { background:linear-gradient(135deg,#164e63,#0f766e); }
.geo-north { position:absolute; z-index:2; top:.5rem; right:.65rem; color:#0f766e; font-size:.7rem; font-weight:900; }
.dark .geo-north { color:#ccfbf1; }
.geo-island { width:100%; height:100%; position:absolute; inset:0; }
.geo-source-map { width:100%; height:100%; display:block; position:absolute; inset:0; z-index:0; object-fit:contain; user-select:none; }
.geo-world-source { background:#b9e9fa; }
.geo-world-equator,.geo-world-prime { position:absolute; color:#9d174d; font-size:.58rem; font-weight:900; text-shadow:0 1px #fff; white-space:nowrap; }
.geo-world-equator { right:.35rem; margin-top:.18rem; }.geo-world-prime { margin-left:.2rem; top:.25rem; }
.geo-district-map { position:absolute; inset:0; display:block; background:transparent; }.geo-district-svg { width:100%; height:100%; position:absolute; inset:0; z-index:1; }
.geo-district { fill:hsl(var(--district-h),58%,76%,.45); stroke:rgba(15,23,42,.48); stroke-width:.24; vector-effect:non-scaling-stroke; cursor:pointer; transition:filter .15s,stroke-width .15s; }
.geo-district:hover,.geo-district.is-selected { filter:brightness(.9) saturate(1.35); stroke:#0f172a; stroke-width:.65; }
.dark .geo-district { stroke:rgba(226,232,240,.42); }
.geo-island > path:first-child { fill:#bbf7d0; stroke:#15803d; stroke-width:4; }
.dark .geo-island > path:first-child { fill:#166534; stroke:#86efac; }
.geo-island text { fill:#166534; font-size:18px; font-weight:800; letter-spacing:2px; opacity:.7; }
.dark .geo-island text { fill:#bbf7d0; }
.geo-river-line { fill:none; stroke:#0284c7; stroke-width:5; stroke-linecap:round; opacity:.8; }
.geo-road-line { fill:none; stroke:#64748b; stroke-width:4; stroke-linecap:round; opacity:.72; }
.geo-place { fill:#334155; font-size:24px; font-weight:700; paint-order:stroke; stroke:#fff; stroke-width:5px; stroke-linejoin:round; }
.geo-rodrigues-island > path:first-child { fill:#f8fafc; stroke:#ef4444; stroke-width:4; stroke-dasharray:5 6; }
.dark .geo-rodrigues-island > path:first-child { fill:#e2e8f0; stroke:#fb7185; }
.geo-markers { position:absolute; inset:0; z-index:3; }
.geo-map-spinner { position:absolute; inset:0; z-index:10; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.6rem; background:rgba(186,230,253,.55); backdrop-filter:blur(2px); border-radius:1rem; font-size:.8rem; color:#0f766e; font-weight:600; }
.dark .geo-map-spinner { background:rgba(22,78,99,.6); color:#99f6e4; }
.geo-spinner-ring { width:2.4rem; height:2.4rem; border:3px solid rgba(15,118,110,.2); border-top-color:#0f766e; border-radius:50%; animation:geo-spin .75s linear infinite; }
.dark .geo-spinner-ring { border-color:rgba(153,246,228,.2); border-top-color:#99f6e4; }
@keyframes geo-spin { to { transform:rotate(360deg); } }
.geo-map-marker { position:absolute; width:1px; height:1px; overflow:visible; padding:0; border:0; background:transparent; color:#0f172a; font-size:.65rem; line-height:1; font-weight:800; white-space:nowrap; }
.geo-marker-pin { position:absolute; left:0; top:0; display:grid; place-items:center; width:1.45rem; height:1.45rem; transform:translate(-50%,-50%); border:2px solid #fff; border-radius:999px; background:#0f766e; box-shadow:0 1px 5px rgba(15,23,42,.35); transition:transform .15s,box-shadow .15s; }
.geo-marker-icon { font-size:.8rem; line-height:1; }.geo-marker-leader { position:absolute; left:0; top:0; width:var(--leader-length); height:2px; transform:rotate(var(--leader-angle)); transform-origin:0 50%; background:rgba(15,23,42,.75); pointer-events:none; }.geo-marker-label { position:absolute; left:var(--label-x); top:var(--label-y); padding:.2rem .3rem; border:1px solid rgba(15,23,42,.2); border-radius:.4rem; background:rgba(255,255,255,.94); box-shadow:0 1px 4px rgba(15,23,42,.2); pointer-events:none; }
.geo-map-marker:hover,.geo-map-marker.is-selected { z-index:5; }.geo-map-marker:hover .geo-marker-pin,.geo-map-marker.is-selected .geo-marker-pin { transform:translate(-50%,-50%) scale(1.16); box-shadow:0 0 0 3px rgba(255,255,255,.8),0 3px 8px rgba(15,23,42,.35); }.geo-map-marker.is-selected .geo-marker-label { border-color:#0f766e; box-shadow:0 0 0 2px rgba(20,184,166,.28),0 2px 6px rgba(15,23,42,.25); }
.geo-river .geo-marker-pin { background:#0284c7; }.geo-mountain .geo-marker-pin { background:#b45309; }.geo-water .geo-marker-pin { background:#0891b2; }.geo-coast .geo-marker-pin { background:#0f766e; }.geo-port .geo-marker-pin { background:#4f46e5; }.geo-heritage .geo-marker-pin { background:#be185d; }
.geo-continent .geo-marker-pin { background:#ca8a04; }.geo-region .geo-marker-pin { background:#0f766e; }.geo-ocean .geo-marker-pin { background:#0369a1; }.geo-volcano .geo-marker-pin { background:#dc2626; }.geo-latitude .geo-marker-pin,.geo-longitude .geo-marker-pin { background:#be185d; }
.geo-map-info { display:flex; gap:.65rem; align-items:flex-start; padding:.85rem; border-radius:1rem; background:#fff; border:1px solid #ccfbf1; }
.dark .geo-map-info { background:#1e293b; border-color:rgba(45,212,191,.3); }
.geo-info-icon { font-size:1.7rem; line-height:1; }.geo-info-type { color:#0f766e; text-transform:uppercase; letter-spacing:.06em; font-size:.6rem; font-weight:900; }.dark .geo-info-type { color:#5eead4; }
.geo-map-info h4 { font-size:.85rem; font-weight:800; color:#134e4a; margin:.18rem 0; }.dark .geo-map-info h4 { color:#e2e8f0; }.geo-map-info p { color:#475569; font-size:.75rem; line-height:1.45; }.dark .geo-map-info p { color:#cbd5e1; }
.geo-map-note { margin:.7rem .15rem 0; }
.geo-editor-filter { border:1px solid #99f6e4; border-radius:999px; padding:.28rem .45rem; font-size:.68rem; font-weight:700; color:#0f766e; background:#fff; }
.geo-editor-filter.is-active,.geo-editor-filter:hover { color:#fff; background:#0f766e; border-color:#0f766e; }
#cal-grid { touch-action:pan-y; }
.geo-editor-input { width:100%; display:block; padding:.55rem .65rem; border:1px solid #cbd5e1; border-radius:.7rem; background:#fff; color:#0f172a; font-size:.8rem; }
.dark .geo-editor-input { border-color:#475569; background:#1e293b; color:#e2e8f0; }
@media (max-width:640px) { .geo-map-layout { grid-template-columns:1fr; }.geo-map-wrap { min-height:0; }.geo-map-marker { font-size:.58rem; padding:.12rem .2rem; }.geo-marker-label { max-width:5rem; overflow:hidden; text-overflow:ellipsis; }.geo-map-head { display:block; }.geo-map-bonus { display:inline-block; margin-top:.45rem; } }
@media (prefers-reduced-motion:reduce) { .geo-filter,.geo-map-marker { transition:none; } }

/* Above GeoMap's LABEL_LIMIT the markers layer gets .labels-quiet: only the
   selected marker (or the one under the pointer) keeps its caption. Sixty
   captions at once is a wall of text, not a map - the category filters are how
   a child reads a whole group, and tapping is how they read one place. */
.geo-markers.labels-quiet .geo-map-marker .geo-marker-label,
.geo-markers.labels-quiet .geo-map-marker .geo-marker-leader { display: none; }
.geo-markers.labels-quiet .geo-map-marker.is-selected .geo-marker-label,
.geo-markers.labels-quiet .geo-map-marker.is-selected .geo-marker-leader,
.geo-markers.labels-quiet .geo-map-marker:hover .geo-marker-label,
.geo-markers.labels-quiet .geo-map-marker:hover .geo-marker-leader,
.geo-markers.labels-quiet .geo-map-marker:focus-visible .geo-marker-label,
.geo-markers.labels-quiet .geo-map-marker:focus-visible .geo-marker-leader { display: block; }
.geo-map-hint { margin:.55rem .15rem 0; font-size:.7rem; line-height:1.4; color:#0f766e; }
.dark .geo-map-hint { color:#99f6e4; }
.geo-map-hint:empty { display:none; }
/* Denser maps: a smaller pin keeps sixty markers legible against the artwork. */
.geo-island .geo-marker-pin { background:#0f766e; }
.geo-waterfall .geo-marker-pin { background:#0369a1; }
.geo-reserve .geo-marker-pin { background:#15803d; }
.geo-town .geo-marker-pin { background:#7c3aed; }
.geo-cave .geo-marker-pin { background:#57534e; }
.geo-ed-row-icon.geo-island { background:#0f766e; }
.geo-ed-row-icon.geo-waterfall { background:#0369a1; }
.geo-ed-row-icon.geo-reserve { background:#15803d; }
.geo-ed-row-icon.geo-town { background:#7c3aed; }
.geo-ed-row-icon.geo-cave { background:#57534e; }

.geo-crater .geo-marker-pin { background:#b91c1c; }
.geo-plain .geo-marker-pin { background:#4d7c0f; }
.geo-ed-row-icon.geo-crater { background:#b91c1c; }
.geo-ed-row-icon.geo-plain { background:#4d7c0f; }
/* World graticule - drawn by GeoMap from the fitted Robinson projection, not by
   evenly spaced CSS gradients. Meridians curve; parallels are straight. */
.geo-world-grid { position:absolute; inset:0; z-index:1; pointer-events:none; overflow:visible; }
.geo-grat { fill:none; stroke:rgba(14,116,144,.34); stroke-width:1; vector-effect:non-scaling-stroke; }
.geo-grat.is-equator, .geo-grat.is-prime { stroke:rgba(190,24,93,.62); stroke-width:2; }

/* River courses. Drawn in the same stretched viewBox as the districts so a
   percentage means one point on every layer; non-scaling-stroke keeps the line
   an even width despite that non-uniform scale. */
.geo-lines { position:absolute; inset:0; z-index:2; overflow:visible; pointer-events:none; }
.geo-line { fill:none; stroke:#0284c7; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;
            vector-effect:non-scaling-stroke; opacity:.85; pointer-events:stroke; cursor:pointer; }
.geo-line:hover { stroke:#0369a1; stroke-width:3.5; }
.geo-line.is-selected { stroke:#0369a1; stroke-width:3.5; filter:drop-shadow(0 0 3px rgba(255,255,255,.9)); }
.dark .geo-line { stroke:#38bdf8; }
/* Course points, shown only for the river being edited. */
.geo-ed-vertex { position:absolute; z-index:4; width:.7rem; height:.7rem; transform:translate(-50%,-50%);
                 border:2px solid #fff; border-radius:999px; background:#0369a1; padding:0;
                 box-shadow:0 1px 3px rgba(15,23,42,.5); cursor:grab; touch-action:none; }
.geo-ed-vertex:hover { background:#f59e0b; transform:translate(-50%,-50%) scale(1.35); }
.geo-ed-along { width:100%; display:block; margin:.15rem 0 .1rem; }

/* ── Admin map editor ──────────────────────────────────────────────────────
   The canvas deliberately reuses .geo-map-marker, .geo-marker-label and
   .geo-district - the child's own markup - so the editor cannot drift out of
   step with what a child sees. Only editor chrome is styled here. */
.geo-ed { background:#fff; border-radius:1rem; padding:1rem; box-shadow:0 1px 3px rgba(15,23,42,.1); }
.dark .geo-ed { background:#1f2937; }
.geo-ed-head { display:flex; flex-wrap:wrap; gap:.75rem; align-items:flex-start; justify-content:space-between; }
.geo-ed-head h3 { font-size:1rem; font-weight:800; color:#115e59; }
.dark .geo-ed-head h3 { color:#99f6e4; }
.geo-ed-head p { font-size:.72rem; line-height:1.45; color:#64748b; margin-top:.2rem; max-width:34rem; }
.dark .geo-ed-head p { color:#94a3b8; }
.geo-ed-actions { display:flex; flex-wrap:wrap; gap:.4rem; align-items:center; }
.geo-ed-dirty { font-size:.68rem; font-weight:800; color:#0f766e; white-space:nowrap; }
.dark .geo-ed-dirty { color:#5eead4; }
.geo-ed-dirty.is-dirty { color:#b45309; }
.dark .geo-ed-dirty.is-dirty { color:#fbbf24; }
.geo-ed-btn { border:1px solid #cbd5e1; background:#fff; color:#334155; border-radius:.7rem; padding:.4rem .7rem; font-size:.72rem; font-weight:700; }
.geo-ed-btn:hover:not(:disabled) { background:#f1f5f9; }
.geo-ed-btn:disabled { opacity:.45; cursor:not-allowed; }
.dark .geo-ed-btn { border-color:#475569; background:#334155; color:#e2e8f0; }
.dark .geo-ed-btn:hover:not(:disabled) { background:#475569; }
.geo-ed-btn.is-primary { background:#0f766e; border-color:#0f766e; color:#fff; }
.geo-ed-btn.is-primary:hover:not(:disabled) { background:#0d9488; }
.geo-ed-btn.is-danger { color:#b91c1c; border-color:#fca5a5; }
.dark .geo-ed-btn.is-danger { color:#fca5a5; border-color:#7f1d1d; background:#3f1d1d; }
.geo-ed-status { margin:.6rem 0 0; padding:.5rem .7rem; border-radius:.6rem; font-size:.73rem; font-weight:600; line-height:1.45; }
.geo-ed-status.is-info { background:#ecfeff; color:#0f766e; }
.geo-ed-status.is-good { background:#ecfdf5; color:#047857; }
.geo-ed-status.is-warn { background:#fffbeb; color:#b45309; }
.geo-ed-status.is-bad  { background:#fef2f2; color:#b91c1c; }
.dark .geo-ed-status.is-info { background:rgba(13,148,136,.2); color:#5eead4; }
.dark .geo-ed-status.is-good { background:rgba(5,150,105,.2); color:#6ee7b7; }
.dark .geo-ed-status.is-warn { background:rgba(180,83,9,.22); color:#fcd34d; }
.dark .geo-ed-status.is-bad  { background:rgba(185,28,28,.22); color:#fca5a5; }
.geo-ed-body { display:grid; grid-template-columns:minmax(0,1fr) 19rem; gap:1rem; margin-top:.75rem; align-items:start; }
.geo-ed-main { min-width:0; }
.geo-ed-toolbar { display:flex; flex-wrap:wrap; gap:.4rem; align-items:center; margin-bottom:.5rem; }
.geo-ed-island { width:auto; min-width:9.5rem; }
.geo-ed-chips { display:flex; flex-wrap:wrap; gap:.35rem; }
.geo-ed-toggle { display:inline-flex; align-items:center; gap:.3rem; font-size:.7rem; font-weight:700; color:#475569; }
.dark .geo-ed-toggle { color:#cbd5e1; }
.geo-ed-toggle.is-disabled { opacity:.4; }
.geo-ed-zoom { display:inline-flex; align-items:center; gap:.35rem; font-size:.7rem; font-weight:700; color:#475569; }
.dark .geo-ed-zoom { color:#cbd5e1; }
.geo-ed-zoom input { width:7rem; }
.geo-ed-canvas { position:relative; height:min(70vh,40rem); overflow:auto; overscroll-behavior:contain; border:1px solid #99f6e4; border-radius:1rem; background:linear-gradient(135deg,#bae6fd,#cffafe 55%,#99f6e4); }
.dark .geo-ed-canvas { background:linear-gradient(135deg,#164e63,#0f766e); border-color:rgba(45,212,191,.35); }
.geo-ed-canvas.is-placing { cursor:crosshair; }
.geo-ed-zoomlayer { position:relative; height:100%; margin:0 auto; }
.geo-ed-zoomlayer.hide-labels .geo-marker-label,
.geo-ed-zoomlayer.hide-labels .geo-marker-leader { display:none; }
.geo-ed-marker { touch-action:none; }
.geo-ed-marker .geo-marker-pin { cursor:grab; }
.geo-ed-marker .geo-marker-label { pointer-events:auto; cursor:move; }
.geo-ed-marker.is-selected .geo-marker-pin { box-shadow:0 0 0 3px #fff,0 0 0 6px rgba(67,56,202,.85); }
.geo-ed-marker.is-hidden-feature { opacity:.38; }
.geo-ed-hint { margin:.45rem .15rem 0; font-size:.7rem; color:#64748b; }
.dark .geo-ed-hint { color:#94a3b8; }
.geo-ed-coord { font-variant-numeric:tabular-nums; font-weight:700; color:#0f766e; }
.dark .geo-ed-coord { color:#5eead4; }
.geo-ed-save-bar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.6rem; margin-top:.65rem; padding:.65rem .75rem; border:1px solid #99f6e4; border-radius:.8rem; background:#f0fdfa; color:#115e59; font-size:.72rem; font-weight:700; }
.dark .geo-ed-save-bar { background:rgba(13,148,136,.15); border-color:rgba(45,212,191,.35); color:#ccfbf1; }
.geo-ed-side { display:flex; flex-direction:column; gap:.5rem; min-width:0; }
.geo-ed-list { max-height:13rem; overflow:auto; border:1px solid #e2e8f0; border-radius:.7rem; }
.dark .geo-ed-list { border-color:#475569; }
.geo-ed-row { display:flex; width:100%; gap:.5rem; align-items:center; text-align:left; padding:.4rem .5rem; border-bottom:1px solid #f1f5f9; }
.dark .geo-ed-row { border-color:#334155; }
.geo-ed-row:hover { background:#f8fafc; }
.dark .geo-ed-row:hover { background:#334155; }
.geo-ed-row.is-active { background:#ccfbf1; }
.dark .geo-ed-row.is-active { background:rgba(13,148,136,.3); }
.geo-ed-row-icon { flex:0 0 auto; display:grid; place-items:center; width:1.55rem; height:1.55rem; border-radius:999px; background:#0f766e; font-size:.8rem; }
.geo-ed-row-icon.geo-river { background:#0284c7; }
.geo-ed-row-icon.geo-mountain { background:#b45309; }
.geo-ed-row-icon.geo-water { background:#0891b2; }
.geo-ed-row-icon.geo-coast { background:#0f766e; }
.geo-ed-row-icon.geo-port { background:#4f46e5; }
.geo-ed-row-icon.geo-heritage { background:#be185d; }
.geo-ed-row-icon.geo-continent { background:#ca8a04; }.geo-ed-row-icon.geo-region { background:#0f766e; }.geo-ed-row-icon.geo-ocean { background:#0369a1; }.geo-ed-row-icon.geo-volcano { background:#dc2626; }.geo-ed-row-icon.geo-latitude,.geo-ed-row-icon.geo-longitude { background:#be185d; }
.geo-ed-row-text { display:flex; flex-direction:column; min-width:0; }
.geo-ed-row-text b { font-size:.74rem; font-weight:700; color:#0f172a; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dark .geo-ed-row-text b { color:#e2e8f0; }
.geo-ed-row-text i { font-style:normal; font-size:.62rem; color:#64748b; }
.dark .geo-ed-row-text i { color:#94a3b8; }
.geo-ed-empty { font-size:.72rem; color:#94a3b8; padding:.6rem; }
.geo-ed-form { display:flex; flex-direction:column; gap:.3rem; }
.geo-ed-form-head { display:flex; gap:.45rem; align-items:center; font-size:.78rem; font-weight:700; color:#0f172a; }
.dark .geo-ed-form-head { color:#e2e8f0; }
.geo-ed-label { font-size:.63rem; font-weight:800; text-transform:uppercase; letter-spacing:.04em; color:#64748b; margin-top:.3rem; }
.dark .geo-ed-label { color:#94a3b8; }
.geo-ed-fact { height:6rem; resize:vertical; }
.geo-ed-pair { display:grid; grid-template-columns:1fr 1fr; gap:.35rem; }
.geo-ed-icons { display:flex; flex-wrap:wrap; gap:.3rem; align-items:center; }
.geo-ed-icon { width:2rem; height:2rem; border:1px solid #cbd5e1; border-radius:.55rem; background:#fff; font-size:1rem; }
.dark .geo-ed-icon { border-color:#475569; background:#334155; }
.geo-ed-icon.is-active { border-color:#0f766e; box-shadow:0 0 0 2px rgba(13,148,136,.3); }
.geo-ed-icon-input { width:4.5rem; display:inline-block; text-align:center; }
.geo-ed-form-actions { display:flex; flex-wrap:wrap; gap:.35rem; margin-top:.55rem; }
.geo-ed-wide { flex:1 0 100%; }
.geo-ed-preview { margin-top:.9rem; border-top:1px solid #e2e8f0; padding-top:.7rem; }
.dark .geo-ed-preview { border-color:#334155; }
.geo-ed-preview > summary { font-size:.74rem; font-weight:800; color:#0f766e; cursor:pointer; }
.dark .geo-ed-preview > summary { color:#5eead4; }
.geo-ed-preview > div { margin-top:.7rem; max-width:44rem; }
@media (max-width:900px) { .geo-ed-body { grid-template-columns:1fr; } .geo-ed-canvas { height:min(60vh,26rem); } .geo-ed-save-bar { align-items:stretch; } .geo-ed-save-bar .geo-ed-btn { width:100%; } }

/* MCQ option micro-interactions */
.mcq-opt:not(.disabled):active  { transform: scale(0.97); }
.mcq-opt.correct { animation: optPulse  0.4s ease both; }
.mcq-opt.wrong   { animation: optShake  0.35s ease both; }
@keyframes optPulse {
  0%  { transform: scale(1); }
  45% { transform: scale(1.035); }
  100%{ transform: scale(1); }
}
@keyframes optShake {
  0%, 100% { transform: translateX(0); }
  28%  { transform: translateX(-6px); }
  72%  { transform: translateX(6px); }
}

/* XP floating bubble */
@keyframes xpFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  65%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-64px) scale(0.75); }
}
.xp-float {
  position: fixed; pointer-events: none; z-index: 999;
  font-size: 1rem; font-weight: 800; color: #7c3aed;
  text-shadow: 0 1px 6px rgba(0,0,0,.18);
  animation: xpFloat 1.3s ease-out forwards;
  white-space: nowrap;
}
.dark .xp-float { color: #c4b5fd; }

/* Combo banner */
@keyframes comboPop {
  0%   { opacity: 0; transform: translate(-50%, -14px) scale(0.7); }
  55%  { transform: translate(-50%, 4px)   scale(1.08); }
  100% { opacity: 1; transform: translate(-50%, 0)     scale(1); }
}
@keyframes comboFade {
  from { opacity: 1; }
  to   { opacity: 0; transform: translate(-50%, -10px) scale(0.85); }
}
#practice-combo {
  position: fixed; top: 72px; left: 50%;
  transform: translate(-50%, 0);
  z-index: 500; pointer-events: none;
  padding: 0.45rem 1.4rem; border-radius: 99px;
  font-weight: 800; font-size: 1.1rem; white-space: nowrap;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white; box-shadow: 0 4px 20px rgba(239,68,68,.4);
}
#practice-combo.combo-in  { animation: comboPop  0.42s cubic-bezier(.34,1.56,.64,1) both; }
#practice-combo.combo-out { animation: comboFade 0.32s ease forwards; }

/* Question slide-in */
@keyframes questionIn {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}
.question-enter { animation: questionIn 0.22s ease both; }

/* Sound toggle muted state */
#sound-toggle-btn.muted { opacity: 0.45; }

/* Parent PIN number-pad keys */
.pin-key-btn {
  padding-top: 1rem; padding-bottom: 1rem;
  font-size: 1.125rem; line-height: 1.75rem; font-weight: 700;
  color: #1f2937; background-color: #f3f4f6;
  border: none; border-radius: 1rem; cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
  -webkit-user-select: none; user-select: none; width: 100%;
}
.pin-key-btn:hover  { background-color: #e5e7eb; }
.pin-key-btn:active { transform: scale(0.93); }
.pin-key-btn:disabled { opacity: 0.45; pointer-events: none; }
.dark .pin-key-btn          { color: #f9fafb; background-color: #1f2937; }
.dark .pin-key-btn:hover    { background-color: #374151; }

/* ── "Switch to a child" chips (#modal-student-switch) ───────────────────
   Face over name, so the child is picked by the avatar they chose rather
   than by reading. Sized past the 44px touch target even with one word. */
.sw-kid {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.15rem;
  min-width: 4.5rem; max-width: 6.5rem; padding: 0.5rem 0.4rem;
  border: 2px solid #e5e7eb; border-radius: 1rem;
  background-color: #f9fafb; cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
  -webkit-user-select: none; user-select: none;
}
.sw-kid:active { transform: scale(0.95); }
.sw-kid-face { font-size: 1.6rem; line-height: 1.8rem; }
.sw-kid-name {
  font-size: 0.7rem; font-weight: 700; color: #374151;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sw-kid-on { border-color: #6366f1; background-color: #eef2ff; }
.sw-kid-on .sw-kid-name { color: #4338ca; }
.dark .sw-kid          { border-color: #374151; background-color: #111827; }
.dark .sw-kid-name     { color: #d1d5db; }
.dark .sw-kid-on       { border-color: #818cf8; background-color: #312e81; }
.dark .sw-kid-on .sw-kid-name { color: #e0e7ff; }

/* ── Onboarding hint callout ─────────────────────── */
#hint-callout {
  position: fixed;
  z-index: 9999;
  max-width: 240px;
  background: #4f46e5;
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px 12px 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  box-shadow: 0 8px 28px rgba(79,70,229,0.45);
  pointer-events: auto;
  animation: hint-pop 0.25s cubic-bezier(0.34,1.56,0.64,1) both;
}
#hint-callout.hint-hidden { display: none; }
#hint-callout .hint-close {
  position: absolute; top: 6px; right: 8px;
  background: none; border: none; color: rgba(255,255,255,0.75);
  font-size: 1rem; cursor: pointer; line-height: 1; padding: 0;
}
#hint-callout .hint-close:hover { color: #fff; }
#hint-callout::after {
  content: '';
  position: absolute;
  border: 8px solid transparent;
}
#hint-callout.arrow-top::after {
  top: -16px; left: calc(var(--hint-arrow-x, 20px) - 8px);
  border-bottom-color: #4f46e5;
}
#hint-callout.arrow-bottom::after {
  bottom: -16px; left: calc(var(--hint-arrow-x, 20px) - 8px);
  border-top-color: #4f46e5;
}
@keyframes hint-pop {
  from { opacity: 0; transform: scale(0.85) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ══════════ TASK BUTTONS ══════════
   Today's plan and anything paused, as two small cards instead of two full
   panels. Side by side from 480px; stacked below that, where a phone has room
   for exactly one readable row. */
.task-row { display: grid; gap: 0.5rem; margin-bottom: 1.25rem; }
@media (min-width: 480px) { .task-row { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); } }

.task-btn {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  padding: 0.75rem 0.875rem; border-radius: 1rem; border: 1px solid transparent;
  text-align: left; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.task-btn:active { transform: scale(0.985); }
.task-btn.is-plan   { background: #eef2ff; border-color: #c7d2fe; }
.dark .task-btn.is-plan { background: rgba(79,70,229,0.22); border-color: rgba(99,102,241,0.4); }
.task-btn.is-resume { background: #ecfdf5; border-color: #a7f3d0; }
.dark .task-btn.is-resume { background: rgba(16,185,129,0.18); border-color: rgba(16,185,129,0.4); }
.task-btn.is-muted  { opacity: 0.7; }

.task-ico { font-size: 1.5rem; line-height: 1; flex: 0 0 auto; }
.task-body { flex: 1; min-width: 0; }
.task-title {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.85rem; font-weight: 800; color: #1e293b; line-height: 1.2;
}
.dark .task-title { color: #f1f5f9; }
.task-badge {
  min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: #4f46e5; color: #fff;
  font-size: 0.625rem; font-weight: 800; line-height: 1;
}
.task-btn.is-resume .task-badge { background: #059669; }
.task-sub  { display: block; font-size: 0.72rem; font-weight: 600; color: #475569; margin-top: 0.1rem;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dark .task-sub { color: #cbd5e1; }
.task-meta { display: block; font-size: 0.65rem; color: #64748b; margin-top: 0.05rem; }
.dark .task-meta { color: #94a3b8; }

/* Rows inside the "pick up again" sheet */
.rt-item {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.625rem 0.5rem; border-radius: 0.875rem;
}
.rt-item + .rt-item { border-top: 1px solid #f1f5f9; }
.dark .rt-item + .rt-item { border-top-color: #374151; }
.rt-ico   { font-size: 1.35rem; flex: 0 0 auto; }
.rt-body  { flex: 1; min-width: 0; }
.rt-title { font-size: 0.8rem; font-weight: 700; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dark .rt-title { color: #f1f5f9; }
.rt-sub   { font-size: 0.68rem; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dark .rt-sub { color: #94a3b8; }
.rt-go {
  flex: 0 0 auto; font-size: 0.7rem; font-weight: 800; padding: 0.45rem 0.7rem;
  border-radius: 0.7rem; border: none; cursor: pointer;
  background: #059669; color: #fff;
}
.rt-go:hover { background: #047857; }
.rt-drop {
  flex: 0 0 auto; width: 1.75rem; height: 1.75rem; border: none; cursor: pointer;
  border-radius: 999px; background: transparent; color: #94a3b8; font-size: 0.85rem;
}
.rt-drop:hover { background: #fee2e2; color: #dc2626; }
.dark .rt-drop:hover { background: rgba(220,38,38,0.25); color: #fca5a5; }

/* ══════════ TODAY'S GOAL ══════════
   The card that gives a practice session an ending. Sits at the top of both
   landing screens (kid home and dashboard). */
.goal-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 1.25rem;
  padding: 1rem; margin-bottom: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.dark .goal-card { background: #1f2937; border-color: #374151; }
.goal-card.is-done { border-color: #86efac; background: linear-gradient(180deg, #f0fdf4, #fff); }
.dark .goal-card.is-done { border-color: rgba(34,197,94,0.5); background: linear-gradient(180deg, rgba(22,163,74,0.18), #1f2937); }

.goal-main { display: flex; align-items: center; gap: 0.875rem; }
.goal-ring-wrap { position: relative; width: 60px; height: 60px; flex: 0 0 60px; }
.goal-ring { width: 60px; height: 60px; transform: rotate(-90deg); }
.goal-ring-bg { fill: none; stroke: #e5e7eb; stroke-width: 6; }
.dark .goal-ring-bg { stroke: #374151; }
.goal-ring-fg {
  fill: none; stroke: #6366f1; stroke-width: 6; stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.25,0.46,0.45,0.94);
}
.goal-ring-fg.is-done { stroke: #22c55e; }
@media (prefers-reduced-motion: reduce) { .goal-ring-fg { transition: none; } }
.goal-ring-txt {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; color: #334155;
}
.dark .goal-ring-txt { color: #f1f5f9; }
.goal-ring-txt small { font-size: 0.65rem; font-weight: 700; color: #94a3b8; }
.goal-card.is-done .goal-ring-txt { color: #16a34a; font-size: 1.5rem; }

.goal-text { flex: 1; min-width: 0; }
.goal-head { font-size: 0.95rem; font-weight: 800; color: #1e293b; line-height: 1.2; }
.dark .goal-head { color: #f1f5f9; }
.goal-sub  { font-size: 0.75rem; color: #64748b; margin-top: 0.1rem; }
.dark .goal-sub { color: #94a3b8; }
.goal-lv   { font-size: 0.68rem; font-weight: 700; color: #6d28d9; margin-top: 0.35rem; }
.dark .goal-lv { color: #c4b5fd; }
.goal-lv-bar { height: 4px; border-radius: 999px; background: #ede9fe; overflow: hidden; margin-top: 0.2rem; }
.dark .goal-lv-bar { background: #374151; }
.goal-lv-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg,#8b5cf6,#6366f1); transition: width 0.6s ease; }

/* Seven days, three states. A bare streak number cannot say "you met the goal
   on 4 days and showed up on 2 more". */
.goal-week { margin-top: 0.875rem; padding-top: 0.75rem; border-top: 1px solid #f1f5f9; }
.dark .goal-week { border-top-color: #374151; }
.goal-week-days { display: flex; gap: 0.3rem; }
.goal-day {
  flex: 1 1 0; min-width: 0; height: 1.75rem; border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: #94a3b8;
  font-size: 0.6rem; font-weight: 800;
}
.dark .goal-day { background: #374151; color: #6b7280; }
.goal-day i { font-style: normal; }
.goal-day.is-part { background: #e0e7ff; color: #4338ca; }
.dark .goal-day.is-part { background: rgba(79,70,229,0.3); color: #c7d2fe; }
.goal-day.is-met  { background: #22c55e; color: #fff; }
.dark .goal-day.is-met { background: #16a34a; color: #fff; }
.goal-week-note { font-size: 0.65rem; color: #64748b; margin-top: 0.4rem; }
.dark .goal-week-note { color: #94a3b8; }

/* ── Parent report: Today / Yesterday breakdown ──
   The one card that answers "what did they do today", so it reads as a list of
   chapters, not another chart. */
.rep-days { display: grid; gap: 0.5rem; }
@media (min-width: 480px) { .rep-days { grid-template-columns: 1fr 1fr; } }
.rep-day-card {
  background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 0.875rem;
  padding: 0.625rem 0.75rem;
}
.dark .rep-day-card { background: #1f2937; border-color: #374151; }
.rep-day-card.is-empty { opacity: 0.7; }
.rep-day-when {
  font-size: 0.625rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; color: #64748b; margin-bottom: 0.25rem;
}
.dark .rep-day-when { color: #94a3b8; }
.rep-day-top { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.rep-day-q   { font-size: 0.95rem; font-weight: 800; color: #1e293b; }
.dark .rep-day-q { color: #f1f5f9; }
.rep-day-acc { font-size: 0.8rem; font-weight: 800; }
.rep-day-exam{ font-size: 0.65rem; font-weight: 700; color: #64748b; }
.dark .rep-day-exam { color: #94a3b8; }
.rep-day-none{ font-size: 0.7rem; color: #94a3b8; }
.rep-ch-row {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.2rem 0; font-size: 0.7rem;
}
.rep-ch-ico  { flex: 0 0 auto; }
.rep-ch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
               font-weight: 600; color: #334155; }
.dark .rep-ch-name { color: #cbd5e1; }
.rep-ch-n    { flex: 0 0 auto; font-weight: 700; color: #64748b; }
.dark .rep-ch-n { color: #94a3b8; }
.rep-ch-pct  { flex: 0 0 auto; font-weight: 800; min-width: 2.2rem; text-align: right; }

/* ── Idle nudge ────────────────────────────────
   The gentle "you have been sitting here a while, this is the thing to press"
   shake. Kept small on purpose: a big bounce reads as an error state, and this
   fires on a child who is merely thinking. Three wobbles and it stops.

   ⚠ Two ways to switch the motion off, and both have to work:
   the OS-level prefers-reduced-motion, and Calm Mode in My Settings (.kid-calm),
   which is an explicit in-app choice and therefore has to win even on a device
   whose OS says motion is fine. The glow and the callout stay either way - the
   help is the sentence, the movement is only what draws the eye to it. */
@keyframes attnNudge {
  0%, 100%      { transform: translateX(0)      rotate(0deg); }
  8%, 24%, 40%  { transform: translateX(-3px)   rotate(-0.9deg); }
  16%, 32%, 48% { transform: translateX(3px)    rotate(0.9deg); }
  56%           { transform: translateX(0)      rotate(0deg); }
}
.attn-nudge {
  animation: attnNudge 2.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) 1;
  position: relative; z-index: 2;
  border-radius: inherit;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.32), 0 8px 22px rgba(99, 102, 241, 0.18);
}
.dark .attn-nudge { box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.4), 0 8px 22px rgba(0, 0, 0, 0.45); }
@media (prefers-reduced-motion: reduce) { .attn-nudge { animation: none; } }
.kid-calm .attn-nudge { animation: none !important; }

/* Pulsing ring on the hinted target element */
.hint-pulse {
  position: relative;
}
.hint-pulse::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  border: 2.5px solid #6366f1;
  animation: hint-pulse-ring 1.4s ease-out infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes hint-pulse-ring {
  0%   { opacity: 1; transform: scale(1); }
  70%  { opacity: 0; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(1.15); }
}

/* ── Prevent horizontal scroll ──────────────────
   `overflow-x: hidden` on body propagates to the viewport and makes the
   viewport a scroll container, which is the documented way to break
   `position: sticky` in Safari - and the app header is sticky. `clip` does the
   same clipping WITHOUT establishing a scroll container, so sticky survives.
   The hidden rule stays as the fallback for engines with no `clip` support
   (Safari < 16), where the sticky trade-off was already being made anyway. */
body { overflow-x: hidden; }
@supports (overflow-x: clip) {
  html, body { overflow-x: clip; }
}

/* Backstops for the things that actually cause the sideways scroll: a wide
   image, a long unbroken word (a URL, a French compound, a child's typed
   answer), or a table. Every one of these was reachable in the app. */
img, svg, video, canvas, iframe { max-width: 100%; }
.q-text, .mcq-opt, .pr-feedback, #exam-q-text, #practice-q-text,
#results-review, #rc-review { overflow-wrap: anywhere; }
/* A table cannot wrap, so it gets its own scroller rather than pushing the
   page. #pd-chapters sets white-space: nowrap on purpose. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Screen slide transitions ─────────────────── */
.screen-enter-right {
  animation: slideInRight 0.22s cubic-bezier(0.25,0.46,0.45,0.94) both;
}
.screen-enter-left {
  animation: slideInLeft 0.22s cubic-bezier(0.25,0.46,0.45,0.94) both;
}
/* ⚠ Opacity ONLY - no transform, no translate. A screen div is the ancestor of
   the practice screen's position:fixed action bar, and a transformed ancestor
   becomes the containing block for fixed descendants. With the old
   translateX() keyframes (fill-mode both leaves transform at matrix(1,0,0,1,0,0),
   which is NOT none) the Check/Next bar was anchored to the bottom of the
   screen's CONTENT, not the viewport: half visible on some phones, entirely
   off-screen on a tall question or a larger font size. Measured in headless
   Chrome at 390x844: bar at 784-875px on an 844px viewport. */
@keyframes slideInRight {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Bottom navigation bar ──────────────────────
   ⚠ These buttons used to carry class="nav-btn", the SAME class the exam
   question-navigator grid uses (.nav-btn { width:2rem; height:2rem }). So on
   every device the four tab buttons were being laid out inside a 32×32 box
   while holding a 24px icon and a whole word ("Practice", "Progress"). The
   label could not wrap - it is one word - so it spilled out of the button on
   both sides. On a wide screen the max-w-lg track had slack to absorb it and
   nobody noticed; on a 360px Android phone the four overflowing buttons added
   up to more than the viewport, which is exactly the "the bottom bar is huge
   and the page scrolls sideways" report. A device with a larger system font
   scale (Samsung One UI defaults bigger than stock Android) crosses the line
   sooner, which is why only some phones showed it.

   The bar is its own component now. Nothing here is shared with the exam grid.
   Sizes are in rem so a system font scale grows the bar gracefully instead of
   bursting it, and each tab is a flex item that may shrink to nothing. */
.tabbar-btn {
  flex: 1 1 0;
  min-width: 0;                 /* the part that actually stops the overflow */
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.125rem;
  padding: 0.375rem 0.25rem;
  border: none; background: none; cursor: pointer;
  border-radius: 0.75rem;
  color: #6b7280;
  transition: color 0.15s, background-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tabbar-btn svg { width: 1.5rem; height: 1.5rem; flex: 0 0 auto; }
.tabbar-btn span {
  font-size: 0.625rem; font-weight: 600; line-height: 1.1;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tabbar-btn:active { background: rgba(99,102,241,0.08); }
.tabbar-btn.nav-active { color: #4f46e5; }
.tabbar-btn.nav-active svg { stroke: #6366f1; }
.tabbar-btn.nav-active span { color: #4f46e5; }
.dark .tabbar-btn { color: #9ca3af; }

/* One source of truth for the bar's height, so the main padding below and the
   bar itself can never disagree and clip the last card on the page. */
#student-bottom-nav { --tabbar-h: 3.75rem; }
#student-bottom-nav > div { height: var(--tabbar-h); }
body.has-bottom-nav main {
  padding-bottom: calc(var(--tabbar-h, 3.75rem) + env(safe-area-inset-bottom) + 0.75rem);
}

/* ── MCQ spring tap ───────────────────────────── */
.mcq-spring {
  animation: mcqSpring 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes mcqSpring {
  0%   { transform: scale(1); }
  30%  { transform: scale(0.94); }
  65%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* Dark-mode partners for the greys raised for light-mode contrast above.
   slate-500 is 4.76:1 on white but only 3.07:1 on a #1e293b card; slate-400 is
   the mirror image (2.56:1 / 5.71:1). Each surface gets the one that passes. */
.dark .ch-subtitle,
.dark .ch-sum-lbl,
.dark .ch-sum-bar-head,
.dark .ch-part,
.dark .ch-status.new,
.dark .ch-card.is-locked .ch-cta,
.dark .ch-section-note,
.dark .pr-sess,
.dark .pr-level,
.dark .pr-scratch-head { color: #94a3b8; }
.dark .stat-label { color: #9ca3af; }
.dark .ch-status.mid  { color: #fbbf24; }
.dark .ch-status.good { color: #4ade80; }
.dark .ch-status.low  { color: #60a5fa; }
.dark .ch-sum-num.good,
.dark .ch-sum-pct     { color: #4ade80; }
.dark .ch-section-label { color: #fbbf24; }
.dark .pr-tool-badge  { color: #fbbf24; }
.dark .pr-scratch-clear { color: #f87171; }

/* ══════════════════════════════════════════════
   Kid Home (screen-subject-select) + kid theme
   Scoped to its own classes so nothing here can leak into the rest of the
   app's visual language - only the post-login landing page and the subject
   tiles opt in.
   ══════════════════════════════════════════════ */

.kid-hero {
  background: linear-gradient(135deg, var(--kid-accent-1, #6366f1), var(--kid-accent-2, #ec4899));
}

/* Subject-select keeps the soft pastel; dashboard uses the chalkboard theme. */
#screen-subject-select {
  background:
    radial-gradient(circle at 8% 5%, rgba(253,224,71,.28), transparent 22rem),
    radial-gradient(circle at 92% 12%, rgba(45,212,191,.22), transparent 24rem),
    linear-gradient(145deg, #effcf8 0%, #eef8ff 48%, #f8f1ff 100%);
  border-radius: 1.5rem;
}
.dark #screen-subject-select {
  background:
    radial-gradient(circle at 8% 5%, rgba(250,204,21,.15), transparent 22rem),
    radial-gradient(circle at 92% 12%, rgba(45,212,191,.14), transparent 24rem),
    linear-gradient(145deg, #12334b 0%, #173553 48%, #2b2450 100%);
}
#screen-dashboard {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 34px,
      rgba(240,236,220,.06) 34px,
      rgba(240,236,220,.06) 35px
    ),
    linear-gradient(145deg, #2e5230 0%, #1d3a1f 60%, #2a4a28 100%);
  border-radius: 1.5rem;
}
.dark #screen-dashboard {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 34px,
      rgba(240,236,220,.04) 34px,
      rgba(240,236,220,.04) 35px
    ),
    linear-gradient(145deg, #1a2e1b 0%, #0d1f0e 60%, #152517 100%);
}

@keyframes kidWiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-8deg); }
  75%      { transform: rotate(8deg); }
}
.kid-wiggle { animation: kidWiggle 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .kid-wiggle { animation: none; } }

.kid-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 16px 8px;
  border-radius: 20px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s ease;
}
.kid-tile:hover  { transform: translateY(-2px) scale(1.03); box-shadow: 0 10px 22px rgba(0,0,0,0.18); }
.kid-tile:active { transform: scale(0.94); }

.kid-subject-card:hover .kid-subject-icon { transform: scale(1.12) rotate(-4deg); }
.kid-subject-icon { transition: transform 0.2s cubic-bezier(.34,1.56,.64,1); }
.kid-subject-card:hover { transform: translateY(-3px); }

/* Reduced-motion preference from the kid settings page (My Settings) -
   distinct from the OS-level prefers-reduced-motion media query above:
   this is an explicit in-app choice, so it has to win even on a device whose
   OS setting says otherwise. */
.kid-calm .kid-wiggle,
.kid-calm .kid-tile,
.kid-calm .kid-subject-card,
.kid-calm .kid-subject-icon { animation: none !important; transition: none !important; }

/* Text size preference - applies only within kid-facing screens (the ones
   .kid-hero/.kid-tile already live on), never the parent/admin/teacher UI. */
.kid-text-lg #screen-subject-select,
.kid-text-lg #screen-dashboard { font-size: 1.08em; }

/* ══ Student Home Screen ════════════════════════════════════════════
   The chalkboard hub a student lands on after signing in.
   Same warm-paper outer wrapper as #screen-teacher, same chalk-tab
   navigation, same .ta-tab-content surfaces - the only new thing is
   the sticky-note grid painted on the board.
   ══════════════════════════════════════════════════════════════════ */
#screen-student-home {
  background: #f2ebe0;
  min-height: 100vh;
  padding: 0 0 4rem;
}
.dark #screen-student-home { background: #1a1208; }

/* ══ Parent Dashboard - chalkboard theme ════════════════════════
   Matches the student home aesthetic: dark charcoal + ruled lines,
   chalk-white text, translucent dark cards.
   All overrides are scoped to #screen-parent so nothing else is
   touched. Never add transform/filter here (fixed-child trap).
   ══════════════════════════════════════════════════════════════ */
#screen-parent {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 34px,
      rgba(180,180,180,.07) 34px,
      rgba(180,180,180,.07) 35px
    ),
    #1e1e1e;
  min-height: 100vh;
  padding: 1.25rem 1rem 5rem;
  color: #f0ece8;
}

/* ── Headings & text ── */
#screen-parent h2,
#screen-parent h3                   { color: #f0ece8; }
#screen-parent p                    { color: rgba(240,236,220,.75); }
#screen-parent .text-gray-800,
#screen-parent .text-gray-700,
#screen-parent .dark\:text-white    { color: #f0ece8 !important; }
#screen-parent .text-gray-600,
#screen-parent .text-gray-500,
#screen-parent .text-gray-400,
#screen-parent .dark\:text-gray-300,
#screen-parent .dark\:text-gray-400 { color: rgba(240,236,220,.6) !important; }
#screen-parent .text-indigo-500,
#screen-parent .dark\:text-indigo-400 { color: #a5b4fc !important; }
#screen-parent strong               { color: #f0ece8; }

/* ── Action tiles (pd-action) ── */
#screen-parent .pd-action {
  background: rgba(240,236,220,.07);
  border-color: rgba(240,236,220,.22);
  color: #f0ece8;
  font-size: .8rem;
}
#screen-parent .pd-action:hover {
  background: rgba(240,236,220,.14);
  border-color: rgba(240,236,220,.4);
  color: #fff;
}
#screen-parent .pd-action.is-primary {
  background: rgba(99,102,241,.35);
  border-color: rgba(99,102,241,.6);
  color: #fff;
}
#screen-parent .pd-action.is-primary:hover { background: rgba(99,102,241,.5); }
#screen-parent .pd-action.is-alert {
  border-color: rgba(239,68,68,.45);
  color: #fca5a5;
  background: rgba(239,68,68,.08);
}
#screen-parent .pd-action.is-alert:hover { background: rgba(239,68,68,.16); }

/* ── Switch-to-student bar ──
   Deliberately NOT repainted for the chalkboard, exactly like
   #screen-dashboard .student-parent-switch. The two mode switches are one
   control in two directions and a parent handing the device over should be
   looking at the same object the child taps to hand it back; a translucent
   version here made the parent-side bar read as a panel rather than the
   button it is. The solid gradient already clears 4.5:1 on both stops, and
   both dashboards are chalkboards, so the pair matches in both themes. */

/* ── Plan banner ── */
#screen-parent #pd-plan-banner,
#screen-parent .bg-white,
#screen-parent .dark\:bg-gray-800  {
  background: rgba(240,236,220,.07) !important;
  border-color: rgba(240,236,220,.16) !important;
  color: #f0ece8 !important;
}

/* ── Children grid cards ── */
#screen-parent .pd-child-card,
#pd-children-grid .pd-child-card {
  background: rgba(240,236,220,.07) !important;
  border-color: rgba(240,236,220,.18) !important;
  color: #f0ece8 !important;
}
#screen-parent .pd-child-card:hover {
  background: rgba(240,236,220,.13) !important;
  border-color: rgba(240,236,220,.35) !important;
}
#screen-parent .pd-child-today {
  background: rgba(240,236,220,.1);
  color: #f0ece8;
}
#screen-parent .pd-child-subjects,
#screen-parent .pd-child-next { color: rgba(240,236,220,.65); }
#screen-parent .pd-child-open { color: #a5b4fc; }

/* ── Weekly details / family overview ── */
#screen-parent .pd-weekly-details {
  background: rgba(240,236,220,.06);
  border-color: rgba(240,236,220,.18);
  color: #f0ece8;
}
#screen-parent .pd-weekly-details > summary { color: rgba(240,236,220,.8); }

/* ── Child detail panel tabs ── */
#screen-parent .pd-tabbar {
  background: rgba(240,236,220,.07) !important;
}
#screen-parent .pd-tab {
  color: rgba(240,236,220,.55);
  background: transparent;
}
#screen-parent .pd-tab[class*="bg-white"],
#screen-parent .pd-tab.bg-white {
  background: rgba(240,236,220,.16) !important;
  color: #f0ece8 !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
#screen-parent .pd-tab.dark\:bg-gray-700 { background: rgba(240,236,220,.16) !important; }

/* ── Error / empty state cards ── */
#screen-parent #pd-load-error {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.3);
}
#screen-parent #pd-load-error h3 { color: #fca5a5; }
#screen-parent #pd-load-error p  { color: rgba(252,165,165,.8); }

/* ── Back / utility buttons inside the panel ── */
#screen-parent .bg-gray-100,
#screen-parent .dark\:bg-gray-700 {
  background: rgba(240,236,220,.1) !important;
  color: #f0ece8 !important;
  border-color: rgba(240,236,220,.2);
}
#screen-parent .bg-gray-100:hover,
#screen-parent .dark\:bg-gray-700:hover {
  background: rgba(240,236,220,.18) !important;
}

/* ── Badge chip on shop button ── */
#screen-parent .pd-badge {
  background: #f59e0b;
  color: #1f1300;
}

/* ── Children heading ── */
#screen-parent #pd-children-heading { color: rgba(240,236,220,.75); font-family: 'Caveat', cursive; font-size: 1.15rem; }

/* ── Override the light-mode forced colours from the day-theme block ── */
html:not(.dark) #screen-parent .pd-action,
html:not(.dark) #screen-parent .pd-child-card { background: rgba(240,236,220,.08) !important; color: #f0ece8 !important; }
html:not(.dark) #screen-parent .pd-child-next  { color: rgba(240,236,220,.6) !important; }

/* ── Board frame sits flush under the tabs ── */
#screen-parent .sh-board-frame {
  border-radius: 0 6px 6px 6px;
  margin-top: 4px;
  border-top: none;
  min-height: 300px;
}
/* ── Tab row: tighter top margin since screen already has padding ── */
#screen-parent .teacher-navigation { margin-top: .5rem; }

/* ── Inline parent dashboard panels (calendar, shop, messages, settings) ── */
#pd-panel-calendar,
#pd-panel-shop,
#pd-panel-messages,
#pd-panel-settings { padding-top: .5rem; }

/* Remove the screen-level max-width caps; board frame handles layout */
#pd-panel-calendar .max-w-2xl,
#pd-panel-shop .max-w-3xl,
#pd-panel-messages .max-w-2xl,
#pd-panel-settings .max-w-2xl { max-width: 100%; }

/* Calendar back button is hidden inline (tab bar is the nav) */
#pd-panel-calendar .pd-cal-back { display: none; }

/* Headings & text inherit chalk palette */
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) h2,
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) h3 { color: #f0ece8; }
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) .text-gray-800,
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) .text-gray-700 { color: #f0ece8 !important; }
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) .text-gray-600,
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) .text-gray-500,
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) .text-gray-400 { color: rgba(240,236,220,.6) !important; }
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) .bg-gray-100,
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) .bg-white,
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) .dark\:bg-gray-700,
:is(#pd-panel-calendar, #pd-panel-shop, #pd-panel-messages, #pd-panel-settings) .dark\:bg-gray-800 { background: rgba(240,236,220,.1) !important; }

/* ── Child detail panel header: wrap on small phones so buttons don't overflow ── */
@media (max-width: 480px) {
  #pd-detail-panel > div:first-child { flex-wrap: wrap; }
}

/* ══ Parent-mode screens - chalkboard theme ════════════════════════
   All screens a parent navigates to from #screen-parent share the
   same dark charcoal + ruled-lines background and chalk text as the
   parent dashboard itself.  Overrides are scoped so student-only
   screens (practice, dashboard, games) are never touched.
   ══════════════════════════════════════════════════════════════ */
#screen-calendar,
#screen-shop,
#screen-analytics,
#screen-forum,
#screen-inbox,
#screen-profile,
#screen-parent-messages,
#screen-add-student,
#screen-schedule {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 34px,
      rgba(180,180,180,.07) 34px,
      rgba(180,180,180,.07) 35px
    ),
    #1e1e1e;
  min-height: 100vh;
  color: #f0ece8;
}

/* ── Headings & body text ── */
#screen-calendar h2, #screen-calendar h3,
#screen-shop h2, #screen-shop h3,
#screen-analytics h2, #screen-analytics h3,
#screen-forum h2, #screen-forum h3,
#screen-inbox h2, #screen-inbox h3,
#screen-profile h2, #screen-profile h3,
#screen-parent-messages h2, #screen-parent-messages h3,
#screen-add-student h2, #screen-add-student h3,
#screen-schedule h2, #screen-schedule h3 { color: #f0ece8; }

:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule) p { color: rgba(240,236,220,.72); }

:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule) label { color: rgba(240,236,220,.85); }

/* ── Common Tailwind text overrides ── */
:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  :is(.text-gray-800, .text-gray-700, .dark\:text-white) { color: #f0ece8 !important; }

:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  :is(.text-gray-600, .text-gray-500, .text-gray-400,
      .dark\:text-gray-300, .dark\:text-gray-400, .dark\:text-gray-500) { color: rgba(240,236,220,.58) !important; }

/* ── Cards / panels (bg-white, bg-gray-50, dark:bg-gray-800) ── */
:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  :is(.bg-white, .bg-gray-50, .dark\:bg-gray-800, .dark\:bg-gray-700\/50) {
    background: rgba(240,236,220,.07) !important;
    color: #f0ece8 !important;
  }

:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  :is(.bg-gray-100, .bg-gray-50, .dark\:bg-gray-700) {
    background: rgba(240,236,220,.10) !important;
    color: #f0ece8 !important;
  }

/* ── Borders ── */
:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  :is(.border-gray-200, .border-gray-300, .dark\:border-gray-700, .dark\:border-gray-600) {
    border-color: rgba(240,236,220,.18) !important;
  }

/* ── Inputs, textareas, selects ── */
:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  :is(input, textarea, select) {
    background: rgba(240,236,220,.08) !important;
    border-color: rgba(240,236,220,.25) !important;
    color: #f0ece8 !important;
  }

:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  :is(input::placeholder, textarea::placeholder) { color: rgba(240,236,220,.35) !important; }

/* ── Back / utility buttons (bg-gray-100 style) ── */
:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  :is(.bg-gray-100, .dark\:bg-gray-700):is(button, a) {
    background: rgba(240,236,220,.10) !important;
    color: #f0ece8 !important;
    border-color: rgba(240,236,220,.2) !important;
  }

/* ── Stat tiles (analytics) ── */
:is(#screen-analytics) .stat-tile {
  background: rgba(240,236,220,.07);
  border-color: rgba(240,236,220,.14);
}

/* ── Info banners (green/amber/blue) keep tint but on dark base ── */
:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  .bg-green-50   { background: rgba(34,197,94,.1) !important; }
:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  .bg-amber-50, .bg-yellow-50 { background: rgba(245,158,11,.1) !important; }
:is(#screen-calendar, #screen-shop, #screen-analytics, #screen-forum,
    #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  .bg-blue-50    { background: rgba(59,130,246,.1) !important; }

/* ── Schedule section dividers already chalk-styled via .sch-* ── */

/* ── Light-mode force: override the day-theme block for these screens ── */
html:not(.dark) :is(#screen-calendar, #screen-shop, #screen-analytics,
    #screen-forum, #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  :is(.bg-white, .bg-gray-50) { background: rgba(240,236,220,.07) !important; color: #f0ece8 !important; }

html:not(.dark) :is(#screen-calendar, #screen-shop, #screen-analytics,
    #screen-forum, #screen-inbox, #screen-profile, #screen-parent-messages,
    #screen-add-student, #screen-schedule)
  .stat-tile { background: rgba(240,236,220,.08) !important; }

/* ── Practice Hub ──────────────────────────────────────────────── */
/* ⚠ PAPER, not a board. The blackboard is .sh-board-frame INSIDE the page -
   the same shape as #screen-student-home, which is what makes the wooden
   frame read as a frame at all. When this screen was itself a green board,
   the framed panel sat board-on-board and the frame was invisible. */
#screen-practice-hub {
  background: #f2ebe0;
  min-height: 100vh;
  padding: 1.25rem 1.25rem 5rem;
}
.dark #screen-practice-hub { background: #1a1208; }
.prac-hub-outer { max-width: 700px; margin: 0 auto; }
/* ⚠ Used ONLY by #screen-exam-config now - the two hub screens dropped their
   in-screen crumbs (the app's own breadcrumb bar already draws the same trail).
   Exam config is still a green chalkboard, so this stays chalk. */
.prac-hub-crumb { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: rgba(240,236,220,.7); margin-bottom: 1rem; flex-wrap: wrap; }
.prac-hub-crumb button { background: none; border: none; color: rgba(240,236,220,.85); cursor: pointer; padding: 0; font-size: .78rem; text-decoration: underline; text-underline-offset: 2px; }
.prac-hub-crumb button:hover { color: #f0ece8; }
.prac-hub-crumb .crumb-sep { opacity: .5; }
.prac-hub-title { font-family: 'Caveat', cursive; font-size: 1.9rem; color: #f0ece8; margin-bottom: 1rem; text-shadow: 1px 1px 3px rgba(0,0,0,.4); }
.prac-hub-search-btn { background: rgba(42,77,40,.08); border: 1px solid rgba(42,77,40,.28); border-radius: 2rem; color: #2a4d28; font-size: .85rem; font-weight: 600; padding: .38rem 1rem; cursor: pointer; transition: background .18s, color .18s; align-self: flex-start; }
.prac-hub-search-btn:hover { background: rgba(42,77,40,.16); }
.dark .prac-hub-search-btn { background: rgba(240,236,220,.1); border-color: rgba(240,236,220,.26); color: rgba(240,236,220,.9); }
.dark .prac-hub-search-btn:hover { background: rgba(240,236,220,.2); color: #f0ece8; }
.prac-grade-bar { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; background: rgba(0,0,0,.22); border-radius: .75rem; padding: .6rem 1rem; border: 1px solid rgba(240,236,220,.18); }
.prac-grade-label { font-size: .85rem; color: rgba(240,236,220,.8); font-weight: 700; white-space: nowrap; font-family: 'Caveat', cursive; font-size: 1.05rem; }
.prac-grade-dropdown { background: rgba(240,236,220,.12); border: 1px solid rgba(240,236,220,.3); border-radius: .5rem; color: #f0ece8; font-size: .95rem; padding: .35rem .65rem; cursor: pointer; flex: 1; max-width: 180px; }
.prac-grade-dropdown:disabled { opacity: .65; cursor: default; }
.prac-grade-dropdown option, .prac-grade-dropdown optgroup { background: #2e5230; color: #f0ece8; }
/* ⚠ Shown whenever the child can reach FEWER grades than exist, not merely
   when the dropdown is disabled - a child allowed 2 of 6 grades has a working
   dropdown and no way to learn why the other four are missing. See
   PracticeHub._renderGradeBar(). */
.prac-grade-note { font-size: .78rem; color: rgba(240,236,220,.62); font-style: italic; margin: 0 0 1rem; padding: 0 .25rem; }
/* The green mat the blackboard hangs on. Same surface #screen-student-home
   gets from .ta-tab-content - repeated here rather than reused because that
   rule is shaped for folder tabs (square top-left corner, no top border) and
   this screen has none. ⚠ Never add transform/filter here: a .screen
   descendant with one becomes the containing block for every fixed child. */
.prac-board-mat {
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px, transparent 31px,
      rgba(255,255,255,.035) 31px, rgba(255,255,255,.035) 32px
    ),
    linear-gradient(158deg, #2e5230 0%, #1e3a22 25%, #264028 50%, #1c3420 75%, #203824 100%);
  border: 8px solid #5c3810;
  border-radius: 8px;
  padding: .9rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06);
}
.dark .prac-board-mat {
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px, transparent 31px,
      rgba(255,255,255,.025) 31px, rgba(255,255,255,.025) 32px
    ),
    linear-gradient(158deg, #111 0%, #0a0a0a 40%, #131313 70%, #0d0d0d 100%);
  border-color: #3a2008;
}
@media (max-width: 420px) { .prac-board-mat { padding: .5rem; border-width: 6px; } }

.prac-books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.1rem; }
@media (max-width: 480px) { .prac-books-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; } }
.ph-book {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: .5rem; padding: 1.7rem 1rem 1.3rem;
  background: linear-gradient(145deg, var(--bk-from, rgba(255,255,255,.14)), var(--bk-to, rgba(0,0,0,.15)));
  border: 1.5px solid var(--bk-border, rgba(255,255,255,.28));
  border-radius: 1.25rem;
  cursor: pointer; transition: transform .18s, box-shadow .18s;
  color: #f0ece8; text-align: center; min-height: 190px;
  box-shadow: 0 4px 18px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.09);
  position: relative; overflow: hidden;
}
.ph-book::before {
  content: ''; position: absolute; top: -28px; right: -28px;
  width: 88px; height: 88px; border-radius: 50%;
  background: rgba(var(--bk-glow, 255,255,255), .18);
  pointer-events: none;
}
.ph-book::after {
  content: ''; position: absolute; bottom: -20px; left: -20px;
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(var(--bk-glow, 255,255,255), .10);
  pointer-events: none;
}
.ph-book:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 16px 36px rgba(0,0,0,.42), 0 0 0 2px rgba(var(--bk-glow,255,255,255),.35);
}
.ph-book:active { transform: translateY(-1px) scale(1.01); }
.ph-book-icon {
  font-size: 3rem; line-height: 1; margin-bottom: .1rem;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.45));
}
.ph-book-name {
  font-family: 'Caveat', cursive; font-size: 1.2rem; font-weight: 700;
  line-height: 1.2; color: #f0ece8;
}
.ph-book-tag { font-size: .7rem; color: rgba(240,236,220,.6); line-height: 1.3; padding: 0 .25rem; }
.ph-book-count {
  font-size: .68rem; margin-top: .15rem;
  background: rgba(0,0,0,.3); border-radius: 999px;
  padding: .14rem .6rem; color: rgba(240,236,220,.8);
  border: 1px solid rgba(255,255,255,.12);
}

/* ── Subject Hub ──────────────────────────────────────────────── */
/* ⚠ Paper, for the same reason as #screen-practice-hub above: the chapter
   list already sits on a framed blackboard (.ta-tab-content, 8px #5c3810),
   and its folder tabs already paint #f2ebe0 when selected - this screen was
   the only part of that composition still painted green. */
#screen-subject-hub {
  background: #f2ebe0;
  min-height: 100vh;
  padding: 1.25rem 1.25rem 5rem;
}
.dark #screen-subject-hub { background: #1a1208; }
.subj-hub-outer { max-width: 860px; margin: 0 auto; }
/* Chapter cards inside Subject Hub */
.sh-chapter-list { display: flex; flex-direction: column; gap: .5rem; }
.sh-chapter-card { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; background: rgba(255,255,255,.08); border: 1px solid rgba(240,236,220,.18); border-radius: .75rem; cursor: pointer; color: #f0ece8; text-align: left; transition: background .15s; width: 100%; }
.sh-chapter-card:hover { background: rgba(255,255,255,.16); }
.sh-ch-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; }
.sh-ch-info { flex: 1; display: flex; flex-direction: column; gap: .15rem; font-size: .9rem; }
.sh-ch-pct { font-size: .72rem; opacity: .7; }
.sh-ch-arrow { opacity: .5; font-size: 1.1rem; flex-shrink: 0; }
.sh-chapter-enr { border-style: dashed; }
.sh-enr-badge { background: rgba(251,191,36,.22); color: #fbbf24; border-radius: 999px; padding: .1rem .45rem; font-size: .7rem; }
.sh-enr-divider { color: rgba(240,236,220,.5); font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; padding: .85rem 0 .3rem; border-top: 1px dashed rgba(240,236,220,.2); margin-top: .5rem; }
/* ── Exam option cards (paper-style) ──────────────────────────────────── */
.sh-exam-opts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.1rem; padding: .25rem 0;
}
.sh-exam-card {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  padding: 0 1rem 1.2rem; background: transparent; border: none;
  cursor: pointer; color: #f0ece8; text-align: center;
  transition: transform .18s; width: 100%;
}
.sh-exam-card:hover { transform: translateY(-5px); }
.sh-exam-card:hover .sh-paper { box-shadow: 0 16px 32px rgba(0,0,0,.55); }

/* The paper sheet graphic */
.sh-paper {
  position: relative; width: 100%; aspect-ratio: 3/4;
  background: linear-gradient(160deg, #faf7f0 0%, #ede8d8 100%);
  border-radius: .25rem .25rem .25rem .25rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.4), 2px 2px 0 rgba(0,0,0,.12);
  overflow: hidden; margin-bottom: .55rem;
  transition: box-shadow .18s;
}
/* Alternate paper colours */
.sh-paper-blue { background: linear-gradient(160deg, #e8f0fe 0%, #c7d9fb 100%); }
.sh-paper-dim  { background: linear-gradient(160deg, #ccc 0%, #aaa 100%); filter: grayscale(.4); }

/* Ruled lines on the paper */
.sh-paper-header {
  position: absolute; top: 0; left: 0; right: 0; height: 28%;
  border-bottom: 2px solid rgba(0,0,0,.12);
  background: linear-gradient(180deg, rgba(0,0,0,.06) 0%, transparent 100%);
  display: flex; align-items: flex-end; padding: 0 .5rem .35rem;
}
.sh-paper-lines {
  display: block; width: 100%;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px, transparent 6px,
    rgba(0,0,0,.1) 6px, rgba(0,0,0,.1) 7px
  );
  height: 14px;
  border-radius: 1px;
}
/* Body lines below the header */
.sh-paper::before {
  content: '';
  position: absolute; top: 34%; left: .5rem; right: .5rem; bottom: 20%;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px, transparent 9px,
    rgba(0,0,0,.1) 9px, rgba(0,0,0,.1) 10px
  );
}
/* Folded corner */
.sh-paper-corner {
  position: absolute; bottom: 0; right: 0; width: 22px; height: 22px;
  background: linear-gradient(225deg, rgba(0,0,0,.18) 50%, transparent 50%);
}
.sh-paper-corner::after {
  content: ''; position: absolute; bottom: 0; right: 0;
  width: 22px; height: 22px;
  background: linear-gradient(225deg, rgba(255,255,255,.55) 50%, transparent 50%);
}
/* Big emoji floating above the paper */
.sh-paper-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -44%);
  font-size: 2.4rem; line-height: 1;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.28));
}

/* Text below the paper */
.sh-exam-label {
  display: block; font-family: 'Caveat', cursive; font-size: 1.2rem;
  color: #f0ece8; font-weight: 700;
}
.sh-exam-meta { display: block; font-size: .72rem; color: rgba(240,236,220,.6); }
.sh-exam-tag {
  display: inline-block; margin-top: .15rem; font-size: .65rem; font-weight: 700;
  background: rgba(255,255,255,.12); border-radius: 999px;
  padding: .12rem .55rem; color: rgba(240,236,220,.8);
  border: 1px solid rgba(255,255,255,.15);
}
.sh-exam-tag-gold { background: rgba(251,191,36,.2); color: #fbbf24; border-color: rgba(251,191,36,.3); }
.sh-exam-tag-blue { background: rgba(96,165,250,.2); color: #93c5fd; border-color: rgba(96,165,250,.3); }

.sh-exam-card-soon { opacity: .45; cursor: not-allowed; }
.sh-exam-card-soon:hover { transform: none; }
.sh-exam-card-soon:hover .sh-paper { box-shadow: 0 6px 20px rgba(0,0,0,.4), 2px 2px 0 rgba(0,0,0,.12); }

.sh-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .5rem;
}
.sh-title {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 700;
  color: #2a4d28;
  line-height: 1.1;
  margin: 0;
}
.dark .sh-title { color: #86efac; }
.sh-subtitle {
  font-size: .95rem;
  color: #6b7280;
  margin: .3rem 0 0;
}
.dark .sh-subtitle { color: #86836a; }

/* Blackboard frame - the visible bordered board the notes sit on */
.sh-board-frame {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 34px,
      rgba(180,180,180,.10) 34px,
      rgba(180,180,180,.10) 35px
    ),
    #1e1e1e;
  border: 6px solid #5c3d1e;
  border-radius: .75rem;
  padding: .85rem;
  box-shadow:
    inset 0 2px 12px rgba(0,0,0,.45),
    0 6px 18px rgba(0,0,0,.5),
    0 2px 4px rgba(0,0,0,.3);
  margin-bottom: 0;
}

/* Area below the blackboard - outside the frame, on the page background */
.sh-below-board {
  padding: .85rem .1rem .4rem;
}

/* Goal card - below the blackboard, chalk-styled and compact */
#screen-student-home .goal-card { background: rgba(0,0,0,.22); border-color: rgba(240,236,220,.16); margin-top: 0; margin-bottom: .5rem; }
#screen-student-home .goal-card.is-done { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.32); }
#screen-student-home .goal-ring-bg { stroke: rgba(240,236,220,.15); }
#screen-student-home .goal-ring-txt { color: #f0ece8; }
#screen-student-home .goal-head { color: #f0ece8; }
#screen-student-home .goal-sub  { color: rgba(240,236,220,.65); }
#screen-student-home .goal-lv   { color: rgba(199,210,254,.9); }
#screen-student-home .goal-lv-bar { background: rgba(240,236,220,.12); }
#screen-student-home .goal-week { border-top-color: rgba(240,236,220,.12); }
#screen-student-home .goal-day  { background: rgba(240,236,220,.08); color: rgba(240,236,220,.55); }
#screen-student-home .goal-day.is-active { background: rgba(240,236,220,.18); color: #f0ece8; }
#screen-student-home .goal-day.is-met    { background: rgba(34,197,94,.28); color: #86efac; }
#screen-student-home .goal-week-note { color: rgba(240,236,220,.45); }

/* Mission + weak-area drill row */
.sh-mission-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .85rem; }
@media (max-width: 420px) { .sh-mission-row { grid-template-columns: 1fr; } }
.sh-mission-card {
  display: flex; align-items: flex-start; gap: .55rem;
  background: rgba(240,236,220,.08); border: 1px solid rgba(240,236,220,.2);
  border-radius: .75rem; padding: .65rem .8rem;
  cursor: pointer; text-align: left; transition: background .15s; position: relative;
}
.sh-mission-card:hover { background: rgba(240,236,220,.16); }
.sh-mission-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: .05rem; }
.sh-mission-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.sh-mission-title { font-family: 'Caveat', cursive; font-size: 1rem; font-weight: 700; color: #f0ece8; }
.sh-mission-sub { font-size: .73rem; color: rgba(240,236,220,.62); line-height: 1.35; }
.sh-mission-lock { font-size: .8rem; flex-shrink: 0; align-self: center; }
.sh-mission-arrow { font-size: 1.3rem; flex-shrink: 0; align-self: center; color: rgba(240,236,220,.5); }
.sh-mission-schedule { border-color: rgba(251,191,36,.3); }
.sh-mission-schedule:hover { border-color: rgba(251,191,36,.55); background: rgba(251,191,36,.08); }
/* Fix my mistakes - a repair job, not a warning. Green because finishing it
   is a win; red would make a list of the child own errors look like a telling-off. */
.sh-mission-fix { border-color: rgba(52,211,153,.34); }
.sh-mission-fix:hover { border-color: rgba(52,211,153,.6); background: rgba(52,211,153,.09); }

/* Schedule screen - section dividers */
.sch-section-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: .35rem .1rem; margin-bottom: .5rem; border-bottom: 1px solid;
}
.sch-section-backlog  { color: #f59e0b; border-color: rgba(245,158,11,.3); }
.sch-section-upcoming { color: #6b7280; border-color: rgba(107,114,128,.2); margin-top: 1rem; }
.sch-section-count    { font-size: .68rem; font-weight: 600; opacity: .75; }
.sch-backlog-day      { opacity: .88; }
.sch-overdue-tag {
  display: inline-block; font-size: .6rem; font-weight: 700; letter-spacing: .04em;
  background: rgba(239,68,68,.15); color: #f87171; border-radius: 4px;
  padding: 1px 5px; margin-left: .35rem; vertical-align: middle; text-transform: uppercase;
}

/* Badges below the board - the same collectible sticker as the dashboard grid
   (see "BADGE DISPLAY"), sized down for the chalk strip. Only earned badges
   reach this list, so there is no locked state here. */
.sh-badges-section { margin-top: .85rem; padding-top: .75rem; border-top: 1px solid rgba(240,236,220,.12); }
.sh-badges-header { font-family: 'Caveat', cursive; font-size: 1rem; font-weight: 700; color: rgba(240,236,220,.82); margin-bottom: .55rem; }
.sh-badges-strip { display: flex; flex-wrap: wrap; gap: .6rem .5rem; }
.sh-badge-item {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  min-width: 3.5rem; padding: 0;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.sh-badge-item:hover { transform: translateY(-3px); }
.sh-badge-icon {
  position: relative;
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem; flex: none;
  font-size: 1.25rem; line-height: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, var(--badge-a, #fff3c9) 0%, var(--badge-b, #f6c343) 72%);
  /* A cream rim rather than the dashboard's white: on the chalkboard a pure
     white ring glares against the dark green. */
  box-shadow: 0 0 0 2px rgba(255,251,238,.9), 0 3px 7px rgba(0,0,0,.38);
}
.sh-badge-icon::before {
  content: ''; position: absolute; left: 15%; top: 9%; width: 50%; height: 32%;
  border-radius: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,.85), rgba(255,255,255,0));
  pointer-events: none;
}
.sh-badge-item:nth-child(5n+1) .sh-badge-icon { --badge-a:#fff3c9; --badge-b:#f6c343; }
.sh-badge-item:nth-child(5n+2) .sh-badge-icon { --badge-a:#e2f3ff; --badge-b:#7cc4f5; }
.sh-badge-item:nth-child(5n+3) .sh-badge-icon { --badge-a:#ffe6ef; --badge-b:#f490b6; }
.sh-badge-item:nth-child(5n+4) .sh-badge-icon { --badge-a:#e6fbe8; --badge-b:#7bd68b; }
.sh-badge-item:nth-child(5n+5) .sh-badge-icon { --badge-a:#efe7ff; --badge-b:#b198f0; }
.sh-badge-name { font-size: .6rem; font-weight: 700; color: rgba(240,236,220,.88); text-align: center; line-height: 1.25; }
@media (prefers-reduced-motion: reduce) {
  .sh-badge-item, .sh-badge-item:hover { transition: none; transform: none; }
}

/* Resume card - chalk-themed "pick up where you left off" above the notes */
.sh-resume-card {
  background: rgba(240,236,220,.08);
  border: 1.5px dashed rgba(240,236,220,.35);
  border-radius: .8rem;
  padding: .65rem .9rem;
  margin-bottom: .85rem;
}
.sh-resume-header {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  font-weight: 700;
  color: rgba(240,236,220,.75);
  margin-bottom: .45rem;
}
.sh-resume-list { display: flex; flex-direction: column; gap: .35rem; }
.sh-resume-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: rgba(240,236,220,.08);
  border-radius: .5rem;
  padding: .45rem .6rem;
}
.sh-resume-item-icon { font-size: 1.15rem; flex-shrink: 0; }
.sh-resume-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sh-resume-item-label { font-family: 'Caveat', cursive; font-size: 1rem; font-weight: 700; color: #f0ece8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-resume-item-detail { font-size: .75rem; color: rgba(240,236,220,.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-resume-go {
  background: rgba(240,236,220,.18);
  border: 1px solid rgba(240,236,220,.3);
  color: #f0ece8;
  border-radius: .45rem;
  padding: .3rem .65rem;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.sh-resume-go:hover { background: rgba(240,236,220,.3); }
.sh-resume-dismiss {
  background: none;
  border: none;
  color: rgba(240,236,220,.38);
  font-size: .95rem;
  cursor: pointer;
  padding: .15rem .3rem;
  line-height: 1;
  transition: color .15s;
  flex-shrink: 0;
}
.sh-resume-dismiss:hover { color: rgba(240,236,220,.8); }

/* Bottom action bar - gear + bulb - below the blackboard frame */
.sh-board-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: .5rem;
}
.sh-board-action-btn {
  background: rgba(240,236,220,.1);
  border: 1px solid rgba(240,236,220,.22);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .18s, transform .15s;
  flex-shrink: 0;
}
.sh-board-action-btn:hover { background: rgba(240,236,220,.22); transform: scale(1.1); }
.sh-board-action-icon { font-size: 1.15rem; line-height: 1; }

/* Sticky notes grid ── auto-fill so it works from 280px to 1200px */
.sh-notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 1.5rem 1.25rem;
  padding: 1.75rem 0 1.25rem;
}

/* Base sticky note - the CSS custom property --sh-rot lets each :nth-child
   have its own tilt angle without extra classes. */
.sh-note {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.15rem 1rem 1rem;
  border-radius: 3px;
  text-align: left;
  cursor: pointer;
  border: none;
  transform: rotate(var(--sh-rot, -1.8deg));
  box-shadow: 3px 4px 14px rgba(0,0,0,.32), 1px 1px 0 rgba(0,0,0,.12);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease;
  min-height: 155px;
}
.sh-note:hover {
  transform: rotate(0deg) translateY(-6px) scale(1.05);
  box-shadow: 6px 12px 22px rgba(0,0,0,.38), 2px 2px 0 rgba(0,0,0,.12);
  z-index: 2;
}
.sh-note:active { transform: scale(.95); transition: transform .08s; }
/* Alternate tilt per slot */
.sh-note:nth-child(2) { --sh-rot:  1.8deg; }
.sh-note:nth-child(3) { --sh-rot: -0.6deg; }
.sh-note:nth-child(4) { --sh-rot:  1.2deg; }
.sh-note:nth-child(5) { --sh-rot:  2.1deg; }
.sh-note:nth-child(6) { --sh-rot: -1.1deg; }
.sh-note:nth-child(7) { --sh-rot:  0.7deg; }
.sh-note:nth-child(8) { --sh-rot: -2.1deg; }

/* Tape strip at the top */
.sh-note-tape {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  width: 56px;
  height: 21px;
  background: rgba(255,255,255,.58);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}

/* Colour variants */
.sh-note-yellow { background: #fef08a; }
.sh-note-blue   { background: #bfdbfe; }
.sh-note-green  { background: #bbf7d0; }
.sh-note-pink   { background: #fbcfe8; }
.dark .sh-note-yellow { background: #713f12; }
.dark .sh-note-blue   { background: #1e3a5f; }
.dark .sh-note-green  { background: #052e16; }
.dark .sh-note-pink   { background: #500724; }

/* Note content */
.sh-note-icon  { font-size: 2rem; margin-bottom: .45rem; line-height: 1; }
.sh-note-title {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a2e1b;
  margin-bottom: .3rem;
  line-height: 1.2;
}
.dark .sh-note-title { color: #f0ece0; }
.sh-note-desc {
  font-size: .73rem;
  color: rgba(26,46,27,.72);
  line-height: 1.45;
}
.dark .sh-note-desc { color: rgba(240,236,220,.65); }

/* Link-card rows inside Progress + Messages tabs */
.sh-link-cards { display: flex; flex-direction: column; gap: .75rem; }
.sh-link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1rem;
  background: rgba(0,0,0,.22);
  border: 1.5px solid rgba(240,236,220,.18);
  border-radius: .875rem;
  color: #f0ece0;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  width: 100%;
}
.sh-link-card:hover {
  background: rgba(0,0,0,.32);
  border-color: rgba(240,236,220,.35);
}
.sh-link-card strong { display: block; font-size: .95rem; margin-bottom: .15rem; }
.sh-link-card span   { font-size: .78rem; color: rgba(240,236,220,.65); }
.sh-link-ico   { font-size: 1.6rem; flex: 0 0 auto; }
.sh-link-arrow { font-size: 1.4rem; color: rgba(240,236,220,.5); margin-left: auto; flex: 0 0 auto; }

/* ══ Student Dashboard - Chalkboard Theme ══════════════════════════
   All rules scoped to #screen-dashboard so no other screen is touched.
   ══════════════════════════════════════════════════════════════════ */

/* ── Headings → Caveat chalk text ─────────────────────────────────── */
#screen-dashboard h2:not(.kid-hero h2),
#screen-dashboard h3 {
  color: #f0ece0;
  font-family: 'Caveat', cursive;
  font-size: 1.35rem;
  text-shadow: 0 0 8px rgba(240,236,220,.15);
}
#screen-dashboard .text-2xl { font-family: 'Caveat', cursive; }

/* ── Body text → chalk white ─────────────────────────────────────── */
#screen-dashboard .text-gray-800 { color: #f0ece0 !important; }
#screen-dashboard .text-gray-700 { color: rgba(240,236,220,.9) !important; }
#screen-dashboard .text-gray-500,
#screen-dashboard .text-gray-400 { color: rgba(240,236,220,.65) !important; }

/* ── Cards - translucent chalkboard panels ───────────────────────── */
#screen-dashboard .bg-white:not(button):not(a),
#screen-dashboard [class*="bg-gray-8"]:not(button):not(a) {
  background: rgba(0,0,0,.22) !important;
  box-shadow: none !important;
  border-color: rgba(240,236,220,.18) !important;
}

/* ── Track cards (Exam Paper / Chapter Practice) ─────────────────── */
#screen-dashboard .track-card {
  background: rgba(0,0,0,.25) !important;
  border-color: rgba(240,236,220,.2);
  color: #f0ece0;
}
#screen-dashboard .track-card h3 {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
}
#screen-dashboard .track-card p { color: rgba(240,236,220,.72) !important; }
#screen-dashboard #btn-exam-mode:hover    { border-color: #86efac; }
#screen-dashboard #btn-chapter-mode:hover { border-color: #fcd34d; }

/* ── Chips → chalk-outline style ─────────────────────────────────── */
#screen-dashboard .chip { border: 1px solid currentColor; }
#screen-dashboard .chip.blue   { background: rgba(96,165,250,.15);  color: #bfdbfe; }
#screen-dashboard .chip.purple { background: rgba(167,139,250,.15); color: #ddd6fe; }
#screen-dashboard .chip.green  { background: rgba(134,239,172,.15); color: #bbf7d0; }
#screen-dashboard .chip.amber  { background: rgba(252,211,77,.15);  color: #fde68a; }
#screen-dashboard .chip.gray   { background: rgba(240,236,220,.1);  color: rgba(240,236,220,.7); }

/* ── "Your first mission" banner ─────────────────────────────────── */
#dash-start-here {
  background: rgba(0,0,0,.28) !important;
  border: 1.5px solid rgba(240,236,220,.2) !important;
  box-shadow: none !important;
}
#dash-start-here #dash-mission-title {
  color: #f0ece0;
  font-family: 'Caveat', cursive;
}
#dash-start-here #dash-mission-copy { color: rgba(240,236,220,.8) !important; }
/* The "Start my 5-question mission" button → pencil yellow */
#dash-start-here button.bg-white {
  background: #e5bd3a !important;
  color: #1a3018 !important;
  box-shadow: 0 3px 0 #8a6a10;
}
#dash-start-here button.bg-white:hover { filter: brightness(1.08); }
/* "Choose a subject instead" link */
#dash-start-here .text-white\/95 { color: rgba(240,236,220,.85) !important; }

/* ── Wide action tiles (search, analytics, games, inbox) ─────────── */
#screen-dashboard #dash-analytics-tile,
#screen-dashboard #dash-inbox-tile,
#screen-dashboard button[onclick="Search.open()"] {
  background: rgba(0,0,0,.22) !important;
  border-color: rgba(240,236,220,.18) !important;
}
#screen-dashboard #dash-games-tile {
  background: rgba(0,0,0,.22) !important;
  border-color: rgba(252,211,77,.25) !important;
}
#screen-dashboard #dash-analytics-tile:hover            { border-color: rgba(96,165,250,.5)  !important; }
#screen-dashboard button[onclick="Search.open()"]:hover { border-color: rgba(167,139,250,.5) !important; }
#screen-dashboard #dash-games-tile:hover                { border-color: rgba(252,211,77,.55) !important; }
#screen-dashboard #dash-inbox-tile:hover                { border-color: rgba(167,139,250,.5) !important; }

/* Tile chevrons */
#screen-dashboard .text-indigo-400,
#screen-dashboard .text-blue-400  { color: rgba(240,236,220,.5) !important; }
#screen-dashboard .text-amber-400 { color: rgba(252,211,77,.6)  !important; }
#screen-dashboard .text-gray-300  { color: rgba(240,236,220,.4) !important; }

/* ── "My timetable →" / "+ Invite" pill chips ─────────────────── */
#screen-dashboard .bg-indigo-100,
#screen-dashboard .bg-indigo-900 {
  background: rgba(240,236,220,.15) !important;
  color: #f0ece0 !important;
}
#screen-dashboard .hover\:bg-indigo-200:hover,
#screen-dashboard .hover\:bg-indigo-800:hover {
  background: rgba(240,236,220,.25) !important;
}

/* ── Notification opt-in banner ──────────────────────────────────── */
#screen-dashboard #dash-notify-optin {
  background: rgba(0,0,0,.22) !important;
  border-color: rgba(240,236,220,.2) !important;
}
#screen-dashboard #dash-notify-optin .text-amber-800 { color: #f0ece0 !important; }
#screen-dashboard #dash-notify-optin .text-amber-700\/80 { color: rgba(240,236,220,.7) !important; }
#screen-dashboard #dash-notify-optin button.bg-amber-500 {
  background: #e5bd3a !important;
  color: #1a3018 !important;
}

/* ── Today's study plan section ──────────────────────────────────── */
#screen-dashboard #dash-today-title { color: #f0ece0 !important; font-family: 'Caveat', cursive; }
#screen-dashboard #dash-today-date  { color: rgba(240,236,220,.6) !important; }

/* ── "Switch to parent mode" bar stays indigo - it's the parent gate */
#screen-dashboard .student-parent-switch { /* unchanged */ }

/* ══════════ "My Colours" vibes (My Settings) ══════════
   Each vibe sets FOUR custom properties, not two:
     --kid-accent-1/2  the gradient pair (used by .kid-hero and the tiles)
     --kid-ink         a text/icon colour that passes contrast on a WHITE card
     --kid-ink-dark    the same role on a DARK card
   The two ink values are what makes a vibe theme-aware. Reusing --kid-accent-1
   for text was the obvious shortcut and it is exactly wrong at both ends:
   Mango's #f59e0b on white measures 2.15:1, and Midnight's #1e40af on the
   #111827 dark page measures 2.03:1 - both well under the 3:1 floor and both
   genuinely hard to read. Every vibe therefore states a darker ink for light
   mode and a lighter one for dark mode; the lowest of the 24 is 5.02:1, so a
   child can pick any colour without picking an unreadable one.

   ⚠ Keep this list in step with KID_VIBES in engine/app.js - the ids must match
   or the swatch in My Settings paints a colour the app then does not apply. */
:root {
  --kid-accent-1: #6366f1; --kid-accent-2: #ec4899;
  --kid-ink: #4f46e5;      --kid-ink-dark: #a5b4fc;
}
:root[data-kid-vibe="ocean"]     { --kid-accent-1:#0ea5e9; --kid-accent-2:#14b8a6; --kid-ink:#0369a1; --kid-ink-dark:#7dd3fc; }
:root[data-kid-vibe="sunset"]    { --kid-accent-1:#f97316; --kid-accent-2:#ec4899; --kid-ink:#c2410c; --kid-ink-dark:#fdba74; }
:root[data-kid-vibe="forest"]    { --kid-accent-1:#22c55e; --kid-accent-2:#0d9488; --kid-ink:#15803d; --kid-ink-dark:#86efac; }
:root[data-kid-vibe="galaxy"]    { --kid-accent-1:#7c3aed; --kid-accent-2:#4338ca; --kid-ink:#6d28d9; --kid-ink-dark:#c4b5fd; }
:root[data-kid-vibe="candy"]     { --kid-accent-1:#ec4899; --kid-accent-2:#f43f5e; --kid-ink:#be185d; --kid-ink-dark:#f9a8d4; }
:root[data-kid-vibe="mango"]     { --kid-accent-1:#f59e0b; --kid-accent-2:#ef4444; --kid-ink:#b45309; --kid-ink-dark:#fcd34d; }
:root[data-kid-vibe="mint"]      { --kid-accent-1:#10b981; --kid-accent-2:#22d3ee; --kid-ink:#0f766e; --kid-ink-dark:#5eead4; }
:root[data-kid-vibe="grape"]     { --kid-accent-1:#a855f7; --kid-accent-2:#6366f1; --kid-ink:#7e22ce; --kid-ink-dark:#d8b4fe; }
:root[data-kid-vibe="bubblegum"] { --kid-accent-1:#f472b6; --kid-accent-2:#a78bfa; --kid-ink:#be185d; --kid-ink-dark:#f5d0fe; }
:root[data-kid-vibe="lagoon"]    { --kid-accent-1:#0891b2; --kid-accent-2:#3b82f6; --kid-ink:#0e7490; --kid-ink-dark:#67e8f9; }
:root[data-kid-vibe="midnight"]  { --kid-accent-1:#1e40af; --kid-accent-2:#312e81; --kid-ink:#1e40af; --kid-ink-dark:#93c5fd; }

/* The one place the theme choice is made. Everything tinted by a vibe reads
   var(--kid-ink-now) and never touches the two raw ink values. */
:root      { --kid-ink-now: var(--kid-ink); }
.dark      { --kid-ink-now: var(--kid-ink-dark); }

/* Where a vibe actually shows up, beyond the hero gradient it started as.
   Deliberately kid-facing surfaces only - no parent, teacher or admin screen
   reads any of these, so a child's colour choice can never restyle an adult's
   dashboard. */
.kid-accent-text { color: var(--kid-ink-now); }
.kid-accent-bg   { background: linear-gradient(135deg, var(--kid-accent-1), var(--kid-accent-2)); }
.kid-accent-ring { box-shadow: 0 0 0 2px var(--kid-ink-now); }
#student-bottom-nav .tabbar-btn.nav-active,
#student-bottom-nav .tabbar-btn.nav-active span { color: var(--kid-ink-now); }
#student-bottom-nav .tabbar-btn.nav-active svg  { stroke: var(--kid-ink-now); }
.hint-pulse::before { border-color: var(--kid-ink-now); }
/* ⚠ Deliberately NOT .kid-tile. Those three tiles carry their own Tailwind
   gradients (fuchsia / sky / emerald) and they are how a child tells Surprise
   Me from Search from My Settings at a glance. Repainting all three in the
   chosen vibe would make them one indistinguishable colour. */
.dark .ch-star        { color: #64748b; }

/* ── Plan-gated controls ──────────────────────────────────────────────────
   Locked, not hidden. A child who cannot see a feature does not know it
   exists and cannot ask a parent for it; a padlocked one explains itself and
   is the only thing that makes the upgrade prompt reachable. Deliberately no
   `display:none` anywhere in here.
   The badge is a ::after so it needs no markup change at any call site, and
   sits on position:relative already-positioned buttons. */
.plan-locked {
  position: relative;
  opacity: 0.55;
  filter: grayscale(0.7);
}
.plan-locked::after {
  content: "🔒";
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  font-size: 0.75rem;
  line-height: 1;
  pointer-events: none;
}
/* The radio itself stays disabled; the label must still take the tap so the
   click handler can explain why rather than swallowing it silently. */
label.exam-opt.plan-locked { cursor: not-allowed; }

/* ── Promotional pricing ──────────────────────────────────────────────────
   A struck-out number on its own reads as an error as often as a discount.
   Three things together make it unambiguous: the old price is smaller and
   muted (it is not the thing being offered), the strike is drawn thicker than
   the browser default so it survives a bold weight, and a saving badge states
   the discount in words rather than leaving the reader to do the subtraction. */
.price-was {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.6;
  color: rgb(165 180 252 / 0.55);          /* indigo-300 @ 55% */
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  /* Safari < 12.1 ignores text-decoration-thickness and just draws a hairline;
     the strike is still visible, so this degrades rather than disappearing. */
}
.price-save {
  display: inline-block;
  margin-bottom: 0.3rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #052e16;                           /* green-950, on a light chip */
  background: #4ade80;                      /* green-400 */
  white-space: nowrap;
}
.price-save.hidden, .price-was.hidden { display: none; }

/* The plans modal sits on a light card, so the muted-on-dark tone above would
   vanish there. Scoped override rather than a second class at every call site. */
#modal-plans .price-was { color: rgb(107 114 128 / 0.75); font-size: 1rem; }

/* ── "How it works" info screen ───────────────────────────────────────────
   Mock-ups are built from real markup rather than screenshots: a screenshot
   goes stale the moment a button moves, cannot be read by a screen reader,
   and cannot be translated. These stay honest by construction. */
.info-chip {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgb(199 210 254 / 0.9);
  background: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.1);
  transition: background 0.15s, color 0.15s;
}
.info-chip:hover { background: rgb(255 255 255 / 0.13); color: #fff; }

.info-section {
  display: grid;
  gap: 2rem;
  align-items: center;
  padding: 2.5rem 0;
  border-top: 1px solid rgb(255 255 255 / 0.08);
  scroll-margin-top: 4.5rem;               /* the nav is sticky */
}
@media (min-width: 900px) {
  .info-section { grid-template-columns: 1fr 1fr; gap: 3rem; }
  /* Alternate which side the picture sits on, so eight stacked sections do
     not read as one long column. On mobile the copy always comes first. */
  .info-flip .info-copy { order: 2; }
  .info-flip .info-shot { order: 1; }
}
.info-kicker { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(165 180 252 / 0.75); margin-bottom: 0.5rem; }
.info-copy h2 { font-size: 1.5rem; font-weight: 900; line-height: 1.2; margin-bottom: 0.75rem; }
.info-copy p  { font-size: 0.9rem; line-height: 1.65; color: rgb(199 210 254 / 0.75); margin-bottom: 1rem; }
.info-list { display: grid; gap: 0.6rem; font-size: 0.875rem; line-height: 1.55; color: rgb(199 210 254 / 0.8); }
.info-list li { padding-left: 1.1rem; position: relative; }
.info-list li::before { content: "▸"; position: absolute; left: 0; color: rgb(129 140 248 / 0.8); }
.info-list b { color: #fff; font-weight: 700; }

/* ── The mock-up "device" ── */
.mock {
  border-radius: 1.1rem;
  overflow: hidden;
  background: #f8fafc;
  color: #1e293b;
  box-shadow: 0 18px 40px -12px rgb(0 0 0 / 0.55);
  border: 1px solid rgb(255 255 255 / 0.12);
  max-width: 24rem;
  margin: 0 auto;
  font-size: 0.78rem;
}
.mock-bar { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.6rem 0.85rem; background: #4f46e5; color: #fff; font-weight: 700; }
.mock-bar-warn { background: #b45309; }
.mock-dim  { opacity: 0.75; font-weight: 600; font-size: 0.7rem; }
.mock-tiny { font-size: 0.68rem; color: #64748b; }
.mock-body { padding: 0.85rem; display: grid; gap: 0.45rem; }
.mock-q    { font-weight: 700; line-height: 1.45; margin-bottom: 0.15rem; }
.mock-opt  { border: 1px solid #e2e8f0; border-radius: 0.6rem; padding: 0.45rem 0.6rem; background: #fff; }
.mock-opt-on { border-color: #22c55e; background: #f0fdf4; color: #15803d; font-weight: 700; }
.mock-hint { background: #fffbeb; border: 1px solid #fde68a; color: #b45309; border-radius: 0.6rem; padding: 0.45rem 0.6rem; }
.mock-note { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; border-radius: 0.6rem; padding: 0.45rem 0.6rem; }
.mock-row  { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.15rem; }
.mock-btn  { flex: 1; background: #4f46e5; color: #fff; font-weight: 700; border-radius: 0.6rem; padding: 0.45rem 0.6rem; text-align: center; }
.mock-btn-ghost { border: 1px solid #cbd5e1; color: #475569; font-weight: 600; border-radius: 0.6rem; padding: 0.45rem 0.6rem; }
.mock-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.25rem; margin-bottom: 0.3rem; }
.mg { text-align: center; padding: 0.2rem 0; border-radius: 0.35rem; background: #e2e8f0; color: #64748b; font-size: 0.7rem; font-weight: 700; }
.mg-done { background: #dcfce7; color: #15803d; }
.mg-flag { background: #fee2e2; color: #b91c1c; }
.mg-now  { background: #4f46e5; color: #fff; }
.mock-paper { border-left: 3px solid #cbd5e1; padding: 0.3rem 0 0.3rem 0.55rem; line-height: 1.45; }
.mock-marks { color: #64748b; font-size: 0.68rem; }
.mock-dimmed { opacity: 0.45; }
.mock-chapter { font-weight: 800; display: flex; justify-content: space-between; margin-top: 0.3rem; }
.mock-sub { display: flex; justify-content: space-between; padding: 0.3rem 0 0.3rem 0.8rem; border-left: 2px solid #e2e8f0; }
.mock-stat { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: 0.5rem; align-items: center; }
.bar { background: #e2e8f0; border-radius: 9999px; height: 0.42rem; overflow: hidden; }
.bar i { display: block; height: 100%; background: #22c55e; border-radius: 9999px; }
.bar-warn i { background: #f59e0b; }
.mock-kid { display: flex; gap: 0.55rem; align-items: center; padding-bottom: 0.4rem; border-bottom: 1px solid #e2e8f0; }
.mock-av { font-size: 1.6rem; }
.mock-tabs { display: flex; gap: 0.25rem; margin: 0.25rem 0; }
.mock-tab, .mock-tab-on { flex: 1; text-align: center; padding: 0.28rem 0; border-radius: 0.45rem; font-size: 0.68rem; font-weight: 700; background: #e2e8f0; color: #64748b; }
.mock-tab-on { background: #4f46e5; color: #fff; }
.mock-toggle { display: flex; justify-content: space-between; align-items: center; padding: 0.3rem 0; }
.tg { width: 1.9rem; height: 1.05rem; border-radius: 9999px; background: #cbd5e1; position: relative; flex-shrink: 0; }
.tg::after { content: ""; position: absolute; top: 0.15rem; left: 0.15rem; width: 0.75rem; height: 0.75rem; border-radius: 9999px; background: #fff; transition: transform 0.15s; }
.tg-on { background: #22c55e; }
.tg-on::after { transform: translateX(0.85rem); }
.mock-field { display: grid; gap: 0.1rem; border: 1px solid #e2e8f0; border-radius: 0.6rem; padding: 0.35rem 0.6rem; background: #fff; }

/* The mock-ups are decorative detail, not information the page depends on -
   a reader who prefers reduced motion or a very small screen still gets the
   full explanation from the copy beside them. */
@media (max-width: 380px) { .mock { font-size: 0.72rem; } }

/* Extra mock-up pieces used by the parent/child deep-dive sections. */
.info-aside {
  margin-top: 0.9rem;
  padding: 0.6rem 0.8rem;
  border-left: 2px solid rgb(129 140 248 / 0.5);
  background: rgb(255 255 255 / 0.04);
  border-radius: 0 0.5rem 0.5rem 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: rgb(199 210 254 / 0.7);
}
.mock-sep { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; margin-top: 0.35rem; }
.mock-task { background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; border-radius: 0.6rem; padding: 0.5rem 0.6rem; line-height: 1.45; }
.mock-badges { display: flex; align-items: center; gap: 0.35rem; font-size: 1.05rem; padding-top: 0.2rem; }

/* ── "Who is who" role comparison ─────────────────────────────────────────
   Three cards plus a table. The table scrolls inside its own wrapper rather
   than widening the page: four columns cannot honestly fit a 360px screen,
   and a page that scrolls sideways as a whole is worse than one panel that
   does. The cards carry the same information above it, so a reader who never
   scrolls the table has still been told everything. */
.role-card {
  border-radius: 1rem;
  overflow: hidden;
  background: rgb(255 255 255 / 0.05);
  border: 1px solid rgb(255 255 255 / 0.1);
  display: flex;
  flex-direction: column;
}
.role-head { display: flex; align-items: center; gap: 0.55rem; padding: 0.75rem 1rem; font-size: 0.95rem; }
.role-ico  { font-size: 1.35rem; line-height: 1; }
.role-parent  { background: rgb(79 70 229 / 0.35); }
.role-kid     { background: rgb(22 163 74 / 0.32); }
.role-teacher { background: rgb(217 119 6 / 0.32); }
.role-body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.role-line { font-size: 0.82rem; line-height: 1.5; color: rgb(199 210 254 / 0.85); }
.role-line b, .role-list b { color: #fff; }
.role-list { display: grid; gap: 0.45rem; font-size: 0.8rem; line-height: 1.5; color: rgb(199 210 254 / 0.75); }
.role-list li { padding-left: 1rem; position: relative; }
.role-list li::before { content: "•"; position: absolute; left: 0.15rem; color: rgb(129 140 248 / 0.8); }
.role-foot { margin-top: auto; padding-top: 0.6rem; border-top: 1px solid rgb(255 255 255 / 0.08); font-size: 0.72rem; color: rgb(165 180 252 / 0.6); line-height: 1.45; }

.role-table-wrap { margin-top: 1.5rem; overflow-x: auto; border-radius: 0.9rem; border: 1px solid rgb(255 255 255 / 0.1); }
.role-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; min-width: 34rem; }
.role-table th, .role-table td { padding: 0.55rem 0.75rem; text-align: left; vertical-align: top; }
.role-table thead th { background: rgb(255 255 255 / 0.07); font-weight: 800; white-space: nowrap; }
.role-table tbody tr { border-top: 1px solid rgb(255 255 255 / 0.07); }
.role-table tbody td:first-child { color: rgb(165 180 252 / 0.8); font-weight: 600; white-space: nowrap; }
.role-table tbody td { color: rgb(199 210 254 / 0.78); }
.role-table tbody td b { color: #fff; }

.role-note {
  border-radius: 0.8rem;
  padding: 0.85rem 1rem;
  background: rgb(255 255 255 / 0.04);
  border: 1px solid rgb(255 255 255 / 0.09);
  font-size: 0.8rem;
  line-height: 1.6;
  color: rgb(199 210 254 / 0.75);
}
.role-note b { color: #fff; }

/* ── Parent dashboard tab bar ─────────────────────────────
   Was `flex gap-1` with five flex-1 tabs. At 360px that is ~67px per tab and
   "Assignments" needs more, so the labels spilled out of their buttons - the
   same failure the bottom bar had before .tabbar-btn (see CLAUDE.md).
   `flex: 1 0 auto` is the fix: grow to fill the row when there is space, never
   shrink below the label, scroll when there is not. Scrollbar hidden because on
   a phone the row is swiped, and a visible bar under five tabs reads as broken. */
.pd-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  /* Backstop only. With wrap + flex-shrink:0 below, a tab that does not fit
     moves to the next row rather than overflowing, so this should never engage
     - but a very long label at 320px would scroll rather than break the page. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pd-tabbar::-webkit-scrollbar { display: none; }
/* flex-shrink MUST stay 0. Five flex-1 tabs at 360px give each ~64px while
   "Assignments" needs ~130px, and the label spills out of the button on both
   sides - the exact failure .nav-btn had in the bottom bar (see CLAUDE.md).
   Wrapping costs one extra row on a phone; hiding tabs off the end of a
   scroller cost a parent ever finding the Reports tab, which is worse. */
.pd-tabbar .pd-tab {
  flex: 1 0 auto;
  white-space: nowrap;
}

/* ── Reports: 30-day activity strip ───────────────────────
   Bars are sized in JS (height is data). Everything static lives here so the
   inline style attribute carries only the two values that actually vary. */
.rep-strip { display: flex; align-items: flex-end; gap: 2px; height: 64px; }
.rep-day   { flex: 1 1 0; min-width: 0; border-radius: 2px 2px 0 0; position: relative; }
.rep-day[data-empty="1"] { background: #e2e8f0; height: 2px !important; }
:root.dark .rep-day[data-empty="1"] { background: #374151; }

/* Sparklines and the exam trend are inline SVG with a viewBox and no fixed
   width, so they scale to whatever the card gives them at any device width. */
.rep-svg { width: 100%; height: auto; display: block; overflow: visible; }
.rep-key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; vertical-align: middle; }

/* ── Family overview table ────────────────────────────────
   A row is a grid, not a flex line: the columns have to line up between rows
   AND with the header, and a flex row with truncating names does not do that.
   The name column is the only 1fr - everything else is content-sized, so a long
   name shrinks and the numbers stay in their columns.
   `min-width:0` on the row is what actually lets the name truncate; without it
   a grid item refuses to shrink below its content and the row overflows. */
.fam-head, .fam-row {
  display: grid;
  /* EXPLICIT widths, not auto. The header and the rows are separate grids, so
     auto columns size to each grid's OWN content - "Streak" is wider than
     "12🔥", "Acc" narrower than "72%" - and the two can never line up. Measured
     misaligned at all ten widths before this. The strip column is 14 cells of
     3px plus 13 gaps of 1px = 55px, hence 3.5rem. */
  grid-template-columns: 1.75rem minmax(0, 1fr) 3.5rem 3.25rem 3rem 2.75rem 2.5rem 1.5rem;
  align-items: center;
  gap: .5rem;
  width: 100%;
  min-width: 0;
  text-align: left;
}
.fam-head {
  padding: 0 .25rem .375rem;
  color: #9ca3af;
  font-weight: 600;
}
.fam-row {
  padding: .5rem .25rem;
  background: none;
  border: 0;
  cursor: pointer;
  border-radius: .5rem;
  transition: background-color .15s;
}
.fam-row:hover  { background: rgba(99, 102, 241, .06); }
.fam-row:active { transform: scale(.995); }
:root.dark .fam-row:hover { background: rgba(99, 102, 241, .12); }
.fam-name { min-width: 0; }
.fam-num  { font-size: .75rem; text-align: right; white-space: nowrap; }
.fam-unit { font-size: .625rem; opacity: .55; margin-left: .0625rem; }

/* 14 one-day cells. Fixed 3px cells rather than flex: the strip must stay the
   same width on every row or the columns after it stop lining up. */
.fam-strip { display: inline-flex; gap: 1px; align-items: center; }
.fam-cell  { width: 3px; height: 14px; border-radius: 1px; background: #cbd5e1; }
.fam-cell[data-empty="1"] { background: #e5e7eb; height: 4px; }
:root.dark .fam-cell[data-empty="1"] { background: #374151; }

/* Below 560px the strip and the two least-load-bearing columns come off: eight
   columns cannot fit a phone, and squeezing them was what broke the tab bar and
   the bottom bar before it. Questions / accuracy / days survive, because those
   are what the row is for. Streak and the trend arrow are in the child's own
   report a tap away. */
@media (max-width: 559px) {
  .fam-head, .fam-row {
    grid-template-columns: 1.75rem minmax(0, 1fr) 3.25rem 3rem 2.75rem;
    gap: .375rem;
  }
  /* !important so this still wins if an inline display is ever put back on the
     header cell - that is exactly how this rule silently stopped working and
     left the header one column wider than every row beneath it. */
  .fam-head > .fam-strip, .fam-row > .fam-strip { display: none !important; }
  .fam-head > .fam-num:nth-last-child(-n+2),
  .fam-row  > .fam-num:nth-last-child(-n+2) { display: none; }
}

/* ── Calendar: layer filters ──────────────────────────────
   Four toggles above the month grid. Wraps rather than scrolls - there are only
   ever four, and at 320px they land as 2x2, which is fine; a scroller would hide
   one behind an edge with no affordance. */
.cal-filters { display: flex; flex-wrap: wrap; gap: .375rem; }
.cal-chip {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .375rem .625rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
}
:root.dark .cal-chip { background: #1f2937; border-color: #374151; color: #6b7280; }
/* OFF is the styled state, not ON. A parent's default is everything visible, so
   the chips must not all read as "selected buttons" on first sight - the muted
   one is the one hiding something. */
.cal-chip.is-on { color: #1f2937; border-color: #cbd5e1; }
:root.dark .cal-chip.is-on { color: #f3f4f6; border-color: #4b5563; }
.cal-chip:not(.is-on) { opacity: .55; }
.cal-chip:not(.is-on) .cal-chip-dot { background: transparent !important; box-shadow: inset 0 0 0 1.5px currentColor; }
.cal-chip-dot { width: .5rem; height: .5rem; border-radius: 999px; flex: 0 0 auto; }

/* ── Calendar: day dots ───────────────────────────────────
   Solid = it happened. Hollow = it is planned. There is no room for a legend on
   a 52px square, and "was this actually done" is the question the month view is
   being scanned for. */
.cal-dot {
  width: .375rem;
  height: .375rem;
  border-radius: 999px;
  flex: 0 0 auto;
}
.cal-dot.is-plan {
  background: transparent !important;
  box-shadow: inset 0 0 0 1.5px currentColor;
  color: #94a3b8;
}
/* The plan dot borrows the type colour through currentColor, so the ring is
   tinted rather than uniformly grey. Set after the reset above, or the grey
   fallback would win. */
.cal-dot.is-plan.bg-indigo-500 { color: #6366f1; }
.cal-dot.is-plan.bg-red-500    { color: #ef4444; }
.cal-dot.is-plan.bg-green-500  { color: #22c55e; }
.cal-dot.is-plan.bg-gray-400   { color: #9ca3af; }
.cal-dot.is-plan.bg-yellow-500 { color: #eab308; }
.cal-dot-more {
  font-size: 9px;
  line-height: 1;
  font-weight: 700;
  color: #94a3b8;
  align-self: center;
}

/* ── <select> dropdown legibility ─────────────────────────────────────────
   ⚠ An <option> is painted by the PLATFORM, not by the page. It inherits the
   select's `color` but never its `background`: measured, every option in this
   app computes to `rgba(0, 0, 0, 0)` on all four combinations of the two
   child-creation screens x light/dark. So the popup list is drawn on whatever
   ground the platform picks, in whatever colour the control inherited - and
   `text-white` on the family-setup grade picker made the entire grade list
   white-on-white and literally unreadable. The 29 other `dark:text-white`
   selects in index.html have the same defect the moment the popup is light.

   Two halves, both needed. The explicit OPTION pair is the deterministic one:
   it does not depend on what the platform decides to paint behind the text.
   `color-scheme` is what makes the popup CHROME (its ground, border and
   scrollbar) match, and it is scoped to `select` on purpose - on :root it
   would repaint every native control in the app, which is not what was asked
   for and not what was measured. The closed control keeps whatever the markup
   gives it either way: this touches the dropdown only. */
select { color-scheme: light; }
html.dark select { color-scheme: dark; }

select option,
select optgroup {
  background-color: #ffffff;
  color: #111827;
}
html.dark select option,
html.dark select optgroup {
  background-color: #1f2937;
  color: #f9fafb;
}
.qm-heading { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1rem; color:#1e293b; }
.qm-heading h2 { font-size:1.4rem; font-weight:800; }
.qm-heading p, .qm-filter-panel > p { font-size:.85rem; color:#475569; margin:.4rem 0 .8rem; }
.qm-filter-panel, .qm-question-card { border:1px solid #cbd5e1; background:#f8fafc; color:#1e293b; padding:1rem; border-radius:1rem; margin-bottom:1rem; }
.qm-filter-panel h3, .qm-question-card h3 { font-weight:700; margin-bottom:.5rem; }
.qm-filter-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.8rem; }
.qm-filter-panel label { font-size:.8rem; font-weight:600; }
.qm-filter-grid select, .qm-search-row input { display:block; width:100%; min-width:0; padding:.65rem; margin-top:.3rem; border:1px solid #94a3b8; border-radius:.6rem; background:#fff; color:#1e293b; }
.qm-filter-grid select:disabled { opacity:.6; }
.qm-extra-filters { display:flex; flex-wrap:wrap; gap:.8rem; margin:1rem 0 .5rem; }
.qm-extra-filters label { display:flex; align-items:center; gap:.4rem; }
.qm-filter-panel > p.qm-filter-hint { margin:.6rem 0 0; font-size:.82rem; font-weight:700; color:#92400e; }
.dark .qm-filter-panel > p.qm-filter-hint { color:#fcd34d; }
.qm-search-row { display:flex; gap:.6rem; align-items:center; }
.qm-question-meta { display:flex; flex-wrap:wrap; gap:.4rem; font-size:.75rem; margin-bottom:.7rem; }
.qm-question-meta span { background:#e0e7ff; color:#3730a3; border-radius:.5rem; padding:.25rem .5rem; }
.qm-question-preview { white-space:pre-wrap; overflow-wrap:anywhere; font-size:.95rem; line-height:1.65; margin:.5rem 0 1rem; }
.qm-question-footer { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:flex-start; gap:.75rem; border-top:1px solid #cbd5e1; padding-top:.75rem; }
.qm-question-id { font-size:.7rem; color:#475569; overflow-wrap:anywhere; }
.qm-question-actions { display:flex; flex-wrap:wrap; gap:.75rem; align-items:flex-start; }
.qm-edit-button { background:#4338ca; color:white; padding:.65rem .9rem; border-radius:.6rem; font-size:.8rem; font-weight:700; flex-shrink:0; }
.qm-question-actions summary { cursor:pointer; padding:.65rem; font-size:.8rem; }
.qm-secondary-actions { max-width:18rem; font-size:.8rem; }
.qm-secondary-actions button { display:block; padding:.65rem; border:1px solid #94a3b8; border-radius:.5rem; margin-top:.5rem; }
.qm-delete-button { color:#b91c1c; }
.dark .qm-heading { color:#f1f5f9; }
.dark .qm-filter-panel, .dark .qm-question-card { background:#273449; color:#f1f5f9; border-color:#52647e; }
.dark .qm-heading p, .dark .qm-filter-panel > p, .dark .qm-question-id { color:#cbd5e1; }
.dark .qm-filter-grid select, .dark .qm-search-row input { background:#1e293b; color:#f1f5f9; border-color:#64748b; }
.dark .qm-question-meta span { background:#37306b; color:#e0e7ff; }
.dark .qm-delete-button { color:#fca5a5; }
@media (min-width:900px) { .qm-filter-grid { grid-template-columns:repeat(4,minmax(0,1fr)); } }
@media (max-width:420px) { .qm-filter-grid { grid-template-columns:minmax(0,1fr); } }

/* ── Admin › Syllabus preview (read-only) ──────────────────────────────────
   ⚠ Real CSS, not Tailwind: this markup is injected by innerHTML, and the
   Play CDN only generates rules for classes present at its initial scan, so a
   Tailwind class added later gets the class and no rule. Colours follow the
   .qm-* pair above rather than using opacity, which would have dropped the
   meta lines below 4.5:1 on one theme or the other. */
.asyl-controls { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.8rem; }
.asyl-controls label { font-size:.8rem; font-weight:600; }
.asyl-head { margin:.25rem 0 1rem; color:#1e293b; }
.asyl-head h3 { font-size:1.1rem; font-weight:800; }
.asyl-head p { font-size:.85rem; color:#475569; margin:.3rem 0 0; }
.asyl-head .asyl-src { font-size:.72rem; color:#475569; overflow-wrap:anywhere; }
.asyl-ch { border:1px solid #cbd5e1; background:#f8fafc; color:#1e293b; border-radius:.9rem; padding:.85rem 1rem; margin-bottom:.6rem; }
.asyl-ch-head { display:flex; align-items:center; gap:.5rem; }
.asyl-ch-icon { font-size:1.15rem; line-height:1; }
.asyl-ch-name { font-weight:700; font-size:.95rem; }
.asyl-ch-meta { font-size:.72rem; color:#475569; margin:.25rem 0 .5rem; overflow-wrap:anywhere; }
.asyl-ch-prose { font-size:.86rem; line-height:1.6; white-space:pre-wrap; overflow-wrap:anywhere; }
.asyl-empty { color:#475569; font-style:italic; }
.asyl-note { font-size:.85rem; color:#475569; padding:.75rem 0; }
.dark .asyl-head, .dark .asyl-ch { color:#f1f5f9; }
.dark .asyl-ch { background:#273449; border-color:#52647e; }
.dark .asyl-head p, .dark .asyl-ch-meta, .dark .asyl-note { color:#cbd5e1; }
.dark .asyl-head .asyl-src, .dark .asyl-empty { color:#a8b6c8; }
@media (max-width:420px) { .asyl-controls { grid-template-columns:minmax(0,1fr); } }
.coach-card { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:1rem; padding:1.25rem; margin:1rem 0; border:1px solid #a5b4fc; border-radius:1.25rem; background:linear-gradient(120deg,#eef2ff,#f0fdfa); color:#1e293b; }
.coach-card > div { flex:1; min-width:200px; }
.coach-card h3 { font-size:1.1rem; font-weight:800; margin:.35rem 0; }
.coach-card p { font-size:.9rem; line-height:1.6; margin:.4rem 0; }
.coach-kicker { font-size:.65rem; letter-spacing:.08em; font-weight:800; color:#4338ca; }
.coach-card button { background:#4338ca; color:white; border-radius:.85rem; padding:.85rem 1rem; font-weight:700; }
.coach-card button:disabled { opacity:.6; }
.coach-parent { display:block; }
.coach-topic { border-top:1px solid #a5b4fc; padding:.85rem 0; }
.coach-note, .coach-topic small { color:#475569; font-size:.8rem; }
.dark .coach-card { background:linear-gradient(120deg,#273449,#203d3e); border-color:#818cf8; color:#f1f5f9; }
.dark .coach-kicker { color:#c7d2fe; }
.dark .coach-note, .dark .coach-topic small { color:#cbd5e1; }
/* ══ Teacher Screen ══════════════════════════════════════════════════ */
/* ══ Teacher workspace - classroom theme ═══════════════════════════ */
#screen-teacher {
  background: #f2ebe0;
  min-height: 100vh;
  padding: 0 0 4rem;
}
.dark #screen-teacher { background: #1a1208; }

#screen-teacher > .flex { margin-bottom: .5rem; }
#screen-teacher h2 {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 700;
  color: #2a4d28;
  letter-spacing: .01em;
}
.dark #screen-teacher h2 { color: #86efac; }

#screen-teacher .teacher-intro {
  font-size: .95rem;
  line-height: 1.6;
  color: #5c4a2a;
  margin: .4rem 0 .8rem;
}
.dark #screen-teacher .teacher-intro { color: #a3855a; }

/* ── Chalkboard tab navigation ───────────────────────────────────── */
#screen-teacher .teacher-navigation,
#screen-student-home .teacher-navigation,
#screen-subject-hub .teacher-navigation,
#screen-parent .teacher-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: flex-end;
  background: linear-gradient(180deg, #2a4d28 0%, #1c3619 100%);
  border-radius: 8px 8px 0 0;
  padding: 10px 10px 0;
  margin: 1.2rem 0 0;
  box-shadow:
    0 -1px 0 #4a7a40 inset,
    0 4px 0 #3d2208;
  position: relative;
}
/* chalk tray bottom ledge */
#screen-teacher .teacher-navigation::after,
#screen-student-home .teacher-navigation::after,
#screen-subject-hub .teacher-navigation::after,
#screen-parent .teacher-navigation::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(to bottom, #5c3810, #3a2008);
  border-radius: 0 0 3px 3px;
}

#screen-teacher .ta-tab,
#screen-student-home .ta-tab,
#screen-subject-hub .ta-tab,
#screen-parent .ta-tab {
  position: relative;
  padding: .55rem 1.2rem .5rem;
  border: none;
  border-radius: 5px 5px 0 0;
  background: rgba(255,255,255,.06);
  color: rgba(240,236,220,.75);
  cursor: pointer;
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .01em;
  transition: background .14s, color .14s;
  min-width: 72px;
  text-align: center;
  margin-bottom: 0;
}
#screen-teacher .ta-tab strong,
#screen-student-home .ta-tab strong,
#screen-subject-hub .ta-tab strong,
#screen-parent .ta-tab strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Caveat', cursive;
  line-height: 1.2;
}
#screen-teacher .ta-tab span,
#screen-student-home .ta-tab span,
#screen-subject-hub .ta-tab span,
#screen-parent .ta-tab span { display: none; }
#screen-teacher .ta-tab:hover,
#screen-student-home .ta-tab:hover,
#screen-subject-hub .ta-tab:hover,
#screen-parent .ta-tab:hover {
  background: rgba(255,255,255,.12);
  color: rgba(240,236,220,.85);
}
#screen-teacher .ta-tab[aria-selected="true"],
#screen-student-home .ta-tab[aria-selected="true"],
#screen-subject-hub .ta-tab[aria-selected="true"],
#screen-parent .ta-tab[aria-selected="true"] {
  background: #f2ebe0;
  color: #2a4d28;
  box-shadow: 0 -2px 0 #4a7a40 inset;
  z-index: 2;
}
.dark #screen-teacher .ta-tab,
.dark #screen-student-home .ta-tab,
.dark #screen-subject-hub .ta-tab,
.dark #screen-parent .ta-tab { background: rgba(0,0,0,.2); }
.dark #screen-teacher .ta-tab[aria-selected="true"],
.dark #screen-student-home .ta-tab[aria-selected="true"],
.dark #screen-subject-hub .ta-tab[aria-selected="true"],
.dark #screen-parent .ta-tab[aria-selected="true"] { background: #1a1208; color: #86efac; }

/* ── Tab content panels - chalkboard surface ─────────────────────── */
#screen-teacher .ta-tab-content,
#screen-student-home .ta-tab-content,
#screen-subject-hub .ta-tab-content {
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px, transparent 31px,
      rgba(255,255,255,.035) 31px, rgba(255,255,255,.035) 32px
    ),
    linear-gradient(158deg,
      #2e5230 0%, #1e3a22 25%,
      #264028 50%, #1c3420 75%,
      #203824 100%
    );
  border-radius: 0 6px 6px 6px;
  padding: 1.6rem 1.4rem 1.4rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06);
  line-height: 1.6;
  position: relative;
  margin-top: 4px;
  color: #f0ece0;
  border: 8px solid #5c3810;
  border-top: none;
}
/* Blackboard in dark mode */
.dark #screen-teacher .ta-tab-content,
.dark #screen-student-home .ta-tab-content,
.dark #screen-subject-hub .ta-tab-content {
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px, transparent 31px,
      rgba(255,255,255,.025) 31px, rgba(255,255,255,.025) 32px
    ),
    linear-gradient(158deg,
      #111 0%, #0a0a0a 40%, #131313 70%, #0d0d0d 100%
    );
  border-color: #3a2008;
  color: #e8dcc8;
}

/* ── Text overrides inside board panels ───────────────────────────── */
#screen-teacher .ta-tab-content h3,
#screen-teacher .ta-tab-content h4:not(.teacher-step),
#screen-student-home .ta-tab-content h3,
#screen-subject-hub .ta-tab-content h3 {
  color: #f0ece0;
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  text-shadow: 0 0 10px rgba(240,236,220,.2);
}
#screen-teacher .ta-tab-content label,
#screen-teacher .ta-tab-content .text-xs,
#screen-teacher .ta-tab-content .text-sm,
#screen-teacher .ta-tab-content p:not(.teacher-intro):not(.ta-chip-hint),
#screen-student-home .ta-tab-content label,
#screen-student-home .ta-tab-content .text-xs,
#screen-student-home .ta-tab-content .text-sm,
#screen-student-home .ta-tab-content p,
#screen-subject-hub .ta-tab-content label,
#screen-subject-hub .ta-tab-content .text-xs,
#screen-subject-hub .ta-tab-content .text-sm,
#screen-subject-hub .ta-tab-content p {
  color: rgba(240,236,220,.8) !important;
}
#screen-teacher .ta-tab-content b,
#screen-student-home .ta-tab-content b,
#screen-subject-hub .ta-tab-content b { color: #f0ece0; }
/* ── Admin › Teachers: activity summary on each card ── */
.tch-act { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid #f3f4f6; }
.dark .tch-act { border-top-color: #374151; }
.tch-act-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; margin-bottom: 0.45rem; }
.tch-act-when { font-size: 0.72rem; color: #4b5563; }
.dark .tch-act-when { color: #d1d5db; }
.tch-act-when b { font-weight: 600; color: #374151; }
.dark .tch-act-when b { color: #f3f4f6; }
.tch-act-email { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #6b7280; overflow-wrap: anywhere; }
.tch-act-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tch-act-chip {
  font-size: 0.72rem; font-weight: 600; color: #374151; background: #f3f4f6;
  border-radius: 999px; padding: 0.2rem 0.6rem; white-space: nowrap;
}
.dark .tch-act-chip { color: #e5e7eb; background: #374151; }
.tch-act-note { font-size: 0.72rem; color: #6b7280; margin-top: 0.5rem; }
.dark .tch-act-note { color: #9ca3af; }
.tch-act-detail { margin-top: 0.5rem; font-size: 0.75rem; color: #374151; }
.dark .tch-act-detail { color: #d1d5db; }
.tch-act-detail summary { cursor: pointer; font-weight: 600; color: #4f46e5; }
.dark .tch-act-detail summary { color: #a5b4fc; }
.tch-act-detail ul { list-style: disc; padding-left: 1.1rem; margin: 0.35rem 0; }
.tch-act-detail li { margin: 0.15rem 0; line-height: 1.45; }
.tch-act-sub { margin-top: 0.4rem; font-weight: 600; color: #6b7280; }
.dark .tch-act-sub { color: #9ca3af; }

/* Chapter cards are paper pinned to the board, not chalk on it. The board
   overrides above match every h3/p inside the panel, which painted
   "Numeration & Notation" in cream Caveat on a WHITE card in light mode
   (measured ~1.2:1). The card's own ink wins inside .ch-card. */
#screen-subject-hub .ta-tab-content .ch-card h3.ch-name {
  color: #1f2937; font-family: inherit; font-size: 0.9rem; text-shadow: none;
}
.dark #screen-subject-hub .ta-tab-content .ch-card h3.ch-name { color: #f1f5f9; }
#screen-subject-hub .ta-tab-content .ch-card p.ch-status { color: #334155 !important; }
.dark #screen-subject-hub .ta-tab-content .ch-card p.ch-status { color: #e2e8f0 !important; }
#screen-subject-hub .ta-tab-content .ch-card b { color: inherit; }
/* Strip inner white boxes - everything sits directly on the board */
#screen-teacher .ta-tab-content .bg-white,
#screen-teacher .ta-tab-content [class*="bg-gray"],
#screen-teacher .ta-tab-content .rounded-2xl.shadow,
#screen-teacher .ta-tab-content .rounded-xl.shadow {
  background: transparent !important;
  box-shadow: none !important;
  border-color: rgba(255,255,255,.12) !important;
}
#screen-teacher .ta-tab-content .bg-gray-50 { background: rgba(255,255,255,.06) !important; }
/* Section dividers on the board */
#screen-teacher .ta-tab-content .border-gray-200,
#screen-teacher .ta-tab-content .border-gray-300 {
  border-color: rgba(255,255,255,.15) !important;
}

/* ── Access-mode help text - chalk note on board ─────────────────── */
#ta-access-help {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: #d4f1c0;
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.2);
  border-radius: 6px;
  padding: .4rem .8rem;
  margin: .3rem 0 .6rem;
  line-height: 1.5;
}
.dark #ta-access-help { color: #86efac; background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.15); }
#ta-access-help.hidden { display: none; }

/* ── Step labels - chalk circles on the board ────────────────────── */
#screen-teacher .teacher-step {
  display: flex;
  gap: .7rem;
  align-items: center;
  font-weight: 700;
  color: #f0ece0;
  padding: .3rem 0 .6rem;
  margin: 1.2rem 0 .6rem;
  border-bottom: 1px solid rgba(255,255,255,.15);
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  text-shadow: 0 0 12px rgba(240,236,220,.2);
}
/* Step number - chalk-outline circle */
#screen-teacher .teacher-step::before {
  content: attr(data-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(240,236,220,.65);
  color: #f0ece0;
  font-size: 1rem;
  font-weight: 800;
  font-family: 'Caveat', cursive;
  flex-shrink: 0;
  text-shadow: none;
  box-shadow: 0 0 8px rgba(240,236,220,.15);
}
#screen-teacher .teacher-step span { color: rgba(240,236,220,.85); font-size: 1.1rem; }
.dark #screen-teacher .teacher-step { color: #e8dcc8; border-color: rgba(255,255,255,.1); }
.dark #screen-teacher .teacher-step::before { border-color: rgba(232,220,200,.6); color: #e8dcc8; }
.dark #screen-teacher .teacher-step span { color: rgba(232,220,200,.85); }

/* ── Tip box - yellow sticky note ───────────────────────────────── */
#screen-teacher .teacher-tip {
  background: linear-gradient(160deg, #fef9c3 0%, #fef08a 100%);
  color: #713f12;
  border-radius: 4px 12px 12px 4px;
  padding: .9rem 1.1rem .9rem 1.4rem;
  font-size: .88rem;
  margin: .8rem 0;
  position: relative;
  box-shadow: 2px 3px 8px rgba(0,0,0,.12), -1px -1px 0 rgba(234,179,8,.3) inset;
}
/* Corner fold */
#screen-teacher .teacher-tip::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 18px; height: 18px;
  background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,.1) 50%);
  border-radius: 0 0 12px 0;
}
/* Thumbtack pin */
#screen-teacher .teacher-tip::before {
  content: '📌';
  position: absolute;
  top: -10px; left: 10px;
  font-size: 1.2rem;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.3));
}
.dark #screen-teacher .teacher-tip {
  background: linear-gradient(160deg, #3b2f02 0%, #4a3a05 100%);
  color: #fde68a;
  box-shadow: 2px 3px 8px rgba(0,0,0,.3);
}

/* ── Create classroom input row ──────────────────────────────────── */
#screen-teacher .teacher-class-create {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  padding: .8rem 0;
}
#screen-teacher .teacher-class-create input { flex: 1; min-width: 150px; }

/* ── All inputs & selects - chalk-on-board style ─────────────────── */
#screen-teacher input:not([type=checkbox]),
#screen-teacher select {
  min-height: 44px;
  border: none !important;
  border-bottom: 1.5px solid rgba(240,236,220,.45) !important;
  border-radius: 0 !important;
  background: rgba(255,255,255,.08) !important;
  padding: .5rem .3rem !important;
  font-size: 1rem;
  color: #f0ece0 !important;
  transition: border-color .15s, background .15s;
  outline: none !important;
  box-shadow: none !important;
}
#screen-teacher input:not([type=checkbox]):focus,
#screen-teacher select:focus {
  border-bottom-color: rgba(240,236,220,.9) !important;
  background: rgba(255,255,255,.13) !important;
}
#screen-teacher input::placeholder { color: rgba(240,236,220,.4) !important; font-style: italic; }
.dark #screen-teacher input:not([type=checkbox]),
.dark #screen-teacher select {
  border-bottom-color: rgba(232,220,200,.35) !important;
  background: rgba(255,255,255,.06) !important;
  color: #e8dcc8 !important;
}
.dark #screen-teacher input:not([type=checkbox]):focus,
.dark #screen-teacher select:focus {
  border-bottom-color: rgba(232,220,200,.8) !important;
}

/* The "topics" checkbox grid keeps its box style */
#ta-chapter-opts-container {
  background: rgba(255,255,255,.07) !important;
  border: 1px solid rgba(255,255,255,.15) !important;
  border-radius: 8px !important;
}
.dark #ta-chapter-opts-container {
  background: rgba(0,0,0,.3) !important;
  border-color: rgba(80,60,20,.4) !important;
}

#screen-teacher button:focus-visible,
.coach-card button:focus-visible {
  outline: 3px solid #2a4d28;
  outline-offset: 3px;
}

/* ── Primary chalkboard button (Generate Link) ───────────────────── */
#ta-build-btn {
  width: 100%;
  padding: .85rem;
  font-family: 'Caveat', cursive;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: #f0ece0;
  background: linear-gradient(160deg, #2a4d28 0%, #1c3619 100%);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow:
    0 4px 0 #0f2010,
    0 6px 12px rgba(0,0,0,.2);
  transition: transform .1s, box-shadow .1s;
  text-shadow: 0 0 12px rgba(240,236,220,.25), 1px 1px 0 rgba(0,0,0,.4);
  position: relative;
  overflow: hidden;
}
#ta-build-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    92deg,
    transparent 0px, transparent 4px,
    rgba(255,255,255,.025) 4px, rgba(255,255,255,.025) 5px
  );
  pointer-events: none;
}
#ta-build-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #0f2010, 0 10px 18px rgba(0,0,0,.25);
}
#ta-build-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0f2010, 0 3px 6px rgba(0,0,0,.15);
}

/* ── Pencil-style button (Create classroom / Upload) ─────────────── */
.ta-btn-pencil {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.2rem;
  background: linear-gradient(160deg, #e5bd3a 0%, #c89e20 100%);
  color: #2d1f04;
  font-family: 'Caveat', cursive;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 3px 0 #8a6a10, 0 4px 8px rgba(0,0,0,.15);
  transition: transform .1s, box-shadow .1s;
  letter-spacing: .01em;
}
.ta-btn-pencil:hover { transform: translateY(-1px); box-shadow: 0 4px 0 #8a6a10, 0 6px 12px rgba(0,0,0,.18); }
.ta-btn-pencil:active { transform: translateY(1px); box-shadow: 0 1px 0 #8a6a10; }

/* ── Eraser-style button (Refresh / secondary) ───────────────────── */
.ta-btn-eraser {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1rem;
  background: linear-gradient(160deg, #e8c8c0 0%, #d4a89c 100%);
  color: #4a2020;
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 3px 0 #a06860, 0 4px 8px rgba(0,0,0,.12);
  transition: transform .1s, box-shadow .1s;
}
.ta-btn-eraser:hover { transform: translateY(-1px); box-shadow: 0 4px 0 #a06860, 0 6px 12px rgba(0,0,0,.15); }
.ta-btn-eraser:active { transform: translateY(1px); box-shadow: 0 1px 0 #a06860; }

/* ── Assignment cards - exercise book covers ─────────────────────── */
.ta-copybook-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 4px 0 8px;
}

.ta-copybook {
  position: relative;
  width: 180px;
  min-height: 220px;
  background: #fefcf7;
  border-radius: 3px 10px 10px 3px;
  box-shadow:
    0 3px 10px rgba(0,0,0,.14),
    2px 0 0 rgba(0,0,0,.06) inset;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(150,120,60,.2);
}
.ta-copybook:hover {
  transform: translateY(-4px) rotate(.5deg);
  box-shadow: 0 10px 24px rgba(42,77,40,.2), 2px 0 0 rgba(0,0,0,.06) inset;
}
.ta-copybook:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}
.dark .ta-copybook {
  background: #1e1a12;
  border-color: rgba(80,60,20,.4);
}

/* Coloured spine on the left - cycles through subject colours */
.ta-copybook::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 8px;
  background: linear-gradient(180deg, #2a4d28, #1c3619);
  border-radius: 3px 0 0 3px;
}
.ta-copybook:nth-child(4n+1)::before { background: linear-gradient(180deg,#2a4d28,#1c3619); }
.ta-copybook:nth-child(4n+2)::before { background: linear-gradient(180deg,#1e3a8a,#1e2d70); }
.ta-copybook:nth-child(4n+3)::before { background: linear-gradient(180deg,#7c2d12,#5a1a08); }
.ta-copybook:nth-child(4n+0)::before { background: linear-gradient(180deg,#713f12,#5a2e08); }

/* Spiral binding holes */
.ta-copybook::after {
  content: '';
  position: absolute;
  top: 12px; bottom: 12px; left: 2px;
  width: 8px;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 14px,
    rgba(0,0,0,.25) 14px, rgba(0,0,0,.25) 20px,
    transparent 20px, transparent 22px
  );
  pointer-events: none;
}

.ta-copybook-fold { display: none; }

.ta-copybook-page {
  position: relative;
  flex: 1;
  padding: 12px 10px 8px 18px;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 19px,
    rgba(100,150,255,.18) 19px, rgba(100,150,255,.18) 20px
  );
}

.ta-copybook-subject {
  font-family: 'Caveat', cursive;
  font-size: .85rem;
  color: #2a4d28;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: 2px;
  text-transform: uppercase;
}
.dark .ta-copybook-subject { color: #86efac; }

.ta-copybook-title {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e3a1c;
  line-height: 1.3;
  margin-bottom: 6px;
  word-break: break-word;
}
.dark .ta-copybook-title { color: #e8dcc8; }

.ta-copybook-meta {
  font-size: .82rem;
  color: #64748b;
  margin-top: 4px;
  line-height: 1.5;
}
.dark .ta-copybook-meta { color: #94a3b8; }

.ta-copybook-status {
  font-family: 'Caveat', cursive;
  font-size: .82rem;
  font-weight: 700;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 4px;
  display: inline-block;
  background: #dcfce7;
  color: #166534;
}
.ta-copybook-status.closed { background: #fee2e2; color: #991b1b; }
.ta-copybook-status.archived { background: #f1f5f9; color: #64748b; }

.ta-copybook-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid rgba(150,120,60,.2);
  background: rgba(242,235,224,.8);
}
.dark .ta-copybook-actions { border-color: rgba(80,60,20,.3); background: rgba(0,0,0,.2); }
.ta-copybook-actions button {
  min-width: 0;
  font-family: 'Caveat', cursive;
  font-size: .9rem;
  font-weight: 700;
  color: #2a4d28;
  background: none;
  border: none;
  padding: 7px 4px;
  cursor: pointer;
  border-right: 1px solid rgba(150,120,60,.2);
  transition: background .12s;
}
.dark .ta-copybook-actions button { color: #86efac; border-color: rgba(80,60,20,.3); }
.ta-copybook-actions button:last-child { border-right: none; }
.ta-copybook-actions button:hover { background: rgba(42,77,40,.1); }
.dark .ta-copybook-actions button:hover { background: rgba(134,239,172,.08); }
.ta-copybook-actions button:disabled { color: #94a3b8; cursor: default; }

/* Assignment detail: one teacher-friendly snapshot before opening raw results. */
.ta-detail-overlay {
  position: fixed; inset: 0; z-index: 10030;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(15,23,42,.68);
  backdrop-filter: blur(3px);
}
.ta-copybook-actions button[data-details] {
  grid-column: 1 / -1;
  border-right: 0;
  border-bottom: 1px solid rgba(150,120,60,.2);
  background: rgba(42,77,40,.07);
}
.dark .ta-copybook-actions button[data-details] { border-color: rgba(80,60,20,.3); background: rgba(134,239,172,.05); }
.ta-detail-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  border-radius: 22px;
  padding: 26px;
  color: #172033;
  background: #fffdf7;
  box-shadow: 0 28px 80px rgba(0,0,0,.3);
}
.dark .ta-detail-panel { color: #e5e7eb; background: #172033; }
.ta-detail-close {
  position: absolute; top: 13px; right: 15px;
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  font-size: 1.7rem; line-height: 1; color: #475569; background: #eef2f7;
}
.dark .ta-detail-close { color: #e5e7eb; background: #334155; }
.ta-detail-heading { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding-right: 38px; }
.ta-detail-heading h2 { margin: 2px 0 0; font-size: clamp(1.35rem, 3vw, 1.8rem); line-height: 1.18; }
.ta-detail-kicker { color: #3b6e39; font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.dark .ta-detail-kicker { color: #86efac; }
.ta-detail-state { flex: none; border-radius: 999px; padding: 5px 11px; font-size: .78rem; font-weight: 800; color: #166534; background: #dcfce7; }
.ta-detail-state.closed { color: #991b1b; background: #fee2e2; }
.ta-detail-state.archived { color: #475569; background: #e2e8f0; }
.ta-detail-status-note { margin: 8px 0 18px; color: #64748b; font-size: .9rem; }
.dark .ta-detail-status-note, .dark .ta-detail-section-head p { color: #aebbd0; }
.ta-detail-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.ta-detail-facts > div { min-width: 0; padding: 11px 13px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; }
.dark .ta-detail-facts > div { border-color: #40506a; background: #202c40; }
.ta-detail-facts small { display: block; margin-bottom: 3px; color: #64748b; font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.ta-detail-facts strong { display: block; overflow-wrap: anywhere; font-size: .88rem; }
.ta-detail-section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }
.ta-detail-section-head h3 { margin: 0; font-size: 1.05rem; }
.ta-detail-section-head p { margin: 2px 0 0; color: #64748b; font-size: .8rem; }
.ta-detail-section-head button { flex: none; border: 0; border-radius: 9px; padding: 7px 10px; color: #225020; background: #e5f4e4; font-weight: 700; }
.dark .ta-detail-section-head button { color: #b7f5bc; background: #28442d; }
.ta-detail-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.ta-detail-stats > div { padding: 12px 7px; border-radius: 12px; text-align: center; background: #f1f5f9; }
.dark .ta-detail-stats > div { background: #263349; }
.ta-detail-stats strong, .ta-detail-stats span { display: block; }
.ta-detail-stats strong { font-size: 1.3rem; }
.ta-detail-stats span { margin-top: 2px; color: #64748b; font-size: .72rem; }
.dark .ta-detail-stats span { color: #aebbd0; }
.ta-detail-pupils { margin-top: 12px; border: 1px solid #e2e8f0; border-radius: 13px; overflow: hidden; }
.dark .ta-detail-pupils { border-color: #40506a; }
.ta-detail-pupil { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 13px; border-bottom: 1px solid #e2e8f0; }
.dark .ta-detail-pupil { border-color: #40506a; }
.ta-detail-pupil:last-child { border-bottom: 0; }
.ta-detail-pupil span, .ta-detail-pupil small { display: block; }
.ta-detail-pupil small { margin-top: 2px; color: #64748b; }
.dark .ta-detail-pupil small { color: #aebbd0; }
.ta-detail-pupil b { color: #166534; font-size: .86rem; text-align: right; }
.ta-detail-pupil b.in-progress { color: #9a5b08; }
.ta-detail-pupil b.not-started { color: #64748b; }
.ta-detail-loading, .ta-detail-empty, .ta-detail-error { margin: 10px 0; padding: 18px; border-radius: 12px; text-align: center; color: #64748b; background: #f8fafc; }
.dark .ta-detail-loading, .dark .ta-detail-empty { color: #b7c2d3; background: #202c40; }
.ta-detail-error { color: #991b1b; background: #fef2f2; }
.ta-detail-footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.ta-detail-footer button { border: 1px solid #cbd5e1; border-radius: 10px; padding: 10px 14px; color: #334155; background: #fff; font-weight: 750; }
.ta-detail-footer button.primary { border-color: #2a4d28; color: #fff; background: #2a4d28; }
.ta-detail-footer button:disabled { opacity: .5; }
.dark .ta-detail-footer button { border-color: #506078; color: #e5e7eb; background: #263349; }
.dark .ta-detail-footer button.primary { border-color: #86efac; color: #122014; background: #86efac; }
@media (max-width: 600px) {
  .ta-detail-overlay { padding: 0; align-items: end; }
  .ta-detail-panel { width: 100%; max-height: 92vh; padding: 22px 16px; border-radius: 22px 22px 0 0; }
  .ta-detail-facts { grid-template-columns: 1fr; }
  .ta-detail-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ta-detail-footer { flex-direction: column-reverse; }
  .ta-detail-footer button { width: 100%; }
}

.ta-copybook-date {
  position: absolute;
  top: 8px; right: 8px;
  font-size: .67rem;
  color: #94a3b8;
}

.ta-copybook-class {
  font-family: 'Caveat', cursive;
  font-size: .82rem;
  color: #2a4d28;
  background: rgba(42,77,40,.12);
  border-radius: 4px;
  padding: 1px 7px;
  margin-bottom: 4px;
  display: inline-block;
}

@media (max-width:700px) {
  #screen-teacher .teacher-navigation,
  #screen-student-home .teacher-navigation,
  #screen-subject-hub .teacher-navigation,
  #screen-parent .teacher-navigation { gap: 2px; }
  #screen-teacher .ta-tab,
  #screen-student-home .ta-tab,
  #screen-subject-hub .ta-tab,
  #screen-parent .ta-tab { min-width: 60px; padding: .45rem .7rem .4rem; font-size: .95rem; }
  .ta-copybook { width: 158px; min-height: 200px; }
  .ta-copybook-title { font-size: 1rem; }
  .ta-copybook-wrap { gap: 12px; }
}
/* On very small phones (≤420px) squeeze tabs further so 5 still fit in one row */
@media (max-width:420px) {
  #screen-teacher .ta-tab,
  #screen-student-home .ta-tab,
  #screen-subject-hub .ta-tab,
  #screen-parent .ta-tab { min-width: 50px; padding: .38rem .5rem .35rem; font-size: .85rem; }
}
.coach-card.hidden { display:none !important; }

/* ══ MiniGames / Peak Quest ═════════════════════════════════════════════
   All injected via innerHTML, so every rule lives HERE - the Tailwind Play
   CDN only generates classes it saw at its initial scan and would silently
   drop any utility class used only inside MiniGames' rendered markup.
   Animations transform INNER elements only - never .screen/main/body, which
   would re-anchor every position:fixed bar in the app. */
.mg-hero { text-align:center; margin-bottom:18px; }
.mg-hero h2 { font-size:1.6rem; font-weight:800; color:#1f2937; }
.dark .mg-hero h2 { color:#f9fafb; }
.mg-hero p { color:#6b7280; font-size:.9rem; }
.dark .mg-hero p { color:#9ca3af; }
/* During a game the hero is dead weight - ~180px of a phone's height spent on
   a title the child already read. Progressive: browsers without :has() simply
   keep it. */
#screen-minigames:has(#mg-game:not(.hidden)) .mg-hero { display:none; }
@media (max-width:480px) {
  .mg-hero { margin-bottom:12px; }
  .mg-hero h2 { font-size:1.35rem; }
}
.mg-note { text-align:center; color:#6b7280; padding:2rem 1rem; }
.mg-fineprint { text-align:center; color:#4b5563; font-size:0.75rem; line-height:1.45; margin:6px 4px 0; }
.dark .mg-fineprint { color:#9ca3af; }

.mg-card { display:flex; align-items:center; gap:14px; width:100%; text-align:left;
  background:#fff; border:2px solid #e5e7eb; border-radius:20px; padding:18px 16px;
  margin-bottom:12px; transition:transform .15s, box-shadow .15s, border-color .15s; }
.dark .mg-card { background:#1f2937; border-color:#374151; }
.mg-card-live { cursor:pointer; border-color:#fbbf24;
  background:linear-gradient(120deg,#fffbeb,#fff7ed); }
.dark .mg-card-live { background:linear-gradient(120deg,#3b2f14,#3b2417); border-color:#b45309; }
.mg-card-live:hover { transform:translateY(-2px); box-shadow:0 10px 26px rgba(245,158,11,.25); }
.mg-card-soon { opacity:.62; }
.mg-card-art { font-size:2.4rem; flex:0 0 auto; }
.mg-card-body { flex:1; display:flex; flex-direction:column; gap:2px; min-width:0; }
.mg-card-body b { font-size:1.05rem; color:#1f2937; }
.dark .mg-card-body b { color:#f9fafb; }
.mg-card-body > span { font-size:.82rem; color:#6b7280; }
.dark .mg-card-body > span { color:#9ca3af; }
.mg-card-best { font-size:.78rem; color:#b45309; font-weight:700; margin-top:2px; }
.dark .mg-card-best { color:#fbbf24; }
.mg-card-go { flex:0 0 auto; background:#f59e0b; color:#fff; font-weight:800; font-size:.78rem;
  border-radius:99px; padding:8px 14px; letter-spacing:.04em; }
.mg-card-lock { flex:0 0 auto; background:#e5e7eb; color:#6b7280; font-weight:800; font-size:.72rem;
  border-radius:99px; padding:7px 12px; letter-spacing:.04em; }
.dark .mg-card-lock { background:#374151; color:#9ca3af; }

.mg-top { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.mg-alt { font-size:.92rem; font-weight:700; color:#374151; }
.dark .mg-alt { color:#e5e7eb; }
.mg-quit { width:40px; height:40px; border-radius:50%; background:#f3f4f6; color:#6b7280;
  font-weight:800; flex:0 0 auto; }
.dark .mg-quit { background:#374151; color:#d1d5db; }
.mg-rest { text-align:center; font-size:.78rem; font-weight:800; color:#065f46;
  background:#ecfdf5; border:1.5px solid #a7f3d0; border-radius:14px; padding:6px 12px; line-height:1.15; }
.mg-rest small { font-weight:600; color:#059669; }
.mg-rest[disabled] { opacity:.5; }
.dark .mg-rest { background:#064e3b; border-color:#065f46; color:#a7f3d0; }
.dark .mg-rest small { color:#6ee7b7; }

.mg-stage { display:flex; gap:14px; align-items:flex-start; }
.mg-main { flex:1; min-width:0; }
.mg-qcard { background:linear-gradient(135deg,#312e81,#4f46e5); color:#fff; border-radius:20px;
  padding:20px 18px; margin-bottom:14px; box-shadow:0 10px 26px rgba(79,70,229,.3); }
.mg-qtext { font-size:1.05rem; font-weight:700; line-height:1.45; }
.mg-qtext img, .mg-qtext svg { max-width:100%; height:auto; }

.mg-opts { display:grid; grid-template-columns:1fr; gap:10px; margin-bottom:12px; }
@media (min-width:640px) { .mg-opts { grid-template-columns:1fr 1fr; } }
.mg-opt { display:flex; align-items:center; gap:10px; text-align:left; background:#fff;
  border:2px solid #e5e7eb; border-radius:14px; padding:12px 14px; font-weight:600;
  color:#1f2937; transition:border-color .15s, transform .12s, opacity .3s; }
.dark .mg-opt { background:#1f2937; border-color:#4b5563; color:#f3f4f6; }
.mg-opt:hover { border-color:#818cf8; }
.mg-opt:active { transform:scale(.98); }
.mg-tag { flex:0 0 auto; width:30px; height:30px; border-radius:50%; background:#eef2ff;
  color:#4f46e5; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:.85rem; }
.dark .mg-tag { background:#312e81; color:#c7d2fe; }
.mg-optext { min-width:0; }
.mg-opt.gone { opacity:.18; pointer-events:none; }
.mg-opt.picked { border-color:#f59e0b; background:#fffbeb; }
.dark .mg-opt.picked { background:#3b2f14; }
.mg-opt.right { border-color:#10b981; background:#ecfdf5; }
.dark .mg-opt.right { background:#064e3b; }
.mg-opt.right .mg-tag { background:#10b981; color:#fff; }
.mg-opt.wrong { border-color:#ef4444; background:#fef2f2; pointer-events:none; }
.dark .mg-opt.wrong { background:#450a0a; }
.mg-opt.wrong .mg-tag { background:#ef4444; color:#fff; }
.mg-opt.waiting { animation:mg-breathe 1.1s ease infinite; }
@keyframes mg-breathe { 50% { opacity:.65; } }
.mg-opt.pulse { animation:mg-pulse .6s ease 2; }
@keyframes mg-pulse { 50% { transform:scale(1.04); box-shadow:0 0 0 6px rgba(16,185,129,.25); } }
.mg-opt.shake { animation:mg-shake .5s ease 1; }
@keyframes mg-shake { 20%,60% { transform:translateX(-6px); } 40%,80% { transform:translateX(6px); } }
.mg-pop { animation:mg-pop .4s ease; }
@keyframes mg-pop { 0% { transform:scale(.85); opacity:0; } 100% { transform:scale(1); opacity:1; } }

.mg-msg { background:#fffbeb; border:1.5px solid #fcd34d; color:#78350f; border-radius:14px;
  padding:11px 14px; font-size:.9rem; margin-bottom:12px; }
.dark .mg-msg { background:#3b2f14; border-color:#b45309; color:#fde68a; }

.mg-lifes { display:flex; gap:8px; flex-wrap:wrap; }
.mg-life { flex:1 1 70px; display:flex; flex-direction:column; align-items:center; gap:2px;
  background:#fff; border:2px solid #e5e7eb; border-radius:14px; padding:8px 4px;
  transition:transform .12s, border-color .15s; }
.dark .mg-life { background:#1f2937; border-color:#4b5563; }
.mg-life span { font-size:1.3rem; }
.mg-life small { font-size:.64rem; font-weight:800; color:#6b7280; letter-spacing:.02em; }
.dark .mg-life small { color:#9ca3af; }
.mg-life:not(.used):hover { transform:translateY(-2px); border-color:#818cf8; }
.mg-life.used { opacity:.32; }
.mg-life.used span { filter:grayscale(1); }

.mg-ladder { flex:0 0 auto; width:104px; display:flex; flex-direction:column; gap:3px; }
@media (max-width:560px) { .mg-ladder { display:none; } }
.mg-rung { display:flex; align-items:center; justify-content:space-between; gap:4px;
  border-radius:9px; padding:3px 8px; font-size:.68rem; color:#6b7280; background:#f3f4f6; position:relative; }
.dark .mg-rung { background:#374151; color:#9ca3af; }
.mg-rung b { font-weight:800; }
.mg-rung.done { background:#ecfdf5; color:#059669; }
.dark .mg-rung.done { background:#064e3b; color:#6ee7b7; }
.mg-rung.now { background:#4f46e5; color:#fff; transform:scale(1.06); box-shadow:0 4px 12px rgba(79,70,229,.4); }
.mg-rung.camp i { font-style:normal; position:absolute; right:-7px; top:-7px; font-size:.8rem; }

.mg-poll { background:#eef2ff; border:2px solid #c7d2fe; border-radius:16px; padding:14px; margin-bottom:12px; }
.dark .mg-poll { background:#1e1b4b; border-color:#4338ca; }
.mg-poll-head { font-size:.95rem; color:#312e81; margin-bottom:10px; }
.dark .mg-poll-head { color:#c7d2fe; }
.mg-poll-head span { float:right; font-weight:800; color:#4f46e5; }
.dark .mg-poll-head span { color:#a5b4fc; }
.mg-poll-share { display:flex; gap:8px; margin-bottom:12px; }
.mg-bar-row { margin-bottom:8px; }
.mg-bar-head { display:flex; justify-content:space-between; font-size:.78rem; font-weight:800;
  color:#374151; margin-bottom:2px; }
.dark .mg-bar-head { color:#e5e7eb; }
.mg-bar-track { background:#fff; border-radius:99px; height:12px; overflow:hidden; }
.dark .mg-bar-track { background:#374151; }
.mg-bar-fill { height:12px; border-radius:99px; background:linear-gradient(90deg,#818cf8,#4f46e5);
  width:0%; transition:width .6s ease; }
.mg-poll-tip { font-size:.78rem; color:#6b7280; margin-top:4px; }
.dark .mg-poll-tip { color:#9ca3af; }

.mg-btn-primary { background:#4f46e5; color:#fff; font-weight:800; font-size:.85rem;
  border-radius:12px; padding:10px 16px; transition:background .15s; }
.mg-btn-primary:hover { background:#4338ca; }
.mg-btn-ghost { background:#fff; color:#4f46e5; border:2px solid #c7d2fe; font-weight:800;
  font-size:.85rem; border-radius:12px; padding:10px 16px; }
.dark .mg-btn-ghost { background:#1f2937; border-color:#4338ca; color:#a5b4fc; }

.mg-end { text-align:center; background:#fff; border-radius:24px; padding:28px 18px;
  border:2px solid #e5e7eb; max-width:480px; margin:0 auto; }
.dark .mg-end { background:#1f2937; border-color:#374151; }
.mg-end-icon { font-size:4rem; margin-bottom:6px; }
.mg-end h3 { font-size:1.4rem; font-weight:800; color:#1f2937; margin-bottom:4px; }
.dark .mg-end h3 { color:#f9fafb; }
.mg-end p { color:#6b7280; margin-bottom:12px; }
.dark .mg-end p { color:#9ca3af; }
.mg-end-learn { text-align:left; background:#f0fdf4; border:1.5px solid #bbf7d0; border-radius:14px;
  padding:12px 14px; font-size:.88rem; color:#14532d; margin-bottom:14px; }
.dark .mg-end-learn { background:#064e3b; border-color:#065f46; color:#d1fae5; }
.mg-end-learn span { color:#166534; font-size:.82rem; }
.dark .mg-end-learn span { color:#a7f3d0; }
.mg-end-stars { font-size:1.3rem; font-weight:800; color:#b45309; margin-bottom:16px; }
.dark .mg-end-stars { color:#fbbf24; }
.mg-end-row { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }

/* Soft daylight: light-only, with enough specificity to survive Tailwind's
   runtime stylesheet. Keep coloured banners and answer-state colours intact. */
html:not(.dark) {
  color-scheme: light;
  --day-page: #e8edf2;
  --day-card: #f7f8fa;
  --day-inset: #eef2f6;
  --day-ink: #1e293b;
  --day-muted: #475569;
  --day-border: #c3ceda;
}
html:not(.dark) body { background-color:var(--day-page); color:var(--day-ink); }
html:not(.dark) .bg-white { background-color:var(--day-card); }
html:not(.dark) :is(.bg-gray-50, .bg-slate-50):not(body) { background-color:var(--day-inset); }
html:not(.dark) :is(.border-gray-100, .border-gray-200, .border-slate-200) { border-color:var(--day-border); }
html:not(.dark) header { background-color:#f1f4f7; border-color:var(--day-border); }
html:not(.dark) .screen :is(.text-gray-300, .text-gray-400, .text-gray-500, .text-slate-400, .text-slate-500):not([class*="bg-gradient-"] *):not(.bg-gray-800 *):not(.bg-gray-900 *):not(.bg-slate-900 *) {
  color:var(--day-muted);
}
html:not(.dark) .screen :is(p.text-xs, label.text-xs, p[class~="text-[11px]"], p[class~="text-[10px]"]) {
  font-size:.875rem; line-height:1.6;
}
html:not(.dark) :is(input,textarea,select)::placeholder { color:#526176; opacity:1; }
html:not(.dark) :is(.pd-action, .pd-weekly-details, .pr-card, .pr-head, .pr-scratch, .qm-filter-panel, .qm-question-card, .mg-card, .mg-end) {
  background-color:var(--day-card); color:var(--day-ink); border-color:var(--day-border);
}
html:not(.dark) #pd-children-grid .pd-child-card,
html:not(.dark) .ch-card:not(.is-bonus):not(.is-paused) {
  background-color:#edf2f8; color:var(--day-ink); border-color:var(--day-border);
}
html:not(.dark) :is(.ch-subtitle,.ch-sum-lbl,.ch-section-note,.ch-part,.pr-sess,.pr-level,.pr-scratch-head,.stat-label,.pd-child-next,.qm-question-id) { color:var(--day-muted); }
html:not(.dark) :is(.ch-subtitle,.ch-section-note,.pd-child-next) { font-size:.875rem; line-height:1.6; }
html:not(.dark) .pd-action { font-size:.8rem; line-height:1.4; }
html:not(.dark) .pr-tool-lbl { font-size:.75rem; line-height:1.4; text-transform:none; letter-spacing:0; }
html:not(.dark) .pr-tool { color:var(--day-muted); border-color:var(--day-border); }
html:not(.dark) .pr-tool-primary { color:#3730a3; }
html:not(.dark) .pr-tool-report-visible { color:#991b1b; }
html:not(.dark) .pr-q { color:var(--day-ink); line-height:1.75; }
html:not(.dark) .mcq-opt:not(.selected):not(.correct):not(.wrong) { background-color:#f1f4f8; border-color:#aebdce; color:var(--day-ink); }
html:not(.dark) .mcq-opt.selected:not(.correct):not(.wrong) { background-color:#e0e7ff; border-color:#4338ca; color:#312e81; }
html:not(.dark) :is(.pr-tool:disabled,button.track-card:disabled,.plan-locked) { opacity:1; border-style:dashed; }
html:not(.dark) .pr-tool:disabled { background-color:#e2e8f0; color:#475569; }
html:not(.dark) .btn-primary { background:linear-gradient(135deg,#4338ca,#3730a3); }
html:not(.dark) .btn-finish { background:#15803d !important; }
/* teacher tab override removed - handled by classroom theme above */
html:not(.dark) .coach-card { background-image:linear-gradient(120deg,#e3eaf7,#e2f0ec); }
html:not(.dark) #screen-subject-select { background:linear-gradient(145deg,#e4efe9,#e5edf5 50%,#ece7f3); }
/* Keyboard focus, both themes. The old rule was light-mode only while
   <html class="dark"> is the default, so a keyboard user in dark mode had no
   ring at all. Two-tone: the box-shadow fills the offset gap with a contrasting
   halo so the ring reads on white cards AND on the dark-green chalkboard.
   Inputs keep their Tailwind focus:ring (box-shadow) and get the outline only. */
:is(button,a,summary,[role="button"],[tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid #4338ca; outline-offset: 3px; box-shadow: 0 0 0 3px #fff;
}
:is(input,select,textarea):focus-visible { outline: 3px solid #4338ca; outline-offset: 2px; }
.dark :is(button,a,summary,[role="button"],[tabindex]:not([tabindex="-1"])):focus-visible {
  outline-color: #fbbf24; box-shadow: 0 0 0 3px #0f172a;
}
.dark :is(input,select,textarea):focus-visible { outline-color: #fbbf24; }
/* showScreen() moves focus to the screen's first heading so assistive tech
   announces where the user landed. A heading is not interactive, so it draws
   no ring (Chrome would otherwise paint the UA outline whenever the last input
   modality was the keyboard). Interactive elements keep theirs. */
.screen :is(h1,h2,h3)[tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }

/* ══ Quick Fire ═════════════════════════════════════════════════════════ */
.mg-card-qf { border-color:#f59e0b; background:linear-gradient(120deg,#fff7ed,#fef2f2); }
.dark .mg-card-qf { background:linear-gradient(120deg,#3b2417,#3b1d1d); border-color:#c2410c; }
.mg-card-qf:hover { box-shadow:0 10px 26px rgba(234,88,12,.25); }

.qf-hud { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
.qf-score { text-align:center; line-height:1; }
.qf-score b { font-size:1.7rem; font-weight:800; color:#4f46e5; }
.dark .qf-score b { color:#a5b4fc; }
.qf-score small { display:block; font-size:.66rem; color:#6b7280; font-weight:700; letter-spacing:.05em; }
.qf-combo { font-size:.85rem; font-weight:800; color:#6b7280; background:#f3f4f6; border-radius:99px; padding:6px 14px; }
.dark .qf-combo { background:#374151; color:#d1d5db; }
.qf-combo.hot { color:#fff; background:linear-gradient(90deg,#f97316,#ef4444);
  animation:qf-hot .8s ease infinite; }
@keyframes qf-hot { 50% { transform:scale(1.08); } }

.qf-timebar { position:relative; height:20px; background:#e5e7eb; border-radius:99px; overflow:hidden; margin-bottom:14px; }
.dark .qf-timebar { background:#374151; }
.qf-timebar-fill { position:absolute; inset:0; width:100%; border-radius:99px;
  background:linear-gradient(90deg,#22c55e,#4ade80); transition:width .2s linear; }
.qf-timebar-fill.low { background:linear-gradient(90deg,#ef4444,#f97316); animation:qf-pulse-bar .5s ease infinite; }
@keyframes qf-pulse-bar { 50% { opacity:.7; } }
.qf-timebar span { position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-size:.72rem; font-weight:800; color:#065f46; }
.dark .qf-timebar span { color:#fff; }

.qf-qcard { background:linear-gradient(135deg,#7c3aed,#4f46e5); color:#fff; border-radius:18px;
  padding:18px 16px; margin-bottom:12px; box-shadow:0 8px 22px rgba(124,58,237,.28); min-height:76px;
  display:flex; align-items:center; }
.qf-qtext { font-size:1rem; font-weight:700; line-height:1.4; }
.qf-qtext img, .qf-qtext svg { max-width:100%; height:auto; }

.qf-opts { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-bottom:10px; }
@media (max-width:420px) { .qf-opts { grid-template-columns:1fr; } }
.qf-opt { display:flex; align-items:center; gap:9px; text-align:left; background:#fff;
  border:2px solid #e5e7eb; border-radius:13px; padding:11px 13px; font-weight:600; color:#1f2937;
  transition:border-color .12s, transform .1s, background .15s; }
.dark .qf-opt { background:#1f2937; border-color:#4b5563; color:#f3f4f6; }
.qf-opt:active { transform:scale(.97); }
.qf-opt.right { border-color:#10b981; background:#ecfdf5; }
.dark .qf-opt.right { background:#064e3b; }
.qf-opt.right .mg-tag { background:#10b981; color:#fff; }
.qf-opt.wrong { border-color:#ef4444; background:#fef2f2; }
.dark .qf-opt.wrong { background:#450a0a; }
.qf-opt.wrong .mg-tag { background:#ef4444; color:#fff; }
.qf-hint { font-size:.76rem; color:#6b7280; text-align:center; }
.dark .qf-hint { color:#9ca3af; }

.qf-float { position:fixed; left:50%; top:38%; transform:translateX(-50%); font-size:2rem; font-weight:900;
  pointer-events:none; z-index:60; animation:qf-float 0.9s ease forwards; }
.qf-float.good { color:#10b981; }
.qf-float.bad { color:#ef4444; }
@keyframes qf-float { 0% { opacity:0; transform:translate(-50%,10px) scale(.6); }
  25% { opacity:1; transform:translate(-50%,-6px) scale(1.1); }
  100% { opacity:0; transform:translate(-50%,-52px) scale(1); } }

.qf-scoreboard { display:flex; gap:10px; justify-content:center; margin:6px 0 16px; }
.qf-scoreboard > div { background:#f3f4f6; border-radius:14px; padding:12px 8px; min-width:78px; }
.dark .qf-scoreboard > div { background:#374151; }
.qf-scoreboard b { display:block; font-size:1.5rem; font-weight:800; color:#1f2937; }
.dark .qf-scoreboard b { color:#f9fafb; }
.qf-scoreboard span { font-size:.72rem; color:#6b7280; }
.dark .qf-scoreboard span { color:#9ca3af; }

.qf-share-card { background:linear-gradient(135deg,#312e81,#7c3aed); color:#fff; border-radius:18px;
  padding:18px; margin:4px 0 14px; }
.qf-share-top { font-size:.8rem; font-weight:700; opacity:.85; letter-spacing:.03em; }
.qf-share-score { font-size:3.2rem; font-weight:800; color:#fde047; line-height:1.05; }
.qf-share-sub { font-size:.82rem; opacity:.92; }
.qf-share-foot { font-weight:800; margin-top:8px; }
.qf-share-label { font-size:.78rem; font-weight:800; color:#6b7280; letter-spacing:.04em; margin-bottom:8px; }
.dark .qf-share-label { color:#9ca3af; }
.qf-share-row { display:flex; gap:8px; justify-content:center; margin-bottom:18px; flex-wrap:wrap; }
.qf-sbtn { border-radius:12px; padding:11px 14px; font-weight:800; font-size:.95rem; border:2px solid transparent; }
.qf-native { flex:1 1 auto; background:#4f46e5; color:#fff; }
.qf-native:hover { background:#4338ca; }
.qf-wa { background:#25d366; color:#fff; }
.qf-fb { background:#1877f2; color:#fff; }
.qf-x  { background:#111; color:#fff; }
.qf-copy { background:#fff; color:#4f46e5; border-color:#c7d2fe; }
.dark .qf-copy { background:#1f2937; border-color:#4338ca; color:#a5b4fc; }
/* One loud arcade banner, not a heading + grey button - the same white-on-
   indigo/violet gradient pair the promoted parent switch bar already measures
   at 4.5:1+ on both stops. */
.student-games-section { max-width:56rem; margin:0 auto 1.5rem; }
.student-games-section.hidden { display:none !important; }
.student-games-link { display:flex; flex-wrap:wrap; align-items:center; gap:.9rem; width:100%;
  padding:1.1rem 1.2rem; border:none; border-radius:1.25rem; text-align:left; cursor:pointer;
  background:linear-gradient(115deg,#4f46e5,#7c3aed 55%,#9333ea);
  box-shadow:0 8px 24px rgba(124,58,237,.35); transition:box-shadow .2s ease, filter .2s ease; }
.student-games-link:hover { box-shadow:0 12px 32px rgba(124,58,237,.5); filter:brightness(1.06); }
.student-games-icon { font-size:2.6rem; animation:sg-bob 2.2s ease-in-out infinite; }
.student-games-copy { flex:1; min-width:150px; }
.student-games-link strong { display:block; font-size:1.25rem; font-weight:900;
  letter-spacing:.06em; color:#fff; text-shadow:0 2px 6px rgba(0,0,0,.25); }
.student-games-link strong + span { display:block; font-size:.83rem; line-height:1.55;
  color:#eef2ff; font-weight:600; }
.student-games-go { padding:.65rem 1.1rem; border-radius:999px; background:#fbbf24; color:#451a03;
  font-weight:900; font-size:.95rem; letter-spacing:.04em; box-shadow:0 3px 0 #b45309;
  animation:sg-glow 1.8s ease-in-out infinite; }
.student-games-link:focus-visible { outline:3px solid #fbbf24; outline-offset:3px; }
@keyframes sg-bob { 0%,100% { transform:translateY(0) rotate(-4deg); } 50% { transform:translateY(-5px) rotate(4deg); } }
@keyframes sg-glow { 0%,100% { box-shadow:0 3px 0 #b45309, 0 0 0 0 rgba(251,191,36,.55); }
  50% { box-shadow:0 3px 0 #b45309, 0 0 0 9px rgba(251,191,36,0); } }
@media (prefers-reduced-motion: reduce) { .student-games-icon, .student-games-go { animation:none; } }
.dark .student-games-link { box-shadow:0 8px 24px rgba(0,0,0,.45); }

/* ══ Who Wants to Be a Billionaire? ═══════════════════════════════════════
   The stage carries its OWN dark quiz-set ground in both app themes - the
   TV-quiz look is intentionally dark, so no light variant. All injected via
   innerHTML (Tailwind CDN never sees these). */
.bq-card-bq { border-color:#f5c542; background:linear-gradient(120deg,#fffbeb,#eef2ff); }
.dark .bq-card-bq, .dark .mg-card-bq { background:linear-gradient(120deg,#1e1b4b,#3b2f14); border-color:#a16207; }
.mg-card-bq { border-color:#f5c542; background:linear-gradient(120deg,#fffbeb,#eef2ff); }
.mg-card-bq:hover { box-shadow:0 10px 26px rgba(245,197,66,.3); }

/* ⚠ The topbar is a DIRECT child of this flex ROW (main + ladder are its
   siblings). Without wrap, the topbar's min-content width claims the whole
   first row and .bq-main collapses to 0 and lands off-screen - measured at
   360px: bq-main w=0 l=435, the child saw an empty dark stage. */
.bq-stage { background:radial-gradient(120% 90% at 50% 0%, #14235a 0%, #0a1533 55%, #050b1f 100%);
  border-radius:20px; padding:14px 12px 16px; display:flex; flex-wrap:wrap; gap:14px; align-items:flex-start;
  box-shadow:inset 0 0 60px rgba(0,0,0,.5); }
.bq-main { flex:1; min-width:0; display:flex; flex-direction:column; }

.bq-topbar { flex:1 1 100%; min-width:0; display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.bq-quit, .bq-mute { width:40px; height:40px; border-radius:50%; flex:0 0 auto; font-weight:800;
  background:rgba(255,255,255,.1); color:#fff; border:1px solid rgba(255,255,255,.2); }
.bq-lifes { flex:1; min-width:0; display:flex; gap:7px; justify-content:center; }
.bq-life { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px;
  width:60px; height:52px; border-radius:14px; background:linear-gradient(160deg,#1e3a8a,#111f4d);
  border:2px solid #3b82f6; color:#fff; transition:transform .12s; }
.bq-life span { font-size:1rem; font-weight:800; line-height:1; }
.bq-life small { font-size:.6rem; font-weight:700; opacity:.85; letter-spacing:.01em; }
/* Phones: icons carry the lifelines (title/aria keep the names), and they get
   their own full-width row - sharing one 328px row with ✕/❓/🔊 made the
   centered group spill over its neighbours. */
@media (max-width:480px) {
  .bq-topbar { flex-wrap:wrap; }
  .bq-mute { margin-left:auto; }
  .bq-lifes { order:9; flex:1 1 100%; }
  .bq-life { width:auto; flex:1 1 0; min-width:44px; max-width:64px; height:40px; }
  .bq-life small { display:none; }
}
.bq-life:not(.used):hover { transform:translateY(-2px); box-shadow:0 4px 14px rgba(59,130,246,.5); }
.bq-life.used { opacity:.35; }
.bq-life.used span { position:relative; }
.bq-life.used span::after { content:'✕'; position:absolute; inset:0; display:flex; align-items:center;
  justify-content:center; color:#ef4444; font-size:1.5rem; }

.bq-prize-now { color:#e5e7ff; font-size:.82rem; text-align:center; margin-bottom:6px; }
.bq-prize-now b { color:#fde047; }
.bq-tier { display:inline-block; margin-left:4px; font-size:.66rem; font-weight:800; padding:2px 8px; border-radius:99px; }
.bq-tier.hard { background:#7c2d12; color:#fdba74; }
.bq-tier.gk { background:#4c1d95; color:#ddd6fe; }
.bq-walk { align-self:center; font-size:.74rem; font-weight:700; color:#fde047; background:rgba(253,224,71,.1);
  border:1px solid rgba(253,224,71,.4); border-radius:99px; padding:9px 16px; margin-bottom:10px; }
.bq-walk[disabled] { opacity:.4; }

.bq-qwrap { margin-bottom:12px; }
.bq-source { text-align:center; font-size:.68rem; font-weight:800; letter-spacing:.04em; text-transform:uppercase;
  color:#93c5fd; margin-bottom:5px; }
.bq-qcard { background:linear-gradient(160deg,#0b1a44,#0a1230); border:2px solid #2d4a9e;
  border-radius:16px; padding:18px 16px; min-height:74px; display:flex; align-items:center; justify-content:center;
  box-shadow:0 6px 20px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.06); }
.bq-qtext { color:#fff; font-size:1.02rem; font-weight:600; line-height:1.4; text-align:center; }
.bq-qtext img, .bq-qtext svg { max-width:100%; height:auto; }

.bq-opts { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-bottom:10px; }
@media (max-width:430px) { .bq-opts { grid-template-columns:1fr; } }
.bq-opt { display:flex; align-items:center; gap:9px; text-align:left; padding:12px 15px;
  background:linear-gradient(160deg,#101f4e,#0a1636); border:2px solid #2d4a9e; border-radius:13px;
  color:#fff; font-weight:600; transition:transform .1s, border-color .15s, background .2s;
  /* classic angled-lozenge nod without breaking text layout */
  clip-path:polygon(3% 0, 97% 0, 100% 50%, 97% 100%, 3% 100%, 0 50%); }
.bq-opt:hover:not([disabled]) { border-color:#60a5fa; transform:scale(1.01); }
.bq-opt .bq-tag { flex:0 0 auto; color:#fbbf24; font-weight:800; font-size:1rem; }
.bq-optext { min-width:0; }
.bq-opt.waiting { animation:bq-flash 1s ease infinite; }
@keyframes bq-flash { 50% { border-color:#fbbf24; } }
.bq-opt.picked { background:linear-gradient(160deg,#f59e0b,#d97706); border-color:#fde047; color:#1f1300;
  animation:bq-picked .6s ease infinite; }
@keyframes bq-picked { 50% { box-shadow:0 0 0 4px rgba(251,191,36,.4); } }
.bq-opt.picked .bq-tag { color:#7c2d12; }
.bq-opt.right { background:linear-gradient(160deg,#16a34a,#15803d); border-color:#4ade80; color:#fff; }
.bq-opt.right .bq-tag { color:#dcfce7; }
.bq-opt.wrong { background:linear-gradient(160deg,#dc2626,#991b1b); border-color:#f87171; color:#fff; }
.bq-opt.wrong .bq-tag { color:#fee2e2; }
.bq-opt.gone { opacity:.12; pointer-events:none; }
.bq-opt.pulse { animation:bq-pulse .6s ease 2; }
@keyframes bq-pulse { 50% { transform:scale(1.03); } }
.bq-opt.shake { animation:bq-shake .5s ease 1; }
@keyframes bq-shake { 20%,60% { transform:translateX(-6px); } 40%,80% { transform:translateX(6px); } }

.bq-ladder { flex:0 0 auto; width:132px; display:flex; flex-direction:column; gap:2px; }
@media (max-width:600px) {
  .bq-ladder { display:none; }
  .bq-ladder.bq-ladder-peek {
    display: flex;
    flex-direction: row;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 9999;
    background: rgba(8,16,42,.97);
    border-top: 2px solid rgba(245,158,11,.5);
    padding: 8px 10px calc(12px + env(safe-area-inset-bottom));
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    animation: bq-peek-in .22s ease;
  }
  .bq-ladder.bq-ladder-peek::-webkit-scrollbar { display:none; }
  .bq-ladder.bq-ladder-peek .bq-rung {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: .62rem;
    white-space: nowrap;
  }
  .bq-ladder.bq-ladder-peek .bq-rung.now {
    box-shadow: 0 0 10px rgba(245,158,11,.6);
  }
  @keyframes bq-peek-in {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
  }
}
.bq-rung { display:flex; align-items:center; gap:6px; border-radius:8px; padding:3px 8px; font-size:.66rem;
  color:#c7d2fe; }
.bq-rung .bq-lvl { flex:0 0 18px; text-align:center; opacity:.6; font-weight:700; }
.bq-rung b { font-weight:700; color:#e0e7ff; }
.bq-rung.safe b { color:#fff; }
.bq-rung.done { opacity:.4; }
.bq-rung.now { background:linear-gradient(90deg,#f59e0b,#d97706); }
.bq-rung.now .bq-lvl { opacity:1; color:#1f1300; }
.bq-rung.now b { color:#1f1300; font-weight:800; }
.bq-rung.safe:not(.now) b::before { content:'🔒 '; font-size:.6rem; }

.bq-best { font-size:.85rem; color:#b45309; font-weight:700; margin-top:-8px; margin-bottom:12px; }
.dark .bq-best { color:#fbbf24; }

.bq-prize-flash {
  position:fixed; top:50%; left:50%;
  transform:translate(-50%,-50%) scale(1);
  z-index:10001; pointer-events:none;
  background:linear-gradient(135deg,#f59e0b,#d97706);
  border-radius:22px; padding:22px 36px; text-align:center;
  box-shadow:0 8px 48px rgba(245,158,11,.65);
  animation:bq-pf-pop .28s cubic-bezier(.34,1.56,.64,1);
}
.bq-prize-flash .bq-pf-label { font-size:.78rem; color:#1f1300; font-weight:700; margin-bottom:2px; }
.bq-prize-flash .bq-pf-amount { font-size:2.1rem; font-weight:900; color:#1f1300; line-height:1.1; }
.bq-prize-flash .bq-pf-safe { font-size:.72rem; color:#1f1300; margin-top:6px; opacity:.85; }
@keyframes bq-pf-pop {
  from { transform:translate(-50%,-50%) scale(.55); opacity:0; }
  to   { transform:translate(-50%,-50%) scale(1);   opacity:1; }
}

/* the shared message + poll panels sit on the dark stage now */
.bq-stage .mg-msg { background:rgba(251,191,36,.12); border-color:rgba(251,191,36,.5); color:#fde68a; }
.bq-stage .mg-poll { background:rgba(59,130,246,.12); border-color:rgba(59,130,246,.4); }
.bq-stage .mg-poll-head { color:#bfdbfe; }
.bq-stage .mg-bar-head { color:#e0e7ff; }
.bq-stage .mg-poll-tip { color:#93c5fd; }
.bq-stage .mg-fineprint { color:#8fa0d8; margin-top:10px; }

/* ══ Word Builder 🧩 ═════════════════════════════════════════════ */
.mg-card-wb { border-color:#38bdf8; background:linear-gradient(120deg,#f0f9ff,#ecfeff); }
.dark .mg-card-wb { background:linear-gradient(120deg,#082f49,#164e63); border-color:#0369a1; }
.mg-card-wb:hover { box-shadow:0 10px 26px rgba(14,165,233,.25); }
.wb-stage { max-width:560px; margin:0 auto; }
.wb-topbar { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.wb-lives { font-size:1.05rem; letter-spacing:2px; }
.wb-score { display:flex; align-items:baseline; gap:4px; background:#eef2ff; border-radius:12px; padding:6px 12px; }
.wb-score b { font-size:1.15rem; color:#4f46e5; }
.wb-score small { color:#6b7280; font-size:.7rem; font-weight:700; }
.dark .wb-score { background:#312e81; }
.dark .wb-score b { color:#c7d2fe; }
.dark .wb-score small { color:#a5b4fc; }
.wb-lagoon { display:flex; align-items:center; justify-content:center; gap:4px; flex-wrap:wrap;
  background:linear-gradient(180deg,#bae6fd,#7dd3fc); border-radius:16px; padding:10px 8px; margin-bottom:10px; }
.dark .wb-lagoon { background:linear-gradient(180deg,#0c4a6e,#075985); }
.wb-shore { font-size:1.4rem; }
.wb-stone { font-size:1.05rem; opacity:.55; filter:grayscale(.3); }
.wb-stone.done { opacity:1; filter:none; }
.wb-stone.now { font-size:1.5rem; opacity:1; filter:none; animation:mg-pop .4s ease; }
.wb-word-no { text-align:center; font-size:.72rem; font-weight:800; color:#6b7280;
  text-transform:uppercase; letter-spacing:.08em; margin-bottom:6px; }
.dark .wb-word-no { color:#9ca3af; }
.wb-clue { display:flex; gap:10px; align-items:flex-start; background:#fff; border:1.5px solid #e5e7eb;
  border-radius:16px; padding:14px; margin-bottom:14px; font-size:.95rem; color:#1f2937; }
.dark .wb-clue { background:#1f2937; border-color:#374151; color:#f3f4f6; }
.wb-slots { display:flex; gap:6px; justify-content:center; flex-wrap:wrap; margin-bottom:14px; min-height:44px; }
.wb-slot { width:38px; height:44px; border-radius:10px; border:2px dashed #a5b4fc; background:#eef2ff;
  display:flex; align-items:center; justify-content:center; font-weight:800; font-size:1.15rem; color:#312e81; }
.dark .wb-slot { background:#1e1b4b; border-color:#4338ca; color:#e0e7ff; }
.wb-slot.filled { border-style:solid; border-color:#6366f1; background:#fff; }
.dark .wb-slot.filled { background:#312e81; }
.wb-slots.right .wb-slot { border-color:#10b981; background:#ecfdf5; color:#065f46; }
.dark .wb-slots.right .wb-slot { background:#064e3b; color:#a7f3d0; }
.wb-slots.wrong .wb-slot { border-color:#ef4444; background:#fef2f2; color:#991b1b; }
.dark .wb-slots.wrong .wb-slot { background:#450a0a; color:#fecaca; }
.wb-slots.shake { animation:bq-shake .5s ease 1; }
.wb-tiles { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-bottom:14px; }
.wb-tile { width:44px; height:48px; border-radius:12px; background:#fbbf24; border:2px solid #d97706;
  color:#451a03; font-weight:800; font-size:1.2rem; box-shadow:0 3px 0 #b45309; cursor:pointer; }
.wb-tile:active { transform:translateY(2px); box-shadow:0 1px 0 #b45309; }
.wb-tile.used { opacity:.18; pointer-events:none; box-shadow:none; }
.wb-actions { display:flex; gap:10px; justify-content:center; margin-bottom:12px; }

/* ══ Island Explorer 🗺️ ═════════════════════════════════════════ */
.mg-card-ex { border-color:#34d399; background:linear-gradient(120deg,#ecfdf5,#f7fee7); }
.dark .mg-card-ex { background:linear-gradient(120deg,#052e16,#1a2e05); border-color:#047857; }
.mg-card-ex:hover { box-shadow:0 10px 26px rgba(16,185,129,.25); }
.ex-stage { max-width:560px; margin:0 auto; }
.ex-progress { font-weight:800; font-size:.85rem; color:#065f46; background:#d1fae5; border-radius:12px; padding:6px 12px; }
.dark .ex-progress { color:#a7f3d0; background:#064e3b; }
.ex-route { display:flex; align-items:center; justify-content:center; gap:2px; flex-wrap:wrap;
  background:#f0fdf4; border:1.5px solid #bbf7d0; border-radius:16px; padding:8px 6px; margin-bottom:12px; }
.dark .ex-route { background:#052e16; border-color:#166534; }
.ex-dot { font-size:.95rem; opacity:.45; padding:1px 2px; }
.ex-dot.done { opacity:1; }
.ex-dot.now { font-size:1.4rem; opacity:1; animation:mg-pop .4s ease; }
.ex-stop { display:flex; gap:12px; align-items:flex-start; background:#fff; border:1.5px solid #e5e7eb;
  border-radius:16px; padding:14px; margin-bottom:10px; }
.dark .ex-stop { background:#1f2937; border-color:#374151; }
.ex-stop-icon { font-size:2.2rem; flex:0 0 auto; }
.ex-stop-body { display:flex; flex-direction:column; gap:2px; min-width:0; }
.ex-stop-body b { color:#1f2937; font-size:1.05rem; }
.dark .ex-stop-body b { color:#f9fafb; }
.ex-stop-body > span { font-size:.82rem; color:#6b7280; }
.dark .ex-stop-body > span { color:#9ca3af; }
.ex-stop-body > .ex-district { font-weight:700; color:#047857; }
.dark .ex-stop-body > .ex-district { color:#34d399; }
.ex-clue { font-weight:700; color:#1f2937; background:#fefce8; border:1.5px solid #fde047;
  border-radius:14px; padding:12px 14px; margin-bottom:12px; font-size:.95rem; }
.dark .ex-clue { background:#3b2f14; border-color:#a16207; color:#fef9c3; }
.ex-explain { display:block; font-weight:500; font-size:.82rem; margin-top:4px; }
.ex-passport { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin-bottom:14px; }
@media (max-width:420px) { .ex-passport { grid-template-columns:repeat(2,1fr); } }
.ex-pass-cell { display:flex; flex-direction:column; align-items:center; gap:2px; background:#f9fafb;
  border:1.5px dashed #d1d5db; border-radius:12px; padding:8px 4px; }
.dark .ex-pass-cell { background:#111827; border-color:#374151; }
.ex-pass-cell b { font-size:.7rem; color:#374151; text-align:center; }
.dark .ex-pass-cell b { color:#d1d5db; }
.ex-pass-stamp { font-size:1rem; }

/* ── Number Ninja 🥷 - dark dojo, self-themed like .bq-stage ── */
.nj-stage { max-width:560px; margin:0 auto; border-radius:20px; padding:14px 12px 16px;
  display:flex; flex-direction:column; gap:10px;
  background:radial-gradient(120% 90% at 50% 0%, #292524 0%, #1c1917 60%, #0c0a09 100%);
  box-shadow:inset 0 0 60px rgba(0,0,0,.5); }
.nj-topbar { display:flex; align-items:center; gap:8px; }
.nj-belts { flex:1; min-width:0; display:flex; flex-wrap:wrap; justify-content:center; gap:4px; font-size:1rem; }
.nj-belts span { opacity:.25; transition:opacity .2s, transform .2s; }
.nj-belts span.done { opacity:1; }
.nj-belts span.now { opacity:1; transform:scale(1.3); }
.nj-lives { flex:0 0 auto; font-size:.8rem; letter-spacing:0; }
.nj-timerow { display:flex; align-items:center; gap:8px; }
.nj-timebar { flex:1; height:10px; border-radius:99px; background:rgba(255,255,255,.12); overflow:hidden; }
.nj-timebar-fill { height:100%; border-radius:99px; width:100%;
  background:linear-gradient(90deg,#fbbf24,#f87171); transition:width .1s linear; }
.nj-timebar-fill.low { background:#ef4444; animation:qf-pulse-bar .5s ease infinite; }
.nj-time-num { flex:0 0 auto; min-width:1.4em; text-align:center; color:#fde68a; font-weight:800; font-size:.85rem; }
.nj-qcard { position:relative; overflow:hidden; text-align:center; border-radius:16px; padding:24px 12px;
  background:linear-gradient(135deg,#7f1d1d,#991b1b); border:2px solid rgba(248,113,113,.6); }
.nj-qtext { font-size:1.9rem; font-weight:800; color:#fff; letter-spacing:.03em; }
.nj-qcard.sliced::after { content:''; position:absolute; left:-8%; right:-8%; top:50%; height:3px;
  background:linear-gradient(90deg,transparent,#fff,transparent); transform:rotate(-10deg);
  animation:nj-slash .4s ease-out both; }
@keyframes nj-slash { from { transform:rotate(-10deg) scaleX(0); opacity:1; } to { transform:rotate(-10deg) scaleX(1); opacity:.85; } }
.nj-opts { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.nj-opt { border-radius:14px; padding:16px 8px; font-weight:800; font-size:1.2rem; color:#fff;
  background:rgba(255,255,255,.08); border:2px solid rgba(255,255,255,.18); }
.nj-opt:active { transform:scale(.97); }
.nj-opt.right { background:#16a34a; border-color:#4ade80; }
.nj-opt.wrong { background:#b91c1c; border-color:#f87171; }
.nj-score-line { text-align:center; color:#d6d3d1; font-size:.78rem; }
.nj-score-line b { color:#fde047; }

/* ── Brain Battle ⚔️ - pass-the-phone duel ── */
.bb-stage { max-width:560px; margin:0 auto; display:flex; flex-direction:column; gap:10px; }
.bb-topbar { display:flex; align-items:center; gap:8px; }
.bb-round { flex:1; text-align:center; font-weight:800; font-size:.85rem; color:#6b7280; }
.dark .bb-round { color:#9ca3af; }
.bb-round.sudden { color:#dc2626; animation:mg-pop .4s ease; }
.bb-scores { display:flex; align-items:stretch; gap:8px; }
.bb-side { flex:1; display:flex; flex-direction:column; align-items:center; gap:1px; border-radius:14px;
  padding:8px 4px; border:2px solid transparent; opacity:.75; transition:opacity .2s, border-color .2s; }
.bb-side.p1 { background:#fef2f2; }
.bb-side.p2 { background:#eff6ff; }
.dark .bb-side.p1 { background:#450a0a; }
.dark .bb-side.p2 { background:#172554; }
.bb-side.active { opacity:1; }
.bb-side.p1.active { border-color:#f87171; }
.bb-side.p2.active { border-color:#60a5fa; }
.bb-face { font-size:1.3rem; }
.bb-side b { font-size:1.25rem; color:#1f2937; }
.dark .bb-side b { color:#f9fafb; }
.bb-side small { font-size:.66rem; font-weight:700; color:#6b7280; }
.dark .bb-side small { color:#9ca3af; }
.bb-vs { align-self:center; font-weight:900; font-size:.8rem; color:#9ca3af; }
.bb-handover { text-align:center; background:#fff; border:2px solid #e5e7eb; border-radius:18px; padding:26px 14px; }
.dark .bb-handover { background:#1f2937; border-color:#374151; }
.bb-handover-face { font-size:3rem; margin-bottom:6px; }
.bb-handover h3 { font-size:1.15rem; font-weight:800; color:#1f2937; margin-bottom:6px; }
.dark .bb-handover h3 { color:#f9fafb; }
.bb-handover p { font-size:.82rem; color:#6b7280; margin-bottom:14px; }
.dark .bb-handover p { color:#9ca3af; }
.bb-ready { width:100%; }
.bb-timerow { display:flex; align-items:center; gap:8px; }
.bb-timebar { flex:1; height:10px; border-radius:99px; background:#e5e7eb; overflow:hidden; }
.dark .bb-timebar { background:#374151; }
.bb-timebar-fill { height:100%; border-radius:99px; width:100%;
  background:linear-gradient(90deg,#818cf8,#6366f1); transition:width .1s linear; }
.bb-timebar-fill.low { background:#ef4444; animation:qf-pulse-bar .5s ease infinite; }
.bb-time-num { flex:0 0 auto; min-width:1.4em; text-align:center; font-weight:800; font-size:.85rem; color:#4f46e5; }
.dark .bb-time-num { color:#a5b4fc; }
.bb-turnline { text-align:center; font-weight:800; font-size:.85rem; color:#1f2937; }
.dark .bb-turnline { color:#f9fafb; }
.bb-source { font-size:.68rem; font-weight:700; color:#6b7280; text-align:center; margin-bottom:4px;
  text-transform:uppercase; letter-spacing:.05em; }
.dark .bb-source { color:#9ca3af; }
.bb-qcard { background:linear-gradient(135deg,#7c3aed,#4f46e5); color:#fff; border-radius:18px; padding:16px 14px; }
.bb-qtext { font-size:1rem; font-weight:700; line-height:1.4; }
.bb-qtext img, .bb-qtext svg { max-width:100%; height:auto; }
.bb-opts { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.bb-opt { display:flex; align-items:center; gap:9px; text-align:left; background:#fff;
  border:2px solid #e5e7eb; border-radius:14px; padding:12px 10px; font-weight:700; font-size:.9rem; color:#1f2937; }
.dark .bb-opt { background:#1f2937; border-color:#4b5563; color:#f9fafb; }
.bb-opt:active { transform:scale(.97); }
.bb-opt.right { border-color:#10b981; background:#ecfdf5; color:#065f46; }
.bb-opt.right .mg-tag { background:#10b981; color:#fff; }
.bb-opt.wrong { border-color:#ef4444; background:#fef2f2; color:#991b1b; }
.bb-opt.wrong .mg-tag { background:#ef4444; color:#fff; }
.mg-end .bb-scores { margin:6px 0 16px; }
.mg-end .bb-side { opacity:1; }

/* ── Time Traveller 🕰️ - sepia timeline ── */
.tt-stage { max-width:560px; margin:0 auto; display:flex; flex-direction:column; gap:10px; }
.tt-topbar { display:flex; align-items:center; gap:8px; }
.tt-round { flex:1; text-align:center; font-weight:800; font-size:.85rem; color:#92400e; }
.dark .tt-round { color:#fbbf24; }
.tt-score { display:flex; align-items:baseline; gap:3px; background:#fef3c7; border-radius:12px; padding:6px 12px; }
.dark .tt-score { background:#451a03; }
.tt-score b { font-size:1.05rem; color:#92400e; }
.dark .tt-score b { color:#fbbf24; }
.tt-score small { font-size:.66rem; font-weight:700; color:#b45309; }
.tt-timerow { display:flex; align-items:center; gap:8px; }
.tt-timebar { flex:1; height:10px; border-radius:99px; background:#e5e7eb; overflow:hidden; }
.dark .tt-timebar { background:#374151; }
.tt-timebar-fill { height:100%; border-radius:99px; width:100%;
  background:linear-gradient(90deg,#f59e0b,#d97706); transition:width .1s linear; }
.tt-timebar-fill.low { background:#ef4444; animation:qf-pulse-bar .5s ease infinite; }
.tt-time-num { flex:0 0 auto; min-width:1.4em; text-align:center; font-weight:800; font-size:.85rem; color:#b45309; }
.dark .tt-time-num { color:#fbbf24; }
.tt-prompt { text-align:center; font-size:.85rem; color:#6b7280; }
.dark .tt-prompt { color:#9ca3af; }
.tt-line { display:flex; flex-direction:column; gap:6px; min-height:44px; border-left:3px solid #d97706;
  padding:4px 0 4px 10px; margin-left:6px; }
.tt-line-hint { font-size:.78rem; color:#9ca3af; font-style:italic; }
.tt-slot { display:flex; align-items:center; gap:8px; background:#fffbeb; border:1.5px solid #fcd34d;
  border-radius:12px; padding:8px 10px; font-size:.85rem; font-weight:700; color:#78350f; text-align:left; }
.dark .tt-slot { background:#451a03; border-color:#92400e; color:#fde68a; }
.tt-no { flex:0 0 auto; width:22px; height:22px; border-radius:50%; background:#d97706; color:#fff;
  font-size:.72rem; font-weight:800; display:flex; align-items:center; justify-content:center; }
.tt-pool { display:flex; flex-direction:column; gap:8px; }
.tt-card { text-align:left; background:#fff; border:2px solid #e5e7eb; border-radius:14px; padding:12px 12px;
  font-weight:700; font-size:.88rem; color:#1f2937; }
.dark .tt-card { background:#1f2937; border-color:#4b5563; color:#f9fafb; }
.tt-card:active { transform:scale(.98); }
.tt-undo { align-self:center; font-size:.78rem; font-weight:700; color:#6b7280; background:#f3f4f6;
  border-radius:99px; padding:8px 16px; }
.dark .tt-undo { background:#374151; color:#d1d5db; }
.tt-undo:disabled { opacity:.4; }
.tt-verdict { text-align:center; font-weight:800; font-size:.95rem; color:#1f2937; background:#f3f4f6;
  border-radius:14px; padding:12px; display:flex; flex-direction:column; gap:2px; }
.dark .tt-verdict { background:#374151; color:#f9fafb; }
.tt-verdict.perfect { background:#fef3c7; color:#92400e; }
.dark .tt-verdict.perfect { background:#451a03; color:#fde68a; }
.tt-verdict b { font-size:1.3rem; }
.tt-reveal { display:flex; flex-direction:column; gap:6px; }
.tt-rev-row { display:flex; align-items:center; gap:8px; border-radius:12px; padding:8px 10px;
  font-size:.83rem; font-weight:600; }
.tt-rev-row.ok { background:#ecfdf5; color:#065f46; }
.tt-rev-row.no { background:#fef2f2; color:#991b1b; }
.dark .tt-rev-row.ok { background:#064e3b; color:#a7f3d0; }
.dark .tt-rev-row.no { background:#450a0a; color:#fecaca; }
.tt-year { flex:0 0 auto; font-weight:800; background:rgba(0,0,0,.08); border-radius:8px; padding:2px 7px; }
.dark .tt-year { background:rgba(255,255,255,.12); }
.tt-rev-label { flex:1; }
.tt-mark { flex:0 0 auto; font-weight:900; }
.tt-next { width:100%; }

/* ══ MiniGame help (How to play) ══════════════════════════════════════════ */
.mg-help-btn { width:40px; height:40px; border-radius:50%; flex:0 0 auto; font-weight:800;
  background:rgba(255,255,255,.12); color:#fff; border:1px solid rgba(255,255,255,.25); margin-left:6px; }
.mg-help-btn:hover { background:rgba(255,255,255,.22); }
/* On the light-stage games (Word Builder, Quick Fire hud) keep it readable */
.qf-hud .mg-help-btn, .wb-topbar .mg-help-btn { background:#eef2ff; color:#4f46e5; border-color:#c7d2fe; }
.dark .qf-hud .mg-help-btn, .dark .wb-topbar .mg-help-btn { background:#312e81; color:#c7d2fe; border-color:#4338ca; }
.mg-help-overlay { position:fixed; inset:0; z-index:80; display:flex; align-items:center; justify-content:center;
  padding:20px; background:rgba(8,12,30,.72); backdrop-filter:blur(3px); }
.mg-help-card { background:#fff; border-radius:22px; padding:22px 20px; max-width:440px; width:100%;
  max-height:88vh; overflow-y:auto; box-shadow:0 18px 50px rgba(0,0,0,.4); }
.dark .mg-help-card { background:#1f2937; }
.mg-help-head { display:flex; align-items:center; gap:10px; }
.mg-help-icon { font-size:2rem; }
.mg-help-head h3 { font-size:1.3rem; font-weight:800; color:#1f2937; }
.dark .mg-help-head h3 { color:#f9fafb; }
.mg-help-sub { font-weight:700; color:#4f46e5; margin:2px 0 12px; }
.dark .mg-help-sub { color:#a5b4fc; }
.mg-help-list { list-style:none; padding:0; margin:0 0 18px; display:flex; flex-direction:column; gap:11px; }
.mg-help-list li { font-size:.95rem; line-height:1.45; color:#374151; padding-left:2px; }
.dark .mg-help-list li { color:#e5e7eb; }
.mg-help-list li b { color:#1f2937; }
.dark .mg-help-list li b { color:#fff; }
.mg-help-close { width:100%; }

/* Hub cards on phones: squeezing the blurb between the icon and the PLAY chip
   left a one-word-per-line column, so the chip wraps onto its own row. Lives
   at the END of the file so it wins the cascade over the base .mg-card rules. */
@media (max-width:480px) {
  .mg-card { gap:8px 10px; flex-wrap:wrap; }
  .mg-card-art { font-size:2rem; }
  .mg-card-body { flex:1 1 70%; }
  .mg-card-go, .mg-card-lock { margin-left:auto; }
}

/* ── No-classroom notice - cork pin style ────────────────────────── */
.ta-no-classroom-notice {
  position: relative;
  background: linear-gradient(160deg, #fef9c3 0%, #fef08a 100%);
  border-radius: 4px 12px 12px 4px;
  padding: 2rem 1.6rem 1.6rem;
  text-align: center;
  box-shadow: 2px 4px 12px rgba(0,0,0,.15);
  margin-bottom: 1rem;
}
.ta-thumbtack {
  display: block;
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f44 0%, #c00 55%, #800 100%);
  box-shadow: 0 2px 5px rgba(0,0,0,.4), 0 -1px 0 rgba(255,255,255,.25) inset;
  z-index: 2;
}
.ta-thumbtack::after {
  content: '';
  display: block;
  position: absolute;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  width: 2px; height: 10px;
  background: linear-gradient(to bottom, #888, #555);
}
.ta-notice-pin-icon { display: none; }
.ta-notice-title {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  font-weight: 700;
  color: #713f12;
  margin-bottom: .4rem;
}
.ta-notice-body {
  font-size: .95rem;
  color: #92400e;
  line-height: 1.5;
  margin-bottom: 1.2rem;
}
.ta-notice-btn {
  background: linear-gradient(160deg, #2a4d28 0%, #1c3619 100%);
  color: #f0ece0;
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 5px;
  padding: .6rem 1.4rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #0f2010, 0 5px 10px rgba(0,0,0,.2);
  transition: transform .1s, box-shadow .1s;
  letter-spacing: .01em;
}
.ta-notice-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #0f2010, 0 8px 14px rgba(0,0,0,.25); }
.dark .ta-no-classroom-notice {
  background: linear-gradient(160deg, #3b2f02 0%, #4a3a05 100%);
}
.dark .ta-notice-title { color: #fde68a; }
.dark .ta-notice-body { color: #fef3c7; }

/* ── Classroom chip picker - mini chalkboard labels ──────────────── */
.ta-class-picker-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1rem;
}

/* ── Classroom chip picker - chalk labels on the board ───────────── */
.ta-class-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: .55rem 1rem;
  border-radius: 4px;
  border: 1.5px solid rgba(240,236,220,.45);
  background: rgba(255,255,255,.07);
  cursor: pointer;
  transition: border-color .14s, background .14s, transform .1s;
  text-align: left;
}
.ta-class-chip:hover {
  background: rgba(255,255,255,.13);
  border-color: rgba(240,236,220,.75);
  transform: translateY(-1px);
}
.ta-class-chip-sel {
  border-color: #e5bd3a !important;
  background: rgba(229,189,58,.18) !important;
  box-shadow: 0 0 0 2px rgba(229,189,58,.3) !important;
}

.ta-chip-name {
  font-family: 'Caveat', cursive;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f0ece0;
  line-height: 1.2;
  text-shadow: 0 0 8px rgba(240,236,220,.2);
}
.ta-chip-pupils {
  font-family: 'Caveat', cursive;
  font-size: .82rem;
  color: rgba(240,236,220,.55);
}
.ta-class-chip-sel .ta-chip-name { color: #fef9c3; }
.ta-class-chip-sel .ta-chip-pupils { color: rgba(254,249,195,.75); }

/* Open-link chip - slightly different (dashed border = "open") */
.ta-class-chip[data-cid=""] {
  border-style: dashed;
  border-color: rgba(240,236,220,.35);
  background: rgba(255,255,255,.04);
}
.ta-class-chip[data-cid=""].ta-class-chip-sel {
  border-style: solid;
  border-color: #e5bd3a !important;
}

.ta-chip-hint {
  width: 100%;
  font-family: 'Caveat', cursive;
  font-size: .95rem;
  color: rgba(240,236,220,.55);
  padding: .35rem .2rem 0;
  line-height: 1.5;
}
.dark .ta-chip-hint { color: rgba(232,220,200,.5); }

/* Tab content must stay hidden when .hidden is present - defensive override
   because style.css loads after the Tailwind CDN and a display rule here
   would outrank Tailwind's .hidden { display:none }. */
#screen-teacher .ta-tab-content.hidden,
#screen-student-home .ta-tab-content.hidden,
#screen-subject-hub .ta-tab-content.hidden { display: none; }

/* ── Blackboard classroom cards ───────────────────────────────────── */
.tc-boards-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 28px;
  padding: 4px 0 20px;
  align-items: flex-start;
}

/* Hanger assembly: nail → string → board */
.tc-board-hanger {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 168px;
}

/* Screw/nail in the wall */
.tc-board-nail {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #f0d070 0%, #c8960a 45%, #6b4e06 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.3);
  z-index: 2;
  margin-bottom: 0;
}

/* Two strings side by side for realism */
.tc-board-strings {
  display: flex;
  gap: 14px;
  height: 26px;
  align-items: flex-start;
}
.tc-board-string {
  width: 1.5px;
  height: 26px;
  background: linear-gradient(to bottom,
    #c8960a 0%, #a07810 30%, #c8a020 60%, #906010 100%);
  border-radius: 1px;
  box-shadow: 0.5px 0 1px rgba(0,0,0,.3);
}

/* ── The board itself ─────────────────────────────── */
.tc-board {
  position: relative;
  width: 168px;
  min-height: 140px;
  cursor: pointer;
  transition: transform .18s cubic-bezier(.2,.8,.3,1), box-shadow .18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;

  /* Thick wood frame using layered borders */
  border-radius: 4px;
  /* Outer frame shadow */
  box-shadow:
    0 6px 20px rgba(0,0,0,.5),
    0 2px 6px rgba(0,0,0,.35);

  /* Wood frame as padding + background clip */
  padding: 0;
}

/* Wood frame (outer ring) */
.tc-board::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  border: 10px solid transparent;
  /* Wood grain via layered gradients */
  background:
    repeating-linear-gradient(
      92deg,
      transparent 0px, transparent 3px,
      rgba(0,0,0,.06) 3px, rgba(0,0,0,.06) 4px
    ),
    linear-gradient(175deg,
      #7a4e1a 0%, #9b6828 18%, #6b3e10 35%,
      #8a5820 50%, #6b3e10 65%, #9b6828 82%, #7a4e1a 100%
    );
  background-clip: padding-box;
  pointer-events: none;
  z-index: 3;
  /* Cut out the inner area */
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  padding: 10px;
}

/* Inner chalkboard surface */
.tc-board-inner {
  position: absolute;
  inset: 10px;
  border-radius: 2px;
  background:
    /* subtle chalk smudges */
    radial-gradient(ellipse 55% 25% at 25% 35%, rgba(255,255,255,.04) 0%, transparent 70%),
    radial-gradient(ellipse 35% 18% at 75% 65%, rgba(255,255,255,.025) 0%, transparent 65%),
    radial-gradient(ellipse 20% 40% at 60% 20%, rgba(255,255,255,.02) 0%, transparent 60%),
    /* board colour */
    linear-gradient(158deg,
      #2e5230 0%, #1e3a22 25%,
      #264028 50%, #1c3420 75%,
      #203824 100%
    );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 10px 34px;
  overflow: hidden;
}

/* Faint horizontal chalk lines like a real ruled board */
.tc-board-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 22px,
    rgba(255,255,255,.025) 22px,
    rgba(255,255,255,.025) 23px
  );
  pointer-events: none;
}

.tc-board:hover {
  transform: translateY(-5px) rotate(-1deg);
  box-shadow:
    0 12px 28px rgba(0,0,0,.55),
    0 4px 10px rgba(0,0,0,.35);
}

/* Content inside the board */
.tc-board-emoji {
  font-size: 1.5rem;
  margin-bottom: 2px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.6));
}
.tc-board-name {
  font-family: 'Caveat', 'Comic Sans MS', cursive;
  font-size: 1.15rem;
  font-weight: 700;
  color: #eeeedd;
  /* Chalk look: multiple offset shadows give a rough edge */
  text-shadow:
    0 0 12px rgba(255,255,255,.18),
    -0.5px -0.5px 0 rgba(255,255,255,.12),
     0.5px  0.5px 0 rgba(0,0,0,.5),
    -0.5px  0.5px 0 rgba(255,255,255,.08),
     0.5px -0.5px 0 rgba(0,0,0,.4);
  line-height: 1.25;
  word-break: break-word;
  position: relative;
  z-index: 1;
  letter-spacing: .01em;
}
.tc-board-pupils {
  font-family: 'Caveat', cursive;
  font-size: .85rem;
  font-weight: 500;
  color: rgba(200,220,195,.55);
  margin-top: 4px;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.tc-board-archived {
  font-family: 'Caveat', cursive;
  font-size: .75rem;
  color: rgba(255,190,80,.6);
  margin-top: 2px;
  position: relative;
  z-index: 1;
  letter-spacing: .05em;
}

/* ── Chalk tray at the bottom ─────────────────────── */
.tc-board-tray {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  z-index: 4;
  /* Wood tray */
  background: linear-gradient(to bottom,
    #5c3810 0%, #4a2c08 40%, #3a2008 100%);
  border-top: 2px solid #7a5020;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

/* White chalk dust sitting in the tray */
.tc-board-tray::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 8px;
  right: 8px;
  height: 5px;
  background: linear-gradient(to right,
    transparent 0%, rgba(240,235,220,.3) 15%,
    rgba(240,235,220,.5) 40%, rgba(240,235,220,.2) 70%,
    transparent 100%);
  border-radius: 50%;
  filter: blur(1px);
}

.tc-board-tray button {
  font-size: .62rem;
  color: rgba(220,205,175,.75);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 3px;
  transition: background .12s, color .12s;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}
.tc-board-tray button:hover {
  background: rgba(255,255,255,.14);
  color: #fff;
}

/* ── "Add classroom" dashed board ─────────────────── */
.tc-board-add {
  min-height: 140px;
  background: transparent !important;
  box-shadow: none !important;
}
.tc-board-add::after { display: none; }
.tc-board-add .tc-board-inner {
  background: transparent;
  border: 2.5px dashed rgba(100,160,100,.45);
  border-radius: 4px;
}
.tc-board-add:hover .tc-board-inner {
  border-color: rgba(130,200,130,.75);
  background: rgba(50,90,50,.12);
}
.tc-board-add .tc-board-name {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: rgba(150,200,150,.65);
  text-shadow: none;
}
.tc-board-add:hover .tc-board-name { color: rgba(180,230,180,.85); }
.tc-board-add:hover { transform: translateY(-3px); }

@media (max-width: 480px) {
  .tc-board-hanger { width: 148px; }
  .tc-board { width: 148px; min-height: 128px; }
  .tc-board-inner { padding: 10px 8px 32px; }
  .tc-board-name { font-size: 1rem; }
  .tc-boards-wrap { gap: 24px 16px; }
  .tc-board-strings { gap: 10px; }
}

/* ── Classroom home - clear, modern teaching dashboard ───────────── */
.tc-classroom-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .65rem;
}
.tc-classroom-heading h3 { margin: .1rem 0 0; font-size: 1.65rem !important; }
.tc-classroom-kicker {
  display: block;
  color: #b7e6b4;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .13em;
}
.tc-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem .8rem;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px;
  color: #eef8ed;
  background: rgba(255,255,255,.09);
  font-weight: 750;
  font-size: .82rem;
  transition: background .15s, transform .15s;
}
.tc-refresh-btn:hover { background: rgba(255,255,255,.16); transform: translateY(-1px); }

#screen-teacher .teacher-class-create {
  display: grid;
  grid-template-columns: minmax(210px, 1.1fr) minmax(220px, 1.4fr) auto;
  gap: .8rem;
  padding: .9rem;
  margin: 1rem 0 1.15rem;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  background: rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
.tc-quick-create-copy { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.tc-quick-create-copy > span {
  display: grid; place-items: center; flex: 0 0 38px; height: 38px;
  border-radius: 11px; color: #2d1f04; background: #f4ce52;
  font-size: 1.35rem; font-weight: 900;
}
.tc-quick-create-copy strong, .tc-quick-create-copy small { display: block; }
.tc-quick-create-copy strong { color: #fff; font-size: .91rem; }
.tc-quick-create-copy small { margin-top: 2px; color: rgba(240,236,220,.66); font-size: .72rem; line-height: 1.25; }
#screen-teacher .teacher-class-create input { width: 100%; min-width: 0; }
#screen-teacher .teacher-class-create .ta-btn-pencil { justify-content: center; border-radius: 10px; padding-inline: 1rem; font-family: inherit; font-size: .9rem; }

.tc-class-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .7rem;
  margin: .25rem 0 1.15rem;
}
.tc-class-overview > div {
  display: grid;
  grid-template-columns: 34px auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: .65rem;
  min-width: 0;
  padding: .75rem .9rem;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  background: rgba(5,25,10,.2);
}
.tc-overview-icon { grid-row: 1 / 3; font-size: 1.45rem; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.tc-class-overview strong { color: #fff; font-size: 1.15rem; line-height: 1; }
.tc-class-overview small { overflow: hidden; color: rgba(240,236,220,.68); font-size: .72rem; white-space: nowrap; text-overflow: ellipsis; }

.tc-class-empty {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: .5rem 0 1rem;
  padding: 1rem;
  border: 1px dashed rgba(252,211,77,.45);
  border-radius: 15px;
  background: rgba(252,211,77,.08);
}
.tc-class-empty > span { font-size: 1.8rem; }
.tc-class-empty strong { display: block; color: #fef3c7; }
#screen-teacher .ta-tab-content .tc-class-empty p { margin: .15rem 0 0; color: rgba(240,236,220,.7) !important; font-size: .82rem; }

.tc-boards-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 32px 28px;
  padding: 4px 0 20px;
}
.tc-board-hanger { width: 210px; }
.tc-board { width: 210px; min-height: 178px; }
.tc-board-inner { padding: 21px 13px 39px; }
.tc-board-active {
  position: absolute;
  top: 9px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #bbf7d0;
  font: 700 .62rem/1 system-ui, sans-serif;
}
.tc-board-active i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74,222,128,.13);
}
.tc-board-access {
  position: relative;
  z-index: 1;
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  color: rgba(220,235,215,.68);
  font: 600 .62rem/1.2 system-ui, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tc-board-tray { height: 34px; }
.tc-board-tray button { min-height: 28px; font-size: .68rem; }
.tc-board-hanger:focus-visible .tc-board { outline: 3px solid #fcd34d; outline-offset: 4px; }
.tc-board-add-hanger {
  appearance: none;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
}
.tc-class-card {
  --tc-accent: #34a853;
  position: relative;
  min-width: 0;
  min-height: 230px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #d2c4b1;
  border-radius: 19px;
  color: #172033;
  background: #eee5d8;
  box-shadow: 0 9px 24px rgba(0,0,0,.22);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.dark .tc-class-card {
  border-color: #465568;
  color: #f1f5f9;
  background: #202b3a;
  box-shadow: 0 9px 24px rgba(0,0,0,.38);
}
.tc-class-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 7px; background: var(--tc-accent); }
.tc-class-card::after {
  content: '';
  position: absolute; top: -55px; right: -50px;
  width: 150px; height: 150px; border-radius: 50%;
  background: color-mix(in srgb, var(--tc-accent) 11%, transparent);
  pointer-events: none;
}
.tc-class-card:hover { transform: translateY(-4px); box-shadow: 0 15px 32px rgba(0,0,0,.28); }
.tc-class-card:focus-visible { outline: 3px solid #fcd34d; outline-offset: 3px; }
.tc-class-tone-0 { --tc-accent: #3b82f6; }
.tc-class-tone-1 { --tc-accent: #8b5cf6; }
.tc-class-tone-2 { --tc-accent: #10b981; }
.tc-class-tone-3 { --tc-accent: #f97316; }
.tc-class-tone-4 { --tc-accent: #ec4899; }
.tc-class-tone-5 { --tc-accent: #0ea5e9; }
.tc-class-card-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 18px 8px; position: relative; z-index: 1; }
.tc-class-card-icon {
  display: grid; place-items: center; width: 48px; height: 48px;
  border-radius: 15px;
  background: color-mix(in srgb, var(--tc-accent) 17%, #e8dece);
  font-size: 1.55rem;
}
.dark .tc-class-card-icon { background: color-mix(in srgb, var(--tc-accent) 24%, #273449); }
.tc-class-live { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; color: #18733b; background: #e9f9ef; font-size: .68rem; font-weight: 800; }
.dark .tc-class-live { color: #bbf7d0; background: #163d2a; }
.tc-class-live i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.13); }
.tc-class-card-body { flex: 1; padding: 7px 18px 15px; position: relative; z-index: 1; }
#screen-teacher .ta-tab-content .tc-class-card h4 { margin: 0 0 5px; color: #172033; font-family: inherit; font-size: 1.12rem; line-height: 1.25; text-shadow: none; }
#screen-teacher .ta-tab-content .tc-class-card p { margin: 0 0 10px; color: #526076 !important; font-size: .83rem; }
.tc-class-card-body p strong { color: #172033 !important; font-size: 1.05rem; }
.dark #screen-teacher .ta-tab-content .tc-class-card h4 { color: #f1f5f9; }
.dark #screen-teacher .ta-tab-content .tc-class-card p { color: #cbd5e1 !important; }
.dark .tc-class-card-body p strong { color: #f8fafc !important; }
.tc-class-access { display: inline-flex; max-width: 100%; padding: 5px 8px; border-radius: 8px; color: #526076; background: #e1d7c9; font-size: .7rem; font-weight: 700; }
.dark .tc-class-access { color: #cbd5e1; background: #303d50; }
.tc-class-card-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 5px; padding: 11px 12px; border-top: 1px solid #d4c7b6; background: #e5dbce; }
.dark .tc-class-card-actions { border-color: #3e4c60; background: #192332; }
.tc-class-card-actions button { border: 0; border-radius: 9px; min-height: 36px; }
.tc-class-open { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; color: #fff; background: var(--tc-accent); font-size: .78rem; font-weight: 850; }
.tc-class-open span { font-size: 1rem; }
.tc-class-icon-btn { width: 36px; color: #475569; background: #d5cabb; font-size: .82rem; }
.tc-class-icon-btn:hover { background: #c9bcaa; }
.dark .tc-class-icon-btn { color: #dbe5f2; background: #344258; }
.dark .tc-class-icon-btn:hover { background: #42536d; }

.tc-class-add {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: 1.4rem;
  border: 2px dashed rgba(190,230,190,.42);
  border-radius: 19px;
  color: #e5f5e3;
  background: rgba(255,255,255,.045);
  text-align: center;
  transition: background .15s, border-color .15s, transform .15s;
}
.tc-class-add:hover { transform: translateY(-3px); border-color: rgba(190,230,190,.75); background: rgba(255,255,255,.09); }
.tc-class-add-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: #1f3c21; background: #dff3dc; font-size: 1.7rem; }
.tc-class-add strong { font-size: .95rem; }
.tc-class-add small { max-width: 190px; color: rgba(240,236,220,.62); font-size: .74rem; line-height: 1.35; }

@media (max-width: 760px) {
  #screen-teacher .teacher-class-create { grid-template-columns: 1fr; }
  .tc-class-overview { grid-template-columns: repeat(3, minmax(105px, 1fr)); overflow-x: auto; padding-bottom: 3px; }
  .tc-class-overview > div { min-width: 105px; grid-template-columns: 1fr; grid-template-rows: auto; text-align: center; }
  .tc-overview-icon { grid-row: auto; }
  .tc-class-overview small { white-space: normal; }
}
@media (max-width: 520px) {
  .tc-classroom-heading { align-items: center; }
  .tc-refresh-btn span { display: none; }
  .tc-refresh-btn { width: 40px; height: 40px; justify-content: center; padding: 0; font-size: 1.1rem; }
  .tc-boards-wrap { justify-content: center; gap: 24px 16px; }
  .tc-board-hanger, .tc-board { width: min(210px, 76vw); }
}

/* ══ Classroom Detail Overlay - chalkboard theme ════════════════════ */
@keyframes tc-cd-slide-in {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.tc-cd-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(240,236,220,.055) 27px,
      rgba(240,236,220,.055) 28px
    ),
    linear-gradient(135deg, #2e5230 0%, #1d3a1f 50%, #243f26 100%);
  overflow: hidden;
  animation: tc-cd-slide-in .28s cubic-bezier(.22,.61,.36,1) both;
}
.dark .tc-cd-overlay {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(255,255,255,.035) 27px,
      rgba(255,255,255,.035) 28px
    ),
    linear-gradient(135deg, #111 0%, #0c0c0c 100%);
}
.tc-cd-overlay.hidden { display: none; animation: none; }

/* ── Header (chalkboard green - already matches home tab) ─────────── */
.tc-cd-header {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .9rem 1.2rem;
  background:
    radial-gradient(circle at 75% 0%, rgba(255,255,255,.12), transparent 32%),
    linear-gradient(120deg, #244f34 0%, #173a27 58%, #102b20 100%);
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  flex-shrink: 0;
}
.tc-cd-back {
  font-size: .9rem;
  font-weight: 600;
  color: rgba(240,236,220,.85);
  background: none;
  border: 1px solid rgba(240,236,220,.3);
  border-radius: 6px;
  padding: .3rem .75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s;
  font-family: 'Caveat', cursive;
}
.tc-cd-back:hover { background: rgba(255,255,255,.12); color: #f0ece0; }
.tc-cd-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.45rem;
  font-weight: 700;
  color: #f0ece0;
  font-family: 'Caveat', cursive;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tc-cd-title #tc-cd-emoji {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 13px;
  background: rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  font-size: 1.35rem;
}
.tc-cd-share-btn {
  font-size: .88rem;
  font-weight: 600;
  color: #f0ece0;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(240,236,220,.3);
  border-radius: 8px;
  padding: .35rem .9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s;
}
.tc-cd-share-btn:hover { background: rgba(255,255,255,.22); }

/* ── Stats strip - chalk numbers on a dark ledge ─────────────────── */
.tc-cd-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
  padding: .65rem 1.2rem;
  background: #183425;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(240,236,220,.1);
}
.dark .tc-cd-stats { background: rgba(0,0,0,.35); }
.tc-cd-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .55rem .6rem;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 11px;
  background: rgba(255,255,255,.055);
}
.tc-cd-stat:last-child { border-right: 1px solid rgba(255,255,255,.1); }
.tc-cd-stat strong {
  font-size: 1.3rem;
  font-weight: 700;
  color: #f0ece0;
  font-family: 'Caveat', cursive;
  line-height: 1;
}
.tc-cd-stat span {
  font-size: .72rem;
  color: rgba(240,236,220,.6);
  margin-top: 1px;
}

.tc-cd-body { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar nav - darker chalkboard strip ───────────────────────── */
.tc-cd-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: .9rem .55rem;
  background: rgba(7,24,12,.32);
  border-right: 1px solid rgba(240,236,220,.1);
  width: 92px;
  flex-shrink: 0;
  overflow-y: auto;
}
.tc-cd-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: .7rem .35rem;
  border-radius: 11px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  color: rgba(240,236,220,.65);
  font-size: .9rem;
  transition: background .12s, color .12s, border-color .12s;
}
.tc-cd-nav-btn span { font-size: .7rem; line-height: 1; font-family: 'Caveat', cursive; }
.tc-cd-nav-btn:hover { background: rgba(255,255,255,.1); color: #f0ece0; border-color: rgba(240,236,220,.2); }
.tc-cd-nav-active { background: #f4ce52 !important; color: #2d270e !important; border-color: #ffe68c !important; box-shadow: 0 5px 13px rgba(0,0,0,.2); }

/* ── Content area - same chalkboard surface as the home tabs ─────── */
.tc-cd-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  background: transparent;
}

/* On very small screens the sections stack their emoji OVER a smaller label
   rather than dropping the label. An emoji alone is a guess, and "which one of
   these is where my files go" is precisely the question this nav has to answer.
   ⚠ Specificity, not order: the max-width:700px block further down this file
   turns these buttons into rows and would otherwise win at 360px. The old
   `width: 52px` here was already dead for the same reason - that block sets
   `width: auto`. */
@media (max-width: 430px) {
  .tc-cd-nav { padding: .5rem .3rem; gap: 1px; }
  .tc-cd-nav .tc-cd-nav-btn { flex-direction: column; gap: 2px; padding: .42rem .3rem; }
  .tc-cd-nav .tc-cd-nav-btn span { font-size: .62rem; }
  .tc-cd-content { padding: .75rem .8rem; }
}

/* ── Section titles & headers ────────────────────────────────────── */
.tc-cd-section { padding-bottom: 2rem; }
.tc-cd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid rgba(240,236,220,.18);
}
.tc-cd-section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #f0ece0;
  font-family: 'Caveat', cursive;
  text-shadow: 0 0 10px rgba(240,236,220,.2);
  margin: 0;
}

/* ── Classroom command centre ────────────────────────────────────── */
.tc-today-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 17px;
  background:
    radial-gradient(circle at 80% 0%, rgba(252,211,77,.13), transparent 32%),
    rgba(255,255,255,.07);
}
.tc-today-kicker { color: #fcd34d; font-size: .65rem; font-weight: 900; letter-spacing: .13em; }
.tc-today-hero h3 { margin: .12rem 0 0; color: #fff; font-size: 1.55rem; font-weight: 850; }
.tc-today-hero p { margin: .1rem 0 0; color: rgba(240,236,220,.68); font-size: .82rem; }
.tc-today-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.tc-setup-help,
.tc-setup-skip {
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  padding: .55rem .72rem;
  color: #f0ece0;
  background: rgba(0,0,0,.2);
  font: inherit;
  font-size: .72rem;
  font-weight: 800;
}
.tc-setup-help:hover,
.tc-setup-skip:hover { border-color: rgba(252,211,77,.6); background: rgba(252,211,77,.12); }
.tc-setup-guide {
  overflow: hidden;
  border: 1px solid rgba(252,211,77,.42);
  border-radius: 19px;
  padding: 1.1rem;
  background:
    radial-gradient(circle at 92% -5%, rgba(252,211,77,.18), transparent 35%),
    linear-gradient(145deg, rgba(24,67,39,.96), rgba(10,35,21,.96));
  box-shadow: 0 16px 38px rgba(0,0,0,.18);
}
.tc-setup-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.tc-setup-head h3 { margin: .14rem 0 .12rem; color: #fff; font-size: clamp(1.25rem,3vw,1.7rem); }
.tc-setup-head p { max-width: 650px; margin: 0; color: rgba(240,236,220,.76); font-size: .78rem; line-height: 1.5; }
.tc-setup-kicker { color: #fcd34d; font-size: .65rem; font-weight: 900; letter-spacing: .13em; }
.tc-setup-flow { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .75rem; }
.tc-setup-step {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 245px;
  padding: .9rem;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 15px;
  background: rgba(5,24,13,.42);
}
.tc-setup-current { border-color: rgba(252,211,77,.72); background: rgba(66,50,11,.38); box-shadow: inset 0 0 0 1px rgba(252,211,77,.08); }
.tc-setup-done { border-color: rgba(134,239,172,.42); background: rgba(15,67,37,.45); }
.tc-setup-upcoming { border-style: dashed; }
.tc-setup-step-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.tc-setup-number { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; color: #302408; background: #fcd34d; font-size: .78rem; font-weight: 950; }
.tc-setup-done .tc-setup-number { color: #10351e; background: #86efac; }
.tc-setup-upcoming .tc-setup-number { color: #f0ece0; background: rgba(255,255,255,.13); }
.tc-setup-icon { font-size: 1.35rem; }
.tc-setup-step-copy { flex: 1; padding: .85rem 0; }
.tc-setup-step-copy small { color: #fde68a; font-size: .59rem; font-weight: 900; letter-spacing: .1em; }
.tc-setup-done .tc-setup-step-copy small { color: #bbf7d0; }
.tc-setup-step-copy h4 { margin: .18rem 0 .35rem; color: #fff; font-size: .96rem; line-height: 1.25; }
.tc-setup-step-copy p { margin: 0; color: rgba(240,236,220,.76); font-size: .72rem; line-height: 1.5; }
.tc-setup-step > button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: .55rem .65rem;
  color: #302408;
  background: #fcd34d;
  font: inherit;
  font-size: .69rem;
  font-weight: 900;
}
.tc-setup-step > button:hover { filter: brightness(1.07); }
.tc-setup-done > button { color: #10351e; background: #bbf7d0; }
.tc-setup-wait { display: grid; min-height: 44px; place-items: center; border-radius: 10px; color: rgba(240,236,220,.67); background: rgba(255,255,255,.07); font-size: .66rem; text-align: center; }
.tc-setup-reassure { display: flex; align-items: flex-start; gap: .5rem; margin: .85rem 0 0; padding: .75rem .85rem; border-radius: 12px; color: rgba(240,236,220,.78); background: rgba(255,255,255,.07); font-size: .72rem; line-height: 1.45; }
.tc-setup-reassure b { color: #fff; }
.tc-today-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: .65rem;
  margin-bottom: .75rem;
}
.tc-today-stats > div {
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto;
  column-gap: .65rem;
  align-items: center;
  min-width: 0;
  padding: .75rem;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 14px;
  background: rgba(9,28,14,.25);
}
.tc-today-stats span { grid-row: 1 / 3; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; font-weight: 900; }
.tc-today-stats span.blue { background: rgba(59,130,246,.22); }
.tc-today-stats span.green { color: #bbf7d0; background: rgba(34,197,94,.2); }
.tc-today-stats span.amber { background: rgba(245,158,11,.2); }
.tc-today-stats span.purple { background: rgba(168,85,247,.2); }
.tc-today-stats strong { color: #fff; font-size: 1.2rem; line-height: 1; }
.tc-today-stats small { overflow: hidden; color: rgba(240,236,220,.62); font-size: .68rem; white-space: nowrap; text-overflow: ellipsis; }
.tc-today-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.tc-today-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 15px;
  background: rgba(7,24,12,.27);
}
.tc-today-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .75rem .85rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.tc-today-panel-head > div { display: flex; align-items: center; gap: .45rem; }
.tc-today-panel-head h4 { margin: 0; color: #fff; font-family: inherit; font-size: .88rem; }
.tc-today-panel-head small { color: rgba(240,236,220,.48); font-size: .64rem; }
.tc-today-panel-head button { border: 0; border-radius: 8px; padding: .35rem .55rem; color: #fde68a; background: rgba(252,211,77,.1); font-size: .68rem; font-weight: 750; }
.tc-activity-row, .tc-attention-row { display: flex; align-items: center; gap: .65rem; padding: .65rem .8rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.tc-activity-row:last-child, .tc-attention-row:last-child { border-bottom: 0; }
.tc-activity-avatar { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 31px; border-radius: 50%; color: #203623; background: #d9f3d8; font-size: .76rem; font-weight: 900; }
.tc-activity-row > div, .tc-attention-row > div { flex: 1; min-width: 0; }
.tc-activity-row strong, .tc-activity-row small, .tc-attention-row strong, .tc-attention-row small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tc-activity-row strong, .tc-attention-row strong { color: #f5f7f5; font-size: .76rem; }
.tc-activity-row small, .tc-attention-row small { margin-top: 2px; color: rgba(240,236,220,.55); font-size: .65rem; }
.tc-activity-row time { flex: none; color: rgba(240,236,220,.45); font-size: .62rem; }
.tc-attention-row > span { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 31px; border-radius: 9px; background: rgba(245,158,11,.13); }
.tc-today-loading, .tc-today-empty { margin: 0; padding: 1rem; color: rgba(240,236,220,.55); font-size: .75rem; text-align: center; }
.tc-today-good { color: #bbf7d0; }

.tc-quick-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; margin: .85rem 0 1.35rem; }
.tc-quick-actions button {
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: .65rem;
  padding: .7rem .8rem;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 13px;
  color: #fff;
  background: rgba(255,255,255,.065);
  text-align: left;
  transition: transform .14s, background .14s;
}
.tc-quick-actions button:hover { transform: translateY(-2px); background: rgba(255,255,255,.11); }
.tc-quick-actions span { grid-row: 1 / 3; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.1); font-size: 1.15rem; }
.tc-quick-actions strong { font-size: .76rem; }
.tc-quick-actions small { color: rgba(240,236,220,.53); font-size: .62rem; }
.tc-work-heading > div > p { margin: 1px 0 0; color: rgba(240,236,220,.53); font-size: .72rem; }
.tc-work-empty { display: flex; flex-direction: column; align-items: center; padding: 1.6rem; border: 1px dashed rgba(255,255,255,.2); border-radius: 15px; text-align: center; }
.tc-work-empty > span { font-size: 2rem; }
.tc-work-empty strong { color: #fff; }
.tc-work-empty p { margin: .2rem 0 .7rem; color: rgba(240,236,220,.58); font-size: .75rem; }
.tc-work-empty button { border: 0; border-radius: 9px; padding: .55rem .75rem; color: #2d1f04; background: #f4ce52; font-weight: 800; font-size: .75rem; }
.tc-cd-content .ta-copybook-wrap { display: grid; grid-template-columns: repeat(auto-fill,minmax(205px,1fr)); gap: .8rem; }
.tc-cd-content .ta-copybook { width: auto; min-height: 230px; }
.tc-work-progress { overflow: hidden; height: 6px; margin-top: 8px; border-radius: 999px; background: #e2e8f0; }
.tc-work-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#22c55e,#16a34a); }
.tc-work-progress-label { display: block; margin-top: 3px; color: #64748b; font-size: .62rem; }
.dark .tc-work-progress-label { color: #94a3b8; }

.tc-pupil-overview { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .75rem; padding: .7rem .8rem; border: 1px solid rgba(255,255,255,.13); border-radius: 13px; background: rgba(255,255,255,.06); }
.tc-pupil-overview > div strong, .tc-pupil-overview > div small { display: block; }
.tc-pupil-overview > div strong { color: #fff; font-size: 1.15rem; }
.tc-pupil-overview > div small { color: rgba(240,236,220,.58); font-size: .67rem; }
.tc-pupil-overview label { display: flex; align-items: center; gap: .35rem; width: min(240px,55%); padding: 0 .55rem; border: 1px solid rgba(255,255,255,.15); border-radius: 10px; background: rgba(0,0,0,.14); }
.tc-pupil-overview input { width: 100%; min-width: 0; border: 0; outline: 0; padding: .5rem .15rem; color: #fff; background: transparent; font-size: .76rem; }
.tc-pupil-overview input::placeholder { color: rgba(240,236,220,.42); }
.tc-cd-register-row { gap: .7rem; }
.tc-pupil-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px; color: #234329; background: #d8efd8; font-weight: 900; font-size: .78rem; }
.tc-cd-register-name small { display: block; margin-top: 1px; color: rgba(240,236,220,.43); font-size: .62rem; font-family: inherit; font-weight: 500; }

@media (max-width: 760px) {
  .tc-setup-flow { grid-template-columns: 1fr; }
  .tc-setup-step { min-height: 0; }
  .tc-today-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .tc-today-columns { grid-template-columns: 1fr; }
  .tc-quick-actions { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .tc-today-hero { align-items: flex-start; flex-direction: column; }
  .tc-today-actions { width: 100%; }
  .tc-today-actions > button { flex: 1 1 145px; }
  .tc-setup-head { flex-direction: column; }
  .tc-setup-skip { width: 100%; }
  .tc-setup-guide { padding: .85rem; }
  .tc-today-hero .tc-cd-action-btn { padding: .55rem .65rem; font-size: .75rem; }
  .tc-today-hero h3 { font-size: 1.25rem; }
  .tc-today-stats > div { grid-template-columns: 31px 1fr; padding: .6rem; }
  .tc-today-stats span { width: 31px; height: 31px; }
  .tc-pupil-overview { align-items: stretch; flex-direction: column; }
  .tc-pupil-overview label { width: 100%; }
}

/* ── Pencil-yellow action button (matches teacher home) ──────────── */
.tc-cd-action-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .88rem;
  font-weight: 700;
  color: #2a1a00;
  background: linear-gradient(180deg,#f0ca50,#e5bd3a);
  border: none;
  border-radius: 8px;
  padding: .4rem .9rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #8a6a10, 0 4px 8px rgba(0,0,0,.18);
  transition: transform .1s, box-shadow .1s;
  white-space: nowrap;
  font-family: 'Caveat', cursive;
  letter-spacing: .01em;
}
.tc-cd-action-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 #8a6a10, 0 6px 12px rgba(0,0,0,.2); }
.tc-cd-action-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #8a6a10; }

/* ── Status / empty / error ─────────────────────────────────────── */
.tc-cd-loading { color: rgba(240,236,220,.55); font-size: 1rem; }
.tc-cd-err     { color: #fca5a5; font-size: 1rem; }
.tc-cd-empty   { color: rgba(240,236,220,.45); font-size: 1rem; margin: .5rem 0 1rem; }

/* ── Tip box - sticky-note yellow (matches teacher home) ─────────── */
.tc-cd-tip {
  background: linear-gradient(135deg, #fffde7, #fff9c4);
  border-left: 3px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  padding: .6rem .9rem;
  font-size: .9rem;
  color: #78350f;
  margin-top: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.tc-cd-tip-text { font-size: .9rem; color: rgba(240,236,220,.7); margin: .3rem 0 .6rem; }

/* ── Shared-PIN classroom banner ─────────────────────────────────── */
.tc-cd-shared-pin-banner { background: rgba(0,0,0,.22); border: 2px solid rgba(251,191,36,.4); border-radius: 1rem; padding: 1.2rem 1.4rem; margin-bottom: 1rem; text-align: center; }
.tc-cd-shared-pin-label { font-size: .8rem; color: rgba(240,236,220,.75); font-weight: 700; letter-spacing: .04em; margin-bottom: .5rem; }
.tc-cd-big-pin { font-size: 3rem; font-weight: 900; letter-spacing: .35em; font-family: monospace; color: #fbbf24; line-height: 1; }
.tc-cd-shared-pin-hint { font-size: .8rem; color: rgba(240,236,220,.65); margin-top: .75rem; }

/* ── Per-student PIN reveal toolbar ──────────────────────────────── */
.tc-cd-pins-toolbar { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.tc-cd-pins-note { font-size: .78rem; color: rgba(240,236,220,.65); }
.tc-cd-student-pin-badge { font-family: monospace; font-size: .9rem; font-weight: 700; background: rgba(251,191,36,.15); border: 1px solid rgba(251,191,36,.4); color: #fbbf24; border-radius: .4rem; padding: .1rem .5rem; margin-left: .5rem; letter-spacing: .08em; }

/* ── New Classroom Form ───────────────────────────────────────────── */
.ncf-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.ncf-overlay.hidden { display: none; }
.ncf-panel { background: linear-gradient(145deg, #2e5230 0%, #1d3a1f 60%, #2a4a28 100%); border: 2px solid rgba(240,236,220,.2); border-radius: 1.25rem; padding: 1.5rem; max-width: 460px; width: 100%; color: #f0ece8; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.55); }
.ncf-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.ncf-header h3 { font-family: 'Caveat', cursive; font-size: 1.6rem; color: #f0ece8; margin: 0; }
.ncf-close { background: rgba(255,255,255,.1); border: none; color: #f0ece8; border-radius: .5rem; width: 2rem; height: 2rem; cursor: pointer; font-size: 1rem; line-height: 1; }
.ncf-close:hover { background: rgba(255,255,255,.2); }
.ncf-field { margin-bottom: 1rem; }
.ncf-field > label { display: block; font-size: .8rem; color: rgba(240,236,220,.75); margin-bottom: .35rem; font-weight: 600; letter-spacing: .03em; }
.ncf-input { width: 100%; background: rgba(0,0,0,.25); border: 1px solid rgba(240,236,220,.25); border-radius: .6rem; color: #f0ece8; padding: .55rem .75rem; font-size: .95rem; box-sizing: border-box; }
.ncf-input:focus { outline: none; border-color: rgba(240,236,220,.6); }
.ncf-input-sm { max-width: 100px; }
.ncf-count-note { font-size: .75rem; color: rgba(240,236,220,.55); margin-left: .5rem; }
.ncf-toggle-group { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.ncf-toggle-opt { display: flex; flex-direction: column; gap: .2rem; background: rgba(0,0,0,.2); border: 2px solid rgba(240,236,220,.15); border-radius: .75rem; padding: .75rem; cursor: pointer; transition: border-color .15s, background .15s; }
.ncf-toggle-opt:has(input:checked) { border-color: rgba(240,236,220,.6); background: rgba(255,255,255,.08); }
.ncf-toggle-opt input[type="radio"] { display: none; }
.ncf-toggle-opt span { font-size: .9rem; font-weight: 700; color: #f0ece8; }
.ncf-toggle-opt small { font-size: .72rem; opacity: .7; color: #f0ece8; }
.ncf-warning { background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.35); border-radius: .6rem; padding: .65rem .85rem; font-size: .8rem; color: #fef3c7; margin-bottom: 1rem; line-height: 1.5; }
.ncf-warning.hidden { display: none; }
.ncf-pin-preview { margin-bottom: 1rem; }
.ncf-pin-preview > label { display: block; font-size: .8rem; color: rgba(240,236,220,.75); margin-bottom: .4rem; font-weight: 600; }
.ncf-big-pin { font-size: 2.5rem; font-weight: 900; letter-spacing: .3em; font-family: monospace; color: #fbbf24; background: rgba(0,0,0,.3); border-radius: .75rem; padding: .5rem 1rem; display: inline-block; margin: .35rem .35rem .35rem 0; }
.ncf-btn-ghost { background: none; border: 1px solid rgba(240,236,220,.3); color: rgba(240,236,220,.8); border-radius: .5rem; padding: .3rem .7rem; font-size: .8rem; cursor: pointer; }
.ncf-btn-ghost:hover { border-color: rgba(240,236,220,.6); }
.ncf-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }
.ncf-btn-cancel { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); color: #f0ece8; border-radius: .6rem; padding: .55rem 1rem; cursor: pointer; font-size: .9rem; }
.ncf-btn-cancel:hover { background: rgba(255,255,255,.15); }
.ncf-btn-create { background: linear-gradient(135deg, #16a34a, #15803d); border: none; color: #fff; border-radius: .6rem; padding: .55rem 1.25rem; font-weight: 700; cursor: pointer; font-size: .9rem; }
.ncf-btn-create:disabled { opacity: .5; cursor: default; }
.ncf-btn-create:not(:disabled):hover { background: linear-gradient(135deg, #15803d, #166534); }
.ncf-err { color: #fca5a5; font-size: .82rem; margin-top: .5rem; }
.ncf-err.hidden { display: none; }

/* ── Inputs - chalk-underline style (matches teacher home) ───────── */
.tc-cd-input {
  font-size: .95rem;
  border: none;
  border-bottom: 1.5px solid rgba(240,236,220,.45);
  border-radius: 0;
  padding: .45rem .4rem;
  background: transparent;
  color: #f0ece0;
  min-height: 40px;
  outline: none;
  transition: border-color .12s;
}
.tc-cd-input::placeholder { color: rgba(240,236,220,.38); }
.tc-cd-input:focus { border-bottom-color: rgba(240,236,220,.9); }
.tc-cd-input option { background: #2e5230; color: #f0ece0; }
.tc-cd-file-input { font-size: .85rem; color: rgba(240,236,220,.7); flex: 1; }
.tc-cd-upload-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.tc-cd-upload-panel {
  background: rgba(255,255,255,.06);
  border-radius: 10px;
  padding: .9rem 1rem;
  margin-bottom: 1.2rem;
  border: 1px solid rgba(240,236,220,.12);
}
.tc-cd-status-msg { font-size: .9rem; color: #fbbf24; min-height: 1.2em; margin: .3rem 0 0; }

/* ── The class library link (/m/<CODE>) ───────────────────────────── */
/* Above the upload form on purpose: "where do pupils get all this" is the
   question a teacher asks BEFORE adding the next file, not after. */
.tc-cd-lib {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(240,236,220,.16);
  border-radius: 10px;
  padding: .9rem 1rem;
  margin-bottom: 1rem;
}
.tc-cd-lib-off { border-style: dashed; }
.tc-cd-lib-head { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .7rem; }
.tc-cd-lib-head > span { font-size: 1.15rem; line-height: 1.3; }
.tc-cd-lib-head strong { display: block; font-size: .95rem; color: #f0ece0; }
.tc-cd-lib-head small { display: block; margin-top: 2px; font-size: .8rem; line-height: 1.4; color: rgba(240,236,220,.68); }
.tc-cd-lib-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.tc-cd-lib-url {
  flex: 1 1 200px; min-width: 0; min-height: 40px;
  background: rgba(0,0,0,.22); border: 1px solid rgba(240,236,220,.22); border-radius: 8px;
  padding: .4rem .6rem; color: #f0ece0; font-size: .84rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tc-cd-lib-acts { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.tc-cd-lib-warn { margin: .6rem 0 0; font-size: .78rem; line-height: 1.4; color: #fbbf24; }

/* ── Files not shared with this class ─────────────────────────────── */
/* ⚠ A <details>, closed by default. For a teacher with several classes this
   is a normal large list — everything that lives elsewhere — and only
   becomes urgent when a file they have just uploaded is in it. */
.tc-cd-unshared {
  margin-top: 1.2rem;
  border: 1px dashed rgba(240,236,220,.28);
  border-radius: 10px;
  background: rgba(255,255,255,.04);
}
.tc-cd-unshared > summary {
  display: flex; align-items: center; gap: .5rem;
  min-height: 48px; padding: .5rem .9rem;
  cursor: pointer; list-style: none;
  font-size: .92rem; font-weight: 700; color: rgba(240,236,220,.9);
}
.tc-cd-unshared > summary::-webkit-details-marker { display: none; }
.tc-cd-unshared-n {
  margin-left: auto; min-width: 24px; padding: .1rem .45rem;
  border-radius: 999px; background: rgba(244,206,82,.22); color: #f4ce52;
  font-size: .8rem; font-weight: 800; text-align: center;
}
.tc-cd-unshared-note {
  margin: 0 .9rem .6rem; font-size: .8rem; line-height: 1.45;
  color: rgba(240,236,220,.66);
}
.tc-cd-unshared .tc-cd-file-row { margin: 0 .5rem .5rem; }


.tc-cd-add-pupil-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ── Pills - chalk-outline style ─────────────────────────────────── */
.tc-cd-pill {
  font-size: .82rem;
  font-weight: 600;
  color: rgba(240,236,220,.85);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(240,236,220,.3);
  border-radius: 20px;
  padding: .25rem .7rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .1s;
}
.tc-cd-pill:hover { background: rgba(255,255,255,.18); color: #f0ece0; }
.tc-cd-pill-red    { color: #fca5a5; background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4); }
.tc-cd-pill-red:hover    { background: rgba(239,68,68,.22); }
.tc-cd-pill-orange { color: #fcd34d; background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.35); }
.tc-cd-pill-orange:hover { background: rgba(245,158,11,.2); }
.tc-cd-pill-active { background: rgba(251,191,36,.22); border-color: rgba(251,191,36,.6); color: #fbbf24; }
.tc-cd-pill-active:hover { background: rgba(251,191,36,.32); }
/* WhatsApp share reads as the primary way a file leaves this screen. */
.tc-cd-pill-share { color: #86efac; background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.45); }
.tc-cd-pill-share:hover { background: rgba(34,197,94,.26); }

/* ── Class register - ruled ledger on the board ──────────────────── */
.tc-cd-register {
  background: rgba(255,255,255,.05);
  border-radius: 10px;
  border: 1px solid rgba(240,236,220,.12);
  overflow: hidden;
  margin: .5rem 0 .8rem;
}
.tc-cd-register-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid rgba(240,236,220,.09);
  flex-wrap: wrap;
}
.tc-cd-register-row:last-child { border-bottom: none; }
.tc-cd-register-name { font-size: 1rem; color: #f0ece0; flex: 1; min-width: 80px; font-weight: 500; }
.tc-cd-register-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.tc-cd-register-row-dim { opacity: .5; }

/* ── Results grade-book ──────────────────────────────────────────── */
.tc-cd-results-summary { font-size: 1rem; color: rgba(240,236,220,.7); margin-bottom: .6rem; }
.tc-cd-grade-book {
  background: rgba(255,255,255,.05);
  border-radius: 10px;
  border: 1px solid rgba(240,236,220,.12);
  overflow: hidden;
}
.tc-cd-grade-header, .tc-cd-grade-row { display: grid; grid-template-columns: 2fr 1fr 1fr 2fr; gap: .5rem; padding: .5rem 1rem; border-bottom: 1px solid rgba(240,236,220,.09); }
.tc-cd-grade-header {
  font-weight: 700;
  color: rgba(240,236,220,.6);
  background: rgba(0,0,0,.15);
  font-size: .85rem;
  font-family: 'Caveat', cursive;
  letter-spacing: .04em;
}
.tc-cd-grade-row { font-size: .95rem; color: #f0ece0; }
.tc-cd-grade-pct { font-weight: 700; }
.tc-cd-grade-pct.pass { color: #86efac; }
.tc-cd-grade-pct.fail { color: #fca5a5; }
.tc-cd-grade-date { font-size: .8rem; color: rgba(240,236,220,.45); }
.tc-cd-grade-pending { opacity: .45; }

/* ── Gradebook tab ───────────────────────────────────────────────── */
.ta-gb-toolbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.ta-gb-sel {
  flex: 1;
  min-width: 0;
  padding: .45rem .7rem;
  border-radius: 8px;
  border: 1px solid rgba(240,236,220,.25);
  background: rgba(255,255,255,.08);
  color: #f0ece0;
  font-size: .9rem;
}
.ta-gb-btn {
  padding: .45rem 1rem;
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  color: #f0ece0;
  font-size: .85rem;
  font-weight: 600;
  border: 1px solid rgba(240,236,220,.2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.ta-gb-btn:hover { background: rgba(255,255,255,.2); }
.ta-gb-scroll { overflow-x: auto; border-radius: 10px; }
.ta-gb-table {
  border-collapse: collapse;
  width: 100%;
  font-size: .88rem;
  color: #f0ece0;
}
.ta-gb-th {
  padding: .55rem .7rem;
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  color: rgba(240,236,220,.6);
  background: rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(240,236,220,.15);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ta-gb-th-name { text-align: left; min-width: 110px; }
.ta-gb-th-avg  { min-width: 54px; }
.ta-gb-td {
  padding: .45rem .65rem;
  text-align: center;
  border-bottom: 1px solid rgba(240,236,220,.07);
  vertical-align: middle;
}
.ta-gb-td-name { text-align: left; font-weight: 600; color: #f0ece0; white-space: nowrap; }
.ta-gb-td-avg  { font-weight: 700; }
.ta-gb-cell    { font-size: .9rem; font-weight: 600; min-width: 54px; }
.ta-gb-pass    { color: #86efac; }
.ta-gb-mid     { color: #fde68a; }
.ta-gb-fail    { color: #fca5a5; }
.ta-gb-nd      { color: rgba(240,236,220,.3); font-weight: 400; }
.ta-gb-foot td { background: rgba(255,255,255,.06); border-top: 1px solid rgba(240,236,220,.18); border-bottom: none; }
.ta-gb-msg     { font-size: .92rem; color: rgba(240,236,220,.6); padding: .5rem 0; }
.ta-gb-err     { color: #fca5a5; }
.ta-gb-legend  {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  margin-top: .8rem;
  font-size: .78rem;
  color: rgba(240,236,220,.5);
}
.ta-gb-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: .25rem;
}
.ta-gb-dot.ta-gb-pass { background: #86efac; }
.ta-gb-dot.ta-gb-mid  { background: #fde68a; }
.ta-gb-dot.ta-gb-fail { background: #fca5a5; }
.ta-gb-dot.ta-gb-nd   { background: rgba(240,236,220,.25); }

/* ── Materials file list ─────────────────────────────────────────── */
.tc-cd-file-list { display: flex; flex-direction: column; gap: .5rem; }
.tc-cd-file-row {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(240,236,220,.12);
  border-radius: 10px;
  padding: .7rem 1rem;
}
.tc-cd-file-icon { font-size: 1.5rem; flex-shrink: 0; }
.tc-cd-file-info { flex: 1; min-width: 0; }
.tc-cd-file-name { font-size: 1rem; font-weight: 700; color: #f0ece0; margin: 0; }
.tc-cd-file-meta { font-size: .78rem; color: rgba(240,236,220,.5); margin: 1px 0; }
.tc-cd-file-desc { font-size: .82rem; color: rgba(240,236,220,.65); margin: 2px 0 0; }
.tc-cd-file-btns { display: flex; gap: 4px; flex-shrink: 0; align-items: flex-start; flex-wrap: wrap; }

/* ── Homework type choice overlay ───────────────────────────────── */
.tc-hw-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.tc-hw-choice-panel,
.tc-hw-form-panel {
  background: #1a2a1a;
  border: 1.5px solid rgba(240,236,220,.18);
  border-radius: 1.1rem;
  padding: 1.4rem 1.6rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 40px rgba(0,0,0,.55);
}
.tc-hw-form-panel { max-width: 520px; }
.tc-hw-choice-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.1rem;
  font-size: 1.05rem; font-weight: 800; color: #f0ece0;
  font-family: 'Patrick Hand', 'Caveat', cursive, sans-serif;
}
.tc-hw-close {
  background: none; border: none; color: rgba(240,236,220,.55);
  font-size: 1.1rem; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.tc-hw-close:hover { color: #f0ece0; background: rgba(255,255,255,.08); }
.tc-hw-choice-cards {
  display: flex; gap: .9rem; flex-wrap: wrap;
}
.tc-hw-choice-card {
  flex: 1 1 180px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: .4rem; padding: 1.2rem 1rem;
  background: rgba(255,255,255,.06);
  border: 1.5px solid rgba(240,236,220,.15);
  border-radius: .9rem; cursor: pointer;
  color: #f0ece0; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.tc-hw-choice-card:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(240,236,220,.35);
}
.tc-hw-card-icon { font-size: 2rem; }
.tc-hw-choice-card strong { font-size: .95rem; font-weight: 800; }
.tc-hw-choice-card small  { font-size: .78rem; color: rgba(240,236,220,.6); line-height: 1.35; }
/* Form body */
.tc-hw-form-body { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }

/* ── Physical worksheet cards in Work tab ────────────────────────── */
.tc-phw-card {
  display: flex; align-items: flex-start; gap: .75rem;
  background: rgba(255,235,180,.07);
  border: 1.5px solid rgba(246,173,85,.25);
  border-radius: .8rem;
  padding: .75rem 1rem;
  margin-bottom: .5rem;
}
.tc-phw-card.tc-phw-expired {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.1);
  opacity: .7;
}
.tc-phw-badge {
  flex-shrink: 0;
  background: rgba(246,173,85,.18);
  color: #f6ad55;
  border: 1px solid rgba(246,173,85,.35);
  border-radius: 999px;
  font-size: .72rem; font-weight: 800;
  padding: 2px 10px;
  white-space: nowrap;
  margin-top: 2px;
}
.tc-phw-body { flex: 1; min-width: 0; }
.tc-phw-title { font-size: .95rem; font-weight: 700; color: #f0ece0; margin: 0 0 2px; }
.tc-phw-meta  { font-size: .78rem; color: rgba(240,236,220,.55); margin: 0; }
.tc-phw-desc  { font-size: .82rem; color: rgba(240,236,220,.65); margin: 3px 0 0; }
.tc-phw-due   { font-size: .78rem; color: #68d391; margin: 4px 0 0; font-weight: 700; }
.tc-phw-due-expired { color: rgba(240,236,220,.4); }
.tc-phw-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }

/* ── File / camera picker shared styles ─────────────────────────── */
.tm-pick-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-top: .25rem;
}
.tm-pick-btn,
.tc-cd-pick-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .82rem;
  font-weight: 700;
  padding: .35rem .85rem;
  border-radius: .5rem;
  border: 1.5px solid;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
/* "Choose file" - neutral blue */
.tm-pick-btn:not(.tm-pick-camera),
.tc-cd-pick-btn:not(.tc-cd-pick-camera) {
  background: rgba(99,179,237,.15);
  color: #90cdf4;
  border-color: rgba(99,179,237,.35);
}
.tm-pick-btn:not(.tm-pick-camera):hover,
.tc-cd-pick-btn:not(.tc-cd-pick-camera):hover {
  background: rgba(99,179,237,.28);
}
/* "Camera" - warm amber */
.tm-pick-camera,
.tc-cd-pick-camera {
  background: rgba(246,173,85,.15);
  color: #f6ad55;
  border-color: rgba(246,173,85,.35);
}
.tm-pick-camera:hover,
.tc-cd-pick-camera:hover {
  background: rgba(246,173,85,.28);
}
.tm-filename-hint,
.tc-cd-filename-hint {
  font-size: .78rem;
  color: rgba(240,236,220,.45);
  font-style: italic;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}

/* ── Classroom-materials: badges + assign picker (general + detail) ─ */
.tm-file-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  background: rgba(255,255,255,.06);
  border-radius: .75rem;
  padding: .75rem 1rem;
  border: 1px solid rgba(255,255,255,.1);
  margin-bottom: .5rem;
}
.tm-classrooms-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
  margin-top: .4rem;
}
.tm-classroom-badge {
  display: inline-block;
  background: rgba(99,179,237,.18);
  color: #90cdf4;
  border: 1px solid rgba(99,179,237,.35);
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  padding: 1px 8px;
  white-space: nowrap;
}
.tm-classroom-badge.tm-badge-none {
  background: rgba(200,200,200,.1);
  color: rgba(200,200,200,.55);
  border-color: rgba(200,200,200,.2);
  font-weight: 400;
  font-style: italic;
}
.tm-assign-btn {
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(246,173,85,.15);
  color: #f6ad55;
  border: 1px solid rgba(246,173,85,.3);
  cursor: pointer;
  white-space: nowrap;
}
.tm-assign-btn:hover { background: rgba(246,173,85,.28); }
.tm-assign-picker {
  margin-top: .5rem;
  background: rgba(0,0,0,.35);
  border-radius: .6rem;
  padding: .65rem .8rem;
  border: 1px solid rgba(255,255,255,.12);
}
.tm-assign-list {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: .4rem;
}
.tm-assign-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .85rem;
  color: #f0ece0;
  font-weight: 500;
}
.tm-assign-item input[type="checkbox"] { accent-color: #f6ad55; width: 1rem; height: 1rem; cursor: pointer; }
.tm-assign-note { font-size: .75rem; color: rgba(240,236,220,.5); margin: 0; }

/* ── Settings cards ──────────────────────────────────────────────── */
.tc-cd-settings-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(240,236,220,.12);
  border-radius: 10px;
  padding: .9rem 1rem;
  margin-bottom: .8rem;
}
.tc-cd-settings-label {
  font-weight: 700;
  color: #f0ece0;
  font-size: 1rem;
  font-family: 'Caveat', cursive;
  display: block;
  margin-bottom: .5rem;
}
.tc-cd-danger-zone { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.07); }
.tc-cd-emoji-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.tc-cd-emoji-opt {
  font-size: 1.4rem;
  background: none;
  border: 2px solid rgba(240,236,220,.2);
  border-radius: 8px;
  padding: .3rem;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.tc-cd-emoji-opt:hover { background: rgba(255,255,255,.12); border-color: rgba(240,236,220,.5); }
.tc-cd-emoji-sel { border-color: #f0ece0 !important; background: rgba(255,255,255,.18) !important; }

/* ── Radio option group (entry mode) ────────────────────────────── */
.tc-cd-radio-group { display: flex; flex-direction: column; gap: .5rem; margin-top: .3rem; }
.tc-cd-radio-group input[type="radio"] { position: absolute; opacity: 0; width: 0; }
.tc-cd-radio-opt {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .6rem .8rem; border-radius: 10px; cursor: pointer;
  border: 2px solid rgba(240,236,220,.18); background: rgba(255,255,255,.04);
  color: rgba(240,236,220,.75); font-size: .9rem;
  transition: border-color .12s, background .12s, color .12s;
}
.tc-cd-radio-opt:hover { border-color: rgba(240,236,220,.4); background: rgba(255,255,255,.09); color: #f0ece0; }
.tc-cd-radio-sel { border-color: #f0ece0 !important; background: rgba(255,255,255,.14) !important; color: #f0ece0 !important; }
.tc-cd-radio-opt span strong { display: block; margin-bottom: .15rem; }

/* ── Time-limit chips ───────────────────────────────────────────── */
.tc-cd-radio-row { flex-direction: row; flex-wrap: wrap; }
.tc-cd-radio-row input[type="radio"] { position: absolute; opacity: 0; width: 0; }
.tc-cd-time-chip {
  padding: .35rem .75rem; border-radius: 20px; cursor: pointer; font-size: .85rem;
  border: 2px solid rgba(240,236,220,.2); background: rgba(255,255,255,.05);
  color: rgba(240,236,220,.7);
  transition: border-color .12s, background .12s, color .12s;
}
.tc-cd-time-chip:hover { border-color: rgba(240,236,220,.45); color: #f0ece0; }
.tc-cd-time-sel { border-color: #f0ece0 !important; background: rgba(255,255,255,.16) !important; color: #f0ece0 !important; }

/* ── Toggle switch ──────────────────────────────────────────────── */
.tc-cd-toggle-row { display: flex; align-items: center; gap: .75rem; margin-top: .25rem; }
.tc-cd-toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.tc-cd-toggle input { position: absolute; opacity: 0; width: 0; }
.tc-cd-toggle-track {
  position: absolute; inset: 0; border-radius: 12px;
  background: rgba(240,236,220,.2); border: 2px solid rgba(240,236,220,.25);
  transition: background .2s, border-color .2s; cursor: pointer;
}
.tc-cd-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(240,236,220,.7); transition: transform .2s, background .2s;
}
.tc-cd-toggle input:checked + .tc-cd-toggle-track { background: #4ade80; border-color: #22c55e; }
.tc-cd-toggle input:checked + .tc-cd-toggle-track::after { transform: translateX(20px); background: #fff; }
.tc-cd-toggle-label { font-size: .88rem; color: rgba(240,236,220,.75); }

/* ── Notes textarea ─────────────────────────────────────────────── */
.tc-cd-notes-area {
  width: 100%; min-height: 80px; resize: vertical;
  font-family: inherit; font-size: .88rem; line-height: 1.5;
  display: block; margin-top: .3rem;
}

/* ── Archived toggle ─────────────────────────────────────────────── */
.tc-cd-archived-toggle { margin: .8rem 0; font-size: .95rem; color: rgba(240,236,220,.6); }
.tc-cd-archived-toggle summary { cursor: pointer; padding: .3rem 0; }

/* ── Inline share panel (avoids popup-blocker) ───────────────────── */
.tc-share-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  padding: 1rem;
}
@media (min-width: 480px) { .tc-share-panel { align-items: center; } }
.tc-share-inner {
  background: linear-gradient(135deg, #2e5230 0%, #1d3a1f 100%);
  border: 1px solid rgba(240,236,220,.18);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 400px;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 -4px 24px rgba(0,0,0,.35);
}
@media (min-width: 480px) { .tc-share-inner { border-radius: 16px; } }
.tc-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.tc-share-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f0ece0;
  font-family: 'Caveat', cursive;
}
.tc-share-close {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(240,236,220,.25);
  border-radius: 50%;
  width: 28px; height: 28px;
  color: rgba(240,236,220,.8);
  cursor: pointer;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
}
.tc-share-lbl { font-size: .75rem; color: rgba(240,236,220,.55); margin: 0 0 .35rem; text-transform: uppercase; letter-spacing: .06em; }
.tc-share-url-row { display: flex; gap: .5rem; margin-bottom: .9rem; }
.tc-share-url {
  flex: 1;
  font-size: .82rem;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(240,236,220,.2);
  border-radius: 8px;
  padding: .45rem .7rem;
  color: #f0ece0;
  outline: none;
  min-width: 0;
}
.tc-share-copy-btn {
  font-size: .88rem;
  font-weight: 700;
  color: #2a1a00;
  background: linear-gradient(180deg,#f0ca50,#e5bd3a);
  border: none;
  border-radius: 8px;
  padding: .45rem .9rem;
  cursor: pointer;
  box-shadow: 0 2px 0 #8a6a10;
  white-space: nowrap;
  font-family: 'Caveat', cursive;
  transition: transform .1s;
  flex-shrink: 0;
}
.tc-share-copy-btn:active { transform: translateY(1px); box-shadow: none; }
.tc-share-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .75rem;
  background: #25d366;
  /* ⚠ Not white: white on WhatsApp green measures 2:1. The brand green stays,
     the ink goes dark, and the button clears 4.5:1 like everything else. */
  color: #05331f;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  transition: opacity .12s;
  font-family: 'Caveat', cursive;
}
.tc-share-wa-btn:hover { opacity: .92; }
.tc-share-hint { font-size: .75rem; color: rgba(240,236,220,.4); margin: .5rem 0 0; text-align: center; }

@media (max-width: 600px) {
  .tc-cd-header { gap: .4rem; padding: .65rem .6rem; }
  .tc-cd-back, .tc-cd-share-btn { padding: .32rem .5rem; font-size: .78rem; }
  .tc-cd-title { gap: .35rem; font-size: 1.08rem; }
  .tc-cd-title #tc-cd-emoji { width: 32px; height: 32px; flex-basis: 32px; border-radius: 9px; font-size: 1rem; }
  .tc-cd-stats { gap: .3rem; padding: .45rem .55rem; }
  .tc-cd-stat { padding: .45rem .25rem; }
  .tc-cd-stat strong { font-size: 1.1rem; }
  .tc-cd-stat span { font-size: .62rem; }
  .tc-cd-body { flex-direction: column; }
  .tc-cd-nav {
    flex-direction: row;
    width: auto;
    border-right: none;
    border-bottom: 1px solid rgba(240,236,220,.1);
    padding: .4rem .5rem;
    overflow-x: auto;
    gap: 2px;
  }
  .tc-cd-nav-btn { flex-direction: row; gap: 4px; padding: .4rem .6rem; white-space: nowrap; }
  .tc-cd-nav-btn span { font-size: .8rem; }
  .tc-cd-content { padding: .8rem; }
  .tc-cd-grade-header, .tc-cd-grade-row { grid-template-columns: 2fr 1fr 1fr 1.5fr; font-size: .85rem; }
}
/* ── Personal student / teacher installation ─────────────────────────────── */
.profile-launch-dialog,
.profile-install-dialog {
  width: min(100%, 31rem);
  max-height: min(90vh, 46rem);
  overflow-y: auto;
  border-radius: 1.6rem;
  background: #fff;
  color: #172033;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .35);
  border: 1px solid rgba(99, 102, 241, .16);
}
.dark .profile-launch-dialog,
.dark .profile-install-dialog { background:#172033; color:#f8fafc; border-color:rgba(165,180,252,.2); }
.profile-launch-dialog { padding:1.35rem; }
.profile-launch-head { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; }
.profile-launch-head h2,.profile-install-dialog h2 { margin:.15rem 0 0; font-size:1.3rem; line-height:1.2; font-weight:850; }
.profile-launch-head > button,.profile-install-close { width:2.25rem; height:2.25rem; border:0; border-radius:999px; background:#eef2ff; color:#4f46e5; font-weight:800; }
.dark .profile-launch-head > button,.dark .profile-install-close { background:#29344d; color:#c7d2fe; }
.profile-launch-kicker { color:#6366f1; font-size:.68rem; letter-spacing:.12em; font-weight:900; }
.profile-launch-explain { margin:.7rem 0 1rem; color:#64748b; font-size:.86rem; line-height:1.45; }
.dark .profile-launch-explain { color:#cbd5e1; }
.profile-launch-list { display:grid; gap:.65rem; }
.profile-launch-row { display:flex; border:1px solid #e2e8f0; border-radius:1rem; overflow:hidden; background:#f8fafc; }
.dark .profile-launch-row { border-color:#334155; background:#202b42; }
.profile-launch-main { min-width:0; flex:1; display:grid; grid-template-columns:2.4rem minmax(0,1fr) auto; align-items:center; gap:.65rem; padding:.8rem; text-align:left; }
.profile-launch-main > span { font-size:1.85rem; text-align:center; }
.profile-launch-main div { min-width:0; display:flex; flex-direction:column; }
.profile-launch-main strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.94rem; }
.profile-launch-main small { color:#64748b; font-size:.72rem; }
.dark .profile-launch-main small { color:#aab7ca; }
.profile-launch-main > b { color:#4f46e5; font-size:.75rem; white-space:nowrap; }
.dark .profile-launch-main > b { color:#a5b4fc; }
.profile-launch-forget { width:2.5rem; border-left:1px solid #e2e8f0; color:#94a3b8; font-size:1.2rem; }
.dark .profile-launch-forget { border-color:#334155; }
.profile-launch-empty { padding:1.2rem; text-align:center; border:1px dashed #cbd5e1; border-radius:1rem; color:#64748b; font-size:.85rem; }
.profile-launch-privacy { margin:1rem 0 0; font-size:.72rem; color:#64748b; text-align:center; }
.dark .profile-launch-privacy { color:#aab7ca; }
.profile-install-dialog { position:relative; padding:1.65rem; text-align:center; }
.profile-install-close { position:absolute; top:.8rem; right:.8rem; }
.profile-install-avatar { width:5rem; height:5rem; margin:.2rem auto .8rem; display:grid; place-items:center; border-radius:1.6rem; background:linear-gradient(135deg,#e0e7ff,#fce7f3); font-size:2.8rem; box-shadow:inset 0 0 0 1px rgba(99,102,241,.12); }
.profile-install-dialog > p { color:#64748b; margin:.65rem auto 1rem; max-width:24rem; font-size:.9rem; line-height:1.5; }
.dark .profile-install-dialog > p { color:#cbd5e1; }
.profile-install-help { padding:.8rem; border-radius:.9rem; background:#eef2ff; color:#4338ca; font-size:.8rem; line-height:1.45; }
.dark .profile-install-help { background:#252f4a; color:#c7d2fe; }
.profile-install-confirm { display:block; width:100%; margin-top:1rem; padding:.8rem; border-radius:.9rem; background:#4f46e5; color:white; font-weight:800; }
.profile-install-confirm:disabled { opacity:.52; cursor:wait; }
.profile-install-later { margin-top:.8rem; color:#64748b; font-size:.8rem; }
.profile-install-card { display:grid; grid-template-columns:auto minmax(0,1fr); gap:.8rem; padding:1rem; border-radius:1.2rem; background:linear-gradient(135deg,#ecfeff,#eef2ff 58%,#fdf2f8); border:1px solid #c7d2fe; box-shadow:0 7px 20px rgba(79,70,229,.08); color:#1e293b; }
.dark .profile-install-card { background:linear-gradient(135deg,#153348,#25294f 60%,#40233e); border-color:#46568c; color:#f8fafc; }
.profile-install-card-icon { font-size:2rem; }
.profile-install-card-copy h3 { font-size:.92rem; font-weight:850; }
.profile-install-card-copy p { margin-top:.2rem; color:#526077; font-size:.76rem; line-height:1.4; }
.dark .profile-install-card-copy p { color:#cbd5e1; }
.profile-install-card-copy span { display:block; margin-top:.35rem; color:#475569; font-size:.67rem; font-weight:700; }
.dark .profile-install-card-copy span { color:#b8c4d7; }
.profile-install-card > button { grid-column:1/-1; width:100%; padding:.68rem .9rem; border-radius:.8rem; background:#4f46e5; color:white; font-size:.8rem; font-weight:850; }
@media (min-width:520px) {
  .profile-install-card { grid-template-columns:auto minmax(0,1fr) auto; align-items:center; }
  .profile-install-card > button { grid-column:auto; width:auto; white-space:nowrap; }
}

/* ══════════ TEXTES À TROUS (PSAC French Q6) - engine/cloze.js ══════════ */
/* ⚠ Every colour is defined on bare :root-level selectors here and only
   re-stated inside the dark block, so nothing has its ONLY definition in a
   media query. ⚠ No transform/filter/contain on any ancestor of the footer -
   see the .screen note above; a transformed ancestor re-anchors position:fixed
   and that is what once put the practice bar off-screen. */

.clz-hero { background: linear-gradient(135deg, #0f766e, #115e59); color: #fff;
  border-radius: 1rem; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.clz-hero h2 { font-size: 1.35rem; font-weight: 800; margin: 0 0 .25rem; }
.clz-hero p  { font-size: .9rem; margin: 0; color: #d5f5f0; }

/* ── The list ─────────────────────────────────────────────────────── */
.clz-list { display: flex; flex-direction: column; gap: .55rem; }
.clz-empty { padding: 1.2rem; text-align: center; color: #6b7280; }

.clz-item { display: flex; align-items: center; gap: .7rem; width: 100%;
  text-align: left; padding: .7rem .8rem; border-radius: .85rem;
  background: #fff; border: 1px solid #e5e7eb; cursor: pointer;
  /* 56px clears the 44px touch target with room for a mis-aimed thumb. */
  min-height: 56px; }
.clz-item:hover { border-color: #0f766e; }
.clz-item.is-attempted { border-left: 4px solid #0f766e; }

.clz-num { flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: .85rem;
  background: #f0fdfa; color: #0f766e; }
.clz-item.is-attempted .clz-num { background: #0f766e; color: #fff; }

.clz-item-main  { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .12rem; }
.clz-item-title { font-weight: 700; font-size: .95rem; color: #111827; }
.clz-item-meta  { font-size: .74rem; color: #6b7280; }
.clz-item-go    { flex: 0 0 auto; display: flex; align-items: center; gap: .35rem;
  color: #0f766e; font-size: 1.15rem; }
.clz-again { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }

.clz-badge { display: inline-block; margin-top: .18rem; font-size: .7rem;
  font-weight: 700; padding: .1rem .45rem; border-radius: 999px; width: fit-content; }
.clz-badge.is-new  { background: #f3f4f6; color: #6b7280; }
.clz-badge.is-done { background: #ccfbf1; color: #0f766e; }
.clz-badge.is-full { background: #fef3c7; color: #92400e; }

/* ── The player ───────────────────────────────────────────────────── */
.clz-play  { padding-bottom: 2rem; }
.clz-title { font-size: 1.2rem; font-weight: 800; margin: 0 0 .3rem; color: #111827; }
.clz-intro { font-size: .84rem; color: #4b5563; margin: 0 0 .8rem; line-height: 1.45; }
.clz-help  { font-size: .78rem; color: #6b7280; margin: .5rem 0 .9rem; }

/* The bank sticks to the top so the words stay reachable while the child reads
   down a long passage. ⚠ position: sticky, never fixed - a fixed bank inside a
   .screen is the exact trap the header comment above describes. */
.clz-bank { position: sticky; top: .25rem; z-index: 5;
  display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: .8rem; }

.clz-word { font-size: .9rem; font-weight: 600; padding: .45rem .7rem;
  border-radius: .6rem; background: #fff; border: 1.5px solid #cbd5e1;
  color: #0f172a; cursor: pointer; min-height: 40px; }
.clz-word:hover:not(:disabled) { border-color: #0f766e; }
.clz-word.is-sel  { background: #0f766e; border-color: #0f766e; color: #fff;
  box-shadow: 0 0 0 3px rgba(15,118,110,.25); }
.clz-word.is-used { opacity: .32; text-decoration: line-through; cursor: default; }
.clz-word.is-spare { background: #fef2f2; border-color: #fecaca; color: #991b1b;
  opacity: 1; text-decoration: none; }

.clz-text { font-size: 1rem; line-height: 2.3; color: #111827;
  background: #fff; border: 1px solid #e5e7eb; border-radius: .8rem; padding: .9rem; }

.clz-gap { display: inline-flex; align-items: center; justify-content: center;
  min-width: 5.5rem; min-height: 2rem; margin: 0 .12rem; padding: 0 .45rem;
  border-radius: .45rem; border: 2px dashed #94a3b8; background: #f8fafc;
  font-size: .92rem; font-weight: 700; color: #64748b; cursor: pointer;
  vertical-align: middle; }
.clz-gap:hover:not(:disabled) { border-color: #0f766e; background: #f0fdfa; }
.clz-gap.is-over   { border-color: #0f766e; background: #ccfbf1; }
.clz-gap.is-filled { border-style: solid; border-color: #0f766e;
  background: #f0fdfa; color: #0f766e; }
.clz-gap.is-right  { border-color: #16a34a; background: #dcfce7; color: #166534; }
.clz-gap.is-wrong  { border-color: #dc2626; background: #fee2e2; color: #991b1b;
  text-decoration: line-through; }
.clz-gap-n { font-size: .78rem; opacity: .75; }

@keyframes clz-pop { 0% { transform: scale(.82); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
/* Safe: the animation is on the gap itself, which is not an ancestor of any
   position:fixed element. */
.clz-gap.clz-pop { animation: clz-pop .22s ease-out; }

.clz-footer   { margin-top: 1rem; }
.clz-progress { font-size: .85rem; font-weight: 700; color: #0f766e; margin-bottom: .5rem; }
.clz-note     { font-size: .76rem; color: #6b7280; margin-top: .45rem; }
.clz-actions  { display: flex; flex-wrap: wrap; gap: .5rem; }
.clz-actions button { flex: 1 1 auto; min-width: 10rem; min-height: 44px; }

.clz-score { display: flex; flex-direction: column; gap: .15rem; padding: .8rem 1rem;
  border-radius: .8rem; background: #f0fdfa; border: 1px solid #99f6e4; margin-bottom: .8rem; }
.clz-score b { font-size: 1.6rem; font-weight: 800; color: #0f766e; }
.clz-score span { font-size: .85rem; color: #115e59; }
.clz-score.is-full { background: #fef3c7; border-color: #fde68a; }
.clz-score.is-full b { color: #92400e; }
.clz-score.is-full span { color: #78350f; }

.clz-review { margin-top: 1.1rem; }
.clz-review h4 { font-size: .95rem; font-weight: 800; margin: 0 0 .5rem; color: #111827; }
.clz-r-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.clz-r-list li { display: flex; gap: .55rem; padding: .5rem .6rem; border-radius: .6rem;
  background: #f9fafb; border-left: 3px solid #d1d5db; }
.clz-r-list li.is-right { border-left-color: #16a34a; }
.clz-r-list li.is-wrong { border-left-color: #dc2626; background: #fef2f2; }
.clz-r-n { flex: 0 0 auto; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .72rem; font-weight: 800;
  background: #e5e7eb; color: #374151; }
.clz-r-body { flex: 1 1 auto; min-width: 0; font-size: .87rem; color: #111827;
  display: flex; flex-direction: column; gap: .1rem; }
.clz-r-mine { color: #991b1b; font-size: .8rem; }
.clz-r-note { font-size: .78rem; color: #6b7280; }
.clz-spare  { margin-top: .6rem; font-size: .82rem; color: #6b7280; }

/* Long passages scroll inside their own box rather than pushing the page wide. */
.clz-text, .clz-bank { overflow-x: auto; }

@media (max-width: 380px) {
  .clz-gap { min-width: 4.2rem; font-size: .86rem; }
  .clz-word { font-size: .84rem; padding: .4rem .55rem; }
  .clz-actions button { min-width: 100%; }
}

/* iOS zooms any control under 16px and never zooms back out. These are buttons,
   not inputs, so they are safe - but the tap targets still have to clear 44px,
   which min-height above guarantees. */

:root[data-theme="dark"] .clz-item,
:root:not([data-theme="light"]) .clz-item { background: #1f2937; border-color: #374151; }
:root[data-theme="dark"] .clz-item-title,
:root:not([data-theme="light"]) .clz-item-title { color: #f3f4f6; }
:root[data-theme="dark"] .clz-num,
:root:not([data-theme="light"]) .clz-num { background: #134e4a; color: #5eead4; }
:root[data-theme="dark"] .clz-item.is-attempted .clz-num,
:root:not([data-theme="light"]) .clz-item.is-attempted .clz-num { background: #0f766e; color: #fff; }
:root[data-theme="dark"] .clz-badge.is-new,
:root:not([data-theme="light"]) .clz-badge.is-new { background: #374151; color: #9ca3af; }
:root[data-theme="dark"] .clz-badge.is-done,
:root:not([data-theme="light"]) .clz-badge.is-done { background: #134e4a; color: #5eead4; }
:root[data-theme="dark"] .clz-badge.is-full,
:root:not([data-theme="light"]) .clz-badge.is-full { background: #78350f; color: #fde68a; }
:root[data-theme="dark"] .clz-title,
:root:not([data-theme="light"]) .clz-title { color: #f3f4f6; }
:root[data-theme="dark"] .clz-intro,
:root:not([data-theme="light"]) .clz-intro { color: #d1d5db; }
:root[data-theme="dark"] .clz-bank,
:root:not([data-theme="light"]) .clz-bank { background: #111827; border-color: #374151; }
:root[data-theme="dark"] .clz-word,
:root:not([data-theme="light"]) .clz-word { background: #1f2937; border-color: #4b5563; color: #f3f4f6; }
:root[data-theme="dark"] .clz-word.is-spare,
:root:not([data-theme="light"]) .clz-word.is-spare { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
:root[data-theme="dark"] .clz-text,
:root:not([data-theme="light"]) .clz-text { background: #1f2937; border-color: #374151; color: #f3f4f6; }
:root[data-theme="dark"] .clz-gap,
:root:not([data-theme="light"]) .clz-gap { background: #111827; border-color: #6b7280; color: #9ca3af; }
:root[data-theme="dark"] .clz-gap.is-filled,
:root:not([data-theme="light"]) .clz-gap.is-filled { background: #134e4a; border-color: #14b8a6; color: #5eead4; }
:root[data-theme="dark"] .clz-gap.is-right,
:root:not([data-theme="light"]) .clz-gap.is-right { background: #14532d; border-color: #22c55e; color: #bbf7d0; }
:root[data-theme="dark"] .clz-gap.is-wrong,
:root:not([data-theme="light"]) .clz-gap.is-wrong { background: #450a0a; border-color: #ef4444; color: #fecaca; }
:root[data-theme="dark"] .clz-score,
:root:not([data-theme="light"]) .clz-score { background: #134e4a; border-color: #0f766e; }
:root[data-theme="dark"] .clz-score b,
:root:not([data-theme="light"]) .clz-score b { color: #5eead4; }
:root[data-theme="dark"] .clz-score span,
:root:not([data-theme="light"]) .clz-score span { color: #99f6e4; }
:root[data-theme="dark"] .clz-score.is-full,
:root:not([data-theme="light"]) .clz-score.is-full { background: #78350f; border-color: #b45309; }
:root[data-theme="dark"] .clz-score.is-full b,
:root:not([data-theme="light"]) .clz-score.is-full b { color: #fde68a; }
:root[data-theme="dark"] .clz-score.is-full span,
:root:not([data-theme="light"]) .clz-score.is-full span { color: #fef3c7; }
:root[data-theme="dark"] .clz-review h4,
:root:not([data-theme="light"]) .clz-review h4 { color: #f3f4f6; }
:root[data-theme="dark"] .clz-r-list li,
:root:not([data-theme="light"]) .clz-r-list li { background: #1f2937; }
:root[data-theme="dark"] .clz-r-list li.is-wrong,
:root:not([data-theme="light"]) .clz-r-list li.is-wrong { background: #450a0a; }
:root[data-theme="dark"] .clz-r-body,
:root:not([data-theme="light"]) .clz-r-body { color: #f3f4f6; }
:root[data-theme="dark"] .clz-r-n,
:root:not([data-theme="light"]) .clz-r-n { background: #374151; color: #d1d5db; }
:root[data-theme="dark"] .clz-r-mine,
:root:not([data-theme="light"]) .clz-r-mine { color: #fca5a5; }

/* ── Textes à Trous, part B: the gaps with NO word bank ──────────────────
   ⚠ EVERY typed gap is the SAME width, whatever its answer. An input sized to
   its own word prints the answer's length on the screen; the real paper draws
   one dotted line for every gap. Never add width:auto or a size attribute.
   ⚠ 1rem = 16px is the floor: iOS zooms any control under 16px and never zooms
   back out, which strands a child mid-passage. */
.clz-part + .clz-part { margin-top: 1.4rem; padding-top: 1.1rem; border-top: 2px dashed #d1d5db; }
.clz-lead { font-size: .84rem; color: #4b5563; margin: 0 0 .9rem; line-height: 1.45; }
.clz-part-h { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap;
  font-size: 1rem; font-weight: 800; color: #0f766e; margin: 0 0 .35rem; }
.clz-marks { font-size: .8rem; font-weight: 600; color: #4b5563; }

.clz-tgap { display: inline-flex; align-items: center; gap: .25rem; vertical-align: middle; }
.clz-tgap .clz-gap-n { font-size: .72rem; font-weight: 700; color: #4b5563; }
.clz-input { width: 6.5rem; max-width: 45vw; min-height: 36px; box-sizing: border-box;
  font-size: 1rem; font-family: inherit; font-weight: 600; text-align: center;
  padding: .2rem .35rem; color: #111827; background: #fff;
  border: 2px dashed #6b7280; border-radius: .45rem; }
.clz-input:focus { outline: none; border-color: #0f766e; border-style: solid; background: #f0fdfa; }
.clz-tgap.is-filled .clz-input { border-style: solid; border-color: #0f766e; background: #f0fdfa; }
.clz-tgap.is-right .clz-input { border-color: #16a34a; background: #dcfce7; color: #166534; }
.clz-tgap.is-wrong .clz-input { border-color: #dc2626; background: #fee2e2; color: #991b1b; }
.clz-tgap.is-slip  .clz-input { border-color: #a16207; background: #fef9c3; color: #713f12; }

.clz-r-slip { font-size: .78rem; color: #854d0e; font-weight: 600; }
.clz-r-alt  { font-size: .78rem; color: #4b5563; }
.clz-r-list li.is-typed { border-left-style: dashed; }

@media (max-width: 380px) {
  .clz-input { width: 5.6rem; }
}

:root[data-theme="dark"] .clz-part + .clz-part,
:root:not([data-theme="light"]) .clz-part + .clz-part { border-top-color: #374151; }
:root[data-theme="dark"] .clz-lead,
:root:not([data-theme="light"]) .clz-lead { color: #d1d5db; }
:root[data-theme="dark"] .clz-part-h,
:root:not([data-theme="light"]) .clz-part-h { color: #5eead4; }
:root[data-theme="dark"] .clz-marks,
:root:not([data-theme="light"]) .clz-marks { color: #d1d5db; }
:root[data-theme="dark"] .clz-tgap .clz-gap-n,
:root:not([data-theme="light"]) .clz-tgap .clz-gap-n { color: #d1d5db; }
:root[data-theme="dark"] .clz-input,
:root:not([data-theme="light"]) .clz-input { background: #111827; border-color: #9ca3af; color: #f3f4f6; }
:root[data-theme="dark"] .clz-input:focus,
:root:not([data-theme="light"]) .clz-input:focus { border-color: #14b8a6; background: #134e4a; }
:root[data-theme="dark"] .clz-tgap.is-filled .clz-input,
:root:not([data-theme="light"]) .clz-tgap.is-filled .clz-input { background: #134e4a; border-color: #14b8a6; color: #5eead4; }
:root[data-theme="dark"] .clz-tgap.is-right .clz-input,
:root:not([data-theme="light"]) .clz-tgap.is-right .clz-input { background: #14532d; border-color: #22c55e; color: #bbf7d0; }
:root[data-theme="dark"] .clz-tgap.is-wrong .clz-input,
:root:not([data-theme="light"]) .clz-tgap.is-wrong .clz-input { background: #450a0a; border-color: #ef4444; color: #fecaca; }
:root[data-theme="dark"] .clz-tgap.is-slip .clz-input,
:root:not([data-theme="light"]) .clz-tgap.is-slip .clz-input { background: #422006; border-color: #eab308; color: #fef08a; }
:root[data-theme="dark"] .clz-r-slip,
:root:not([data-theme="light"]) .clz-r-slip { color: #fde68a; }
:root[data-theme="dark"] .clz-r-alt,
:root:not([data-theme="light"]) .clz-r-alt { color: #d1d5db; }


/* ── Game settings (parent card) + Game Zone mix line ─────────────────── */
/* Rendered by GameSettings.renderParentCard() via innerHTML, so nothing here
   may rely on a Tailwind class the Play CDN never scanned. Light values are the
   defaults, every colour has a .dark twin, and selection is shown by a ✓ mark
   and a text state as well as colour. */
.gs-card-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e5e7eb; }
.dark .gs-card-wrap { border-top-color: #374151; }
.gs-summary { font-size: .85rem; color: #374151; background: #f3f4f6; border-radius: 12px; padding: 10px 12px; line-height: 1.45; overflow-wrap: anywhere; }
.dark .gs-summary { color: #e5e7eb; background: #374151; }
.gs-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px;
  border-radius: 12px; font-weight: 700; font-size: .875rem; border: 2px solid #d1d5db; background: #fff; color: #1f2937; cursor: pointer; }
.dark .gs-btn { background: #1f2937; color: #f9fafb; border-color: #4b5563; }
.gs-btn-open { margin-top: 10px; width: 100%; border-color: #6366f1; color: #4338ca; }
.dark .gs-btn-open { color: #c7d2fe; border-color: #818cf8; }
.gs-btn-primary { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.dark .gs-btn-primary { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.gs-btn-sm { min-height: 40px; padding: 6px 12px; font-size: .78rem; }
.gs-btn:disabled { opacity: .6; cursor: default; }
.gs-panel { margin-top: 8px; }
.gs-lead { font-size: .9rem; font-weight: 700; color: #1f2937; margin-bottom: 8px; }
.dark .gs-lead { color: #f9fafb; }
.gs-section { border: 1px solid #e5e7eb; border-radius: 14px; padding: 12px; margin: 0 0 12px; min-width: 0; }
.dark .gs-section { border-color: #374151; }
.gs-h { font-weight: 800; font-size: .85rem; color: #111827; padding: 0 6px; }
.dark .gs-h { color: #f9fafb; }
.gs-note { font-size: .78rem; color: #4b5563; margin: 8px 0 0; line-height: 1.45; }
.dark .gs-note { color: #9ca3af; }
.gs-warn { color: #b91c1c; font-weight: 600; }
.dark .gs-warn { color: #fca5a5; }
.gs-cards { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
@media (min-width: 480px) { .gs-cards-2 { grid-template-columns: 1fr 1fr; } }
.gs-card { position: relative; display: flex; align-items: flex-start; gap: 10px; min-height: 56px; padding: 10px 12px;
  border: 2px solid #d1d5db; border-radius: 12px; background: #fff; cursor: pointer; min-width: 0; }
.dark .gs-card { background: #111827; border-color: #4b5563; }
.gs-card.on { border-color: #4f46e5; background: #eef2ff; }
.dark .gs-card.on { border-color: #818cf8; background: #312e81; }
.gs-card input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.gs-card:focus-within { outline: 3px solid #f59e0b; outline-offset: 2px; }
.gs-card-mark { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #9ca3af; display: inline-flex;
  align-items: center; justify-content: center; font-size: .8rem; font-weight: 900; color: #fff; background: transparent; margin-top: 1px; }
.gs-card.on .gs-card-mark { background: #4f46e5; border-color: #4f46e5; }
.dark .gs-card.on .gs-card-mark { background: #818cf8; border-color: #818cf8; color: #111827; }
.gs-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gs-card-body b { font-size: .875rem; color: #111827; overflow-wrap: anywhere; }
.dark .gs-card-body b { color: #f9fafb; }
.gs-card-body > span { font-size: .76rem; color: #4b5563; line-height: 1.35; }
.dark .gs-card-body > span { color: #9ca3af; }
.gs-row { display: grid; grid-template-columns: 1fr 3.4rem; grid-template-areas: "label val" "slider slider"; align-items: center; gap: 4px 8px; margin-top: 10px; }
.gs-row-label { grid-area: label; font-size: .85rem; font-weight: 600; color: #1f2937; }
.dark .gs-row-label { color: #f3f4f6; }
.gs-row-val { grid-area: val; text-align: right; font-weight: 800; font-size: .9rem; color: #4338ca; font-variant-numeric: tabular-nums; }
.dark .gs-row-val { color: #c7d2fe; }
.gs-row input[type=range] { grid-area: slider; width: 100%; min-width: 0; height: 32px; accent-color: #4f46e5; cursor: pointer; }
.gs-row-total { grid-template-columns: auto auto 1fr; grid-template-areas: "t v b"; margin-top: 14px; font-size: .85rem; color: #374151; }
.dark .gs-row-total { color: #e5e7eb; }
.gs-row-total > span { grid-area: t; } .gs-row-total > b { grid-area: v; color: #111827; } .dark .gs-row-total > b { color: #f9fafb; }
.gs-row-total > button { grid-area: b; justify-self: end; }
.gs-toggle { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #f3f4f6; position: relative; cursor: pointer; }
.gs-toggle:first-of-type { border-top: 0; }
.dark .gs-toggle { border-top-color: #374151; }
.gs-toggle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gs-toggle-text b { font-size: .85rem; color: #111827; }
.dark .gs-toggle-text b { color: #f9fafb; }
.gs-toggle-text span { font-size: .74rem; color: #4b5563; line-height: 1.35; }
.dark .gs-toggle-text span { color: #9ca3af; }
.gs-toggle input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.gs-switch { width: 44px; height: 24px; border-radius: 99px; background: #9ca3af; position: relative; flex: 0 0 auto; transition: background .15s; }
.gs-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.gs-toggle input:checked ~ .gs-switch { background: #4f46e5; }
.gs-toggle input:checked ~ .gs-switch::after { transform: translateX(20px); }
.gs-toggle input:focus-visible ~ .gs-switch { outline: 3px solid #f59e0b; outline-offset: 2px; }
.gs-onoff { font-size: .74rem; font-weight: 800; width: 2rem; color: #374151; }
.dark .gs-onoff { color: #e5e7eb; }
.gs-which { font-size: .78rem; color: #4b5563; margin: 0 0 12px; }
.dark .gs-which { color: #9ca3af; }
.gs-which summary { cursor: pointer; font-weight: 700; color: #4338ca; padding: 6px 0; }
.dark .gs-which summary { color: #c7d2fe; }
.gs-which ul { margin: 6px 0 0; padding-left: 18px; }
.gs-which li { margin: 4px 0; overflow-wrap: anywhere; }
.gs-which b { color: #111827; } .dark .gs-which b { color: #f9fafb; }
.gs-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gs-status { font-size: .78rem; color: #b91c1c; font-weight: 600; flex: 1 1 100%; }
.dark .gs-status { color: #fca5a5; }
@media (prefers-reduced-motion: reduce) { .gs-switch, .gs-switch::after { transition: none; } }

.mg-mix-line { text-align: center; font-size: .82rem; font-weight: 600; color: #4338ca; background: #eef2ff;
  border-radius: 12px; padding: 8px 12px; margin: 0 0 12px; overflow-wrap: anywhere; }
.dark .mg-mix-line { color: #c7d2fe; background: #312e81; }

/* Which grades a child's games draw from. Injected by GameSettings.childGradeBar()
   into the arcade hub, so the Tailwind CDN never sees these classes - every rule
   the chips need lives here. Shown only when a parent has unlocked a higher
   grade, so an empty row never appears.
   ⚠ The row carries its OWN background, exactly like .mg-mix-line above: the hub
   has no surface colour of its own, so text left transparent here was measured
   at 2.35:1 against whatever the screen happened to be painting. */
.mg-gradebar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 8px; margin: 0 0 12px; padding: 8px 10px; border-radius: 12px; background: #eef2ff; }
.mg-gradebar-label { font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: #4338ca; }
.dark .mg-gradebar { background: #312e81; }
.dark .mg-gradebar-label { color: #c7d2fe; }
.mg-gradebar-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mg-gchip { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 8px 14px;
  border: 1.5px solid #c7d2fe; border-radius: 999px; background: #fff; color: #4b5563;
  font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s; }
.mg-gchip small { font-size: .66rem; font-weight: 600; opacity: .8; }
.mg-gchip:not(.mine):hover { border-color: #6366f1; }
.mg-gchip.on { background: #4338ca; border-color: #4338ca; color: #fff; }
.mg-gchip.mine { cursor: default; }
.dark .mg-gchip { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }
.dark .mg-gchip.on { background: #4f46e5; border-color: #a5b4fc; color: #fff; }

/* ══ TEACHER COMMAND CENTRE ═══════════════════════════════════════════════
   Home, four-item navigation with a More menu, the simplified Set Work form,
   the action-focused Results screen and the classroom Overview/Work/Pupils.
   Everything below is injected by innerHTML, so every rule lives HERE (the
   Tailwind Play CDN never sees these classes).

   Surfaces: the teacher panels are a chalkboard (dark green / near-black),
   so content sits on "paper" cards that carry their OWN ink colour in both
   themes. The board's cream `p`/`label` overrides use !important, so the
   paper rules below do too - otherwise a white card gets cream text.      */

/* ── Paper tokens ─────────────────────────────────────────────────────── */
:root {
  --tp-bg: #fffdf7; --tp-ink: #172033; --tp-muted: #55606f; --tp-line: #e4dfd2; --tp-soft: #f3f0e6;
  --tp-accent: #2a4d28; --tp-accent-ink: #ffffff; --tp-gold: #f4ce52; --tp-gold-ink: #2d1f04;
  --tp-good-bg: #dcfce7; --tp-good-ink: #166534; --tp-warn-bg: #fef3c7; --tp-warn-ink: #92400e;
  --tp-bad-bg: #fee2e2; --tp-bad-ink: #991b1b; --tp-idle-bg: #e2e8f0; --tp-idle-ink: #334155;
}
.dark {
  --tp-bg: #1e293b; --tp-ink: #f1f5f9; --tp-muted: #cbd5e1; --tp-line: #334155; --tp-soft: #263244;
  --tp-accent: #86efac; --tp-accent-ink: #052e16; --tp-gold: #f4ce52; --tp-gold-ink: #2d1f04;
  --tp-good-bg: #14532d; --tp-good-ink: #bbf7d0; --tp-warn-bg: #78350f; --tp-warn-ink: #fde68a;
  --tp-bad-bg: #7f1d1d; --tp-bad-ink: #fecaca; --tp-idle-bg: #334155; --tp-idle-ink: #e2e8f0;
}

/* Paper cards override the board's cream text rules. The board paints
   p / label / h3 / h4 cream with !important, so inside paper those four
   inherit the card's ink; everything else already inherits normally.
   ⚠ The board's p rule is `p:not(.teacher-intro):not(.ta-chip-hint)` - the two
   :not()s lift it to (1,3,1), above any single-id selector. The doubled id
   below (2,x,y) is deliberate: it is the only way to outrank it without
   rewriting the board. */
#screen-teacher#screen-teacher .ta-tab-content :is(.th-card, .th-action, .tw-card, .tr-wrap, .ta-share-opt, .ta-settings-card, .ta-settings-note, .ta-more-options, .ta-state, .tp-paper) { color: var(--tp-ink) !important; }
#screen-teacher#screen-teacher .ta-tab-content :is(.th-card, .th-action, .th-error, .tw-card, .tr-wrap, .ta-share-opt, .ta-settings-card, .ta-settings-note, .ta-more-options, .ta-state, .tr-help, .tp-paper) :is(p, h3, h4, label, b, .text-xs, .text-sm) {
  color: inherit !important; text-shadow: none; font-family: inherit; font-size: inherit;
}
#screen-teacher#screen-teacher .ta-tab-content .th-action-primary { color: var(--tp-gold-ink) !important; }
#screen-teacher#screen-teacher .ta-tab-content .ta-state-error { color: var(--tp-warn-ink) !important; }
#screen-teacher#screen-teacher .ta-tab-content .th-error { color: var(--tp-warn-ink) !important; }
#screen-teacher#screen-teacher .ta-tab-content .tr-help { color: var(--tp-warn-ink) !important; }
#screen-teacher#screen-teacher .ta-tab-content :is(.th-empty p, .th-more, .tw-meta, .tr-head-main p, .tr-group-empty, .tr-updated, .tr-updating, .ta-settings-note p, .ta-share-opt-text small) { color: var(--tp-muted) !important; }
#screen-teacher#screen-teacher .ta-tab-content .th-empty-good p { color: var(--tp-good-ink) !important; }
#screen-teacher#screen-teacher .ta-tab-content .tr-group-help h4 { color: var(--tp-warn-ink) !important; }
#screen-teacher#screen-teacher .ta-tab-content .tr-group-completed h4 { color: var(--tp-good-ink) !important; }
#screen-teacher#screen-teacher .ta-tab-content .tr-answers p.ok { color: var(--tp-good-ink) !important; }
#screen-teacher#screen-teacher .ta-tab-content .tr-answers p.wrong { color: var(--tp-bad-ink) !important; }
#screen-teacher#screen-teacher .ta-tab-content .ta-more-options .ta-form-note { color: var(--tp-muted) !important; }
/* Intro copy sits on the chalkboard inside panels, not on the cream page. */
#screen-teacher#screen-teacher .ta-tab-content .teacher-intro { color: rgba(240,236,220,.82) !important; }

/* ── Generic states ───────────────────────────────────────────────────── */
.ta-state { margin: .6rem 0; padding: .9rem 1rem; border-radius: 12px; color: var(--tp-ink); background: var(--tp-bg); border: 1px solid var(--tp-line); font-size: .92rem; line-height: 1.5; }
.ta-state-loading { color: var(--tp-muted); animation: ta-pulse 1.4s ease-in-out infinite; }
.ta-state-error { border-color: #f59e0b; background: var(--tp-warn-bg); color: var(--tp-warn-ink) !important; }
.ta-state-retry, .th-retry { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.1rem; border: 0; border-radius: 10px; background: var(--tp-gold); color: var(--tp-gold-ink); font-weight: 800; font-size: .92rem; cursor: pointer; }
.ta-link-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.ta-loading { color: rgba(240,236,220,.7); }
@keyframes ta-pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ── Header ───────────────────────────────────────────────────────────── */
.ta-mode-switch { font-size: .95rem !important; padding: .55rem 1rem !important; min-height: 44px; }

/* ── Main navigation: 4 tabs + More ───────────────────────────────────── */
#screen-teacher .ta-tab { min-height: 44px; }
.ta-more-wrap { position: relative; margin-left: auto; align-self: flex-end; }
#screen-teacher .ta-more-btn {
  position: relative; min-height: 44px; padding: .55rem 1rem .5rem; border: none; border-radius: 5px 5px 0 0;
  background: rgba(255,255,255,.06); color: rgba(240,236,220,.75); cursor: pointer;
  font-family: 'Caveat', cursive; font-size: 1.1rem; font-weight: 700; transition: background .14s, color .14s;
}
#screen-teacher .ta-more-btn:hover, #screen-teacher .ta-more-btn[aria-expanded="true"] { background: rgba(255,255,255,.14); color: #f0ece0; }
#screen-teacher .ta-more-btn.ta-more-btn-active { background: #f2ebe0; color: #2a4d28; box-shadow: 0 -2px 0 #4a7a40 inset; }
.dark #screen-teacher .ta-more-btn.ta-more-btn-active { background: #1a1208; color: #86efac; }
.ta-more-badge { position: absolute; top: 2px; right: 2px; padding: 1px 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: .62rem; font-family: system-ui, sans-serif; font-weight: 800; }
.ta-more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 290px; max-width: calc(100vw - 2rem);
  padding: .4rem; border-radius: 14px; background: var(--tp-bg); color: var(--tp-ink); border: 1px solid var(--tp-line);
  box-shadow: 0 18px 40px rgba(0,0,0,.28);
}
.ta-more-menu.hidden { display: none; }
.ta-more-menu button { display: flex; align-items: center; gap: .7rem; width: 100%; min-height: 52px; padding: .5rem .7rem; border: 0; border-radius: 10px; background: none; color: inherit; text-align: left; cursor: pointer; }
.ta-more-menu button:hover, .ta-more-menu button:focus-visible { background: var(--tp-soft); outline: none; }
.ta-more-menu button[aria-current="page"] { background: var(--tp-soft); box-shadow: inset 3px 0 0 var(--tp-accent); }
.ta-more-menu .ta-more-ico { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; background: var(--tp-soft); font-size: 1.05rem; }
.ta-more-menu strong, .ta-more-menu small { display: block; }
.ta-more-menu strong { font-size: .92rem; }
.ta-more-menu small { margin-top: 1px; color: var(--tp-muted); font-size: .74rem; }

/* ── Home ─────────────────────────────────────────────────────────────── */
.th-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.th-kicker { display: block; color: #fcd34d; font-size: .66rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
#screen-teacher .ta-tab-content .th-hero h3 { margin: .15rem 0 0; font-family: 'Caveat', cursive; font-size: 1.9rem; line-height: 1.1; color: #fff; }
#screen-teacher#screen-teacher .ta-tab-content .th-hero p { margin: .3rem 0 0; font-size: .95rem; color: rgba(240,236,220,.85) !important; }
.th-refresh { flex: none; min-height: 44px; padding: 0 .9rem; border: 1px solid rgba(240,236,220,.35); border-radius: 10px; background: rgba(255,255,255,.08); color: #f0ece0; font-weight: 700; cursor: pointer; }
.th-refresh:disabled { opacity: .55; }
.th-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .7rem; margin: .5rem 0 1.1rem; }
.th-action {
  display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto; column-gap: .7rem; align-items: center;
  min-height: 84px; padding: .85rem .95rem; border: 1px solid var(--tp-line); border-radius: 16px; background: var(--tp-bg); color: var(--tp-ink);
  text-align: left; cursor: pointer; transition: transform .14s, box-shadow .14s; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.th-action:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.22); }
.th-action:focus-visible { outline: 3px solid var(--tp-gold); outline-offset: 2px; }
.th-action > span { grid-row: 1 / 3; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--tp-soft); font-size: 1.45rem; }
.th-action strong { font-size: 1rem; }
.th-action small { color: var(--tp-muted); font-size: .76rem; line-height: 1.3; }
.th-action-primary { background: var(--tp-gold); color: var(--tp-gold-ink); border-color: #d1aa2c; }
.th-action-primary > span { background: rgba(255,255,255,.55); }
.th-action-primary small { color: #4a3708; }
.th-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .8rem; }
.th-card { min-width: 0; border: 1px solid var(--tp-line); border-radius: 16px; background: var(--tp-bg); color: var(--tp-ink); overflow: hidden; }
.th-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem .95rem; border-bottom: 1px solid var(--tp-line); }
.th-card-head h4 { margin: 0; font-size: .95rem; font-weight: 800; }
.th-card-head button { min-height: 36px; padding: 0 .7rem; border: 0; border-radius: 8px; background: var(--tp-soft); color: var(--tp-ink); font-size: .78rem; font-weight: 700; cursor: pointer; }
.th-row { display: flex; align-items: center; gap: .65rem; padding: .7rem .95rem; border-bottom: 1px solid var(--tp-line); }
.th-row:last-child { border-bottom: 0; }
.th-row-main { flex: 1; min-width: 0; }
.th-row-main strong, .th-row-main small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.th-row-main strong { font-size: .9rem; }
.th-row-main small { margin-top: 2px; color: var(--tp-muted); font-size: .74rem; }
.th-row time { flex: none; color: var(--tp-muted); font-size: .72rem; }
.th-row-btn { flex: none; min-height: 40px; padding: 0 .75rem; border: 1px solid var(--tp-line); border-radius: 9px; background: var(--tp-soft); color: var(--tp-ink); font-size: .78rem; font-weight: 700; cursor: pointer; }
.th-chip { flex: none; padding: .2rem .55rem; border-radius: 999px; background: var(--tp-idle-bg); color: var(--tp-idle-ink); font-size: .72rem; font-weight: 700; white-space: nowrap; }
.th-chip-good { background: var(--tp-good-bg); color: var(--tp-good-ink); }
.th-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: #d9f3d8; color: #203623; font-weight: 900; font-size: .8rem; }
.th-empty { padding: 1rem .95rem 1.1rem; }
.th-empty p { margin: 0 0 .5rem; color: var(--tp-muted); font-size: .88rem; line-height: 1.45; }
.th-empty small { display: block; color: var(--tp-muted); font-size: .74rem; }
.th-empty button { min-height: 44px; padding: 0 1rem; border: 0; border-radius: 10px; background: var(--tp-gold); color: var(--tp-gold-ink); font-weight: 800; cursor: pointer; }
.th-empty-good p { color: var(--tp-good-ink); font-weight: 700; }
.th-more { margin: 0; padding: .5rem .95rem .8rem; color: var(--tp-muted); font-size: .76rem; }
.th-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; padding: .9rem 1rem; border-radius: 12px; border: 1px solid #f59e0b; background: var(--tp-warn-bg); color: var(--tp-warn-ink); }
.th-error p { margin: 0; font-size: .9rem; }
.th-error-inline { margin-bottom: .9rem; }
.th-skeleton, .tc-skeleton { padding: .3rem 0; }
.th-sk-line { height: 18px; width: 45%; margin: .4rem 0; border-radius: 8px; background: rgba(255,255,255,.14); animation: ta-pulse 1.4s ease-in-out infinite; }
.th-sk-line.th-sk-wide { width: 70%; height: 26px; }
.th-sk-actions, .th-sk-cards { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .7rem; margin-top: .8rem; }
.th-sk-actions > div { height: 84px; border-radius: 16px; background: rgba(255,255,255,.12); animation: ta-pulse 1.4s ease-in-out infinite; }
.th-sk-cards > div { height: 150px; border-radius: 16px; background: rgba(255,255,255,.08); animation: ta-pulse 1.4s ease-in-out infinite; }

/* ── Set Work form ─────────────────────────────────────────────────────── */
.ta-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .6rem .9rem; }
.ta-field { display: flex; flex-direction: column; gap: .3rem; margin: .35rem 0 .55rem; min-width: 0; }
.ta-field-narrow { max-width: 300px; }
.ta-field-wide { max-width: 520px; }
#screen-teacher .ta-tab-content .ta-field > label { font-size: .88rem; font-weight: 700; color: rgba(240,236,220,.92) !important; }
#screen-teacher .ta-tab-content .ta-field > label span { display: block; font-weight: 500; font-size: .76rem; color: rgba(240,236,220,.62) !important; }
#screen-teacher .ta-field select, #screen-teacher .ta-field input:not([type=checkbox]) { width: 100%; min-height: 46px; font-size: 1rem; }
#screen-teacher .ta-field input[type=date] { max-width: 240px; }
#screen-teacher#screen-teacher .ta-tab-content .ta-form-note { margin: .25rem 0 .6rem; font-size: .84rem; color: rgba(240,236,220,.72) !important; line-height: 1.45; }
#screen-teacher#screen-teacher .ta-tab-content .ta-form-help { margin: .1rem 0 .6rem; font-size: .88rem; color: rgba(240,236,220,.78) !important; }
.ta-chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .4rem; max-height: 220px; overflow-y: auto; padding: .45rem; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.15); }
.ta-chapter-opt { display: flex; align-items: center; gap: .5rem; min-height: 40px; padding: .35rem .5rem; border-radius: 8px; cursor: pointer; font-size: .86rem; }
.ta-chapter-opt:hover { background: rgba(255,255,255,.08); }
.ta-chapter-opt input { width: 18px; height: 18px; accent-color: #f4ce52; flex: none; }
.ta-chapter-opt:has(input:checked) { background: rgba(244,206,82,.18); }
.ta-share-choice { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .6rem; margin: .7rem 0 .3rem; }
#screen-teacher .ta-tab-content .ta-share-opt {
  display: grid; grid-template-columns: 40px 1fr; column-gap: .7rem; align-items: center; min-height: 72px; padding: .7rem .8rem;
  border: 2px solid var(--tp-line); border-radius: 14px; background: var(--tp-bg); color: var(--tp-ink) !important; cursor: pointer; transition: border-color .14s, box-shadow .14s;
}
#screen-teacher .ta-tab-content .ta-share-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.ta-share-opt-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--tp-soft); font-size: 1.25rem; }
.ta-share-opt-text strong, .ta-share-opt-text small { display: block; }
.ta-share-opt-text strong { font-size: .95rem; }
.ta-share-opt-text small { margin-top: 2px; color: var(--tp-muted) !important; font-size: .78rem; line-height: 1.35; }
#screen-teacher .ta-tab-content .ta-share-opt.ta-share-opt-sel { border-color: #e5bd3a; box-shadow: 0 0 0 3px rgba(229,189,58,.35); }
#screen-teacher .ta-tab-content .ta-share-opt.ta-share-opt-disabled { opacity: .55; cursor: not-allowed; }

/* One go per device. A checkbox, not a third sharing card: it MODIFIES the open
   link rather than replacing it, and a card would read as a choice between three. */
#screen-teacher .ta-tab-content .ta-one-device {
  display: grid; grid-template-columns: 22px 1fr; column-gap: .7rem; align-items: start;
  margin-top: .6rem; padding: .7rem .8rem; min-height: 56px;
  border: 1px solid var(--tp-line); border-radius: 14px; background: var(--tp-bg); color: var(--tp-ink) !important; cursor: pointer;
}
#screen-teacher .ta-tab-content .ta-one-device input { width: 22px; height: 22px; margin-top: 2px; accent-color: #e5bd3a; cursor: pointer; }
.ta-one-device-text strong, .ta-one-device-text small { display: block; }
.ta-one-device-text strong { font-size: .92rem; }
.ta-one-device-text small { margin-top: 2px; color: var(--tp-muted) !important; font-size: .78rem; line-height: 1.35; }
.ta-due-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1rem; }
.ta-due-chips { display: flex; flex-wrap: wrap; gap: .4rem; padding-bottom: .6rem; }
.ta-due-chips button { min-height: 44px; padding: 0 .9rem; border: 1.5px solid rgba(240,236,220,.45); border-radius: 999px; background: rgba(255,255,255,.07); color: #f0ece0; font-size: .88rem; font-weight: 700; cursor: pointer; }
.ta-due-chips button.ta-due-chip-sel { background: #f4ce52; color: #2d1f04; border-color: #f4ce52; }
#screen-teacher .ta-tab-content .ta-more-options { margin: .9rem 0 1rem; border: 1px solid var(--tp-line); border-radius: 14px; background: var(--tp-bg); color: var(--tp-ink) !important; }
.ta-more-options > summary { display: flex; align-items: center; justify-content: space-between; gap: .6rem; min-height: 52px; padding: .6rem .95rem; cursor: pointer; list-style: none; font-weight: 800; }
.ta-more-options > summary::-webkit-details-marker { display: none; }
.ta-more-options > summary::after { content: '▾'; font-size: 1.1rem; color: var(--tp-muted); transition: transform .15s; }
.ta-more-options[open] > summary::after { transform: rotate(180deg); }
.ta-more-options > summary small { flex: 1; color: var(--tp-muted) !important; font-weight: 500; font-size: .78rem; }
.ta-more-options > *:not(summary) { padding: 0 .95rem; }
.ta-more-options > .ta-form-note { padding-bottom: .9rem; }
#screen-teacher .ta-tab-content .ta-more-options .ta-field > label { color: var(--tp-ink) !important; }
#screen-teacher .ta-tab-content .ta-more-options .ta-field > label span { color: var(--tp-muted) !important; }
#screen-teacher .ta-more-options select, #screen-teacher .ta-more-options input:not([type=checkbox]) {
  background: var(--tp-soft) !important; color: var(--tp-ink) !important; border: 1px solid var(--tp-line) !important; border-radius: 10px !important; padding: .5rem .7rem !important;
}
#screen-teacher .ta-more-options input::placeholder { color: var(--tp-muted) !important; }
.ta-check { display: flex; align-items: center; gap: .55rem; min-height: 44px; font-size: .92rem; cursor: pointer; }
.ta-check input { width: 20px; height: 20px; accent-color: #2a4d28; }
.ta-pupils-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .3rem; max-height: 240px; overflow-y: auto; padding: .4rem; border-radius: 10px; background: var(--tp-soft); }
.ta-pupils-tools { grid-column: 1 / -1; font-size: .8rem; color: var(--tp-muted); }
.ta-pupil-opt { display: flex; align-items: center; gap: .5rem; min-height: 40px; padding: .25rem .45rem; border-radius: 8px; font-size: .88rem; cursor: pointer; }
.ta-pupil-opt input { width: 18px; height: 18px; accent-color: #2a4d28; }
#screen-teacher#screen-teacher .ta-tab-content .ta-quota { margin: .2rem 0 .6rem; font-size: .8rem; color: rgba(240,236,220,.7) !important; }
#ta-build-btn { min-height: 56px; }
#ta-build-btn:disabled { opacity: .6; cursor: wait; transform: none; }

/* ── Work cards ────────────────────────────────────────────────────────── */
.ta-results-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; margin-bottom: .6rem; }
.ta-results-head h3 { margin: 0; }
.ta-list-tools { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.ta-list-tools select { min-width: 160px; }
/* ⚠ Work cards were tall enough to hide the list they belong to: five text
   lines plus a 2x2 block of four buttons, so on a laptop barely two cards fit
   above the fold and on a phone one card WAS the screen. The information is all
   still here — what changed is that the four actions sit on ONE wrapping row
   instead of two fixed ones, and the metadata lines are tighter.
   ⚠ The 44px minimum on the buttons is NOT reduced. Shrinking a teacher's tap
   target to win vertical space is the wrong trade; the height came out of
   padding and the second button row instead. */
.tw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .7rem; }
.tw-card { display: flex; flex-direction: column; gap: .22rem; min-width: 0; padding: .7rem .8rem .65rem; border: 1px solid var(--tp-line); border-radius: 16px; background: var(--tp-bg); color: var(--tp-ink); box-shadow: 0 4px 14px rgba(0,0,0,.16); cursor: pointer; transition: transform .14s, box-shadow .14s; }
.tw-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.22); }
.tw-card:focus-visible { outline: 3px solid var(--tp-gold); outline-offset: 2px; }
.tw-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tw-status { padding: .18rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.tw-status-active { background: var(--tp-good-bg); color: var(--tp-good-ink); }
.tw-status-closed { background: var(--tp-bad-bg); color: var(--tp-bad-ink); }
.tw-status-archived { background: var(--tp-idle-bg); color: var(--tp-idle-ink); }
.tw-due { font-size: .76rem; font-weight: 700; color: var(--tp-muted); }
.tw-due-soon { color: #b45309; }
.dark .tw-due-soon { color: #fcd34d; }
.tw-title { margin: .1rem 0 0; font-size: 1rem; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.tw-meta { margin: 0; font-size: .78rem; color: var(--tp-muted); line-height: 1.3; }
.tw-meta-dim { font-size: .72rem; }
.tw-progress { overflow: hidden; height: 6px; margin-top: .3rem; border-radius: 999px; background: var(--tp-idle-bg); }
.tw-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#22c55e,#16a34a); }
.tw-completion { margin: .1rem 0 .3rem; font-size: .8rem; font-weight: 700; }
/* Everyone finished. Part-done keeps the ordinary ink on purpose — see the
   note beside this class in teacher_workspace.js. */
.tw-completion-all { color: #15803d; }
.tw-completion-some { color: var(--tp-ink); }
#screen-teacher#screen-teacher .tw-completion-all { color: #4ade80; }
/* ⚠ ONE wrapping row, not a fixed 2-column grid. The grid forced the four
   actions onto two rows on every card at every width, which was ~56px of pure
   height per card. Flex lets them sit on one row wherever they fit and wrap
   only where they genuinely cannot. */
.tw-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; }
.tw-actions .tw-btn { flex: 1 1 auto; }
/* The three secondary actions are fixed 44px squares, so the row is
   primary + 3 icons and fits one line at every card width.
   ⚠ Selector must be `.tw-actions .tw-btn-icon`, not `.tw-btn-icon`: the rule
   above scores (0,2,0) and a bare class scores (0,1,0), so the icons kept
   stretching and the row still wrapped. Measured, not assumed. */
.tw-actions .tw-btn-icon { flex: 0 0 44px; width: 44px; padding: 0; font-size: 1rem; }
.tw-actions .tw-btn-primary { flex: 1 1 auto; min-width: 7rem; }
.tw-btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; min-height: 44px; padding: 0 .8rem; border: 1px solid var(--tp-line); border-radius: 10px; background: var(--tp-soft); color: var(--tp-ink); font-size: .84rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.tw-btn:hover { filter: brightness(.96); }
.tw-btn:disabled { opacity: .5; cursor: default; }
.tw-btn-primary { background: var(--tp-accent); color: var(--tp-accent-ink); border-color: transparent; }

/* ── Results screen ────────────────────────────────────────────────────── */
.tr-wrap { padding: 1rem; border: 1px solid var(--tp-line); border-radius: 18px; background: var(--tp-bg); color: var(--tp-ink); }
.tr-stale { opacity: .8; }
.tr-updating { margin: .2rem 0 .6rem; color: var(--tp-muted); font-size: .8rem; animation: ta-pulse 1.4s ease-in-out infinite; }
.tr-head { display: flex; align-items: flex-start; gap: .7rem; flex-wrap: wrap; }
.tr-back { min-height: 40px; padding: 0 .7rem; border: 1px solid var(--tp-line); border-radius: 9px; background: var(--tp-soft); color: var(--tp-ink); font-size: .82rem; font-weight: 700; cursor: pointer; }
.tr-head-main { flex: 1; min-width: 200px; }
.tr-head-main h3 { margin: 0; font-size: 1.25rem; font-weight: 850; line-height: 1.2; }
.tr-head-main p { margin: .2rem 0 0; color: var(--tp-muted); font-size: .82rem; }
.tr-toolbar { display: flex; flex-wrap: wrap; gap: .45rem; margin: .8rem 0; }
.tr-stats { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: .5rem; margin-bottom: .9rem; }
.tr-stats > div { padding: .7rem .4rem; border-radius: 12px; background: var(--tp-soft); text-align: center; }
.tr-stats strong { display: block; font-size: 1.35rem; line-height: 1.1; }
.tr-stats span { display: block; margin-top: 3px; color: var(--tp-muted); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.tr-stat-good { background: var(--tp-good-bg); color: var(--tp-good-ink); }
.tr-stat-good span { color: inherit; }
.tr-help { margin: 0 0 .8rem; padding: .8rem .95rem; border: 2px solid #f4ce52; border-radius: 14px; background: var(--tp-warn-bg); color: var(--tp-warn-ink); }
.tr-help-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .3rem; }
.tr-help-head h4 { margin: 0; font-size: 1rem; font-weight: 850; }
.tr-help-head small { font-size: .74rem; }
.tr-help-empty { margin: .2rem 0; font-size: .9rem; }
.tr-help-good { font-weight: 700; }
.tr-insight { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .55rem 0; border-top: 1px solid rgba(0,0,0,.08); }
.dark .tr-insight { border-top-color: rgba(255,255,255,.12); }
.tr-insight > div { min-width: 0; }
.tr-insight strong, .tr-insight small { display: block; }
.tr-insight strong { font-size: .92rem; }
.tr-insight small { margin-top: 1px; font-size: .76rem; opacity: .85; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tr-insight-btn { flex: none; min-height: 44px; padding: 0 .85rem; border: 0; border-radius: 10px; background: var(--tp-gold); color: var(--tp-gold-ink); font-size: .82rem; font-weight: 800; cursor: pointer; }
.tr-bulk { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .5rem; margin-bottom: 1rem; }
.tr-bulk button { min-height: 48px; padding: .4rem .8rem; border: 1px solid var(--tp-line); border-radius: 12px; background: var(--tp-soft); color: var(--tp-ink); font-size: .86rem; font-weight: 700; cursor: pointer; text-align: left; }
.tr-bulk button:disabled { opacity: .5; cursor: default; }
.tr-group { margin-bottom: .9rem; border: 1px solid var(--tp-line); border-radius: 14px; overflow: hidden; }
.tr-group h4 { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .6rem .85rem; background: var(--tp-soft); font-size: .92rem; font-weight: 800; }
.tr-group h4 span { padding: .05rem .5rem; border-radius: 999px; background: var(--tp-idle-bg); color: var(--tp-idle-ink); font-size: .74rem; }
.tr-group-help h4 { background: var(--tp-warn-bg); color: var(--tp-warn-ink); }
.tr-group-completed h4 { background: var(--tp-good-bg); color: var(--tp-good-ink); }
.tr-group-empty { margin: 0; padding: .7rem .85rem; color: var(--tp-muted); font-size: .84rem; }
.tr-row { display: grid; grid-template-columns: 36px 1fr auto; column-gap: .65rem; align-items: center; padding: .6rem .85rem; border-top: 1px solid var(--tp-line); }
.tr-row-help { background: rgba(244,206,82,.12); }
.tr-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #d9f3d8; color: #203623; font-weight: 900; font-size: .8rem; }
.tr-row-main { min-width: 0; }
.tr-row-main strong, .tr-row-main small { display: block; }
.tr-row-main strong { font-size: .92rem; }
.tr-row-main small { margin-top: 1px; color: var(--tp-muted); font-size: .76rem; }
.tr-row-main small b { color: var(--tp-ink); }
.tr-flag { display: inline-block; margin-left: .3rem; padding: .05rem .45rem; border-radius: 999px; background: var(--tp-warn-bg); color: var(--tp-warn-ink); font-size: .68rem; font-weight: 800; vertical-align: middle; }
.tr-flag-rush { background: var(--tp-idle-bg); color: var(--tp-idle-ink); }

/* ── Who has finished ──────────────────────────────────────────────────────
   A teacher scanning 25 pupils wants "who is done" in one look. Green is the
   fast signal, but it is never the ONLY one: each row carries a glyph and a
   word too (✓ Done / ● Working / ○ Not started), so the state survives a
   colour-vision deficiency, a greyscale printout and a screenshot.
   ⚠ The left border, not a full green wash. A filled row fights the
   "may need help" amber highlight, which is the other thing this list has to
   be able to say — and a pupil can legitimately be both finished and struggling. */
.tr-row-completed   { border-left: 4px solid #16a34a; }
.tr-row-working     { border-left: 4px solid #d97706; }
.tr-row-not-started { border-left: 4px solid transparent; }
.tr-state {
  display: inline-block; margin-left: .35rem; padding: .05rem .45rem;
  border-radius: 999px; font-size: .68rem; font-weight: 800; vertical-align: middle;
}
.tr-state-done    { background: #dcfce7; color: #14532d; }
.tr-state-working { background: #fef3c7; color: #713f12; }
.tr-state-idle    { background: #e5e7eb; color: #374151; }
.tr-avatar-completed { background: #bbf7d0; color: #14532d; }
.tr-avatar-working   { background: #fde68a; color: #713f12; }
.tr-avatar-not-started { background: #e5e7eb; color: #4b5563; }
/* ⚠ The results list sits on the teacher CHALKBOARD, whose
   `p:not(…):not(…)` rule scores (1,3,1) and beats any single-id override — so
   these use the doubled id, like the rest of the command-centre CSS. The pills
   keep their own dark ink on a light chip rather than inheriting chalk, which
   on these backgrounds measured below 4.5:1. */
#screen-teacher#screen-teacher .tr-state-done    { background: #bbf7d0; color: #052e16; }
#screen-teacher#screen-teacher .tr-state-working { background: #fde68a; color: #451a03; }
#screen-teacher#screen-teacher .tr-state-idle    { background: #e5e7eb; color: #1f2937; }
#screen-teacher#screen-teacher .tr-row-completed { border-left-color: #4ade80; }
#screen-teacher#screen-teacher .tr-row-working   { border-left-color: #fbbf24; }
.tr-row-actions { display: flex; gap: .3rem; }
.tr-mini { min-height: 40px; padding: 0 .65rem; border: 1px solid var(--tp-line); border-radius: 9px; background: var(--tp-soft); color: var(--tp-ink); font-size: .76rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.tr-mini:disabled { opacity: .55; cursor: default; }
.tr-answers { grid-column: 2 / -1; margin-top: .3rem; font-size: .82rem; }
.tr-answers summary { min-height: 36px; display: flex; align-items: center; cursor: pointer; color: var(--tp-muted); font-weight: 700; }
.tr-answers p { margin: .25rem 0; padding: .45rem .6rem; border-radius: 8px; background: var(--tp-soft); line-height: 1.4; }
.tr-answers p.ok { background: var(--tp-good-bg); color: var(--tp-good-ink); }
.tr-answers p.wrong { background: var(--tp-bad-bg); color: var(--tp-bad-ink); }
.tr-updated { margin: .4rem 0 0; color: var(--tp-muted); font-size: .74rem; }
.ta-answer-panel { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid rgba(255,255,255,.15); }

/* ── Success / share modal ─────────────────────────────────────────────── */
.ta-share-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .4rem 0 .8rem; }
.ta-share-facts > div { padding: .5rem .65rem; border-radius: 10px; background: #f3f4f6; }
.dark .ta-share-facts > div { background: #374151; }
.ta-share-facts small { display: block; color: #6b7280; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.dark .ta-share-facts small { color: #d1d5db; }
.ta-share-facts strong { display: block; font-size: .86rem; color: #111827; overflow-wrap: anywhere; }
.dark .ta-share-facts strong { color: #f9fafb; }
.ta-share-warning { margin: 0 0 .8rem; padding: .6rem .75rem; border-radius: 10px; background: #fef3c7; color: #92400e; font-size: .8rem; line-height: 1.45; }
.dark .ta-share-warning { background: #78350f; color: #fde68a; }
.ta-share-link-row { display: flex; gap: .4rem; margin-bottom: .4rem; }
.ta-share-copy { flex: none; min-height: 44px; padding: 0 .8rem; border: 0; border-radius: 10px; background: #e5bd3a; color: #2d1f04; font-weight: 800; font-size: .84rem; cursor: pointer; }
.ta-share-qr { display: flex; flex-direction: column; align-items: center; gap: .3rem; margin: .3rem 0 .9rem; }
.ta-share-qr canvas { border-radius: 10px; background: #fff; }
.ta-share-qr small { color: #6b7280; font-size: .74rem; }
.dark .ta-share-qr small { color: #d1d5db; }
.ta-share-panel .grid button { min-height: 46px; }
.ta-share-close { min-width: 44px; min-height: 44px; }
.ta-share-textarea { width: 100%; min-height: 120px; margin-bottom: .7rem; padding: .6rem .7rem; border-radius: 10px; border: 1px solid rgba(240,236,220,.25); background: rgba(0,0,0,.25); color: #f0ece0; font-size: .86rem; line-height: 1.45; resize: vertical; }
/* One to three buttons now, not always two: WhatsApp moved above the message
   and Copy link / More apps appear only when they apply. */
.ta-share-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; }
.ta-share-row .tc-share-copy-btn { min-height: 46px; flex: 1 1 auto; }
/* The share sheet WhatsApp button now sits above the message it will send. */
.tc-share-inner .tc-share-wa-btn { margin-bottom: .8rem; }
/* ⚠ The hint sits on the dark share panel: .4 alpha measured under 4.5:1. */
.tc-share-hint { color: rgba(240,236,220,.72); }

/* ── Teacher settings ──────────────────────────────────────────────────── */
.ta-settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.ta-settings-card { display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; column-gap: .7rem; align-items: center; min-height: 76px; padding: .8rem .9rem; border: 1px solid var(--tp-line); border-radius: 14px; background: var(--tp-bg); color: var(--tp-ink); text-align: left; cursor: pointer; }
.ta-settings-card:hover { box-shadow: 0 8px 18px rgba(0,0,0,.2); }
.ta-settings-card > span { grid-row: 1 / 3; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--tp-soft); font-size: 1.3rem; }
.ta-settings-card strong { font-size: .95rem; }
.ta-settings-card small { color: var(--tp-muted); font-size: .76rem; line-height: 1.3; }
.ta-settings-note { padding: .9rem 1rem; border: 1px solid var(--tp-line); border-radius: 14px; background: var(--tp-bg); color: var(--tp-ink); }
.ta-settings-note strong { display: block; margin-bottom: .3rem; }
.ta-settings-note p { margin: 0; font-size: .88rem; line-height: 1.5; color: var(--tp-muted) !important; }

/* ── Classroom overlay: three sections + More ──────────────────────────── */
.tc-cd-nav-btn { min-height: 56px; }
.tc-cd-nav-more { position: relative; margin-top: auto; }
.tc-cd-more-menu { position: absolute; left: calc(100% + 6px); bottom: 0; z-index: 30; min-width: 190px; padding: .35rem; border-radius: 12px; background: var(--tp-bg); color: var(--tp-ink); border: 1px solid var(--tp-line); box-shadow: 0 14px 34px rgba(0,0,0,.35); }
.tc-cd-more-menu.hidden { display: none; }
.tc-cd-more-menu button { display: block; width: 100%; min-height: 44px; padding: .4rem .7rem; border: 0; border-radius: 8px; background: none; color: inherit; font-size: .9rem; font-weight: 700; text-align: left; cursor: pointer; }
.tc-cd-more-menu button:hover, .tc-cd-more-menu button[aria-current="page"] { background: var(--tp-soft); }
.tc-cd-action-btn { min-height: 44px; }
.tc-cd-action-big { min-height: 48px; font-size: 1.05rem; padding: .5rem 1.1rem; }
.tc-cd-share-btn { min-height: 44px; }
.tc-cd-back { min-height: 44px; }
.tc-cd-inline-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin: 0 0 .9rem; padding: .8rem .95rem; border-radius: 12px; border: 1px solid #f59e0b; background: rgba(245,158,11,.14); color: #fde68a; }
.tc-cd-inline-error p { margin: 0; font-size: .88rem; }
.tc-cd-inline-error button { min-height: 44px; padding: 0 1rem; border: 0; border-radius: 10px; background: #f4ce52; color: #2d1f04; font-weight: 800; cursor: pointer; }
.tc-today-stats > button { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; column-gap: .65rem; align-items: center; min-width: 0; min-height: 64px; padding: .75rem; border: 1px solid rgba(255,255,255,.13); border-radius: 14px; background: rgba(9,28,14,.25); color: #fff; text-align: left; cursor: pointer; }
.tc-today-stats > button:hover { background: rgba(255,255,255,.1); }
.tc-cd-section-sub { margin: .1rem 0 0; color: rgba(240,236,220,.65); font-size: .8rem; }
.tc-work-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .9rem; }
.tc-work-filter { min-height: 44px; padding: 0 .9rem; border: 1.5px solid rgba(240,236,220,.35); border-radius: 999px; background: rgba(255,255,255,.06); color: #f0ece0; font-size: .88rem; font-weight: 700; cursor: pointer; }
.tc-work-filter span { margin-left: .3rem; padding: .05rem .45rem; border-radius: 999px; background: rgba(255,255,255,.14); font-size: .74rem; }
.tc-work-filter.on { background: #f4ce52; color: #2d1f04; border-color: #f4ce52; }
.tc-work-filter.on span { background: rgba(0,0,0,.12); }
.tc-work-subhead { display: flex; align-items: center; gap: .6rem; margin: 1.1rem 0 .5rem; color: #f0ece0; font-size: 1rem; font-weight: 800; }
.tc-work-subhead .ta-link-btn { font-size: .8rem; color: #fde68a; }
.tc-work-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; }
.tc-work-file { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: .55rem; align-items: center; min-height: 56px; padding: .55rem .7rem; border: 1px solid var(--tp-line); border-radius: 12px; background: var(--tp-bg); color: var(--tp-ink); text-align: left; cursor: pointer; }
.tc-work-file > span { grid-row: 1 / 3; font-size: 1.4rem; }
.tc-work-file strong { font-size: .86rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tc-work-file small { color: var(--tp-muted); font-size: .72rem; }
.tc-cd-content .tw-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* Pupils roster */
.tp-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; }
.tp-row[hidden] { display: none; }
.tp-row-flag { background: rgba(244,206,82,.08); }
.tp-open { display: flex; flex: 1; min-width: 160px; align-items: center; gap: .7rem; min-height: 48px; padding: .2rem .3rem; border: 0; border-radius: 10px; background: none; color: inherit; text-align: left; cursor: pointer; }
.tp-open:hover { background: rgba(255,255,255,.07); }
.tp-flag { padding: .2rem .55rem; border-radius: 999px; background: rgba(0,0,0,.34); border: 1px solid rgba(251,191,36,.45); color: #fde68a; font-size: .72rem; font-weight: 800; white-space: nowrap; }
/* Amber on a translucent amber tint measured 3.7:1 on the board; a dark tint behind the same amber clears 4.5:1. */
.tc-cd-student-pin-badge { background: rgba(0,0,0,.34); border-color: rgba(251,191,36,.5); color: #fde68a; }
.tp-pin { display: flex; align-items: center; gap: .35rem; }
.tp-pin .tc-cd-pill { min-height: 40px; }
.tp-pin .hidden { display: none; }
.tp-manage { position: relative; }
.tp-manage > summary { display: grid; place-items: center; width: 44px; height: 40px; border: 1px solid rgba(240,236,220,.3); border-radius: 10px; color: #f0ece0; font-size: 1.2rem; list-style: none; cursor: pointer; }
.tp-manage > summary::-webkit-details-marker { display: none; }
.tp-manage-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 190px; padding: .3rem; border-radius: 12px; background: var(--tp-bg); color: var(--tp-ink); border: 1px solid var(--tp-line); box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.tp-manage-menu button { display: block; width: 100%; min-height: 44px; padding: 0 .7rem; border: 0; border-radius: 8px; background: none; color: inherit; font-size: .88rem; font-weight: 700; text-align: left; cursor: pointer; }
.tp-manage-menu button:hover { background: var(--tp-soft); }
.tp-manage-menu button.danger { color: #b91c1c; }
.dark .tp-manage-menu button.danger { color: #fca5a5; }
.tc-cd-register-name small { white-space: normal; }

/* Dialogs used by the roster (rename, new PIN) */
.tp-dialog-overlay { position: fixed; inset: 0; z-index: 10002; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.tp-dialog { width: 100%; max-width: 340px; padding: 1.5rem 1.4rem; border-radius: 20px; background: var(--tp-bg); color: var(--tp-ink); box-shadow: 0 16px 48px rgba(0,0,0,.3); }
.tp-dialog-center { text-align: center; }
.tp-dialog-title { margin: 0 0 .8rem; font-size: 1.05rem; font-weight: 800; }
.tp-dialog-label { display: block; margin-bottom: .35rem; color: var(--tp-muted); font-size: .85rem; }
.tp-dialog-input { width: 100%; min-height: 46px; padding: .5rem .75rem; border: 1.5px solid var(--tp-line); border-radius: 10px; background: var(--tp-soft); color: var(--tp-ink); font-size: 1rem; }
.tp-dialog-pin { margin: .2rem 0 .5rem; padding: .8rem 0; border-radius: 12px; background: var(--tp-soft); color: var(--tp-ink); font-family: ui-monospace, monospace; font-size: 2.4rem; font-weight: 900; letter-spacing: .2em; }
.tp-dialog-hint { margin: 0 0 1rem; color: var(--tp-muted); font-size: .8rem; }
.tp-dialog-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; }
.tp-dialog-actions button { flex: 1; min-height: 46px; border-radius: 12px; font-weight: 800; cursor: pointer; }
.tp-dialog-ok { border: 0; background: #1d4ed8; color: #fff; }
.tp-dialog-cancel { border: 1px solid var(--tp-line); background: var(--tp-soft); color: var(--tp-ink); }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .th-actions { grid-template-columns: 1fr; }
  .tr-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .th-sk-actions, .th-sk-cards { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .ta-form-grid { grid-template-columns: 1fr; }
  .ta-share-choice { grid-template-columns: 1fr; }
  .tr-bulk { grid-template-columns: 1fr; }
  .tw-grid, .tc-cd-content .tw-grid { grid-template-columns: 1fr; }
  .ta-results-head { flex-direction: column; }
  .tc-cd-more-menu { left: 0; bottom: calc(100% + 6px); }
  .tp-row { padding: .6rem .5rem; }
  .tp-open { min-width: 0; flex-basis: 100%; }
}
@media (max-width: 480px) {
  .tc-class-overview { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; overflow: visible !important; }
  .tc-class-overview > div { min-width: 0; padding: .6rem .3rem; }
  .tc-class-overview strong { font-size: 1.2rem; }
  .tc-class-overview small { font-size: .66rem; }
  .th-hero { flex-direction: column; }
  .th-refresh { align-self: flex-start; }
  .tr-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .tr-row { grid-template-columns: 32px 1fr; }
  .tr-row-actions { grid-column: 2 / -1; margin-top: .3rem; }
  .th-row { flex-wrap: wrap; }
  .th-row-btn { flex-basis: 100%; }
  .ta-more-menu { width: 260px; }
  #screen-teacher .ta-tab-content { padding: 1rem .8rem .9rem; }
}

/* The parent dashboard is a chalkboard in BOTH themes (see #screen-parent
   above), so inside it the card takes the board's chalk palette rather than
   the light/dark one. Same rule as every other #screen-parent override. */
#screen-parent .gs-card-wrap { border-top-color: rgba(240,236,220,.16); }
#screen-parent .gs-summary { color: #f0ece8; background: rgba(240,236,220,.10); }
#screen-parent .gs-btn { background: rgba(240,236,220,.08); color: #f0ece8; border-color: rgba(240,236,220,.35); }
#screen-parent .gs-btn-open { color: #c7d2fe; border-color: #818cf8; }
#screen-parent .gs-btn-primary { background: #4f46e5; border-color: #4f46e5; color: #fff; }
#screen-parent .gs-lead, #screen-parent .gs-h, #screen-parent .gs-row-label, #screen-parent .gs-toggle-text b,
#screen-parent .gs-card-body b, #screen-parent .gs-which b, #screen-parent .gs-onoff, #screen-parent .gs-row-total,
#screen-parent .gs-row-total > b { color: #f0ece8; }
#screen-parent .gs-section { border-color: rgba(240,236,220,.16); }
#screen-parent .gs-note, #screen-parent .gs-card-body > span, #screen-parent .gs-toggle-text span, #screen-parent .gs-which { color: rgba(240,236,220,.72); }
#screen-parent .gs-warn, #screen-parent .gs-status { color: #fca5a5; }
#screen-parent .gs-card { background: rgba(240,236,220,.07); border-color: rgba(240,236,220,.22); }
#screen-parent .gs-card.on { background: rgba(99,102,241,.32); border-color: #a5b4fc; }
#screen-parent .gs-card-mark { border-color: rgba(240,236,220,.5); }
#screen-parent .gs-card.on .gs-card-mark { background: #c7d2fe; border-color: #c7d2fe; color: #1e1b4b; }
#screen-parent .gs-row-val, #screen-parent .gs-which summary { color: #c7d2fe; }
#screen-parent .gs-row input[type=range] { accent-color: #a5b4fc; }
#screen-parent .gs-toggle { border-top-color: rgba(240,236,220,.14); }
#screen-parent .gs-switch { background: rgba(240,236,220,.35); }
#screen-parent .gs-toggle input:checked ~ .gs-switch { background: #6366f1; }

/* ══ MY TIMETABLE - list ⇄ calendar (child) ═══════════════════════════════
   The month grid is built by innerHTML, so it cannot rely on Tailwind: the
   Play CDN only generates rules for classes present at its initial scan.
   Everything below is real CSS for that reason. */
.tt-viewtoggle { display: flex; gap: .4rem; margin: 0 0 1rem 2.25rem; }
.tt-viewbtn {
  flex: 1 1 0; min-height: 44px; padding: .5rem .6rem;
  border: 1px solid #d1d5db; border-radius: .8rem; background: #fff;
  color: #374151; font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.tt-viewbtn:hover { background: #f3f4f6; }
.tt-viewbtn.is-on { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.dark .tt-viewbtn { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }
.dark .tt-viewbtn:hover { background: #374151; }
.dark .tt-viewbtn.is-on { background: #4f46e5; border-color: #818cf8; color: #fff; }

.tt-cal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tt-cal-title { font-size: 1.1rem; font-weight: 800; color: #111827; }
.dark .tt-cal-title { color: #f9fafb; }
.tt-nav {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: .75rem;
  border: 1px solid #d1d5db; background: #fff; color: #374151;
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.tt-nav:hover { background: #f3f4f6; }
.dark .tt-nav { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }
.dark .tt-nav:hover { background: #374151; }
.tt-cal-bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: .35rem 0 .6rem; }
.tt-cal-count { font-size: .72rem; font-weight: 600; color: #6b7280; }
.dark .tt-cal-count { color: #9ca3af; }
.tt-today-btn {
  min-height: 32px; padding: .3rem .8rem; border-radius: 999px;
  border: 1px solid #a5b4fc; background: #eef2ff; color: #3730a3;
  font-size: .72rem; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.dark .tt-today-btn { background: #312e81; border-color: #6366f1; color: #e0e7ff; }

.tt-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: .22rem; margin-bottom: .25rem; }
.tt-dow span {
  text-align: center; font-size: .62rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: #6b7280;
}
.dark .tt-dow span { color: #9ca3af; }
.tt-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .22rem; }
.tt-day {
  position: relative; display: flex; flex-direction: column; gap: .15rem;
  min-height: 74px; padding: .28rem .22rem; overflow: hidden; text-align: left;
  border: 1px solid #e5e7eb; border-radius: .6rem; background: #fff; cursor: pointer;
}
.tt-day:hover { border-color: #a5b4fc; }
.dark .tt-day { background: #111827; border-color: #374151; }
.dark .tt-day:hover { border-color: #6366f1; }
.tt-day.is-blank { border-color: transparent; background: transparent; cursor: default; pointer-events: none; }
.tt-day.is-past { opacity: .6; }
.tt-day.has-work { background: #f8fafc; }
.dark .tt-day.has-work { background: #1f2937; }
/* After .has-work on purpose - today must win whether or not work is planned. */
.tt-day.is-today { background: #eef2ff; border-color: #6366f1; box-shadow: inset 0 0 0 1px #6366f1; opacity: 1; }
.dark .tt-day.is-today { background: #312e81; border-color: #818cf8; box-shadow: inset 0 0 0 1px #818cf8; }
.tt-date { font-size: 1.15rem; font-weight: 800; line-height: 1.05; color: #111827; }
.dark .tt-date { color: #f3f4f6; }
.tt-day.is-today .tt-date { color: #3730a3; }
.dark .tt-day.is-today .tt-date { color: #e0e7ff; }
.tt-done-mark {
  position: absolute; top: .25rem; right: .25rem;
  font-size: .6rem; font-weight: 800; color: #16a34a; line-height: 1;
}
.dark .tt-done-mark { color: #4ade80; }
.tt-chips { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.tt-chip {
  display: flex; align-items: center; gap: .18rem; min-width: 0;
  padding: .1rem .18rem; border-left: 3px solid var(--tt-c, #6366f1);
  border-radius: .25rem; background: rgba(15, 23, 42, .07);
  font-size: .63rem; font-weight: 600; line-height: 1.3; color: #1f2937;
}
.dark .tt-chip { background: rgba(255, 255, 255, .1); color: #e5e7eb; }
.tt-chip-ico { flex-shrink: 0; }
.tt-chip-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-more { font-size: .58rem; font-weight: 700; color: #6b7280; padding-left: .2rem; }
.dark .tt-more { color: #9ca3af; }
/* A 46px-wide square cannot hold readable words for a nine-year-old, so the
   phone grid keeps the subject's colour and icon and the day popup carries the
   words. Above 520px the label fits and is shown. */
@media (max-width: 519px) {
  .tt-chip-txt, .tt-more-word { display: none; }
  .tt-chip { justify-content: center; padding: .12rem .1rem; border-left-width: 4px; }
  .tt-chip-ico { font-size: .8rem; }
}
@media (min-width: 520px) {
  .tt-day { min-height: 104px; padding: .4rem .35rem; }
  .tt-date { font-size: 1.5rem; }
  .tt-chip { font-size: .68rem; padding: .12rem .3rem; }
}
.tt-hint { margin-top: .6rem; font-size: .7rem; color: #6b7280; text-align: center; }
.dark .tt-hint { color: #9ca3af; }
.tt-legend { display: flex; flex-wrap: wrap; gap: .3rem .7rem; margin-top: .5rem; justify-content: center; }
.tt-legend-item { display: inline-flex; align-items: center; gap: .3rem; font-size: .68rem; font-weight: 600; color: #4b5563; }
.dark .tt-legend-item { color: #d1d5db; }
.tt-legend-dot { width: .55rem; height: .55rem; border-radius: 50%; flex-shrink: 0; }

/* ── The day popup ── */
.tt-daysheet { border-radius: 1.25rem 1.25rem 0 0; max-height: 88vh; }
@media (min-width: 640px) { .tt-daysheet { border-radius: 1.25rem; max-height: 84vh; } }
.tt-sessions { display: flex; flex-direction: column; gap: .65rem; }
.tt-sess { border: 1px solid #e5e7eb; border-radius: .9rem; padding: .7rem; background: #fff; }
.dark .tt-sess { border-color: #374151; background: #111827; }
.tt-sess-head { display: flex; gap: .55rem; align-items: flex-start; }
.tt-sess-ico { font-size: 1.35rem; line-height: 1.1; flex-shrink: 0; }
.tt-sess-info { display: flex; flex-direction: column; min-width: 0; gap: .1rem; }
.tt-sess-title { font-size: .9rem; font-weight: 700; color: #1f2937; }
.dark .tt-sess-title { color: #f3f4f6; }
.tt-sess-meta { font-size: .72rem; color: #6b7280; }
.dark .tt-sess-meta { color: #9ca3af; }
.tt-sess-note { font-size: .73rem; color: #6b7280; margin-top: .45rem; line-height: 1.4; }
.dark .tt-sess-note { color: #9ca3af; }
.tt-opts { margin-top: .6rem; display: flex; flex-direction: column; gap: .5rem; }
.tt-start {
  min-height: 44px; border: none; border-radius: .75rem; background: #4f46e5;
  color: #fff; font-size: .85rem; font-weight: 700; cursor: pointer;
}
.tt-start:hover { background: #4338ca; }
.tt-diffs { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.tt-diffs-label { width: 100%; font-size: .66rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.dark .tt-diffs-label { color: #9ca3af; }
.tt-diff {
  min-height: 44px; padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid #d1d5db; background: #f9fafb; color: #374151;
  font-size: .74rem; font-weight: 600; cursor: pointer;
}
.tt-diff:hover { background: #eef2ff; border-color: #a5b4fc; }
.dark .tt-diff { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }
.dark .tt-diff:hover { background: #374151; }
.tt-empty { text-align: center; padding: 1.25rem .5rem; }
.tt-empty-ico { font-size: 2rem; }
.tt-empty-msg { font-size: .85rem; font-weight: 600; color: #374151; margin-top: .4rem; }
.dark .tt-empty-msg { color: #e5e7eb; }
.tt-empty-sub { font-size: .73rem; color: #6b7280; margin-top: .2rem; }
.dark .tt-empty-sub { color: #9ca3af; }
.tt-didsec { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid #e5e7eb; }
.dark .tt-didsec { border-top-color: #374151; }
.tt-didsec-head { font-size: .78rem; font-weight: 700; color: #374151; margin-bottom: .45rem; }
.dark .tt-didsec-head { color: #e5e7eb; }
.tt-did { display: flex; align-items: center; gap: .5rem; padding: .4rem .1rem; }
.tt-did-ico { font-size: 1.05rem; flex-shrink: 0; }
.tt-did-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tt-did-title { font-size: .8rem; font-weight: 600; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dark .tt-did-title { color: #f3f4f6; }
.tt-did-meta { font-size: .68rem; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dark .tt-did-meta { color: #9ca3af; }
.tt-did-pct { font-size: .8rem; font-weight: 800; flex-shrink: 0; }
.tt-choose {
  width: 100%; min-height: 44px; margin-top: .9rem; border-radius: .75rem;
  border: 1px dashed #a5b4fc; background: transparent; color: #4338ca;
  font-size: .8rem; font-weight: 700; cursor: pointer;
}
.dark .tt-choose { border-color: #6366f1; color: #c7d2fe; }

/* ⚠ #screen-schedule is a CHALKBOARD in BOTH themes (see the board block
   above), so the month grid cannot use the light-mode ink the popup uses: dark
   text on a #1e1e1e board measured 1.1:1. Everything that sits ON the board is
   chalk here; the day popup is a normal white/dark sheet outside the screen and
   keeps the rules above. Same shape as the #screen-parent .gs-* block. */
#screen-schedule .tt-viewbtn { background: rgba(240,236,220,.08); border-color: rgba(240,236,220,.35); color: #f0ece8; }
#screen-schedule .tt-viewbtn:hover { background: rgba(240,236,220,.16); }
#screen-schedule .tt-viewbtn.is-on { background: #4f46e5; border-color: #a5b4fc; color: #fff; }
#screen-schedule .tt-cal-title { color: #f0ece8; }
#screen-schedule .tt-nav { background: rgba(240,236,220,.08); border-color: rgba(240,236,220,.35); color: #f0ece8; }
#screen-schedule .tt-nav:hover { background: rgba(240,236,220,.16); }
#screen-schedule .tt-cal-count { color: rgba(240,236,220,.72); }
#screen-schedule .tt-today-btn { background: rgba(99,102,241,.32); border-color: #a5b4fc; color: #e0e7ff; }
#screen-schedule .tt-dow span { color: rgba(240,236,220,.72); }
#screen-schedule .tt-day { background: rgba(240,236,220,.07); border-color: rgba(240,236,220,.22); }
#screen-schedule .tt-day:hover { border-color: #a5b4fc; }
#screen-schedule .tt-day.is-blank { background: transparent; border-color: transparent; }
#screen-schedule .tt-day.has-work { background: rgba(240,236,220,.12); }
#screen-schedule .tt-day.is-today { background: rgba(99,102,241,.34); border-color: #a5b4fc; box-shadow: inset 0 0 0 1px #a5b4fc; }
#screen-schedule .tt-date { color: #f0ece8; }
#screen-schedule .tt-day.is-today .tt-date { color: #e0e7ff; }
/* Past days are dimmed, not greyed out: below ~.8 the chalk stops clearing
   4.5:1 against the board, and a day a child can still catch up on must stay
   readable. */
#screen-schedule .tt-day.is-past { opacity: .82; }
#screen-schedule .tt-chip { background: rgba(240,236,220,.14); color: #f0ece8; }
#screen-schedule .tt-more { color: rgba(240,236,220,.72); }
#screen-schedule .tt-hint { color: rgba(240,236,220,.72); }
#screen-schedule .tt-legend-item { color: rgba(240,236,220,.8); }
#screen-schedule .tt-done-mark { color: #86efac; }

/* ── Materials sort control ───────────────────────────────────────────────
   Used by the teacher Materials tab and by a classroom Materials section.
   Both sit inside #screen-teacher, whose board rules score high, so the
   doubled id is deliberate - the same idiom the command centre uses. */
.mat-sort { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0 0 .85rem; }
.mat-sort-label { font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #6b7280; }
.mat-sort-btn {
  min-height: 44px; padding: .3rem .75rem; border-radius: 999px;
  border: 1px solid #d1d5db; background: #f9fafb; color: #374151;
  font-size: .74rem; font-weight: 600; cursor: pointer;
}
.mat-sort-btn.is-on { background: #4f46e5; border-color: #4f46e5; color: #fff; }
#screen-teacher#screen-teacher .mat-sort-label { color: rgba(240,236,220,.78); }
#screen-teacher#screen-teacher .mat-sort-btn {
  background: rgba(240,236,220,.10); border-color: rgba(240,236,220,.4); color: #f0ece0;
}
#screen-teacher#screen-teacher .mat-sort-btn:hover { background: rgba(240,236,220,.2); }
#screen-teacher#screen-teacher .mat-sort-btn.is-on { background: #4f46e5; border-color: #a5b4fc; color: #fff; }

/* ══ Materials: source toggle, search, views, calendar ═════════════════════
   ⚠ #screen-teacher is a CHALKBOARD in both themes, and its
   `p:not(…):not(…)` rule scores (1,3,1) - it beats a single-id override. Every
   override below therefore uses #screen-teacher#screen-teacher on purpose, the
   same trick the command-centre CSS uses. */
.tm-source-row { display: flex; gap: .4rem; margin-bottom: .85rem; flex-wrap: wrap; }
.tm-source-btn {
  min-height: 44px; padding: .35rem .9rem; border-radius: 999px;
  border: 1px solid #d1d5db; background: #f9fafb; color: #374151;
  font-size: .78rem; font-weight: 600; cursor: pointer;
}
.tm-source-btn.is-on { background: #4f46e5; border-color: #4f46e5; color: #fff; }
#screen-teacher#screen-teacher .tm-source-btn {
  background: rgba(240,236,220,.10); border-color: rgba(240,236,220,.4); color: #f0ece0;
}
#screen-teacher#screen-teacher .tm-source-btn.is-on { background: #4f46e5; border-color: #a5b4fc; color: #fff; }

.tm-find-row { position: relative; margin-bottom: .6rem; }
/* ⚠ 16px. Anything smaller in a form control makes iOS zoom the page in and
   never back out - the same rule the contact form and the PIN pad follow. */
.tm-search-input {
  width: 100%; min-height: 44px; font-size: 16px;
  padding: .55rem 2.2rem .55rem .8rem; border-radius: .9rem;
  border: 1px solid #d1d5db; background: #fff; color: #111827;
}
.tm-search-clear {
  position: absolute; right: .45rem; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 999px; border: 0;
  background: transparent; color: #6b7280; font-size: .9rem; cursor: pointer;
}
#screen-teacher#screen-teacher .tm-search-input {
  background: rgba(0,0,0,.25); border-color: rgba(240,236,220,.35); color: #f0ece0;
}
#screen-teacher#screen-teacher .tm-search-input::placeholder { color: rgba(240,236,220,.55); }
#screen-teacher#screen-teacher .tm-search-clear { color: rgba(240,236,220,.75); }

.mat-view { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0 0 .6rem; }
.mat-view-btn {
  min-height: 44px; padding: .3rem .75rem; border-radius: 999px;
  border: 1px solid #d1d5db; background: #f9fafb; color: #374151;
  font-size: .74rem; font-weight: 600; cursor: pointer;
}
.mat-view-btn.is-on { background: #0f766e; border-color: #0f766e; color: #fff; }
#screen-teacher#screen-teacher .mat-view-btn {
  background: rgba(240,236,220,.10); border-color: rgba(240,236,220,.4); color: #f0ece0;
}
#screen-teacher#screen-teacher .mat-view-btn.is-on { background: #0d9488; border-color: #5eead4; color: #062b28; }

.tm-kind { margin-right: .35rem; }
.tm-row-actions { display: flex; gap: .5rem; margin-left: .75rem; flex-shrink: 0; flex-wrap: wrap; }
.tm-group-head {
  display: flex; align-items: center; gap: .5rem;
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  margin: 1rem 0 .4rem; color: #4b5563;
}
.tm-group-count {
  font-size: .7rem; padding: .05rem .45rem; border-radius: 999px;
  background: #e5e7eb; color: #374151; letter-spacing: 0;
}
#screen-teacher#screen-teacher .tm-group-head { color: rgba(240,236,220,.85); }
#screen-teacher#screen-teacher .tm-group-count { background: rgba(240,236,220,.2); color: #f0ece0; }
.tm-clear-inline {
  margin-left: .4rem; text-decoration: underline; font-weight: 600;
  background: none; border: 0; cursor: pointer; color: inherit; min-height: 44px;
}

/* ── Calendar ──────────────────────────────────────────────────────────── */
.tm-cal-nav { display: flex; align-items: center; justify-content: center; gap: .75rem; margin: .2rem 0 .6rem; }
.tm-cal-btn {
  min-width: 44px; min-height: 44px; border-radius: 999px; cursor: pointer;
  border: 1px solid #d1d5db; background: #f9fafb; color: #374151; font-size: 1.1rem;
}
.tm-cal-month { font-weight: 700; font-size: .95rem; }
.tm-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; }
.tm-cal-head { font-size: .62rem; font-weight: 700; text-transform: uppercase; text-align: center; color: #6b7280; padding: .2rem 0; }
.tm-cal-cell {
  min-height: 46px; border-radius: .5rem; padding: .2rem .25rem;
  border: 1px solid #e5e7eb; background: #fff; overflow: hidden;
}
.tm-cal-cell.is-empty { border: 0; background: transparent; }
.tm-cal-cell.has-items { border-color: #6366f1; background: #eef2ff; }
.tm-cal-cell.is-today { outline: 2px solid #f59e0b; outline-offset: -2px; }
.tm-cal-date { display: block; font-size: .66rem; font-weight: 700; color: #374151; }
.tm-cal-chip {
  display: flex; align-items: center; gap: .2rem; font-size: .6rem;
  color: #3730a3; white-space: nowrap; overflow: hidden;
}
.tm-cal-more { font-size: .58rem; font-weight: 700; color: #4338ca; }
.tm-cal-count { font-size: .74rem; margin: .6rem 0 .5rem; color: #4b5563; }
#screen-teacher#screen-teacher .tm-cal-btn { background: rgba(240,236,220,.10); border-color: rgba(240,236,220,.4); color: #f0ece0; }
#screen-teacher#screen-teacher .tm-cal-head { color: rgba(240,236,220,.7); }
#screen-teacher#screen-teacher .tm-cal-cell { background: rgba(0,0,0,.22); border-color: rgba(240,236,220,.22); }
#screen-teacher#screen-teacher .tm-cal-cell.is-empty { background: transparent; border-color: transparent; }
#screen-teacher#screen-teacher .tm-cal-cell.has-items { background: rgba(99,102,241,.32); border-color: #a5b4fc; }
#screen-teacher#screen-teacher .tm-cal-date { color: rgba(240,236,220,.9); }
#screen-teacher#screen-teacher .tm-cal-chip { color: #e0e7ff; }
#screen-teacher#screen-teacher .tm-cal-more { color: #c7d2fe; }
#screen-teacher#screen-teacher .tm-cal-count { color: rgba(240,236,220,.8); }
#screen-teacher#screen-teacher .tm-cal-month { color: #f0ece0; }
/* ⚠ Chip LABELS are hidden on a phone. A 46px square cannot hold a title a
   teacher can read, so below 520px the grid is icon + count and the list under
   it carries the words - exactly the rule the timetable grid follows. */
@media (max-width: 520px) {
  .tm-cal-chip-t { display: none; }
  .tm-cal-cell { min-height: 44px; }
}

/* ══ Contact form (guest-facing) ══════════════════════════════════════════
   The contact panel is a fixed dark gradient in BOTH themes, so these fields
   carry their own ink rather than inheriting the theme. */
.contact-field {
  width: 100%; min-height: 44px; padding: .6rem .75rem;
  border-radius: .9rem; border: 1px solid rgba(255,255,255,.28);
  /* ⚠ OPAQUE, not a white tint. A translucent select is painted over the UA-s
     own light control ground in the light color-scheme, and white text on it
     disappears - the same defect the option-contrast rules exist for. */
  background: #1b1741; color: #fff;
  /* ⚠ 16px: any smaller and iOS zooms the page in on focus and never back. */
  font-size: 1rem; font-family: inherit; line-height: 1.45;
}
.contact-field::placeholder { color: rgba(255,255,255,.62); }
.contact-field:focus { outline: 2px solid #a5b4fc; outline-offset: 1px; border-color: #a5b4fc; }
textarea.contact-field { min-height: 120px; }
/* Off-screen rather than display:none - a bot that skips hidden fields still
   fills this one, and a screen reader is told to leave it. */
.contact-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ══ Admin reports: filter chips + bulk actions ═══════════════════════════ */
.rep-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .6rem; }
.rep-tools-gap { flex: 1 1 auto; }
.rep-chip {
  min-height: 44px; padding: .3rem .75rem; border-radius: 999px;
  border: 1px solid #d1d5db; background: #f9fafb; color: #374151;
  font-size: .74rem; font-weight: 600; cursor: pointer;
}
.rep-chip:hover { background: #eef2ff; border-color: #a5b4fc; }
.rep-chip.is-on { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.rep-chip:disabled { opacity: .5; cursor: default; }
.rep-chip-danger { color: #b91c1c; border-color: #fca5a5; background: #fef2f2; }
.rep-chip-danger:hover:not(:disabled) { background: #fee2e2; border-color: #f87171; }
.dark .rep-chip { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }
.dark .rep-chip:hover { background: #374151; }
.dark .rep-chip.is-on { background: #4f46e5; border-color: #818cf8; color: #fff; }
.dark .rep-chip-danger { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
/* A 13px tick box is not a touch target; this is the one the admin taps most. */
.rep-pick { width: 20px; height: 20px; accent-color: #4f46e5; cursor: pointer; }

/* Search box above the chips. Same pill language as .rep-chip so the whole
   toolbar reads as one control strip. */
.rep-search-row { display: flex; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.rep-search-ico { font-size: .9rem; opacity: .7; flex: 0 0 auto; }
.rep-search {
  flex: 1 1 auto; min-width: 0; min-height: 44px;
  padding: .3rem .85rem; border-radius: 999px;
  border: 1px solid #d1d5db; background: #fff; color: #111827; font-size: .85rem;
}
.rep-search::placeholder { color: #9ca3af; }
.rep-search:focus { outline: 2px solid #a5b4fc; outline-offset: 1px; border-color: #a5b4fc; }
.dark .rep-search { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }
.dark .rep-search::placeholder { color: #6b7280; }

/* ══ Admin reports: collapsed cards ══════════════════════════════════════
   The card body lives in <details>, so "collapsed by default" is the absence
   of an [open] attribute rather than a class anyone has to remember to add. */
/* ⚠ The flex row is an inner SPAN, not the <summary> itself. Overriding a
   summary's own display is what stops it toggling in older WebKit - the same
   Safari the no-lookbehind rule exists for - and a card that will not open is
   a worse bug than a marker that will not hide. */
.rep-sum { display: block; cursor: pointer; list-style: none; border-radius: .5rem; padding: .1rem; }
.rep-sum-inner { display: flex; align-items: flex-start; gap: .5rem; }
.rep-sum::-webkit-details-marker { display: none; }
.rep-sum:hover { background: rgba(99, 102, 241, .06); }
.rep-sum:focus-visible { outline: 2px solid #818cf8; outline-offset: 2px; }
.rep-caret {
  flex: 0 0 auto; margin-top: .15rem; font-size: .8rem; color: #9ca3af;
  transition: transform .15s ease;
}
/* Safe here and nowhere near a .screen: a transformed ancestor becomes the
   containing block for every position:fixed descendant, and this span has none. */
details.rep-det[open] > .rep-sum .rep-caret { transform: rotate(90deg); }
.rep-sum-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1 1 auto; }
.rep-sum-top { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.rep-sum-sub { font-size: .72rem; font-weight: 600; }
/* One line, clipped: the snippet is there to tell two reports apart, not to be
   read in full - that is what opening the card is for. */
.rep-sum-snip { display: block; font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-sum-meta { font-size: .68rem; }

/* ===== HEADER CONTROL: WORK IN PROGRESS =====
   Set by setHeaderBtnBusy() while a header button is awaiting the network.
   Deliberately not `disabled`: a disabled button drops its tooltip and its
   place in the tab order mid-interaction, and the point here is to say "heard
   you, working" - not to take the control away. aria-disabled carries that to
   a screen reader while the element stays focusable. */
.hdr-btn.is-busy, .hdr-menu-item.is-busy { cursor: progress; opacity: .72; }
.hdr-btn.is-busy .hdr-ico, .hdr-menu-item.is-busy .mi-ico { visibility: hidden; }
.hdr-btn.is-busy, .hdr-menu-item.is-busy { position: relative; }
.hdr-btn.is-busy .hdr-ico::after, .hdr-menu-item.is-busy .mi-ico::after {
  content: ""; visibility: visible; position: absolute; top: 50%; left: 0;
  width: 1em; height: 1em; margin-top: -.5em;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: hdr-busy-spin .7s linear infinite;
}
@keyframes hdr-busy-spin { to { transform: rotate(360deg); } }
/* A spinner that cannot spin should not pretend to: hold one still frame. */
@media (prefers-reduced-motion: reduce) {
  .hdr-btn.is-busy .hdr-ico::after, .hdr-menu-item.is-busy .mi-ico::after { animation: none; }
}

/* ===== TYPED FRENCH ANSWER: THE ACCENT NUDGE =====
   Shown when matchTypedAnswer() marks an answer right with slip:true - the
   child typed the word correctly but without its accents, which a phone
   keyboard often will not produce. It is a note, not an error: green, quiet,
   and it carries the accented spelling they will need in the exam. */
.txt-slip {
  margin-top: .5rem; font-size: .85rem; line-height: 1.45;
  color: #276749; background: rgba(72, 187, 120, .12);
  border-left: 3px solid #48bb78; border-radius: .25rem;
  padding: .4rem .6rem;
}
html.dark .txt-slip { color: #9ae6b4; background: rgba(72, 187, 120, .16); border-left-color: #68d391; }

/* ══ Exam-style symmetry line drawing ════════════════════════════════════
   SVG keeps the ruler line crisp at every phone size. touch-action:none is
   scoped to the drawing paper; the rest of the question still scrolls. */
.symline-wrap {
  width: min(100%, 34rem); margin: .5rem auto 0; padding: .7rem;
  border: 1px solid #cbd5e1; border-radius: 1rem;
  background: #f8fafc; color: #1e293b;
}
.symline-heading {
  display:flex; align-items:center; justify-content:space-between; gap:.7rem;
  margin-bottom:.45rem; font-size:.78rem; font-weight:800;
}
.symline-heading span:last-child { color:#64748b; font-weight:650; }
.symline-svg {
  display:block; width:100%; max-height:25rem; border-radius:.8rem;
  touch-action:none; user-select:none; cursor:crosshair; overflow:hidden;
  box-shadow:inset 0 0 0 1px rgba(100,116,139,.2);
}
.symline-svg.is-disabled { cursor:default; touch-action:auto; }
.symline-paper { fill:#fff; stroke:#cbd5e1; stroke-width:2; }
.symline-shape { fill:#f8fafc; stroke:#172033; stroke-width:4; stroke-linejoin:round; }
.symline-shape-accent { fill:#eef2ff; }
.symline-user, .symline-preview, .symline-answer {
  fill:none; stroke-linecap:round; pointer-events:none;
}
.symline-user { stroke:#2563eb; stroke-width:6; }
.symline-preview { stroke:#6366f1; stroke-width:5; stroke-dasharray:10 7; opacity:.8; }
.symline-user.is-correct { stroke:#16a34a; }
.symline-user.is-wrong { stroke:#dc2626; }
.symline-answer { stroke:#16a34a; stroke-width:5; stroke-dasharray:10 6; }
.symline-answer.is-missed { stroke:#f59e0b; }
.symline-tools { display:flex; flex-wrap:wrap; gap:.45rem; margin-top:.6rem; }
.symline-tools button {
  min-height:44px; padding:.45rem .8rem; border:1px solid #cbd5e1;
  border-radius:.75rem; background:#fff; color:#334155; font-weight:750;
  font-size:.78rem; cursor:pointer;
}
.symline-tools button:hover:not(:disabled) { border-color:#818cf8; background:#eef2ff; }
.symline-tools button:focus-visible { outline:3px solid #818cf8; outline-offset:2px; }
.symline-tools button:disabled { opacity:.42; cursor:default; }
.symline-help {
  margin-top:.55rem; padding:.65rem .75rem; border-radius:.75rem;
  background:#eef2ff; color:#3730a3; font-size:.8rem; line-height:1.45;
}
.symline-legend { display:flex; flex-wrap:wrap; gap:.7rem 1rem; margin-top:.55rem; font-size:.75rem; font-weight:700; }
.symline-legend span { display:inline-flex; align-items:center; gap:.35rem; }
.symline-legend i { display:inline-block; width:1.7rem; border-top:4px solid; border-radius:2px; }
.symline-legend i.is-correct { color:#16a34a; }
.symline-legend i.is-wrong { color:#dc2626; }
.symline-legend i.is-missed { color:#f59e0b; border-top-style:dashed; }
.dark .symline-wrap { background:#172033; border-color:#475569; color:#f8fafc; }
.dark .symline-heading span:last-child { color:#cbd5e1; }
.dark .symline-paper { fill:#f8fafc; stroke:#64748b; }
.dark .symline-shape { fill:#e2e8f0; stroke:#0f172a; }
.dark .symline-shape-accent { fill:#c7d2fe; }
.dark .symline-tools button { background:#253149; border-color:#64748b; color:#f8fafc; }
.dark .symline-tools button:hover:not(:disabled) { background:#312e81; border-color:#a5b4fc; }
.dark .symline-help { background:#312e81; color:#e0e7ff; }
@media (max-width:420px) {
  .symline-wrap { padding:.5rem; }
  .symline-heading { align-items:flex-start; flex-direction:column; gap:.1rem; }
  .symline-tools { display:grid; grid-template-columns:1fr 1fr; }
  .symline-tools button:last-child { grid-column:1 / -1; }
}

/* ── A question type with no on-screen renderer ────────────────────────────
   renderAnswerArea() draws this instead of falling through to the numeric
   input. NCE Grade 9 carries drawing and construction tasks that genuinely
   cannot be marked on a phone; saying so is honest, and a digit pad under
   "construct the perpendicular bisector of QR" is not. */
.answer-unsupported {
  border: 2px dashed var(--border, #cbd5e1);
  border-radius: 10px;
  padding: 14px 16px;
  background: rgba(148, 163, 184, .12);
  color: #334155;
}
.dark .answer-unsupported { color: #e2e8f0; border-color: rgba(148,163,184,.5); }
.answer-unsupported p { margin: 0 0 6px; }
.answer-unsupported p:last-child { margin-bottom: 0; opacity: .85; font-size: .95em; }

/* ── The chapter practice journey (engine/practice_journey.js) ─────────────
   ⚠ Written here rather than as Tailwind classes because the sheet body is
   injected with innerHTML AFTER the Play CDN's initial scan, and the CDN only
   generates rules for classes present at that scan. A class added later gets
   the class and no rule.
   ⚠ State is never signalled by colour alone: every cell carries a mark
   (○ ! ↑ ✓) and an aria-label, and the legend names all four.
   ⚠ Every interactive control here is at least 44px on its shortest side. */

.pj-sheet {
  border-radius: 1.5rem 1.5rem 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .35);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
@media (min-width: 640px) {
  .pj-sheet { border-radius: 1.5rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); max-height: 86vh; }
}
.pj-sheet-head {
  display: flex; align-items: center; gap: .5rem;
  padding: 1rem 1rem .5rem 1.25rem;
  border-bottom: 1px solid rgba(120, 120, 140, .18);
}
.pj-sheet-title { flex: 1; font-size: 1.05rem; font-weight: 800; color: #111827; }
.dark .pj-sheet-title { color: #f3f4f6; }
.pj-x {
  min-width: 44px; min-height: 44px;
  border-radius: 999px; font-size: 1rem; line-height: 1;
  color: #4b5563; background: transparent; border: 0; cursor: pointer;
}
.dark .pj-x { color: #9ca3af; }
.pj-x:hover { background: rgba(120, 120, 140, .14); }
.pj-sheet-body { padding: .75rem 1rem 1.25rem; overflow-y: auto; }

/* one option per row */
.pj-opt {
  display: flex; align-items: center; gap: .75rem; width: 100%;
  min-height: 60px; padding: .7rem .85rem; margin-bottom: .5rem;
  text-align: left; cursor: pointer;
  border: 1px solid rgba(120, 120, 140, .22); border-radius: 1rem;
  background: #f9fafb; color: #111827;
}
.dark .pj-opt { background: #111827; color: #f3f4f6; border-color: rgba(160, 160, 180, .22); }
.pj-opt:hover { border-color: #6366f1; }
.pj-opt-primary { background: #eef2ff; border-color: #6366f1; }
.dark .pj-opt-primary { background: rgba(99, 102, 241, .18); }
.pj-opt-icon { font-size: 1.35rem; line-height: 1; flex: 0 0 auto; }
.pj-opt-text { flex: 1; min-width: 0; }
.pj-opt-name { display: block; font-weight: 700; font-size: .95rem; }
.pj-opt-desc { display: block; font-size: .8rem; color: #4b5563; margin-top: .1rem; }
.dark .pj-opt-desc { color: #9ca3af; }
.pj-rec {
  font-size: .62rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: #4338ca; background: #e0e7ff; border-radius: 999px; padding: .1rem .4rem; margin-left: .3rem;
}
.dark .pj-rec { color: #c7d2fe; background: rgba(99, 102, 241, .3); }
.pj-opt-count {
  flex: 0 0 auto; font-weight: 800; font-size: .95rem; color: #4338ca;
  background: #e0e7ff; border-radius: .6rem; padding: .15rem .5rem; min-width: 2rem; text-align: center;
}
.dark .pj-opt-count { color: #c7d2fe; background: rgba(99, 102, 241, .3); }

.pj-cov { font-size: .85rem; color: #4b5563; margin: .2rem 0 .7rem; }
.dark .pj-cov { color: #9ca3af; }
.pj-note { font-size: .78rem; color: #6b7280; margin: .6rem 0 0; line-height: 1.45; }
.dark .pj-note { color: #9ca3af; }
.pj-tip {
  font-size: .8rem; line-height: 1.45; color: #3730a3; background: #eef2ff;
  border-radius: .75rem; padding: .6rem .75rem; margin: 0 0 .7rem;
}
.dark .pj-tip { color: #c7d2fe; background: rgba(99, 102, 241, .16); }
.pj-tip-x {
  display: inline-block; min-height: 44px; padding: 0 .6rem; margin-left: .25rem;
  font-weight: 700; color: inherit; background: transparent; border: 0; cursor: pointer;
  text-decoration: underline;
}
.pj-empty { text-align: center; padding: 1rem .5rem 0; }
.pj-empty-t { font-size: .95rem; color: #374151; margin-bottom: .9rem; }
.dark .pj-empty-t { color: #d1d5db; }

/* ── the map ───────────────────────────────────────────────────────────── */
.pj-legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem; margin: .3rem 0 .9rem; }
.pj-key { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; color: #4b5563; }
.dark .pj-key { color: #9ca3af; }
.pj-map-group { margin-bottom: 1rem; }
.pj-map-h { font-size: .8rem; font-weight: 800; color: #374151; margin: 0 0 .4rem; }
.dark .pj-map-h { color: #d1d5db; }
.pj-map-n { font-weight: 600; color: #9ca3af; }
.pj-map-grid { display: flex; flex-wrap: wrap; gap: .3rem; }
/* Not a button: the map is a picture of the chapter, not 300 tap targets.
   Practice starts from the options sheet, which keeps every real control at
   44px without making a 300-cell grid unusable on a phone. */
.pj-cell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: .5rem;
  font-size: .85rem; font-weight: 800; position: relative;
  border: 1px solid transparent;
}
.pj-cell em { position: absolute; bottom: 1px; right: 3px; font-size: .5rem; font-style: normal; opacity: .75; }
.pj-cell.is-new      { background: #f3f4f6; color: #4b5563; border-color: #9ca3af; }
.pj-cell.is-legacy   { background: #f3f4f6; color: #4b5563; border-color: #6b7280; border-style: dashed; }
.pj-cell.is-needs    { background: #ffedd5; color: #9a3412; border-color: #f97316; }
.pj-cell.is-improved { background: #dbeafe; color: #1e40af; border-color: #3b82f6; }
.pj-cell.is-secure   { background: #dcfce7; color: #166534; border-color: #22c55e; }
.dark .pj-cell.is-new      { background: #1f2937; color: #9ca3af; border-color: #4b5563; }
.dark .pj-cell.is-legacy   { background: #1f2937; color: #9ca3af; border-color: #6b7280; }
.dark .pj-cell.is-needs    { background: #7c2d12; color: #fed7aa; border-color: #fb923c; }
.dark .pj-cell.is-improved { background: #1e3a8a; color: #bfdbfe; border-color: #60a5fa; }
.dark .pj-cell.is-secure   { background: #14532d; color: #bbf7d0; border-color: #4ade80; }

/* the small control beside the chapter card's big button */
.ch-options {
  position: absolute; right: .55rem; bottom: .5rem; z-index: 3;
  min-width: 44px; min-height: 44px; padding: 0 .55rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
  font-size: .72rem; font-weight: 700; cursor: pointer;
  color: #4338ca; background: rgba(238, 242, 255, .95);
  border: 1px solid rgba(99, 102, 241, .45); border-radius: .75rem;
}
.dark .ch-options { color: #c7d2fe; background: rgba(30, 27, 75, .9); border-color: rgba(129, 140, 248, .45); }
.ch-options:hover { background: #e0e7ff; }
.dark .ch-options:hover { background: rgba(67, 56, 202, .55); }

.pj-sync { font-size: .7rem; font-weight: 700; color: #6b7280; margin-left: .4rem; }
.pj-sync.is-offline { color: #b45309; }
.dark .pj-sync { color: #9ca3af; }
.dark .pj-sync.is-offline { color: #fbbf24; }

/* Algebraic answer input (type 'expr'). The caret hint is not decoration: a
   child who types "a8" instead of "a^8" is marked wrong for a notation they
   were never told, and there is no ^ key on a phone number pad. */
.expr-hint { margin: 6px 2px 0; font-size: .85em; color: #4b5563; }
.dark .expr-hint { color: #9ca3af; }

/* Multi-blank answers (type 'slots'): "x = ...., y = ...." and table
   completion. Every box is the SAME width on purpose - a box sized to its
   answer prints the answer's length on screen, which is the rule the French
   cloze gaps already follow. */
.slot-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.slot-label { font-style: italic; color: #4b5563; }
.dark .slot-label { color: #cbd5e1; }
.slot-input {
  width: 7.5em; padding: 10px 12px; font-size: 16px;
  border: 2px solid var(--border, #cbd5e1); border-radius: 8px;
  background: var(--card, #fff); color: inherit;
}
.slot-input:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
.slot-score { margin: 8px 2px 0; font-weight: 600; color: #334155; }
.dark .slot-score { color: #e2e8f0; }

/* A pupil SAYS they have done a worksheet or watched a video. Green because it
   is good news, but the words carry the meaning — nothing here was marked. */
.tc-cd-done-chip { margin: .15rem 0 0; font-size: .72rem; font-weight: 700; color: #15803d; }
#screen-teacher#screen-teacher .tc-cd-done-chip { color: #4ade80; }

/* Who changed a pupil name, and when. Collapsed by default: it is a record to
   consult, not something a teacher needs in the way every time. */
.tc-cd-name-history { margin: .4rem 0 .6rem; font-size: .78rem; }
.tc-cd-name-history summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.tc-cd-name-history ul { margin: .2rem 0 0; padding-left: 1rem; }
.tc-cd-name-change { margin: .18rem 0; line-height: 1.4; }
.tc-cd-name-who { margin-left: .4rem; padding: .02rem .4rem; border-radius: 999px; font-size: .68rem; font-weight: 700; }
/* ⚠ The pupil case is the one worth noticing, so it is the one that is tinted. */
.tc-cd-name-who-pupil   { background: #fef3c7; color: #713f12; }
.tc-cd-name-who-teacher { background: #e5e7eb; color: #374151; }
.tc-cd-name-when { margin-left: .4rem; opacity: .75; font-size: .7rem; }
#screen-teacher#screen-teacher .tc-cd-name-who-pupil   { background: #fde68a; color: #451a03; }
#screen-teacher#screen-teacher .tc-cd-name-who-teacher { background: #e5e7eb; color: #1f2937; }

/* Devices that have joined a shared-PIN class. A DEVICE, not a pupil — the
   heading and the caption both say so, because two children on one tablet are
   one row here. */
.tc-cd-device-list { list-style: none; margin: .3rem 0 .4rem; padding: 0; }
.tc-cd-device { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid rgba(255,255,255,.12); font-size: .82rem; }
.tc-cd-device-tag { font-size: .68rem; padding: .05rem .45rem; border-radius: 999px; background: #e5e7eb; color: #374151; font-weight: 700; }
.tc-cd-device-when { font-size: .7rem; opacity: .75; }
#screen-teacher#screen-teacher .tc-cd-device-tag { background: rgba(240,236,220,.2); color: #f0ece0; }

/* ══════════ Chasse aux Erreurs (engine/errorhunt.js) ══════════
   Amber, where Textes à Trous is teal: two French text exercises that look
   alike would be two exercises a child cannot tell apart on the chapter grid.

   ⚠ THE 44px TAP RULE IS DELIBERATELY BENT HERE, and only here. Every word in
   a flowing text is a button; making each one 44px tall turns a 110-word
   Grade 6 passage into six phone screens and destroys the one thing the
   exercise needs, which is reading it as a text. Words are ~40px tall with a
   2.7 line-height, and a one-letter word still measures 40px wide via
   min-width - so the target area is met horizontally and missed by 4px
   vertically, in exchange for prose a child can actually read.

   ⚠ .is-picked must never hint at correctness. It is a highlighter mark - the
   child saying "I think this one is wrong" - and it looks identical on a word
   that is right and a word that is wrong. The verdict classes are added only
   by Terminer. */
.eh-hero { background: linear-gradient(135deg, #b45309, #92400e); color: #fff;
  border-radius: 1rem; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.eh-hero h2 { font-size: 1.35rem; font-weight: 800; margin: 0 0 .25rem; }
.eh-hero p  { font-size: .9rem; margin: 0; color: #fde9c8; }

.eh-list  { display: flex; flex-direction: column; gap: .55rem; }
.eh-empty { padding: 1.2rem; text-align: center; color: #6b7280; }

.eh-item { display: flex; align-items: center; gap: .7rem; width: 100%;
  text-align: left; padding: .7rem .8rem; border-radius: .8rem;
  background: #fff; border: 1px solid #e5e7eb; min-height: 44px;
  transition: border-color .15s ease; }
.eh-item:hover { border-color: #b45309; }
.eh-item.is-attempted { border-left: 4px solid #b45309; }

.eh-num { flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem; font-weight: 800;
  background: #fef3c7; color: #92400e; }
.eh-item.is-attempted .eh-num { background: #b45309; color: #fff; }

.eh-item-main  { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .12rem; }
.eh-item-title { font-weight: 700; font-size: .95rem; color: #111827; }
.eh-item-meta  { font-size: .74rem; color: #6b7280; }
.eh-item-go    { flex: 0 0 auto; display: flex; align-items: center; gap: .35rem;
  color: #b45309; font-weight: 700; }
.eh-again { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }

.eh-badge { display: inline-block; margin-top: .18rem; font-size: .7rem;
  font-weight: 700; padding: .1rem .45rem; border-radius: .4rem; }
.eh-badge.is-new  { background: #f3f4f6; color: #6b7280; }
.eh-badge.is-done { background: #fef3c7; color: #92400e; }
.eh-badge.is-full { background: #dcfce7; color: #166534; }

.eh-play  { padding-bottom: 2rem; }
.eh-title { font-size: 1.2rem; font-weight: 800; margin: 0 0 .3rem; color: #111827; }
.eh-intro { font-size: .84rem; color: #4b5563; margin: 0 0 .5rem; line-height: 1.45; }
.eh-help  { font-size: .78rem; color: #6b7280; margin: 0 0 .9rem; line-height: 1.4; }

.eh-text { font-size: 1rem; line-height: 2.7; color: #111827;
  background: #fffdf7; border: 1px solid #fde68a; border-radius: .9rem;
  padding: .9rem 1rem; overflow-x: auto; }

.eh-w { display: inline-block; min-height: 40px; min-width: 40px;
  padding: .5rem .3rem; border-radius: .45rem; border: 1px solid transparent;
  background: transparent; color: inherit; font: inherit; line-height: 1.4;
  cursor: pointer; transition: background-color .12s ease, border-color .12s ease; }
.eh-w:hover:not(:disabled) { background: #fef3c7; }
.eh-w.is-picked { background: #fde68a; border-color: #d97706;
  box-shadow: inset 0 -2px 0 #b45309; font-weight: 700; }
.eh-w.is-found  { background: #dcfce7; border-color: #16a34a; color: #14532d; font-weight: 700; }
.eh-w.is-missed { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; font-weight: 700; }
.eh-w.is-false  { background: #f3f4f6; border-color: #9ca3af; color: #4b5563;
  text-decoration: line-through; font-weight: 400; }
.eh-w:disabled { cursor: default; }

.eh-footer   { margin-top: 1rem; }
.eh-progress { font-size: .85rem; font-weight: 700; color: #92400e; margin-bottom: .5rem; }
.eh-note     { font-size: .76rem; color: #6b7280; margin-top: .5rem; line-height: 1.45; }
.eh-actions  { display: flex; flex-wrap: wrap; gap: .5rem; }
.eh-actions button { flex: 1 1 auto; min-width: 10rem; min-height: 44px; }

.eh-score { display: flex; flex-direction: column; gap: .15rem; padding: .8rem 1rem;
  border-radius: .8rem; background: #fef3c7; border: 1px solid #fde68a; margin-bottom: .8rem; }
.eh-score b { font-size: 1.6rem; font-weight: 800; color: #92400e; }
.eh-score span { font-size: .85rem; color: #78350f; }
.eh-score.is-full { background: #dcfce7; border-color: #86efac; }
.eh-score.is-full b { color: #166534; }
.eh-score.is-full span { color: #14532d; }

.eh-review { margin-top: 1.1rem; }
.eh-review h4 { font-size: .95rem; font-weight: 800; margin: 0 0 .5rem; color: #111827; }
.eh-correct-h { margin-top: 1rem !important; }
.eh-r-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.eh-r-list li { display: flex; gap: .55rem; padding: .5rem .6rem; border-radius: .6rem;
  background: #f9fafb; border-left: 3px solid #d1d5db; }
.eh-r-list li.is-right { border-left-color: #16a34a; }
.eh-r-list li.is-wrong { border-left-color: #dc2626; background: #fef2f2; }
.eh-r-n { flex: 0 0 auto; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .72rem; font-weight: 800;
  background: #e5e7eb; color: #374151; }
.eh-r-list li.is-right .eh-r-n { background: #dcfce7; color: #166534; }
.eh-r-list li.is-wrong .eh-r-n { background: #fee2e2; color: #991b1b; }
.eh-r-body { flex: 1 1 auto; min-width: 0; font-size: .87rem; color: #111827;
  display: flex; flex-direction: column; gap: .1rem; }
.eh-r-fix { color: #166534; }
.eh-r-was { color: #991b1b; font-size: .8rem; }
.eh-r-why { font-size: .78rem; color: #6b7280; }
.eh-false   { margin-top: .7rem; font-size: .82rem; color: #4b5563; line-height: 1.5; }
.eh-correct { font-size: .9rem; line-height: 1.75; color: #111827;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: .7rem; padding: .7rem .85rem; margin: 0; }

@media (max-width: 380px) {
  .eh-text { font-size: .95rem; line-height: 2.6; padding: .7rem .75rem; }
  .eh-actions button { min-width: 100%; }
}

:root[data-theme="dark"] .eh-item,
:root:not([data-theme="light"]) .eh-item { background: #1f2937; border-color: #374151; }
:root[data-theme="dark"] .eh-item-title,
:root:not([data-theme="light"]) .eh-item-title { color: #f3f4f6; }
:root[data-theme="dark"] .eh-item-meta,
:root:not([data-theme="light"]) .eh-item-meta { color: #9ca3af; }
:root[data-theme="dark"] .eh-item-go,
:root:not([data-theme="light"]) .eh-item-go { color: #fbbf24; }
:root[data-theme="dark"] .eh-num,
:root:not([data-theme="light"]) .eh-num { background: #78350f; color: #fde68a; }
:root[data-theme="dark"] .eh-item.is-attempted .eh-num,
:root:not([data-theme="light"]) .eh-item.is-attempted .eh-num { background: #b45309; color: #fff; }
:root[data-theme="dark"] .eh-badge.is-new,
:root:not([data-theme="light"]) .eh-badge.is-new { background: #374151; color: #9ca3af; }
:root[data-theme="dark"] .eh-badge.is-done,
:root:not([data-theme="light"]) .eh-badge.is-done { background: #78350f; color: #fde68a; }
:root[data-theme="dark"] .eh-badge.is-full,
:root:not([data-theme="light"]) .eh-badge.is-full { background: #14532d; color: #bbf7d0; }
:root[data-theme="dark"] .eh-title,
:root:not([data-theme="light"]) .eh-title { color: #f3f4f6; }
:root[data-theme="dark"] .eh-intro,
:root:not([data-theme="light"]) .eh-intro { color: #d1d5db; }
:root[data-theme="dark"] .eh-help,
:root:not([data-theme="light"]) .eh-help { color: #9ca3af; }
:root[data-theme="dark"] .eh-note,
:root:not([data-theme="light"]) .eh-note { color: #9ca3af; }
:root[data-theme="dark"] .eh-progress,
:root:not([data-theme="light"]) .eh-progress { color: #fbbf24; }
:root[data-theme="dark"] .eh-text,
:root:not([data-theme="light"]) .eh-text { background: #1f2937; border-color: #78350f; color: #f3f4f6; }
:root[data-theme="dark"] .eh-w:hover:not(:disabled),
:root:not([data-theme="light"]) .eh-w:hover:not(:disabled) { background: #451a03; }
:root[data-theme="dark"] .eh-w.is-picked,
:root:not([data-theme="light"]) .eh-w.is-picked { background: #78350f; border-color: #f59e0b; color: #fde68a;
  box-shadow: inset 0 -2px 0 #f59e0b; }
:root[data-theme="dark"] .eh-w.is-found,
:root:not([data-theme="light"]) .eh-w.is-found { background: #14532d; border-color: #22c55e; color: #bbf7d0; }
:root[data-theme="dark"] .eh-w.is-missed,
:root:not([data-theme="light"]) .eh-w.is-missed { background: #450a0a; border-color: #ef4444; color: #fecaca; }
:root[data-theme="dark"] .eh-w.is-false,
:root:not([data-theme="light"]) .eh-w.is-false { background: #374151; border-color: #6b7280; color: #d1d5db; }
:root[data-theme="dark"] .eh-score,
:root:not([data-theme="light"]) .eh-score { background: #78350f; border-color: #b45309; }
:root[data-theme="dark"] .eh-score b,
:root:not([data-theme="light"]) .eh-score b { color: #fde68a; }
:root[data-theme="dark"] .eh-score span,
:root:not([data-theme="light"]) .eh-score span { color: #fef3c7; }
:root[data-theme="dark"] .eh-score.is-full,
:root:not([data-theme="light"]) .eh-score.is-full { background: #14532d; border-color: #16a34a; }
:root[data-theme="dark"] .eh-score.is-full b,
:root:not([data-theme="light"]) .eh-score.is-full b { color: #bbf7d0; }
:root[data-theme="dark"] .eh-score.is-full span,
:root:not([data-theme="light"]) .eh-score.is-full span { color: #dcfce7; }
:root[data-theme="dark"] .eh-review h4,
:root:not([data-theme="light"]) .eh-review h4 { color: #f3f4f6; }
:root[data-theme="dark"] .eh-r-list li,
:root:not([data-theme="light"]) .eh-r-list li { background: #1f2937; }
:root[data-theme="dark"] .eh-r-list li.is-wrong,
:root:not([data-theme="light"]) .eh-r-list li.is-wrong { background: #2a1414; }
:root[data-theme="dark"] .eh-r-body,
:root:not([data-theme="light"]) .eh-r-body { color: #f3f4f6; }
:root[data-theme="dark"] .eh-r-n,
:root:not([data-theme="light"]) .eh-r-n { background: #374151; color: #d1d5db; }
:root[data-theme="dark"] .eh-r-list li.is-right .eh-r-n,
:root:not([data-theme="light"]) .eh-r-list li.is-right .eh-r-n { background: #14532d; color: #bbf7d0; }
:root[data-theme="dark"] .eh-r-list li.is-wrong .eh-r-n,
:root:not([data-theme="light"]) .eh-r-list li.is-wrong .eh-r-n { background: #450a0a; color: #fecaca; }
:root[data-theme="dark"] .eh-r-fix,
:root:not([data-theme="light"]) .eh-r-fix { color: #86efac; }
:root[data-theme="dark"] .eh-r-was,
:root:not([data-theme="light"]) .eh-r-was { color: #fca5a5; }
:root[data-theme="dark"] .eh-r-why,
:root:not([data-theme="light"]) .eh-r-why { color: #9ca3af; }
:root[data-theme="dark"] .eh-false,
:root:not([data-theme="light"]) .eh-false { color: #d1d5db; }
:root[data-theme="dark"] .eh-correct,
:root:not([data-theme="light"]) .eh-correct { background: #14532d; border-color: #166534; color: #dcfce7; }
:root[data-theme="dark"] .eh-empty,
:root:not([data-theme="light"]) .eh-empty { color: #9ca3af; }

/* ===== SIGN-IN PROGRESS OVERLAY =====
   A password check plus the profile, family and student reads behind it is
   several seconds on a slow connection, and the auth screen sat there
   completely still for all of it - then the dashboard appeared by itself.
   This covers that gap and then cross-fades: it fades OUT over 0.28s while
   the incoming .screen fades IN over 0.3s, so one hands over to the other
   instead of the app blinking.
   ⚠ The transform below is safe ONLY because this element is a body-level
   sibling of every .screen. Putting a transform on .screen, main, body or
   the auth card is what breaks position:fixed bars and native autofill
   popovers - see the notes at the top of this file. */
#auth-progress {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #312e81, #4c1d95 55%, #1e3a8a);
  animation: authProgressIn 0.16s ease both;
}
#auth-progress.auth-progress-leaving { animation: authProgressOut 0.28s ease both; }
#auth-progress.hidden { display: none !important; }
@keyframes authProgressIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes authProgressOut { from { opacity: 1; } to { opacity: 0; } }

.auth-progress-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
  text-align: center; max-width: 20rem;
  animation: authProgressCard 0.45s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes authProgressCard {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* The cap the auth screen is already showing, with an arc orbiting it: the
   app is loading, not some widget. The ring spins; the cap must not, or it
   reads as a page that has fallen over. */
.auth-progress-orbit { position: relative; width: 4.5rem; height: 4.5rem; }
.auth-progress-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #a5b4fc;
  border-right-color: rgba(165,180,252,0.45);
  animation: authProgressSpin 0.9s linear infinite;
}
.auth-progress-mark {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; line-height: 1; user-select: none;
  animation: authProgressBreathe 2.2s ease-in-out infinite;
}
@keyframes authProgressBreathe {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.07); }
}
@keyframes authProgressSpin { to { transform: rotate(360deg); } }

.auth-progress-title {
  color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em;
}
.auth-progress-step {
  color: rgba(255,255,255,0.72); font-size: 0.8rem; line-height: 1.4;
  min-height: 2.2em;
  animation: authProgressStep 0.3s ease both;
}
@keyframes authProgressStep { from { opacity: 0; } to { opacity: 1; } }

/* The button keeps its size while its label becomes a spinner, so the card
   does not reflow under the finger that just tapped it. */
.auth-btn-busy { position: relative; color: transparent !important; pointer-events: none; }
.auth-btn-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 1.15rem; height: 1.15rem; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  animation: authProgressSpin 0.7s linear infinite;
}

/* ── ROUTE BUSY ─────────────────────────────────────────
   Shown while a tap waits on a subject manifest or a question bank. It reuses
   the sign-in card's classes so the app has ONE loading look, but NOT its
   backdrop, deliberately: sign-in covers an app that is not on screen yet and
   may be opaque, while this covers a screen the child is already looking at,
   where an opaque wall reads as having been signed out of it. A scrim keeps
   what they tapped visible behind the card.
   ⚠ The card's transform is safe for the same reason it is on #auth-progress
   and no other: this is a body-level sibling of every .screen, and nothing
   inside it is position:fixed or a text input. */
#route-busy {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: rgba(30, 27, 75, 0.55);
  animation: authProgressIn 0.16s ease both;
}
#route-busy.hidden { display: none !important; }
#route-busy .auth-progress-card {
  background: rgba(23, 20, 60, 0.94);
  padding: 1.5rem 1.75rem;
  border-radius: 1.25rem;
  box-shadow: 0 18px 45px rgba(0,0,0,0.38);
}
/* The sign-in step line reserves two lines because its text changes as the
   sign-in advances. This one is set once per tap, so it reserves nothing. */
#route-busy .auth-progress-step { min-height: 0; }

@media (prefers-reduced-motion: reduce) {
  #auth-progress, #auth-progress.auth-progress-leaving, .auth-progress-card,
  #route-busy, .auth-progress-step { animation: none; }
  .auth-progress-mark { animation: none; }
  .auth-progress-ring, .auth-btn-busy::after { animation-duration: 1.6s; }
}

/* ===== QUESTION CHART FIGURES =====
   Baked into question text as inline SVG by scripts/build-chart-figures.js.
   The fixed chrome lives here rather than in a style="" on every figure: the
   offline question cache is budgeted in BYTES, and 150 bytes of repeated
   presentation per chart is 150 bytes of a child's Grade 5 cache. Only
   max-width, which differs per chart, is still inline.
   ⚠ A white plate on purpose. The app has a dark theme and the chart is drawn
   in dark ink; letting it inherit the page background makes the axes and the
   labels disappear for every child practising at night. */
.q-chart {
  display: block;
  width: 100%;
  max-width: 460px;
  height: auto;
  margin: 0.5rem auto;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ===== QUESTION DATA TABLES =====
   Frequency tables, tally charts and any other question stimulus that is a
   table. Paired with .q-chart above: a data question should SHOW its data.

   ⚠ A fixed light plate with dark ink, in both themes, exactly like .q-chart —
   NOT inherited colour. The practice screen is a chalkboard: #screen-practice
   .pr-q forces color:#f0ece8 (style.css, "PRACTICE CHALKBOARD") and wins on
   specificity over the day-theme rule, so a table that inherits its colour is
   legible on one surface and invisible on the next. Every existing question
   table in the bank either inherits (borderless, near-invisible on the
   chalkboard) or repeats a style="" attribute on every single cell — which is
   real bytes out of a child's offline cache, since that cache is budgeted in
   bytes. One class, once.

   ⚠ Deliberately NOT written as `.pr-q table` / `#exam-q-text table`: those
   descendant selectors outrank `.picto-table th` and would silently restyle the
   pictogram tables, including their dark-mode overrides. */
.q-table {
  border-collapse: collapse;
  margin: 0.6rem 0;
  font-size: 0.88rem;
  background: #fff;
  color: #1e293b;
  text-shadow: none;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.q-table th {
  background: #f1f5f9;
  font-weight: 700;
  text-align: left;
  padding: 5px 12px;
  border: 1px solid #cbd5e1;
}
.q-table td {
  padding: 5px 12px;
  border: 1px solid #e2e8f0;
}
.q-table code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; }

/* A table with more columns than a phone can hold scrolls inside its own box
   rather than widening the question card. */
.q-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0.6rem 0; }
.q-scroll .q-table { margin: 0; }

/* ===== ADMIN QUESTION MANAGER: PUPIL PREVIEW =====================================
   The list used to show a stripped-HTML line, which is the one thing a question
   cannot be judged from: the markup IS the question - an <img>, an inline <svg>,
   a run of ___ blanks - and "A noun is a -" reads as a broken sentence when it is
   a perfectly good stem with four options under it.
   Two surfaces:
   - #qm-preview-board is the faithful one. It borrows the practice screen's own
     chalkboard rules (the shared selector list up by .pr-card) and only defines
     the board itself here.
   - .qm-kid is the inline one in the list, deliberately NOT the chalkboard: fifty
     dark cards make the list unscannable, and the modal is one tap away. */
#qm-preview-board {
  background:
    repeating-linear-gradient(0deg, transparent, transparent 34px,
      rgba(180,180,180,.08) 34px, rgba(180,180,180,.08) 35px),
    #1e1e1e;
  border-radius: 1rem; padding: 0.9rem;
}
/* A phone's width, because that is what a child holds. */
.qm-preview-frame { max-width: 24rem; margin: 0 auto; }
/* .pr-answers-pair is a VIEWPORT media query - two columns for short options
   on a wide screen. This frame is a PHONE width sitting inside a desktop
   page, so the query fires and pairs options that no phone ever pairs, in
   cells narrower than the tap-target guidance. Put them back in one column,
   which is what the child in the frame actually gets. */
@media (min-width: 700px) {
  #qm-preview-board .pr-answers-pair { display: block; }
  #qm-preview-board .pr-answers-pair .mcq-opt { margin-bottom: 0.5rem; height: auto; }
}
#qm-preview-board .pr-q img, #qm-preview-board .pr-q svg { max-width: 100%; height: auto; }
.qm-preview-opts { display: grid; gap: .4rem; font-size: .8rem; color: #334155; }
.dark .qm-preview-opts { color: #cbd5e1; }
.qm-preview-opts label { display: flex; align-items: flex-start; gap: .45rem; cursor: pointer; }
.qm-preview-note { font-size: .75rem; color: #64748b; }
.dark .qm-preview-note { color: #94a3b8; }
.qmp-hint-line + .qmp-hint-line { margin-top: .35rem; }
.qmp-fb { display: flex; align-items: flex-start; gap: .6rem; }
.qmp-fb-ico { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
.qmp-fb-head { font-weight: 700; margin-bottom: .2rem; }
.qmp-fb-body { font-size: .85rem; }

.qm-kid { margin: .5rem 0 1rem; }
.qm-kid .pr-q { font-size: 1rem; }
/* Capped, not hidden: a diagram is why the preview exists, but a 900px SVG
   would push every other card off the first screenful. */
.qm-kid .pr-q img, .qm-kid .pr-q svg { max-width: 100%; max-height: 170px; height: auto; }
.qm-kid-opts { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.qm-kid-opt {
  display: inline-flex; align-items: center; gap: .4rem; max-width: 100%;
  border: 2px solid #cbd5e1; background: #fff; color: #1e293b;
  border-radius: .6rem; padding: .3rem .6rem; font-size: .85rem;
}
/* Which option is right is signalled by the tick as well as the green, so it
   still reads for someone who cannot separate the hues. */
.qm-kid-opt.is-answer { border-color: #22c55e; background: #f0fdf4; }
.qm-kid-opt.is-answer::after { content: '\2713'; color: #16a34a; font-weight: 800; }
.dark .qm-kid-opt { background: #1e293b; border-color: #374151; color: #e5e7eb; }
.dark .qm-kid-opt.is-answer { background: #052e16; border-color: #22c55e; }
.qm-kid-typed { margin-top: .7rem; font-size: .85rem; }
.qm-kid-empty { font-style: italic; opacity: .7; }
.qm-preview-button {
  background: #0f766e; color: #fff; padding: .65rem .9rem; border-radius: .6rem;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.qm-preview-button:hover { background: #115e59; }

/* ══════════════════════════════════════════════════════════════════════
   Teacher restructure - "what needs you today" lists and the Set Work
   wizard.
   ⚠ Anything that sets a COLOUR on a p / small / label inside
   .ta-tab-content needs the doubled #screen-teacher#screen-teacher prefix:
   the chalkboard's own p:not(.teacher-intro):not(.ta-chip-hint) rule scores
   (1,3,1) and beats every single-id override.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Home: what needs you today ─────────────────────────────────────── */
.th-today { border: 1px solid var(--tp-line); border-radius: 16px; background: var(--tp-bg); overflow: hidden; margin-bottom: 1.15rem; }
.th-today-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem .95rem; border-bottom: 1px solid var(--tp-line); }
#screen-teacher#screen-teacher .ta-tab-content .th-today-head h4 { margin: 0; color: var(--tp-ink) !important; font-family: inherit; font-size: .98rem; font-weight: 800; }
#screen-teacher#screen-teacher .ta-tab-content .th-today-head small { color: var(--tp-muted) !important; font-size: .74rem; }
.th-todo { display: flex; align-items: center; gap: .7rem; padding: .8rem .95rem; border-bottom: 1px solid var(--tp-line); }
.th-todo:last-child { border-bottom: 0; }
.th-todo-ico { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; background: var(--tp-soft); font-size: 1.15rem; }
.th-todo-not-opened .th-todo-ico { background: var(--tp-warn-bg); }
.th-todo-all-done .th-todo-ico { background: var(--tp-good-bg); }
.th-todo-main { flex: 1; min-width: 0; }
#screen-teacher#screen-teacher .ta-tab-content .th-todo-main strong { display: block; color: var(--tp-ink) !important; font-size: .92rem; line-height: 1.35; }
#screen-teacher#screen-teacher .ta-tab-content .th-todo-main small { display: block; margin-top: 2px; color: var(--tp-muted) !important; font-size: .78rem; line-height: 1.35; }
.th-todo-btn { flex: none; min-height: 44px; padding: 0 .85rem; border: 1px solid #d1aa2c; border-radius: 10px; background: var(--tp-gold); color: var(--tp-gold-ink); font-size: .8rem; font-weight: 800; cursor: pointer; }
.th-todo-btn:hover { filter: brightness(1.06); }
.th-todo-all-done .th-todo-btn { border-color: var(--tp-line); background: var(--tp-soft); color: var(--tp-ink); }
.th-classes-head { margin: 0 0 .55rem; }
#screen-teacher#screen-teacher .ta-tab-content .th-classes-head h4 { margin: 0; color: #fff !important; font-family: 'Caveat', cursive; font-size: 1.5rem; }
#screen-teacher#screen-teacher .ta-tab-content .th-classes-head p { margin: .1rem 0 0; color: rgba(240,236,220,.8) !important; font-size: .85rem; }

/* ── Classroom: what needs you today (chalkboard, not paper) ────────── */
.tc-todo-list { display: grid; gap: .55rem; margin-bottom: .9rem; }
.tc-todo {
  display: flex; align-items: center; gap: .7rem;
  padding: .8rem .9rem;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 14px;
  background: rgba(9,28,14,.28);
}
.tc-todo-not-opened { border-color: rgba(245,158,11,.5); }
.tc-todo-all-done { border-color: rgba(34,197,94,.38); }
.tc-todo-ico { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; background: rgba(255,255,255,.09); font-size: 1.15rem; }
.tc-todo-main { flex: 1; min-width: 0; }
.tc-todo-main strong { display: block; color: #fff; font-size: .92rem; line-height: 1.35; }
.tc-todo-main small { display: block; margin-top: 2px; color: rgba(240,236,220,.8); font-size: .76rem; line-height: 1.35; }
.tc-todo-btn {
  flex: none; min-height: 44px; padding: 0 .8rem;
  border: 0; border-radius: 10px;
  color: #302408; background: #fcd34d;
  font: inherit; font-size: .76rem; font-weight: 900; cursor: pointer;
}
.tc-todo-btn:hover { filter: brightness(1.07); }
.tc-todo-all-done .tc-todo-btn { color: #f0ece0; background: rgba(255,255,255,.12); }
.tc-today-footnote { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .2rem 0 0; color: rgba(240,236,220,.78); font-size: .78rem; }
.tc-today-footnote button {
  min-height: 44px; padding: 0 .5rem;
  border: 0; border-radius: 8px;
  color: rgba(240,236,220,.9); background: transparent;
  font: inherit; font-size: .78rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.tc-today-footnote button:hover { color: #fff; background: rgba(255,255,255,.08); }

/* ── Set Work: one question per screen ──────────────────────────────── */
.ta-wiz-top { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.ta-wiz-quit {
  min-height: 44px; padding: 0 .8rem;
  border: 1px solid rgba(240,236,220,.35); border-radius: 10px;
  background: rgba(255,255,255,.08); color: #f0ece0;
  font-size: .82rem; font-weight: 700; cursor: pointer;
}
.ta-wiz-quit:hover { background: rgba(255,255,255,.16); }
.ta-wiz-track { display: flex; flex: 1; gap: .3rem; }
.ta-wiz-track i { flex: 1; height: 6px; border-radius: 999px; background: rgba(255,255,255,.16); }
.ta-wiz-track i.done { background: rgba(252,211,77,.55); }
.ta-wiz-track i.on { background: #fcd34d; }
#screen-teacher#screen-teacher .ta-tab-content .ta-wiz-count { flex: none; color: rgba(240,236,220,.8) !important; font-size: .78rem; font-weight: 700; white-space: nowrap; }
#screen-teacher#screen-teacher .ta-tab-content .ta-wiz-q {
  margin: 0 0 .3rem; color: #fff !important;
  font-family: 'Caveat', cursive; font-size: 2rem; line-height: 1.15;
}
#screen-teacher#screen-teacher .ta-tab-content .ta-wiz-help { margin: 0 0 1rem; color: rgba(240,236,220,.82) !important; font-size: .92rem; line-height: 1.45; }
#screen-teacher#screen-teacher .ta-tab-content .ta-wiz-sub { margin: 1.3rem 0 .55rem; color: #fff !important; font-family: inherit; font-size: 1rem; font-weight: 800; }
.ta-wiz-nav { display: flex; gap: .6rem; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.14); }
.ta-wiz-back, .ta-wiz-next { min-height: 48px; padding: 0 1.1rem; border-radius: 12px; font-size: .95rem; font-weight: 800; cursor: pointer; }
.ta-wiz-back { border: 1px solid rgba(240,236,220,.35); background: rgba(255,255,255,.08); color: #f0ece0; }
.ta-wiz-back:hover { background: rgba(255,255,255,.16); }
.ta-wiz-next { flex: 1; border: 1px solid #d1aa2c; background: var(--tp-gold); color: var(--tp-gold-ink); }
.ta-wiz-next:hover { filter: brightness(1.06); }

/* Which part of the subject - the choice that used to be "leave it blank". */
.ta-scope { display: grid; gap: .55rem; margin-bottom: 1rem; }
.ta-scope-opt {
  display: flex; align-items: flex-start; gap: .75rem;
  min-height: 44px; padding: .85rem .9rem;
  border: 2px solid var(--tp-line); border-radius: 14px;
  background: var(--tp-bg); color: var(--tp-ink);
  cursor: pointer;
}
.ta-scope-opt input { margin-top: .25rem; flex: none; width: 20px; height: 20px; accent-color: #2a4d28; }
.ta-scope-opt-sel { border-color: #d1aa2c; box-shadow: 0 0 0 3px rgba(244,206,82,.28); }
.ta-scope-ico { flex: none; font-size: 1.3rem; line-height: 1.2; }
.ta-scope-text { min-width: 0; }
#screen-teacher#screen-teacher .ta-tab-content .ta-scope-text strong { display: block; color: var(--tp-ink) !important; font-size: .96rem; }
#screen-teacher#screen-teacher .ta-tab-content .ta-scope-text small { display: block; margin-top: 2px; color: var(--tp-muted) !important; font-size: .8rem; line-height: 1.4; }

/* The whole assignment in one sentence, right above the button that sends it. */
.ta-wiz-summary {
  margin: 1.2rem 0 .8rem; padding: .95rem 1rem;
  border: 1px solid var(--tp-line); border-left: 5px solid var(--tp-gold); border-radius: 14px;
  background: var(--tp-bg); color: var(--tp-ink);
}
#screen-teacher#screen-teacher .ta-tab-content .ta-wiz-summary-kicker { display: block; margin-bottom: .3rem; color: var(--tp-muted) !important; font-size: .68rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
#screen-teacher#screen-teacher .ta-tab-content .ta-wiz-summary p { margin: 0; color: var(--tp-ink) !important; font-size: 1rem; line-height: 1.55; }
#screen-teacher#screen-teacher .ta-tab-content .ta-wiz-summary p b { color: var(--tp-ink) !important; font-weight: 800; }
#screen-teacher#screen-teacher .ta-tab-content .ta-wiz-summary-how { margin-top: .45rem !important; color: var(--tp-muted) !important; font-size: .84rem !important; }

@media (max-width: 640px) {
  .th-todo, .tc-todo { flex-wrap: wrap; }
  .th-todo-main, .tc-todo-main { flex: 1 1 60%; }
  .th-todo-btn, .tc-todo-btn { flex: 1 1 100%; margin-left: 48px; }
  .ta-wiz-top { flex-wrap: wrap; }
  .ta-wiz-track { order: 3; flex: 1 1 100%; }
  #screen-teacher#screen-teacher .ta-tab-content .ta-wiz-q { font-size: 1.7rem; }
  .ta-wiz-nav { position: sticky; bottom: 0; z-index: 2; margin-left: -.5rem; margin-right: -.5rem; padding: .7rem .5rem calc(.7rem + env(safe-area-inset-bottom)); background: rgba(18,42,22,.96); backdrop-filter: blur(4px); }
}

/* The classroom header numbers navigate now - they are the only place this
   class is counted, so each one is the way to what it counts. */
button.tc-cd-stat { min-height: 44px; font: inherit; text-align: center; cursor: pointer; transition: background .14s, border-color .14s; }
button.tc-cd-stat:hover { background: rgba(255,255,255,.12); border-color: rgba(240,236,220,.28); }
button.tc-cd-stat:focus-visible { outline: 3px solid #f4ce52; outline-offset: 2px; }
/* The rail labels are the whole navigation for a teacher who is not sure
   what the icons mean, so they are readable rather than decorative. */
.tc-cd-nav-btn span { font-size: .82rem; }
@media (max-width: 430px) {
  .tc-cd-nav .tc-cd-nav-btn span { font-size: .72rem; }
}
