/* Riot Room — exercise-book ink on cool paper, with one highlighter-yellow accent. */
:root {
  --paper: #eef2f6;
  --card: #ffffff;
  --ink: #1b2a41;
  --ink-2: #4a5a70;
  --muted: #6b7a8f;
  --line: #d6dde6;
  --line-2: #e6ebf1;
  --hl: #ffe14d;
  --hl-soft: #fff4b8;
  --live: #23935f;
  --warn: #b5442f;
  --focus: #1c64c8;
  --radius: 10px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.5 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
a { color: var(--focus); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #b9c4d2; background: #f8fafc; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #2a3d5a; border-color: #2a3d5a; }
.btn-hl { background: var(--hl); border-color: #e9c92a; color: var(--ink); }
.btn-hl:hover { background: #ffd91a; border-color: #d9b81a; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(27, 42, 65, .06); border-color: transparent; }
.btn-danger { color: var(--warn); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 14px; }
.btn-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.input {
  min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%;
}
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(28, 100, 200, .18); }
.error { color: var(--warn); font-weight: 600; min-height: 1.5em; }
.muted { color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c3ccd7; display: inline-block; flex: none; }
.dot.on { background: var(--live); }

/* The highlighter swipe used behind key words and the active slide. */
.mark { background: linear-gradient(transparent 18%, var(--hl) 18%, var(--hl) 88%, transparent 88%); padding: 0 .15em; }

/* ---------- slide canvas ---------- */
.stage-host { position: relative; overflow: hidden; }
.stage { position: absolute; transform-origin: 0 0; background: #fff; user-select: none; -webkit-user-select: none; touch-action: none; }
.stage-bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage-ink { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ink-pen { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ink-hl { fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .45; mix-blend-mode: multiply; }
.stage-texts, .stage-chips { position: absolute; inset: 0; }
/* Both layers cover the whole slide, so only the boxes and words inside them catch clicks. */
.stage-texts, .stage-chips { pointer-events: none; }
.stage-chips .chip { pointer-events: auto; }
/* The pointer for each tool is set from stage.js so it can match the chosen colour. */
.stage-texts .tb { pointer-events: auto; }
.stage[data-tool="pen"] .tb, .stage[data-tool="hl"] .tb, .stage[data-tool="erase"] .tb,
.stage[data-tool="tick"] .tb, .stage[data-tool="query"] .tb, .stage-texts .tb.ro { pointer-events: none; }

/* Numbers placed with the number pad, centred on where they were tapped. */
.stage-digits { position: absolute; inset: 0; pointer-events: none; }
.digit { position: absolute; transform: translate(-50%, -50%); font-family: var(--font); font-weight: 700; line-height: 1; white-space: nowrap; }
.digit.moving { opacity: .65; }
.stage[data-tool="num"] .tb { pointer-events: none; }

/* The teacher's ✓ and ? marks. Sized in slide units, so they scale with the slide. */
.stage-stamps { position: absolute; inset: 0; pointer-events: none; }
.stamp {
  position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font: 800 28px/1 var(--font); box-shadow: 0 0 0 3px #fff, 0 2px 8px rgba(27, 42, 65, .3);
}
.stamp-tick { background: #1f8a4c; }
.stamp-query { background: #c26a00; }
.stamp svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }

/* --u is one screen pixel, so the handles stay a usable size however much the slide is scaled. */
.tb { position: absolute; line-height: 1.3; --u: calc(1px / var(--k, 1)); }
.tb-text {
  display: block; width: 100%; margin: 0; padding: 4px 6px; border: 0; background: transparent; resize: none; overflow: hidden;
  font-family: var(--font); font-size: 1em; line-height: 1.3; color: inherit; white-space: pre-wrap; overflow-wrap: break-word; min-height: 1.6em;
}
textarea.tb-text { outline: 1px dashed transparent; border-radius: 4px; cursor: move; }
textarea.tb-text:focus { cursor: text; }
.tb:hover textarea.tb-text { outline-color: #9fb0c5; }
textarea.tb-text:focus, .tb.dragging textarea.tb-text { outline: 2px solid var(--focus); background: rgba(255, 255, 255, .85); }
.tb.dragging { z-index: 5; }
.tb-grip, .tb-del, .tb-size { position: absolute; display: none; border: 0; padding: 0; }
.tb:hover .tb-grip, .tb:focus-within .tb-grip, .tb.dragging .tb-grip,
.tb:hover .tb-del, .tb:focus-within .tb-del,
.tb:hover .tb-size, .tb:focus-within .tb-size, .tb.dragging .tb-size { display: block; }
.tb.dragging .tb-del { display: none; }
.tb-grip {
  left: calc(-32 * var(--u)); top: 0; width: calc(28 * var(--u)); height: calc(28 * var(--u)); border-radius: calc(7 * var(--u));
  cursor: grab; background: var(--ink); color: #fff;
}
.tb-grip:active { cursor: grabbing; }
.tb-grip svg { display: block; width: 100%; height: 100%; padding: 16%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tb-del {
  right: calc(-12 * var(--u)); top: calc(-12 * var(--u)); width: calc(24 * var(--u)); height: calc(24 * var(--u)); border-radius: 50%;
  background: var(--warn); color: #fff; font: 700 calc(18 * var(--u)) / calc(24 * var(--u)) var(--font); cursor: pointer; text-align: center;
}
.tb-size {
  right: calc(-8 * var(--u)); top: 50%; transform: translateY(-50%); width: calc(14 * var(--u)); height: calc(32 * var(--u));
  border-radius: calc(7 * var(--u)); background: #fff; border: calc(2.5 * var(--u)) solid var(--focus); cursor: ew-resize;
}

.chip {
  position: absolute; padding: .25em .6em; border-radius: .4em; background: #fff; border: 2px solid var(--ink);
  font-weight: 700; line-height: 1.25; color: var(--ink); white-space: nowrap; box-shadow: 0 2px 0 var(--ink); touch-action: none;
}
.chip-tray { position: static; font-size: 17px; cursor: grab; }
.stage .chip { cursor: grab; }
/* While dragging a word, number or text box, the pointer stays a gripping hand everywhere (set from stage.js). */
html.is-dragging, html.is-dragging * { cursor: grabbing !important; }
/* Teacher screens only: a placed word outlined green (right place) or red (not right). */
.chip.chip-right { border-color: #1f8a4c; box-shadow: 0 0 0 3px #1f8a4c; background: #e7f5ec; }
.chip.chip-wrong { border-color: #c93a3a; box-shadow: 0 0 0 3px #c93a3a; background: #fbe9e9; }
.chip-ghost { position: fixed; z-index: 1000; pointer-events: none; transform: rotate(-2deg); box-shadow: 0 8px 20px rgba(27, 42, 65, .25); }

/* ---------- drawing toolbar (student screen and teacher's enlarged view) ---------- */
.toolbar {
  display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--card); border-top: 1px solid var(--line); flex-wrap: wrap;
}
.tool-group { display: flex; align-items: center; gap: 4px; }
.tool-group + .tool-group { padding-left: 14px; border-left: 1px solid var(--line-2); }
.tool {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; cursor: pointer; font-weight: 600; font-size: 14px;
}
.tool:hover { background: #f1f4f8; }
.tool[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool .hl-line { stroke: var(--hl); stroke-width: 3; }
.tool.icon-only { padding: 0 10px; }
.tool:disabled { opacity: .35; cursor: default; background: transparent; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.size-btn { height: 34px; min-width: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; padding: 0 8px; }
.size-btn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- web link slides (student screen and teacher's live screen) ---------- */
.lv { width: 100%; height: 100%; min-height: 0; display: grid; grid-template-rows: auto 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lv svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.lv-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.lv-icon { color: var(--focus); display: inline-flex; }
.lv-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lv-domain { color: var(--muted); font-size: 13px; white-space: nowrap; }
.lv-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.lv-card { grid-template-rows: 1fr; place-items: center; background: linear-gradient(160deg, #eef4fd, #fff 60%); }
.lv-card-inner { display: grid; justify-items: center; gap: 8px; padding: 24px; text-align: center; max-width: 520px; }
.lv-big-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: #e0ebfb; color: var(--focus); }
.lv-big-icon svg { width: 34px; height: 34px; }
.lv-card-title { font-size: 26px; overflow-wrap: anywhere; }
.lv-card-domain { margin: 0; color: var(--muted); }
.lv-open { min-height: 52px; padding: 0 26px; font-size: 18px; margin-top: 8px; }
.lv-open svg { width: 20px; height: 20px; }
.lv-card-note { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- polls: writing one (editor and live screen) ---------- */
.pf { display: grid; gap: 12px; }
.pf-types { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: fit-content; max-width: 100%; }
.pf-types button { border: 0; background: #fff; padding: 7px 12px; font-weight: 600; font-size: 14px; cursor: pointer; }
.pf-types button + button { border-left: 1px solid var(--line); }
.pf-types button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.pf-field { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.pf-field .muted { font-weight: 400; }
.pf-q { resize: vertical; min-height: 56px; font-weight: 400; }
.pf-label { font-weight: 600; font-size: 14px; }
.pf-label .muted { font-weight: 400; }
.pf-choice { display: grid; gap: 8px; }
.pf-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pf-options li { display: flex; align-items: center; gap: 6px; }
.pf-letter { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--line-2); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.pf-opt { min-height: 38px; flex: 1; min-width: 0; }
.pf-mark, .pf-remove { width: 34px; height: 34px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 800; color: var(--muted); }
.pf-mark[aria-pressed="true"] { background: #1f8a4c; border-color: #1f8a4c; color: #fff; }
.pf-remove { color: var(--warn); font-size: 18px; }
.pf-remove:disabled { opacity: .35; cursor: default; }
.pf-add { width: fit-content; }
.pf-hint { margin: 0; font-size: 14px; }
.pf-error { margin: 0; color: var(--warn); font-weight: 600; font-size: 14px; }
.pf-error:empty { display: none; }

/* ---------- polls: results chart (teacher and, when shown, students) ---------- */
.pr-total { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.pr { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.pr-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(60px, 1fr) 28px; gap: 8px; align-items: center; font-size: 14px; }
.pr-label { min-width: 0; overflow-wrap: anywhere; }
.pr-label b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 6px; background: var(--line-2); font-size: 12px; margin-right: 4px; }
.pr-bar { height: 14px; border-radius: 7px; background: var(--line-2); overflow: hidden; }
.pr-bar span { display: block; height: 100%; border-radius: 7px; background: #5a8fd8; transition: width .35s ease; }
.pr-count { font-weight: 800; text-align: right; }
.pr-correct .pr-bar span { background: #1f8a4c; }
.pr-correct .pr-label b { background: #1f8a4c; color: #fff; }
.pr-tag { display: inline-block; font-size: 11px; font-weight: 800; color: #1f8a4c; white-space: nowrap; }
.pr-tag-mine { color: #1a4f9c; }
.pr-mine .pr-label { font-weight: 700; }
.pr-none { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- number pad (student screen and teacher's enlarged view / demonstration) ---------- */
.tool-123 { font-weight: 800; font-size: 13px; letter-spacing: -.02em; border: 2px solid currentColor; border-radius: 5px; padding: 0 3px; line-height: 16px; }
.numpad { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.numpad[hidden] { display: none !important; }
.numpad-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.numpad-group { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.num-key {
  width: 52px; height: 52px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font: 800 26px/1 var(--font);
  color: var(--ink); cursor: grab; touch-action: none; box-shadow: 0 2px 0 var(--line);
}
.num-key:hover { border-color: #b9c4d2; }
.num-key.sym { background: #eef4fd; border-color: #c9d9f2; box-shadow: 0 2px 0 #c9d9f2; }
.num-key.rubout { display: inline-grid; place-items: center; background: #fdf1ef; border-color: #ecc6c0; box-shadow: 0 2px 0 #ecc6c0; cursor: pointer; }
.num-key.rubout svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num-key[aria-pressed="true"], .num-key.sym[aria-pressed="true"], .num-key.rubout[aria-pressed="true"] {
  background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 2px 0 #0d1624;
}
.numpad-help { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.numpad-help.nudge { color: var(--warn); font-weight: 700; }
.digit-ghost {
  position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%); font: 800 40px/1 var(--font); color: var(--ink);
  background: rgba(255, 255, 255, .9); border: 2px solid var(--focus); border-radius: 10px; padding: 4px 12px; box-shadow: 0 8px 20px rgba(27, 42, 65, .25);
}
@media (max-width: 760px) {
  .num-key { width: 44px; height: 44px; font-size: 22px; }
}

.size-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.size-toggle button { border: 0; background: #fff; padding: 5px 12px; font-weight: 600; font-size: 14px; cursor: pointer; }
.size-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.size-toggle button:disabled { cursor: default; opacity: .6; }

/* ---------- chat ---------- */
.chat-btn { position: relative; }
.chat-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-btn[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chat-badge {
  position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--warn); color: #fff; font-size: 12px; font-weight: 800; line-height: 20px; text-align: center;
}
.chat {
  width: 320px; flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--card); border-left: 1px solid var(--line);
}
.chat[hidden] { display: none !important; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line-2); }
.chat-head h2 { font-size: 17px; }
.chat-min svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.chat-mode { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 16px 0; }
.chat-mode-label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.chat-rule { margin: 0; padding: 8px 16px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line-2); }
.chat-list { list-style: none; margin: 0; padding: 12px; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.chat-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 24px 8px; }
.chat-day { align-self: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.msg { max-width: 88%; align-self: flex-start; background: #f1f4f8; border-radius: 12px 12px 12px 4px; padding: 6px 10px 8px; }
.msg.mine { align-self: flex-end; background: #e6effc; border-radius: 12px 12px 4px 12px; }
.msg.from-teacher:not(.mine) { background: var(--hl-soft); }
.msg.private { box-shadow: inset 0 0 0 1.5px #b9c4d2; }
.msg-meta { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.msg-meta strong { color: var(--ink); font-size: 13px; }
.msg-to { font-style: italic; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; }
.msg-text a { color: var(--focus); font-weight: 600; }
.msg-del { margin-left: auto; border: 0; background: none; color: var(--warn); font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer; padding: 0 2px; opacity: 0; }
.msg:hover .msg-del, .msg-del:focus-visible { opacity: 1; }
.chat-form { padding: 10px 12px 12px; border-top: 1px solid var(--line-2); display: grid; gap: 6px; }
.chat-to { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.chat-to-pick { position: relative; flex: 1; min-width: 0; }
.chat-to-btn {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font: inherit; font-size: 14px; font-weight: 400; color: var(--ink); text-align: left; cursor: pointer;
}
.chat-to-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-to-btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chat-to-btn.to-one { border-color: #5b3c99; background: #f6f2fd; color: #5b3c99; font-weight: 600; }
/* The menu opens upwards, because the message box is at the bottom of the screen. */
.chat-to-menu {
  position: absolute; z-index: 30; left: 0; right: 0; bottom: calc(100% + 4px); max-height: 260px; overflow-y: auto;
  list-style: none; margin: 0; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(27, 42, 65, .2);
}
.chat-to-menu li { padding: 7px 10px; border-radius: 6px; font-size: 14px; font-weight: 400; color: var(--ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; outline: none; }
.chat-to-menu li:hover, .chat-to-menu li:focus-visible { background: #efe8fb; }
.chat-to-menu li[aria-selected="true"] { font-weight: 700; color: #5b3c99; }
.msg-reply { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.msg-reply:hover { color: #5b3c99; }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; }
.chat-text { min-height: 44px; resize: none; padding: 8px 10px; font-size: 15px; line-height: 1.35; }
.chat-error { margin: 0; color: var(--warn); font-size: 13px; font-weight: 600; }

/* Flares: one-tap messages. */
.flares { display: flex; flex-wrap: wrap; gap: 6px; }
.flare {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 6px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.flare:hover { background: #f1f4f8; border-color: #b9c4d2; }
.flare:disabled { opacity: .5; cursor: default; }
.flare .flare-emoji { font-size: 17px; line-height: 1; }
.flare-help { border-color: #d9a6a0; }
.flare-help:hover { background: #fdf1ef; border-color: var(--warn); }
.msg-flare { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; padding-top: 2px; }
.msg-flare .flare-emoji { font-size: 30px; line-height: 1.1; }
@media (prefers-reduced-motion: no-preference) {
  .msg.is-flare .flare-emoji { display: inline-block; animation: flare-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
  @keyframes flare-pop { from { transform: scale(.4); } }
}
.msg.flare-help { background: #fff; box-shadow: inset 0 0 0 2px var(--warn); }
/* The white flag disappears on white, so it always sits on a solid red circle. */
.flare-help .flare-emoji {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--warn); font-size: 13px;
}
.msg.flare-help .flare-emoji { display: inline-grid; width: 40px; height: 40px; font-size: 22px; }

/* A student's "Got it" on the teacher's screen (cleared when the slide changes). */
.got-flag {
  display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; background: #1f8a4c; color: #fff;
  font-size: 12px; font-weight: 800; white-space: nowrap;
}

/* A student's help flag on the teacher's screen. */
.help-flag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px 1px 4px; border-radius: 999px; background: var(--warn); color: #fff;
  font-size: 12px; font-weight: 800; white-space: nowrap;
}
.chat-error:empty { display: none; }
@media (max-width: 900px) {
  /* On small screens the chat slides over the slide instead of squeezing it. */
  .chat { position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 100%); z-index: 40; box-shadow: -8px 0 30px rgba(27, 42, 65, .18); }
}

/* ---------- top bars ---------- */
.bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); min-height: 60px;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
/* The Riot Room logo: the bubbly "R" next to the name in top bars, and the full logo on welcome cards. */
.brand-mark { height: 28px; width: auto; display: block; flex: none; }
.brand-logo { display: block; width: min(220px, 70%); height: auto; }
.brand-logo-link { display: block; width: fit-content; }
.brand-logo-link .brand-logo { width: 220px; max-width: 100%; }
.spacer { flex: 1; }

/* ---------- dialogs ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 30, 46, .55); display: grid; place-items: center; z-index: 50; padding: 24px; }
.dialog { background: var(--card); border-radius: 14px; padding: 24px; width: min(440px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dialog h2 { font-size: 20px; margin-bottom: 8px; }
.dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.dialog-wide { width: min(640px, 100%); max-height: 92vh; overflow-y: auto; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; }

/* A list of polls (lesson editor, poll library, live poll launcher). */
.poll-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.poll-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.poll-item-main { flex: 1; min-width: 200px; }
.poll-item-q { font-weight: 700; overflow-wrap: anywhere; }
.poll-item-sub { font-size: 13px; color: var(--muted); }
.poll-item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.poll-empty { padding: 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 8px; font-weight: 600; z-index: 100; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
/* A student pressed "I need help": red, at the top of the screen, so it never looks like the dark Answers tab at the bottom.
   Several at once stack in a column. */
.help-alerts {
  position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 10px;
  max-width: calc(100% - 32px); pointer-events: none;
}
.help-alert {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  padding: 12px 22px 12px 12px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 18px; font-weight: 800;
  border: 3px solid #fff; box-shadow: 0 0 0 2px var(--warn), 0 10px 30px rgba(181, 68, 47, .45); cursor: pointer; max-width: 100%;
}
.help-alert-flag {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: #fff; font-size: 22px;
}
@media (prefers-reduced-motion: no-preference) {
  .help-alert { animation: help-alert-in .35s cubic-bezier(.3, 1.6, .5, 1); }
  @keyframes help-alert-in { from { opacity: 0; transform: translateY(-12px) scale(.9); } }
}
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in .18s ease-out; }
  @keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
}
