/* MaTalk styles shared by the extension side panel and the class web page.
   Keep identical in both places: scripts/sync-web.sh copies it.

   The brand: warm cream, MaTalk blue, Verbi, and picture cards bordered in
   Fitzgerald category colours. Motion is gentle and brief, because many of
   the children are sensitive to it, and it switches off entirely when the
   device asks for reduced motion. No web fonts: nothing is loaded from a third
   party on a child's device. */

:root {
  --cream: #fff5e0;
  --cream-deep: #f8e8c6;
  --paper: #fffdf8;
  --ink: #2b2a33;
  --muted: #6e6a73;
  --blue: #478ddb;
  --blue-dark: #2f6fb8;
  --blue-soft: #eaf3fd;
  --blue-line: #cfe1f7;
  --card: #ffffff;
  --line: #eadfc8;
  --green: #29d414;
  --green-dark: #1f9c0f;
  --green-soft: #e9fbe4;
  --sun: #f2c230;
  --sun-soft: #fff5d1;
  --red: #d8323f;

  --radius-s: 12px;
  --radius: 16px;
  --radius-l: 22px;
  --shadow-s: 0 1px 2px rgba(92, 64, 20, 0.06), 0 2px 8px rgba(92, 64, 20, 0.05);
  --shadow: 0 2px 4px rgba(92, 64, 20, 0.05), 0 8px 24px rgba(92, 64, 20, 0.08);
  --shadow-l: 0 4px 10px rgba(92, 64, 20, 0.07), 0 18px 44px rgba(92, 64, 20, 0.14);
  --spring: cubic-bezier(0.2, 0.9, 0.3, 1.2);
  /* Cards, panels and buttons: a warm white, softer than pure white on the
     cream page. Pictures (library symbols are drawn on pure white) keep #fff. */
  --warm-white: #fffcf6;
  /* Things inside a warm-white card (its rows, chips, folds): a soft tint, so
     the layers stand apart. */
  --inset: #f6efe1;
  --inset-line: #e6dac4;

  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 105% -8%, #ffeccb 0%, rgba(255, 236, 203, 0) 60%),
    radial-gradient(900px 480px at -12% 108%, #ffeed2 0%, rgba(255, 238, 210, 0) 60%),
    var(--cream);
  background-attachment: fixed;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; }

/* ---------- Buttons ---------- */

button {
  border: 0;
  border-radius: 14px;
  padding: 11px 20px;
  background: linear-gradient(180deg, #5a9de5 0%, var(--blue) 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 0 var(--blue-dark), 0 6px 14px rgba(47, 111, 184, 0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}
button:hover { background: linear-gradient(180deg, #4d94e0 0%, #3b82d2 100%); }
button:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 var(--blue-dark), 0 3px 8px rgba(47, 111, 184, 0.18); }
button:disabled { background: #cfccd2; box-shadow: none; cursor: not-allowed; transform: none; }

button.secondary { background: var(--warm-white); color: var(--blue-dark); border: 2px solid var(--blue-line); box-shadow: var(--shadow-s); }
button.secondary:hover { background: var(--blue-soft); border-color: var(--blue); }
button.secondary:active { box-shadow: none; }
button.danger { background: var(--warm-white); color: var(--red); border: 2px solid #f1c3c7; box-shadow: none; }
button.danger:hover { background: #fff3f4; border-color: var(--red); }
button.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
button.wide { width: 100%; }
button.link-button { background: none; color: var(--blue-dark); padding: 4px 6px; font-weight: 600; font-size: 13px; box-shadow: none; }
/* Red only for taking something away. */
button.link-button.remove, button.link-button.remove-question, button.link-button.remove-picture, button.link-button.ws-item-remove, .picker-tile-tools .link-button:last-child { color: var(--red); }
button.link-button:hover { background: none; text-decoration: underline; }
button.link-button:active { transform: none; }
/* Link-style buttons that aren't destructive: the base rule colours
   button.link-button red (for "Remove"), which reads as "danger" elsewhere. */
button.link-button.toggle-questions, button.link-button.mark-right { color: var(--blue-dark); font-weight: 700; }
button.link-button.end-button { color: var(--muted); margin-left: auto; }

button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid #f0a020;
  outline-offset: 2px;
}

/* ---------- Fields & type ---------- */

input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea {
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--warm-white);
  color: var(--ink);
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
  outline: none;
}
input::placeholder, textarea::placeholder { color: #a39d93; }
textarea { resize: vertical; width: 100%; }

h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
h2 { margin: 18px 0 8px; font-size: 17px; font-weight: 800; }
h3 { margin: 0; font-size: 15px; font-weight: 800; }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
.error { color: var(--red); }

/* ---------- Views & headers ---------- */

.view { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: 12px; }

.view-header { display: flex; align-items: center; gap: 12px; padding: 14px 12px 6px; }
.back-button {
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  background: var(--warm-white);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 20px;
  box-shadow: var(--shadow-s);
}
.back-button:hover { background: var(--paper); border-color: var(--blue-line); }
.view-title { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.view-title h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }

.connection {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c4c4ca; flex: none; }
.connection[data-status="live"] .dot { background: var(--green); }
.connection[data-status="reconnecting"] .dot, .connection[data-status="connecting"] .dot { background: #f0a020; }
.connection[data-status="gone"] .dot { background: var(--red); }
.teacher-view .connection[data-status="live"] .dot { animation: ping 2.6s ease-out infinite; }

/* ---------- Home ---------- */

.home-header { display: flex; align-items: center; gap: 14px; padding: 20px 16px 6px; }
.home-mascot {
  width: 72px;
  height: 72px;
  object-fit: contain;
  padding: 8px;
  border-radius: 24px;
  background: var(--warm-white);
  box-shadow: var(--shadow);
}
.home-section { padding: 0 16px; }
.home-section > p:first-child { margin-top: 12px; }
#view-home > .wide { margin: 18px 16px 0; width: auto; }
#view-home { gap: 0; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; margin-bottom: 8px; }
.section-head h2 { margin: 0; }
.create-class { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.create-class input { flex: 1 1 220px; }

.dev-signin { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 12px; border: 2px dashed var(--line); border-radius: var(--radius-s); }

.class-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.class-item {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  text-align: left;
  background: var(--warm-white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-s);
}
.class-item::after { content: "›"; order: 99; margin-left: auto; font-size: 26px; line-height: 1; color: #c9bda4; font-weight: 400; }
.class-item:has(.live-badge)::after { margin-left: 4px; }
.class-item:hover { background: var(--warm-white); border-color: var(--blue-line); box-shadow: var(--shadow); transform: translateY(-1px); }
.class-item:hover::after { color: var(--blue); }
.class-item:disabled { background: #faf7f0; box-shadow: none; }
.class-item-name { font-weight: 800; font-size: 16px; }
.live-badge {
  margin-left: auto;
  background: var(--green-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(41, 212, 20, 0.18);
}
/* A child's classes: big tiles, easy to tap. */
.class-list.big .class-item { min-height: 88px; padding: 16px 20px; border-radius: var(--radius-l); }
.class-list.big .class-item-name { font-size: 24px; }
.class-list.big .live-badge { font-size: 16px; padding: 6px 14px; }

.inline-form, .type-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input, .type-form input { flex: 1; }

.role-options { display: flex; flex-direction: column; gap: 12px; }
.role-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  row-gap: 2px;
  align-items: center;
  text-align: left;
  background: var(--warm-white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 16px 18px;
  box-shadow: var(--shadow-s);
}
.role-card:hover { background: var(--warm-white); border-color: var(--blue-line); box-shadow: var(--shadow); transform: translateY(-1px); }
.role-icon { grid-row: 1 / span 2; font-size: 30px; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: var(--sun-soft); }
.role-card[data-role="student"] .role-icon { background: var(--green-soft); }
.role-name { font-size: 17px; font-weight: 800; }

.signin-status { margin-top: 8px; }

.home-status { padding: 0 16px; }

.settings { border-top: 1px solid var(--line); padding: 8px 16px 12px; font-size: 14px; margin-top: auto; }
.settings summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
#settings-form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
#settings-form label { display: flex; flex-direction: column; gap: 4px; }
#settings-form input { padding: 8px 10px; border-width: 1px; border-radius: 8px; }

#view-home .settings { margin-top: auto; padding-top: 16px; }

/* ---------- Solo practice (the original Q&A) ---------- */

.mic-button { flex: none; width: 60px; border-radius: 16px; padding: 0; display: grid; place-items: center; }
.mic-button svg { width: 28px; height: 28px; fill: currentColor; }
.mic-button.listening { background: #e5334a; box-shadow: 0 0 0 6px rgba(229, 51, 74, 0.18); animation: pulse 1.2s ease-in-out infinite; }

.question-box {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 2px solid var(--blue-line);
  border-radius: var(--radius);
  padding: 8px 12px;
  box-shadow: var(--shadow-s);
}
.question-text {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.question-text.placeholder { color: var(--muted); font-weight: 400; font-size: 14px; }

#view-solo > .phase, .class-view .phase { padding: 12px 12px 0; }
.phase { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.mascot { width: 140px; height: auto; }
.prompt { margin: 0; font-size: 21px; font-weight: 800; }

.phase .type-form { width: 100%; margin-top: 12px; }

/* ---------- Answer cards ---------- */

.answer-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 14px;
}
.answer-card {
  position: relative;
  aspect-ratio: 1 / 1.05;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  background: linear-gradient(180deg, #ffffff 0%, var(--paper) 100%);
  color: var(--ink);
  border: 3px solid var(--card-border, #e3dccd);
  border-radius: 20px;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--card-border, #e3dccd) 45%, transparent), 0 8px 18px rgba(92, 64, 20, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.2s ease;
}
.answer-card:hover { background: #fff; transform: translateY(-3px); box-shadow: 0 4px 0 color-mix(in srgb, var(--card-border, #e3dccd) 50%, transparent), 0 14px 26px rgba(92, 64, 20, 0.12); }
.answer-card:active { transform: scale(0.97); }
.answer-card .emoji { font-size: 46px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(60, 40, 10, 0.14)); }
.answer-card .label { font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
/* Words only (a class setting): the word fills the card, with no picture. */
.answer-card.words-only { padding: 12px; }
.answer-card.words-only .label { font-size: 26px; line-height: 1.15; text-align: center; }
.answer-grid.few .answer-card.words-only .label { font-size: clamp(30px, 4vw, 44px); }
.live-question .answer-card.words-only .label { font-size: 20px; }
.live-question .answer-grid.few .answer-card.words-only .label { font-size: 24px; }

/* How much of the class chose a card: a tint that deepens with the share. */
.answer-card.chosen { background: color-mix(in srgb, #d6e8ff calc(var(--share) * 100%), #fff); }
.answer-card.selected {
  background: var(--green-soft);
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(41, 212, 20, 0.22), 0 8px 18px rgba(31, 156, 15, 0.14);
}
/* Once the answer is shown: the right card glows, the others step back. */
.answer-card.outcome-right {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 0 0 6px rgba(41, 212, 20, 0.28), 0 10px 26px rgba(31, 156, 15, 0.18);
}
.answer-card.outcome-faded { opacity: 0.42; transform: none; }
/* Green means only "right". A child's own pick, if it wasn't right, drops to a
   calm blue outline so it can't be read as correct. */
.answer-card.outcome-faded.selected { background: #fff; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(71, 141, 219, 0.2); opacity: 0.85; }

.answer-card.more { --card-border: var(--blue-line); color: var(--blue-dark); background: var(--blue-soft); }
.answer-card.more .label { font-size: 15px; }
.answer-card.more:disabled { color: #9a9aa2; --card-border: #e2dfd8; background: #f6f4ef; transform: none; box-shadow: none; }
.answer-card.round-nav { --card-border: var(--blue-line); color: var(--blue-dark); background: var(--blue-soft); display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 6px; padding: 8px; cursor: default; }
.answer-card.round-nav .label { font-size: 15px; text-align: center; flex: 1; }
.round-nav .round-step { min-width: 44px; min-height: 44px; border-radius: 12px; border: 2px solid var(--blue-line); background: var(--warm-white); color: var(--blue-dark); font-size: 26px; font-weight: 700; line-height: 1; cursor: pointer; }
.round-nav .round-step:disabled { opacity: 0.35; cursor: default; }

.count-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5a9de5, var(--blue));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(47, 111, 184, 0.3);
}
.count-badge.zero { background: #efe8da; color: #9a917f; box-shadow: none; }
.count-badge.bump { animation: bump 0.45s var(--spring); }
.corner-badge { position: absolute; bottom: 7px; font-size: 11px; font-weight: 800; color: var(--green-dark); }

.number-card .emoji { font-size: 54px; font-weight: 900; color: var(--ink); font-family: inherit; filter: none; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; color: var(--blue-dark); font-size: 13px; letter-spacing: 1px; }

/* Fitzgerald-style border colours by category */
.cat-person { --card-border: #f2c230; }
.cat-activity { --card-border: #43a047; }
.cat-description, .cat-feeling { --card-border: #478ddb; }
.cat-animal, .cat-thing, .cat-food, .cat-place { --card-border: #f08a24; }
.cat-choice, .cat-need, .cat-support { --card-border: #e5334a; }
.cat-question, .cat-time { --card-border: #8e5cc9; }

/* Fewer cards come out bigger. */
.answer-grid.few { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.answer-grid.few .answer-card .emoji { font-size: 66px; }
.answer-grid.few .answer-card .label { font-size: 22px; }

/* A new question's cards glide in, one after another. */
.answer-grid.enter > * { animation: card-in 0.42s var(--spring) both; }
.answer-grid.enter > :nth-child(2) { animation-delay: 0.04s; }
.answer-grid.enter > :nth-child(3) { animation-delay: 0.08s; }
.answer-grid.enter > :nth-child(4) { animation-delay: 0.12s; }
.answer-grid.enter > :nth-child(5) { animation-delay: 0.16s; }
.answer-grid.enter > :nth-child(6) { animation-delay: 0.2s; }
.answer-grid.enter > :nth-child(7) { animation-delay: 0.24s; }
.answer-grid.enter > :nth-child(n + 8) { animation-delay: 0.28s; }

/* Teacher cards: the card itself, plus a separate ✓ circle. */
.card-wrap { position: relative; display: grid; }
.card-wrap > .answer-card { width: 100%; }
.correct-toggle {
  position: absolute; top: -9px; left: -9px; width: 36px; height: 36px; padding: 0;
  border-radius: 999px; background: var(--warm-white); color: #c9c2b2; border: 2px solid #ded7c6;
  font-size: 18px; font-weight: 900; line-height: 1; display: grid; place-items: center;
  box-shadow: 0 3px 8px rgba(92, 64, 20, 0.16);
}
.correct-toggle:hover { background: var(--green-soft); color: var(--green-dark); border-color: var(--green); }
.correct-toggle.on { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.correct-toggle:disabled { cursor: default; }
.correct-toggle:disabled:not(.on) { display: none; }

/* ---------- Class views (teacher + student) ---------- */

.class-view { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.class-view > .answer-grid, .class-view > .pick-status, .class-view > .question-box { margin: 0 12px; width: auto; }
.pick-status { text-align: center; }

.tabs {
  align-self: flex-start;
  max-width: calc(100% - 24px);
  overflow-x: auto;
  display: flex;
  gap: 2px;
  margin: 2px 12px 0;
  padding: 4px;
  border-radius: 14px;
  background: var(--cream-deep);
  box-shadow: inset 0 1px 2px rgba(92, 64, 20, 0.08);
}
.tab { background: none; color: var(--muted); border-radius: 11px; padding: 8px 16px; font-size: 15px; white-space: nowrap; box-shadow: none; }
.tab:hover { background: rgba(255, 255, 255, 0.55); }
.tab:active { transform: none; box-shadow: none; }
.tab[aria-selected="true"] { color: var(--blue-dark); background: var(--warm-white); box-shadow: var(--shadow-s); }

.tab-panel { display: flex; flex-direction: column; gap: 12px; }

.tab-panel > .type-form { margin: 0 12px; }
.tab-panel > .live-error:empty { display: none; }
.tab-panel > .live-error, .no-question, .live-question, .roster { margin: 0 12px; }
.teacher-view > .tab-panel[data-panel="live"] { flex: 1; }

/* Big segmented buttons instead of dropdowns: easy to hit on an iPad. */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: #f4ead6; box-shadow: inset 0 1px 2px rgba(92, 64, 20, 0.08); }
.segmented button { background: none; color: var(--muted); border-radius: 9px; padding: 7px 14px; font-size: 15px; min-height: 38px; box-shadow: none; }
.segmented button:hover { background: rgba(255, 255, 255, 0.6); color: var(--ink); }
.segmented button:active { transform: none; box-shadow: none; }
.segmented button[aria-checked="true"] { background: linear-gradient(180deg, #5a9de5, var(--blue)); color: #fff; box-shadow: 0 2px 6px rgba(47, 111, 184, 0.3); }
/* Summary → the time choice: one bar under the heading. For Earlier the bar
   also holds ‹ the period › and a calendar; Day · Week sits under it. */
.summary-range { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.range-bar { display: inline-flex; flex-wrap: wrap; align-items: center; max-width: 100%; padding: 3px; border-radius: 12px; background: #f4ead6; box-shadow: inset 0 1px 2px rgba(92, 64, 20, 0.08); }
.range-bar .segmented { padding: 0; background: none; box-shadow: none; }
.earlier-period { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding-left: 8px; border-left: 1px solid rgba(92, 64, 20, 0.16); }
.earlier-step { width: 38px; height: 38px; min-height: 0; padding: 0; border: 0; border-radius: 9px; background: none; box-shadow: none; color: var(--blue-dark); font-size: 20px; font-weight: 800; line-height: 1; }
.earlier-step:hover:not(:disabled) { background: rgba(255, 255, 255, 0.7); transform: none; box-shadow: none; }
.earlier-step:disabled { background: none; color: var(--muted); opacity: 0.35; cursor: default; }
.earlier-label { min-width: 120px; padding: 0 4px; text-align: center; font-size: 15px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.earlier-calendar { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; color: var(--blue-dark); cursor: pointer; }
.earlier-calendar:hover { background: rgba(255, 255, 255, 0.7); }
.earlier-calendar input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.earlier-under { margin: 0 0 0 6px; font-size: 13px; }
.earlier-unit { font-size: 13px; padding: 0; min-height: 0; }
.earlier-unit[aria-pressed="true"] { color: var(--ink); font-weight: 800; text-decoration: none; cursor: default; }
@media (max-width: 560px) {
  .earlier-period { margin: 4px 0 0; padding-left: 0; border-left: 0; width: 100%; justify-content: space-between; }
}
.ask-settings, .planned-settings { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.grid-slot, .choices-slot { display: inline-flex; align-items: center; gap: 8px; }
.setting { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.setting-label { font-weight: 700; font-size: 13px; color: var(--muted); }

/* ---------- Teacher: lesson panel ---------- */

.lesson-title { font-weight: 800; flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }

.lesson-questions {
  list-style: none; margin: 0; padding: 6px; display: flex; flex-direction: column; gap: 4px;
  background: var(--warm-white); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  max-height: 320px; overflow-y: auto;
}
.lesson-question {
  width: 100%; display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center;
  text-align: left; background: none; color: var(--ink); border-radius: 10px; padding: 10px 12px; min-height: 44px; box-shadow: none;
}
.lesson-question:hover { background: #f5f9ff; }
.lesson-question:active { transform: none; box-shadow: none; }
.lesson-question.selected { background: var(--blue-soft); box-shadow: inset 0 0 0 2px var(--blue); }

.lesson-next {
  display: flex; align-items: center; gap: 12px;
  background: var(--warm-white); border-radius: 18px; padding: 14px 16px;
  border: 1px solid var(--blue-line); border-left: 6px solid var(--blue);
  box-shadow: var(--shadow);
}

.lesson-next-label { font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--blue-dark); }
.lesson-next-question { font-size: 21px; font-weight: 800; overflow-wrap: anywhere; }
.ask-lesson { font-size: 18px; padding: 12px 28px; }

/* ---------- Teacher: the question on stage ---------- */

.live-question {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 16px;
  box-shadow: var(--shadow);
}
.asked { margin: 0; }
.asked-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.asked-top .end-button { flex: none; }
.asked-status { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--blue-dark); }
.asked-text { margin: 4px 0 0; font-size: 28px; font-weight: 800; line-height: 1.22; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.question-hint { min-height: 20px; margin: -4px 0 0; }
.question-hint:empty { min-height: 0; display: none; }
.live-question .answer-grid { padding-top: 6px; }

.results { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.answered-summary { margin: 0; font-weight: 800; font-size: 16px; }
.progress { height: 12px; background: #f3ead8; border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(92, 64, 20, 0.1); }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #5ee04a, var(--green) 60%, #24c010); transition: width 0.45s var(--spring); }
.question-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.question-actions .reveal-button, .question-actions .next-button, .question-actions .back-to-slides { font-size: 17px; padding: 12px 22px; }
.question-actions .back-to-slides { display: inline-flex; align-items: center; gap: 8px; background: var(--green-dark); }
.question-actions .back-to-slides[hidden] { display: none; }
.question-actions .reveal-button:disabled { opacity: 0.6; }
.next-up { font-size: 13px; }

.live-status { margin: 0 12px; font-weight: 700; color: var(--blue-dark); display: flex; align-items: center; gap: 8px; }
.live-status::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--blue-line); border-top-color: var(--blue); animation: spin 0.8s linear infinite; }
.live-status:empty { display: none; }

/* Older list-style results, kept for the extension. */

.distribution { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.distribution li { display: grid; grid-template-columns: minmax(60px, 1fr) 2fr auto; align-items: center; gap: 8px; font-size: 14px; }

/* ---------- Teacher: nothing asked yet ---------- */

.idle-stage {
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 20px;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background:
    radial-gradient(260px 180px at 100% 0%, var(--blue-soft) 0%, rgba(234, 243, 253, 0) 70%),
    radial-gradient(220px 160px at 0% 100%, var(--sun-soft) 0%, rgba(255, 245, 209, 0) 70%),
    var(--paper);
  box-shadow: var(--shadow);
}
.idle-stage.in-lesson { padding: 0; border: 0; background: none; box-shadow: none; }
.idle-title { margin: 0; font-size: 24px; letter-spacing: -0.01em; }
.idle-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.idle-stage.in-lesson .idle-actions { margin-top: 0; }

.lesson-picker, .lesson-done { margin-top: 12px; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-s); }
.lesson-picker-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 8px; }
.lesson-done h3 { margin: 0 0 6px; font-size: 18px; }
.lesson-done h3::before { content: "🎉 "; }

/* ---------- Teacher: roster ---------- */

.roster-head { margin: 8px 12px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.roster-title { margin: 0; }
.roster-head .online-summary { flex-basis: 100%; }
.roster-head .online-summary:empty { display: none; }
.show-answers { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.roster { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.roster li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 14px;
  box-shadow: var(--shadow-s);
}
.avatar {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  background: color-mix(in srgb, var(--avatar, #478ddb) 26%, #fff);
  border: 2px solid color-mix(in srgb, var(--avatar, #478ddb) 70%, #fff);
}
.roster li.online .avatar::after {
  content: ""; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--green); border: 2px solid #fff;
}
.roster li.offline { background: #fbf8f2; box-shadow: none; }
.roster li.offline .avatar { filter: grayscale(1); opacity: 0.55; }
.roster li.offline .roster-name { color: var(--muted); }
.roster-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.roster-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.roster-choices { font-size: 12px; }
.roster-choices:empty { display: none; }
.roster-pick { color: var(--muted); font-size: 12px; white-space: nowrap; }
.roster li[data-pick="answered"] .roster-pick { color: var(--green-dark); background: var(--green-soft); font-weight: 800; padding: 1px 8px; border-radius: 999px; }
.roster li.online[data-pick="waiting"] .roster-pick { color: #8a6d12; background: var(--sun-soft); font-weight: 700; padding: 1px 8px; border-radius: 999px; }

/* A narrow side panel or phone: three cards a row, and a little less padding. */
@media (max-width: 520px) {
  .live-question { padding: 12px; border-radius: 18px; }
  .asked-text { font-size: 24px; }
  .live-question .answer-grid { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; }
  .live-question .answer-card { border-radius: 16px; }
  .live-question .answer-card .emoji { font-size: 34px; }
  .live-question .answer-card .label { font-size: 14px; }
  .live-question .answer-grid.few .answer-card .emoji { font-size: 48px; }
  .live-question .answer-grid.few .answer-card .label { font-size: 17px; }
  .live-question .count-badge { top: 5px; right: 5px; min-width: 24px; height: 24px; font-size: 13px; }
  .lesson-next { flex-wrap: wrap; }
  .lesson-next-question { font-size: 19px; }
}

/* ---------- Teacher: the ask bar, always at the bottom ---------- */

.composer {
  position: sticky;
  bottom: 10px;
  z-index: 5;
  margin: auto 12px 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-l);
}

.composer .segmented button { padding: 5px 12px; min-height: 34px; font-size: 14px; }
.composer .mode-help { font-size: 13px; margin: -4px 0 0; }
.composer.slim .mode-help { display: none; }
.composer .type-form { margin: 0; align-items: stretch; }
.composer .type-input { font-size: 17px; min-height: 52px; border-radius: 16px; }
.composer .mic-button { width: 52px; min-height: 52px; border-radius: 16px; }
.composer .type-form button[type="submit"] { padding: 0 26px; font-size: 17px; border-radius: 16px; }
@media (max-width: 520px) {
  .composer { padding: 10px; gap: 8px; }
  .composer .setting-label { font-size: 12px; }
  .composer .segmented button { padding: 4px 9px; font-size: 13px; min-height: 32px; }
  .composer .type-form button[type="submit"] { padding: 0 18px; }
}

/* ---------- Teacher: students tab ---------- */

.tab-panel[data-panel="students"] { padding: 4px 12px 0; }
.add-students-form { display: flex; flex-direction: column; gap: 8px; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-s); }
.add-students-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.add-students-form button { align-self: flex-start; }
.student-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.student-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow-s);
}
.student-list li > div { display: flex; flex-direction: column; min-width: 0; }
.student-list li.pending { background: #fbf8f2; box-shadow: none; }
.student-list li.pending .student-name { color: var(--muted); }
.student-list .choices-slot { margin-left: auto; }
.student-list .choices-slot .segmented button { padding: 4px 10px; min-height: 32px; font-size: 13px; }
.student-name { font-weight: 700; overflow-wrap: anywhere; }
.student-email { font-size: 12px; }
/* Students and the co-teacher, side by side (stacked on a narrow screen). */
.people-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; align-items: stretch; }
.people-row > * { height: 100%; box-sizing: border-box; }
.people-title { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.people-title .help-dot { width: 22px; height: 22px; font-size: 12px; box-shadow: none; padding: 0; min-height: 0; }
.join-info { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 2px dashed var(--line); border-radius: 12px; background: var(--paper); }
.join-info p { margin: 0; }
.join-info .help-dot { width: 20px; height: 20px; font-size: 11px; vertical-align: 1px; margin-left: 4px; box-shadow: none; }
.co-teacher-box { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-s); }
.sharing { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.sharing-summary { margin: 0; font-size: 13.5px; font-weight: 700; }
.sharing-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sharing-classes { margin: 0; font-size: 13px; }
.sharing-row { display: flex; flex-direction: column; gap: 6px; }
.sharing-row + .sharing-row { padding-top: 8px; border-top: 1px dashed var(--line); }
.setup-notice { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 12px 14px; margin-bottom: 12px; border-radius: var(--radius); background: #eef4ff; border: 1px solid var(--blue-line, #c9d8f5); font-weight: 700; font-size: 14px; }
.setup-notice p { margin: 0; flex: 1 1 280px; }
.setup-notice-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-tabs .segmented { flex-wrap: wrap; }
.share-tabs .segmented button { font-size: 13px; padding: 6px 10px; min-height: 34px; }
.share-tools { display: flex; align-items: center; gap: 10px; margin: 10px 0 8px; }
.share-search { flex: 1 1 auto; min-width: 0; }
.share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--warm-white); overflow: hidden; }
.share-list li + li { border-top: 1px solid var(--line); }
.share-list > .hint { padding: 10px 12px; }
.share-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; cursor: pointer; }
.share-row:hover { background: var(--paper); }
.share-title { flex: 1 1 auto; min-width: 0; font-weight: 700; overflow-wrap: anywhere; line-height: 1.3; }
.share-meta { flex: none; font-size: 12.5px; }
.share-status { margin: 0 auto 0 0; font-size: 13px; }
/* The other teachers of a co-taught class, in the header. */
.teachers-online { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.teacher-online { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.teacher-online[data-online="true"] .dot { background: var(--green); }
/* The class's students: a compact tile each, several to a row on a wide
   screen; a student's settings open in place, across the row. */
.class-students { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.class-students li.student-tile { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 4px; padding: 8px 12px; }
.class-students li.student-tile.open { grid-column: 1 / -1; }
.class-students li .student-row { display: flex; flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
.student-row .student-who { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.student-row .student-name, .student-row .student-email { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presence[data-online="true"] { background: var(--green); }
.student-summary { margin: 0 0 0 18px; font-size: 12.5px; }
.class-students li .student-settings { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 6px 0 2px 18px; }
.class-students li .student-settings .choices-slot { margin-left: 0; }
.class-students li .student-settings .access-slot { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
.class-students li .student-settings .remove { margin-left: auto; }
.co-teacher-box p { margin: 0; }
.co-teacher-form { display: flex; gap: 8px; flex-wrap: wrap; }
.co-teacher-form input { flex: 1 1 220px; min-width: 0; }
.co-teacher-box .leave-class { align-self: flex-start; }
/* Another teacher is presenting: her controls rest, the results stay readable. */
.presenter-lock, .groups-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; border-radius: var(--radius); font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.presenter-lock { background: #fff6e0; border: 1px solid #f0d58a; color: #6b4e00; }
.groups-bar { background: #eef4ff; border: 1px solid var(--blue-line, #c9d8f5); color: var(--ink); }
.presenter-lock-text, .groups-text { flex: 1 1 240px; }
.teacher-view.locked .composer,
.teacher-view.locked .question-actions,
.teacher-view.locked .top-tools,
.teacher-view.locked .on-screen-stop,
.teacher-view.locked .teach-rail,
.teacher-view.locked .idle-actions,
.teacher-view.locked .end-exit,
.teacher-view.locked .ask-lesson,
.teacher-view.locked .ss-nav,
.teacher-view.locked .ss-see-slot,
.teacher-view.locked .ss-questions,
.teacher-view.locked .back-to-slides,
.teacher-view.locked .aac-pane { pointer-events: none; opacity: 0.45; }
.groups-list .segmented { margin-left: auto; }
.groups-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.share-link-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-link { color: var(--blue-dark); overflow-wrap: anywhere; font-size: 14px; }
.delete-class { align-self: flex-start; margin-top: 8px; }

/* ---------- Who needs help ---------- */

.tab-panel[data-panel="summary"] { padding: 4px 12px 0; }
.summary-section { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.summary-section h3 { margin: 0; }
.summary-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.summary-student { background: var(--warm-white); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow-s); }
.summary-student.needs-help { border-color: #f2d46a; background: #fffbea; }
.summary-student-head { display: flex; justify-content: space-between; gap: 10px; }
.summary-name { font-weight: 800; }
.summary-missed summary { cursor: pointer; color: var(--blue-dark); font-size: 14px; font-weight: 600; margin-top: 4px; }
.summary-missed ul { margin: 6px 0 0; padding-left: 18px; }
.summary-question { font-weight: 700; }
.reteach-item { background: var(--warm-white); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow-s); }

/* ---------- Lesson editor ---------- */

.lesson-editor { display: flex; flex-direction: column; gap: 14px; padding: 0 12px 24px; }
.lesson-editor .view-header { padding-left: 0; padding-right: 0; }
.lesson-editor .view-header .save-lesson { margin-left: auto; }

.editor-field input, .editor-field textarea, .planned-text { font: inherit; font-weight: 500; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; }
.pdf-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: -4px; }

.planned-questions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.planned-question { background: var(--warm-white); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-s); }
.planned-head { display: flex; gap: 8px; align-items: center; }
.planned-number { font-weight: 800; color: var(--muted); width: 22px; }
.planned-text { flex: 1; min-width: 0; }
.planned-tools { display: flex; }
.planned-tools .link-button { color: var(--muted); font-size: 16px; }
.planned-tools .link-button:disabled { opacity: 0.3; background: none; }
.planned-answers { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.planned-answers:empty { display: none; }
/* Block, not grid: a grid row works out its height before the card's
   aspect-ratio, so the card spilled onto the "Add a card" row below. The
   margin keeps the corner buttons (they sit 6px outside the card) clear. */
.planned-answers:not(:empty) { margin-bottom: 6px; }
.planned-answer { position: relative; display: block; }
.planned-answer .answer-card { width: 100%; }
.planned-answer .answer-card .emoji { font-size: 34px; }
.planned-answer .answer-card .label { font-size: 14px; }
.remove-answer {
  position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; padding: 0;
  border-radius: 999px; background: var(--warm-white); color: var(--red); border: 1px solid var(--line);
  font-size: 16px; font-weight: 800; display: grid; place-items: center; box-shadow: var(--shadow-s);
}
.remove-answer:hover { background: #fff3f4; }
.planned-answer-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.add-answer { display: flex; gap: 6px; }
.add-answer input { padding: 6px 10px; border: 2px solid var(--line); border-radius: 10px; font: inherit; }

/* ---------- A child's screen ---------- */

/* The question: a big heading, not a box that looks like a text field. */
.student-question { flex: none; background: none; border: none; box-shadow: none; padding: 8px 0 4px; }
.student-question .question-text { font-size: 30px; font-weight: 800; line-height: 1.25; -webkit-line-clamp: 6; letter-spacing: -0.01em; }
.student-question.math .question-text { font-size: 44px; font-weight: 900; text-align: center; }

.mascot-halo {
  width: 190px;
  height: 190px;
  margin-top: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #ffffff 0%, #ffffff 52%, rgba(255, 255, 255, 0) 71%);
}
.mascot-halo .mascot { width: 128px; }
.waiting .prompt { font-size: 24px; }

/* Cards: larger by default, and a few fill the screen. */
.class-view:not(.teacher-view) > .answer-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.class-view:not(.teacher-view) > .answer-grid .emoji { font-size: 58px; }
.class-view:not(.teacher-view) > .answer-grid .label { font-size: 20px; }
.class-view:not(.teacher-view) > .answer-grid.few { grid-template-columns: repeat(var(--count, 2), minmax(0, 300px)); justify-content: center; }
.class-view:not(.teacher-view) > .answer-grid.few .emoji { font-size: 110px; }
.class-view:not(.teacher-view) > .answer-grid.few .label { font-size: 30px; }
.class-view:not(.teacher-view) > .pick-status { font-size: 18px; text-align: center; }

/* A tap answers back with a small, soft bounce. */
.answer-card.just-picked { animation: pick-pop 0.32s var(--spring); }
/* The right answer gets a star once it's shown: good news, never a red X. */
.class-view:not(.teacher-view) .answer-card.outcome-right::after {
  content: "⭐";
  position: absolute;
  top: -16px;
  right: -12px;
  font-size: 36px;
  filter: drop-shadow(0 2px 3px rgba(120, 80, 0, 0.3));
  animation: star-in 0.5s var(--spring) both;
}
.class-view > .pick-status:empty { display: none; }
.class-view > .pick-status.revealed {
  align-self: center;
  margin: 4px 12px 0;
  padding: 10px 24px;
  border-radius: 999px;
  background: var(--sun-soft);
  border: 1px solid #f3dc8a;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  box-shadow: var(--shadow-s);
}

/* ---------- Motion ---------- */

@keyframes pulse { 50% { opacity: 0.6; } }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(41, 212, 20, 0.45); } 70%, 100% { box-shadow: 0 0 0 7px rgba(41, 212, 20, 0); } }
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes pick-pop { 0% { transform: scale(1); } 45% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes star-in { from { opacity: 0; transform: scale(0.3) rotate(-30deg); } to { opacity: 1; transform: none; } }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
.bob { animation: bob 1.6s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Fill in the blank ---------- */

.blank-gap {
  display: inline-block;
  min-width: 3.2em;
  margin: 0 0.15em;
  padding: 0 0.25em;
  border-bottom: 3px solid var(--blue);
  border-radius: 4px 4px 0 0;
  background: var(--blue-soft);
  line-height: 1.1;
  text-align: center;
}
.blank-gap.filled { color: #2e7d32; background: #e7f6e8; border-bottom-color: #43a047; }

/* ---------- Quick questions ---------- */

.quick-timer { display: inline-block; margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--blue-dark); font-variant-numeric: tabular-nums; }
.quick-timer.done { color: #2e7d32; }

/* ---------- Shuffled cards ---------- */

.students-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; }
.students-head h3 { margin: 0; font-size: 16px; }
.card-settings { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.shuffle-setting { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.student-list .student-settings { margin-left: auto; gap: 6px; align-items: flex-end; }
.student-list .student-settings .choices-slot { margin-left: 0; }
.summary-student.habit { border-color: var(--blue-line); background: var(--blue-soft); }

/* ---------- Written summary ---------- */

.summary-written { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-s); margin-bottom: 16px; }
.summary-written-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.summary-written-head h3 { margin: 0; }
.summary-written-part h4 { margin: 10px 0 2px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.summary-written-part p { margin: 2px 0; }

/* ---------- Summary tab: built to skim ---------- */

.tab-panel[data-panel="summary"] .summary-note { display: none; }
.summary-body { display: flex; flex-direction: column; gap: 18px; margin-top: 12px; }
.sum-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sum-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.sum-empty { text-align: center; padding: 32px 16px; background: var(--paper); border: 2px dashed var(--line); border-radius: var(--radius); }
.sum-empty p { margin: 2px 0; }
.sum-empty-title { font-weight: 800; font-size: 18px; }

.sum-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.sum-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--warm-white); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-s); }
.sum-tile-value { font-size: 30px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.sum-tile-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.sum-tile.good .sum-tile-value { color: #2e7d32; }
.sum-tile.mid .sum-tile-value { color: #b7791f; }
.sum-tile.low .sum-tile-value { color: #c62828; }

.sum-chip { padding: 5px 12px; border-radius: 999px; background: var(--blue-soft); border: 1px solid var(--blue-line); font-size: 14px; font-weight: 700; color: var(--blue-dark); }

@media (max-width: 520px) {
  .sum-tile-value { font-size: 24px; }

}

/* ---------- Worksheets ---------- */

.worksheet-view { display: flex; flex-direction: column; gap: 16px; padding-bottom: 32px; }
.ws-drop { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 18px; background: var(--paper); border: 2px dashed var(--blue-line); border-radius: var(--radius-l); }
.ws-drop p { margin: 0; }
.ws-drop-title { font-size: 20px; font-weight: 800; }
.ws-choose { font-size: 17px; padding: 12px 24px; margin-top: 6px; }
.ws-status { min-height: 1.2em; font-weight: 600; }
.ws-result { display: flex; flex-direction: column; gap: 12px; }

.ws-passage-text { white-space: pre-wrap; margin: 8px 0 0; }

.ws-item-note { font-size: 14px; font-weight: 600; color: #8a6d12; }

/* ---------- Worksheet storyboard ---------- */

.ws-story { display: flex; flex-direction: column; gap: 10px; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-s); }

.ws-story-status:empty { display: none; }
.ws-story-figure { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ws-story-img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); }
.ws-story-captions { list-style: none; counter-reset: panel; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr)); gap: 8px; }
.ws-story-captions li { counter-increment: panel; font-size: 15px; font-weight: 700; line-height: 1.3; background: var(--paper); border-radius: 10px; padding: 8px 10px; }
.ws-story-captions li::before { content: counter(panel); display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; background: var(--blue-soft); color: var(--blue-dark); font-size: 12px; font-weight: 800; }
a.button-link { display: inline-flex; align-items: center; align-self: flex-start; text-decoration: none; border-radius: 12px; padding: 6px 14px; font-weight: 700; font-size: 14px; }
a.button-link.secondary { background: var(--warm-white); color: var(--blue-dark); border: 2px solid var(--blue-line); }
@media (max-width: 520px) {
  .ws-story-captions { grid-template-columns: 1fr; }
}

/* ---------- Worksheet library and pictures ---------- */

.ws-title-input { flex: 1 1 240px; font-size: 20px; font-weight: 800; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); }

.ws-item-remove { margin-left: auto; color: var(--muted); }
.ws-item-picture { display: flex; align-items: flex-end; gap: 10px; }
.ws-item-picture img { max-width: 220px; max-height: 160px; border-radius: 10px; border: 1px solid var(--line); background: #fff; object-fit: contain; }

.ws-delete { align-self: flex-start; margin-top: 8px; }

/* A picture from a worksheet on a card, in place of the emoji. */
.answer-card .card-picture { width: 100%; max-width: 150px; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: #fff; }
.answer-grid.few .answer-card .card-picture { max-width: 220px; }

/* A question's own picture, above the cards. */
.question-picture { display: block; max-width: min(100%, 360px); max-height: 240px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: #fff; margin: 8px 0; }
.question-picture[hidden] { display: none; }
.student-question .question-picture { margin: 0 auto 10px; max-height: 280px; }
.planned-picture { display: flex; align-items: flex-end; gap: 10px; }
.planned-picture img { max-width: 200px; max-height: 140px; border-radius: 10px; border: 1px solid var(--line); object-fit: contain; }
.planned-picture[hidden] { display: none; }

/* ---------- Picture picker ---------- */

.card-picture-button { position: absolute; left: -6px; top: -6px; width: 30px; height: 30px; min-height: 0; padding: 0; display: grid; place-items: center; border-radius: 50%; font-size: 15px; background: var(--warm-white); color: var(--blue-dark); border: 2px solid var(--blue-line); box-shadow: var(--shadow-s); z-index: 2; }
.card-picture-button:hover { background: var(--blue-soft); }
.planned-answer { position: relative; }
/* A typed word's library pictures: one panel under the cards, for the card
   being chosen (outlined). Grouped by meaning; tap a picture to use it. */
.planned-answer.choosing .answer-card { box-shadow: 0 0 0 4px var(--blue-line), var(--shadow-s); }
.card-choices { display: grid; gap: 12px; margin-top: 12px; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.card-choices-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-choices-head h4 { margin: 0; font-size: 16px; font-weight: 800; color: var(--ink); }
.card-choices-close { width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 50%; background: var(--warm-white); border: 1px solid var(--line); color: var(--muted); font-size: 18px; line-height: 1; box-shadow: none; }
.card-choices-meaning { display: grid; gap: 6px; }
.card-choices-what { margin: 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.card-choices-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.card-choice { display: grid; grid-template-rows: 1fr auto; gap: 4px; justify-items: center; aspect-ratio: 5 / 6; width: 100%; min-height: 0; padding: 8px 6px 6px; border-radius: 14px; background: #fff; border: 2px solid var(--line); box-shadow: none; cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.card-choice img { width: 100%; height: 100%; min-height: 0; object-fit: contain; display: block; }
.card-choice-who { font-size: 13px; font-weight: 700; color: var(--ink); }
.card-choice:hover { border-color: var(--blue); transform: translateY(-1px); }
.card-choice.chosen { border-color: var(--blue-dark); box-shadow: 0 0 0 3px var(--blue-line); }
.card-choice:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.card-choices-more { justify-self: start; font-size: 14px; }
.picker-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(40, 30, 10, 0.35); display: grid; place-items: center; padding: 16px; }
.picker { width: min(760px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column; gap: 10px; background: var(--paper, #fffdf8); border-radius: var(--radius-l, 22px); padding: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.picker-head { display: flex; justify-content: space-between; align-items: center; }
.picker-head h3 { margin: 0; }
.picker-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.picker-search { flex: 1 1 200px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); font-size: 15px; }
.picker-status { margin: 0; }
.picker-status:empty { display: none; }
.picker-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; padding: 2px; }
.picker-tile { display: flex; flex-direction: column; gap: 2px; }
.picker-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; min-height: 0; background: var(--warm-white); color: var(--ink); border: 2px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-s); }
.picker-pick:hover { border-color: var(--blue); }
.picker-tile.current .picker-pick { border-color: #43a047; }
.picker-pick img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; }
.picker-label { font-size: 13px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-tile-tools { display: flex; justify-content: center; gap: 8px; font-size: 12px; }
.picker-tile-tools .link-button { font-size: 12px; padding: 0; min-height: 0; }
.picker-foot { display: flex; justify-content: flex-end; }
.planned-picture { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }

/* ---------- Image bank ---------- */

.image-bank { display: flex; flex-direction: column; gap: 14px; padding-bottom: 32px; }
.picture-browser { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.picker .picture-browser { overflow: hidden; }
.image-bank .picker-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); overflow: visible; }
.picker-pick { width: 100%; }
div.picker-pick { cursor: default; }
.picker-source { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-adjust-button { position: absolute; right: -6px; bottom: -6px; width: 30px; height: 30px; min-height: 0; padding: 0; display: grid; place-items: center; border-radius: 50%; font-size: 14px; background: var(--warm-white); color: var(--ink); border: 2px solid var(--blue-line); box-shadow: var(--shadow-s); z-index: 2; }
.card-adjust-button:hover { background: var(--blue-soft); }

/* ---------- Word problems as things to count ---------- */

.math-slot[hidden] { display: none; }
.math-scene { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; padding: 12px; margin: 8px 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.math-group { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 10px; background: var(--paper); border: 2px dashed var(--blue-line); border-radius: 14px; }
.math-group-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.math-sign { font-size: 34px; font-weight: 900; color: var(--blue-dark); }
.count-pictures { display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.15; }
.count-row { font-size: 26px; letter-spacing: 2px; white-space: nowrap; }
.count-pictures .taken { position: relative; opacity: 0.35; }
.count-pictures .taken::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; color: #d32f2f; font-weight: 900; opacity: 1; }
.answer-card .count-pictures .count-row { font-size: 15px; letter-spacing: 1px; }
.student-question .math-scene { margin: 4px auto 10px; }
.student-question .count-row { font-size: 34px; }
.class-view:not(.teacher-view) > .answer-grid .answer-card .count-pictures .count-row { font-size: 20px; }

/* ---------- A worksheet opened from a lesson ---------- */

.questions-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.questions-head h3 { margin: 0; }
.worksheet-status:empty { display: none; }
.ws-layer { position: fixed; inset: 0; z-index: 90; overflow-y: auto; background: var(--cream); padding: 16px 12px; }
.ws-layer .page { max-width: min(1600px, 100%); margin: 0 auto; }
body.ws-layer-open { overflow: hidden; }

.picker .ws-choices { overflow-y: auto; }

/* ---------- Books ---------- */

.bk-author { flex: 0 1 200px; font-size: 15px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); }

.bk-things { display: flex; flex-wrap: wrap; gap: 4px; }
.bk-thing { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 2px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.bk-thing img { width: 24px; height: 24px; object-fit: contain; border-radius: 50%; }
.bk-progress { width: min(360px, 100%); }

/* ======================================================================
   Calmer teacher screens: one main action per screen, one list of
   material, controls shown when they're needed.
   ====================================================================== */

.icon-wrap { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon { display: block; }

/* ---------- Home: Teach ---------- */

.class-row { display: flex; align-items: center; gap: 10px; }
.class-row > .class-item { flex: 1; min-width: 0; }
.class-start { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 10px 18px; font-size: 15px; }
.home-section .section-head .link-button { font-size: 14px; }

/* ---------- Home: Prepare ---------- */

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 260px; display: flex; flex-direction: column; padding: 6px; background: var(--warm-white); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-l); }
.menu[hidden] { display: none; }
.menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 10px 12px; min-height: 0; background: none; color: var(--ink); border: 0; border-radius: 10px; box-shadow: none; }
.menu button:hover, .menu button:focus-visible { background: var(--blue-soft); }
.menu-title { font-weight: 800; font-size: 15px; }
.menu-sub { font-size: 13px; color: var(--muted); font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.chip { padding: 5px 12px; min-height: 0; font-size: 14px; font-weight: 700; background: var(--warm-white); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; box-shadow: none; }
.chip[aria-selected="true"] { background: var(--blue-soft); color: var(--blue-dark); border-color: var(--blue-line); }

.library-list { list-style: none; margin: 0; padding: 0; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-s); }
.library-list:empty { display: none; }
.library-list li + li { border-top: 1px solid var(--line); }
.library-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 0; background: none; color: var(--ink); border: 0; border-radius: 0; box-shadow: none; text-align: left; }
.library-row:hover { background: var(--paper); }
.library-row > .icon-wrap:first-child { color: var(--blue-dark); }
.library-row > .icon-wrap:last-child { color: var(--muted); }
.library-title { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-meta { flex: none; font-size: 13px; color: var(--muted); font-weight: 600; }
@media (max-width: 520px) {
  .library-row { flex-wrap: wrap; }
  .library-meta { order: 3; width: 100%; padding-left: 30px; }
}
.empty-state { text-align: center; padding: 28px 16px; background: var(--warm-white); border: 2px dashed var(--line); border-radius: var(--radius); }
.empty-state p { margin: 2px 0; }
.empty-title { font-weight: 800; font-size: 17px; }

.class-row > .class-item::after { content: none; }

/* ---------- Live class: a calmer ask bar ---------- */

.composer { gap: 8px; }
.composer-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.composer-chips .segmented.chip-group { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 0; background: none; box-shadow: none; }
.composer-chips .segmented.chip-group button { padding: 4px 12px; min-height: 30px; font-size: 13px; font-weight: 700; background: var(--warm-white); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; box-shadow: none; }
.composer-chips .segmented.chip-group button[aria-checked="true"] { background: var(--blue-soft); color: var(--blue-dark); border-color: var(--blue-line); }
.composer-chips .chip { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 4px 12px; font-size: 13px; }
.composer-chips .settings-toggle { padding: 4px 8px; }
.composer-chips .settings-toggle[aria-expanded="true"] { background: var(--blue-soft); color: var(--blue-dark); }
.composer .quick-menu { top: calc(100% + 6px); bottom: auto; left: 0; right: auto; min-width: 220px; z-index: 40; }
.composer-more { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; border-top: 1px solid var(--line); }
.composer-more[hidden] { display: none; }
.composer-more .mode-help { margin: 4px 0 0; font-size: 13px; }
.idle-actions button { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Lesson planner: compact questions ---------- */

.about-lesson { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow-s); }
.about-lesson summary { cursor: pointer; display: flex; flex-direction: column; gap: 1px; list-style: none; }
.about-lesson summary::-webkit-details-marker { display: none; }
.about-title { font-weight: 800; }
.about-title::after { content: " ▾"; color: var(--muted); font-weight: 400; }
.about-lesson[open] .about-title::after { content: " ▴"; }
.about-sub { font-size: 13px; color: var(--muted); }
.about-lesson textarea { width: 100%; box-sizing: border-box; margin-top: 10px; }
.about-lesson .pdf-row { margin-top: 8px; }
.pdf-status:empty, .worksheet-status:empty, .suggest-questions-status:empty { display: none; }
.planned-question.compact { padding: 0; }

.planned-done-row { display: flex; justify-content: flex-end; }
.add-menu-wrap { align-self: flex-start; }
.add-menu-wrap .add-questions { display: inline-flex; align-items: center; gap: 6px; }
.add-menu { left: 0; right: auto; top: calc(100% + 6px); }
.lesson-editor .delete-lesson { align-self: flex-start; color: var(--muted); margin-top: 12px; }

/* ---------- Review screens: steps and one main action ---------- */

.steps { list-style: none; counter-reset: step; display: flex; gap: 6px; margin: 0; padding: 0; }
.steps li { counter-increment: step; display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; font-size: 13px; font-weight: 700; color: var(--muted); background: var(--warm-white); border: 1px solid var(--line); border-radius: 999px; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #f4ead6; color: var(--muted); font-size: 12px; }
.steps li.current { color: var(--blue-dark); border-color: var(--blue-line); background: var(--blue-soft); }
.steps li.current::before { background: var(--blue); color: #fff; }
.steps li.done::before { content: "✓"; background: #43a047; color: #fff; }

.ws-story { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow-s); }
.ws-story summary { cursor: pointer; display: flex; flex-direction: column; gap: 1px; list-style: none; }
.ws-story .ws-make-story { align-self: flex-start; margin-top: 8px; }

.bk-section summary::-webkit-details-marker, .ws-story summary::-webkit-details-marker { display: none; }
.bk-section[open] .about-title::after, .ws-story[open] .about-title::after { content: " ▴"; }
.worksheet-view .ws-delete, .book-view .bk-delete { align-self: flex-start; color: var(--muted); }
.worksheet-view .ws-drop-title { font-size: 20px; }
.home-section .section-head .link-button { color: var(--blue-dark); font-weight: 700; }
/* One strong button per area: Start is quiet; a class with a question on is not. */
.class-start { background: var(--warm-white); color: var(--blue-dark); border: 2px solid var(--blue-line); box-shadow: var(--shadow-s); }
.class-start.live { background: linear-gradient(180deg, #5a9de5 0%, var(--blue) 100%); color: #fff; border: 0; }

/* ======================================================================
   Inviting look: a sunny welcome, colour that means something (lessons
   blue, books coral, worksheets green, pictures violet), softer buttons
   and roomier cards. The children's answer cards keep their own look.
   ====================================================================== */

:root {
  --coral: #e8704f;
  --coral-dark: #c4553a;
  --coral-soft: #fdebe4;
  --teal-dark: #1f7f5c;
  --teal-soft: #e2f5ec;
  --violet-dark: #6f43a8;
  --violet-soft: #f1e9fb;
  --sun-dark: #a87a00;
  --shadow-s: 0 1px 2px rgba(92, 64, 20, 0.05), 0 3px 10px rgba(92, 64, 20, 0.06);
}

/* Softer buttons: flat colour, a gentle lift, no heavy 3D edge. */
button {
  background: var(--blue);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(47, 111, 184, 0.22), 0 4px 12px rgba(47, 111, 184, 0.16);
}
button:hover { background: #3d83d2; }
button:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(47, 111, 184, 0.22); }
button.secondary { border-width: 1.5px; box-shadow: 0 1px 2px rgba(92, 64, 20, 0.05); }

/* ---------- The welcome ---------- */

.home-header { padding: 30px 16px 8px; gap: 16px; }
.mascot-sun {
  flex: none;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #fff8dc 0%, #ffe9a8 58%, #ffd978 100%);
  box-shadow: 0 0 0 8px rgba(255, 217, 120, 0.22), 0 10px 24px rgba(214, 160, 30, 0.2);
}
.mascot-sun .home-mascot { width: 72px; height: 72px; padding: 0; background: none; box-shadow: none; border-radius: 0; }
.home-greeting h1 { font-size: 28px; letter-spacing: -0.02em; }
.home-greeting .hint { font-size: 15px; margin-top: 4px; max-width: 34ch; }

/* ---------- Sign in: who's here ---------- */

.role-question { font-size: 21px; font-weight: 800; margin: 22px 0 12px; }
.role-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.role-card { padding: 20px; border-radius: 20px; }
.role-icon { width: 58px; height: 58px; border-radius: 18px; color: var(--sun-dark); }
.role-card[data-role="student"] .role-icon { color: var(--green-dark); }
.role-sub { grid-column: 2; font-size: 14px; color: var(--muted); font-weight: 500; }
.role-card:hover .role-name { color: var(--blue-dark); }

/* ---------- Sections ---------- */

#signed-in .section-head { margin-top: 28px; margin-bottom: 10px; }
#signed-in .section-head h2 { font-size: 21px; letter-spacing: -0.01em; }

/* ---------- Classes as cards ---------- */

#class-list:not(.big) { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.class-row {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 10px 12px 10px 8px;
  box-shadow: var(--shadow-s);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.class-row:hover { border-color: var(--blue-line); box-shadow: var(--shadow); transform: translateY(-1px); }
.class-row > .class-item { background: none; border: 0; box-shadow: none; padding: 4px; }
.class-row > .class-item:hover { transform: none; box-shadow: none; }
.class-item { flex-wrap: nowrap; }
.class-avatar {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  font-size: 21px;
  font-weight: 900;
  color: var(--ink);
  background: color-mix(in srgb, var(--avatar, #478ddb) 26%, #fff);
  border: 2px solid color-mix(in srgb, var(--avatar, #478ddb) 55%, #fff);
}
.class-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.class-item-text .class-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-list.big .class-avatar { width: 60px; height: 60px; font-size: 28px; border-radius: 18px; }

/* ---------- Material, colour-coded ---------- */

.library-list { border-radius: 20px; }
.library-row { gap: 14px; padding: 12px 16px; }
.library-row > .icon-wrap:first-child { width: 42px; height: 42px; border-radius: 13px; background: var(--blue-soft); color: var(--blue-dark); }
.library-row[data-type="book"] > .icon-wrap:first-child { background: var(--coral-soft); color: var(--coral-dark); }
.library-row[data-type="slides"] > .icon-wrap:first-child { background: var(--green-soft); color: var(--green-dark); }
/* One row per lesson: a badge for a board, copies and actions beside it. */
.library-row > .library-text { flex: 1; min-width: 0; }
.library-badge { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; font-weight: 700; }
.library-list li.with-side { display: flex; align-items: center; }
.library-list li.with-side > .library-row { flex: 1; min-width: 0; }
.library-side { flex: none; margin-right: 14px; font-size: 13.5px; white-space: nowrap; }
/* With chips beside it, the row's arrow would sit between them: the row itself is the way in. */
.library-list li.with-side > .library-row > .icon-wrap:last-child { display: none; }
.library-list li.with-side > .library-side + .library-side { margin-left: -6px; }
.library-list li.library-section { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 16px 7px; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--paper); border-top: 1px solid var(--line); }
.library-list li.library-section:first-child { border-top: 0; }
.library-list li.library-section .section-count { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.library-list li.library-copy .library-row { padding-left: 38px; background: #fdfbf6; }
.library-list li.library-copy .library-title { font-weight: 600; font-size: 15px; }
.library-row[data-type="worksheet"] > .icon-wrap:first-child { background: var(--teal-soft); color: var(--teal-dark); }
.library-row[data-type="picture"] > .icon-wrap:first-child { background: var(--violet-soft); color: var(--violet-dark); }
.chip { padding: 6px 14px; font-size: 14px; }
.chip:hover { border-color: var(--blue-line); color: var(--blue-dark); }

.menu { border-radius: 16px; padding: 8px; }
.menu button { border-radius: 12px; }

.empty-state { padding: 26px 16px 22px; border-radius: 20px; border-style: dashed; }
.empty-mascot { width: 76px; height: 76px; object-fit: contain; margin-bottom: 6px; }

/* ---------- Class screen chrome ---------- */

.teacher-view .view-header .class-name { font-size: 22px; letter-spacing: -0.01em; }
.teacher-view .tabs { background: rgba(255, 255, 255, 0.6); border: 1px solid var(--line); }
.idle-stage { border-radius: 22px; }
.idle-title { font-size: 26px; }

/* ---------- Planner and review: the same friendly cards ---------- */

.planned-question, .ws-item, .bk-section, .about-lesson, .ws-story, .ws-passage { border-radius: 18px; }

.steps li { padding: 5px 14px 5px 5px; }
.library-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.library-text .library-title { flex: none; }
.library-row { flex-wrap: nowrap; }
@media (max-width: 520px) {
  .library-row { flex-wrap: nowrap; }
  .library-meta { order: 0; width: auto; padding-left: 0; }
}
.class-item-text .live-badge { align-self: flex-start; margin: 2px 0 0; }

/* ======================================================================
   Side panel: a quick look without leaving the page. From the right on
   wider screens, a sheet from the bottom on a phone.
   ====================================================================== */

.sp-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(43, 42, 51, 0); transition: background 0.2s ease; }
.sp-scrim.shown { background: rgba(43, 42, 51, 0.28); }
.sp-panel {
  position: fixed; z-index: 81; top: 0; right: 0; bottom: 0;
  width: min(480px, 100%);
  display: flex; flex-direction: column;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 48px rgba(92, 64, 20, 0.16);
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sp-panel.wide { width: min(640px, 100%); }
.sp-panel.shown { transform: none; }
body.sp-open { overflow: hidden; }
.sp-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.sp-titles { flex: 1; min-width: 0; }
.sp-title { margin: 0; font-size: 21px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.sp-subtitle { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.sp-close { flex: none; width: 38px; height: 38px; padding: 0; min-height: 0; border-radius: 12px; background: var(--warm-white); color: var(--ink); border: 1px solid var(--line); box-shadow: none; font-size: 16px; }
.sp-close:hover { background: var(--blue-soft); }
.sp-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 12px; }
/* Long lists in a panel scroll with it, rather than being squeezed and cut. */
.sp-body > * { flex-shrink: 0; }
.sp-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--warm-white); }
.sp-actions .sp-left { margin-right: auto; }
.sp-actions button { display: inline-flex; align-items: center; gap: 6px; }
.sp-actions .button-link { display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; text-decoration: none; }
.sp-actions .sp-primary-link { background: var(--blue); color: #fff; }
@media (max-width: 640px) {
  .sp-panel, .sp-panel.wide { top: auto; left: 0; width: 100%; max-height: 88vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; box-shadow: 0 -18px 48px rgba(92, 64, 20, 0.16); transform: translateY(100%); }
  .sp-panel.shown { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-panel, .sp-scrim { transition: none; }
}

/* ---------- What's inside the previews ---------- */

.pv-questions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pv-question { background: var(--warm-white); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.pv-question-head { display: flex; align-items: center; gap: 8px; }
.pv-num { font-size: 12px; font-weight: 800; color: var(--blue-dark); background: var(--blue-soft); border-radius: 8px; padding: 2px 8px; }
.pv-meta { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.pv-text { margin: 0; font-weight: 800; font-size: 16px; overflow-wrap: anywhere; }
.pv-picture { max-width: 180px; max-height: 130px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.pv-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-card { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.pv-card img { width: 22px; height: 22px; object-fit: contain; border-radius: 6px; }
.pv-card.right { background: #e7f6e8; border-color: #b9e3bc; color: #2e7d32; }
.pv-note { margin: 0; font-size: 13px; color: var(--muted); }
.pv-about { background: var(--warm-white); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.pv-heading { margin: 4px 0 0; font-size: 16px; }
.pv-cover-row { display: flex; gap: 14px; align-items: center; }
.pv-cover { width: 120px; border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow-s); background: #fff; }
.pv-facts p { margin: 2px 0; font-weight: 700; }
.pv-words { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-word { padding: 4px 10px; border-radius: 999px; background: var(--coral-soft); color: var(--coral-dark); font-weight: 700; font-size: 13px; }
.pv-word.core { background: var(--blue-soft); color: var(--blue-dark); }
.pv-storyboard { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.pv-flag { margin: 0; padding: 8px 12px; border-radius: 12px; background: #fff8e1; color: #8a6d12; font-weight: 700; font-size: 14px; }
.pv-classes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pv-class { width: 100%; text-align: left; background: var(--warm-white); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.pv-class:hover { background: var(--blue-soft); }
.pv-file { width: 100%; min-height: 60vh; border: 1px solid var(--line); border-radius: 12px; background: var(--warm-white); }
img.pv-file { min-height: 0; }
.sp-body .picture-browser .picker-grid { overflow: visible; }

/* Tabs in Prepare, with counts. */
.chip-count { margin-left: 6px; padding: 0 7px; border-radius: 999px; background: rgba(47, 111, 184, 0.1); font-size: 12px; }
.library-row[data-type="file"] > .icon-wrap:first-child { background: #f4f1ea; color: var(--muted); }

/* ======================================================================
   Class: the ask bar on top, the class in the middle, lessons beside it.
   ====================================================================== */

.teach-panel { gap: 12px; }
.teach-panel > .composer { position: static; margin: 4px 12px 0; box-shadow: var(--shadow); }
.teach-panel > .composer .quick-menu { top: calc(100% + 6px); bottom: auto; }
.teach-panel > .live-status, .teach-panel > .live-error { margin: 0 12px; }
.teach-panel > .live-error:empty { display: none; }

.teach-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 0 12px; }
.teach-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.teach-main .roster-head { margin: 4px 0 0; }
@media (min-width: 900px) {
  .teach-layout { grid-template-columns: minmax(0, 1fr) clamp(330px, 24vw, 420px); align-items: start; }

}

.side-label { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.side-lesson { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 0; text-align: left; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: none; }
.side-lesson:hover { background: var(--blue-soft); border-color: var(--blue-line); }
.side-lesson > .icon-wrap { color: var(--blue-dark); }
.side-lesson-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.side-lesson-title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-lesson-meta { font-size: 13px; color: var(--muted); }
.teach-main .idle-stage { padding: 20px; }
.teach-main .idle-title { font-size: 22px; }

/* ======================================================================
   Book review as a reader: pages on the left, the open page and where to
   stop on it on the right. On a phone the pages become a strip.
   ====================================================================== */

.reader { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 860px) {
  .reader { grid-template-columns: 260px minmax(0, 1fr); align-items: start; }

}

.stop-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--paper); border: 1px solid #f5c9bb; border-left: 4px solid var(--coral); border-radius: 14px; }
.stop-card.off { opacity: 0.55; border-left-color: #d9d2c4; }
.stop-head { display: flex; align-items: center; gap: 8px; }
.stop-use { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stop-use input { width: 18px; height: 18px; margin: 0; }
.stop-head .remove { margin-left: auto; }
.stop-text { font-size: 17px; font-weight: 800; }
.stop-cards { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }

.rp-add { display: flex; gap: 8px; }
.rp-add input { flex: 1; }

/* ======================================================================
   Books and worksheets, round 3: a header with the title and the two
   actions, then tabs -- one thing at a time. Details open in the side panel.
   ====================================================================== */

/* The side panel sits above a book or worksheet opened from a lesson. */
.sp-scrim { z-index: 94; }
.sp-panel { z-index: 95; }

.doc-view { display: flex; flex-direction: column; gap: 14px; padding-bottom: 40px; }
.doc-header { display: flex; align-items: center; gap: 12px; padding: 14px 12px 4px; flex-wrap: wrap; }
.doc-titles { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-heading { margin: 0; font-size: 24px; }
.doc-title { width: 100%; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; padding: 4px 8px; margin-left: -8px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ink); }
.doc-sub { width: 100%; font-size: 15px; padding: 2px 8px; margin-left: -8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); }
.doc-title:hover, .doc-sub:hover { border-color: var(--line); }
.doc-title:focus, .doc-sub:focus { border-color: var(--blue-line); background: var(--warm-white); outline: none; }
.doc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-status { font-size: 13px; color: var(--muted); font-weight: 600; }
.doc-view > .ws-drop { margin: 0 12px; }
.doc-view .bk-result, .doc-view .ws-result { display: flex; flex-direction: column; gap: 14px; padding: 0 12px; }
.doc-view .bk-result[hidden], .doc-view .ws-result[hidden], .doc-view .ws-drop[hidden] { display: none; }

.doc-tabs { align-self: flex-start; max-width: 100%; overflow-x: auto; display: flex; gap: 2px; padding: 4px; border-radius: 14px; background: var(--cream-deep); box-shadow: inset 0 1px 2px rgba(92, 64, 20, 0.08); }
.doc-tab { display: inline-flex; align-items: center; gap: 6px; background: none; color: var(--muted); border-radius: 11px; padding: 8px 16px; font-size: 15px; white-space: nowrap; box-shadow: none; min-height: 0; }
.doc-tab[hidden] { display: none; }
.doc-tab:hover { background: rgba(255, 255, 255, 0.55); }
.doc-tab:active { transform: none; box-shadow: none; }
.doc-tab[aria-selected="true"] { color: var(--ink); background: var(--warm-white); box-shadow: var(--shadow-s); }
.tab-count { font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: rgba(0, 0, 0, 0.06); }
.tab-count:empty { display: none; }
.doc-panel { display: flex; flex-direction: column; gap: 12px; }
.doc-panel[hidden] { display: none; }
.doc-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bk-plan-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bk-more { display: inline-flex; align-items: center; gap: 6px; }
.doc-tip { margin: 0; color: var(--muted); font-size: 15px; }
.doc-empty { list-style: none; color: var(--muted); padding: 24px; text-align: center; background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Stops: one card each, the page on the left. */
.stop-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.doc-view .stop-card, .sp-body .stop-card { flex-direction: row; align-items: flex-start; gap: 14px; padding: 14px; background: var(--warm-white); border: 1px solid var(--line); border-left: 4px solid var(--coral); border-radius: var(--radius); box-shadow: var(--shadow-s); }
.sp-body .stop-card { background: var(--paper); box-shadow: none; }
.stop-card.off { opacity: 0.55; border-left-color: #d9d2c4; }
.stop-thumb { flex: none; width: 116px; display: flex; flex-direction: column; gap: 4px; padding: 0; min-height: 0; background: none; border: 0; box-shadow: none; color: var(--coral-dark); cursor: pointer; }
.stop-thumb img { width: 116px; height: 88px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); }
.stop-thumb:hover img { border-color: var(--coral); }
.stop-thumb-label { font-size: 12px; font-weight: 800; }
.stop-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.stop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stop-use { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.stop-use input { width: 20px; height: 20px; margin: 0; accent-color: var(--coral); }
.stop-kind { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--coral-dark); background: var(--coral-soft); padding: 2px 9px; border-radius: 999px; }
.stop-head .remove { color: var(--muted); font-size: 14px; }
.stop-text { width: 100%; font-size: 18px; font-weight: 700; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; background: var(--paper); resize: vertical; font-family: inherit; color: var(--ink); }
.stop-text:focus { border-color: var(--blue-line); background: var(--warm-white); outline: none; }
.stop-note { margin: 0; font-size: 13px; color: var(--muted); }
.stop-cards { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.stop-cards .answer-card { min-height: 0; padding: 8px 6px; }
.stop-cards .answer-card .emoji { font-size: 30px; }
.stop-cards .answer-card .card-picture { max-width: 64px; }
.stop-cards .answer-card .label { font-size: 14px; }
@media (max-width: 560px) {
  .doc-view .stop-card { flex-direction: column; }
  .stop-thumb { width: 100%; flex-direction: row; align-items: center; }
  .stop-thumb img { width: 64px; height: 48px; }
}

/* Pages: the book as a grid of pages. */
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.page-tile { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 8px; min-height: 0; text-align: left; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); cursor: pointer; font-weight: 400; }
.page-tile:hover { border-color: var(--coral); transform: translateY(-1px); box-shadow: var(--shadow); }
.page-tile.muted { opacity: 0.6; }
.page-tile-image { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--paper); }
.page-tile-image img { width: 100%; height: 100%; object-fit: cover; }
.page-tile-stop { position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 800; color: #fff; background: var(--coral); padding: 2px 8px; border-radius: 999px; box-shadow: var(--shadow-s); }
.page-tile-number { font-size: 12px; font-weight: 800; color: var(--coral-dark); margin-top: 2px; }
.page-tile-text { font-size: 13px; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* A page in the side panel. */
.pp-image { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.pp-text { margin: 0; font-size: 18px; line-height: 1.45; font-weight: 600; }
.pp-picture { margin: 0; font-size: 14px; color: var(--muted); font-style: italic; }
.pp-stops-title { margin: 6px 0 0; font-size: 15px; font-weight: 800; }
.sp-body .rp-add { display: flex; gap: 8px; }
.sp-body .rp-add input { flex: 1; min-width: 0; }

/* Words. */
.word-group { display: flex; flex-direction: column; gap: 8px; }
.word-group[hidden] { display: none; }
.word-group h3 { margin: 0; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.word-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.word-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.word-tiles:empty::before { content: "None yet."; color: var(--muted); font-size: 14px; }
.bk-word-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 8px 10px; border-radius: 14px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.bk-word-picture { width: 100%; aspect-ratio: 1; min-height: 0; padding: 4px; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: var(--paper); border: 2px dashed var(--line); box-shadow: none; color: var(--blue-dark); }
.bk-word-picture:hover { border-color: var(--blue); background: var(--blue-soft); }
.bk-word-picture img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; min-width: 0; min-height: 0; }
.bk-picture-actions { display: flex; justify-content: center; gap: 2px; }
.bk-picture-actions .link-button { padding: 2px 6px; min-height: 0; font-size: 12px; }
.bk-word-emoji { font-size: 44px; }
.bk-word-none { font-size: 13px; font-weight: 700; }
.bk-word-name { font-weight: 800; font-size: 15px; text-align: center; }
.bk-word-from { font-size: 11px; color: var(--muted); min-height: 14px; }
.bk-word-remove { position: absolute; top: 2px; right: 2px; min-height: 0; padding: 0 6px; font-size: 16px; }
.character-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.character-cards:empty::before { content: "None yet."; color: var(--muted); font-size: 14px; }
.bk-character { position: relative; display: flex; gap: 12px; padding: 10px; border-radius: 14px; background: var(--warm-white); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.bk-character-side { flex: 0 0 116px; display: flex; flex-direction: column; gap: 4px; }
.bk-character-picture { width: 116px; height: 116px; }
.bk-character-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding-right: 18px; }
.bk-character-fields input, .bk-character-fields textarea { font: inherit; border: 1px solid transparent; border-radius: 8px; padding: 3px 6px; background: transparent; width: 100%; box-sizing: border-box; }
.bk-character-fields input:hover, .bk-character-fields textarea:hover, .bk-character-fields input:focus, .bk-character-fields textarea:focus { border-color: var(--blue-line); background: var(--paper); }
.bk-character-name { font-weight: 800; font-size: 17px; }
.bk-character-what { font-size: 13px; color: var(--muted); }
.bk-character-description { font-size: 13px; resize: vertical; min-height: 38px; }
.character-add, .word-add { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.word-add select { font: inherit; font-size: 14px; border-radius: 10px; border: 1px solid var(--line); padding: 4px 6px; }
.bk-choose-title { margin: 14px 0 6px; font-size: 15px; }
.bk-choose-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.bk-choose-grid.pages { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.bk-choose-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 0; padding: 6px; border-radius: 12px; background: var(--warm-white); color: var(--ink); border: 2px solid var(--line); box-shadow: none; font-size: 12px; font-weight: 700; }
.bk-choose-pick:hover { border-color: var(--blue); background: var(--blue-soft); }
.bk-choose-pick.current { border-color: #43a047; }
.bk-choose-pick img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: var(--paper); }
.bk-choose-grid.pages .bk-choose-pick img { aspect-ratio: 3 / 4; object-fit: cover; }
.word-chips:empty::before { content: "None yet."; color: var(--muted); font-size: 14px; }

.word-add { display: flex; gap: 8px; max-width: 520px; }
.word-add input { flex: 1; min-width: 0; }

/* Worksheet questions: one card each; tap to open. */
.q-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.q-item { display: flex; align-items: stretch; gap: 0; background: var(--warm-white); border: 1px solid var(--line); border-left: 4px solid var(--teal-dark); border-radius: var(--radius); box-shadow: var(--shadow-s); overflow: hidden; }
.q-item.flagged { border-left-color: var(--sun); background: #fffdf2; }
.q-item.off { opacity: 0.55; }
.q-use { flex: none; width: 22px; height: 22px; margin: 18px 4px 0 14px; accent-color: var(--teal-dark); }
.q-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 10px; min-height: 0; text-align: left; background: none; color: var(--ink); border: 0; border-radius: 0; box-shadow: none; font-weight: 400; cursor: pointer; }
.q-open:hover { background: var(--paper); }
.q-open:active { transform: none; }
.q-thumb { flex: none; width: 72px; height: 72px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.q-thumb.blank { display: grid; place-items: center; font-size: 22px; font-weight: 800; color: var(--teal-dark); background: var(--teal-soft); border-color: transparent; }
.q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.q-meta { display: flex; align-items: center; gap: 8px; }
.q-number { font-size: 12px; font-weight: 800; color: var(--teal-dark); text-transform: uppercase; letter-spacing: 0.04em; }
.q-flag { font-size: 11px; font-weight: 800; color: #8a6d12; background: var(--sun-soft); padding: 1px 8px; border-radius: 999px; }
.q-text { font-size: 17px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.q-answers { display: flex; flex-wrap: wrap; gap: 6px; }
.q-answer { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 2px 10px 2px 4px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }
.q-answer:not(:has(img, span + span)) { padding-left: 10px; }
.q-answer img { width: 22px; height: 22px; object-fit: contain; border-radius: 50%; background: #fff; }
.q-answer.right { background: var(--green-soft); border-color: #b8e8ad; color: var(--green-dark); }
.q-answer.right::after { content: "✓"; font-weight: 900; }
.q-chevron { flex: none; font-size: 26px; color: #c9bda4; }
.q-open:hover .q-chevron { color: var(--teal-dark); }

.sp-body .ws-item-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--sun-soft); color: #8a6d12; font-weight: 700; font-size: 14px; }
.sp-body .ws-item-picture { flex-direction: column; align-items: flex-start; gap: 6px; }
.sp-body .ws-item-picture img { max-width: 100%; max-height: 240px; }
.ws-item-picture-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.sp-body .answer-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.sp-body .ws-item-remove { align-self: flex-start; margin: 8px 0 0; }
.ws-passage-text { margin: 0; white-space: pre-line; font-size: 17px; line-height: 1.5; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.ws-skipped-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.ws-more-status:empty { display: none; }
.ws-lesson-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.doc-view .bk-error:empty, .doc-view .ws-error:empty { display: none; }
.doc-view .ws-delete, .doc-view .bk-delete { align-self: flex-start; color: var(--muted); }

/* ======================================================================
   Class screen, round 3: less to read.
   ====================================================================== */
.teacher-view .connection-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.teacher-view .view-title { display: flex; align-items: center; gap: 10px; }
.teacher-view .view-title .connection { margin: 0; }
.asked-status { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.asked-status:empty { display: none; }
.status-chip { font-size: 12px; font-weight: 800; color: var(--blue-dark); background: var(--blue-soft); padding: 3px 10px; border-radius: 999px; letter-spacing: 0.02em; }
.question-hint:empty { display: none; }
/* A tick on the face of a child who has answered. */
.roster li .avatar { position: relative; }
.roster li[data-pick="answered"] .avatar::before { content: "✓"; position: absolute; right: -6px; top: -6px; width: 18px; height: 18px; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #fff; background: var(--green-dark); border: 2px solid #fff; border-radius: 50%; z-index: 1; }
.roster-pick:empty, .roster-choices:empty { display: none; }

/* Quick look: tap a question to see it in full; Expand for a closer look. */
.sp-expand { flex: none; width: 38px; height: 38px; padding: 0; min-height: 0; border-radius: 12px; background: var(--warm-white); color: var(--ink); border: 1px solid var(--line); box-shadow: none; font-size: 18px; }
.sp-expand:hover, .sp-expand[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue-line); }
.sp-panel.expanded { width: min(1100px, 100%); }
.pv-question { cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease; position: relative; padding-right: 36px; }
.pv-question:hover { border-color: var(--blue-line); }
.pv-question::after { content: "›"; position: absolute; right: 14px; top: 8px; font-size: 22px; color: #c9bda4; transition: transform 0.15s ease; }
.pv-question.open::after { transform: rotate(90deg); color: var(--blue); }
.pv-question.open { border-color: var(--blue-line); box-shadow: var(--shadow-s); }
.pv-question.open > .pv-cards, .pv-question.open > .pv-picture { display: none; }
.pv-full { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; cursor: default; }
.pv-full-picture { max-width: min(100%, 360px); max-height: 240px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.pv-full-cards { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.pv-full-cards .answer-card { cursor: default; }
.sp-panel.expanded .pv-questions { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); align-items: start; }
@media (max-width: 640px) { .sp-expand { display: none; } }

/* The lesson screen: the title and Teach at the top, questions as cards,
   one question open in the side panel. */
.lesson-editor.doc-view { gap: 10px; padding: 0 0 40px; }
.le-body { display: flex; flex-direction: column; gap: 14px; padding: 0 12px; }
.le-body .about-lesson { margin: 0; }
.teach-lesson { display: inline-flex; align-items: center; gap: 6px; }
.questions-head { margin-top: 4px; }
.questions-head[hidden] { display: none; }
.questions-head h3 { margin: 0; font-size: 18px; }
.le-status:empty { display: none; }
.lesson-q { border-left-color: var(--blue); }
.lesson-q.current { border-color: var(--blue-line); box-shadow: 0 0 0 2px var(--blue-line); }
.lesson-q .q-number { color: var(--blue-dark); }
.lesson-q .q-thumb.blank { color: var(--blue-dark); background: var(--blue-soft); }
.lesson-q .q-open > .icon-wrap { flex: none; color: #c9bda4; }
.lesson-q .q-open:hover > .icon-wrap { color: var(--blue); }
.q-note { font-size: 13px; color: var(--muted); font-style: italic; }

.planned-answer:has(.answer-why) { align-self: start; }
.planned-answers:has(.answer-why) .planned-answer { align-self: start; }

.hinge-form { display: flex; flex-direction: column; gap: 8px; }
.hinge-form textarea { width: 100%; }
/* The exit ticket: its own short list under the lesson's questions. */
.exit-section { margin-top: 22px; padding-top: 16px; border-top: 2px dashed var(--line); }
.exit-section[hidden] { display: none; }
.exit-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.exit-head h3 { margin: 0; font-size: 18px; }
.exit-sub { margin: 2px 0 0; }
.exit-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.exit-tools button { display: inline-flex; align-items: center; gap: 6px; }
.exit-q { border-left-color: var(--coral); }
.exit-q .q-number { color: var(--coral-dark); }
.exit-q .q-thumb.blank { color: var(--coral-dark); background: var(--coral-soft); }
.le-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 16px; background: var(--paper); border: 2px dashed var(--blue-line); border-radius: var(--radius-l); }
.le-empty[hidden] { display: none; }
.le-empty-title { margin: 0; font-size: 20px; font-weight: 800; }
.le-starts { width: 100%; max-width: 760px; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.le-start { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; min-height: 0; text-align: left; background: var(--warm-white); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); font-weight: 400; }
.le-start:hover { border-color: var(--blue-line); box-shadow: var(--shadow); transform: translateY(-1px); }
.le-start svg { color: var(--blue); margin-bottom: 4px; }
.le-start .menu-title { font-weight: 800; font-size: 16px; }
.le-start .menu-sub { font-size: 13px; color: var(--muted); }
.le-editor { display: flex; flex-direction: column; gap: 16px; }
.le-field { display: flex; flex-direction: column; gap: 8px; }
.le-label { margin: 0; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.le-editor .planned-picture { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.le-editor .planned-picture img { max-width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.le-editor .answer-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.le-editor .answers-hint:empty { display: none; }
.le-editor .answers-hint { margin: 0; }
.le-editor .planned-answer-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.le-editor .add-answer { display: flex; gap: 8px; flex: 1 1 220px; }
.le-editor .add-answer input { flex: 1; min-width: 0; }
.le-more summary { cursor: pointer; font-size: 14px; color: var(--muted); font-weight: 700; }
.le-more .grid-slot { margin-top: 8px; }
.sp-actions .icon-button { width: 40px; padding: 0; justify-content: center; }
.le-upload { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 14px; }
@media (max-width: 560px) {
  .doc-actions { width: 100%; justify-content: flex-end; }
  .sp-actions { flex-wrap: wrap; }
}

/* The header's title and author: plain text until tapped. Beats the general
   input style and the older book-screen rules. */
.doc-titles .doc-title, .doc-titles .doc-sub { flex: none; width: 100%; min-height: 0; margin-left: -10px; border: 1px solid transparent; background: transparent; box-shadow: none; }
.doc-titles .doc-title { font-size: 24px; font-weight: 800; padding: 4px 10px; border-radius: 10px; }
.doc-titles .doc-sub { font-size: 15px; padding: 2px 10px; border-radius: 8px; color: var(--muted); }
.doc-titles .doc-title:hover, .doc-titles .doc-sub:hover { border-color: var(--line); }
.doc-titles .doc-title:focus, .doc-titles .doc-sub:focus { border-color: var(--blue-line); background: var(--warm-white); outline: none; }
.sp-actions .icon-button { height: 40px; min-height: 40px; font-size: 17px; }

/* ======================================================================
   Teaching a lesson: one bar on top with its steps, one stage below
   (picture left, question and cards right), one row of actions.
   ====================================================================== */

/* A class uses the width of the screen. */
.page:has(> #view-class:not([hidden])) { max-width: 1280px; }
/* The teacher's screen uses the width it has; students' keep theirs. */
.page:has(> #view-class:not([hidden]) .teacher-view) { max-width: min(1800px, 100%); }

.teacher-view.in-lesson .teach-layout { grid-template-columns: minmax(0, 1fr); }
.teacher-view.in-lesson .composer:not(:focus-within) .composer-chips,
.teacher-view.in-lesson .composer:not(:focus-within) .composer-more { display: none; }

/* Up next: the stage when nothing is being asked. */
.teach-main .lesson-next { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: center; margin: 0; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); }
.teach-main .lesson-next:has(.ln-picture:not([hidden])) { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.ln-picture { width: 100%; max-height: 380px; object-fit: contain; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.ln-text { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.teach-main .lesson-next-label { font-size: 13px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--blue-dark); }
.teach-main .lesson-next-question { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.teach-main .ask-lesson { font-size: 18px; padding: 14px 28px; margin-top: 6px; }
/* Under a question that's being asked: a slim bar. */
.teach-main .lesson-next.slim { display: flex; align-items: center; padding: 10px 14px; box-shadow: none; background: var(--blue-soft); border-color: var(--blue-line); order: 0; }
.teach-main .lesson-next.slim .ln-text { flex: 1; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.teach-main .lesson-next.slim .lesson-next-question { flex: 1 1 240px; font-size: 17px; }
.teach-main .lesson-next.slim .ask-lesson { margin: 0; font-size: 15px; padding: 9px 18px; }
.teach-main .live-question { order: 1; }

.teach-main .no-question { order: 1; }
.teach-main .roster-head, .teach-main .roster { order: 3; }

/* The question: with a picture, picture on the left and the rest beside it. */
@media (min-width: 760px) {
  .live-question.has-picture { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: "top top" "pic text" "pic hint" "pic grid" "pic think" "res res"; column-gap: 22px; row-gap: 12px; align-items: start; }
  .live-question.has-picture .asked { display: contents; }
  .live-question.has-picture .asked-top { grid-area: top; }
  .live-question.has-picture .asked-text { grid-area: text; margin: 0; }
  .live-question.has-picture .question-picture { grid-area: pic; width: 100%; max-width: 100%; max-height: 420px; margin: 0; }
  .live-question.has-picture .math-slot { grid-area: hint; }
  .live-question.has-picture .question-hint { grid-area: hint; }
  .live-question.has-picture .answer-grid { grid-area: grid; padding-top: 0; }
  .live-question.has-picture .answer-pool { grid-area: think; }
  .live-question.has-picture .results { grid-area: res; }
}
.live-question .answer-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.live-question .answer-grid.few { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.live-question .answer-grid .answer-card { min-height: 0; aspect-ratio: auto; padding: 14px 8px; }
/* A word alone is short: keep it card-sized beside cards with pictures. */
.live-question .answer-grid .answer-card.words-only { min-height: 104px; }
.live-question.has-picture .answer-grid.few .answer-card .emoji { font-size: 56px; }

/* One row: how many answered, then the buttons, always in reach. */
.teacher-view .results { position: sticky; bottom: 10px; z-index: 4; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; box-shadow: var(--shadow); }
.teacher-view .results .answered-summary { flex: none; font-size: 15px; }
.teacher-view .results .progress { flex: 1 1 120px; min-width: 100px; }
.teacher-view .results .question-actions { flex: none; margin-left: auto; }
.teacher-view .results .question-actions .repeat-button { order: -1; }
.teacher-view .results .next-up { display: none; }

/* Students: a row of faces. */
.teach-main .roster { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.teach-main .roster li { padding: 5px 12px 5px 5px; border-radius: 999px; gap: 8px; box-shadow: none; }
.teach-main .roster .avatar { width: 30px; height: 30px; font-size: 13px; }
.teach-main .roster-name { font-size: 14px; }
.teach-main .roster-head { align-items: center; }
.teach-main .roster-title { font-size: 15px; }

@media (min-width: 760px) {
  .live-question.has-picture { grid-template-rows: auto auto auto 1fr auto; }
}

/* ======================================================================
   Student: a book's page is big -- the class needs to see it.
   ====================================================================== */
.student-question .question-picture { cursor: zoom-in; }
/* The slide the teacher is presenting: as big as the screen allows. */
.student-slide { display: flex; justify-content: center; padding: 4px 0 12px; }
.student-slide[hidden] { display: none; }
.slide-image { display: block; width: 100%; max-height: calc(100vh - 140px); object-fit: contain; background: #fff; border: 2px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); cursor: zoom-in; }
.class-view.has-picture .student-question .question-picture { width: 100%; max-width: 100%; max-height: 52vh; object-fit: contain; margin: 0 0 12px; border-radius: 18px; border: 2px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.class-view.has-picture .student-question .question-text { font-size: 26px; }
/* Wide screens (an iPad on its side, a laptop, a smartboard): the page on
   the left, as tall as the screen allows; the question and cards beside it. */
@media (min-width: 820px) and (orientation: landscape) {
  .page:has(> #view-class:not([hidden])) { max-width: 1400px; }
  .page:has(> #view-class:not([hidden]) .teacher-view) { max-width: min(1800px, 100%); }
  .class-view.has-picture:not(.teacher-view) { display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); grid-template-rows: auto auto 1fr auto; grid-template-areas: "head head" "pic text" "pic grid" "pic status"; column-gap: 24px; align-items: start; }
  .class-view.has-picture:not(.teacher-view) > .view-header { grid-area: head; }
  .class-view.has-picture:not(.teacher-view) > .student-question { display: contents; }
  .class-view.has-picture:not(.teacher-view) .question-picture { grid-area: pic; max-height: calc(100vh - 110px); margin: 0 0 0 12px; position: sticky; top: 12px; }
  .class-view.has-picture:not(.teacher-view) .question-text { grid-area: text; margin: 0 12px 0 0; }
  .class-view.has-picture:not(.teacher-view) .math-slot { grid-area: text; }
  .class-view.has-picture:not(.teacher-view) > .answer-grid { grid-area: grid; margin: 12px 12px 0 0; }
  .class-view.has-picture:not(.teacher-view) > .pick-status { grid-area: status; margin: 8px 12px 0 0; }
}
.picture-zoom { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(20, 18, 14, 0.85); cursor: zoom-out; }
.picture-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; background: #fff; }

/* ======================================================================
   Teacher class screen, redesigned: one top line (class + tabs), the stage
   on the left, a rail on the right with the lesson and the students.
   ====================================================================== */
.teacher-view { gap: 12px; }
.class-top { display: flex; align-items: center; gap: 12px; padding: 12px 12px 4px; flex-wrap: wrap; }
.class-top-title { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; gap: 10px; }
.class-top-title .class-name { margin: 0; font-size: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-top-title .rename-class { flex: none; display: inline-flex; align-items: center; gap: 4px; }
.class-top-title .rename-class[hidden] { display: none; }
.class-top .connection { margin: 0; display: inline-flex; }
.class-top .tabs { margin: 0; align-self: center; }
.teacher-view .tab-panel { padding: 0 12px; }

.teacher-view .teach-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 0; align-items: start; }
@media (min-width: 900px) {
  .teacher-view .teach-layout, .teacher-view.in-lesson .teach-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .teach-rail { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
}
.teacher-view .teach-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.teacher-view .teach-main > * { margin: 0; }
.teacher-view .live-status:empty, .teacher-view .live-error:empty { display: none; }
.teacher-view .composer { margin: 0; }
.teacher-view .lesson-next { order: 0; }
.teacher-view .lesson-next.slim { order: 0; }
.teacher-view .live-question, .teacher-view .no-question { order: 1; }

.teach-rail { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rail-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-s); }
.rail-title { margin: 0; font-size: 16px; font-weight: 800; }
.rail-card .lesson-picker, .rail-card .lesson-running { display: flex; flex-direction: column; gap: 10px; }
.rail-card .lesson-picker[hidden], .rail-card .lesson-running[hidden] { display: none; }
.rail-card .lesson-picker ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lesson-running .lesson-title { margin: -4px 0 0; font-size: 19px; font-weight: 800; line-height: 1.25; flex: none; overflow-wrap: anywhere; }
.lr-progress { display: flex; align-items: center; gap: 10px; }
.lr-bar { flex: 1; height: 8px; border-radius: 999px; background: #f3ead8; overflow: hidden; }
.lr-fill { height: 100%; border-radius: 999px; background: var(--green); transition: width 0.3s ease; }
.lr-count { flex: none; font-size: 13px; font-weight: 700; color: var(--muted); }
.lr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; }
.lr-row { width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; min-height: 0; text-align: left; background: none; color: var(--ink); border: 1px solid transparent; border-radius: 12px; box-shadow: none; font-weight: 400; }
.lr-row:hover { background: var(--paper); border-color: var(--line); }
.lr-row:active { transform: none; }
.lr-number { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; font-weight: 800; background: var(--paper); color: var(--muted); border: 2px solid var(--line); }

.lr-question { font-size: 15px; font-weight: 600; line-height: 1.3; }

.lr-row.done .lr-number { background: var(--green-soft); border-color: #b8e8ad; color: var(--green-dark); }
.lr-row.done .lr-question { color: var(--muted); }
.lr-row.selected { background: var(--blue-soft); border-color: var(--blue-line); }
.lr-row.selected .lr-number { border-color: var(--blue); color: var(--blue-dark); background: var(--warm-white); }

.lr-row.live { background: var(--blue-soft); border-color: var(--blue); }
/* Picked from the list while another question is up: Ask now sits on its row. */
.lr-list li.has-ask { position: relative; }
.lr-row.skip { padding-right: 96px; }
.lr-ask { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); min-height: 0; padding: 7px 12px; border-radius: 10px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.lr-ask:active { transform: translateY(-50%) scale(0.97); }
.lr-row.live .lr-number { background: var(--blue); border-color: var(--blue); color: #fff; }

.students-card .roster-head { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.students-card .show-answers { font-size: 13px; color: var(--muted); font-weight: 600; }
.students-card .online-summary { margin: 0; }
.students-card .online-summary:empty { display: none; }
.teacher-view .students-card .roster { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; }
.teacher-view .students-card .roster li { padding: 5px 10px 5px 5px; border-radius: 999px; gap: 8px; box-shadow: none; font-size: 14px; }
.teacher-view .students-card .roster .avatar { width: 28px; height: 28px; font-size: 12px; }
.teacher-view .students-card .roster-meta:has(.roster-pick:empty):has(.roster-choices:empty) { display: none; }

/* The idle stage: a calm, roomy welcome. */
.teacher-view .idle-stage { padding: 36px 24px; text-align: center; align-items: center; }
.teacher-view .idle-actions { justify-content: center; }
.class-view.has-picture:not(.teacher-view) > .pick-status { align-self: start; position: static; }
.class-view.has-picture:not(.teacher-view) .question-text { font-size: 30px; }
.rail-card .lesson-picker { padding: 0; border: 0; background: none; box-shadow: none; }
.teacher-view .students-card .roster li[data-pick="answered"] .avatar::before { right: -7px; top: -7px; width: 16px; height: 16px; font-size: 10px; }
@media (min-width: 820px) and (orientation: landscape) {
  .class-view.has-picture:not(.teacher-view) { grid-template-rows: auto auto auto 1fr; }
}

/* ======================================================================
   Lesson panel, round 2: the ways out on top; questions told apart by
   their pictures, one line each.
   ====================================================================== */
.lr-head { display: flex; align-items: center; gap: 12px; }
.lr-cover { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; overflow: hidden; background: var(--blue-soft); color: var(--blue-dark); border: 1px solid var(--line); }
.lr-cover img { width: 100%; height: 100%; object-fit: cover; }
.lr-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lr-titles .lesson-title { margin: 0; font-size: 17px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.lr-action { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 0; padding: 10px 10px; font-size: 14px; font-weight: 800; border-radius: 12px; background: var(--blue-soft); color: var(--blue-dark); border: 1px solid var(--blue-line); box-shadow: none; }
.lr-action:hover { background: #dcebfb; }
.lr-action.lr-end { background: #fdecec; color: #b3261e; border-color: #f5c6c2; }
.lr-action.lr-end:hover { background: #fbdcdc; }
.lr-progress { gap: 8px; }
.lr-count { font-size: 12px; }

.lr-list { gap: 2px; }
.lr-row { align-items: center; gap: 10px; padding: 5px 8px 5px 5px; }
.lr-pic { position: relative; flex: none; width: 44px; height: 34px; display: grid; place-items: center; border-radius: 8px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.lr-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lr-pic .lr-number { position: relative; width: auto; height: auto; border: 0; background: none; font-size: 13px; font-weight: 800; color: var(--muted); }
.lr-pic img + .lr-number { position: absolute; left: 2px; bottom: 2px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 6px; font-size: 10px; background: rgba(255, 255, 255, 0.92); color: var(--ink); display: grid; place-items: center; }
.lr-question { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-tag { flex: none; font-size: 11px; font-weight: 800; color: var(--muted); }
.lr-tag:empty { display: none; }
.lr-row.done .lr-pic { border-color: #b8e8ad; }
.lr-row.done .lr-number { color: var(--green-dark); }
.lr-row.selected .lr-question, .lr-row.live .lr-question { white-space: normal; font-weight: 800; }
.lr-row.selected .lr-pic { border: 2px solid var(--blue); }
.lr-row.selected .lr-tag { color: #fff; background: var(--blue); padding: 2px 8px; border-radius: 999px; }
.lr-row.live .lr-pic { border: 2px solid var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.lr-row.live .lr-tag { color: #fff; background: var(--green-dark); padding: 2px 8px; border-radius: 999px; }
.lr-row.live .lr-number, .lr-row.selected .lr-number { color: var(--blue-dark); }

/* Lessons to start: a cover and a colour for each kind. */
.side-lesson { padding: 8px 10px 8px 8px; }
.side-lesson-cover { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; overflow: hidden; background: var(--blue-soft); color: var(--blue-dark); }
.side-lesson-cover img { width: 100%; height: 100%; object-fit: cover; }
.side-lesson[data-kind="book"] .side-lesson-cover { background: var(--coral-soft); color: var(--coral-dark); }
.side-lesson[data-kind="worksheet"] .side-lesson-cover { background: var(--teal-soft); color: var(--teal-dark); }
.side-lesson[data-kind="book"] .side-lesson-meta { color: var(--coral-dark); }
.side-lesson[data-kind="slides"] .side-lesson-cover { background: var(--green-soft); color: var(--green-dark); }
.side-lesson[data-kind="slides"] .side-lesson-meta { color: var(--green-dark); }
.side-lesson[data-kind="worksheet"] .side-lesson-meta { color: var(--teal-dark); }
.side-lesson-meta { font-size: 12px; font-weight: 700; }
.lr-action { white-space: nowrap; font-size: 13px; padding: 10px 6px; }

/* Change and End lesson on the class's top line, apart from the tabs. */
.class-top .lesson-controls { display: flex; gap: 8px; margin-left: auto; }
.class-top .lesson-controls[hidden] { display: none; }
.class-top .lesson-controls + .tabs { margin-left: 8px; }
.class-top .lesson-controls .lr-action { padding: 10px 14px; font-size: 14px; }
@media (max-width: 700px) {
  .class-top .lesson-controls { order: 3; width: 100%; margin-left: 0; }
  .class-top .lesson-controls .lr-action { flex: 1; }
  .class-top .lesson-controls + .tabs { margin-left: 0; }
}
/* The number over a question's picture: no coloured disc behind it. */
.lr-row.live .lr-pic .lr-number, .lr-row.selected .lr-pic .lr-number, .lr-row.done .lr-pic .lr-number { background: none; border: 0; box-shadow: none; width: auto; height: auto; }
.lr-row.live .lr-pic img + .lr-number, .lr-row.selected .lr-pic img + .lr-number, .lr-row.done .lr-pic img + .lr-number { background: rgba(255, 255, 255, 0.92); }

/* ======================================================================
   Word boards
   ====================================================================== */
.word-board { display: grid; grid-template-columns: repeat(var(--board-columns, 6), minmax(0, 1fr)); gap: 6px; }
.wb-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2px;
  aspect-ratio: 1 / 1; min-width: 0; min-height: 0; padding: 6px 4px 5px; margin: 0;
  background: var(--cell-colour, #fff); color: var(--ink);
  border: 3px solid var(--cell-edge, var(--line)); border-radius: 12px; box-shadow: none;
  font-weight: 800; text-align: center; overflow: hidden;
}
button.wb-cell { cursor: pointer; }
button.wb-cell:hover { filter: brightness(0.97); }
button.wb-cell:active { transform: scale(0.97); }
.wb-cell.empty { background: transparent; border: 2px dashed var(--line); }
.wb-picture { flex: 1; min-height: 0; width: 100%; object-fit: contain; border-radius: 8px; background: #fff; }
.wb-emoji { flex: 1; min-height: 0; display: grid; place-items: center; font-size: clamp(20px, 4vw, 44px); line-height: 1; }
.wb-label { flex: none; max-width: 100%; font-size: clamp(11px, 1.4vw, 17px); line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-add { font-size: 26px; color: #c9bda4; margin: auto; }
.wb-cell.spoken { animation: wb-spoken 0.5s ease; }
@keyframes wb-spoken { 0% { transform: scale(1); } 40% { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(71, 141, 219, 0.35); } 100% { transform: scale(1); } }

/* The editor. */
.board-view .bv-step { display: flex; flex-direction: column; gap: 14px; padding: 0 12px; }
.bv-step[hidden], .bv-edit[hidden] { display: none; }
.bv-step-title { margin: 0; font-size: 20px; font-weight: 800; }
.bv-from-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.bv-from-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 16px; min-height: 0; background: var(--warm-white); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-s); font-size: 17px; font-weight: 800; }
.bv-from-card:hover { border-color: var(--blue-line); box-shadow: var(--shadow); transform: translateY(-1px); }
.bv-from-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: var(--blue-soft); color: var(--blue-dark); }
.bv-from-card.kind-book .bv-from-icon { background: var(--coral-soft); color: var(--coral-dark); }
.bv-from-card.kind-worksheet .bv-from-icon { background: var(--teal-soft); color: var(--teal-dark); }
.bv-sizes { display: flex; gap: 6px; flex-wrap: wrap; }
.bv-sizes .chip.selected, .bv-ready-sizes .chip.selected { background: var(--blue); color: #fff; border-color: var(--blue); }
.bv-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.bv-option { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 12px; min-height: 0; text-align: left; background: var(--warm-white); color: var(--ink); border: 2px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-s); font-weight: 400; }
.bv-option:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.bv-preview { gap: 3px; margin-bottom: 4px; pointer-events: none; }
.bv-preview .wb-cell { border-width: 2px; border-radius: 6px; padding: 2px; }
.bv-preview .wb-emoji { font-size: 16px; }
.bv-preview .wb-label { font-size: 8px; }
.bv-option-title { font-size: 16px; font-weight: 800; }
.bv-option-sub { font-size: 13px; color: var(--muted); }
.board-view .bv-edit { display: flex; flex-direction: column; gap: 12px; padding: 0 12px; }
.bv-lessons { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); }
.bv-lessons-label { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.bv-lesson-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bv-lesson-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-size: 14px; font-weight: 700; }
.bv-lesson-remove { min-height: 0; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; box-shadow: none; color: var(--blue-dark); font-size: 16px; line-height: 1; }
.bv-lesson-remove:hover { background: rgba(71, 141, 219, 0.15); }
.bv-lesson-none { font-size: 14px; font-weight: 600; color: var(--muted); }
.bv-lessons-hint { flex: 1 1 100%; margin: 0; font-size: 13px; }
.bv-lessons-hint[hidden] { display: none; }

.bv-progress:empty, .board-view .bv-working:empty, .board-view .bv-error:empty { display: none; }
.board-view .bv-working { padding: 24px 12px; font-size: 17px; font-weight: 700; color: var(--ink); text-align: center; }
.bv-sheet { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 16px; box-shadow: var(--shadow-s); }
.bv-sheet-title { margin: 0 0 12px; font-size: 20px; text-align: center; }
.bv-legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }

.bv-tools { display: flex; justify-content: space-between; gap: 12px; }
.bv-cell-form { display: flex; flex-direction: column; gap: 8px; }
.bv-cell-form input { font-size: 18px; font-weight: 700; }
.bv-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.bv-group { min-height: 0; padding: 6px 12px; font-size: 13px; font-weight: 800; color: var(--ink); background: var(--cell-colour); border: 2px solid var(--cell-edge); border-radius: 999px; box-shadow: none; }
.bv-group.selected { box-shadow: 0 0 0 3px rgba(43, 42, 51, 0.25); }
.bv-cell-picture { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.bv-cell-preview { width: 130px; flex: none; }
.bv-cell-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.pv-board { margin-top: 4px; }
.library-row[data-type="board"] > .icon-wrap:first-child { background: var(--sun-soft); color: #8a6d12; }
.side-lesson[data-kind="board"] .side-lesson-cover { background: var(--sun-soft); color: #8a6d12; }

/* Printing: only the board, as big as the page allows. */
@media print {
  body.printing-board { background: #fff !important; }
  body.printing-board * { visibility: hidden; }
  body.printing-board .bv-sheet, body.printing-board .bv-sheet * { visibility: visible; }
  body.printing-board .bv-sheet { position: absolute; left: 0; top: 0; width: 100%; border: 0; box-shadow: none; padding: 0; }
  body.printing-board .wb-cell { break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.printing-board .wb-cell.empty { border-color: transparent; }
  body.printing-board .wb-add { display: none; }
  body.printing-board .wb-label { font-size: 14pt; }
  body.printing-board .wb-emoji { font-size: 34pt; }

}

/* In class: the teacher's button, and the board big for the smartboard. */
.class-top .board-toggle { padding: 10px 14px; font-size: 14px; background: var(--sun-soft); color: #7a5f0c; border-color: #f0dc8c; }
.class-top .board-toggle.on { background: #fff1a8; border-color: #e2c43a; box-shadow: 0 0 0 3px rgba(242, 194, 48, 0.25); }
.class-top .board-toggle + .lesson-controls { margin-left: 8px; }
.class-top .board-toggle { margin-left: auto; }
.class-top .lesson-controls { margin-left: 8px; }
.board-overlay { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; background: var(--cream); overflow: auto; }
.bo-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bo-title { margin: 0; flex: 1 1 200px; font-size: 24px; }
.bo-note { font-size: 13px; color: var(--muted); font-weight: 700; }
.board-overlay .bo-grid { flex: 1; min-height: 0; align-content: center; width: min(100%, calc((100vh - 110px) * var(--board-columns) / var(--board-rows))); margin: 0 auto; gap: 8px; }
.board-overlay .wb-label { font-size: clamp(13px, 1.8vw, 24px); }
.board-overlay .wb-emoji { font-size: clamp(28px, 5vw, 64px); }

/* Students: the board while waiting, and a Words button during a question. */
.student-board { margin: 0 12px; }
.class-view.with-board .waiting { padding-top: 4px; }
.class-view.with-board .waiting .mascot-halo, .class-view.with-board .waiting .hint { display: none; }
.class-view.with-board .waiting .waiting-text { font-size: 18px; }
.words-button { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20; padding: 14px 22px; font-size: 18px; border-radius: 999px; background: #fff1a8; color: #5a4608; border: 3px solid #e2c43a; box-shadow: var(--shadow-l); }
/* The whole board in view while editing. */
.bv-sheet .word-board { width: min(100%, calc((100vh - 250px) * var(--board-columns) / var(--board-rows))); margin: 0 auto; }
.student-board .word-board { width: min(100%, calc((100vh - 200px) * var(--board-columns) / var(--board-rows))); margin: 0 auto; }

/* ======================================================================
   Word boards, round 2: square cells on square boards, editing on the board
   (drag, ✕, +), where each picture came from, and a branded sheet.
   ====================================================================== */
.word-board { grid-template-rows: repeat(var(--board-rows, 5), minmax(0, 1fr)); }
.wb-cell { aspect-ratio: 1 / 1; }
.word-board.editable .wb-cell:not(.empty) { touch-action: none; cursor: grab; }
.wb-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: #b3261e; font-size: 11px; font-weight: 900; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); opacity: 0; transition: opacity 0.12s ease; cursor: pointer; }
.wb-cell:hover .wb-remove, .wb-cell:focus-visible .wb-remove { opacity: 1; }
@media (hover: none) { .wb-remove { opacity: 1; } }
.wb-pending { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); font-size: 10px; font-weight: 800; color: var(--blue-dark); background: rgba(255, 255, 255, 0.95); padding: 1px 7px; border-radius: 999px; animation: wb-pulse 1.2s ease-in-out infinite; white-space: nowrap; }
@keyframes wb-pulse { 50% { opacity: 0.45; } }
.wb-cell.dragging { opacity: 0.35; }
.wb-cell.drop-target { outline: 3px dashed var(--blue); outline-offset: 2px; }
.wb-ghost { position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none; opacity: 0.92; box-shadow: var(--shadow-l); transform-origin: center; }
.wb-legend-item { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--cell-colour); border: 2px solid var(--cell-edge); color: var(--ink); }

.bv-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.bv-size-slot { display: flex; gap: 6px; flex-wrap: wrap; }
.bv-size-slot .chip.selected { background: var(--blue); color: #fff; border-color: var(--blue); }
.bv-pictures { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--blue-soft); color: var(--blue-dark); font-size: 14px; font-weight: 700; }
.bv-pictures:empty { display: none; }
.bv-help { text-align: center; }
.bv-source { margin: 0; font-size: 13px; font-weight: 800; color: var(--muted); }
.bv-moves { display: flex; gap: 6px; }
.bv-moves .icon-button { width: 44px; height: 44px; min-height: 0; padding: 0; font-size: 18px; }

/* The sheet: looks the same on screen and on paper. */
.bv-sheet { display: flex; flex-direction: column; gap: 12px; }
.bv-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 3px solid var(--sun); }
.bv-logo { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--sun-soft); display: grid; place-items: center; overflow: hidden; }
.bv-logo img { width: 40px; height: 40px; object-fit: contain; }
.bv-sheet-titles { flex: 1; min-width: 0; text-align: center; }
.bv-sheet-titles .bv-sheet-title { margin: 0; font-size: 22px; }
.bv-sheet-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); font-weight: 700; }
.bv-sheet-sub:empty { display: none; }
.bv-wordmark { flex: none; font-size: 20px; font-weight: 900; letter-spacing: -0.02em; color: var(--blue-dark); }
.bv-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }
.bv-sheet-foot .bv-legend { margin: 0; justify-content: flex-start; }
.bv-made { font-size: 12px; font-weight: 800; color: var(--muted); }
.bv-sheet .word-board { width: min(100%, calc((100vh - 330px) * var(--board-columns) / var(--board-rows))); }

@media print {
  body.printing-board .bv-sheet { display: flex; height: 100vh; padding: 0; gap: 6mm; }
  body.printing-board .bv-sheet .word-board { width: min(100%, calc((100vh - 42mm) * var(--board-columns) / var(--board-rows))); margin: 0 auto; }
  body.printing-board .bv-brand, body.printing-board .bv-logo, body.printing-board .bv-legend-item, body.printing-board .wb-legend-item { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.printing-board .wb-remove, body.printing-board .wb-pending { display: none !important; }
  body.printing-board .bv-sheet-title { font-size: 20pt; }
}
/* Labels size themselves to their square, so "caterpillar" fits whole. */
.wb-cell { container-type: inline-size; }
.wb-label { font-size: clamp(9px, 13cqw, 26px); white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-overflow: clip; }
.wb-emoji { font-size: clamp(18px, 38cqw, 72px); }
.bv-preview .wb-label { font-size: 7px; }
.bv-preview .wb-emoji { font-size: 14px; }

/* Create menu: an icon beside each kind, in that kind's colour. */
#create-menu button[data-create] { display: grid; grid-template-columns: 38px 1fr; column-gap: 12px; align-items: center; }
#create-menu button[data-create] > .icon-wrap { grid-row: span 2; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--blue-soft); color: var(--blue-dark); }
#create-menu button[data-kind="book"] > .icon-wrap { background: var(--coral-soft); color: var(--coral-dark); }
#create-menu button[data-kind="slides"] > .icon-wrap { background: var(--green-soft); color: var(--green-dark); }
#create-menu button[data-kind="worksheet"] > .icon-wrap { background: var(--teal-soft); color: var(--teal-dark); }
#create-menu button[data-create="board"] > .icon-wrap { background: var(--sun-soft); color: #8a6d12; }

/* Moving words: grab to drag, or pick a square after "Move to another square". */
.word-board.editable .wb-cell { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.word-board.is-dragging .wb-cell:not(.dragging) { transition: transform 0.12s ease; }
.wb-cell.drop-target { outline: 4px solid var(--blue); outline-offset: 2px; transform: scale(1.04); }
.word-board.moving .wb-cell { cursor: pointer; }
.word-board.moving .wb-cell:not(.move-source):hover { outline: 4px solid var(--blue); outline-offset: 2px; }
.wb-cell.move-source { outline: 4px dashed var(--blue); outline-offset: 2px; opacity: 0.6; }
.bv-moving { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--blue); color: #fff; font-weight: 800; position: sticky; top: 8px; z-index: 5; }
.bv-moving[hidden] { display: none; }
.bv-moving .link-button { color: #fff; text-decoration: underline; }

/* The sheet is a page: portrait for square boards, and the board takes its
   whole width. The brand is a thin strip above and below. */
.bv-sheet { width: min(100%, 780px); margin: 0 auto; padding: 22px 24px; gap: 12px; }
.bv-sheet[data-shape="portrait"] { aspect-ratio: 210 / 297; }
.bv-sheet[data-shape="landscape"] { width: min(100%, 1040px); aspect-ratio: 297 / 210; }
.bv-sheet .word-board, .bv-sheet[data-shape] .word-board { width: 100%; margin: 0; gap: 8px; }
.bv-sheet[data-shape="landscape"] .word-board { width: min(100%, calc((min(100vw, 1040px) * 210 / 297 - 120px) * var(--board-columns) / var(--board-rows))); margin: 0 auto; }
.bv-brand { gap: 10px; padding-bottom: 8px; border-bottom-width: 2px; }
.bv-logo { width: 34px; height: 34px; }
.bv-logo img { width: 30px; height: 30px; }
.bv-sheet-titles .bv-sheet-title { font-size: 20px; }
.bv-wordmark { font-size: 16px; }
.bv-sheet-foot { padding-top: 6px; margin-top: auto; }
.bv-sheet .wb-cell { border-width: 3px; border-radius: 10px; padding: 5% 4% 4%; }

@media print {
  body.printing-board .bv-sheet, body.printing-board .bv-sheet[data-shape] { position: absolute; left: 0; top: 0; width: 100%; height: auto; aspect-ratio: auto; padding: 0; margin: 0; border: 0; box-shadow: none; gap: 3mm; display: flex; flex-direction: column; }
  body.printing-board .bv-brand { padding-bottom: 2mm; }
  body.printing-board .bv-logo { width: 9mm; height: 9mm; }
  body.printing-board .bv-logo img { width: 8mm; height: 8mm; }
  body.printing-board .bv-sheet-title { font-size: 15pt; }
  body.printing-board .bv-sheet-sub { font-size: 8pt; }
  body.printing-board .bv-wordmark { font-size: 11pt; }
  /* As big as the page allows: the full width, unless the height runs out. */
  body.printing-board .bv-sheet .word-board { width: min(100%, calc((100vh - 30mm) * var(--board-columns) / var(--board-rows))); margin: 0 auto; gap: 2mm; }
  body.printing-board .bv-sheet .wb-cell { border-width: 0.7mm; border-radius: 2.5mm; padding: 1.5mm 1mm 1mm; }
  body.printing-board .wb-label { font-size: clamp(8pt, 13cqw, 18pt); }
  body.printing-board .wb-emoji { font-size: clamp(16pt, 40cqw, 60pt); }
  body.printing-board .bv-sheet-foot { padding-top: 1.5mm; margin-top: 0; }
  body.printing-board .wb-legend-item { font-size: 7pt; padding: 0.5mm 2mm; border-width: 0.4mm; }
  body.printing-board .bv-made { font-size: 7pt; }
}

/* Tiles are buttons, but must not look or move like the app's buttons:
   no blue hover, no press nudge, and the dragged tile follows the pointer
   exactly (no easing), so a drag feels direct. */
.word-board .wb-cell, .word-board button.wb-cell:hover, .word-board button.wb-cell:active, .word-board button.wb-cell:focus {
  background: var(--cell-colour, #fff); box-shadow: none; transition: filter 0.12s ease, outline-color 0.12s ease;
}
.word-board button.wb-cell.empty:hover, .word-board button.wb-cell.empty:active { background: var(--paper); }
.word-board button.wb-cell:active { transform: none; }
.word-board.editable button.wb-cell:not(.empty):hover { filter: brightness(0.96); }
.wb-ghost { transition: none !important; will-change: transform; box-shadow: 0 14px 30px rgba(43, 42, 51, 0.28) !important; cursor: grabbing; border-radius: 12px; }
.word-board.is-dragging, .word-board.is-dragging * { cursor: grabbing !important; }
.bv-sheet, .bv-sheet * { -webkit-user-select: none; user-select: none; }
.wb-cell.drop-target { transform: none; outline: 4px solid var(--blue); outline-offset: 2px; filter: brightness(0.94); }

/* Swaps you can see: the word being displaced slides to the dragged tile's
   old square, the dragged tile glides into place, and both pulse once. */
.word-board .wb-cell.making-room { transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.12s ease; z-index: 2; filter: none; outline: 3px dashed var(--blue); outline-offset: 2px; }
.wb-ghost.landing { transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1) !important; box-shadow: 0 4px 10px rgba(43, 42, 51, 0.18) !important; }
.word-board .wb-cell.sliding { z-index: 3; position: relative; }
.word-board .wb-cell.just-moved { animation: wb-moved 0.7s ease-out; z-index: 1; }
@keyframes wb-moved {
  0% { box-shadow: 0 0 0 0 rgba(71, 141, 219, 0.7); filter: brightness(1.08); }
  45% { box-shadow: 0 0 0 7px rgba(71, 141, 219, 0.35); }
  100% { box-shadow: 0 0 0 12px rgba(71, 141, 219, 0); filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .word-board .wb-cell.making-room, .wb-ghost.landing, .word-board .wb-cell.sliding { transition: none !important; }
  .word-board .wb-cell.just-moved { animation: none; outline: 3px solid var(--blue); }
}
.switch-account-row { margin: 4px 0 0; text-align: center; }
.switch-account-row .link-button { font-size: 14px; }
/* Header buttons with an icon keep it beside the word. */
.doc-actions button { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* The guide: a button on the home screen, and a small "?" on each screen. */
.home-header { position: relative; }
.guide-button { margin-left: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--warm-white); border: 1px solid var(--line); color: var(--blue-dark); font-weight: 800; font-size: 14px; text-decoration: none; box-shadow: var(--shadow-s); white-space: nowrap; }
.guide-button span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 12px; }
.guide-button:hover { border-color: var(--blue); }

.help-dot { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--warm-white); border: 1px solid var(--line); color: var(--blue-dark); font-weight: 900; font-size: 15px; text-decoration: none; box-shadow: var(--shadow-s); }
.help-dot:hover { border-color: var(--blue); background: var(--blue-soft); }
.class-top .help-dot { margin-left: 4px; }

/* ---------- Hinge questions and exit tickets ---------- */

.card-why { margin: 4px 2px 0; font-size: 12px; line-height: 1.3; color: var(--violet-dark); background: var(--violet-soft); border-radius: 8px; padding: 3px 6px; text-align: center; }
.composer.blocked { opacity: 0.55; }
.lr-exit { margin-top: 10px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--coral); }
.lr-exit:hover { background: var(--coral-dark); }
.lr-exit[hidden] { display: none; }
.lr-present { margin-top: 10px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--green-dark); }
.lr-present:hover { background: #17790b; }
.lr-present[hidden] { display: none; }

/* Presenting a slide deck: the slide is the stage. */
.slide-stage { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--green-dark); border-radius: var(--radius-l); box-shadow: var(--shadow-s); }
.ss-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ss-image { display: block; width: 100%; max-height: 50vh; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.ss-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ss-nav button { min-width: 110px; font-size: 16px; }
.ss-position { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.ss-questions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ss-questions:empty { display: none; }
.ss-question { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--blue-line); border-left: 6px solid var(--blue); border-radius: 14px; background: var(--blue-soft); }
.ss-question.asked { border-left-color: var(--line); background: var(--warm-white); }
.ss-question-text { flex: 1; min-width: 0; font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.ss-hint { margin: 0; }
.ss-students { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.exit-stage { display: flex; flex-direction: column; gap: 12px; padding: 18px; background: var(--warm-white); border: 1px solid var(--line); border-top: 4px solid var(--coral); border-radius: var(--radius-l); box-shadow: var(--shadow-s); }
.exit-stage[hidden] { display: none; }
.exit-stage-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.exit-stage-title { margin: 2px 0; font-size: 22px; }
.exit-stage-sub { margin: 0; }
.exit-stage .progress-fill { background: var(--coral); }
.exit-grid-wrap { overflow-x: auto; }
.exit-grid { width: 100%; border-collapse: collapse; font-size: 15px; }
.exit-grid th, .exit-grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.exit-grid tr > th:first-child { text-align: left; font-weight: 700; white-space: nowrap; }
.exit-grid tr:first-child th { vertical-align: bottom; font-size: 13px; color: var(--muted); font-weight: 600; max-width: 180px; }
.exit-grid .eg-number { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-bottom: 4px; border-radius: 50%; background: var(--coral-soft); color: var(--coral-dark); font-weight: 800; }
.exit-grid .eg-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.exit-grid .eg-right { color: var(--green-dark); font-weight: 800; font-size: 18px; }
.exit-grid .eg-wrong { color: var(--coral-dark); font-weight: 700; }
.exit-grid .eg-empty { color: #c9bda4; }
.exit-grid tr.offline > th:first-child { color: var(--muted); font-weight: 400; }
.exit-grid tr.done > th:first-child::after { content: " ✓"; color: var(--green-dark); }
.exit-grid .eg-total th, .exit-grid .eg-total td { border-bottom: 0; font-weight: 800; color: var(--ink); }

.exit-step { margin: 0 0 6px; font-size: 15px; font-weight: 800; color: var(--coral-dark); }
.exit-step[hidden] { display: none; }
.exit-done[hidden] { display: none; }

/* The hinge panel: goals to pick, then three questions side by side. */
.hinge-goals { display: flex; flex-direction: column; gap: 8px; }
.hinge-goal-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 0; padding: 12px 14px; text-align: left; background: var(--warm-white); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); font-weight: 600; }
.hinge-goal-option:hover { background: var(--warm-white); border-color: var(--violet-dark); }
.hinge-goal-option[aria-checked="true"] { border: 2px solid var(--violet-dark); background: var(--violet-soft); }
.hinge-goal-kind { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--cream-deep); color: var(--muted); font-size: 12px; font-weight: 700; }
.hinge-own { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.hinge-options { display: flex; flex-direction: column; gap: 12px; }
.hinge-option { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.hinge-option:hover { border-color: #cdb9ea; }
.hinge-option:focus-visible { outline: 3px solid var(--blue-line); outline-offset: 2px; }
.hinge-option[aria-checked="true"] { border: 2px solid var(--violet-dark); padding: 15px 17px; box-shadow: 0 0 0 4px var(--violet-soft); }
.hinge-option-head { display: flex; align-items: center; justify-content: space-between; }
.hinge-option-number { font-size: 12px; font-weight: 800; color: var(--violet-dark); text-transform: uppercase; letter-spacing: 0.05em; }
.hinge-option-mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); color: transparent; font-size: 13px; font-weight: 800; }
.hinge-option[aria-checked="true"] .hinge-option-mark { background: var(--violet-dark); border-color: var(--violet-dark); color: #fff; }
.hinge-option-text { margin: 0; font-size: 19px; line-height: 1.3; }
.hinge-checks { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.hinge-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.hinge-tile { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 15px; font-weight: 700; }
.hinge-tile.right { background: var(--green-soft); border-color: #a9dd9c; }
.hinge-tile-emoji { font-size: 20px; line-height: 1; }
.hinge-tile-img { width: 24px; height: 24px; object-fit: contain; }
.hinge-tile-check { color: var(--green-dark); font-weight: 800; }
.hinge-sub { margin: 2px 0 -4px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.hinge-mistakes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hinge-mistakes li { display: grid; grid-template-columns: minmax(70px, max-content) 1fr; gap: 10px; font-size: 14px; line-height: 1.35; }
.hinge-mistakes strong { font-weight: 700; color: var(--ink); }
.hinge-mistakes span { color: var(--muted); }

.exit-goal { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-width: 520px; }
.exit-goal input { width: 100%; }
.exit-step { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.exit-label { font-size: 15px; font-weight: 800; color: var(--coral-dark); }
.exit-dots { display: inline-flex; gap: 6px; }
.exit-dots span { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--coral); }
.exit-dots span.done, .exit-dots span.now { background: var(--coral); }
.exit-dots span.now { box-shadow: 0 0 0 3px var(--coral-soft); }
.exit-hear { margin-left: auto; width: 52px; height: 52px; min-height: 0; padding: 0; border-radius: 50%; font-size: 24px; background: var(--warm-white); color: var(--ink); border: 2px solid var(--coral); box-shadow: var(--shadow-s); }
.exit-hear:hover { background: var(--coral-soft); }
.exit-next { position: sticky; bottom: 12px; z-index: 2; display: block; width: min(420px, 100%); margin: 14px auto 0; min-height: 64px; box-shadow: var(--shadow-l); font-size: 22px; font-weight: 800; background: var(--coral); border-radius: var(--radius-l); }
.exit-next:hover { background: var(--coral-dark); }
.exit-next[hidden] { display: none; }
.exit-stage-goal { margin: 2px 0 0; font-size: 14px; color: var(--violet-dark); font-weight: 600; }
.exit-stage-goal:empty { display: none; }
/* A hinge check in the lesson: a checkpoint between the questions. */
.q-checkpoint { list-style: none; }
.q-checkpoint-open { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; min-height: 0; padding: 10px 14px; text-align: left; background: var(--violet-soft); color: var(--ink); border: 1.5px dashed var(--violet-dark); border-radius: var(--radius); box-shadow: none; font-weight: 400; }
.q-checkpoint-open:hover { background: #e9ddf8; color: var(--ink); }
.q-checkpoint.current .q-checkpoint-open { border-style: solid; box-shadow: 0 0 0 3px #d9c8f2; }
.q-checkpoint-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--violet-dark); text-transform: uppercase; letter-spacing: 0.04em; }
.q-checkpoint-goal { text-transform: none; letter-spacing: 0; font-weight: 600; }
.q-checkpoint-text { font-size: 16px; font-weight: 700; }
.q-checkpoint-when { font-size: 13px; color: var(--violet-dark); }
.hinge-fields { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius-s); background: var(--violet-soft); }
.hinge-fields[hidden] { display: none; }
.hinge-fields input { width: 100%; }
.hinge-fields .hint { margin: 0; }
.hinge-when { display: flex; align-items: center; gap: 6px; margin: -2px 0 0; font-size: 13px; font-weight: 600; color: var(--violet-dark); }
.lr-row.hinge { background: var(--violet-soft); border: 1.5px dashed var(--violet-dark); }
.lr-row.hinge .lr-pic { color: var(--violet-dark); display: grid; place-items: center; }
.lr-row.hinge .lr-tag { color: var(--violet-dark); }
.lesson-next.hinge { border-color: var(--violet-dark); }
.lesson-next.hinge .lesson-next-label { color: var(--violet-dark); }

/* ---------- Books: kind of book, reading in the background ---------- */
.bk-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; width: 100%; max-width: 560px; margin: 4px 0 12px; }
.bk-kind { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 0; padding: 12px 14px; text-align: left; background: var(--warm-white); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); font-weight: 400; }
.bk-kind:hover { background: var(--warm-white); color: var(--ink); border-color: var(--coral); }
.bk-kind[aria-checked="true"] { border: 2px solid var(--coral); background: var(--coral-soft); }
.bk-kind .menu-title { font-weight: 800; font-size: 15px; }
.bk-kind .menu-sub { font-size: 13px; color: var(--muted); }
.bk-reading[hidden], .bk-reading-actions[hidden] { display: none; }
.bk-reading .progress { width: 100%; max-width: 480px; }
.bk-reading .progress-fill { background: var(--coral); transition: width 0.4s; }
.book-toast { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.book-toast-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 14px; background: var(--warm-white); border: 1px solid var(--line); border-left: 4px solid var(--coral); border-radius: var(--radius); box-shadow: var(--shadow-l); font-size: 14px; }
.book-toast-row.ready { border-left-color: var(--green-dark); }
.book-toast-row.failed { border-left-color: var(--red); }
.book-toast-text { flex: 1 1 0; min-width: 0; }
.book-toast-bar { flex: 1 1 100%; height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--coral) var(--done), var(--cream-deep) var(--done)); }
.book-toast-close { min-height: 0; padding: 2px 6px; background: none; color: var(--muted); box-shadow: none; font-size: 14px; }
.book-toast-close:hover { background: var(--cream); color: var(--ink); }

/* ---------- Math: written as on paper, the keypad, pictures that help ---------- */
.math-text { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.18em; }
.math-number { display: inline-flex; align-items: center; gap: 0.12em; }
.math-frac { display: inline-flex; flex-direction: column; align-items: center; font-size: 0.72em; line-height: 1.05; vertical-align: middle; }
.math-top { padding: 0 0.15em; border-bottom: 0.09em solid currentColor; }
.math-bottom { padding: 0 0.15em; }
.math-op { margin: 0 0.12em; }
.math-box { display: inline-block; min-width: 1.4em; height: 1.15em; border: 0.08em solid var(--blue); border-radius: 0.18em; background: var(--blue-soft); vertical-align: middle; }
.math-card-text { font-size: 30px; font-weight: 800; line-height: 1.1; }
.math-key-toggle { min-height: 0; width: 40px; height: 40px; padding: 0; flex: none; border-radius: var(--radius-s); background: var(--warm-white); color: var(--blue-dark); border: 1px solid var(--blue-line); box-shadow: none; font-size: 20px; font-weight: 800; }
.math-key-toggle:hover { background: var(--blue-soft); color: var(--blue-dark); }
.math-key-toggle[hidden] { display: none; }
.math-keypad { position: absolute; z-index: 70; display: grid; grid-template-columns: repeat(5, 52px); gap: 6px; padding: 10px; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-l); }
.math-keypad[hidden] { display: none; }
.math-key { min-height: 0; height: 46px; padding: 0; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: none; font-size: 20px; font-weight: 700; }
.math-key.digit { background: var(--warm-white); }
.math-key.done { background: var(--blue); color: #fff; font-size: 14px; }
.math-key:hover { background: var(--blue-soft); color: var(--ink); }
.math-key.done:hover { background: var(--blue-dark); color: #fff; }
.visual-help { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.visual-help[hidden], .visual-help-setting[hidden] { display: none; }
.math-visual { display: flex; justify-content: center; padding: 8px 0; }
.math-numberline { width: min(640px, 100%); height: auto; }
.math-numberline .nl-axis { stroke: var(--ink); stroke-width: 3; }
.math-numberline .nl-tick { stroke: var(--ink); stroke-width: 2; }
.math-numberline .nl-tick.big { stroke-width: 3; }
.math-numberline .nl-label { font-size: 15px; text-anchor: middle; fill: var(--muted); font-weight: 700; }
.math-numberline .nl-hop { fill: none; stroke: var(--coral); stroke-width: 4; stroke-dasharray: 2 0; }
.math-numberline .nl-start { fill: var(--blue); }
.math-numberline .nl-hop-label { font-size: 20px; font-weight: 800; text-anchor: middle; fill: var(--coral-dark); }
.math-array { display: grid; grid-template-columns: repeat(var(--cols), 22px); gap: 8px; padding: 10px; background: var(--paper); border-radius: var(--radius-s); }
.math-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--blue); display: inline-block; }
.math-sharing { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.math-pile { display: flex; flex-wrap: wrap; gap: 6px; max-width: 200px; }
.math-pile .math-dot { width: 18px; height: 18px; }
.math-arrow { font-size: 28px; color: var(--muted); }
.math-groups { display: flex; gap: 10px; flex-wrap: wrap; }
.math-group-circle { width: 64px; height: 64px; border-radius: 50%; border: 3px dashed var(--blue-line); }
.math-fractions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; font-size: 26px; font-weight: 800; }
.math-bar-group { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.math-bar { display: flex; width: 180px; height: 34px; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.math-piece { flex: 1; border-right: 2px solid var(--ink); background: #fff; }
.math-piece:last-child { border-right: 0; }
.math-piece.shaded { background: var(--sun); }

/* ---------- Switch access and reading aloud ---------- */
.question-hear { float: right; width: 52px; height: 52px; min-height: 0; padding: 0; margin: 0 0 6px 10px; border-radius: 50%; font-size: 24px; background: var(--warm-white); color: var(--ink); border: 2px solid var(--blue-line); box-shadow: var(--shadow-s); }
.question-hear:hover { background: var(--blue-soft); color: var(--ink); }
.question-hear[hidden] { display: none; }
/* A switch user needs to see where they are from across the room. */
.switch-access .answer-card:focus,
.switch-access .answer-card:focus-visible,
.switch-access .exit-next:focus-visible,
.switch-access .question-hear:focus-visible,
.switch-access .exit-hear:focus-visible { outline: 6px solid var(--sun); outline-offset: 4px; box-shadow: 0 0 0 10px rgba(242, 194, 48, 0.35); transform: scale(1.03); }
.access-slot { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.access-slot label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.math-line { display: block; margin-top: 6px; font-size: 0.85em; color: var(--blue-dark); }

.wb-emoji.wb-math { font-size: clamp(22px, 3.2vw, 40px); font-weight: 800; color: #12524a; line-height: 1; }
/* A number or sign is its own label: no small copy underneath. */
.wb-cell:has(.wb-math) .wb-label { display: none; }
.wb-cell:has(.wb-math) .wb-math { font-size: clamp(26px, 4vw, 52px); }
/* What the wrong math picks show: one line each, under the answers. */
.pick-reasons { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pick-reasons[hidden] { display: none; }
.pick-reasons li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--violet-soft); color: var(--ink); font-size: 15px; }
.pr-value { min-width: 44px; padding: 2px 8px; border-radius: 8px; background: var(--warm-white); color: var(--violet-dark); font-weight: 800; font-size: 18px; text-align: center; }
.pr-text { font-weight: 600; }
.pr-who { color: var(--violet-dark); font-size: 13px; font-weight: 700; white-space: nowrap; }
/* Long numbers (1239, 3 R2) shrink to fit their card. */
.results .pick-reasons { flex: 1 1 100%; order: 10; width: 100%; }

/* ---------- Number cards: sized to fit, dots as dice faces ---------- */
/* The number never outgrows its card: about 1.4 card-widths shared by its digits. */
.number-card { container-type: inline-size; }
.number-card .emoji { font-size: min(var(--number-size, 54px), calc(130cqw / var(--chars, 2))) !important; white-space: nowrap; }
.answer-grid.few .number-card { --number-size: 66px; }
.class-view:not(.teacher-view) > .answer-grid.few .number-card { --number-size: 110px; }
.dots { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: nowrap; }
.die-face { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; width: 30px; height: 30px; padding: 3px; border: 1.5px solid var(--blue-line); border-radius: 7px; background: #fff; }
.die-dot, .die-gap { border-radius: 50%; }
.die-dot { background: var(--blue-dark); }
.class-view:not(.teacher-view) > .answer-grid .die-face { width: 46px; height: 46px; gap: 3px; padding: 5px; }
/* Student cards sit in the middle of the screen, rows centred, so a fifth
   card isn't left alone on the left. */
.class-view:not(.teacher-view) > .answer-grid:not(.few):not([hidden]) { display: flex; flex-wrap: wrap; justify-content: center; }
.class-view:not(.teacher-view) > .answer-grid:not(.few) > .answer-card { flex: 0 1 190px; min-width: 150px; }
.class-view:not(.teacher-view) > .answer-grid:not(.few) .number-card { --number-size: 76px; }
/* Who picked each card (with Show picks on). */
/* Under each card: how many picked it, then who. The right card's in green. */
.card-tally { display: block; margin-top: 7px; text-align: center; font-size: 15px; font-weight: 800; color: var(--blue-dark); font-variant-numeric: tabular-nums; }
.card-tally.none { color: var(--muted); font-weight: 700; }
.card-pickers { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 6px; }
.card-picker { padding: 3px 12px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-size: 13.5px; font-weight: 700; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.right-card .card-tally:not(.none) { color: #2e7d32; }
.right-card .card-picker { background: #e5f6e1; color: #2e7d32; }
.answer-pool { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 2px dashed var(--line); border-radius: var(--radius); background: #fffdf8; }
.answer-pool[hidden] { display: none; }
.pool-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.pool-label { font-weight: 800; font-size: 15px; margin-right: 4px; }
.pool-name, .pool-count { padding: 4px 12px; border-radius: 999px; background: #f3ead8; color: #5f584b; font-size: 14px; font-weight: 700; }
.answer-pool.done { border-style: solid; border-color: #c9e8c2; background: #f3fbf0; }
.answer-pool.done .pool-label { color: #2e7d32; }
.pool-away { margin: 0; font-size: 13.5px; }
.pool-away[hidden] { display: none; }
.card-picker.arrived { animation: picker-in 0.45s var(--spring, ease-out); }
@keyframes picker-in { from { opacity: 0; transform: translateY(-10px) scale(0.85); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card-picker.arrived { animation: none; } }

/* A speaker under each card (per student): hear it without choosing it. */
.card-hear-wrap { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; }
.card-hear-wrap > .answer-card { width: 100%; }
.card-hear { align-self: center; width: 56px; height: 44px; min-height: 0; padding: 0; border-radius: 999px; font-size: 22px; background: var(--warm-white); color: var(--ink); border: 2px solid var(--blue-line); box-shadow: var(--shadow-s); }
.card-hear:hover { background: var(--blue-soft); color: var(--ink); }
.card-hear:active { transform: scale(0.95); }
.class-view:not(.teacher-view) > .answer-grid:not(.few) > .card-hear-wrap { flex: 0 1 190px; min-width: 150px; }
/* The teacher sees the same dice, a little bigger. */
.teacher-view .live-question .die-face { width: 36px; height: 36px; gap: 2px; padding: 4px; }

/* The presenter view on the smartboard: the student screen, nothing to tap. */
.display-view .back-button, .display-view .question-hear, .display-view .words-button { display: none !important; }
.display-view .answer-card { cursor: default; }
.display-view .view-header { justify-content: space-between; }
.present-fullscreen { margin-left: auto; }
.present-fullscreen[hidden] { display: none; }

/* Already have one by that name: open it, or make a new copy. */
.same-note { width: 100%; max-width: 460px; margin: 6px auto 0; padding: 12px 14px; border-radius: var(--radius); background: var(--sun-soft); border: 1px solid #f0d98a; text-align: center; }
.same-note p { margin: 0 0 10px; font-size: 15px; }
.same-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- Prepare: tabs, a sidebar per tab, the list ---------- */
.library-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.library-top .chips { margin: 0; }
.library-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }
.library-side-panel { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; padding: 10px; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); }
.side-search { width: 100%; box-sizing: border-box; margin: 0 0 6px; font-size: 14px; padding: 8px 10px; }
.side-heading { margin: 10px 8px 4px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.side-link { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 0; padding: 7px 10px; border: 0; border-radius: 10px; background: none; box-shadow: none; color: var(--ink); font-size: 14.5px; font-weight: 700; text-align: left; }
.side-link span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link:hover { background: var(--paper); }
.side-link.on { background: var(--blue-soft); color: var(--blue-dark); }
.side-count { flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-link.on .side-count { color: var(--blue-dark); }
.library-main .empty-state { margin-top: 0; }
@media (max-width: 760px) {
  .library-layout { grid-template-columns: minmax(0, 1fr); }
  .library-side-panel { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  .library-side-panel .side-search { flex: 1 1 100%; }
  .library-side-panel .side-heading { display: none; }
  .library-side-panel .side-link { width: auto; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; }
}

/* A lesson's topic, beside its row. */
.library-side.topic-chip { padding: 3px 11px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-weight: 700; text-decoration: none; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.library-side.topic-chip.empty { background: none; border: 1px dashed var(--line); color: var(--muted); }
.topic-choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.topic-choices .on { border-color: var(--blue); color: var(--blue-dark); background: var(--blue-soft); }
.topic-new { display: flex; gap: 8px; margin: 0 0 12px; }
.topic-new input { flex: 1; min-width: 0; }

/* Create a lesson / Add: what each choice will do. */
#create-menu.create-menu { width: min(380px, 92vw); padding: 6px; }
#create-menu.create-menu.opens-right { left: 0; right: auto; width: min(380px, calc(100vw - 48px)); }
#create-menu button[data-create] { grid-template-columns: 38px 1fr; padding: 10px; align-items: start; }
#create-menu .create-text { display: flex; flex-direction: column; gap: 2px; text-align: left; }
#create-menu .create-text .menu-sub { white-space: normal; line-height: 1.4; }
#create-menu .menu-how { font-size: 12px; color: var(--muted); font-weight: 600; }
#create-menu .create-note { margin: 6px 10px 6px; font-size: 12.5px; color: var(--muted); }

/* In a lesson's quick look: what it was made from. */

.pv-made { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.pv-made .link-button { font-weight: 800; }

/* Which lessons a board is for. */
.assign-list { display: flex; flex-direction: column; gap: 2px; margin: 10px 0; }
.assign-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.assign-row:hover { background: var(--paper); }
.assign-row .hint { font-weight: 600; font-size: 13px; }
.bv-describe { display: flex; flex-direction: column; gap: 8px; }
.bv-describe textarea { width: 100%; box-sizing: border-box; }

/* Before a board is built: the size, then Build. */
.bv-ready { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.bv-ready-sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.bv-ready .bv-build { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; padding: 12px 22px; }

/* Top right of home: the guide, and the account (who's signed in, Sign out). */
.home-top-actions { margin-left: auto; align-self: flex-start; display: flex; align-items: flex-start; gap: 8px; }
.home-top-actions .guide-button { margin-left: 0; }
.account-wrap[hidden] { display: none; }
.account-button { display: inline-flex; align-items: center; gap: 8px; min-height: 0; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--warm-white); border: 1px solid var(--line); color: var(--ink); font-weight: 800; font-size: 14px; box-shadow: var(--shadow-s); }
.account-initial { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-dark); font-size: 13px; }
.account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu { right: 0; left: auto; min-width: 230px; }
.account-who { margin: 6px 12px 8px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.account-plan { display: flex; flex-direction: column; gap: 2px; margin: 0 8px 8px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--blue-soft); }
.account-plan[data-source="trial"] { background: var(--sun-soft); }
.account-plan[data-source="own"], .account-plan[data-source="school"] { background: var(--green-soft); }
.account-plan-name { font-weight: 800; color: var(--ink); }
.account-plan-when { font-size: 13px; color: var(--muted); }
.account-plan-when:empty { display: none; }
@media (max-width: 560px) { .account-name { display: none; } .account-button { padding-right: 5px; } }
/* A phone has no room for the mascot, the greeting and the Guide and account
   buttons in one row: the buttons get their own row at the top, and the
   greeting the whole width below, so it wraps between words (only a name too
   long for the line breaks inside it). */
@media (max-width: 520px) {
  .home-header { flex-wrap: wrap; gap: 10px 12px; padding-top: 16px; }
  .home-top-actions { order: -1; flex: 1 0 100%; justify-content: flex-end; min-width: 0; }
  .home-top-actions:has(.share-notice) { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .mascot-sun { width: 64px; height: 64px; box-shadow: 0 0 0 6px rgba(255, 217, 120, 0.22), 0 6px 16px rgba(214, 160, 30, 0.2); }
  .mascot-sun .home-mascot { width: 50px; height: 50px; }
  .home-greeting { flex: 1 1 0; min-width: 0; }
  .home-greeting h1 { font-size: 24px; overflow-wrap: anywhere; }
}

/* ---------- High contrast, on a student's own screen ----------
   Set per student by the teacher (Perkins: no one scheme suits everyone).
   A solid background, no gradients, shadows or decoration; bold outlines;
   big, heavy words; pictures keep their own colours. Dark is light on black
   (easier with glare); Light is black on white. */
body.hc-dark { background: #000; }
body.hc-light { background: #fff; }
.class-view.hc-dark, .class-view.hc-light { --hc-gap: 14px; }
.class-view.hc-dark { color: #fff; }
.class-view.hc-light { color: #000; }
.class-view:is(.hc-dark, .hc-light) .mascot-halo,
.class-view:is(.hc-dark, .hc-light) .waiting-hint { display: none; }
.class-view:is(.hc-dark, .hc-light) .question-text,
.class-view:is(.hc-dark, .hc-light) .prompt { font-weight: 900; font-size: clamp(24px, 3.4vw, 34px); }
.class-view.hc-dark :is(.question-text, .prompt, .class-name, .pick-status) { color: #fff; }
.class-view.hc-light :is(.question-text, .prompt, .class-name, .pick-status) { color: #000; }
.class-view.hc-dark :is(.hint, .connection) { color: #e8e8e8; }
.class-view.hc-light :is(.hint, .connection) { color: #222; }
.class-view:is(.hc-dark, .hc-light) .answer-grid { gap: var(--hc-gap); }
/* Cards: one solid colour, a thick outline, the word big and heavy. */
.class-view.hc-dark .answer-card { --card-border: #ffd400; background: #000; color: #fff; border: 5px solid #ffd400; box-shadow: none; }
.class-view.hc-light .answer-card { --card-border: #000; background: #fff; color: #000; border: 5px solid #000; box-shadow: none; }
.class-view:is(.hc-dark, .hc-light) .answer-card:hover { transform: none; box-shadow: none; }
.class-view.hc-dark .answer-card:hover { background: #1a1a1a; }
.class-view.hc-light .answer-card:hover { background: #f2f2f2; }
.class-view:is(.hc-dark, .hc-light) .answer-card .label { font-size: 22px; font-weight: 900; }
.class-view:is(.hc-dark, .hc-light) .answer-card .emoji { filter: none; }
/* Her pick: filled bright yellow, black word. The right one, once shown: a heavy green outline. */
.class-view:is(.hc-dark, .hc-light) .answer-card.selected { background: #ffd400; color: #000; border-color: #ffd400; box-shadow: 0 0 0 5px #fff, 0 0 0 9px #000; }
.class-view.hc-light .answer-card.selected { border-color: #000; box-shadow: 0 0 0 5px #000; }
.class-view:is(.hc-dark, .hc-light) .answer-card.outcome-right { background: #00c853; color: #000; border: 6px solid #00c853; box-shadow: 0 0 0 5px #fff; }
.class-view.hc-light .answer-card.outcome-right { border-color: #000; box-shadow: 0 0 0 5px #000; }
.class-view:is(.hc-dark, .hc-light) .answer-card.outcome-faded { opacity: 0.3; }
/* Pictures (a page, a slide) framed with the same bold outline. */
.class-view.hc-dark :is(.question-picture, .slide-image) { border: 5px solid #ffd400; box-shadow: none; }
.class-view.hc-light :is(.question-picture, .slide-image) { border: 5px solid #000; box-shadow: none; }
/* Buttons she might press: solid, outlined. */
.class-view.hc-dark :is(.question-hear, .words-button, .exit-next, .back-button, .card-hear) { background: #ffd400; color: #000; border: 3px solid #fff; box-shadow: none; }
.class-view.hc-light :is(.question-hear, .words-button, .exit-next, .back-button, .card-hear) { background: #000; color: #fff; border: 3px solid #000; box-shadow: none; }
.class-view:is(.hc-dark, .hc-light) .student-board { background: transparent; }

/* A class's lessons: search, taught lately, then every lesson by topic, folded. */
.lesson-picker-list > li.lesson-picker-body { display: flex; flex-direction: column; gap: 8px; list-style: none; }
.lp-search { width: 100%; box-sizing: border-box; font-size: 14px; padding: 8px 10px; }
.lp-heading { margin: 8px 2px 2px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.lp-topic { border: 1px solid var(--line); border-radius: 12px; background: var(--warm-white); margin-top: 6px; }
.lp-topic > summary { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; cursor: pointer; font-weight: 800; list-style: none; }
.lp-topic > summary::-webkit-details-marker { display: none; }
.lp-topic > summary::before { content: "▸"; color: var(--muted); margin-right: 8px; }
.lp-topic[open] > summary::before { content: "▾"; }
.lp-topic > summary > span:first-child { flex: 1; }
.lp-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lp-topic > .lesson-picker-list { padding: 0 8px 8px; }

.class-view:is(.hc-dark, .hc-light) .pick-status { font-size: 20px; font-weight: 900; }

/* ---------- The Summary tab: a summary, plain ---------- */
.sum-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sum-head h2 { flex: 1; margin: 0; }
.sum-lesson { font-size: 14px; padding: 6px 10px; border-radius: 10px; }
.sum-tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sum-box { background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.sum-box h3 { margin: 0 0 4px; font-size: 17px; }
.sum-table { display: flex; flex-direction: column; }
.sum-questions .sum-th, .sum-questions .sum-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 150px; gap: 12px; align-items: center; }
.sum-students .sum-th, .sum-students .sum-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 56px minmax(0, 1.2fr); gap: 12px; align-items: center; }
.sum-th { padding: 4px 8px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }

.sum-line { border-bottom: 1px solid var(--line); }
.sum-line:last-child { border-bottom: 0; }
.sum-row { padding: 9px 8px; cursor: pointer; list-style: none; border-radius: 8px; }
.sum-row::-webkit-details-marker { display: none; }
.sum-row:hover { background: var(--paper); }
.sum-text { font-weight: 700; overflow-wrap: anywhere; }
.sum-muted { color: var(--muted); font-weight: 600; font-size: 13px; }
.sum-num { font-weight: 800; font-variant-numeric: tabular-nums; }
.sum-right { display: flex; align-items: center; gap: 8px; }
.sum-bar { flex: 1; height: 9px; border-radius: 999px; background: #f0e9db; overflow: hidden; }
.sum-bar i { display: block; height: 100%; background: #43a047; border-radius: 999px; }
.sum-dots { display: flex; flex-wrap: wrap; gap: 4px; }
.sum-dots i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.dot-right { background: #43a047; }
.dot-wrong { background: #e5334a; }
.dot-answered { background: #b9b2a5; }
.dot-no_answer, .dot-away { border: 1.5px solid #c9c1b2; }
.dot-not_in_class { display: none !important; }
.sum-cards { list-style: none; margin: 0 0 10px; padding: 4px 8px 4px 22px; display: flex; flex-direction: column; gap: 4px; }
.sum-cards li { display: grid; grid-template-columns: minmax(0, 1.2fr) 40px minmax(0, 1.4fr); gap: 10px; font-size: 14px; }
.sum-students .sum-cards li { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.sum-cards li.right .sum-card-label, .sum-cards li.right .sum-who { color: #2e7d32; font-weight: 700; }
.sum-cards li.wrong .sum-who { color: #c62839; }
.sum-cards li.sum-muted { display: block; }
.sum-who { color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
.sum-foot { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.sum-note { margin: 4px 2px 0; font-size: 14.5px; color: var(--muted); font-weight: 600; }
@media (max-width: 640px) {
  .sum-tiles.three { grid-template-columns: minmax(0, 1fr); }
  .sum-questions .sum-th, .sum-questions .sum-row { grid-template-columns: minmax(0, 1fr) 60px 100px; }
  .sum-students .sum-th, .sum-students .sum-row { grid-template-columns: minmax(0, 1fr) 64px 40px; }
  .sum-students .sum-th span:last-child, .sum-students .sum-row .sum-dots { display: none; }
}

/* The teacher's screen uses the whole screen: the stage is as tall as the
   window allows, not just its content. */
@media (min-width: 900px) {
  .teach-main .no-question:not([hidden]) { min-height: calc(100vh - 230px); display: flex; flex-direction: column; }
  .teach-main .no-question .idle-stage:not([hidden]) { flex: 1; display: flex; flex-direction: column; justify-content: center; }
}
/* Summary: the time choice on its heading line; Questions and Students side by side when there's room. */
.sum-head .summary-range .segmented { margin: 0; }
.summary-range:empty { display: none; }
.sum-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
@media (min-width: 1200px) { .sum-columns { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.sum-tile-value { font-variant-numeric: tabular-nums; }
/* Some room at the sides now that the teacher's page is as wide as the window. */
.page:has(> #view-class:not([hidden]) .teacher-view) { padding-inline: clamp(12px, 2vw, 32px); box-sizing: border-box; }

/* ---------- Summary, readable ---------- */
.sum-tile.blue .sum-tile-value { color: var(--blue-dark); }
.sum-tile { border-top: 4px solid var(--line); }
.sum-tile.good { border-top-color: #43a047; }
.sum-tile.mid { border-top-color: #e0a526; }
.sum-tile.low { border-top-color: #e5334a; }
.sum-tile.blue { border-top-color: var(--blue); }
/* Sections: a lesson (or a day's lesson), folded when the list is long. */
.sum-section { border-bottom: 1px solid var(--line); }
.sum-section:last-child { border-bottom: 0; }
.sum-section-head { display: flex; align-items: center; gap: 10px; padding: 12px 8px 8px; cursor: pointer; list-style: none; }
.sum-section-head::-webkit-details-marker { display: none; }
.sum-section-head::before { content: "▸"; color: var(--muted); font-size: 13px; }
.sum-section[open] > .sum-section-head::before { content: "▾"; }
.sum-section-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink); }
.sum-chip { padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.sum-chip.good { background: #e5f6e1; color: #2e7d32; }
.sum-chip.mid { background: #fdf3d6; color: #8a6d12; }
.sum-chip.low { background: #fbe7e9; color: #c62839; }
.sum-section > .sum-line { margin-left: 14px; }
.sum-qnum { display: inline-block; min-width: 2.2em; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
/* No ring around a row that's open; the keyboard still gets one. */
.sum-row:focus { outline: none; }
.sum-row:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.sum-line[open] > .sum-row { background: var(--blue-soft); }
/* Students: a dot per question when there are few; a bar of how they went when many. */
.dot-answered { background: var(--blue) !important; }
.sum-stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: #f0e9db; }
.sum-stack i { display: block; height: 100%; }
.sum-stack .dot-no_answer { background: #e7e0d2; border: 0; }
.sum-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.sum-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sum-legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
/* A student's answers: numbered, grouped, each answer a coloured chip. */
.sum-answers { padding: 4px 8px 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.sum-answers-head { margin: 10px 0 4px; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.sum-answer { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 8px; font-size: 14px; }
.sum-answer:nth-child(even) { background: #fcfaf5; }
.sum-answer.no_answer .sum-answer-q { color: var(--muted); }
.sum-answer-q { overflow-wrap: anywhere; }
.sum-pick { padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 13px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.sum-pick.right { background: #e5f6e1; color: #2e7d32; }
.sum-pick.wrong { background: #fbe7e9; color: #c62839; }
.sum-pick.answered { background: var(--blue-soft); color: var(--blue-dark); }
.sum-pick.no_answer, .sum-pick.away { background: none; color: var(--muted); font-weight: 600; }
.sum-answer-note { margin: 8px 0 0; }

/* Home: as wide as the screen allows, like the teacher's class page. */
.page:has(> #view-home:not([hidden])) { max-width: min(1600px, 100%); padding-inline: clamp(12px, 2vw, 32px); box-sizing: border-box; }

.sum-day { margin: 14px 8px 2px; font-size: 14px; font-weight: 900; color: var(--ink); }
.sum-table > .sum-day:first-of-type { margin-top: 6px; }
.sum-answers-day { margin: 14px 0 2px; font-size: 13.5px; font-weight: 900; color: var(--ink); }

/* ---------- Summary: the Questions, easier to read ---------- */
.sum-questions .sum-th, .sum-questions .sum-row { grid-template-columns: minmax(0, 1fr) 76px 170px; }
.sum-day { display: inline-flex; align-self: flex-start; margin: 16px 0 6px; padding: 4px 12px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 800; letter-spacing: 0.01em; }
.sum-table > .sum-day:first-of-type { margin-top: 8px; }
.sum-questions .sum-section { margin: 4px 0 8px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; overflow: hidden; }
.sum-questions .sum-section-head { padding: 10px 12px; background: var(--warm-white); }
.sum-questions .sum-section[open] > .sum-section-head { border-bottom: 1px solid var(--line); }
.sum-questions .sum-section-title { font-size: 15px; font-weight: 800; letter-spacing: 0; text-transform: none; }
.sum-questions .sum-section > .sum-line { margin-left: 0; border-bottom: 1px solid #f1ebdf; }
.sum-questions .sum-section > .sum-line:last-child { border-bottom: 0; }
.sum-questions .sum-row { padding: 10px 12px; }
.sum-text { display: flex; align-items: flex-start; gap: 10px; }
.sum-qbadge { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 1px solid var(--line); font-size: 12px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 1px; }
.sum-qtext { font-size: 15px; font-weight: 700; line-height: 1.35; }
.sum-tag { padding: 2px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-size: 12px; font-weight: 800; }
.sum-right .sum-muted { font-size: 12.5px; }
.sum-bar.good i { background: #43a047; }
.sum-bar.mid i { background: #e0a526; }
.sum-bar.low i { background: #e5334a; }
.sum-right .sum-num { min-width: 46px; text-align: right; font-size: 13.5px; }
.sum-questions .sum-cards { padding: 4px 14px 12px 46px; }
/* Answered but none right: the bar's track is pale red, not the same as nobody answering. */
.sum-bar.low { background: #fbe0e3; }
.sum-bar.mid { background: #fbefd0; }

/* ---------- The class's top bar: quiet tools, a status when something's on screen ---------- */
.top-tools { display: flex; align-items: center; gap: 6px; }
.top-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 0; padding: 8px 12px; border-radius: 10px; background: var(--warm-white); border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 800; box-shadow: none; }
.top-tool:hover { border-color: var(--blue-line); color: var(--blue-dark); }
.top-tool .icon { color: var(--muted); }
.board-toggle.on { background: var(--sun-soft); border-color: #f0d98a; }
.lesson-controls[hidden] { display: none; }
.lesson-menu { right: 0; left: auto; min-width: 250px; }
.lesson-menu-title { margin: 6px 12px 8px; font-size: 13px; font-weight: 800; color: var(--muted); }
.on-screen { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; border-radius: 999px; background: #fdecee; border: 1px solid #f3c2c8; color: #a1202f; font-size: 13.5px; font-weight: 800; }
.on-screen[hidden] { display: none; }
.on-screen-dot { width: 9px; height: 9px; border-radius: 50%; background: #e5334a; box-shadow: 0 0 0 0 rgba(229, 51, 74, 0.5); animation: on-air 1.8s ease-out infinite; }
@keyframes on-air { 0% { box-shadow: 0 0 0 0 rgba(229, 51, 74, 0.5); } 80%, 100% { box-shadow: 0 0 0 7px rgba(229, 51, 74, 0); } }
@media (prefers-reduced-motion: reduce) { .on-screen-dot { animation: none; } }
.on-screen-stop { min-height: 0; padding: 5px 12px; border-radius: 999px; background: #e5334a; border: 0; color: #fff; font-size: 13px; font-weight: 800; box-shadow: none; }
.on-screen-stop:hover { background: #c62839; }

/* Summary: Answered / Right label each open lesson's rows, inside its card. */
.sum-questions > .sum-th { display: none; }
.sum-section .sum-th { display: grid; grid-template-columns: minmax(0, 1fr) 76px 170px; gap: 12px; padding: 6px 12px; border-bottom: 1px solid #f1ebdf; font-size: 11.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: #fffdf9; }

/* The legend: each state, and what it means. */
.sum-legend-wrap { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
ul.sum-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
ul.sum-legend li { display: flex; align-items: baseline; gap: 6px; }
ul.sum-legend li i { flex: none; align-self: center; }
ul.sum-legend strong { color: var(--ink); white-space: nowrap; }
.sum-stack .dot-answered { background: var(--blue); }
.sum-pick.answered::before { content: "Took part: "; font-weight: 600; opacity: 0.8; }

/* ---------- Words tab: one group at a time ---------- */

.word-filter { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; background: rgba(0, 0, 0, 0.04); border-radius: 14px; align-self: flex-start; position: sticky; top: 0; z-index: 2; }
.word-filter-pill { display: inline-flex; align-items: center; gap: 6px; background: none; color: var(--muted); border-radius: 11px; padding: 7px 14px; font-size: 14px; white-space: nowrap; box-shadow: none; min-height: 0; }
.word-filter-pill:hover { background: rgba(255, 255, 255, 0.6); }
.word-filter-pill:active { transform: none; box-shadow: none; }
.word-filter-pill[aria-pressed="true"] { color: var(--ink); background: var(--warm-white); box-shadow: var(--shadow-s); }
.word-filter-count { font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: rgba(0, 0, 0, 0.06); }
.card-remove-button { position: absolute; right: -6px; top: -6px; width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%; font-size: 15px; line-height: 1; background: var(--warm-white); color: var(--muted); border: 2px solid var(--line); box-shadow: var(--shadow-s); z-index: 2; }
.card-remove-button:hover { color: var(--coral-dark); border-color: var(--coral); }
.ws-kind-select { font: inherit; font-size: 14px; border-radius: 10px; border: 1px solid var(--line); padding: 6px 8px; align-self: flex-start; }
.ws-add-question { align-self: flex-start; }

/* ---------- A lesson's book, slides or worksheet ---------- */

.le-source { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; padding: 10px 14px; background: var(--warm-white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); }
.le-source[hidden] { display: none; }
.le-source-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; min-width: 0; }
.le-source-label strong { color: var(--ink); }
.le-source-buttons { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.library-dates { font-size: 12.5px; color: var(--muted); font-weight: 600; opacity: 0.85; }
.doc-dates { font-size: 13px; color: var(--muted); font-weight: 600; padding-left: 2px; }
.doc-dates:empty { display: none; }
.editable-picture { cursor: pointer; transition: box-shadow 0.15s; }
.editable-picture:hover { box-shadow: 0 0 0 3px var(--blue-line); }

/* ---------- AAC boards ----------
   A light AAC in the style of the MaTalk AI app: a sentence bar on top, and
   tiles with a picture and the word in bold, using the Modified Fitzgerald
   key for both their background and border. Sizes follow each tile (container queries), so the
   same board reads on a laptop, beside a lesson, and full screen on the
   smartboard. */

.aac { display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 0; }
.aac-bar { display: flex; align-items: center; gap: 8px; }
.aac-lead:empty, .aac-trail:empty { display: none; }
.aac-sentence { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; height: 62px; padding: 0 4px 0 10px; background: var(--warm-white); border: 2px solid #4a90d9; border-radius: 20px; }
.aac-sentence.saying { animation: aac-saying 0.7s ease; }
@keyframes aac-saying { 0% { box-shadow: 0 0 0 0 rgba(41, 212, 20, 0.55); } 100% { box-shadow: 0 0 0 16px rgba(41, 212, 20, 0); } }
.aac-words { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.aac-words::-webkit-scrollbar { display: none; }
.aac-placeholder { font-style: italic; color: var(--muted); font-size: 15px; white-space: nowrap; }
.aac-chip { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 4px; border-radius: 10px; background: var(--blue-soft); font-size: 18px; font-weight: 800; white-space: nowrap; }
.aac-chip img { width: 32px; height: 32px; object-fit: contain; }
.aac-chip-emoji { font-size: 22px; }
.aac-say { flex: none; width: 44px; height: 44px; min-height: 0; padding: 0; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; box-shadow: none; }
.aac-say:hover { background: var(--green-dark); }
.aac-say .icon { fill: currentColor; margin-left: 2px; }
.aac-divider { flex: none; width: 3px; height: 34px; margin: 0 2px; border-radius: 2px; background: #4a90d9; }
.aac-back, .aac-clear { flex: none; width: 44px; height: 44px; min-height: 0; padding: 0; background: none; color: var(--ink); font-size: 24px; box-shadow: none; }
.aac-back:hover, .aac-clear:hover { background: var(--blue-soft); }
.aac-edit-toggle { flex: none; width: 54px; height: 54px; min-height: 0; padding: 0; display: grid; place-items: center; background: #f8f9fa; color: #333; border: 0; border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.aac-edit-toggle:hover { background: #ececef; }
.aac-edit-toggle[aria-pressed="true"] { background: #dc3545; border-color: #dc3545; color: #fff; }

.aac-editbar { display: grid; gap: 10px; padding: 8px 10px; background: var(--warm-white); border: 1px solid var(--line); border-radius: 14px; }
.aac-grid-settings, .aac-grid-size, .aac-edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.aac-grid-settings { justify-content: space-between; }
.aac-stepper, .aac-action-group { display: inline-flex; align-items: center; gap: 6px; }
.aac-action-group { flex-wrap: wrap; }
.aac-ai-actions { padding-left: 10px; border-left: 1px solid var(--line); }
.aac-save-actions { margin-left: auto; }
.aac-color-key { font-size: 12px; color: var(--muted); }
.aac-color-key summary { cursor: pointer; font-weight: 700; padding: 5px 0; }
.aac-color-legend { display: flex; flex-wrap: wrap; gap: 6px; max-width: 560px; padding-top: 6px; }
.aac-key-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.aac-key-item::before { content: ""; width: 13px; height: 13px; border-radius: 3px; background: var(--key-colour); border: 1px solid var(--key-edge); }
@media (max-width: 700px) {
  .aac-save-actions { width: 100%; justify-content: flex-end; }
  .aac-ai-actions { border-left: 0; padding-left: 0; }
}
.aac-edit-label { font-size: 13px; font-weight: 800; color: var(--muted); margin-left: 4px; }
.aac-count { min-width: 22px; text-align: center; font-weight: 800; }
.aac-step { width: 32px; height: 32px; min-height: 0; padding: 0; font-size: 18px; }
.aac-presets { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--warm-white); font-size: 13px; }
.aac-editbar button.small { padding: 6px 12px; min-height: 0; font-size: 13px; }
.aac-editbar button.secondary, .aac-empty-ai, .aac-pane-tools button.secondary, .aac-view .doc-actions button.secondary { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; color: #333; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); font-weight: 600; }
.aac-editbar button.secondary:hover:not(:disabled), .aac-empty-ai:hover, .aac-pane-tools button.secondary:hover, .aac-view .doc-actions button.secondary:hover { background: #e9ecef; }
.aac-editbar button:not(.secondary) { background: #007bff; border-radius: 8px; font-weight: 600; }
.aac button:focus-visible, .aac-view .doc-actions button:focus-visible { outline: 3px solid #4a90d9; outline-offset: 3px; }
.aac-editbar button:disabled { opacity: 0.5; }
.aac-editbar .icon { display: inline-block; vertical-align: -2px; }
.aac-save-status { font-size: 12px; color: var(--muted); min-width: 64px; text-align: right; }
.aac-hint { margin: 0; font-size: 13px; }
.aac-banner { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--sun-soft); border: 1px solid #f4dc8a; font-weight: 600; }
.aac-banner-text { flex: 1; min-width: 0; }
.aac-error:empty { display: none; }

/* Sized by its tiles' shape, and shrinks to fit (it is also the .aac-grid).
   Its box is the space it can have. */
.aac-board-box { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; }
.aac-board { flex: 0 1 auto; min-height: 0; }
/* On its own screen, the board is only as wide as 4:3 tiles of the full
   height, so a wide screen keeps the tiles' shape (centred) instead of
   stretching them. */
.aac-view .aac-board-box, .aac-pane .aac-board-box { container-type: size; }
.aac-view .aac-board { width: min(100%, 100cqh * var(--aac-columns, 6) * var(--tile-w) / (var(--aac-rows, 5) * var(--tile-h))); }
/* Beside a lesson (hers, the students', the smartboard's) the board fills
   its pane as far as it can, its tiles anywhere from 4:3 (flat) to 2:3
   (tall), never stretched beyond: as wide as the pane allows (but no wider
   than flat tiles of the full height), then as tall as allowed (but no taller
   than tall tiles of that width). A tall pane no longer leaves half empty, an
   iPad split pane no longer makes thin or flat tiles. */
.aac-pane .aac-board {
  --board-w: min(100cqw, 100cqh * var(--aac-columns, 6) / (var(--aac-rows, 5) * 0.75));
  width: var(--board-w); height: min(100cqh, var(--board-w) * var(--aac-rows, 5) * 1.5 / var(--aac-columns, 6));
  aspect-ratio: auto; max-height: none;
}
/* Tiles are 4:3, the shape of the pictures: in a tall, narrow pane the
   board sits at the top; in a wide one it fills the height. */
.aac-grid { --tile-w: 4; --tile-h: 3; display: grid; grid-template-columns: repeat(var(--aac-columns, 6), minmax(0, 1fr)); grid-template-rows: repeat(var(--aac-rows, 5), minmax(0, 1fr)); gap: 6px; width: 100%; aspect-ratio: calc(var(--aac-columns, 6) * var(--tile-w) / (var(--aac-rows, 5) * var(--tile-h))); max-height: 100%; min-height: 0; margin: 0 auto; }
/* On a phone the tiles are small and a 4:3 tile is so short that the word
   covers half the picture: taller tiles, with the whole picture above it. */
@media (max-width: 600px) { .aac-grid { --tile-w: 1; --tile-h: 1.5; } }
/* In a pane, its own width decides, not the screen's: a narrow pane (an iPad
   in split screen, the board beside the question) gets the taller tiles, a
   wide one (the board under the question) keeps 4:3. */
@container (max-width: 420px) { .aac-grid { --tile-w: 1; --tile-h: 1.5; } }
@container (min-width: 421px) { .aac-grid { --tile-w: 4; --tile-h: 3; } }
.aac-tile { position: relative; container-type: size; display: flex; flex-direction: column; align-items: stretch; min-width: 0; min-height: 0; padding: 0; background: #fff; color: #000; border: 4px solid var(--tile-edge, #9e9e9e); border-radius: 8px; box-shadow: 0 6px 8px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.08); overflow: hidden; font-weight: 900; text-align: center; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button.aac-tile:hover { background: #fff; filter: brightness(0.97); }
button.aac-tile:active { opacity: 0.7; transform: scale(0.98); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.aac-art { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0; overflow: hidden; }
.aac-art img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
/* A 4:3 picture (marked by aac-board.js) in a tile of about that shape
   fills it edge to edge (a sliver is cropped at most). Any other picture or
   tile shape shows the whole picture. */
@container (min-aspect-ratio: 6 / 5) and (max-aspect-ratio: 3 / 2) { .aac-art img.is-4x3 { object-fit: cover; } }
.aac-emoji { font-size: min(52cqh, 56cqw); line-height: 1; font-weight: 400; }
.aac-math { font-size: min(44cqh, 40cqw); color: var(--ink); }
.aac-label { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 3px 4px; font-size: clamp(10px, min(12cqh, 10cqw), 26px); font-weight: 600; line-height: 1.15; white-space: normal; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; background: color-mix(in srgb, var(--tile-colour, #fff) 70%, transparent); color: #000; }
.aac-tile.empty { background: transparent; border: 0; box-shadow: none; cursor: default; }
.aac-grid.editing .aac-tile.empty { background: #f0f0f0; border: 3px dashed #bdbdbd; cursor: pointer; }
.aac-add { margin: auto; font-size: min(40cqh, 40px); font-weight: 400; color: var(--muted); }
.aac-tile.is-hidden { opacity: 0.5; background-image: repeating-linear-gradient(45deg, transparent 0 8px, rgba(0, 0, 0, 0.06) 8px 16px); }
.aac-tools { position: absolute; top: 3px; right: 3px; display: flex; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 6px); gap: 3px; }
.aac-tool { width: clamp(16px, 20cqw, 26px); height: clamp(16px, 20cqw, 26px); display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: clamp(9px, 12cqw, 12px); font-weight: 400; cursor: pointer; }
.aac-tool:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.aac-tool:hover { background: rgba(0, 0, 0, 0.85); }
/* Small tiles keep Edit (and Open for folders). Hide and Remove remain
   available in the editor, without covering the picture and word. */
@container (max-width: 80px) {
  .aac-tools .aac-tool:nth-last-child(-n+2) { display: none; }
}
.aac-grid.editing .aac-tile:not(.empty) { cursor: grab; touch-action: none; }
.aac-grid.editing button.aac-tile:active { transform: none; }
.aac-tile.tapped { animation: aac-tap 0.45s ease; }
@keyframes aac-tap { 0% { transform: scale(1); } 30% { transform: scale(0.93); box-shadow: 0 0 0 5px var(--tile-edge, var(--blue)); } 100% { transform: scale(1); } }
/* The teacher's tap, on the class's screens. */
.aac-tile.modelled { outline: 5px solid var(--sun); outline-offset: 2px; z-index: 1; }
.aac-tile.dragging { opacity: 0; }
.aac-tile.wb-ghost { opacity: 1; border-radius: 8px; margin: 0; }
.aac-tile.wb-ghost.landing { transition: none !important; }
.aac-tile.drop-target { outline: 4px solid var(--blue); outline-offset: 2px; }
.aac-grid.is-dragging .aac-tile:not(.dragging) { transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.aac-grid.is-dragging, .aac-grid.is-dragging * { cursor: grabbing !important; }
.aac-tile.just-moved { animation: wb-moved 0.7s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .aac-tile.tapped, .aac-tile.just-moved, .aac-sentence.saying { animation: none; }
}

/* The smartboard: a bigger sentence, read from across the room. */
.aac-display .aac-sentence { height: 76px; }
.aac-display .aac-chip { font-size: 26px; }
.aac-display .aac-chip img { width: 44px; height: 44px; }
.aac-display .aac-say, .aac-display .aac-back, .aac-display .aac-clear { width: 48px; height: 48px; }
.aac-display .aac-tile { cursor: default; }

/* Editing a tile, finding words, organising. */
.aac-preview { width: 120px; height: 120px; flex: none; }
.aac-picture-tools { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.aac-emoji-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.aac-emoji-input { width: 64px; font-size: 22px; text-align: center; padding: 4px; border: 1px solid var(--line); border-radius: 10px; }
.aac-hide-row { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; font-size: 14px; }
.aac-search { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; }
.aac-filters { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.aac-filters .chip.selected, .aac-ideas .chip.selected { background: var(--blue); color: #fff; border-color: var(--blue); }
.aac-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.aac-result { position: relative; container-type: size; height: 100px; display: flex; flex-direction: column; padding: 0; min-height: 0; background: #fff; color: #000; border: 2.5px solid var(--tile-edge, #9a9a9a); border-radius: 8px; box-shadow: var(--shadow-s); overflow: hidden; font-weight: 800; }
.aac-result:hover { background: #fff; filter: brightness(0.96); }
.aac-result.on-board { opacity: 0.55; }
.aac-new-word:empty { display: none; }
.aac-new-word { margin: 4px 0 10px; }
.aac-finder-status:empty { display: none; }
.aac-organize-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; resize: vertical; }
.aac-ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.aac-ideas .chip { text-align: left; }
.aac-import-choice { width: 100%; margin-bottom: 10px; }
.aac-cover-emoji { font-size: 22px; }

/* ---------- Beside the lesson ----------
   The AAC pane on the side the teacher chose. Without one, the split is
   just the screen as it always was. */
.aac-split { display: flex; align-items: flex-start; gap: 14px; }
.aac-split > .teach-layout, .aac-split > .class-view { flex: 1; min-width: 0; }
/* The student and smartboard screens stay as tall as the screen, as before. */
.aac-split-class { flex: 1; align-items: stretch; }
.aac-split-class > .aac-pane { align-self: flex-start; }
.aac-pane { flex: 0 0 clamp(340px, 44%, 980px); position: sticky; top: 8px; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); display: flex; flex-direction: column; gap: 8px; padding: 8px; background: #f4f4f6; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.aac-split > .aac-pane { order: 2; }
.aac-split[data-side="left"] > .aac-pane { order: -1; }
.aac-pane.presented { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft), var(--shadow); }
/* As tall as the board needs, up to the screen: everything inside shrinks to fit. */
.aac-pane-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.aac-pane-body > .aac { flex: 1 1 auto; height: auto; }
.aac-pane-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.aac-pane-title { font-weight: 800; }
.aac-pane-note { font-size: 12px; color: var(--muted); }
.aac-pane.presented .aac-pane-note { color: var(--green-dark); font-weight: 700; }
.aac-pane-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.aac-pane-tools button.small { padding: 6px 12px; min-height: 0; font-size: 13px; }
.aac-pane-tools .icon { display: inline-block; vertical-align: -2px; }
.aac-close { flex: none; width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 10px; background: var(--warm-white); color: var(--ink); border: 1px solid var(--line); box-shadow: none; font-size: 14px; }
.aac-close:hover { background: var(--blue-soft); }
/* Under the class's header, the whole board in view without scrolling. */
.teacher-view .aac-pane { max-height: calc(100vh - var(--aac-offset, 120px) - 10px); max-height: calc(100dvh - var(--aac-offset, 120px) - 10px); }
/* The teacher's lesson rail moves under the stage, to make room. */
.teacher-view.with-aac .aac-split .teach-layout { grid-template-columns: minmax(0, 1fr); }
.aac-toggle.on { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
/* A phone, or a tablet held upright: the board goes above the lesson (left)
   or under it (right), the full width. */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  .aac-split { flex-direction: column; align-items: stretch; }
  /* About half the screen: the question and its cards stay in view too. */
  .aac-split > .aac-pane, .teacher-view .aac-pane { flex: none; position: static; max-height: 55vh; max-height: 55dvh; }
}

/* ---------- On its own ---------- */
.page:has(> #view-aac:not([hidden])) { max-width: none; }
.aac-view { display: flex; flex-direction: column; gap: 8px; height: 100vh; height: 100dvh; padding: 0 4px 8px; }
.aac-view .av-panel { flex: 1; min-height: 0; }
.aac-view .av-panel:empty { display: none; }
.aac-view .aac-bar { flex-wrap: wrap; padding: 8px 0 0; }
.aac-view .aac-lead { display: flex; align-items: center; gap: 10px; flex: 0 1 240px; min-width: 160px; }
.aac-view .aac-lead .doc-titles { flex-basis: auto; }
.aac-view .aac-sentence { flex: 1 1 360px; }
.aac-view .aac-trail { flex: none; }
.aac-view .aac-trail .doc-actions { width: auto; flex-wrap: nowrap; }
.aac-view .aac-bar .aac-edit-toggle { height: 54px; }
@media (max-width: 700px) {
  .aac-view .aac-lead { flex: 1 1 100%; }
  .aac-view .aac-sentence { flex: 1 1 260px; order: 2; }
  .aac-view .aac-nav { order: 1; }
  .aac-view .aac-trail { order: 1; }
  .aac-view .aac-bar .aac-edit-toggle { order: 1; margin-left: auto; }
}
.av-start { padding: 8px 4px; }
.av-size { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; font-weight: 700; }
.av-size select { height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--warm-white); }
.av-from-sub { font-size: 13px; font-weight: 500; text-align: center; }
.av-error:empty { display: none; }
body.aac-full .aac-view-head, body.aac-full .aac-view .aac-lead, body.aac-full .aac-view .aac-trail { display: none; }
body.aac-full .aac-view { padding: 8px; }
body.aac-full .page { padding: 0; }
.av-exit-full { position: fixed; top: 10px; right: 10px; z-index: 60; width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; background: rgba(43, 42, 51, 0.7); color: #fff; box-shadow: none; }

/* ---------- AAC folders, building, and students' words ---------- */
/* The native AAC grid uses a dark folder frame, cream caption and inset tab. */
.aac-tile.is-folder { border-color: #222; border-width: 4px; overflow: hidden; background: #fff8e7; }
.aac-tile.is-folder .aac-label { background: rgba(255, 248, 231, 0.85); border-top: 2px solid #222; font-weight: 800; text-transform: uppercase; }
.aac-folder-tab { position: absolute; left: 0; top: 0; width: 60%; height: 12%; min-height: 8px; background: rgba(140, 137, 129, 0.8); border-right: 5px solid #4d4d4a; border-bottom: 5px solid #4d4d4a; border-radius: 0 2px 12px 0; z-index: 1; pointer-events: none; }
.aac-tile.is-folder::before { content: ""; position: absolute; inset: 0 0 auto; height: 12%; background: rgba(255, 248, 231, 0.8); pointer-events: none; }
.aac-tools { z-index: 2; }
.aac-nav { display: flex; align-items: center; gap: 4px; flex: none; }
.aac-home, .aac-up { width: 48px; height: 48px; min-height: 0; padding: 0; font-size: 28px; background: #f8f9fa; color: #333; border: 0; border-radius: 10px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.aac-home:hover, .aac-up:hover { background: var(--blue-soft); }
.aac-page-name { max-width: 14ch; padding: 6px 10px; border-radius: 10px; background: #fff7e3; border: 2px solid #1b1b1f; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aac-display .aac-page-name { font-size: 20px; }
.aac-display .aac-home, .aac-display .aac-up { display: none; }
.aac-open-folder { width: 100%; margin-bottom: 8px; }
.aac-move-to { width: 100%; height: 38px; }
.aac-finder-folder { margin: 8px 0 0; }
.aac-build-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.aac-build-kinds .chip.selected { background: var(--blue); color: #fff; border-color: var(--blue); }
.aac-build-list { max-height: 34vh; overflow: auto; }
.aac-build-list .side-lesson.selected { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 2px var(--blue-line); }
.aac-build-from input, .aac-build-from textarea, .aac-build-extra { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.aac-build-status:empty { display: none; }
.aac-build-scope { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.aac-choose-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.aac-choose-actions .icon { display: inline-block; vertical-align: -2px; }
.aac-students { flex: none; max-height: 28%; overflow: auto; padding: 6px 8px; background: var(--warm-white); border: 1px solid var(--line); border-radius: 12px; }
.aac-students-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.aac-students-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.aac-student { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 8px; opacity: 0.7; }
.aac-student.fresh { opacity: 1; background: var(--sun-soft); }
.aac-student-name { flex: none; min-width: 64px; font-weight: 800; font-size: 13px; }
.aac-student-words { display: flex; flex-wrap: wrap; gap: 4px; }
.aac-student-words .aac-chip { font-size: 13px; padding: 2px 7px; }

/* AAC teaching tools stay compact beside a lesson. */
.aac-more-tools { flex: 1; min-width: 0; }
.aac-more-tools > summary { display: none; }
.aac-tools-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.aac-save-status { white-space: nowrap; }
.aac-save-status:empty { display: none; }
.aac-pane { container-type: inline-size; }
.aac-pane .aac-bar { flex-wrap: wrap; gap: 6px; }
.aac-pane .aac-nav { flex-basis: 100%; }
.aac-pane .aac-sentence { height: 54px; padding-inline: 6px; }
.aac-pane .aac-placeholder { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.aac-pane .aac-say, .aac-pane .aac-back, .aac-pane .aac-clear { width: 34px; height: 34px; font-size: 21px; }
.aac-pane .aac-edit-toggle { width: 42px; height: 42px; }
.aac-pane .aac-editbar { gap: 6px; padding: 6px; }
.aac-pane .aac-edit-actions { flex-wrap: nowrap; gap: 4px; }
.aac-pane .aac-more-tools { position: relative; flex: none; }
.aac-pane .aac-more-tools > summary { display: block; padding: 6px 8px; background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.aac-pane .aac-tools-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: min(360px, calc(100cqw - 30px)); padding: 12px; background: var(--warm-white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-l); }
.aac-pane .aac-save-actions { gap: 4px; flex-wrap: nowrap; margin-left: auto; width: auto; }
.aac-pane .aac-editbar button.small { padding: 6px 8px; font-size: 12px; }
.aac-pane .aac-save-status { min-width: 0; font-size: 10px; }
.aac-pane .aac-hint { font-size: 11px; }
.aac-pane .aac-ai-actions { border: 0; padding: 0; }
.aac-pane .aac-capacity { margin: 0; font-size: 11px; }
.teacher-view .aac-pane { height: calc(100dvh - var(--aac-offset, 120px) - 10px); }
/* Student attempts occupy a lesson-side strip, never the AAC pane. */
.teach-main > .aac-students { order: 3; flex: none; max-height: 100px; padding: 8px; }
.teach-main .aac-students-head { font-size: 12px; }
.teach-main .aac-students-list { flex-direction: row; overflow-x: auto; gap: 8px; }
.teach-main .aac-student { flex: none; max-width: 380px; }
.teach-main .aac-student-words { flex-wrap: nowrap; overflow-x: auto; }
/* Students and presenter use the available screen width and height. */
.page:has(> #view-class:not([hidden]) .aac-split-class) { max-width: none; padding: 8px; }
#view-class > .aac-split-class { min-height: calc(100dvh - 16px); }
/* The split is the screen's height already: the view's own full height and
   foot made the page scroll a few pixels. */
#view-class:has(> .aac-split-class) { min-height: 0; padding-bottom: 0; }
.aac-split-class.with-aac > .aac-pane { height: calc(100dvh - 16px); max-height: none; align-self: stretch; }
.aac-split-class.with-aac .aac-pane-body > .aac { height: 100%; }
.aac-split-class .class-view { min-height: 0; min-width: 0; }
.aac-split-class .class-view > .answer-grid.few { grid-template-columns: repeat(var(--count, 2), minmax(0, 1fr)); }
/* A question with a picture (a book page, a worksheet) beside the board:
   three columns on one screen. The question gets half the room, and its
   cards come in a grid of smaller ones, so they all fit without scrolling (a
   smartboard has no one to scroll it). */
@media (min-width: 820px) and (orientation: landscape) {
  .aac-split-class.with-aac .class-view.has-picture:not(.teacher-view) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; }
  /* The card's picture is as big as three rows of cards allow on this
     screen's height: small on an iPad, full size on a big smartboard. */
  .aac-split-class.with-aac .class-view.has-picture:not(.teacher-view) > .answer-grid { --card-pic: clamp(80px, calc((100dvh - 380px) / 3), 150px); }
  .aac-split-class.with-aac .class-view.has-picture:not(.teacher-view) > .answer-grid:not([hidden]) { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(calc(var(--card-pic) + 40px), calc(50% - 5px)), 1fr)); gap: 10px; }
  .aac-split-class.with-aac .class-view.has-picture:not(.teacher-view) > .answer-grid > * { min-width: 0; }
  .aac-split-class.with-aac .class-view.has-picture:not(.teacher-view) > .answer-grid .answer-card { padding: 8px; }
  .aac-split-class.with-aac .class-view.has-picture:not(.teacher-view) > .answer-grid .card-picture { max-width: var(--card-pic); }
  .aac-split-class.with-aac .class-view.has-picture:not(.teacher-view) > .answer-grid .label { font-size: 17px; }
}
/* With the board under the question there's less room: smaller cards, so two
   still fit on a row (one a row in a narrow iPad split pushed the board off
   the screen). */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  .aac-split-class.with-aac .class-view > .answer-grid:not(.few) > .answer-card,
  .aac-split-class.with-aac .class-view > .answer-grid:not(.few) > .card-hear-wrap { flex-basis: 150px; min-width: 120px; }
}
.aac-split-class .class-view > .student-slide { flex: 1; min-height: 0; }
.aac-split-class .student-slide .slide-image { max-height: calc(100dvh - 110px); width: 100%; object-fit: contain; }
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  .aac-split-class.with-aac > .aac-pane, .teacher-view .aac-pane { height: 55dvh; max-height: 55dvh; }
  .aac-split-class .class-view { min-height: 45dvh; }
}
/* AI flows: readable goal cards, visible guidance, and a review before applying. */
.aac-ai-guidance { padding: 12px; border-radius: 12px; background: var(--blue-soft); font-size: 14px; line-height: 1.45; }
.aac-ideas { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 16px; }
.aac-ai-option { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 12px; text-align: left; background: var(--warm-white); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
.aac-ai-option:hover, .aac-ai-option[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); }
.aac-ai-option > span { font-size: 13px; font-weight: 400; line-height: 1.4; color: var(--muted); }
.aac-ai-option .aac-recommended { font-size: 11px; color: var(--blue-dark); font-weight: 700; }
.aac-ai-preview { max-height: 55dvh; aspect-ratio: 1; margin-top: 12px; }
.aac-build-flow { display: grid; gap: 8px; }
.aac-build-flow h3 { margin: 14px 0 0; font-size: 16px; }
.aac-build-flow .le-label { margin: 4px 0 0; }
.aac-build-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.aac-source-search { width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; }

@media (min-width: 1101px), (min-width: 900px) and (orientation: landscape) {
  /* As tall as the board beside it: a question that's taller (a book page
     and its cards) scrolls inside it, instead of running under the lesson
     list below. */
  .teacher-view.with-aac .teach-main { height: calc(100dvh - var(--aac-offset, 120px) - 10px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .teacher-view.with-aac .teach-main > * { flex-shrink: 0; }
  .teacher-view.with-aac .teach-main .no-question:not([hidden]) { flex: 1; min-height: 0; }
  .teacher-view.with-aac .teach-main > .composer { flex-shrink: 0; }
}
@media (max-width: 480px) {
  .class-top .top-tools { flex-wrap: wrap; min-width: 0; }
  .class-top .tabs { max-width: 100%; min-width: 0; }
}

/* Compact AAC settings: one toolbar on wide screens, wrapped only when needed. */
.aac-editbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; }
.aac-grid-settings { gap: 8px; flex: none; }
.aac-edit-actions { flex: 1; min-width: 0; }
.aac-color-key { order: 2; }
.aac-color-key .aac-color-legend { position: absolute; z-index: 31; background: var(--warm-white); border: 1px solid var(--line); border-radius: 10px; padding: 10px; box-shadow: var(--shadow); }
.aac-hint { margin: 0; font-size: 11px; flex: none; }
.aac-hint summary { cursor: pointer; }
.aac-capacity { flex-basis: 100%; margin: 0; font-size: 11px; line-height: 1.2; }
.aac-pane .aac-grid-settings { width: 100%; }
.aac-pane .aac-edit-actions { width: 100%; }
.aac-tile.dragging { opacity: 0.35; }
.aac-tile.making-room { transition: transform .22s cubic-bezier(.2,.8,.2,1); }
.aac-tile-editor .le-label { display: block; margin: 8px 0 4px; font-size: 11px; }
.aac-tile-editor input:not([type="checkbox"]), .aac-tile-editor select { min-height: 36px; font-size: 14px; }
.aac-category-select { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--warm-white); }
.aac-tile-editor .bv-cell-picture { flex-wrap: nowrap; gap: 12px; margin: 4px 0 10px; }
.aac-tile-editor .aac-preview { width: 90px; height: 100px; }
.aac-tile-editor .aac-picture-tools { flex: 1; min-width: 0; font-size: 13px; }
.aac-tile-editor .bv-source { margin: 0 0 6px; font-size: 12px; }
.aac-tile-editor .aac-picture-tools button { font-size: 12px; padding: 6px 10px; }
.aac-tile-editor .aac-hide-row { margin: 12px 0; font-size: 13px; }
.aac-tile-editor .aac-emoji-row { font-size: 12px; gap: 6px; }
.aac-tile-editor .aac-emoji-input { width: 54px; height: 38px; font-size: 22px; }
.aac-tile-advanced { border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; }
.aac-tile-advanced summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.aac-tile-advanced .bv-moves button { width: 36px; height: 36px; padding: 0; font-size: 20px; }
.aac-tile-advanced .aac-convert-folder { margin-top: 10px; }
.aac-ideas { gap: 6px; margin-bottom: 8px; }
.aac-ai-option { flex-direction: row; align-items: center; gap: 12px; padding: 8px; }
.aac-ai-option .aac-layout-copy { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.aac-layout-copy strong { color: var(--ink); font-size: 14px; }
.aac-layout-copy > span { font-size: 12px; line-height: 1.3; color: var(--muted); }
.aac-layout-copy .aac-recommended { font-size: 10px; color: var(--blue-dark); }
.aac-ai-option .aac-layout-sketch { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; width: 92px; height: 64px; font-size: 9px; line-height: 1; }
.aac-layout-sketch > span { display: grid; place-items: center; background: var(--warm-white); border: 2px solid var(--sketch-color); border-radius: 3px; color: #222; }
.layout-fill > span:nth-child(5), .layout-fill > span:nth-child(8) { border-style: dashed; }
.aac-layout-research { font-size: 12px; margin: 10px 0; }
.aac-layout-research summary { cursor: pointer; }
.aac-review-board .aac-ai-preview { aspect-ratio: auto; height: min(350px, 45dvh); }
.aac-review-board select { width: 100%; }
@media (max-width: 1000px) { .aac-grid-settings { width: 100%; } }

.aac-hint[open] { position: relative; }
.aac-hint[open] { max-width: 280px; }

/* Keep AAC editing controls short and source selection focused. */
.aac-color-explanation { font-size: 12px; line-height: 1.4; margin: 5px 0 12px; }
.aac-tile-actions { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 12px; }
.aac-position-row, .aac-folder-move-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.aac-position-row > span, .aac-folder-move-row > label { width: 65px; flex: none; font-weight: 600; }
.aac-position-row .bv-moves { display: flex; gap: 0; border: 1px solid #d5dce4; border-radius: 9px; overflow: hidden; }
.aac-position-row .bv-moves button { border: 0; border-right: 1px solid #d5dce4; border-radius: 0; box-shadow: none; width: 40px; height: 36px; padding: 0; font-size: 20px; }
.aac-position-row .bv-moves button:last-child { border: 0; }
.aac-folder-move-row select { flex: 1; min-width: 0; font-size: 13px; }
.aac-tile-actions .aac-convert-folder, .aac-tile-actions .aac-open-folder { justify-self: start; font-size: 13px; }
.aac-grid-settings .aac-capacity { flex-basis: auto; background: #fff3cf; color: #725318; padding: 3px 6px; border-radius: 6px; font-size: 11px; }
.aac-generation-progress { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 48px 24px; border: 1px solid #cfe0f3; border-radius: 16px; background: #f1f7ff; margin: 16px 0; }
.aac-generation-progress h3, .aac-generation-progress p { margin: 0; }
.aac-loading-spinner { width: 38px; height: 38px; border: 4px solid #cfe0f3; border-top-color: #3985d7; border-radius: 50%; animation: aac-loading 1s linear infinite; }
@keyframes aac-loading { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .aac-loading-spinner { animation: none; } }
.aac-build-status:not(:empty) { padding: 12px; border: 1px solid #edc977; border-radius: 10px; background: #fff6dc; color: #594321; }
.aac-import-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.aac-import-tabs .chip { padding: 7px 10px; font-size: 13px; }
.aac-import-search { width: 100%; padding: 10px 12px; margin-bottom: 12px; }
.aac-import-panel .side-lesson { padding: 10px 12px; gap: 10px; min-height: 54px; border-radius: 10px; }
.aac-import-panel .side-lesson-title { font-size: 14px; line-height: 1.3; }
.aac-import-panel .side-lesson-meta { font-size: 11px; font-weight: 400; }
.aac-import-panel .side-lesson-cover { width: 34px; height: 34px; flex: 0 0 34px; }
.aac-import-panel .aac-cover-emoji { font-size: 20px; }
.aac-import-results .lesson-picker-list { gap: 6px; }

.aac-category-picker { position: relative; }
.aac-category-current { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--warm-white); cursor: pointer; font-size: 14px; list-style: none; }
.aac-category-current::-webkit-details-marker { display: none; }
.aac-category-chevron { margin-left: auto; }
.aac-category-swatch { display: inline-block; width: 24px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.12); flex: none; }
.aac-category-options { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 5; max-height: 280px; overflow: auto; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--warm-white); box-shadow: var(--shadow); }
.aac-category-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; box-shadow: none; background: var(--warm-white); color: var(--ink); font-size: 14px; text-align: left; justify-content: flex-start; }
.aac-category-option[aria-selected="true"], .aac-category-option:hover { background: #eaf3ff; }
.aac-folder-switch { display: flex; align-items: center; gap: 8px; position: relative; cursor: pointer; font-size: 12px; font-weight: 600; flex: none; }
.aac-folder-switch input { position: absolute; right: 0; width: 36px; height: 22px; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.aac-switch-track { width: 36px; height: 22px; border-radius: 20px; background: #a7adb5; padding: 3px; box-sizing: border-box; }
.aac-switch-track::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--warm-white); }
.aac-folder-switch input:checked + .aac-switch-track { background: #3985d7; }
.aac-folder-switch input:checked + .aac-switch-track::after { transform: translateX(14px); }
.aac-folder-switch input:focus-visible + .aac-switch-track { outline: 3px solid #f0a322; outline-offset: 3px; }
.aac-folder-switch input:disabled + .aac-switch-track { opacity: .5; }

.aac-finder-head { display: grid; gap: 8px; margin-bottom: 12px; }
.aac-finder-head .aac-search { margin: 0; width: 100%; padding: 10px 12px; font-size: 14px; }
.aac-finder-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.aac-finder-actions button { width: auto; margin: 0; padding: 7px 11px; font-size: 13px; }
.aac-finder-panel .aac-filters { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 5px; padding: 3px 0 7px; margin: 0; }
.aac-finder-panel .aac-filters .chip { flex: none; font-size: 12px; padding: 6px 9px; }
.aac-finder-status:not(:empty) { margin: 8px 0; font-size: 12px; }
.aac-finder-status:empty { display: none; }

/* Board-level actions stay compact; tile creation begins in an empty square. */
.aac-save-actions { gap: 6px; padding-left: 10px; border-left: 1px solid var(--line); }
.aac-save-actions .aac-save-status { order: -1; font-size: 11px; color: var(--muted); margin-right: 4px; white-space: nowrap; }
.aac-save-actions .aac-undo { box-shadow: none; border-color: transparent; background: transparent; padding: 6px 8px; font-size: 12px; }
.aac-save-actions .aac-done { min-height: 32px; padding: 6px 12px; font-size: 13px; }
.aac-view .aac-trail .doc-actions { gap: 6px; align-items: center; }
.aac-view .av-full, .aac-view .aac-edit-toggle, .aac-view .av-more > summary { width: 40px; height: 40px; min-height: 40px; padding: 0; display: grid; place-items: center; border: 1px solid #dce1e7; border-radius: 9px; background: var(--warm-white); color: #333; box-shadow: none; }
.aac-view .aac-bar .aac-edit-toggle { height: 40px; }
.aac-view .aac-edit-toggle[aria-pressed="true"] { background: #eaf3ff; color: #286eb8; border-color: #9fc5ee; }
.aac-view .av-more { position: relative; }
.aac-view .av-more > summary { list-style: none; cursor: pointer; font-size: 24px; }
.aac-view .av-more > summary::-webkit-details-marker { display: none; }
.aac-view .av-options { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; padding: 6px; min-width: 140px; border: 1px solid var(--line); border-radius: 10px; background: var(--warm-white); box-shadow: var(--shadow); }
.aac-view .av-options button { width: 100%; padding: 9px 12px; font-size: 13px; text-align: left; }
.aac-create-type { position: relative; display: flex; align-items: center; gap: 8px; font-size: 13px; margin-left: auto; cursor: pointer; }
.aac-create-type input { position: absolute; left: 38px; width: 36px; height: 22px; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.aac-create-type .aac-type-word { font-weight: 700; color: #286eb8; }
.aac-create-type.is-folder .aac-type-word { font-weight: 400; color: var(--muted); }
.aac-create-type .aac-type-folder { color: var(--muted); }
.aac-create-type.is-folder .aac-type-folder { font-weight: 700; color: #286eb8; }
.aac-create-type input:checked + .aac-switch-track { background: #3985d7; }
.aac-create-type input:checked + .aac-switch-track::after { transform: translateX(14px); }
.aac-create-type input:focus-visible + .aac-switch-track { outline: 3px solid #f0a322; outline-offset: 3px; }
.aac-finder-actions { align-items: center; min-height: 32px; }

/* Teaching content stays in the lesson half of the existing AAC split. */
.content-stage { min-width: 0; border: 1px solid var(--border, #dce2e9); border-radius: 14px; overflow: hidden; background: #fff; margin: 10px 0; }
.content-stage[hidden] { display: none; }
.content-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px; }
.content-title { overflow-wrap: anywhere; }
.content-scope { flex: 1 1 180px; margin: 0; }
.content-frame { display: block; width: 100%; height: min(58dvh, 560px); border: 0; background: #f4f6f9; }
.content-frame.youtube, video.content-frame { aspect-ratio: 16 / 9; height: auto; max-height: 58dvh; object-fit: contain; background: #111; }
.content-hint { padding: 8px 12px; margin: 0; font-size: 13px; }
.content-hint a { text-decoration: underline; }
.content-form { display: flex; flex-direction: column; gap: 16px; }
.content-form label { display: flex; flex-direction: column; gap: 8px; font-weight: 700; }
.content-form label[hidden] { display: none; }
.content-form select, .content-form input { width: 100%; min-width: 0; }
.teacher-view.with-content .slide-stage, .teacher-view.with-content .lesson-next, .teacher-view.with-content .idle-stage, .teacher-view.with-content .no-question { display: none; }
.student-content { flex: 0 0 auto; }
.teacher-view.locked .content-present, .teacher-view.locked .content-stop { pointer-events: none; opacity: 0.45; }
@media (max-width: 600px) {
  .content-tools { gap: 6px; }
  .content-scope { flex-basis: 100%; }
  .content-frame { height: 45dvh; }
}

.teacher-view.with-content .teach-main { height: auto; }

.youtube-finder { display: grid; gap: 10px; }
.youtube-finder[hidden] { display: none; }
.youtube-search-row, .youtube-paste-row { display: flex; align-items: center; gap: 8px; }
.youtube-search-row input, .youtube-paste-row input { flex: 1; min-width: 0; }
.youtube-search-row button, .youtube-paste-row button { flex-shrink: 0; }
.youtube-recent-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
button.youtube-recent-video { display: flex; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; text-align: left; }
.youtube-recent-video img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.youtube-recent-video span { padding: 8px; overflow-wrap: anywhere; }
.youtube-status { padding: 8px 12px; margin: 0; }
.youtube-enable { margin: 8px 12px; }
@media (max-width: 600px) {
  .youtube-search-row, .youtube-paste-row { flex-wrap: wrap; }
  .youtube-search-row input, .youtube-paste-row input { flex-basis: 100%; }
}
.content-form input, .content-form select { min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--warm-white); color: var(--ink); font: inherit; }

.youtube-recent-video small { padding: 0 8px 10px; color: var(--muted, #555); overflow-wrap: anywhere; }
.youtube-results:empty { display: none; }

.youtube-remote { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; background: #f1f6ff; border-radius: 12px; margin: 8px 0; }
.youtube-remote[hidden] { display: none; }
.youtube-remote label { display: flex; align-items: center; gap: 6px; }
.youtube-remote input { width: 90px; min-width: 0; }
.youtube-remote-status { flex-basis: 100%; }

.youtube-remote-preview iframe.youtube { pointer-events: none; }

.youtube-remote select { width: auto; min-width: 75px; }

/* Shared copies use the library's panels and remain readable on a phone. */
.share-field { display: grid; gap: 8px; margin: 16px 0; }
.share-field input, .share-field textarea { width: 100%; box-sizing: border-box; }
.share-row { text-align: left; white-space: normal; }
.share-inbox-row { padding: 18px; border-bottom: 1px solid #e3e6eb; overflow-wrap: anywhere; }
.share-row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.account-wrap { min-width: 0; display: flex; flex-direction: column; align-items: flex-end; }
.share-notice { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; background: var(--blue-soft); border: 1px solid #cfe2fa; border-radius: 12px; margin-top: 10px; width: 290px; max-width: 100%; box-sizing: border-box; }
.share-notice .link-button { font-size: 12px; text-align: left; line-height: 1.5; overflow-wrap: anywhere; }
.share-notice .link-button:last-child { flex-shrink: 0; color: var(--muted); }
.share-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 250px; padding: 36px 24px; text-align: center; }
.share-empty-symbol { display: grid; place-items: center; width: 56px; height: 56px; background: var(--blue-soft); color: var(--blue-dark); border-radius: 18px; font-size: 30px; margin-bottom: 16px; }
.share-empty h3 { margin: 0 0 8px; font-size: 20px; }
.share-empty p { max-width: 390px; margin: 0; line-height: 1.6; }
.students-card .teachers-online { display: flex; padding: 8px 0; border-bottom: 1px solid var(--line); }
.students-card .teachers-online[hidden] { display: none; }
.co-teacher-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

.share-slide { max-width: 100%; height: auto; }

/* Keep class navigation together, with teaching actions on their own row. */
.teacher-view .class-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; }
.teacher-view .class-top > .back-button { grid-column: 1; grid-row: 1; }
.teacher-view .class-top-title { grid-column: 2; grid-row: 1; }
.teacher-view .class-top > .tabs { grid-column: 3; grid-row: 1; max-width: none; box-sizing: border-box; }
.teacher-view .class-top > .help-dot { grid-column: 4; grid-row: 1; margin: 0; }
.class-top-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-bottom: 8px; }
.class-top-actions .top-tools { flex: 1 1 auto; flex-wrap: wrap; min-width: 0; }
.class-top-actions .top-tools .board-toggle, .class-top-actions .lesson-controls { margin-left: 0; }
.class-top-actions .on-screen { flex: 0 1 auto; min-width: 0; margin-left: auto; }
.class-top-actions .on-screen-dot { flex-shrink: 0; }
.class-top-actions .on-screen-stop { flex-shrink: 0; }
@media (max-width: 600px) {
  .teacher-view .class-top { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
  .teacher-view .class-top > .help-dot { grid-column: 3; }
  .teacher-view .class-top > .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: start; max-width: 100%; }
  .teacher-view .class-top > .tabs .tab { padding-inline: 10px; font-size: 14px; flex-shrink: 0; }
  .class-top-actions .on-screen { margin-left: 0; border-radius: 14px; font-size: 12px; }
}
/* One answer keeps the same card width as the existing small grids. */
.aac-split-class .class-view > .answer-grid.few:has(> :only-child) { grid-template-columns: minmax(0, 300px); justify-content: center; }

/* Selling packs: review first, then print or download. */
.tpt-rights { display: flex; align-items: flex-start; gap: 10px; padding: 14px; background: var(--blue-soft); border-radius: 12px; font-size: 14px; }
.tpt-rights[hidden] { display: none; }
.tpt-rights input { margin-top: 3px; flex-shrink: 0; }
.tpt-picture-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px; margin-bottom: 8px; border: 1px solid #f0c9bd; border-radius: 12px; }
.tpt-steps { list-style: none; padding: 0; display: grid; gap: 12px; margin: 20px 0; }
.tpt-steps button, .tpt-help { width: 100%; text-align: center; white-space: normal; }
.tpt-help { display: block; box-sizing: border-box; text-decoration: none; padding: 12px; border-radius: 12px; }
.tpt-print { display: none; }
@media print {
  @page tpt { size: letter portrait; margin: 10mm; }
  @page aac-download { size: letter landscape; margin: 10mm; }
  body.printing-tpt { background: white; color: #292831; }
  body.printing-tpt > :not(.tpt-print) { display: none !important; }
  body.printing-tpt > .tpt-print { display: block; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .tpt-page { page: tpt; break-after: page; height: 255mm; display: flex; flex-direction: column; gap: 5mm; box-sizing: border-box; }
  .tpt-page:last-child { break-after: auto; }
  .tpt-page h1 { margin: 0; font-size: 18pt; overflow-wrap: anywhere; }
  .tpt-page h2 { margin: 0; font-size: 17pt; overflow-wrap: anywhere; }
  .tpt-page p { font-size: 11pt; line-height: 1.4; margin: 0; }
  .download-board-grid { flex: none; width: 100%; margin: auto; }
  .download-board-grid.word-board { width: min(100%, calc(210mm * var(--print-columns) / var(--print-rows))); gap: 2mm; }
  .download-board-grid .wb-cell { border-width: 0.7mm; padding: 1.5mm 1mm; }
  .download-board-grid .wb-label { font-size: clamp(8pt, 13cqw, 18pt); }
  .download-board-grid .wb-emoji { font-size: clamp(16pt, 38cqw, 60pt); }
  .download-legend { display: flex; flex-wrap: wrap; gap: 2mm; }
  .download-legend .wb-legend-item { font-size: 8pt; }
  .print-aac_board { page: aac-download; height: 190mm; }
  .download-board-grid.aac-grid { height: 160mm; aspect-ratio: auto; gap: 2mm; }
  .download-board-grid .aac-tile { box-shadow: none; }
  .download-slide { width: 100%; height: 205mm; object-fit: contain; }
  .download-question-picture { max-width: 100%; height: 65mm; object-fit: contain; }
  .download-answer-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3mm; }
  .download-answer-grid .answer-card { height: 33mm; min-height: 0; padding: 2mm; box-shadow: none; }
  .download-answer-grid .emoji { font-size: 24pt; }
  .download-answer-grid .label { font-size: 11pt; }
}

/* Download keeps the two formats visible and optional details out of the way. */
.download-extras { margin: 20px 0; border-top: 1px solid var(--line); padding-top: 16px; }
.download-extras summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.download-extras .share-field { margin-top: 16px; }
.download-extras .tpt-help { width: auto; text-align: left; padding: 12px 0; color: var(--blue-dark); }

.sp-actions { flex-wrap: wrap; }

/* Import is a short decision, so its dialog fits the content. */
.sp-panel.import-panel { top: 50%; bottom: auto; left: 50%; right: auto; width: min(480px, calc(100% - 32px)); max-height: 88vh; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; transform: translate(-50%, -45%); box-shadow: 0 20px 60px rgba(43,42,51,.2); }
.sp-panel.import-panel.shown { transform: translate(-50%, -50%); }
.import-panel .sp-body { flex: 0 1 auto; gap: 16px; padding: 20px; }
.import-panel .sp-body > .hint { margin: 0; overflow-wrap: anywhere; }
.import-panel .share-field { margin: 0; }
.import-duplicate-title { display: block; margin-bottom: 8px; font-size: 17px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.import-asset-name { display: block; font-size: 17px; line-height: 1.4; font-weight: 600; color: var(--blue-dark); }
.import-duplicate-help { display: block; margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.import-panel .hint:focus { outline: none; }
.import-options { display: grid; gap: 16px; }
.import-option { padding: 0; }
.import-or { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.import-or::before, .import-or::after { content: ""; flex: 1; border-top: 1px solid #ece9e2; }
.import-option h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.import-option p { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.import-option > button { width: auto; min-height: 36px; padding: 8px 16px; border-radius: 10px; box-shadow: none; font-size: 14px; justify-content: center; }
.import-matches { display: grid; gap: 2px; margin: 0 -8px 12px; }
.import-match { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.import-match:has(input:checked) { background: #edf5ff; }
.import-match input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.import-match span { min-width: 0; display: grid; gap: 3px; overflow-wrap: anywhere; }
.import-match strong { font-size: 14px; font-weight: 600; }
.import-match small { color: var(--muted); font-size: 12px; }
.import-panel .sp-actions { flex-shrink: 0; }
.import-panel .sp-actions > .secondary { border-color: transparent; box-shadow: none; background: transparent; min-height: 36px; padding: 8px 12px; font-size: 14px; }
.import-panel button:focus-visible, .import-panel input:focus-visible { outline: 2px solid #6599ce; outline-offset: 3px; }
@media (max-width: 640px) {
  .sp-panel.import-panel { top: auto; bottom: 0; left: 0; width: 100%; border-radius: 22px 22px 0 0; transform: translateY(100%); }
  .sp-panel.import-panel.shown { transform: none; }
}

.billing-panel{border:1px solid #c6dfe4;border-radius:16px;padding:24px;margin-bottom:24px;background:#f2f9fa}.billing-actions{display:flex;flex-wrap:wrap;gap:12px}.billing-panel>button{float:right}.billing-panel [role=status]{line-height:1.6}

/* Plans: Standard features locked on Free, the upgrade card, and the PDF footer. */
.lock-badge{margin-left:6px;padding:1px 7px;border-radius:999px;background:var(--cream-deep);color:var(--ink);font-size:.72em;font-weight:600;white-space:nowrap;vertical-align:middle}
/* A feature the plan doesn't include: grey, with a lock; hovering says why
   (title), and a tap explains (plan.js). */
.feature-locked{filter:grayscale(1);opacity:.6}
.feature-locked:hover{opacity:.75}
.upgrade-card{position:fixed;z-index:1000;right:16px;bottom:16px;max-width:min(380px,calc(100vw - 32px));padding:18px 20px;border:1px solid var(--blue-line);border-radius:16px;background:var(--card);color:var(--ink);box-shadow:0 12px 32px rgba(43,42,51,.18)}
.upgrade-card p{margin:0 0 6px;line-height:1.45}
.upgrade-card .upgrade-title{font-weight:700}
.upgrade-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px}
.billing-meter{margin-top:2px}

/* The Account page (#account): plan, billing, school and profile, one card each. */
.account-page{width:100%;max-width:760px;margin:0 auto;box-sizing:border-box}
.account-head{padding-inline:0}
.account-head h2{font-size:1.5rem}
.account-notice:empty{display:none}
.account-notice{margin:6px 0 4px;padding:10px 14px;border-radius:var(--radius-s);background:var(--sun-soft);color:var(--ink);line-height:1.5}
.account-sections{display:grid;gap:16px;margin-top:10px}
.account-card{min-width:0;padding:20px 22px;border:1px solid var(--blue-line);border-radius:var(--radius);background:var(--card);box-shadow:var(--shadow-s)}
.account-card h3{margin:0 0 12px;font-size:.85rem;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}
.account-card h4{margin:0 0 10px;font-size:.95rem}
.account-line{margin:6px 0 0;color:var(--muted);line-height:1.5}
.account-line strong{color:var(--ink)}
.account-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
.account-portal{margin-top:18px}
.account-portal:first-child{margin-top:0}
.account-portal .account-line{margin-top:0}
.account-profile{display:flex;align-items:center;gap:14px;min-width:0}
.account-profile .account-initial{flex:none;width:44px;height:44px;display:grid;place-items:center;border-radius:50%;background:var(--blue-soft);color:var(--blue-dark);font-weight:800;font-size:1.15rem}
.account-profile-text{display:flex;flex-direction:column;gap:2px;min-width:0}
.account-profile-text span{color:var(--muted);overflow-wrap:anywhere}
.account-page .plan-meters{margin-top:18px;display:grid;gap:12px}
.account-page .plan-buy{margin:0}
.plan-buy-short{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 20px}
.plan-buy-short-text{flex:1 1 260px}
.plan-buy-short h4{margin:0 0 4px;font-size:1.15rem}
.plan-buy-short .account-line{margin:0}
.account-card.plan-cta{background:var(--blue-soft);border-color:var(--blue-line)}
.plan-cta .plan-links{margin-top:12px}
.plan-buy-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.plan-buy-head h4{margin:0}
.plan-buy-head+.plan-options{margin-top:10px}
.account-page .plan-links{margin:16px 0 0}
.account-page button.loading,.account-page button.loading:disabled{background:var(--blue);color:#fff;border-color:var(--blue);cursor:progress}
.account-page button.loading::before{content:"";display:inline-block;width:14px;height:14px;margin-right:8px;vertical-align:-2px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:plan-spin .7s linear infinite}
@media (prefers-reduced-motion:reduce){.account-page button.loading::before{animation-duration:2s}}
.plan-title{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:1.35rem}
.plan-badge{padding:3px 10px;border-radius:999px;font-size:.8rem;font-weight:700;background:var(--blue-soft);color:var(--blue-dark)}
.plan-badge.trial{background:var(--sun-soft);color:#8a6400}
.plan-badge.own,.plan-badge.school{background:var(--green-soft);color:var(--green-dark)}
.plan-badge.test{background:#f1e9fb;color:#6f43a8}
.plan-note{margin:12px 0 0;padding:10px 14px;border-radius:var(--radius-s);background:var(--blue-soft);line-height:1.5}
.plan-meter-text{display:flex;justify-content:space-between;gap:12px}
.plan-meter-value{color:var(--muted);font-variant-numeric:tabular-nums}
.plan-bar{height:8px;margin-top:6px;border-radius:999px;background:#eceaf0;overflow:hidden}
.plan-bar>span{display:block;height:100%;min-width:4px;border-radius:inherit;background:var(--blue)}
.plan-bar.full>span{background:var(--red)}
.plan-meter-note{margin:4px 0 0;font-size:.85rem;color:var(--muted)}
.plan-reset{margin:-4px 0 4px;font-size:.9rem;color:var(--muted)}
.plan-allowances-title{margin:0 0 6px;font-weight:600}
.plan-allowances ul{list-style:none;margin:0;padding:0}
.plan-allowances li{display:flex;justify-content:space-between;flex-wrap:wrap;gap:4px 12px;padding:6px 0;border-top:1px solid var(--line)}
.plan-allowances li:first-child{border-top:0}
.plan-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px}
.plan-option{position:relative;display:flex;flex-direction:column;padding:18px;border:2px solid var(--line);border-radius:var(--radius);background:var(--paper)}
.plan-option.best{border-color:var(--blue-line)}
.plan-option.picked{border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-soft)}
.plan-option p{margin:0}
.plan-option-name{font-weight:700}
.plan-price{margin:6px 0 2px!important;font-size:2rem;font-weight:800;line-height:1.1}
.plan-price span{font-size:.95rem;font-weight:600;color:var(--muted);margin-left:2px}
.plan-option-line{color:var(--muted);font-size:.9rem;margin-bottom:14px!important;flex:1}
.plan-option button{width:100%}
.plan-tag{position:absolute;top:-11px;right:14px;padding:2px 10px;border-radius:999px;background:var(--sun);color:var(--ink);font-size:.78rem;font-weight:800}
.plan-fine{margin:10px 0 0;font-size:.85rem;color:var(--muted)}
.plan-links a{color:var(--blue-dark)}
@keyframes plan-spin{to{transform:rotate(360deg)}}
@media (max-width:520px){.account-card{padding:16px}.account-actions button{flex:1 1 100%}.plan-options{grid-template-columns:1fr}}

/* The owner's Schools screen (MaTalk staff). */
.schools-panel .hint{color:var(--muted, #5b6470);font-size:.92em}
.schools-new{margin:14px 0 18px}
.schools-new summary{cursor:pointer;font-weight:700}
.schools-form{display:grid;gap:10px;max-width:560px;margin-top:12px}
.schools-field{display:grid;gap:4px;font-weight:600}
.schools-field.inline{display:inline-grid}
.schools-field input,.schools-field textarea,.schools-field select,.schools-inline input{font:inherit;padding:8px 10px;border:1px solid #c6dfe4;border-radius:10px;background:var(--warm-white);min-width:0}
.schools-quote{margin:0;font-weight:600}
.schools-list{display:grid;gap:14px}
.schools-card{border:1px solid #c6dfe4;border-radius:14px;padding:14px 16px;background:var(--warm-white)}
.schools-card h3{margin:0 0 6px}
.schools-card p{margin:0 0 6px;overflow-wrap:anywhere}
.schools-teachers{margin:6px 0 10px;padding-left:18px}
.schools-teachers li{overflow-wrap:anywhere}
.schools-inline{display:flex;flex-wrap:wrap;align-items:end;gap:8px;margin-top:8px}
.schools-inline input[type=text]{flex:1 1 220px}
.schools-inline input[type=number]{width:90px}
.schools-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:20px 0}
.schools-metric{display:grid;gap:3px;padding:16px;border:1px solid #c6dfe4;border-radius:14px;background:var(--warm-white)}
.schools-metric strong{font-size:1.8rem;line-height:1.15}
.schools-metric span{font-size:.9rem;color:var(--muted)}
.schools-toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:18px 0 10px}
.schools-toolbar input,.schools-toolbar select{font:inherit;padding:10px 12px;border:1px solid #c6dfe4;border-radius:10px;background:var(--warm-white);min-width:0}
.schools-toolbar input{flex:1 1 300px}
.schools-card-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px}
.schools-card-head h3{margin:0}
.schools-badges{display:flex;flex-wrap:wrap;gap:6px}
.school-badge{font-size:.8rem;font-weight:700;border-radius:999px;background:#eff3f6;color:#36475a;padding:4px 10px}
.school-state-active{background:#e3f3e9;color:#235b3b}
.school-state-paused,.school-state-expired{background:#fff0d3;color:#79520b}
.schools-seat-line{font-weight:600}
.schools-manage{border-top:1px solid #e1e9ec;margin-top:14px;padding-top:12px}
.schools-manage summary,.schools-settings summary{cursor:pointer;font-weight:700}
.schools-manage h4{margin:18px 0 8px}
.schools-access,.schools-settings,.schools-billing{border-top:1px solid #e1e9ec;margin-top:18px;padding-top:14px}
.schools-access h4{margin-top:0}
.schools-access .hint{max-width:700px}
.schools-access button{margin-top:8px}
.schools-pause{color:#79520b}
@media(max-width:600px){.schools-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.schools-toolbar>*{flex:1 1 100%}.schools-card{padding:14px}.schools-form{max-width:100%}}
@media print{
  .upgrade-card{display:none!important}
  body.free-plan::after{content:"Made with MaTalk Class";position:fixed;left:0;right:0;bottom:4mm;text-align:center;font-size:9pt;color:#6e6a73}
}

/* Library meanings and alternate symbols share the picture picker's scroll area. */
.picker-content { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.symbol-browser > .picker-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.symbol-browser .picker-label { white-space: normal; overflow-wrap: anywhere; }
/* Each meaning on its own: its name, then boy, girl, AAC symbol… side by side. */
.symbol-browser .symbol-results { display: flex; flex-direction: column; gap: 16px; }
.symbol-meaning { display: flex; flex-direction: column; gap: 6px; }
.symbol-meaning + .symbol-meaning { border-top: 1px solid var(--line); padding-top: 12px; }
.symbol-meaning-title { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); }
.symbol-browser .symbol-versions { overflow: visible; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.symbol-more summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.symbol-more .symbol-versions { margin-top: 6px; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.symbol-browser summary { cursor: pointer; padding: 6px 0; }

/* "Choose pictures": a word with a library picture and one from her image bank. */
.picture-choices { display: grid; gap: 14px; margin: 8px 0 16px; }
.picture-choice { display: grid; gap: 6px; }
.picture-choice-word { margin: 0; font-weight: 700; font-size: 16px; }
.picture-choice-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.picture-choice-option { display: grid; justify-items: center; gap: 4px; padding: 8px; border: 2px solid #e2dfd8; border-radius: 14px; background: #fff; cursor: pointer; min-height: 44px; }
.picture-choice-option img { width: 100%; max-width: 120px; aspect-ratio: 1; object-fit: contain; }
.picture-choice-option[aria-pressed="true"] { border-color: var(--blue-dark, #2563eb); box-shadow: 0 0 0 3px var(--blue-soft, #dbeafe); }
.picture-choice-label { font-size: 13px; color: #55534e; }

/* ---------- Lessons as tiles: a picture on top, the words on the topic's colour ---------- */

.library-list.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.library-list.lesson-grid li + li { border-top: 0; }
.library-list.lesson-grid li.library-section { grid-column: 1 / -1; background: none; border-top: 0; padding: 12px 2px 0; }
.library-list.lesson-grid li.library-section:first-child { padding-top: 0; }
.lesson-tile { position: relative; display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; background: linear-gradient(180deg, color-mix(in srgb, var(--tile) 30%, #fff) 0%, color-mix(in srgb, var(--tile) 20%, #fff) 100%); box-shadow: var(--shadow-s); transition: transform 0.18s var(--spring), box-shadow 0.18s ease; }
.lesson-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.lesson-tile-open, .lesson-tile-open:hover, .lesson-tile-open:active { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: stretch; padding: 0; min-height: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--ink); text-align: left; transform: none; }
.lesson-tile-open:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; }
.lesson-tile-art { aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; background: color-mix(in srgb, var(--tile) 55%, #fff); color: rgba(255, 255, 255, 0.95); }
/* A lesson's picture is a word's picture or a page: shown whole, never cut.
   Pinned to the box's edges: a percentage height doesn't follow a box sized by
   aspect-ratio, so a tall picture overflowed it and lost its bottom. */
.lesson-tile-art { position: relative; }
.lesson-tile-art > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; display: block; }
/* A photo made for its tile (a science experiment) fills it. */
.lesson-tile-art.photo > img { object-fit: cover; background: none; }
/* A library symbol is a drawing on white: shown whole, not cropped. */
.lesson-tile-art img[src^="/v1/symbols/"] { object-fit: contain; background: #fff; padding: 10px; }
.lesson-tile-body { flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 14px 16px 6px;
  background-image: radial-gradient(circle at 90% 22%, rgba(255, 255, 255, 0.4) 0 17px, transparent 18px), radial-gradient(circle at 62% 86%, rgba(255, 255, 255, 0.22) 0 9px, transparent 10px); }
.lesson-tile-title { font-size: 20px; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lesson-tile-meta { font-size: 13px; color: color-mix(in srgb, var(--ink) 72%, transparent); }
.lesson-tile-go { margin-top: auto; padding-top: 8px; font-size: 13px; font-weight: 800; }
.lesson-tile-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 14px 14px; }
.lesson-tile-foot:empty { display: none; }
.lesson-tile-foot .library-side { margin: 0; }
.lesson-tile-foot .library-badge, .lesson-tile-foot .library-side.topic-chip { background: rgba(255, 255, 255, 0.7); border-color: transparent; }
.lesson-tile-foot .library-side.topic-chip.empty { background: none; border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.lesson-tile.library-copy { opacity: 0.82; }
@media (max-width: 520px) {
  .library-list.lesson-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .lesson-tile-title { font-size: 17px; }
  .lesson-tile-body { padding: 12px 12px 4px; }
  .lesson-tile-foot { padding: 4px 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .lesson-tile, .lesson-tile:hover { transition: none; transform: none; }
}
.lesson-tile-emoji { font-size: 64px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12)); }
.symbol-style-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 2px; }
.symbol-background { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.symbol-style-filter .chip[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue-dark); border-color: var(--blue-line); }
.picture-style-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.picture-style-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 2px; }
/* Also inside the AAC edit bar, whose buttons are otherwise solid blue. */
.picture-style-chips button.chip { padding: 4px 11px; min-height: 0; font-size: 13px; font-weight: 700; background: var(--warm-white); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; box-shadow: none; }
.picture-style-chips button.chip:hover { background: var(--paper); color: var(--ink); }
.picture-style-chips button.chip[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue-dark); border-color: var(--blue-line); }
/* A worksheet: the whole page, like a sheet of paper on the tile. */
.lesson-tile-art.sheet { position: relative; }
.lesson-tile-art.sheet img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; background: none; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18)); }
/* Beside a class the edit bar must stay short: the style is set in the full editor. */
.aac-pane .aac-style-slot { display: none; }

/* Every Prepare tab shows tiles, like Lessons (see tile.js). */
.library-list.lesson-grid > .share-empty, .library-list.lesson-grid > .hint { grid-column: 1 / -1; }
.share-tile-error { margin: 0; padding: 0 14px 12px; }

/* A science experiment, full screen inside the app. */
body.experiment-open { overflow: hidden; }
.experiment-view { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: var(--paper, #fff); }
.experiment-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card, #fff); }
.experiment-head h2 { margin: 0; font-size: 18px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.experiment-frame { flex: 1; width: 100%; border: 0; background: #fff; }

/* Account: an on/off switch. */
.account-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); cursor: pointer; }
.account-switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-switch-text span { color: var(--muted); font-size: 14px; }
.switch-input { appearance: none; flex: none; position: relative; width: 46px; height: 28px; margin: 0; border-radius: 999px; background: color-mix(in srgb, var(--ink) 22%, #fff); cursor: pointer; transition: background 0.15s ease; }
.switch-input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--warm-white); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s ease; }
.switch-input:checked { background: var(--blue); }
.switch-input:checked::after { transform: translateX(18px); }
.switch-input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* A board's tile shows the board itself, small (tile.js boardArt). */
/* The board keeps its own shape and fits the box whole, whatever the tile's
   width (a percentage height doesn't, and the bottom rows were cut). */
.lesson-tile-art.board-art { padding: 10px; background: color-mix(in srgb, var(--tile) 22%, #fff); container-type: size; }
.mini-board { display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr)); gap: 3px; aspect-ratio: var(--columns) / var(--rows, 1); width: min(100cqw, 100cqh * var(--columns) / var(--rows, 1)); }
.mini-cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 0; overflow: hidden; border: 1.5px solid var(--edge, #ccc); border-radius: 4px; background: var(--fill, #fff); }
.mini-cell.empty { border: 1px dashed color-mix(in srgb, var(--ink) 18%, transparent); background: rgba(255, 255, 255, 0.5); }
.mini-cell.folder { border-top-width: 4px; }
.mini-cell img { flex: 1; width: 100%; min-height: 0; object-fit: contain; padding: 1px; }
.mini-emoji { flex: 1; display: grid; place-items: center; font-size: 13px; line-height: 1; }
.mini-word { max-width: 100%; padding: 0 1px; font-size: 6.5px; font-weight: 700; line-height: 1.1; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.experiment-head .experiment-present { margin-left: auto; }
/* A science experiment needs room to run: most of the screen. */
.content-frame.experiment { height: max(78dvh, 480px); background: #fff; }

/* Organization identity stays visible independently of a teacher's billing plan. */
.home-organization{box-sizing:border-box;display:inline-block;max-width:100%;margin:8px 0 0;padding:5px 10px;border-radius:10px;background:var(--green-soft);color:var(--ink);font-size:13px;font-weight:600;overflow-wrap:anywhere}
.account-organization{margin:4px 12px 10px;color:var(--muted);font-size:13px;white-space:pre-line;overflow-wrap:anywhere}
.account-school-membership+.account-school-membership{border-top:1px solid #dce8e8;margin-top:16px;padding-top:16px}
.account-school-membership p{margin-top:6px}

.organization-heading,.organization-chip{display:flex;align-items:center;gap:10px;min-width:0}
.organization-heading h3{margin:0;overflow-wrap:anywhere}
.organization-logo{flex:none;object-fit:contain;border-radius:8px;background:#fff;width:48px;height:48px}
.organization-logo.small{width:32px;height:32px}
.home-organization{display:inline-flex;flex-wrap:wrap;gap:8px 16px;align-items:center}
.organization-chip>span{overflow-wrap:anywhere}
.account-plan.has-logo{display:grid;grid-template-columns:32px minmax(0,1fr);column-gap:10px;align-items:center}
.account-plan.has-logo .organization-logo{grid-column:1;grid-row:1/3}
.account-plan.has-logo .account-plan-name,.account-plan.has-logo .account-plan-when{grid-column:2}
.schools-logo-upload{margin-top:18px;display:grid;gap:10px;justify-items:start}
.schools-logo-upload input{max-width:100%;font:inherit}

.schools-credit-table{width:100%;border-collapse:collapse;margin:12px 0}
.schools-credit-table th,.schools-credit-table td{text-align:left;padding:8px 10px;border-bottom:1px solid #e2ebed;overflow-wrap:anywhere}
.schools-credit-table th:last-child,.schools-credit-table td:last-child{text-align:right;font-variant-numeric:tabular-nums}
.account-school-admins{margin:8px 0;overflow-wrap:anywhere}

/* School management: overview, people, usage, and organization details. */
html:has(#view-schools:not([hidden])){scrollbar-gutter:stable}
.schools-panel{width:100%;max-width:1180px;margin:0 auto 24px;padding:28px;background:#f5f9fb}
.schools-page-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:24px}
.schools-page-heading h2{font-size:26px;line-height:1.2;margin:0 0 8px}
.schools-page-heading .hint{margin:0;max-width:680px}
.schools-page-heading>button{float:none;flex-shrink:0}
.schools-heading-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;flex-shrink:0}
.schools-heading-actions>button{float:none}
.schools-guide{margin:0 0 24px;padding:20px;border-radius:16px;background:var(--warm-white);border:1px solid var(--line, #e2ddd2)}
.schools-panel>[role=status]:empty{display:none}
.schools-card{padding:24px;border-radius:18px;overflow:hidden}
.schools-card-head{align-items:flex-start;margin:0}
.schools-card-head .organization-heading{gap:14px;min-width:0}
.schools-card-head h3{font-size:22px;line-height:1.25;margin:0 0 6px}
.schools-card-head .organization-logo{border-radius:12px}
.schools-access-summary{display:flex;flex-wrap:wrap;gap:8px 18px;margin:14px 0 20px;color:var(--muted);font-size:.88rem}
.schools-summary-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:0 0 24px}
.schools-summary-stats>div{padding:16px 18px;background:#f2f7fc;border:1px solid #e0eaf5;border-radius:12px;min-width:0}
.schools-summary-stats dt{font-size:.85rem;font-weight:600;color:#52647b;margin-bottom:8px}
.schools-summary-stats dd{display:grid;gap:5px;margin:0}
.schools-summary-stats strong{font-size:28px;line-height:1.1;color:#23384e}
.schools-summary-stats dd span{font-size:.8rem;color:var(--muted)}
.schools-tabs{display:flex;gap:28px;border-bottom:1px solid #dce5ed}
.schools-tabs button{border:0;border-radius:0;background:transparent;box-shadow:none;color:#626d7c;padding:12px 2px 14px;margin:0;border-bottom:3px solid transparent;font-size:.95rem;transform:none;white-space:nowrap}
.schools-tabs button[aria-selected=true]{color:#2467ac;border-bottom-color:#438cde}
.schools-tabs button:hover{background:#f1f6fc;transform:none}
.schools-tabs button:focus-visible{outline:2px solid #438cde;outline-offset:-2px}
.schools-tab-panel{padding:22px 0 0}
.schools-tab-panel[hidden]{display:none}
.schools-people-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start}
.schools-member-card{padding:20px;border:1px solid #dfe7ee;border-radius:14px;min-width:0;background:var(--warm-white)}
.schools-section-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:8px}
.schools-section-heading h4,.schools-member-card h4,.schools-credit-report h4{margin:0;font-size:1rem}
.schools-count{padding:3px 9px;border-radius:8px;background:#edf3fa;color:#52647b;font-size:.8rem;font-weight:700;white-space:nowrap}
.schools-member-list{padding:0;margin:18px 0;list-style:none}
.schools-member-list li{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:14px 0;border-bottom:1px solid #e8edf2}
.schools-member-list li:first-child{padding-top:0}
.schools-member-info{min-width:0;display:grid;gap:4px;overflow-wrap:anywhere}
.schools-member-info strong{font-size:.92rem;font-weight:600}
.schools-member-info p{margin:0;font-size:.82rem}
.schools-member-list .schools-remove{flex-shrink:0;max-width:124px;font-size:.78rem;padding:2px 0;color:#8c4d48;box-shadow:none;text-align:right;line-height:1.4}
.schools-empty{display:flex;align-items:center;justify-content:center;min-height:74px;margin:16px 0!important;border:1px dashed #dfe6ed;border-radius:10px;color:#737e8b;font-size:.9rem;background:#fafcfe}
.schools-add-member{display:flex;flex-wrap:wrap;align-items:end;gap:10px;margin-top:18px}
.schools-add-member .schools-field{flex:1 1 180px;min-width:0;font-size:.82rem}
.schools-add-member input{width:100%;box-sizing:border-box;font-size:.9rem}
.schools-add-member button{margin:0;font-size:.88rem;white-space:nowrap}
.schools-seat-help{margin:10px 0 0!important;font-size:.8rem!important}
.schools-help{margin-top:14px;font-size:.82rem;color:var(--muted)}
.schools-help summary{cursor:pointer}
.schools-help p{margin-top:8px!important}
.schools-credit-report{padding:2px 0}
.schools-period{font-size:.85rem;color:#52647b;background:#f2f7fc;border-radius:8px;padding:6px 10px}
.schools-credit-report .schools-credit-table{margin:20px 0 12px}
.schools-credit-report .schools-credit-table th{font-size:.83rem;color:#52647b;background:#f5f8fb}
.schools-credit-report .schools-credit-table td{padding-top:14px;padding-bottom:14px;font-size:.9rem}
.schools-contact-details{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin:0 0 24px;padding:18px;background:#f5f8fb;border-radius:12px}
.schools-contact-details dt{font-size:.8rem;color:var(--muted);margin-bottom:6px}
.schools-contact-details dd{margin:0;font-size:.9rem;overflow-wrap:anywhere}
.schools-details-content>.schools-settings:first-of-type{margin:0;border:0;padding:0}
.schools-details-content .schools-form{max-width:640px}
.schools-inactive-note{padding:12px 14px;border-radius:10px;background:#fff4dd;color:#79520b;margin-bottom:16px!important}
@media(max-width:780px){
  .schools-panel{padding:20px}.schools-people-grid{grid-template-columns:1fr}.schools-card{padding:20px}
  .schools-page-heading{align-items:center}.schools-page-heading h2{font-size:22px}
  .schools-contact-details{grid-template-columns:1fr}
}
@media(max-width:520px){
  .schools-panel{padding:14px}.schools-page-heading{flex-wrap:wrap;gap:14px;margin-bottom:18px}
  .schools-page-heading>button{font-size:.85rem}.schools-card{padding:16px}.schools-card-head h3{font-size:20px}
  .schools-summary-stats{gap:6px;margin-bottom:18px}.schools-summary-stats>div{padding:12px 9px}
  .schools-summary-stats dt{font-size:.72rem}.schools-summary-stats strong{font-size:22px}.schools-summary-stats dd span{font-size:.7rem}
  .schools-tabs{gap:20px}.schools-tabs button{font-size:.85rem;padding-bottom:12px}.schools-tab-panel{padding-top:16px}
  .schools-member-card{padding:16px}.schools-member-list li{flex-wrap:wrap}.schools-member-list .schools-remove{max-width:none;text-align:left}
  .schools-section-heading{flex-wrap:wrap}.schools-period{padding:4px 8px}
}

/* ---------- Errors, waiting and reconnecting (teacher) ---------- */

/* One place for errors, wherever the page is scrolled. */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 1000;
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: var(--radius-s);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-l);
  border-left: 4px solid var(--red);
}
.toast[hidden] { display: none; }
.toast-text { flex: 1; overflow-wrap: anywhere; }
.toast-close {
  flex: none;
  background: none;
  border: 0;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  min-height: 0;
  cursor: pointer;
}

/* Finding answers: what is happening, and a way out. */
.ask-wait { margin: 0 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; font-weight: 700; color: var(--blue-dark); }
.ask-wait[hidden] { display: none; }
.ask-wait-text { display: inline-flex; align-items: center; gap: 8px; }
.ask-wait-text::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--blue-line); border-top-color: var(--blue); animation: spin 0.8s linear infinite; }

/* While a step runs, the other teaching buttons can't be tapped. */
.teach-panel.busy button:not(.ask-cancel):not(.ask-yes-no),
.teach-panel.busy .answer-card { opacity: 0.55; pointer-events: none; }

/* Lost the connection for more than a moment: say so plainly. */
.reconnect-banner {
  margin: 4px 12px 8px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  background: var(--sun-soft);
  border: 1px solid var(--sun);
  color: var(--ink);
  font-weight: 700;
}
.reconnect-banner[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .ask-wait-text::before { animation: none; }
}

/* ---------- First-time steps (Home) ---------- */

/* Teach, with no classes yet: the three steps to a first question. */
.first-class {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin: 4px 0 8px;
  padding: 22px;
  background: var(--warm-white);
  border: 1px solid var(--blue-line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
}
.first-class[hidden] { display: none; }
.first-class .empty-mascot { flex: none; width: 84px; height: 84px; margin: 0; }
.first-class-body { flex: 1; min-width: 0; }
.first-class .empty-title { margin: 0 0 10px; font-size: 19px; }
.start-steps { margin: 0 0 16px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.start-steps li {
  counter-increment: step;
  position: relative;
  padding-left: 42px;
  line-height: 1.45;
  color: var(--muted);
}
.start-steps li strong { display: block; color: var(--ink); font-size: 16px; }
.start-steps li b { color: var(--ink); }
.start-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
}
@media (max-width: 560px) {
  .first-class { flex-direction: column; align-items: center; padding: 18px 16px; }
  .first-class .empty-mascot { width: 68px; height: 68px; }
  .first-class .empty-title { text-align: center; }
  #first-class-button { width: 100%; }
}

/* An empty Prepare tab: a picture, what to make, and four step cards.
   The steps go 4 across, 2 × 2 when the card is narrower, and one under
   another on a phone: never 3 + 1. Sized by the card, not the window, since
   the sidebar takes part of the row. */
.empty-state.first-steps { container-type: inline-size; text-align: left; padding: 22px; border: 1px solid var(--blue-line); border-style: solid; background: var(--warm-white); box-shadow: var(--shadow-s); }
.first-head { display: flex; align-items: center; gap: 18px; }
.first-art { flex: none; display: grid; place-items: center; }
.first-art[hidden] { display: none; }
.first-art[data-kind="mascot"] { width: 64px; height: 64px; border-radius: 18px; background: var(--sun-soft); }
.first-art[data-kind="mascot"] img { width: 58px; height: 58px; object-fit: contain; }
.first-art[data-kind="picture"] img { width: 120px; height: 80px; object-fit: contain; }
.first-art[data-kind="icon"] { width: 64px; height: 64px; border-radius: 18px; background: var(--blue-soft); color: var(--blue-dark); }
.first-head-text { flex: 1; min-width: 0; }
.first-steps .empty-title { margin: 0; font-size: 19px; }
.empty-about { margin: 4px 0 0; color: var(--muted); line-height: 1.5; max-width: 640px; }
.empty-about:empty { display: none; }
.first-steps .empty-steps { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.empty-steps:empty { display: none; }
/* Full frame on every tile, even inside a library list (whose "li + li"
   rules drop the top border). */
.first-steps .empty-steps > li { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); line-height: 1.45; }
.library-list .first-steps .empty-steps > li + li { border-top: 1px solid var(--line); }
.step-number { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #fff; font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.step-head { font-size: 15px; color: var(--ink); }
.step-text { font-size: 14px; color: var(--muted); }
.step-text strong { color: var(--ink); }
@container (max-width: 720px) {
  .first-steps .empty-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 460px) {
  .first-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .first-steps .empty-steps { grid-template-columns: 1fr; }
  .first-steps .empty-steps > li { display: grid; grid-template-columns: 26px 1fr; column-gap: 12px; row-gap: 2px; }
  .first-steps .empty-steps > li .step-number { grid-row: span 2; margin: 0; }
}
@media (max-width: 640px) {
  .empty-state.first-steps { padding: 18px 16px; }
}

/* New class: a clear (but secondary) button, not a text link. */
.new-class-button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 14px; font-weight: 700; color: var(--blue-dark); background: var(--blue-soft); border: 1.5px solid var(--blue-line); border-radius: 999px; box-shadow: none; }
.new-class-button:hover { background: #dcebfb; border-color: var(--blue); }
.new-class-button[hidden] { display: none; }

/* Shared with you, empty: the step card, across the whole list. */
.library-list.lesson-grid > .share-steps { grid-column: 1 / -1; list-style: none; }
.share-steps .first-art { font-size: 30px; font-weight: 700; }
#import-button, #export-button { display: inline-flex; align-items: center; gap: 6px; }
#import-button[hidden], #export-button[hidden] { display: none; }
.library-top .menu-wrap { display: flex; gap: 8px; }

/* ---------- Student: sound, zoom, reconnecting ---------- */

/* One tap to turn sound on (iPad Safari), when questions will be read aloud. */
.tap-to-start {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(255, 245, 224, 0.97);
  color: var(--ink);
  cursor: pointer;
  box-shadow: none;
}
.tap-to-start[hidden] { display: none; }
.tts-icon { display: grid; place-items: center; width: 120px; height: 120px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 56px; box-shadow: var(--shadow-l); }
.tts-title { font-size: 32px; font-weight: 800; }
.tts-sub { font-size: 18px; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .tts-icon { animation: tts-pulse 1.8s ease-in-out infinite; }
}
@keyframes tts-pulse { 50% { transform: scale(1.06); } }

/* The zoomed picture's own close button. */
.picture-zoom-close {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  width: 52px;
  height: 52px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: var(--warm-white);
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  box-shadow: var(--shadow-l);
  cursor: pointer;
}

/* Lost the connection: the cards rest until it's back. */
.class-view.offline .answer-grid { opacity: 0.45; pointer-events: none; }
.student-reconnect { margin: 0 12px; padding: 10px 14px; border-radius: var(--radius-s); background: var(--sun-soft); border: 1px solid var(--sun); color: var(--ink); font-weight: 700; text-align: center; }
.student-reconnect[hidden] { display: none; }

/* ---------- The app's own dialogs (dialog.js) ---------- */

.app-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--warm-white);
  color: var(--ink);
  box-shadow: var(--shadow-l);
}
.app-dialog::backdrop { background: rgba(43, 42, 51, 0.45); }
.app-dialog form { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.app-dialog-title { margin: 0; font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.app-dialog-body { display: flex; flex-direction: column; gap: 8px; color: var(--muted); line-height: 1.5; }
.app-dialog-body p { margin: 0; }
.app-dialog-field { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; color: var(--ink); font-weight: 600; }
.app-dialog-field input { width: 100%; }
.app-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
/* A delete's button is solid red: it's the one that can't be taken back. */
.app-dialog-actions button.danger { background: var(--red); color: #fff; border: 0; }
.app-dialog-actions button.danger:hover { background: #b9232f; }
.app-dialog-actions button:disabled { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 420px) {
  .app-dialog-actions button { flex: 1 1 100%; }
}

/* A student not in any class yet: what to do, with the email big enough to show the teacher. */
.not-invited { margin: 14px 0 6px; padding: 20px; border-radius: var(--radius-l); background: var(--warm-white); border: 1px solid var(--sun); box-shadow: var(--shadow-s); text-align: center; }
.not-invited[hidden] { display: none; }
.not-invited p { margin: 0 0 8px; line-height: 1.5; }
.not-invited-title { font-size: 22px; font-weight: 800; }
.not-invited-email { display: inline-block; margin: 6px 0 12px !important; padding: 10px 16px; border-radius: var(--radius); background: var(--sun-soft); font-size: clamp(18px, 5vw, 26px); font-weight: 800; overflow-wrap: anywhere; user-select: all; }
.not-invited .hint { margin: 0; }

/* A new teacher's plan and "all set" steps (welcome-plan.js). */
.welcome-plan {
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-l);
}
.welcome-plan::backdrop { background: rgba(43, 42, 51, 0.45); }
.welcome-plan.done { width: min(480px, calc(100vw - 24px)); }
.welcome-body { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 22px; }
.welcome-body.narrow { max-width: 440px; margin: 0 auto; align-items: stretch; }
.welcome-body h2 { margin: 0; font-size: 26px; line-height: 1.2; text-align: center; }
.welcome-top { align-self: stretch; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 32px; }
.welcome-step { font-size: 13px; font-weight: 800; color: var(--muted); }
.welcome-close { width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%; background: var(--warm-white); color: var(--ink); border: 2px solid var(--line); box-shadow: none; font-size: 20px; line-height: 1; }
.welcome-close:hover { background: var(--cream); }
.welcome-lead { margin: -6px 0 0; color: var(--muted); font-weight: 700; }
.welcome-toggle { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--cream); border: 2px solid var(--line); }
.welcome-toggle button { min-height: 0; padding: 7px 14px; border-radius: 10px; background: none; color: var(--muted); box-shadow: none; }
.welcome-toggle button[aria-pressed="true"] { background: var(--warm-white); color: var(--ink); box-shadow: var(--shadow-s); }
.welcome-toggle em { font-style: normal; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: var(--sun); color: var(--ink); font-size: 12px; }
.welcome-plans { align-self: stretch; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding-top: 8px; }
.welcome-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--warm-white); min-width: 0; }
.welcome-card.popular { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.welcome-card h3 { margin: 0; font-size: 20px; }
.welcome-card p { margin: 0; }
.welcome-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 2px 12px; border-radius: 999px; background: var(--sun); color: var(--ink); font-size: 12px; font-weight: 800; }
.welcome-tagline { color: var(--muted); font-size: 14px; }
.welcome-price { margin-top: 6px !important; font-size: 30px; font-weight: 800; line-height: 1.1; }
.welcome-price span { font-size: 14px; font-weight: 600; color: var(--muted); }
.welcome-sub { font-size: 13px; font-weight: 700; color: var(--teal-dark); }
.welcome-features { flex: 1; margin: 6px 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.welcome-after { font-size: 13px; color: var(--muted); font-weight: 700; }
.welcome-card button, .welcome-quote { width: 100%; }
.welcome-cta { background: var(--coral); box-shadow: 0 2px 0 var(--coral-dark); }
.welcome-cta:hover { background: var(--coral-dark); }
.welcome-quote { display: block; padding: 11px 20px; border-radius: 14px; background: var(--sun-soft); border: 2px solid var(--sun); color: var(--ink); font-weight: 700; text-align: center; text-decoration: none; }
.welcome-quote:hover { background: var(--sun); }
.welcome-rows { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--radius); background: var(--cream); }
.welcome-row { display: grid; grid-template-columns: 56px 1fr; gap: 10px; font-size: 15px; }
.welcome-row span { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .welcome-plans { grid-template-columns: 1fr; gap: 18px; }
  .welcome-body { padding: 18px 16px; }
}

.welcome-badge.school { background: var(--teal-soft, #d9efec); }
.welcome-school-actions { display: flex; flex-direction: column; gap: 8px; }
.welcome-demo { display: block; padding: 9px 20px; border-radius: 14px; background: var(--warm-white); border: 2px solid var(--line); color: var(--ink); font-weight: 700; text-align: center; text-decoration: none; }
.welcome-demo:hover { border-color: var(--ink); }

/* ---------- Lesson editor: tabs, and the questions as tiles ---------- */
.le-tabs { margin-top: 2px; }
.le-body > .doc-panel { gap: 14px; }
.questions-head { justify-content: flex-end; margin-top: 0; }
.questions-head .le-status { margin: 0 auto 0 0; }
.exit-section { margin-top: 0; padding-top: 0; border-top: 0; }
.exit-sub { margin: 0; max-width: 60ch; }
/* The menu opens to the left, so it stays on the screen. */
.add-menu { left: auto; right: 0; max-width: calc(100vw - 32px); }
.about-panel .about-lesson { padding: 14px; }
.about-panel .about-sub { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.about-panel .lesson-context { margin-top: 0; min-height: 220px; }
.about-panel .le-source { margin: 0; }

.lesson-list, .exit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; padding: 0; margin: 0; }
.lesson-list > .q-checkpoint { grid-column: 1 / -1; }
.q-tile { list-style: none; display: flex; min-width: 0; }
.q-tile-open { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0; min-height: 0; text-align: left; color: var(--ink); background: var(--warm-white); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-s); font-weight: 400; cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.q-tile-open:hover { transform: translateY(-2px); box-shadow: var(--shadow-l); background: var(--warm-white); color: var(--ink); }
.q-tile-open:active { transform: none; }
.q-tile.current .q-tile-open { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-line); }
.q-tile-art { position: relative; display: block; aspect-ratio: 16 / 10; background: var(--blue-soft); border-bottom: 1px solid var(--line); }
.q-tile-art > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.q-tile-number { position: absolute; top: 10px; left: 10px; min-width: 30px; height: 30px; padding: 0 8px; box-sizing: border-box; display: grid; place-items: center; border-radius: 999px; background: var(--blue-dark); color: #fff; font-size: 15px; font-weight: 800; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); }
/* No picture: a short strip with the number, so the cards come first. */
.q-tile-art.blank { aspect-ratio: auto; height: 52px; }
.exit-q .q-tile-number { background: var(--teal-dark); }
.q-tile-pen { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: var(--blue-dark); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); opacity: 0.85; }
.q-tile-open:hover .q-tile-pen { opacity: 1; }
.q-tile-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.q-tile-body .q-number { font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--blue-dark); }
.q-tile-body .q-number:empty { display: none; }
.q-tile-body .q-text { font-size: 17px; }
.q-tile-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.q-card { position: relative; width: 74px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.q-card-face { width: 74px; height: 74px; box-sizing: border-box; display: grid; place-items: center; border-radius: 12px; background: #fff; border: 2px solid var(--line); overflow: hidden; }
.q-card-face img { width: 100%; height: 100%; object-fit: contain; padding: 4px; box-sizing: border-box; }
.q-card-emoji { font-size: 32px; line-height: 1; font-weight: 800; }
.q-card-word { max-width: 100%; font-size: 12px; font-weight: 700; text-align: center; line-height: 1.15; overflow-wrap: break-word; hyphens: auto; }
.q-card.right .q-card-face { border-color: var(--green, #4caf50); background: var(--green-soft); }
.q-card.right .q-card-word { color: var(--green-dark); }
.q-card.right::after { content: "✓"; position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--green-dark); color: #fff; font-size: 13px; font-weight: 900; }
@media (max-width: 560px) {
  .lesson-list, .exit-list { grid-template-columns: 1fr; }
}

/* A card whose picture the library is still finding: an empty, softly
   pulsing square instead of a stand-in emoji. */
.picture-loading { display: block; width: 62%; aspect-ratio: 1; margin: auto; border-radius: 12px; background: linear-gradient(100deg, #f1ece2 30%, #faf7f1 50%, #f1ece2 70%); background-size: 300% 100%; animation: picture-loading 1.2s ease-in-out infinite; }
.q-card-face.picture-loading { width: 74px; aspect-ratio: auto; margin: 0; border-radius: 12px; }
@keyframes picture-loading { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .picture-loading { animation: none; } }
.card-choices-none { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Lesson editor: About this lesson, at a glance ---------- */
.about-panel { gap: 14px; }
.ov { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.ov[hidden], .ov-card[hidden] { display: none; }
.ov-card { background: var(--warm-white); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-s); }
.ov-title { margin: 0 0 8px; font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.ov-summary-text { margin: 0 0 8px; font-size: 16px; line-height: 1.45; max-width: 70ch; }
.ov-points { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ov-points li { padding: 4px 10px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-size: 13px; font-weight: 700; }
.ov-points:empty { display: none; }
.ov-open-hint { margin: -2px 0 10px; }
.ov-open, .ov-covered { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ov-part { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.ov-part.open { border-color: #f1d9a8; background: #fffbf2; }
.ov-part-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ov-part-title { font-weight: 800; font-size: 15px; }
.ov-check { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--green-dark); color: #fff; font-size: 12px; font-weight: 900; }
.ov-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--sun, #f4b400); margin: 0 6px 0 6px; }
.ov-pages-chip { font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }
.ov-asks { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 6px 0 0 30px; }
.ov-ask { min-height: 0; padding: 2px 0; background: none; border: 0; box-shadow: none; color: var(--blue-dark); font-weight: 600; font-size: 14px; text-align: left; cursor: pointer; }
.ov-ask:hover { text-decoration: underline; background: none; }
.ov-idea { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "words add" "cards add"; gap: 8px 12px; align-items: center; margin: 8px 0 0 24px; }
.ov-idea-words { grid-area: words; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ov-idea-text { margin: 0; font-size: 16px; font-weight: 700; }
.ov-idea-kind { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--blue-dark); }
.ov-idea-cards { grid-area: cards; display: flex; flex-wrap: wrap; gap: 8px; }
.ov-idea-cards .q-card { width: 60px; }
.ov-idea-cards .q-card-face { width: 60px; height: 60px; }
.ov-idea-cards .q-card-emoji { font-size: 26px; }
.ov-add { grid-area: add; display: inline-flex; align-items: center; gap: 4px; }
.ov-status { margin: 0; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ov-status-text:empty { display: none; }
.ov-loading { padding: 16px; border-radius: 16px; background: linear-gradient(100deg, #f1ece2 30%, #faf7f1 50%, #f1ece2 70%); background-size: 300% 100%; animation: picture-loading 1.4s ease-in-out infinite; color: var(--ink); }
.about-text summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; }
.about-text summary::-webkit-details-marker { display: none; }
.about-text summary .ov-title { margin: 0; }
.about-text summary .ov-title::after { content: " ▾"; color: var(--muted); font-weight: 400; }
.about-text[open] summary .ov-title::after { content: " ▴"; }
.ov-pages { list-style: none; margin: 12px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.ov-pages[hidden] { display: none; }
.ov-page { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ov-page:last-child { border-bottom: 0; }
.ov-page-label { font-size: 12px; font-weight: 800; color: var(--blue-dark); text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px; }
.ov-page-body p { margin: 0; }
.ov-page-text { font-size: 15px; line-height: 1.4; }
.ov-page-picture { margin-top: 2px !important; font-size: 13px; color: var(--muted); font-style: italic; }
.about-edit textarea { width: 100%; box-sizing: border-box; margin-top: 6px; }
.about-edit .pdf-row { margin-top: 8px; }
@media (min-width: 900px) {
  .ov { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
  .ov-summary, .ov-status { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .ov-idea { grid-template-columns: 1fr; grid-template-areas: "words" "cards" "add"; margin-left: 0; }
  .ov-add { justify-self: start; }
  .ov-page { grid-template-columns: 1fr; gap: 2px; }
}
.ov-page.fact { background: var(--paper); border-radius: 10px; padding: 8px 10px; border-bottom: 0; margin-bottom: 2px; }
.ov-page.fact .ov-page-label { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 13px; }
.ov-page.fact { grid-template-columns: 150px minmax(0, 1fr); }

/* About this lesson: side tabs on the left, one part at a time on the right. */
.about-panel:not([hidden]) { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.ab-nav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 16px; background: var(--cream-deep); box-shadow: inset 0 1px 2px rgba(92, 64, 20, 0.08); }
.ab-tab { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 0; padding: 10px 12px; border-radius: 11px; background: none; color: var(--muted); border: 0; box-shadow: none; font-size: 15px; font-weight: 700; text-align: left; }
.ab-tab:hover { background: rgba(255, 255, 255, 0.55); color: var(--ink); }
.ab-tab:active { transform: none; }
.ab-tab[aria-selected="true"] { background: var(--warm-white); color: var(--blue-dark); box-shadow: var(--shadow-s); }
.ab-tab > span:first-of-type { flex: 1; }
.ab-tab .tab-count:empty { display: none; }
.ab-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ab-pane { display: flex; flex-direction: column; gap: 14px; }
.ab-pane[hidden] { display: none; }

/* Where the lesson came from: the book's name with its buttons beside it. */
.about-panel .le-source { justify-content: flex-start; gap: 14px 22px; padding: 14px 16px; border-radius: 16px; }
.about-panel .le-source-label { font-size: 14px; }
.about-panel .le-source-label strong { font-size: 16px; }

.ov-goals { list-style: none; margin: 0; padding: 0; }
.ov-goal { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ov-goal:last-child { border-bottom: 0; }
.ov-goal-title { font-weight: 700; font-size: 15px; }
.ov-goal-where { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.ov-goal.open .ov-goal-where { color: #a26a00; }
.ov-goal .ov-dot { margin: 0 6px; }
.ov-goals-tally { font-weight: 600; font-size: 13px; }

.ov-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; align-items: start; }
.ov-col .ov-title .ov-check, .ov-col .ov-title .ov-dot { margin: 0; }
.ov-col.open { border-color: #f1d9a8; }
.ov-group { margin: 14px 0 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.ov-group:first-child { margin-top: 4px; }
.ov-cov-list, .ov-open-list { display: flex; flex-direction: column; gap: 8px; }
.ov-cov-list .ov-asks { margin-left: 0; }
.ov-part + .ov-group { margin-top: 16px; }
.ov-idea { margin-left: 0; }
.ov-part.open .ov-idea { margin-top: 8px; }
.ov-book-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ov-book-head .hint { margin: 2px 0 0; }
.ov-book-page { margin-top: 6px; }
.ov-book-page .ov-idea { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ov-book-page .ov-idea:last-child { border-bottom: 0; }
.ov-add-all { display: inline-flex; align-items: center; gap: 4px; }
.ov-add-all[hidden] { display: none; }
.ab-pane .ov-pages { max-height: none; }

@media (max-width: 900px) {
  .ov-cols { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .about-panel:not([hidden]) { grid-template-columns: 1fr; }
  .ab-nav { position: static; flex-direction: row; overflow-x: auto; }
  .ab-tab { width: auto; white-space: nowrap; }
}
.ov-book-page + .ov-book-page { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--line); }
@media (max-width: 560px) {
  .ov-page.fact { grid-template-columns: 1fr; gap: 2px; }
}

/* ---- About: calmer (fewer boxes, lighter text, smaller cards) ---- */
.ov-goals-head { display: flex; justify-content: space-between; padding: 0 0 6px 34px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.ov-goal-title { font-weight: 600; }
.ov-goal-where { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ov-q { min-height: 0; padding: 2px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); border: 0; box-shadow: none; font-size: 13px; font-weight: 700; }
.ov-q:hover { background: var(--blue-line); }
.ov-not-yet { font-size: 13px; color: #a26a00; }

.ov-col { padding: 16px 18px; }
.ov-col.open { border-color: var(--line); }
.ov-col .ov-title { font-size: 17px; }
.ov-col > .hint { margin: -4px 0 4px; }
.ov-cov-list, .ov-open-list { gap: 0; }
.ov-part, .ov-part.open { border: 0; border-radius: 0; background: none; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ov-part:last-child { border-bottom: 0; }
.ov-part-title { font-weight: 600; font-size: 14px; color: var(--muted); }
.ov-part.covered .ov-part-title { color: var(--ink); font-size: 15px; }
.ov-asks { margin-top: 4px; gap: 2px; }
.ov-ask { font-weight: 500; }
.ov-group { margin: 18px 0 2px; }
.ov-idea { margin-top: 4px; gap: 6px 12px; }
.ov-idea-text { font-size: 15px; font-weight: 600; }
.ov-idea-meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.ov-idea-cards { gap: 6px; }
.ov-idea-cards .q-card { width: 50px; gap: 2px; }
.ov-idea-cards .q-card-face { width: 50px; height: 50px; border-width: 1.5px; border-radius: 10px; }
.ov-idea-cards .q-card-emoji { font-size: 22px; }
.ov-idea-cards .q-card-word { font-size: 11px; font-weight: 600; }
.ov-idea-cards .q-card.right::after { width: 18px; height: 18px; top: -5px; right: -5px; font-size: 11px; }
.ov-add { padding: 6px 12px; }
.ov-book-page .ov-idea { padding: 12px 0; }

/* The material: a calm list, one page opened at a time. */
.ab-pane .ov-pages { gap: 0; margin: 8px 0 0; }
.ov-facts { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: var(--paper); }
.ov-fact { display: flex; gap: 10px; font-size: 13px; line-height: 1.35; }
.ov-fact-label { flex: none; width: 140px; color: var(--muted); font-weight: 700; }
.ov-page { display: block; padding: 0; border-bottom: 1px solid var(--line); }
.ov-page-head { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 0; padding: 8px 4px; background: none; border: 0; box-shadow: none; color: var(--ink); text-align: left; font-weight: 400; border-radius: 10px; }
.ov-page-head:hover { background: var(--paper); }
.ov-page-head:active { transform: none; }
.ov-page-thumb { flex: none; width: 44px; height: 56px; border-radius: 6px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.ov-page-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ov-page-lines { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ov-page-head .ov-page-label { font-size: 11px; padding: 0; }
.ov-page-head .ov-page-text { font-size: 14px; color: var(--ink); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ov-page-chevron { flex: none; color: var(--muted); font-size: 20px; transition: transform 0.15s ease; }
.ov-page.open .ov-page-chevron { transform: rotate(90deg); }
.ov-page-full { display: none; padding: 4px 4px 14px 60px; }
.ov-page.open .ov-page-full { display: block; }
.ov-page.open .ov-page-head .ov-page-text { -webkit-line-clamp: unset; display: none; }
.ov-page-image { display: block; max-width: min(420px, 100%); max-height: 320px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 8px; }
.ov-page-fulltext { margin: 0 0 4px; font-size: 15px; line-height: 1.45; }
@media (max-width: 560px) {
  .ov-fact { flex-direction: column; gap: 0; }
  .ov-page-full { padding-left: 4px; }
  .ov-goals-head span:last-child { display: none; }
}

/* Book: her own question, on a page she picks. */
.bk-write { display: inline-flex; align-items: center; gap: 6px; }
.bk-write-form { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 10px 14px; align-items: end; margin-bottom: 12px; }
.bk-write-form[hidden] { display: none; }
.bk-write-form label { display: flex; flex-direction: column; gap: 4px; }
.bk-write-form select, .bk-write-form input { width: 100%; box-sizing: border-box; }
.bk-write-actions { display: flex; gap: 10px; align-items: center; }
.bk-write-status { grid-column: 1 / -1; margin: 0; }
.bk-write-status:empty { display: none; }
@media (max-width: 640px) { .bk-write-form { grid-template-columns: 1fr; } }

/* The material, easy to skim: stories as headings, one line a page, alternating rows. */
.ov-page { border-bottom: 0; border-radius: 10px; }
.ov-page.shade { background: #faf6ee; }
.ov-page-group { list-style: none; margin: 16px 0 4px; padding: 0 4px; font-size: 13px; font-weight: 800; color: var(--blue-dark); }
.ov-page-group:first-child, .ov-facts + .ov-page-group { margin-top: 6px; }
.ov-page-head { gap: 12px; padding: 7px 10px; }
.ov-page-head:hover { background: var(--blue-soft); }
.ov-page-num { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--warm-white); border: 1px solid var(--line); font-size: 13px; font-weight: 800; color: var(--muted); }
.ov-page-head .ov-page-text { flex: 1; min-width: 0; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; -webkit-line-clamp: unset; }
.ov-page-q { flex: none; }
.ov-page-thumb { width: 30px; height: 38px; }
.ov-page.open { background: var(--warm-white); box-shadow: inset 0 0 0 1px var(--line); }
.ov-page.open .ov-page-head .ov-page-text { display: block; color: var(--muted); }
.ov-page-full { padding: 2px 12px 14px 52px; }
.ov-facts { gap: 2px; }

/* Suggestions and the book's questions: one calm line each, cards on tap. */
.ov-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.ov-filter { min-height: 0; padding: 5px 12px; border-radius: 999px; background: var(--warm-white); border: 1px solid var(--line); box-shadow: none; color: var(--ink); font-size: 13px; font-weight: 600; }
.ov-filter.on { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue-dark); }
.ov-filter:disabled { opacity: 0.45; }
.ov-page-heading { display: flex; align-items: center; gap: 10px; margin: 16px 0 2px; padding: 0 4px; font-size: 13px; font-weight: 800; color: var(--blue-dark); }
.ov-suggest-list > .ov-page-heading:first-child, .ov-book-page > .ov-page-heading { margin-top: 6px; }
.ov-book-link { min-height: 0; padding: 2px 9px; border-radius: 999px; background: #fff6e0; border: 1px solid #f1d9a8; box-shadow: none; color: #8a5a00; font-size: 12px; font-weight: 700; }
.ov-book-link::before { content: "📖 "; }
.ov-row { border-radius: 10px; }
.ov-row.shade { background: #faf6ee; }
.ov-row-line { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.ov-row-open { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 4px 2px; background: none; border: 0; box-shadow: none; color: var(--ink); text-align: left; font-weight: 400; }
.ov-row-open:hover { background: none; }
.ov-row-open:hover .ov-row-text { color: var(--blue-dark); }
.ov-row-open:active { transform: none; }
.ov-row-text { font-size: 15px; font-weight: 600; }
.ov-row-meta { font-size: 12px; color: var(--muted); }
.ov-row-cards { display: none; padding: 0 8px 10px 10px; }
.ov-row.open .ov-row-cards { display: flex; }
.ov-row.open { background: var(--warm-white); box-shadow: inset 0 0 0 1px var(--line); }
.ov-book-page + .ov-book-page { margin-top: 10px; border-top: 0; padding-top: 0; }

/* ---- About: roomier text, and three ways to view suggested questions ---- */
.about-panel { font-size: 16px; }
.ab-tab { font-size: 16px; font-weight: 600; padding: 12px 14px; }
.about-panel .ov-card { padding: 18px 20px; }
.about-panel .ov-title { font-size: 19px; font-weight: 700; }
.about-panel .hint { font-size: 15px; line-height: 1.5; }
.ov-summary-text { font-size: 17px; line-height: 1.55; }
.ov-goal { padding: 12px 0; }
.ov-goal-title { font-size: 16px; font-weight: 500; }
.ov-q { font-size: 14px; padding: 3px 11px; }
.ov-page-heading { font-size: 15px; font-weight: 700; margin: 20px 0 6px; }
.ov-row-line { padding: 10px 12px; }
.ov-row-text { font-size: 17px; font-weight: 500; }
.ov-row-meta { font-size: 14px; }
.ov-filter { font-size: 14px; padding: 6px 14px; font-weight: 500; }
.ov-book-link { font-size: 13px; font-weight: 600; }
.ov-head-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ov-views { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--cream-deep); }
.ov-view { min-height: 0; padding: 6px 12px; border-radius: 9px; background: none; border: 0; box-shadow: none; color: var(--muted); font-size: 14px; font-weight: 600; }
.ov-view.on { background: var(--warm-white); color: var(--blue-dark); box-shadow: var(--shadow-s); }
.ov-view:active { transform: none; }

/* Grid: tiles with their cards showing. */
.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 6px; }
.view-grid > .hint { grid-column: 1 / -1; }
.ov-tile { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--warm-white); }
.ov-tile-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ov-tile-where { font-size: 13px; font-weight: 700; color: var(--blue-dark); }
.ov-tile-text { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.35; }
.ov-tile-meta { margin: 0; font-size: 14px; color: var(--muted); }
.ov-tile .ov-idea-cards { margin-top: auto; padding-top: 6px; }
.ov-tile .ov-idea-cards .q-card { width: 64px; }
.ov-tile .ov-idea-cards .q-card-face { width: 64px; height: 64px; }
.ov-tile .ov-idea-cards .q-card-word { font-size: 13px; }
.ov-tile .ov-add { align-self: flex-start; }

/* One by one: a single question, large. */
.view-one { margin-top: 6px; }
.ov-one { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--warm-white); text-align: center; }
.ov-one-top { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.ov-one-count { font-weight: 700; }
.ov-one-text { margin: 4px 0 0; font-size: 26px; font-weight: 600; line-height: 1.3; max-width: 30ch; }
.ov-one-meta { margin: 0; font-size: 15px; color: var(--muted); }
.ov-one-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 10px 0; }
.ov-one-cards .q-card { width: 100px; gap: 6px; }
.ov-one-cards .q-card-face { width: 100px; height: 100px; border-radius: 16px; }
.ov-one-cards .q-card-emoji { font-size: 44px; }
.ov-one-cards .q-card-word { font-size: 16px; }
.ov-one-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ov-one-actions .ov-add { padding: 10px 18px; font-size: 16px; }

/* ---- About: tiles with depth; Covered and the material as tiles ---- */
.about-panel .view-grid { gap: 16px; }
.ov-tile { background: var(--warm-white); border: 1px solid #ece4d3; box-shadow: 0 1px 2px rgba(92, 64, 20, 0.06), 0 6px 18px rgba(92, 64, 20, 0.08); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.ov-tile:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(92, 64, 20, 0.08), 0 12px 28px rgba(92, 64, 20, 0.12); }
.ab-pane > .ov-card:has(.view-grid) { background: #fbf7ef; }
.ov-tile.covered { border-top: 4px solid var(--green-dark); }
.ov-tile.covered .ov-tile-top .ov-check { width: 20px; height: 20px; font-size: 11px; }
.ov-tile-asks { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.ov-tile-ask { display: flex; align-items: baseline; gap: 8px; min-height: 0; padding: 6px 8px; border-radius: 10px; background: var(--paper); border: 0; box-shadow: none; color: var(--ink); font-size: 15px; font-weight: 400; text-align: left; }
.ov-tile-ask:hover { background: var(--blue-soft); }
.ov-tile-ask .ov-q { flex: none; }

/* What it teaches: what the marks mean. */
.ov-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: -2px 0 12px; font-size: 14px; color: var(--muted); }
.ov-legend .ov-check { width: 20px; height: 20px; font-size: 11px; }
.ov-legend .ov-dot { margin: 0 2px 0 4px; }
.ov-legend-gap { width: 14px; }

/* One by one: Previous / Next, and a dot per question. */
.ov-one-actions .secondary { min-width: 120px; }
.ov-one-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 420px; }
.ov-one-dot { width: 12px; height: 12px; min-height: 0; padding: 0; border-radius: 50%; border: 0; box-shadow: none; background: #e2d9c6; }
.ov-one-dot.on { background: var(--blue); transform: scale(1.25); }
.ov-one-dot:hover { background: var(--blue-line); }
.ov-one-keys { margin: 0; font-size: 13px; color: var(--muted); }

/* The material as page tiles, under each story. */
.material-grid { list-style: none; padding: 0; }
.material-grid .ov-page-group { margin: 22px 0 8px; font-size: 15px; }
.ov-page-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.ov-page-tile { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; text-align: left; color: var(--ink); background: var(--warm-white); border: 1px solid #ece4d3; border-radius: 14px; box-shadow: 0 1px 2px rgba(92, 64, 20, 0.06), 0 6px 18px rgba(92, 64, 20, 0.08); font-weight: 400; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.ov-page-tile:hover { transform: translateY(-2px); background: var(--warm-white); box-shadow: 0 2px 4px rgba(92, 64, 20, 0.08), 0 12px 28px rgba(92, 64, 20, 0.12); }
.ov-page-tile:active { transform: none; }
.ov-page-tile-art { display: block; aspect-ratio: 4 / 3; background: var(--paper); border-bottom: 1px solid var(--line); }
.ov-page-tile-art img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.ov-page-tile-none { display: grid; place-items: center; height: 100%; font-size: 15px; font-weight: 700; color: var(--muted); }
.ov-page-tile-words { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.ov-page-tile-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ov-page-tile-label { font-size: 13px; font-weight: 700; color: var(--blue-dark); }
.ov-page-tile-text { font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ov-panel-image { display: block; width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: #fff; margin-bottom: 14px; }
.ov-panel-text { font-size: 18px; line-height: 1.55; margin: 0 0 8px; }
.ov-page-tile-story { font-size: 13px; font-weight: 600; color: var(--muted); }
.material-grid .ov-page-grid { margin-top: 6px; }

/* Tags: small coloured chips, each colour one kind of tag. */
.ov-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ov-tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.3; border: 1px solid transparent; cursor: default; }
.ov-tag.tone-page { background: #e8f1fc; color: #1f5fa8; border-color: #c9ddf5; }
.ov-tag.tone-kind { background: #f1eee8; color: #5c564c; border-color: #e2dccf; }
.ov-tag.tone-topic { background: #f0eafc; color: #5b3fa6; border-color: #ddd0f5; }
.ov-tag.tone-across { background: #fff3dc; color: #8a5a00; border-color: #f1d9a8; }
.ov-tag.tone-book { background: #e6f5ee; color: #1f6b4a; border-color: #c5e6d5; }
.ov-row-open .ov-tags { margin-top: 4px; }
.ov-one .ov-tags { justify-content: center; }
.ov-one-purpose { margin: 0; max-width: 46ch; font-size: 15px; line-height: 1.5; color: var(--muted); }

/* The page's own picture, on a tile and in One by one. */
.ov-tile-page { display: block; margin: -16px -16px 4px; aspect-ratio: 16 / 9; background: #fff; border-bottom: 1px solid var(--line); border-radius: 16px 16px 0 0; overflow: hidden; }
.ov-tile-page img { width: 100%; height: 100%; object-fit: contain; }
.ov-tile.covered .ov-tile-page { margin-top: -16px; }
.ov-one-page { display: block; width: min(360px, 100%); aspect-ratio: 4 / 3; border-radius: 14px; border: 1px solid var(--line); overflow: hidden; background: #fff; }
.ov-one-page img { width: 100%; height: 100%; object-fit: contain; }

/* Group headings: sentence case, like the rest of the page. */
.ov-group, .ov-goals-head { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 700; color: var(--muted); }

/* About this lesson: a warm white for cards and tiles, softer than pure white on the cream page. */
.about-panel .ov-card, .ov-tile, .ov-tile:hover, .ov-one, .ov-page-tile, .ov-page-tile:hover, .ab-tab[aria-selected="true"], .ov-view.on, .ov-filter, .ov-row.open, .about-panel .le-source { background: var(--warm-white); }
.ab-pane > .ov-card:has(.view-grid) { background: #f8f2e6; }
.ov-tile-page, .ov-one-page, .ov-page-tile-art img, .ov-tile-page img, .ov-one-page img { background: var(--warm-white); }

/* Lesson preview: About this lesson, short and calm. */
.pv-about { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--warm-white); box-shadow: var(--shadow-s); }
.pv-about-title { margin: 0; font-size: 16px; font-weight: 800; }
.pv-about-summary { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); white-space: normal; }
.pv-about-label { margin: 4px 0 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.pv-goals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pv-goals li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pv-goal-check { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--green-dark); color: #fff; font-size: 10px; font-weight: 900; }
.pv-goal-dot { width: 9px; height: 9px; flex: none; margin: 0 4.5px; border-radius: 50%; background: var(--sun, #f4b400); }
.pv-goals li.open { color: var(--muted); }
.pv-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.pv-facts dt { font-weight: 700; color: var(--muted); }
.pv-facts dd { margin: 0; }
.pv-about-open { align-self: flex-start; margin-top: 4px; font-size: 14px; }

/* A button with nothing to do (Save with no changes): clearly grey. */
button.secondary:disabled, a.button-link.secondary[aria-disabled="true"] { background: #efebe3; color: #9b958a; border-color: #e3ddd2; box-shadow: none; cursor: default; transform: none; }

/* ---- Tiles: one shape for every tile; short tags on one row ---- */
.ov-tags { flex-wrap: nowrap; overflow: hidden; gap: 6px; }
.ov-tag { flex: none; white-space: nowrap; max-width: 14em; overflow: hidden; text-overflow: ellipsis; }
.ov-tile { gap: 10px; }
.ov-tile-page.none { display: grid; place-items: center; font-size: 15px; font-weight: 700; color: #a2927a; background: repeating-linear-gradient(135deg, #f6efe2 0 10px, #f2e9d9 10px 20px); }
.ov-tile-top { flex-wrap: nowrap; }
.ov-tile-text { min-height: 2.7em; }
.ov-tile .ov-idea-cards { margin-top: 0; padding-top: 0; }
.ov-tile .ov-add { margin-top: auto; }
.ov-tile.covered { border-top: 1px solid #ece4d3; }
.ov-tile.covered .ov-tile-asks { margin-top: auto; }
.ov-goal-why { font-size: 14px; color: var(--muted); }
.ov-goal-why summary { cursor: pointer; font-weight: 600; color: var(--blue-dark); list-style: none; }
.ov-goal-why summary::-webkit-details-marker { display: none; }
.ov-goal-why summary::before { content: "▸ "; }
.ov-goal-why[open] summary::before { content: "▾ "; }
.ov-goal-why p { margin: 4px 0 0; line-height: 1.45; }
.ov-one .ov-goal-why { max-width: 46ch; text-align: center; }
.ov-one .ov-goal-why summary { display: none; }
.ov-tag-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.ov-tag-legend:empty { display: none; }
.ov-legend-label { font-weight: 700; }
.ov-tag-legend .ov-tag + span { margin-right: 8px; }
.ov-row-open .ov-tags { margin: 0 0 4px; }

/* The material: the same card tone as the other tabs, its facts larger. */
.ov-facts { background: var(--warm-white); border: 1px solid var(--line); padding: 14px 16px; gap: 8px; }
.ov-fact { font-size: 16px; line-height: 1.45; }
.ov-fact-label { width: 190px; font-size: 15px; }
.ab-pane[data-ab="material"] > .ov-card { background: #f8f2e6; }

/* ---- Tiles: small tags that never overflow; everything lined up ---- */
.ov-tag { flex: 0 1 auto; min-width: 0; font-size: 12px; padding: 2px 9px; max-width: none; }
.ov-tile-top { min-width: 0; }
.ov-tile-top .ov-tags { min-width: 0; flex: 1 1 auto; }
.ov-tile-top .ov-book-link { flex: none; }
/* Questions take the same room on every tile, so the cards line up. */
.ov-tile-text { min-height: calc(1.35em * 3); }
.ov-tile > .ov-goal-why { margin-top: auto; }
.ov-tile > .ov-goal-why + .ov-add { margin-top: 0; }
/* Covered: the questions right under the name, at the top. */
.ov-tile.covered .ov-tile-text { min-height: calc(1.35em * 2); }
.ov-tile.covered .ov-tile-asks { margin-top: 0; }
/* Legend: a bar between its parts. */
.ov-legend-sep { color: #cfc4b0; margin: 0 4px; }
.ov-tag-legend .ov-tag + span { margin-right: 0; }

/* One by one and List sit on the same tinted card as Grid. */
.ab-pane > .ov-card:has(.view-one), .ab-pane > .ov-card:has(.view-list) { background: #f8f2e6; }
.view-list .ov-row { background: var(--warm-white); margin-bottom: 4px; border: 1px solid #ece4d3; }
.view-list .ov-row.shade { background: #fbf6ec; }

/* The "no picture" panel: stripes that stand out from the tile. */
.ov-tile-page.none { background: repeating-linear-gradient(135deg, #efe2c9 0 12px, #e6d6b8 12px 24px); color: #6f5c3e; }

/* List rows: clearly separate from the tinted card behind them. */
.view-list .ov-row, .view-list .ov-row.shade { background: var(--warm-white); border: 1px solid #e0d3bb; box-shadow: 0 1px 2px rgba(92, 64, 20, 0.07), 0 4px 12px rgba(92, 64, 20, 0.07); margin-bottom: 8px; }
.view-list .ov-row:hover { border-color: #d3c3a5; }

/* Section heads: description, then a light legend, with room between. */
.about-panel .ov-book-head { margin-bottom: 6px; }
.about-panel .ov-book-head .hint { margin-top: 4px; }
.ov-tag-legend { gap: 6px 18px; margin: 0 0 16px; font-size: 13px; }
.ov-tag-legend[hidden] { display: none; }
.ov-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ov-legend-item .ov-tag { font-size: 11px; padding: 1px 8px; }
.ov-legend-label, .ov-legend-sep { display: none; }
.ov-views[hidden] { display: none; }
.ov-empty { margin: 4px 0 0; padding: 18px; border: 1px dashed #d9ccb4; border-radius: 14px; background: var(--warm-white); color: var(--muted); font-size: 15px; text-align: center; }

/* Layers: a warm-white card, its items on a soft tint (and the reverse in a
   side panel: a tinted panel, warm-white cards in it). */
.lesson-picker .side-lesson, .lp-topic { background: var(--inset); border-color: var(--inset-line); }
.lp-topic[open] > .lesson-picker-list .side-lesson { background: var(--warm-white); }
.roster li { background: var(--inset); border-color: var(--inset-line); }
.roster li.offline { background: #f3ede2; }
.sp-panel { background: #f6efe1; }
.sp-head, .sp-actions { background: #f6efe1; }
.sp-body > .pv-question, .sp-body > .pv-about, .sp-body .stop-card { background: var(--warm-white); border-color: var(--inset-line); }

/* Picture libraries: a badge in a picture's corner, and a key that says what they are. */
.card-choice, .lib-pick { position: relative; }
.lib-badge { position: absolute; top: 6px; left: 6px; min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box; display: grid; place-items: center; border-radius: 999px; font-size: 12px; font-weight: 800; line-height: 1; border: 1px solid transparent; pointer-events: none; }
.lib-badge.tone-boy { background: #e3eefc; color: #1f5fa8; border-color: #c4d9f4; }
.lib-badge.tone-girl { background: #fbe6f0; color: #a3366b; border-color: #f2c7da; }
.lib-badge.tone-symbol { background: #e2f4ea; color: #1f6b4a; border-color: #c2e3d1; }
.lib-badge.tone-other { background: #fff1d6; color: #8a5a00; border-color: #f1d9a8; }
.lib-key { display: flex; flex-direction: column; gap: 6px; margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; background: var(--inset, #f6efe1); }
.lib-key-note { margin: 0; font-size: 13px; color: var(--muted); }
.lib-key-list { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.lib-key-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.lib-key-item .lib-badge { position: static; }
.picker-grid > .lib-key, .symbol-results > .lib-key { grid-column: 1 / -1; }


/* ---------- Image bank: sources on the left, one tile per word ---------- */

.sp-panel.wide.bank-panel { width: min(980px, 100%); }
.picture-browser.ib { container-type: inline-size; }
.ib-top { align-items: center; }
.ib-sort { display: inline-flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--warm-white); }
.ib-sort button { min-height: 0; padding: 7px 12px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; box-shadow: none; }
.ib-sort button + button { border-left: 2px solid var(--line); }
.ib-sort button.on { background: var(--inset); color: var(--ink); }
.ib-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; min-height: 0; }
.picker .ib-body { overflow-y: auto; }
.ib-sources { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--inset); border: 1px solid var(--inset-line); border-radius: 16px; position: sticky; top: 0; max-height: 70vh; overflow-y: auto; }
.ib-source { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 0; padding: 7px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 600; text-align: left; box-shadow: none; }
.ib-source:hover { background: rgba(255, 255, 255, 0.6); }
.ib-source.on { background: var(--warm-white); box-shadow: var(--shadow-s); font-weight: 800; }
.ib-source-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-source-count { flex: none; font-size: 12px; color: var(--muted); font-weight: 700; }
.ib-source.ib-group { margin-top: 6px; font-weight: 800; }
.ib-source.ib-nested { padding-left: 26px; font-size: 13px; font-weight: 500; }
.ib-source.ib-all { font-weight: 800; }
.ib-sources-heading { margin: 10px 10px 2px; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ib-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ib-head { display: flex; gap: 14px; align-items: center; }
.ib-head[hidden] { display: none; }
.ib-cover { width: 64px; height: 64px; flex: none; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.ib-cover img { width: 100%; height: 100%; object-fit: cover; }
.ib-head h3 { margin: 0 0 2px; font-size: 20px; }
.ib-head .hint { margin: 0; }
.ib-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: #fff3c4; border: 1px solid #f0d77a; border-radius: 14px; }
.ib-banner[hidden] { display: none; }
.ib-banner p { margin: 0; font-weight: 600; }
.ib-banner button { flex: none; }
.ib-grid { overflow: visible; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.ib-tile { position: relative; }
.ib-tile .picker-pick { position: relative; padding: 8px 8px 10px; }
.ib-tile.is-hidden .picker-pick { opacity: 0.55; border-style: dashed; }
.ib-chip { max-width: 100%; padding: 1px 8px; border-radius: 999px; background: var(--inset); border: 1px solid var(--inset-line); font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-count { position: absolute; top: 6px; left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; }
.ib-more { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; min-height: 0; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--warm-white); color: var(--ink); font-size: 16px; font-weight: 800; line-height: 1; box-shadow: var(--shadow-s); opacity: 0; transition: opacity 0.12s; }
.ib-tile:hover .ib-more, .ib-more:focus-visible, .ib-tile:has(.ib-menu) .ib-more { opacity: 1; }
@media (hover: none) { .ib-more { opacity: 1; } }
.ib-menu { position: absolute; top: 38px; right: 6px; z-index: 5; display: flex; flex-direction: column; min-width: 170px; padding: 6px; background: var(--warm-white); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(60, 40, 10, 0.18); }
.ib-menu-item { min-height: 0; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 600; text-align: left; box-shadow: none; }
.ib-menu-item:hover { background: var(--inset); }
.ib-menu-item.ib-danger { color: var(--red); }
.ib-hidden-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border: 2px dashed var(--inset-line); border-radius: 14px; color: var(--muted); font-size: 14px; }
.ib-hidden-line[hidden] { display: none; }
.ib-copies { width: min(640px, 100%); }
.ib-copies .hint { margin: 0; }
.ib.ib-empty .ib-sources { display: none; }
.ib.ib-empty .ib-body { grid-template-columns: 1fr; }
/* Narrow (the picker, a phone): the sources become a row of chips. */
@container (max-width: 620px) {
  .ib-body { grid-template-columns: 1fr; }
  .ib-sources { position: static; flex-direction: row; overflow-x: auto; max-height: none; padding: 6px; }
  .ib-source { width: auto; flex: none; }
  .ib-source.ib-nested { padding-left: 10px; }
  .ib-source.ib-group { margin-top: 0; }
  .ib-sources-heading { display: none; }
  .ib-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* Image bank: selecting, details, size */
.ib-select-toggle.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.ib-select-bar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; background: var(--warm-white); border: 2px solid var(--blue-line, #bcd3f5); border-radius: 14px; box-shadow: var(--shadow-s); }
.ib-select-bar[hidden] { display: none; }
.ib-select-count { flex: 1 1 auto; font-weight: 700; }
.ib-check { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--line); background: #fff; color: #fff; font-size: 14px; font-weight: 900; }
.ib-tile.is-selected .picker-pick { border-color: var(--blue); background: var(--blue-soft, #eaf2ff); }
.ib-tile.is-selected .ib-check { background: var(--blue); border-color: var(--blue); }
.ib-selecting .ib-tile .picker-pick { cursor: pointer; }
.ib-size { font-size: 12px; font-weight: 700; color: var(--muted); }
.ib-details { width: min(680px, 100%); }
.ib-details-body { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 18px; align-items: start; }
.ib-details-img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.ib-facts { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ib-facts > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--inset-line); }
.ib-facts dt { color: var(--muted); font-weight: 700; font-size: 14px; }
.ib-facts dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .ib-details-body { grid-template-columns: 1fr; } }

.ib-select-count { display: flex; flex-direction: column; gap: 2px; }
.ib-select-hint { font-size: 13px; font-weight: 500; color: var(--muted); }
.ib-select-bar .link-button[hidden], .ib-select-toggle[hidden] { display: none; }
.ib-done { background: var(--ink); color: #fff; border-color: var(--ink); }
.ib-select-bar { flex-wrap: nowrap; }
.ib-select-bar > * { flex: none; }
.ib-select-bar > .ib-select-count { flex: 1 1 0; min-width: 0; }
@container (max-width: 620px) { .ib-select-bar { flex-wrap: wrap; } .ib-select-bar > .ib-select-count { flex-basis: 100%; } }

/* What a board's squares show: pictures only, or words only (written large). */
.word-board[data-show="pictures"] .wb-label { display: none; }
.word-board[data-show="pictures"] .wb-cell { justify-content: center; }
.word-board[data-show="words"] .wb-picture, .word-board[data-show="words"] .wb-emoji { display: none; }
.word-board[data-show="words"] .wb-cell { justify-content: center; }
.word-board[data-show="words"] .wb-label { font-size: clamp(11px, 20cqw, 40px); -webkit-line-clamp: 3; }
.bv-preview[data-show="words"] .wb-label { font-size: 9px; }

/* Making a board: size (with any size), what squares show, scramble. */
.bv-size-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bv-custom { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.bv-custom input { width: 4.2em; padding: 6px 8px; }
.bv-show-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.bv-show-row .bv-row-label, .bv-size-row .bv-row-label { font-weight: 800; color: var(--muted); font-size: 14px; }
.bv-show-row .chip.selected { background: var(--blue); color: #fff; border-color: var(--blue); }
.bv-custom.selected { padding: 3px 8px; border-radius: 999px; background: var(--blue-soft); outline: 2px solid var(--blue); }
.word-board[data-show="pictures"] .wb-no-picture .wb-label { display: -webkit-box; font-size: clamp(11px, 20cqw, 40px); }
.word-board[data-show="pictures"] .wb-no-picture .wb-emoji { display: none; }

/* Choose a board: one card, a row for each choice, then the layouts. */
.bv-settings { display: grid; grid-template-columns: max-content 1fr; gap: 12px 18px; align-items: start; margin: 10px 0 18px; padding: 14px 18px; background: var(--card, #fffcf6); border: 1px solid var(--line); border-radius: 16px; }
.bv-setting-name { padding-top: 7px; font-size: 13px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.bv-settings .bv-size-row, .bv-settings .bv-show-row { margin: 0; }
.bv-settings .picture-style-label { display: none; }
.bv-setting-pictures { display: grid; gap: 6px; }
.bv-setting-pictures .aac-hide-row, .bv-order { margin: 0; padding-top: 6px; }
.bv-ask-hint { margin: 0 0 0 26px; max-width: 62ch; }
.bv-layouts-label { margin: 0 0 8px; }
@media (max-width: 640px) { .bv-settings { grid-template-columns: 1fr; gap: 4px; } .bv-setting-name { padding-top: 10px; } }

/* A "?" with its explanation in a bubble, right where it is. */
.info-tip { position: relative; display: inline-flex; vertical-align: middle; margin-left: 6px; }
.info-tip .info-dot { width: 22px; height: 22px; font-size: 12px; padding: 0; cursor: pointer; }
.info-bubble { position: absolute; z-index: 60; top: calc(100% + 8px); left: -12px; width: min(340px, 80vw); display: grid; gap: 8px; padding: 12px 14px; background: var(--warm-white, #fffcf6); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(40, 30, 10, 0.18); font-size: 14px; font-weight: 500; line-height: 1.4; text-align: left; text-transform: none; letter-spacing: normal; white-space: normal; }
.info-bubble[hidden] { display: none; }
.info-tip.at-end .info-bubble { left: auto; right: -12px; }
.bv-ask-row { display: flex; align-items: center; gap: 2px; }
.download-row { display: flex; align-items: center; gap: 8px; }
.download-row > button { flex: 1; }
.download-row .info-tip { margin-left: 0; }
.download-row .info-dot { width: 30px; height: 30px; font-size: 15px; }

/* Teaching with the AAC board open beside the question: the whole question
   (page picture, cards, who's answered, the buttons) fits the column without
   scrolling. --q-room is the column's height under the Ask bar; the page
   picture and the cards are sized from it. */
@media (min-width: 1101px), (min-width: 900px) and (orientation: landscape) {
  .teacher-view.with-aac .live-question { --q-room: calc(100dvh - var(--aac-offset, 120px) - 110px); --card-pic: clamp(44px, calc((var(--q-room) - 360px) / 2), 120px); gap: 8px; padding: 12px; }
  .teacher-view.with-aac .live-question .asked-text { font-size: clamp(19px, 1.7vw, 26px); line-height: 1.2; }
  .teacher-view.with-aac .live-question.has-picture { column-gap: 14px; row-gap: 8px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .teacher-view.with-aac .live-question.has-picture .question-picture { max-height: calc(var(--q-room) - 170px); object-fit: contain; object-position: top center; }
  .teacher-view.with-aac .live-question .answer-grid,
  .teacher-view.with-aac .live-question .answer-grid.few { grid-template-columns: repeat(auto-fill, minmax(calc(var(--card-pic) + 28px), 1fr)); gap: 8px; }
  .teacher-view.with-aac .live-question .answer-grid .answer-card { padding: 6px 6px 8px; gap: 4px; }
  .teacher-view.with-aac .live-question .answer-grid .answer-card.words-only { min-height: 64px; }
  .teacher-view.with-aac .live-question .answer-card .card-picture { max-width: var(--card-pic); }
  .teacher-view.with-aac .live-question .answer-card .emoji { font-size: calc(var(--card-pic) * 0.55); }
  .teacher-view.with-aac .live-question .answer-card .label,
  .teacher-view.with-aac .live-question .answer-grid.few .answer-card .label { font-size: 15px; }
  .teacher-view.with-aac .live-question .answer-pool { padding: 6px 10px; gap: 2px; }
  .teacher-view.with-aac .live-question .pool-label { font-size: 14px; }
  .teacher-view.with-aac .live-question .results { padding: 8px 10px; gap: 6px 10px; bottom: 0; }
  .teacher-view.with-aac .live-question .results .question-actions button { padding: 8px 14px; font-size: 15px; min-height: 0; }
}

/* A topic's colour beside its name: the same colour as its tiles. */
.side-link .side-dot { flex: none; width: 11px; height: 11px; border-radius: 50%; background: var(--dot); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); overflow: visible; }
.side-link .side-link-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Topics are tags in their own colour; the tile keeps its kind's colour. */
.lesson-tile-foot .library-side.topic-chip:not(.empty) { --topic: var(--blue); background: color-mix(in srgb, var(--topic) 22%, #fff); border: 1.5px solid var(--topic); color: color-mix(in srgb, var(--topic) 55%, #1b1b1f); }
.lesson-tile-foot .library-side.topic-chip:not(.empty)::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--topic); vertical-align: 1px; }
/* Board and AAC tiles: the board on white, like a lesson's picture. */
.lesson-tile-art.board-art { background: #fff; }

/* The topic panel. */
.topic-tag { --topic: var(--blue); display: inline-flex; align-items: center; gap: 7px; min-height: 0; padding: 7px 14px; border-radius: 999px; background: color-mix(in srgb, var(--topic) 18%, #fff); border: 2px solid color-mix(in srgb, var(--topic) 70%, #fff); color: color-mix(in srgb, var(--topic) 50%, #1b1b1f); box-shadow: none; font-weight: 800; font-size: 15px; }
.topic-tag::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--topic); }
.topic-tag:disabled { opacity: 1; cursor: default; }
.topic-tag.on { border-color: var(--topic); }
.topic-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.topic-current { display: grid; gap: 8px; margin-bottom: 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--warm-white, #fffcf6); }
.topic-current .le-label { margin: 2px 0 0; }
.topic-current .hint { margin: 0; }
.topic-current-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.topic-remove { color: var(--red, #c62828); }
.topic-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-swatch { width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 50%; background: var(--swatch); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.topic-swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--ink); }
.topic-new { display: flex; gap: 8px; }
.topic-new input { flex: 1; }
.topic-via { margin: 0 0 12px; padding: 8px 10px; border-radius: 10px; background: var(--blue-soft); }

/* Sidebar: easier to read. Lighter words, long names wrap instead of "…". */
.side-link { font-weight: 600; font-size: 14.5px; padding: 8px 10px; line-height: 1.3; }
.side-link .side-link-text { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.side-link.on { font-weight: 700; }
.side-count { font-weight: 600; min-width: 20px; text-align: right; }
.side-heading { margin-top: 18px; }
/* Each tile: what it was made from, and an "i" in its lower right corner. */
.lesson-tile-foot .tile-from { flex: 1 0 100%; min-width: 0; font-size: 13px; font-weight: 600; color: color-mix(in srgb, var(--ink) 78%, transparent); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lesson-tile.has-info .lesson-tile-foot { padding-right: 50px; min-height: 30px; }
.lesson-tile .tile-info.info-tip { position: absolute; right: 12px; bottom: 12px; margin: 0; z-index: 2; }
.tile-info .info-dot, .tile-info .info-dot:hover { width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--blue) 55%, transparent); background: #fff; color: var(--blue-dark); box-shadow: none; font: italic 700 15px/1 Georgia, serif; }
.lesson-tile:has(.info-tip.open) { overflow: visible; z-index: 20; }
.lesson-tile-open, .lesson-tile-open:hover, .lesson-tile-open:active { overflow: hidden; border-radius: 20px 20px 0 0; }
/* The popup: short rows, a small label over each. */
.tile-info .info-bubble { top: calc(100% + 8px); left: auto; right: -12px; width: min(280px, 82vw); gap: 0; padding: 4px 14px; font-size: 14px; }
.source-row { display: grid; gap: 3px; padding: 10px 0; }
.source-row + .source-row { border-top: 1px solid var(--line); }
.source-label { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.source-title { font-size: 14.5px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.source-kind { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 6px; background: var(--paper, #f4efe6); font-size: 11.5px; font-weight: 700; color: var(--muted); vertical-align: 1px; }
.source-note { font-size: 13px; color: var(--muted); line-height: 1.35; }
/* One search; a small button in it opens "Search by". */
.search-wrap { position: relative; margin: 0 0 6px; }
.search-wrap .side-search { margin: 0; padding-right: 40px; }
.search-wrap .side-search { padding-right: 46px; }
.search-by-toggle, .search-by-toggle:hover { position: absolute; top: 50%; right: 5px; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 30px; min-height: 0; padding: 0; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); box-shadow: none; }
.search-by-toggle:hover { border-color: var(--blue); color: var(--blue-dark); }
.search-by-toggle svg { transform: rotate(90deg); transition: transform 0.15s ease; }
.search-by-toggle.open svg { transform: rotate(-90deg); }
.search-by-toggle.set { background: var(--blue-soft); color: var(--blue-dark); }
.search-by { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 2px 8px; }
.search-by[hidden] { display: none; }
.search-by-label { flex: 1 0 100%; font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.search-by-chip, .search-by-chip:hover { min-height: 0; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; box-shadow: none; color: var(--ink); font-size: 13px; font-weight: 600; }
.search-by-chip.on { background: var(--blue-soft); border-color: transparent; color: var(--blue-dark); }
@media (max-width: 760px) { .library-side-panel .search-wrap, .library-side-panel .search-by { flex: 1 1 100%; } }
