: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); }

/* ---- 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: 340px 1fr; 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 { font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--brand-pale); color: var(--brand-d); }
.q-badge.demo-badge { background: #fef3c7; color: #92400e; }   /* anonymous /demo sessions in the admin lists */
.q-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 2px 4px; }
.q-del:hover { 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; }

/* ---- 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); }

/* ---- 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); }
.price-card .btn { text-decoration: none; text-align: center; }
@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; }

.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: var(--bad); }
.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; }
.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; }
.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; }
.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(5, 1fr); gap: 12px; }
.stat-tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-align: center; }
.stat-num { font-size: 1.5rem; font-weight: 800; color: var(--brand-d); }
.stat-lbl { font-size: .72rem; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .03em; }
.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; }
.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; }
