:root {
  --bg: #eef2f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #3a5f91;
  --brand-d: #2d4a72;
  --brand-pale: #eaf1f9;
  --good: #16a34a;
  --bad: #dc2626;
  --warn: #b45309;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win over class `display` rules
   (e.g. .pill, .lobby, .active) — JS toggles visibility via el.hidden. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 80% -10%, var(--brand-pale) 0%, var(--bg) 55%);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px); }

h1, h2 { line-height: 1.15; margin: 0 0 .4em; }

.muted { color: var(--muted); }
.small { font-size: .86rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; color: var(--brand); margin: 0 0 .3em; }

/* ---- buttons ---- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: .98rem; font-weight: 600; padding: 11px 18px;
  border-radius: 12px; cursor: pointer; transition: transform .06s ease, box-shadow .15s ease, background .15s;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: #fecaca; }
.btn.small { padding: 6px 12px; font-size: .85rem; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- forms ---- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 12px; }
.field-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search],
input[type=number], select, textarea {
  width: 100%; margin-top: 6px; padding: 11px 13px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink);
  font-weight: 500; font-family: inherit; box-sizing: border-box;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }

/* ---- accessibility ---- */
/* Skip link: off-screen until a keyboard user tabs to it, then pinned top-left. */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100000; background: var(--brand, #2d4a72); color: #fff; padding: 10px 16px; border-radius: 0 0 10px 0; font-weight: 700; text-decoration: none; }
.skip-link:focus { left: 0; }
#main:focus { outline: none; }   /* the skip target is a container, not an interactive control */
/* A clearly visible keyboard-focus ring on every interactive element (mouse clicks stay clean via :focus-visible). */
a:focus-visible, button:focus-visible, [role="button"]:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--brand, #2d4a72); outline-offset: 2px; border-radius: 4px;
}
/* Respect a user's OS "reduce motion" setting across the whole app. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---- landing ---- */
.hero { text-align: center; padding: 28px 0 8px; }
.hero-logo { width: 84px; height: 84px; display: block; margin: 4px auto 14px; border-radius: 19px; box-shadow: 0 8px 22px rgba(45, 74, 114, .22); }
.brand { font-size: clamp(2.4rem, 6vw, 3.6rem); letter-spacing: -.02em; margin-bottom: .1em; }
.tagline { color: var(--muted); font-size: 1.1rem; max-width: 560px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.center-card {
  max-width: 460px; margin: 8vh auto 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); text-align: center;
}
.center-card .btn { margin-top: 10px; text-decoration: none; display: inline-block; }
.join-title { font-size: 1.6rem; }
.center-card form { text-align: left; margin-top: 18px; }

/* ---- about / how-it-works (landing) ---- */
.about { margin-top: 44px; display: flex; flex-direction: column; gap: 32px; }
.about-h { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
.about-lead { color: var(--muted); font-size: 1.08rem; max-width: 760px; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.feature-ic { font-size: 1.7rem; display: block; margin-bottom: 8px; }
.feature h3 { font-size: 1.05rem; margin: 0 0 .3em; }
.feature p { color: var(--muted); font-size: .9rem; margin: 0; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.about-list, .about-steps { color: var(--muted); padding-left: 1.15em; margin: 10px 0 0; display: flex; flex-direction: column; gap: 9px; }
.about-list li strong, .about-steps li strong { color: var(--ink); }
.about-sub { font-weight: 700; margin: 18px 0 0; color: var(--ink); }

/* ---- pills / topbar ---- */
.pill { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; font-size: .9rem; font-weight: 600; }
.code-pill { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; background: var(--ink); color: #fff; border-color: var(--ink); }
.pill.warn { background: #fffbeb; color: var(--warn); border-color: #fde68a; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.host-title { font-size: 1.5rem; margin: 0; }
/* Unified admin console chrome — shared header across all /admin pages */
.adminbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 16px; margin-bottom: 18px; }
/* Sticky action bar so the single Save button rides along at the top of long settings pages. */
.save-bar { position: sticky; top: 8px; z-index: 30; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; padding: 11px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(15, 23, 42, .10); }
.save-bar .save-bar-hint { margin-left: auto; }
.adminbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.adminbar-brand a { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 700; }
.adminbar-brand img { width: 26px; height: 26px; display: block; }
.admin-tag { font-size: .7rem; color: var(--muted); border-left: 1px solid var(--line); padding-left: 10px; text-transform: uppercase; letter-spacing: .05em; }
.adminhead { margin-bottom: 16px; }
.adminhead .eyebrow { margin: 0 0 .2em; }
.adminhead .host-title { margin: 0; }
/* Collapsible "How this page works" help box — shared across admin pages */
.help-box { border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; margin-bottom: 18px; }
.help-box > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: .92rem; list-style: none; color: var(--ink); }
.help-box > summary::-webkit-details-marker { display: none; }
.help-box > summary::before { content: "\25B8\00a0"; color: var(--muted); }
.help-box[open] > summary::before { content: "\25BE\00a0"; }
.help-box .help-body { padding: 2px 16px 14px; color: var(--muted); font-size: .88rem; line-height: 1.6; }
.help-box .help-body p { margin: 0 0 8px; }
.help-box .help-body ol, .help-box .help-body ul { margin: 6px 0 8px; padding-left: 1.25em; }
.help-box .help-body li { margin: 4px 0; }
.help-box .help-body code { background: #eef2f7; padding: 1px 5px; border-radius: 5px; font-size: .85em; }

/* ---- host layout ---- */
.host-grid { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(300px, 440px); gap: 22px; align-items: start; }
.sidebar { display: flex; flex-direction: column; gap: 18px; }
.stage { display: flex; flex-direction: column; gap: 18px; min-height: 60vh; }

.q-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.q-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.q-item.is-live { border-color: var(--brand); background: var(--brand-pale); }
.q-item .q-meta { flex: 1; min-width: 0; }
.q-item .q-text { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Host Questions list: put the prompt on its own full-width line with the per-question
   control buttons (Launch / ⏸ Pause / ↻ Restart / ✎ / ×) wrapping below — otherwise 3 buttons
   squeeze the prompt to "W…" in the narrow sidebar. */
#q-list .q-item { flex-wrap: wrap; }
#q-list .q-meta { flex-basis: 100%; min-width: 0; }
#q-list .q-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-item .q-sub { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.q-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--brand-pale); color: var(--brand-d); white-space: nowrap; }
.q-badge.demo-badge { background: #fef3c7; color: #92400e; }   /* anonymous /demo sessions in the admin lists */
.q-badge.badge-ok { background: #dcfce7; color: #15803d; }     /* positive state — running, on, verified */
.q-badge.badge-warn { background: #fef3c7; color: #92400e; }   /* attention — lobby, pending, test mode */
.q-badge.badge-muted { background: #eef2f7; color: #56657d; }  /* neutral / done — ended, off */
.q-badge.badge-live { background: #fee2e2; color: #b4232b; }   /* live / urgent */
.q-del { background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 5px 10px; }
.q-del:hover { color: #fff; background: var(--bad); border-color: var(--bad); }
.q-edit { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 4px; }
.q-edit:hover { color: var(--brand); }
.composer-actions { display: flex; align-items: center; gap: 10px; }
.btn.ghost { background: none; border: 1px solid var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: #cbd5e1; }
.q-item:hover:not(.is-live) { border-color: #cbd5e1; }
/* On phones/tablets, let the title take the full row and the actions wrap below it
   (instead of crowding the right edge). Used by the dashboard + host question lists. */
@media (max-width: 600px) {
  .q-item { flex-wrap: wrap; }
  .q-item .q-meta { flex-basis: 100%; }
  .q-item .q-text { white-space: normal; }
}
.opt-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-row input[type=text] { margin-top: 0; }
.opt-row input[type=radio] { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.opt-row .opt-correct { width: 20px; height: 20px; accent-color: var(--brand); flex: none; margin: 0; }
.opt-row .opt-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; flex: none; }

/* ---- matching: pairs editor (composer) ---- */
.pair-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.pair-row input[type=text] { margin-top: 0; flex: 1; min-width: 0; }
.pair-arrow { color: var(--muted); flex: none; font-size: 1.05rem; }
.pair-row .opt-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; flex: none; }

/* ---- matching: student answer grid ---- */
.match-grid { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.match-row { display: flex; align-items: center; gap: 10px; }
.match-left { flex: 1; min-width: 0; font-weight: 600; padding: 12px 14px; background: var(--bg); border-radius: 10px; }
.match-arrow { color: var(--muted); flex: none; font-size: 1.1rem; }
.match-select { flex: 1; min-width: 0; padding: 12px 14px; font-size: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.match-answer { margin-top: 14px; }
.match-pair { padding: 9px 13px; background: var(--bg); border-left: 3px solid var(--good); border-radius: 8px; margin-top: 6px; font-weight: 600; }

/* ---- multiple true/false ---- */
/* composer: each statement + its correct-answer toggle */
.stmt-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.stmt-row .stmt-t { margin-top: 0; flex: 1; min-width: 140px; }
.stmt-tf { display: flex; gap: 4px; flex: none; }
.stmt-tf-opt { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; padding: 5px 9px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; white-space: nowrap; }
.stmt-tf-opt input { accent-color: var(--brand); margin: 0; }
.stmt-row .opt-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; flex: none; }
/* student: mark each statement True or False */
.mtf-list { display: flex; flex-direction: column; gap: 12px; margin: 10px 0; }
.mtf-srow { background: var(--bg); border-radius: 12px; padding: 12px 14px; }
.mtf-stext { font-weight: 600; margin-bottom: 8px; line-height: 1.35; }
.mtf-choice { display: flex; gap: 8px; }
.mtf-tf { flex: 1; padding: 10px; font-size: .95rem; font-weight: 600; border: 1.5px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; }
.mtf-tf.selected { border-color: var(--brand); background: var(--brand-pale); }
.mtf-tf.correct { border-color: var(--good); background: #f0fdf4; }
.mtf-tf.wrong { border-color: var(--bad); background: #fef2f2; }
.mtf-tf:disabled { cursor: default; }
/* host aggregate: the revealed key beside each statement */
.mtf-key { font-weight: 700; font-size: .85em; margin-left: 6px; white-space: nowrap; }
.mtf-key.mtf-true { color: var(--good); }
.mtf-key.mtf-false { color: var(--bad); }

/* ---- host access per admin (expandable) ---- */
.ha-row { border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; background: var(--surface); margin-bottom: 8px; }
.ha-row > summary { cursor: pointer; font-weight: 500; list-style: none; }
.ha-row > summary::-webkit-details-marker { display: none; }
.ha-row > summary::before { content: '▸'; color: var(--muted); margin-right: 8px; }
.ha-row[open] > summary::before { content: '▾'; }
.ha-row .ha-tag { white-space: nowrap; }
.ha-body { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.ha-body .field-label { display: block; margin-bottom: 6px; }

/* ---- host "Class roster" monitoring panel ---- */
.roster-grid { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.roster-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 12px; border-radius: 8px; background: var(--bg); }
.roster-row.joined { background: #ecfdf5; }
.roster-row.off { background: #fff7ed; }
.roster-name { font-weight: 600; }
.roster-stat { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.roster-row.joined .roster-stat { color: var(--good); }

/* ---- lobby ---- */
.lobby { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 36px; box-shadow: var(--shadow); }
.join-url { font-size: 1.3rem; font-weight: 700; word-break: break-all; margin: 0 0 6px; }
.big-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(3rem, 9vw, 6rem);
  font-weight: 800; letter-spacing: .1em; margin: 8px 0 12px; color: var(--brand-d); }
.qr-box { width: clamp(180px, 26vw, 280px); background: #fff; padding: 12px; border-radius: 14px; border: 1px solid var(--line); }
.qr-box .qr { width: 100%; height: auto; display: block; }

/* ---- active question ---- */
.active { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; box-shadow: var(--shadow); }
.active-prompt { font-size: clamp(1.5rem, 3.4vw, 2.4rem); margin: 4px 0 22px; }
/* Teaching-point shown under the results on reveal (host projector + students' phones). */
.active-explanation { margin-top: 18px; padding: 14px 18px; background: var(--brand-pale); border-left: 5px solid var(--brand); border-radius: 12px; text-align: left; }
.active-explanation .ax-label { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-d); }
.active-explanation .ax-text { margin-top: 5px; font-size: 1.05rem; line-height: 1.55; color: var(--ink); }
.display-mode .active-explanation .ax-text { font-size: clamp(1.1rem, 1.9vw, 1.6rem); }
.viz { min-height: 180px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

/* bars */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 1fr; gap: 4px; }
.bar-top { display: flex; justify-content: space-between; font-weight: 600; font-size: 1.05rem; gap: 12px; }
.bar-track { background: #eef2f7; border-radius: 10px; height: 34px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 10px; transition: width .5s cubic-bezier(.2,.8,.2,1); min-width: 2px; }
.bar-row.correct .bar-top { color: var(--good); }
.bar-row.correct .bar-pct::after { content: " ✓"; }
.bar-count { color: var(--muted); font-weight: 500; }

/* word cloud */
.cloud { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; justify-content: center; padding: 10px; }
.cloud-word { font-weight: 700; line-height: 1.1; color: var(--brand-d); }
.cloud-empty, .feed-empty { color: var(--muted); text-align: center; padding: 30px; }

/* feed */
.feed { display: flex; flex-direction: column; gap: 10px; }
.feed-item { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.feed-text { flex: 1; font-size: 1.05rem; white-space: pre-wrap; word-break: break-word; }
.upvote { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid var(--line);
  background: #fff; border-radius: 10px; padding: 4px 10px; cursor: pointer; font-weight: 700; min-width: 46px; }
.upvote .uv-count { font-size: 1.05rem; }
.upvote .uv-label { font-size: .65rem; color: var(--muted); text-transform: uppercase; }
.upvote.voted { background: var(--brand-pale); border-color: var(--brand); color: var(--brand-d); }

/* leaderboard */
.leaderboard h2 { margin-top: 0; }
.lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: rank; }
.lb-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: #f8fafc; font-weight: 600; }
.lb-list li::before { counter-increment: rank; content: counter(rank); width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .85rem; }
.lb-list li:nth-child(1)::before { background: #f59e0b; }
.lb-list li:nth-child(2)::before { background: #94a3b8; }
.lb-list li:nth-child(3)::before { background: #b45309; }
.lb-list .lb-score { margin-left: auto; color: var(--brand-d); }
/* full-screen "leaderboard moment" — projector / Display screen, triggered by the host's 🏆 button */
.lb-moment { position: fixed; inset: 0; z-index: 3000; color: #f2f7fd; overflow: auto;
  background: linear-gradient(150deg, #1f3c64, #2c517e 55%, #22416b);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: clamp(4px, .7vw, 9px); padding: clamp(20px, 4vw, 52px); }
.lb-moment .lbm-h { font-size: clamp(28px, 4.6vw, 58px); font-weight: 800; color: #4ade80; margin-bottom: clamp(6px, 1.2vw, 16px); }
.lb-moment .lbm-row { display: flex; align-items: center; gap: 16px; width: 100%; max-width: 880px; font-weight: 700;
  padding: clamp(6px, 1vw, 13px) clamp(16px, 2.6vw, 30px); border-radius: 10px; background: rgba(255,255,255,.07);
  font-size: clamp(16px, 2.6vw, 34px); }
.lb-moment .lbm-row.top { background: rgba(74,222,128,.18); }
.lb-moment .lbm-rank { width: 1.5em; text-align: center; color: #9fb6d4; font-weight: 800; }
.lb-moment .lbm-row.top .lbm-rank { color: #4ade80; }
.lb-moment .lbm-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-moment .lbm-score { font-variant-numeric: tabular-nums; color: #4ade80; font-weight: 800; }
.lb-moment .lbm-empty { color: #9fb6d4; font-size: clamp(20px, 3.4vw, 40px); padding: 30px; }

/* ---- lively results: animations + confetti ---- */
@keyframes lb-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.lb-list li { animation: lb-in .38s ease both; }

@keyframes pcount-pop { 0% { transform: scale(1); } 35% { transform: scale(1.4); color: var(--brand); } 100% { transform: scale(1); } }
#pcount.pop { display: inline-block; animation: pcount-pop .5s ease; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti i { position: absolute; top: -12vh; width: 9px; height: 14px; border-radius: 2px; opacity: .92;
  animation-name: confetti-fall; animation-timing-function: cubic-bezier(.3,.6,.5,1); animation-fill-mode: forwards; }
@keyframes confetti-fall { to { transform: translate(var(--dx, 0), 115vh) rotate(720deg); opacity: 1; } }

/* ---- quiz countdown + tension ---- */
.countdown { position: relative; width: 130px; height: 130px; margin: 0 auto 14px; }
.cd-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.cd-bg { fill: none; stroke: var(--line); stroke-width: 8; }
.cd-fg { fill: none; stroke: var(--brand); stroke-width: 8; stroke-linecap: round; }
.cd-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; color: var(--brand-d); }
.countdown.cd-danger .cd-fg { stroke: var(--bad); }
.countdown.cd-danger .cd-num { color: var(--bad); animation: cd-pulse .6s ease infinite; }
@keyframes cd-pulse { 50% { transform: scale(1.13); } }
.countdown.cd-done .cd-num { color: var(--muted); }
.quiz-live { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; }
.quiz-answered-wrap { text-align: center; }
.quiz-answered { font-size: 2.6rem; font-weight: 800; color: var(--brand-d); line-height: 1; }
.quiz-answered-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.quiz-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.quiz-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-weight: 600; background: #fff; }
.quiz-chip .dot { width: 16px; height: 16px; border-radius: 5px; }

/* ---- live emoji reactions ---- */
.react-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 6px;
  background: rgba(255, 255, 255, .96); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 12px; box-shadow: var(--shadow); z-index: 50; }
.react-btn { border: none; background: none; font-size: 1.55rem; line-height: 1; cursor: pointer;
  padding: 4px; border-radius: 50%; transition: transform .1s ease; }
.react-btn:hover { transform: scale(1.18); }
.react-btn.tap { animation: react-pop .3s ease; }
@keyframes react-pop { 50% { transform: scale(1.55); } }
.float-emoji { position: fixed; bottom: 9vh; font-size: 2.4rem; pointer-events: none; z-index: 55;
  animation-name: emoji-rise; animation-timing-function: ease-out; animation-fill-mode: forwards; }
@keyframes emoji-rise {
  0% { opacity: 0; transform: translateY(0) scale(.5); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0), -72vh) scale(1.25); }
}

/* ---- new question types: rating + numeric ---- */
.scale-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.scale-btn { width: 64px; height: 64px; border: 2px solid var(--line); border-radius: 14px; background: #fff;
  font-size: 1.5rem; font-weight: 800; color: var(--brand-d); cursor: pointer;
  transition: transform .08s ease, border-color .15s, background .15s; }
.scale-btn:hover { border-color: var(--brand); background: var(--brand-pale); transform: translateY(-2px); }
.stat-row { text-align: center; margin-bottom: 18px; }
.stat-big { font-size: 3rem; font-weight: 800; color: var(--brand-d); line-height: 1; text-align: center; }
.stat-label { text-align: center; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.stat-range { text-align: center; color: var(--muted); margin-top: 8px; font-weight: 600; }

/* ---- admin settings ---- */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
@media (max-width: 640px) { .admin-grid { grid-template-columns: 1fr; } }

/* ---- pricing ---- */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 28px; align-items: stretch; max-width: 1000px; margin-left: auto; margin-right: auto; }
.price-card { display: flex; flex-direction: column; }
.price-card h2 { font-size: 1.15rem; margin-bottom: 2px; }
.price-card .price { font-size: 2rem; font-weight: 800; color: var(--brand-d); margin: 4px 0 14px; }
.price-card .price span { font-size: .8rem; font-weight: 600; color: var(--muted); }
.price-feat { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: .9rem; flex: 1; }
.price-feat li::before { content: "✓ "; color: var(--good); font-weight: 700; }
.price-card.featured { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-pale), var(--shadow); position: relative; }
.badge-pop { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 12px; border-radius: 999px; white-space: nowrap; box-shadow: 0 2px 6px rgba(45,74,114,.25); }
.price-card .btn { text-decoration: none; text-align: center; }
.price-card .price .amt { font-size: inherit; font-weight: inherit; color: inherit; }
/* Pro card: billing-cycle toggle + room-size selector */
.pro-cycle { display: inline-flex; gap: 2px; background: var(--brand-pale); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin: 2px 0 12px; }
.pro-cycle button { appearance: none; border: 0; background: transparent; color: #475569; font-size: .82rem; font-weight: 700; padding: 6px 15px; border-radius: 999px; cursor: pointer; line-height: 1.1; }
.pro-cycle button.active { background: #fff; color: var(--brand-d); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.size-sel { margin: 0 0 15px; }
.size-sel .size-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 7px; }
.size-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.size-chip { appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: .82rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; transition: border-color .12s, background .12s; }
.size-chip:hover { border-color: var(--brand); }
.size-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.price-card .btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }
/* Pro-status view (a logged-in Pro user's own pricing card) */
.badge-pop.plan-badge { background: var(--good); box-shadow: 0 2px 6px rgba(22,163,74,.28); }
.pro-ends { margin: 0 0 12px; font-size: .9rem; font-weight: 700; color: var(--warn); background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 8px 12px; }
.cur-plan { text-align: center; font-weight: 700; color: var(--good); background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 11px; padding: 11px 14px; }
@media (max-width: 900px) { .pricing-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .pricing-grid { grid-template-columns: 1fr; } }
.cmp-wrap { max-width: 880px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.06)); }
.cmp { width: 100%; border-collapse: collapse; font-size: .94rem; }
.cmp th, .cmp td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cmp thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-d); background: #f6f9fc; font-weight: 700; }
.cmp td:first-child, .cmp th:first-child { text-align: left; color: var(--text, #1f2937); }
.cmp th:not(:first-child), .cmp td:not(:first-child) { text-align: center; width: 24%; white-space: nowrap; }
.cmp tbody tr:nth-child(even) td { background: #f9fbfd; }
.cmp th:nth-child(3), .cmp td:nth-child(3) { background: var(--brand-pale) !important; font-weight: 600; }
.cmp td.yes { color: var(--good); font-weight: 700; font-size: 1.05rem; }
.cmp td.no { color: #cbd5e1; }
.cmp tbody tr:last-child td { border-bottom: none; }
/* question-types showcase */
.qtype-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); gap: 12px; max-width: 1000px; margin: 0 auto; }
.qtype-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.qtype-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qtype-name { font-weight: 700; color: var(--brand-d); font-size: .98rem; }
.qtype-desc { color: var(--muted); font-size: .86rem; margin: 6px 0 0; line-height: 1.4; }
.qtype-pill { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 3px 9px; border-radius: 999px; flex: none; }
.qtype-pill.free { background: #e6f4ea; color: #166534; }
.qtype-pill.pro { background: var(--brand); color: #fff; }
.feat th:not(:first-child), .feat td:not(:first-child) { text-align: center; width: 16%; }
.feat td:first-child { line-height: 1.3; }
.feat .feat-ck { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }

/* ---- student play ---- */
.play-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.play-stage { display: flex; flex-direction: column; gap: 16px; }
.waiting { text-align: center; padding: 16vh 0; color: var(--muted); }
.spinner { width: 38px; height: 38px; border: 4px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; margin: 0 auto 16px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.q-prompt { font-size: 1.5rem; font-weight: 700; margin: 4px 0 18px; }
.choices { display: flex; flex-direction: column; gap: 12px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 18px;
  font-size: 1.15rem; font-weight: 600; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.choice:hover { border-color: var(--brand); }
.choice .dot { width: 26px; height: 26px; border-radius: 8px; flex: none; }
.choice.selected { border-color: var(--brand); background: var(--brand-pale); }
.choice.correct { border-color: var(--good); background: #f0fdf4; }
.choice.wrong { border-color: var(--bad); background: #fef2f2; }
.choice:disabled { cursor: default; opacity: .95; }
.conf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.conf-lbl { font-weight: 600; color: var(--muted); font-size: .95rem; margin-right: 2px; }
.conf-chip { padding: 7px 14px; border: 2px solid var(--line); border-radius: 999px; background: #fff;
  font-weight: 600; font-size: .95rem; cursor: pointer; }
.conf-chip:hover { border-color: var(--brand); }
.conf-chip.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.result-pass { font-weight: 800; padding: 8px 16px; border-radius: 999px; display: inline-block; margin-top: 8px; }
.result-pass.is-pass { background: #ecfdf5; color: #15803d; }
.result-pass.is-fail { background: #fef2f2; color: #b91c1c; }

.text-answer textarea { width: 100%; min-height: 110px; padding: 14px; font-size: 1.1rem; font-family: inherit;
  border: 2px solid var(--line); border-radius: 14px; resize: vertical; }
.text-answer textarea:focus { outline: none; border-color: var(--brand); }

.banner { padding: 16px 18px; border-radius: 14px; font-weight: 600; text-align: center; }
.banner.ok { background: var(--brand-pale); color: var(--brand-d); }
.banner.good { background: #f0fdf4; color: var(--good); }
.banner.bad { background: #fef2f2; color: #b91c1c; }   /* darker red for WCAG AA contrast on the pale bg */
.banner.warn { background: #fffbeb; color: var(--warn); }
.result-line { text-align: center; font-size: 1.1rem; margin-top: 4px; }
.score-big { font-size: 2.2rem; font-weight: 800; color: var(--brand-d); }

/* ---- footer ---- */
.site-nav { padding: 12px 0 4px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.site-nav-logout { margin: 0; }
.site-nav-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--brand); text-decoration: none; letter-spacing: -.01em; }
.site-nav-brand:hover { color: var(--brand-d); text-decoration: none; }
.site-nav-logo { width: 28px; height: 28px; display: block; }
.brandmd { color: var(--good); }
.site-banner { background: var(--brand-pale); color: var(--brand-d); border-radius: 10px; padding: 10px 14px; margin: 8px 0 4px; font-weight: 600; text-align: center; font-size: .92rem; }
.site-banner.warn { background: #fef9c3; color: #854d0e; }
.site-ann { position: relative; padding-right: 40px; }
.site-ann .site-ann-msg { color: inherit; }
.site-ann a.site-ann-msg { text-decoration: underline; }
.site-ann .site-ann-x { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: inherit; opacity: .6; cursor: pointer; font-size: 1rem; line-height: 1; padding: 4px 6px; }
.site-ann .site-ann-x:hover { opacity: 1; }
/* "View in <language>" suggestion bar (base.html; driven by lang_hint()) */
.langhint { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; background: var(--brand-pale); border: 1px solid #d3e1f1; border-radius: 12px; padding: 7px 12px; margin: 8px 0 4px; }
.langhint-ico { font-size: 1.05rem; line-height: 1; }
.langhint-go { font-weight: 700; color: var(--brand-d); text-decoration: none; font-size: .98rem; padding: 4px 10px; border-radius: 8px; }
.langhint-go:hover { background: #fff; text-decoration: underline; }
.langhint-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.langhint-x:hover { color: var(--ink); background: rgba(15, 23, 42, .06); }
/* Student→host growth nudge (join page + end-of-session) */
.grow-cta { text-align: center; margin: 18px auto 0; max-width: 460px; }
.grow-cta a { color: var(--brand); font-weight: 600; text-decoration: none; }
.grow-cta a:hover { text-decoration: underline; }
.pwa-standalone .grow-cta { display: none; }
.grow-cta-card { margin-top: 24px; text-align: center; }
.grow-cta-lead { color: var(--muted); font-size: .95rem; margin: 0 0 12px; max-width: 340px; margin-left: auto; margin-right: auto; }
.follow-cta { text-align: center; margin: 14px 0 0; font-size: .9rem; }
.follow-cta a { color: var(--brand); font-weight: 600; text-decoration: none; }
.follow-cta a:hover { text-decoration: underline; }
.testi-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.testi-meta { display: flex; gap: 8px; margin-top: 6px; }
.testi-meta input { flex: 1; min-width: 0; }
.logo-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.logo-row input[type=file] { font-size: .85rem; }
.logo-prev { max-height: 42px; max-width: 140px; border-radius: 6px; background: #fff; padding: 3px; border: 1px solid var(--line); object-fit: contain; }
.pro-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; margin-top: 8px; }
.pro-grid { display: flex; flex-direction: column; gap: 10px; }
.pro-slot-label { display: flex; align-items: center; gap: 10px; margin-bottom: 0; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fbfcfe; }
.pro-num { color: #64748b; font-weight: 700; min-width: 18px; text-align: right; flex: none; }
.pro-slot { flex: 1; min-width: 0; margin-top: 0; }
@media (max-width: 560px) { .pro-grid { grid-template-columns: 1fr; } }
.faq { display: flex; flex-direction: column; gap: 8px; max-width: 760px; }
.faq-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.faq-item summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.faq-item p { margin: 8px 0 0; color: var(--muted); }
.present-mode .composer-card { display: none !important; }
/* Projector / audience display (?display=1): just the live question + results + join QR — no host chrome. */
.display-mode .topbar,
.display-mode .sidebar,
.display-mode .controls,
.display-mode #end-panel,
.display-mode #host-warn,
.display-mode .lobby button,
.display-mode .lobby details { display: none !important; }
.display-mode .host-grid { display: block; }   /* collapse the 2-col grid so the stage spans the whole screen */
.display-mode .stage { max-width: 1180px; margin: 0 auto; padding-top: 10px; }
.display-mode .active-prompt { font-size: clamp(2rem, 4.4vw, 3.4rem); line-height: 1.16; }
.display-mode .active-responses, .display-mode .eyebrow { font-size: 1rem; }
.display-mode .big-code { font-size: clamp(3.2rem, 10vw, 7rem); letter-spacing: .08em; }
.display-mode .qr-box svg, .display-mode .qr-box img { width: min(48vw, 460px); height: auto; }
.display-mode .lobby { text-align: center; }
.display-mode .active { font-size: 1.12rem; }
/* Floating fullscreen toggle on the projector display — subtle, fades unless hovered. */
.display-fs-btn { position: fixed; top: 14px; right: 14px; z-index: 50; opacity: .22; transition: opacity .2s; background: rgba(15,23,42,.72); color: #fff; border: 0; border-radius: 8px; padding: 7px 12px; font-size: .85rem; font-weight: 600; cursor: pointer; }
.display-fs-btn:hover { opacity: 1; }
:fullscreen .display-fs-btn { opacity: 0; }
:fullscreen .display-fs-btn:hover { opacity: 1; }

/* Topic mastery dashboard */
.mastery-filter { margin-bottom: 14px; }
.mastery-filter select { padding: 5px 9px; border-radius: 7px; border: 1px solid #d7dceb; background: #fff; font-size: .9rem; }
.mrow { margin-bottom: 12px; }
.mrow:last-child { margin-bottom: 0; }
.mrow-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.mrow-name { font-weight: 600; min-width: 150px; }
.mbar { height: 10px; background: #eef1f7; border-radius: 6px; overflow: hidden; }
.mbar-fill { display: block; height: 100%; border-radius: 6px; min-width: 2px; transition: width .3s; }
.mbar-fill.low { background: #dc2626; }
.mbar-fill.mid { background: #f59e0b; }
.mbar-fill.high { background: #16a34a; }
.mastery-matrix th, .mastery-matrix td { text-align: center; white-space: nowrap; }
.mastery-matrix th:first-child, .mastery-matrix td:first-child,
.mastery-matrix th:nth-child(2), .mastery-matrix td:nth-child(2) { text-align: left; }
.mastery-avg td { border-top: 2px solid #d7dceb; background: #f8fafc; }

/* Dose calculation */
.dose-fields { display: flex; flex-wrap: wrap; gap: 10px; }
.dose-f { display: flex; flex-direction: column; font-size: .85rem; font-weight: 600; gap: 3px; flex: 1 1 120px; }
.dose-f input, .dose-f select { font-weight: 400; padding: 7px 9px; border-radius: 8px; border: 1px solid #d7dceb; }
.dose-input-row { display: flex; align-items: center; gap: 10px; }
.dose-input-row input { flex: 1; min-width: 0; }
.dose-unit { font-size: 1.3rem; font-weight: 700; color: var(--brand-d, #1e3a5f); white-space: nowrap; }

/* Case-vignette stem (clinical scenario shown above the question) */
.q-stem-wrap { margin: 2px 0; }
.q-stem-wrap > summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--brand-d, #1e3a5f); list-style: revert; }
.q-stem-wrap textarea { width: 100%; margin-top: 8px; padding: 10px; border-radius: 10px; border: 1px solid #d7dceb; font: inherit; resize: vertical; }
.q-stem-keep { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 500; margin-top: 6px; color: #475569; }
.q-stem-keep input { width: auto; margin: 0; }
.active-stem, .q-stem { background: #f1f5fb; border-left: 4px solid var(--brand, #2563eb); border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; line-height: 1.5; color: #1e293b; white-space: pre-wrap; text-align: left; }
.display-mode .active-stem { font-size: 1.6rem; padding: 18px 22px; }

/* Labeled diagram (tag points on an image) */
.label-img { position: relative; width: fit-content; max-width: 100%; margin: 0 auto 12px; line-height: 0; }
.label-img img { display: block; width: 100%; border-radius: 8px; }
.label-pin, .q-label-pin { position: absolute; transform: translate(-50%, -50%); min-width: 24px; height: 24px; padding: 0 4px; border-radius: 999px; background: var(--brand, #2563eb); color: #fff; font-size: .85rem; font-weight: 700; line-height: 24px; text-align: center; box-shadow: 0 0 0 2px #fff; pointer-events: none; box-sizing: border-box; }
.q-label-pin { z-index: 3; }
.label-pt-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.label-pt-row input { flex: 1; min-width: 0; padding: 7px 9px; border-radius: 8px; border: 1px solid #d7dceb; }
.label-pt-n { font-weight: 700; color: var(--brand-d, #1e3a5f); min-width: 22px; }
.label-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.label-key-row { font-weight: 600; }
.display-mode .label-pin { min-width: 34px; height: 34px; line-height: 34px; font-size: 1.2rem; }

/* Personal review (study your own missed questions, by roll) */
.review-form { display: flex; flex-wrap: wrap; gap: 10px; max-width: 560px; }
.review-form input { flex: 1 1 160px; min-width: 0; padding: 11px 13px; border-radius: 10px; border: 1px solid #d7dceb; font-size: 1rem; }
.review-form button { flex: 0 0 auto; }
.rev-head { font-weight: 700; margin: 0 0 12px; }
.rev-card { background: #fff; border: 1px solid #e6e9f2; border-left: 4px solid var(--brand, #2563eb); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; max-width: 720px; }
.rev-stem { background: #f1f5fb; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; line-height: 1.45; white-space: pre-wrap; }
.rev-img { max-width: 100%; max-height: 220px; border-radius: 8px; margin-bottom: 10px; display: block; }
.rev-q { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.rev-correct { color: #16a34a; font-weight: 600; margin-bottom: 6px; }
.rev-exp { color: #475569; line-height: 1.5; margin-bottom: 6px; }
.rev-meta { color: #94a3b8; font-size: .8rem; }

.hotspot-box { position: relative; display: inline-block; line-height: 0; max-width: 100%; }
.q-image-preview { max-width: 100%; max-height: 240px; border-radius: 8px; }
#q-hotspot-marker { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; border: 2px solid var(--good); background: rgba(22, 163, 74, .25); border-radius: 50%; pointer-events: none; }
.hotspot-result { position: relative; display: inline-block; max-width: 100%; line-height: 0; margin: 4px 0 10px; }
.hotspot-result img { max-width: 100%; max-height: 60vh; border-radius: 8px; }
.hs-dot { position: absolute; width: 14px; height: 14px; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(79, 70, 229, .6); border: 1px solid #fff; pointer-events: none; }
.hs-dot.mine { background: rgba(239, 68, 68, .9); width: 16px; height: 16px; }
.hs-target { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; border: 3px dashed var(--good); background: rgba(22, 163, 74, .12); border-radius: 50%; pointer-events: none; }
.people-grid { display: flex; flex-direction: column; gap: 10px; }
/* one person = a tidy stacked block: name+email line, then role + reports-to side by side, then a boxed Permissions panel */
.people-slot { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fbfcfe; }
.slot-main { display: flex; align-items: center; gap: 10px; }
.people-slot .pro-num { min-width: 18px; text-align: right; flex: none; }
.people-slot input, .people-slot select { min-width: 0; margin-top: 0; }
.people-slot .s-name, .people-slot .a-name { flex: 1 1 120px; }
.people-slot .s-email, .people-slot .a-email { flex: 1.6 1 180px; }
.slot-roles { display: flex; gap: 10px; padding-left: 28px; }
.slot-roles select { flex: 1 1 0; width: auto; }
.people-slot .s-manager[disabled] { opacity: .4; }
.people-slot .perms { font-size: .85rem; padding-left: 28px; }
.people-slot .perms summary { cursor: pointer; color: var(--brand-d); width: max-content; font-weight: 600; }
.perm-grid { display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)); gap: 6px 16px; margin-top: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.perm-grid label { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.perm-grid input { width: 16px; height: 16px; flex: none; accent-color: var(--brand); margin: 0; }
@media (max-width: 640px) { .perm-grid { grid-template-columns: 1fr 1fr; } .slot-roles, .people-slot .perms { padding-left: 0; } }
.team-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--brand-pale); border-radius: 10px; }
.team-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.team-name { font-weight: 700; flex: 1; font-size: 1.05rem; }
.team-score { color: var(--muted); font-size: .9rem; }
.ck-row { display: flex; align-items: center; gap: 8px; }
.ck-row input { width: 18px; height: 18px; flex: none; accent-color: var(--brand); margin: 0; }
#exam-card label { display: block; margin-top: 10px; font-size: .9rem; }
#exam-card label.ck-row { display: flex; }
.hotspot-box { position: relative; display: inline-block; line-height: 0; max-width: 100%; }
#q-hotspot-marker { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--good); background: rgba(22, 163, 74, .25); pointer-events: none; }
.hotspot-result { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.hotspot-result img { max-width: 100%; max-height: 60vh; border-radius: 10px; }
.hs-dot { position: absolute; width: 14px; height: 14px; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(79, 70, 229, .6); border: 1px solid rgba(255, 255, 255, .9); pointer-events: none; }
.hs-dot.mine { background: rgba(239, 68, 68, .9); width: 16px; height: 16px; }
.hs-target { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; border-radius: 50%; border: 3px dashed var(--good); background: rgba(22, 163, 74, .12); pointer-events: none; }
.site-footer { margin-top: 40px; padding: 22px 0 6px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.site-footer .footer-logo { height: 30px; width: auto; opacity: .92; }
.footer-legal { color: var(--muted); }
.footer-legal a { color: var(--muted); text-decoration: none; }
.footer-legal a:hover { color: var(--brand); text-decoration: underline; }
/* Footer social icons (links + on/off managed at /admin/social) */
.social-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.social-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; color: var(--muted); background: var(--surface); border: 1px solid var(--line); transition: color .15s, background .15s, border-color .15s, transform .15s; }
.social-icon svg { width: 19px; height: 19px; display: block; }
.social-icon:hover { color: #fff; background: var(--brand); border-color: var(--brand); transform: translateY(-2px); }
/* /admin/social editor rows */
.social-admin { display: flex; flex-direction: column; gap: 10px; }
.social-admin-row { display: flex; align-items: center; gap: 12px; }
.social-admin-ic { width: 24px; height: 24px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.social-admin-ic svg { width: 22px; height: 22px; }
.social-admin-name { width: 104px; font-weight: 600; flex: none; }
.social-admin-row .social-url { flex: 1; min-width: 0; }
.social-toggle { display: flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; font-weight: 600; }
@media (max-width: 600px) { .social-admin-row { flex-wrap: wrap; } .social-admin-row .social-url { flex-basis: 100%; order: 3; } }

/* ---- legal / policy pages ---- */
.legal { max-width: 760px; line-height: 1.6; }
.legal h2 { font-size: 1.05rem; margin: 22px 0 6px; }
.legal p, .legal li { color: var(--ink); }
.legal ul { padding-left: 20px; }
.legal li { margin: 4px 0; }

/* ---- admin subscribers ---- */
.billing-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mode-pill { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.mode-live { background: #dcfce7; color: #166534; }
.mode-test { background: #fef9c3; color: #854d0e; }
.mode-off  { background: #f1f5f9; color: #475569; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; }
.stat-tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; text-align: center; transition: border-color .12s, box-shadow .12s; }
a.stat-tile { text-decoration: none; color: inherit; display: block; }
a.stat-tile:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(30, 41, 59, .07); }
.stat-num { font-size: 1.7rem; font-weight: 800; color: #0f172a; line-height: 1.12; }
.stat-lbl { font-size: .72rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.badge-pro { background: #dcfce7 !important; color: #166534 !important; }
.dtable-wrap { overflow-x: auto; }
.dtable { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dtable th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.dtable td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.dtable tbody tr:hover { background: var(--brand-pale); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 700px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- homepage: medical positioning ---- */
.hero-by { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.usecase-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.usecase { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.uc-ic { font-size: 1.5rem; line-height: 1; }
.usecase strong { display: block; font-size: .98rem; }
.usecase p { margin: 3px 0 0; color: var(--muted); font-size: .86rem; }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.shot { aspect-ratio: 4 / 3; border: 1px dashed var(--line); border-radius: 12px; background: var(--brand-pale); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; overflow: hidden; }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot:has(img) { border-style: solid; background: var(--surface); }
.shot-ic { font-size: 2rem; }
.shot-cap { color: var(--brand-d); font-weight: 600; font-size: .85rem; text-align: center; padding: 0 6px; }
/* Rotating screenshot carousel + click-to-enlarge lightbox */
.carousel { position: relative; max-width: 820px; margin: 16px auto 0; overflow: hidden; }
.carousel-viewport { overflow: hidden; border-radius: 16px; }
.carousel-track { position: relative; }
.carousel-slide { display: none; flex-direction: column; align-items: center; gap: 12px; }
.carousel-slide.active { display: flex; animation: carousel-fade .5s ease; }
@keyframes carousel-fade { from { opacity: 0; } to { opacity: 1; } }
.carousel-img-btn { width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); cursor: zoom-in; display: block; }
.carousel-img-btn img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.carousel-img-btn:hover { border-color: var(--brand); }
.carousel-cap { color: var(--brand-d); font-weight: 600; font-size: 1rem; text-align: center; }
.carousel-arrow { position: absolute; top: calc(50% - 24px); transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, .94); color: var(--brand-d); font-size: 1.7rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow); display: grid; place-items: center; z-index: 2; }
.carousel-arrow.prev { left: 8px; }
.carousel-arrow.next { right: 8px; }
.carousel-arrow:hover { background: #fff; border-color: var(--brand); }
.carousel-dots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.carousel-dot { width: 9px; height: 9px; border-radius: 50%; border: none; background: #cbd5e1; cursor: pointer; padding: 0; transition: width .25s, background .25s; }
.carousel-dot.active { background: var(--brand); width: 24px; border-radius: 5px; }
.carousel-hint { text-align: center; margin-top: 10px; }
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .88); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
.lightbox-close { position: absolute; top: 16px; right: 20px; width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.5rem; cursor: pointer; }
.lightbox-close:hover { background: rgba(255, 255, 255, .28); }
@media (max-width: 680px) { .carousel-arrow.prev { left: 4px; } .carousel-arrow.next { right: 4px; } }
@media (prefers-reduced-motion: reduce) { .carousel-slide.active { animation: none; } }
/* Promo invite-link rows */
.promo-row .slot-main { flex-wrap: wrap; gap: 6px; }
.promo-row .pl-label { flex: 1 1 220px; }
.promo-row .pl-code { flex: 0 1 150px; }
.promo-row .pl-prefix { white-space: nowrap; }
.promo-row .slot-roles { flex-wrap: wrap; align-items: center; gap: 14px; padding-left: 0; }
.promo-row .pl-days-lbl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .85rem; }
.promo-row .pl-days { width: 64px; }
.pl-status { font-weight: 700; font-size: .72rem; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pl-status.on { background: #dcfce7; color: #166534; }
.pl-status.off { background: #f1f5f9; color: #64748b; }
.del-user-btn { color: var(--bad); }
.del-user-btn:hover { border-color: var(--bad); }
.dormant-badge { background: #fef3c7; color: #92400e; }
.proof { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 22px 0; }
.proof-badge { background: var(--brand-pale); color: var(--brand-d); border-radius: 999px; padding: 6px 14px; font-size: .85rem; font-weight: 600; }
.testimonials { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.tcard { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.tcard blockquote { margin: 0 0 8px; font-style: italic; }
.tcard figcaption { color: var(--muted); font-size: .85rem; }
.cta-band { text-align: center; margin: 32px 0 8px; padding: 28px 16px; background: var(--brand-pale); border-radius: 16px; }
.cta-band h2 { margin: 0 0 14px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 12px; }
.tpl-card { display: flex; flex-direction: column; }
.tpl-head { display: flex; align-items: center; gap: 10px; }
.tpl-head h3 { margin: 0; font-size: 1.02rem; }
.tpl-ic { font-size: 1.6rem; line-height: 1; }
.tpl-desc { margin: 8px 0 0; }
.tpl-count { color: var(--muted); font-size: .8rem; margin: 8px 0 12px; }
.tpl-card .btn { margin-top: auto; }
.ai-card { border: 1px solid var(--brand); }
.ai-row { display: flex; gap: 10px; }
.ai-row label { flex: 1; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.hub-link { text-decoration: none; color: inherit; display: block; transition: border-color .15s; }
.hub-link:hover { border-color: var(--brand); }
.hub-link h3 { margin: 8px 0 4px; }
.hub-ic { font-size: 1.8rem; line-height: 1; }
.hub-sec { margin: 26px 0 10px; font-size: 1.1rem; }
/* Collapsible hub sections: the <h2> sits in a <summary> with a disclosure chevron. */
.hub-fold { margin: 0; }
.hub-fold > summary { list-style: none; cursor: pointer; margin: 26px 0 10px; user-select: none; }
.hub-fold > summary::-webkit-details-marker { display: none; }
.hub-fold > summary h2::before { content: "\25B8"; color: var(--muted); font-size: .8em; margin-right: 9px; vertical-align: 2px; }
.hub-fold[open] > summary h2::before { content: "\25BE"; }
/* Author rules (.hub-grid's display:grid, a textarea's own display) beat the UA "a closed
   <details> hides its content", so hide every non-summary child of a collapsed fold explicitly.
   Covers both the card-grid sections and the Roadmap panel's textarea. */
.hub-fold:not([open]) > :not(summary) { display: none; }
.hub-fold > summary:hover h2 { color: var(--brand-d, #1e3a5f); }
/* Inside a card (e.g. the Roadmap panel) the summary sits at the card's top — no big top margin. */
.card > .hub-fold > summary { margin: 0 0 6px; }
.hub-fold > summary:focus-visible { outline: 2px solid var(--brand, #3f5b9c); outline-offset: 3px; border-radius: 6px; }

/* ── First-run guided tour (host page). Dependency-free spotlight + popover. ── */
.tour-mask { position: fixed; inset: 0; z-index: 9998; background: transparent; }
.tour-hole { position: absolute; z-index: 9999; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, .55);
  transition: top .2s, left .2s, width .2s, height .2s; }
.tour-pop { position: absolute; z-index: 10000; max-width: 340px; width: calc(100vw - 32px);
  background: var(--surface, #fff); color: var(--ink, #0f172a);
  border: 1px solid var(--line, #e2e8f0); border-radius: 14px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .32); padding: 16px 18px; }
.tour-pop h4 { margin: 0 0 6px; font-size: 1.05rem; color: var(--brand-d, #1e3a5f); }
.tour-pop p { margin: 0 0 13px; font-size: .93rem; line-height: 1.5; color: var(--ink, #334155); }
.tour-pop p b { color: var(--brand-d, #1e3a5f); }
.tour-foot { display: flex; align-items: center; gap: 8px; }
.tour-step { font-size: .8rem; color: var(--muted, #94a3b8); margin-right: auto; font-variant-numeric: tabular-nums; }
.tour-pop .btn { font-size: .85rem; }

/* ---- Admin console shared components (hub + inner pages) ---- */
/* Quick actions */
.qa-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.qa { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13.5px; transition: border-color .12s, box-shadow .12s; }
.qa:hover { border-color: var(--brand); box-shadow: 0 2px 8px rgba(30, 41, 59, .08); }
.qa-ic { font-size: 15px; }
.qa-live { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #b4232b; }
.qa-pulse { width: 9px; height: 9px; border-radius: 50%; background: #e0242f; box-shadow: 0 0 0 0 rgba(224, 36, 47, .5); animation: qapulse 1.8s infinite; }
@keyframes qapulse { 0% { box-shadow: 0 0 0 0 rgba(224, 36, 47, .5); } 70% { box-shadow: 0 0 0 7px rgba(224, 36, 47, 0); } 100% { box-shadow: 0 0 0 0 rgba(224, 36, 47, 0); } }
/* KPI band */
.kpi-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { position: relative; display: block; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; text-decoration: none; color: inherit; overflow: hidden; transition: box-shadow .14s, transform .14s; }
a.kpi:hover { box-shadow: 0 6px 20px rgba(30, 41, 59, .10); transform: translateY(-1px); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--k, #3a5f91); }
.kpi-lbl { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #64748b; }
.kpi-val { font-size: 2.1rem; font-weight: 800; line-height: 1.1; margin: 6px 0 8px; color: #0f172a; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.kpi-delta { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.kpi-delta.up { background: #ecfdf5; color: #15803d; }
.kpi-delta.down { background: #fef2f2; color: #b91c1c; }
.kpi-delta.flat { background: #f1f5f9; color: #64748b; }
.kpi-sub { font-size: 12px; color: #64748b; font-weight: 600; }
.kpi .spark { width: 104px; height: 30px; color: var(--k, #3a5f91); flex: none; }

/* ---- admin console on phones (≤560px — Samsung S24 Ultra & the installed app) ---- */
@media (max-width: 560px) {
  .wrap { padding: 16px 14px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .adminbar { padding: 10px 13px; gap: 8px 10px; margin-bottom: 14px; }
  .adminbar .btn.small { padding: 7px 11px; }
  .adminhead { margin-bottom: 12px; }
  .adminhead .host-title, .host-title { font-size: 1.3rem; }
  /* KPI band → compact 2-up tiles; drop the sparkline so they stay tidy */
  .kpi-band { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 13px; border-radius: 14px; }
  .kpi-lbl { font-size: 10px; letter-spacing: .4px; }
  .kpi-val { font-size: 1.5rem; margin: 5px 0 6px; }
  .kpi .spark { display: none; }
  .kpi-foot { min-height: 0; flex-wrap: wrap; gap: 6px; }
  .kpi-delta { font-size: 11px; padding: 2px 7px; }
  .kpi-sub { font-size: 11px; }
  /* opted-in tables (.dtable.rowcards) → one labelled card per row instead of a wide side-scroll */
  .dtable.rowcards, .dtable.rowcards tbody, .dtable.rowcards tr, .dtable.rowcards td { display: block; }
  .dtable.rowcards thead { display: none; }
  .dtable.rowcards tr { border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 3px 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
  .dtable.rowcards tbody tr:hover { background: #fff; }
  .dtable.rowcards td { display: flex; justify-content: space-between; align-items: center; gap: 14px; text-align: right; padding: 9px 0; border-bottom: 1px solid #f1f5f9; min-height: 21px; }
  .dtable.rowcards tr td:last-child { border-bottom: none; }
  .dtable.rowcards td::before { content: attr(data-label); font-weight: 700; font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); text-align: left; flex: none; }
  .dtable.rowcards td:empty { display: none; }
  .dtable.rowcards td.actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
}
/* ---- wide matrix tables (CBME heatmap / gradebook / mastery): freeze the first column + header ---- */
/* Add class "matrix" to a .dtable so its student/row labels + column headers stay in view while the
   grid scrolls sideways. Works desktop + mobile; on phones the grid becomes a contained scroll box. */
.dtable.matrix th:first-child, .dtable.matrix td:first-child {
  position: sticky; left: 0; z-index: 1; text-align: left; background: #fff;
  border-right: 1px solid var(--line);
}
.dtable.matrix thead th { position: sticky; top: 0; z-index: 2; background: #f6f9fc; }
.dtable.matrix thead th:first-child { z-index: 3; }   /* top-left corner above both frozen edges */
@media (max-width: 560px) {
  .dtable-wrap:has(.dtable.matrix) { max-height: 70vh; overflow: auto; overscroll-behavior: contain; }
  .dtable.matrix { font-size: 12px; }
  .dtable.matrix th, .dtable.matrix td { padding: 6px 8px; }
  .dtable.matrix th:first-child, .dtable.matrix td:first-child { min-width: 92px; max-width: 132px; white-space: normal; }
}
.k-blue { --k: #2563eb; } .k-green { --k: #16a34a; } .k-violet { --k: #7c3aed; } .k-amber { --k: #d97706; } .k-slate { --k: #475569; }
/* Mini metrics */
.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-bottom: 16px; }
.mini { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: inherit; transition: border-color .12s; }
a.mini:hover { border-color: var(--brand); }
.mini-n { font-size: 1.5rem; font-weight: 800; color: #0f172a; line-height: 1; }
.mini-n.mini-txt { font-size: 1.05rem; }
.mini-l { font-size: 11.5px; color: #64748b; margin-top: 4px; font-weight: 600; }
.mini-sub { font-size: 10.5px; color: #94a3b8; margin-top: 2px; font-weight: 600; }
.mini-sub-inline { font-size: 10px; color: #94a3b8; font-weight: 600; white-space: nowrap; }
.mini-warn .mini-n { color: #b45309; }
/* Product / info strip */
.prod-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.prod { display: inline-flex; align-items: center; gap: 9px; background: #f8fafc; border: 1px solid var(--line); border-radius: 11px; padding: 9px 14px; font-size: 13px; color: #334155; }
.prod-ic { font-size: 16px; }
.prod b { color: #0f172a; }
/* Live card heading */
.live-h { display: flex; align-items: center; gap: 8px; }
.live-auto { margin-left: auto; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #16a34a; background: #ecfdf5; padding: 3px 9px; border-radius: 999px; }
/* Status pills */
.sp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sp { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: #fff; text-decoration: none; color: #334155; font-size: 13px; font-weight: 700; }
a.sp:hover { border-color: #cbd5e1; }
.sp-dot { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; flex: none; }
.sp-sub { color: #64748b; font-weight: 600; font-size: 12px; }
.sp-on .sp-dot { background: #16a34a; } .sp-warn .sp-dot { background: #d97706; } .sp-crit .sp-dot { background: #dc2626; } .sp-off .sp-dot { background: #cbd5e1; }
.sp-on { border-color: #bbf7d0; } .sp-warn { border-color: #fde68a; } .sp-crit { border-color: #fecaca; }
.fac-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.fac-row input { flex: 1; min-width: 0; margin-top: 0; }
.fac-status { font-size: .72rem; color: var(--muted); min-width: 56px; text-align: center; }
.qtype-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.qtype-opt { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.qtype-opt input { width: auto; }
.video-wrap { position: relative; width: 100%; max-width: 720px; aspect-ratio: 16/9; margin-top: 12px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.video-wrap iframe, .video-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-placeholder { max-width: 720px; aspect-ratio: 16/9; margin-top: 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--brand-pale); display: flex; align-items: center; justify-content: center; color: var(--brand-d); font-weight: 600; }
.ask-box { margin-top: 18px; max-width: 600px; }
.ask-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#ask-form textarea { margin-top: 10px; }
#ask-form .btn { margin-top: 10px; }
@media (max-width: 520px) { .ask-row { grid-template-columns: 1fr; } }
#q-image-row { margin-top: 8px; }
#q-image-remove { margin-top: 6px; display: block; }
.q-image-preview { max-width: 220px; max-height: 160px; border-radius: 8px; display: block; object-fit: cover; }
.active-image { max-width: 100%; max-height: 320px; border-radius: 12px; margin: 4px auto 14px; display: block; }
.q-image { max-width: 100%; max-height: 40vh; border-radius: 12px; margin: 8px 0 14px; display: block; }
.q-media { display: block; width: 100%; max-width: 520px; margin: 8px auto 14px; border-radius: 12px; }
audio.q-media { height: 46px; }
.q-media-embed { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; }
.active-media { margin: 4px auto 14px; }
.active-media .q-media { max-width: 680px; }
.active-media audio.q-media { max-width: 520px; }
#q-media-prev .q-media { max-width: 100%; }
.brand-bar { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 16px; }
.brand-bar span { font-weight: 700; color: var(--brand-d); font-size: 1.1rem; }
.brand-logo { max-height: 56px; max-width: 200px; object-fit: contain; }
.play-brand { margin: 0 0 10px; }
.play-brand .brand-logo { max-height: 40px; }
.play-brand span { font-size: .95rem; }
.run-guide { margin-top: 14px; font-size: .9rem; max-width: 420px; }
.run-guide summary { cursor: pointer; font-weight: 600; color: var(--brand-d); }
.run-guide ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.run-guide li { margin: 5px 0; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .host-grid { grid-template-columns: 1fr; }
  .lobby { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .cards { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .features { grid-template-columns: 1fr; }
}

/* ---- assessment report ---- */
.section-h { margin: 22px 0 12px; }
.report-item { margin-bottom: 14px; }
.ri-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.ri-num { font-weight: 700; color: var(--brand-d); }
.ri-prompt { margin: 2px 0 10px; font-weight: 600; }
.ri-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); margin-bottom: 8px; }
.ri-stats b { color: var(--text, #1a1a1a); }
.ri-dist { display: flex; flex-direction: column; gap: 6px; }
.ri-opt-top { display: flex; justify-content: space-between; font-size: .85rem; }
.ri-opt.is-key .ri-opt-label { color: var(--good); font-weight: 600; }
.ri-key { font-size: .72rem; color: var(--good); font-weight: 700; }
.ri-bar { background: var(--line); border-radius: 6px; height: 9px; overflow: hidden; }
.ri-bar span { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.ri-opt.is-key .ri-bar span { background: var(--good); }
.ri-opt-n { min-width: 22px; text-align: right; }
.flag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 7px; border-radius: 999px; }
.flag-easy { background: #e7f0ff; color: #2c5aa0; }
.flag-hard, .flag-bad { background: #fde8e8; color: #b42318; }
.flag-weak { background: #fef3c7; color: #92600a; }
.flag-good { background: #e6f4ea; color: #166534; }
@media print {
  .no-print, .topbar-right { display: none !important; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid var(--line); }
  .report-item { break-inside: avoid; }
}

/* ---- self-paced quiz runner ---- */
.quiz-wrap { max-width: 640px; margin: 0 auto; }
.quiz-nav { margin-top: 16px; display: flex; justify-content: flex-end; }
.big-score { font-size: 2.6rem; font-weight: 800; color: var(--brand-d); margin: 6px 0 0; }
.review-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.review-item { padding: 14px 16px; }
.rev-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.rev-mark { font-size: .8rem; font-weight: 700; }
.rev-ok { border-left: 4px solid var(--good); }
.rev-ok .rev-mark { color: var(--good); }
.rev-bad { border-left: 4px solid var(--bad); }
.rev-bad .rev-mark { color: var(--bad); }
.rev-prompt { font-weight: 600; margin: 2px 0 6px; }
.rev-line { font-size: .9rem; color: var(--muted); margin: 2px 0; }
.rev-key { color: var(--good); font-weight: 600; }
.rev-why { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--soft, #f3f5fb); color: var(--ink, #223); font-style: italic; }
