/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eceff5;
  --line: #d9dee8;
  --text: #17203a;
  --text-2: #4c566e;
  --text-3: #6b7489;
  --shadow: 0 1px 2px rgb(23 32 58 / 6%), 0 8px 24px rgb(23 32 58 / 7%);

  --accent: #0e7c86;
  --on-accent: #ffffff;
  --accent-text: color-mix(in oklab, var(--accent) 82%, var(--text));
  --accent-soft: color-mix(in oklab, var(--accent) 12%, var(--surface));

  --ok: #1d8a4e;
  --ok-soft: color-mix(in oklab, var(--ok) 14%, var(--surface));
  --bad: #c43a31;
  --bad-soft: color-mix(in oklab, var(--bad) 12%, var(--surface));

  --a0: #e85a47;
  --a1: #6e56e8;
  --a2: #e09a1f;
  --a3: #13917a;
  --on-answer: #ffffff;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --gutter: clamp(16px, 4vw, 32px);

  color-scheme: light;
}

:root[data-accent='tulip'] { --accent: #c0306a; }
:root[data-accent='saffron'] { --accent: #b26b00; }
:root[data-accent='steppe'] { --accent: #4a7a2c; }
:root[data-accent='lapis'] { --accent: #3553c9; }

:root[data-theme='dark'] {
  --bg: #10131c;
  --surface: #191d29;
  --surface-2: #222838;
  --line: #2f3648;
  --text: #e9ecf4;
  --text-2: #b4bbcc;
  --text-3: #8e96aa;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 35%);
  --accent-text: color-mix(in oklab, var(--accent) 55%, #ffffff);
  --accent-soft: color-mix(in oklab, var(--accent) 22%, var(--surface));
  --ok: #3fbf78;
  --bad: #ef6b60;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #10131c;
    --surface: #191d29;
    --surface-2: #222838;
    --line: #2f3648;
    --text: #e9ecf4;
    --text-2: #b4bbcc;
    --text-3: #8e96aa;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 35%);
    --accent-text: color-mix(in oklab, var(--accent) 55%, #ffffff);
    --accent-soft: color-mix(in oklab, var(--accent) 22%, var(--surface));
    --ok: #3fbf78;
    --bad: #ef6b60;
    color-scheme: dark;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  font-feature-settings: 'tnum' 1;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 700; }
h2 { font-size: 22px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent-text); text-underline-offset: 3px; }
img, svg { display: block; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

main { flex: 1; width: 100%; }
.wrap { width: min(1080px, 100%); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { width: min(560px, 100%); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.stack > * + * { margin-top: var(--stack, 16px); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* ==========================================================================
   Header & footer
   ========================================================================== */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; margin-right: auto; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 650; font-size: 14px;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 13px;
  padding: 18px 0 22px;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }
.site-footer a { color: inherit; }
.build { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Controls
   ========================================================================== */

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-line: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--btn-line); border-radius: var(--radius-s);
  background: var(--btn-bg); color: var(--btn-fg);
  font: 600 15px/1 var(--font); text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .08s;
}
.btn:hover { --btn-line: color-mix(in oklab, var(--line) 50%, var(--text-3)); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--on-accent); --btn-line: var(--accent); }
.btn-primary:hover { --btn-bg: color-mix(in oklab, var(--accent) 88%, #000); --btn-line: var(--btn-bg); }
.btn-ghost { --btn-bg: transparent; --btn-line: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-2); --btn-line: transparent; }
.btn-danger { --btn-fg: var(--bad); }
.btn-large { min-height: 56px; font-size: 18px; padding: 0 26px; border-radius: var(--radius-m); }
.btn-icon { width: 44px; padding: 0; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 13px; color: var(--text-3); }

.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); color: var(--text);
  font: 400 16px/1.4 var(--font);
}
textarea.input { resize: vertical; min-height: 72px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.choice-group { display: grid; gap: 8px; }
.choice {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin: 3px 0 0; accent-color: var(--accent); grid-row: span 2; }
.choice b { font-weight: 600; }
.choice small { color: var(--text-2); font-size: 13px; }

/* ==========================================================================
   Surfaces
   ========================================================================== */

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); padding: clamp(16px, 3vw, 24px);
}

.toast-host {
  position: fixed; left: 50%; bottom: 20px; z-index: 100; transform: translateX(-50%);
  display: grid; gap: 8px; width: min(440px, calc(100% - 32px));
}
.toast {
  padding: 12px 16px; border-radius: var(--radius-s);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: 15px;
}
.toast.error { background: var(--bad); color: #fff; }

.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  width: 260px; padding: 14px; display: grid; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: var(--shadow);
}
.menu-panel h3 { font-size: 13px; color: var(--text-2); font-weight: 600; }


.swatches { display: flex; gap: 10px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line);
}
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--text); }

dialog {
  width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius-l); background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgb(10 14 26 / 55%); }

.empty {
  padding: 40px 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-m);
  color: var(--text-2);
}
.empty .btn { margin-top: 16px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text-2);
}
.badge.live { background: var(--accent-soft); color: var(--accent-text); }
.badge.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }

@keyframes pulse { 50% { opacity: .35; } }

/* Theme panel */
.theme-panel { width: 236px; }
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-toggle button {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--text);
  font: 600 15px/1 var(--font); cursor: pointer;
}
.mode-toggle button svg { width: 18px; height: 18px; }
.mode-toggle button[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.swatches { justify-content: space-between; }

/* Overflow menu */
.menu-list { width: 220px; padding: 6px; gap: 2px; }
.menu-list button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: 8px; background: none; color: var(--text); font: 500 15px/1 var(--font); text-align: left; cursor: pointer;
}
.menu-list button:hover { background: var(--surface-2); }
.menu-list button.danger { color: var(--bad); }
.menu-list svg { width: 18px; height: 18px; flex: none; }

/* Modal */
.modal { width: min(680px, calc(100% - 24px)); }
.modal[open] { display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.field-label { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; padding: 0; }

/* Bulk import */
.bulk-help { padding: 12px 14px; border-radius: var(--radius-s); background: var(--accent-soft); font-size: 14px; color: var(--text); }
.bulk-help p + p { margin-top: 6px; }
.bulk-area { min-height: 220px; font: 15px/1.5 ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.bulk-summary { font-weight: 600; }
.bulk-summary.ok { color: var(--ok); }
.bulk-errors { margin: 0; padding-left: 20px; color: var(--bad); font-size: 14px; }
.bulk-errors:empty, .bulk-preview:empty { display: none; }
.bulk-preview { margin: 0; padding: 0 0 0 22px; max-height: 220px; overflow: auto; font-size: 14px; border-left: 3px solid var(--line); }
.bulk-preview li { padding: 4px 0; }
.bulk-preview .pq { display: block; }
.bulk-preview .pa { color: var(--ok); font-weight: 600; }

/* Start tiles (empty dashboard) */
.start-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1000px) { .start-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .start-tiles { grid-template-columns: minmax(0, 1fr); } }
.start-tile {
  display: grid; gap: 8px; justify-items: start; text-align: left; padding: 22px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); color: var(--text); font: inherit;
}
.start-tile:hover { border-color: var(--accent); }
.start-tile b { font-size: 18px; }
.start-tile span:last-child { color: var(--text-2); font-size: 14px; }
.start-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.start-icon svg { width: 24px; height: 24px; }

/* Start dialog */
.kind-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .kind-cards { grid-template-columns: 1fr; } }
.kind-card {
  position: relative; display: grid; gap: 6px; padding: 16px; cursor: pointer;
  border: 2px solid var(--line); border-radius: var(--radius-m); background: var(--surface);
}
.kind-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.kind-card input { position: absolute; opacity: 0; pointer-events: none; }
.kind-card:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.kind-card small { color: var(--text-2); font-size: 13px; line-height: 1.4; }
.kind-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent-text); }
.kind-icon svg { width: 20px; height: 20px; }
.schedule { display: grid; gap: 14px; padding: 16px; border-radius: var(--radius-m); background: var(--surface-2); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .two-col { grid-template-columns: 1fr; } }
.chips { gap: 8px; }
.chip {
  min-height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); font: 600 14px/1 var(--font); cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.checks { display: grid; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* ==========================================================================
   Home
   ========================================================================== */

.home { display: grid; place-items: center; padding: clamp(32px, 8vh, 96px) 0; }
.join-card { width: min(440px, 100%); text-align: center; }
.join-card h1 { margin-bottom: 8px; }
.join-card form { margin-top: 28px; display: grid; gap: 12px; }

.pin-input {
  width: 100%; height: 72px; text-align: center; letter-spacing: .3em; padding-left: .3em;
  font: 700 34px/1 var(--font); border: 2px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); color: var(--text);
}
.pin-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.pin-input::placeholder { color: var(--text-3); letter-spacing: .3em; }

.home-teacher { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--text-2); }

/* ==========================================================================
   Landing
   ========================================================================== */

.btn-light { --btn-bg: #fff; --btn-fg: #0f2a3a; --btn-line: #fff; }
.btn-light:hover { --btn-bg: #eef6f7; --btn-line: #eef6f7; }

:root { --hero: color-mix(in oklab, var(--accent) 62%, #04161c); }

.hero {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--hero); color: #fff;
  padding: clamp(40px, 7vw, 88px) 0 clamp(56px, 8vw, 104px);
}
.hero-shapes { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: .9; }
.hero-shapes .float { animation: drift 9s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.hero-shapes .f2 { animation-duration: 11s; animation-delay: -3s; }
.hero-shapes .f3 { animation-duration: 8s; animation-delay: -5s; }
.hero-shapes .f4 { animation-duration: 12s; animation-delay: -2s; }
@keyframes drift { from { transform: translateY(0) rotate(0); } to { transform: translateY(-14px) rotate(8deg); } }

.hero-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
@media (max-width: 880px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } .join-panel-card { order: -1; } }

.hero h1 { font-size: clamp(38px, 6vw, 72px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; max-width: 13ch; }
.hero-lead { margin-top: 20px; font-size: clamp(17px, 1.6vw, 20px); line-height: 1.55; color: rgb(255 255 255 / 86%); max-width: 52ch; }
.hero-actions { margin-top: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.hero-link { color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgb(255 255 255 / 45%); }
.hero-link:hover { text-decoration-color: #fff; }

.join-panel-card {
  background: var(--surface); color: var(--text); border-radius: var(--radius-l); padding: clamp(22px, 3vw, 32px);
  box-shadow: 0 24px 60px rgb(2 20 26 / 35%); text-align: center;
}
.join-panel-card h2 { font-size: 26px; }
.join-panel-card .muted { margin-top: 6px; }
.join-form { margin-top: 22px; display: grid; gap: 12px; }
.join-error { min-height: 1.4em; font-size: 14px; color: var(--bad); }

.showcase { padding: clamp(40px, 6vw, 72px) 0 clamp(24px, 4vw, 48px); }
.scene { margin: 0 auto; max-width: 920px; }
.scene svg { width: 100%; height: auto; overflow: visible; }
.scene text { font-family: var(--font); }
.trust {
  list-style: none; margin: clamp(24px, 4vw, 40px) 0 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; color: var(--text-2); font-weight: 500;
}
.trust li { display: flex; align-items: center; gap: 8px; }
.trust li::before { content: ''; width: 18px; height: 18px; flex: none; border-radius: 50%; background: var(--ok-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 12.5 3.2 3.2L17 9' fill='none' stroke='%231d8a4e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }

.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-tint { background: var(--surface-2); }
.section-title-lg { font-size: clamp(28px, 3.6vw, 42px); font-weight: 800; letter-spacing: -0.025em; max-width: 22ch; }
.section-lead { margin-top: 12px; color: var(--text-2); font-size: 18px; max-width: 60ch; }

.steps { list-style: none; counter-reset: step; margin: 40px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 3vw, 40px); }
@media (max-width: 800px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.steps li { counter-increment: step; position: relative; padding-top: 64px; }
.steps li::before {
  content: counter(step); position: absolute; top: 0; left: 0; width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; font-size: 22px; font-weight: 800; color: #fff; background: var(--a0);
}
.steps li:nth-child(2)::before { background: var(--a1); }
.steps li:nth-child(3)::before { background: var(--a3); }
.steps h3 { font-size: 21px; }
.steps p { margin-top: 8px; color: var(--text-2); line-height: 1.6; }

.features { margin-top: 40px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 960px) { .features { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .features { grid-template-columns: minmax(0, 1fr); } }
.feature { padding: 24px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); }
.feature h3 { margin-top: 16px; font-size: 18px; }
.feature p { margin-top: 6px; color: var(--text-2); line-height: 1.55; font-size: 15px; }
.feature-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.feature-icon svg { width: 24px; height: 24px; }
.fi-1 { background: var(--a0); } .fi-2 { background: var(--a1); } .fi-3 { background: var(--a2); }
.fi-4 { background: var(--a3); } .fi-5 { background: var(--accent); } .fi-6 { background: #2f6fd6; }

.students { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
@media (max-width: 860px) { .students { grid-template-columns: minmax(0, 1fr); } }
.podium-art svg { width: 100%; max-width: 440px; height: auto; display: block; margin: 0 auto; }
.podium-art text { font-family: var(--font); }
.check-list { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 14px; }
.check-list li { padding-left: 34px; position: relative; color: var(--text-2); line-height: 1.55; }
.check-list li::before { content: ''; position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 7px; background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6.5 12.5 3.5 3.5 7.5-8' fill='none' stroke='%230e7c86' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat; }
.check-list b { color: var(--text); }

.plans { margin-top: 36px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-width: 860px; }
@media (max-width: 700px) { .plans { grid-template-columns: minmax(0, 1fr); } }
.plan { display: flex; flex-direction: column; gap: 6px; padding: 28px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); }
.plan h3 { font-size: 18px; color: var(--text-2); }
.plan-price { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.plan-note { color: var(--text-3); font-size: 14px; }
.plan ul { margin: 16px 0 24px; padding: 0; list-style: none; display: grid; gap: 10px; flex: 1; }
.plan li { padding-left: 26px; position: relative; }
.plan li::before { content: ''; position: absolute; left: 2px; top: .55em; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); transform: rotate(45deg); }
.plan .btn { align-self: flex-start; }
.plan-featured { background: var(--hero, var(--accent)); color: #fff; border-color: transparent; }
.plan-featured h3, .plan-featured .plan-note { color: rgb(255 255 255 / 78%); }
.plan-featured li::before { background: #ffd36e; }

.faq details, .faq .section-title-lg { max-width: 820px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { margin-top: 28px; border-top: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; padding: 20px 40px 20px 0; position: relative; font-size: 18px; font-weight: 650;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 26px; font-weight: 400; color: var(--accent-text); transition: transform .2s; }
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq details p { padding: 0 40px 22px 0; color: var(--text-2); line-height: 1.6; }

.cta-band { background: var(--hero, var(--accent)); color: #fff; padding: clamp(48px, 7vw, 80px) 0; }
.cta-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.cta-band h2 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.02em; max-width: 20ch; }

/* ==========================================================================
   Answer tiles (shared by phone and projector)
   ========================================================================== */

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.tile {
  --tile: var(--a0);
  position: relative; display: flex; align-items: center; gap: 14px;
  min-height: 92px; padding: 16px 18px; border: 0; border-radius: var(--radius-m);
  background: var(--tile); color: var(--on-answer);
  font: 600 18px/1.25 var(--font); text-align: left; cursor: pointer;
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / 18%);
  transition: transform .08s, opacity .2s, filter .2s;
}
.tile:nth-child(2) { --tile: var(--a1); }
.tile:nth-child(3) { --tile: var(--a2); }
.tile:nth-child(4) { --tile: var(--a3); }
button.tile:active { transform: scale(.97); }
.tile svg { width: 34px; height: 34px; flex: none; }
.tile span { min-width: 0; overflow-wrap: anywhere; }
.tile.dim { opacity: .28; filter: saturate(.4); }
.tile.picked { outline: 4px solid var(--text); outline-offset: 3px; }
.tile .count { margin-left: auto; font-size: 22px; font-weight: 700; }
.tile .check {
  position: absolute; top: -10px; right: -10px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface); color: var(--ok); display: grid; place-items: center; box-shadow: var(--shadow);
}
.tile .check svg { width: 20px; height: 20px; }

/* ==========================================================================
   Player (phone)
   ========================================================================== */

.player { display: flex; flex-direction: column; min-height: calc(100dvh - 61px); }
.player-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px var(--gutter);
  border-bottom: 1px solid var(--line); background: var(--surface); font-size: 15px;
}
.player-bar .nick { font-weight: 650; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-bar .score { font-weight: 700; }

.player-stage { flex: 1; display: flex; flex-direction: column; padding: 20px var(--gutter) 24px; gap: 18px; width: min(720px, 100%); margin: 0 auto; }
.player-stage.center { justify-content: center; align-items: center; text-align: center; }

.q-meta { display: flex; justify-content: space-between; align-items: center; color: var(--text-2); font-weight: 600; font-size: 15px; }
.q-text { font-size: clamp(20px, 5vw, 26px); font-weight: 650; line-height: 1.3; }
.q-img { max-width: 100%; max-height: 32vh; object-fit: contain; align-self: center; border-radius: var(--radius-s); background: #fff; }
.intro-list { margin: 0 auto; padding: 0; list-style: none; display: grid; gap: 10px; color: var(--text-2); text-align: left; max-width: 36ch; }
.intro-list li { display: grid; grid-template-columns: 17px 1fr; }
.intro-list li::before { content: ''; width: 7px; height: 7px; margin-top: .6em; border-radius: 50%; background: var(--accent); }

.timer { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--accent); transform-origin: left; }

.player .tiles { flex: 1; align-content: end; }
.player .tile { min-height: clamp(84px, 16vh, 140px); }
@media (max-width: 420px) {
  .player .tiles:not(.two) { grid-template-columns: 1fr; }
  .player .tile { min-height: 74px; }
}

.verdict { display: grid; place-items: center; gap: 14px; }
.verdict-icon { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.verdict-icon svg { width: 52px; height: 52px; }
.verdict.ok .verdict-icon { background: var(--ok); }
.verdict.bad .verdict-icon { background: var(--bad); }
.verdict.none .verdict-icon { background: var(--text-3); }
.verdict h2 { font-size: 30px; }
.points { font-size: 44px; font-weight: 750; letter-spacing: -0.02em; }

.wait-orbit { width: 72px; height: 72px; color: var(--accent); }
.wait-orbit circle { transform-origin: 36px 36px; animation: orbit 2.4s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }

/* Result card */
.result-card { width: min(460px, 100%); text-align: left; }
.result-card > .print-only + * { margin-top: 0; }
.result-head { display: flex; align-items: center; gap: 14px; }
.result-rank { font-size: 52px; font-weight: 750; letter-spacing: -0.03em; color: var(--accent-text); }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 12px; border-radius: var(--radius-s); background: var(--surface-2); }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--text-2); }
.marks { display: flex; flex-wrap: wrap; gap: 6px; }
.mark {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--text-3);
}
.mark.ok { background: var(--ok-soft); color: var(--ok); }
.mark.bad { background: var(--bad-soft); color: var(--bad); }

/* ==========================================================================
   Host (projector)
   ========================================================================== */

.host { flex: 1; display: flex; flex-direction: column; padding: clamp(16px, 2.5vw, 32px) clamp(16px, 3vw, 40px); gap: clamp(16px, 2.5vh, 28px); }
.host-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.host-top .title { font-weight: 650; font-size: 18px; margin-right: auto; }

.lobby { flex: 1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(16px, 3vw, 40px); align-items: start; }
@media (max-width: 860px) { .lobby { grid-template-columns: minmax(0, 1fr); } }

.join-panel { display: grid; gap: 22px; justify-items: start; }
.join-url { font-size: clamp(18px, 2vw, 24px); color: var(--text-2); }
.join-url b { color: var(--text); }

.pin-digits { display: flex; gap: clamp(6px, .8vw, 12px); }
.pin-digits span {
  width: clamp(48px, 6vw, 92px); height: clamp(64px, 8.4vw, 124px);
  display: grid; place-items: center; border-radius: var(--radius-m);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: clamp(38px, 5.4vw, 84px); font-weight: 750; letter-spacing: -0.02em;
}
.pin-digits span:nth-child(3) { margin-right: clamp(8px, 1.4vw, 22px); }

.qr { background: #fff; padding: 12px; border-radius: var(--radius-m); width: clamp(150px, 15vw, 230px); border: 1px solid var(--line); }
.qr svg { width: 100%; height: auto; }

.roster-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.roster-count { font-size: clamp(40px, 5vw, 64px); font-weight: 750; line-height: 1; color: var(--accent-text); }
.roster { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; max-height: 52vh; overflow: auto; }
.roster button {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: 600 16px/1.2 var(--font); cursor: pointer;
}
.roster button.offline { opacity: .45; }
.roster button:hover { border-color: var(--bad); color: var(--bad); text-decoration: line-through; }

.host-q { font-size: clamp(26px, 3.6vw, 48px); font-weight: 650; line-height: 1.2; max-width: 32ch; }
.host-qwrap.has-image { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(16px, 2vw, 32px); align-items: start; }
.host-qwrap.has-image .host-q { font-size: clamp(22px, 2.8vw, 40px); }
.host-img { max-height: 34vh; max-width: 42vw; border-radius: var(--radius-m); background: #fff; box-shadow: var(--shadow); }
@media (max-width: 860px) { .host-qwrap.has-image { grid-template-columns: 1fr; } .host-img { max-width: 100%; } }

/* Assignment tracking */
.assignment { flex: 1; display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(16px, 2.5vw, 32px); align-items: start; }
@media (max-width: 960px) { .assignment { grid-template-columns: minmax(0, 1fr); } }
.share-panel { display: grid; gap: 16px; justify-items: start; }
.share-link { width: 100%; padding: 10px 12px; border-radius: var(--radius-s); background: var(--surface-2); font-size: 14px; overflow-wrap: anywhere; user-select: all; }
.small-qr { width: 140px; padding: 8px; }
.pin-inline { font-size: 34px; font-weight: 750; letter-spacing: .12em; }
.progress-panel { display: grid; gap: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--line); vertical-align: middle; }
.dot.on { background: var(--ok); }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.meter span { font-size: 13px; color: var(--text-2); min-width: 42px; }
.kind { display: inline-block; margin-right: 8px; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 650; vertical-align: 2px; }
.host-stage { flex: 1; display: grid; grid-template-rows: auto 1fr auto; gap: clamp(16px, 3vh, 32px); }
.host-mid { display: flex; align-items: center; gap: clamp(16px, 3vw, 48px); }
.host .tiles { gap: clamp(10px, 1.2vw, 18px); }
.host .tile { min-height: clamp(80px, 13vh, 140px); font-size: clamp(18px, 2vw, 28px); }
.host .tile svg { width: clamp(30px, 3vw, 48px); height: clamp(30px, 3vw, 48px); }

.clock { position: relative; width: clamp(96px, 10vw, 150px); aspect-ratio: 1; flex: none; }
.clock svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.clock circle { fill: none; stroke-width: 9; }
.clock .track { stroke: var(--surface-2); }
.clock .arc { stroke: var(--accent); stroke-linecap: round; }
.clock b { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(32px, 3.6vw, 54px); font-weight: 750; }
.answered-count { font-size: clamp(32px, 3.6vw, 54px); font-weight: 750; line-height: 1; }

.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: clamp(10px, 2vw, 28px); align-items: end; height: clamp(100px, 20vh, 240px); flex: 1; }
.bar { display: grid; grid-template-rows: auto 1fr; justify-items: center; height: 100%; gap: 6px; }
.bar b { font-size: clamp(20px, 2.2vw, 30px); }
.bar i { align-self: end; width: 100%; border-radius: 10px 10px 4px 4px; background: var(--a0); min-height: 6px; transition: height .5s ease-out; }
.bar:nth-child(2) i { background: var(--a1); }
.bar:nth-child(3) i { background: var(--a2); }
.bar:nth-child(4) i { background: var(--a3); }
.bar.dim i { opacity: .3; }

.leaders { display: grid; gap: 8px; width: min(560px, 100%); }
.leader { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); font-size: clamp(16px, 1.6vw, 22px); }
.leader .n { font-weight: 700; color: var(--text-3); }
.leader .who { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader .gain { color: var(--ok); font-weight: 600; font-size: .8em; }
.leader .pts { font-weight: 750; }

.podium { display: flex; justify-content: center; align-items: end; gap: clamp(10px, 2vw, 24px); min-height: 46vh; }
.step { width: clamp(110px, 16vw, 220px); display: grid; justify-items: center; gap: 10px; text-align: center; }
.step .who { font-size: clamp(18px, 2vw, 28px); font-weight: 700; overflow-wrap: anywhere; }
.step .pts { color: var(--text-2); font-weight: 600; }
.step .block {
  width: 100%; border-radius: var(--radius-m) var(--radius-m) 6px 6px; display: grid; place-items: start center; padding-top: 14px;
  font-size: clamp(34px, 4vw, 60px); font-weight: 750; color: #fff;
}
.step.p1 .block { height: clamp(150px, 26vh, 280px); background: var(--a2); }
.step.p2 .block { height: clamp(110px, 19vh, 210px); background: var(--a1); }
.step.p3 .block { height: clamp(80px, 13vh, 150px); background: var(--a0); }
.step.p1 { order: 2; }
.step.p2 { order: 1; }
.step.p3 { order: 3; }
.podium .step { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.podium .p2 { animation-delay: .5s; }
.podium .p1 { animation-delay: 1s; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

.host-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* ==========================================================================
   Teacher dashboard
   ========================================================================== */

.dash { padding: 24px 0 56px; }
.btn-glass { --btn-bg: rgb(255 255 255 / 12%); --btn-fg: #fff; --btn-line: rgb(255 255 255 / 22%); }
.btn-glass:hover { --btn-bg: rgb(255 255 255 / 20%); --btn-line: rgb(255 255 255 / 32%); }

.dash-hero { background: var(--hero); color: #fff; padding: 32px 0 28px; position: relative; overflow: hidden; }
.dash-hero::after {
  content: ''; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgb(255 255 255 / 10%) 0 60%, transparent 61%); pointer-events: none;
}
.dash-hero-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; position: relative; z-index: 1; }
.dash-hero h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 800; letter-spacing: -0.03em; }
.dash-hero p { margin-top: 6px; color: rgb(255 255 255 / 82%); max-width: 60ch; }
.stat-tiles { margin-top: 24px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; position: relative; z-index: 1; }
@media (max-width: 720px) { .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-tile { padding: 14px 16px; border-radius: var(--radius-m); background: rgb(255 255 255 / 10%); border: 1px solid rgb(255 255 255 / 14%); }
.stat-tile b { display: block; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.stat-tile span { font-size: 14px; color: rgb(255 255 255 / 78%); }

.dash-extras { display: grid; gap: 20px; margin-bottom: 28px; }
.dash-extras:empty { display: none; }
.guide-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .guide-row { grid-template-columns: minmax(0, 1fr); } }
.onboarding { display: grid; gap: 14px; }
.onboarding h2 { font-size: 20px; }
.onb-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.onb-bar i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.onb-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .onb-steps { grid-template-columns: minmax(0, 1fr); } }
.onb-steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 14px; border-radius: var(--radius-s); background: var(--surface-2); }
.onb-steps li.done { opacity: .72; }
.onb-steps li.done b { text-decoration: line-through; text-decoration-color: var(--text-3); }
.onb-steps p { margin-top: 4px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.onb-mark { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; background: var(--surface); }
.onb-steps li.done .onb-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.onb-mark svg { width: 16px; height: 16px; }
.onb-action { margin-top: 8px; min-height: 36px; padding: 0 12px; color: var(--accent-text); --btn-bg: var(--surface); --btn-line: var(--line); }

.tip-card { padding: 18px 20px; border-radius: var(--radius-m); background: var(--accent-soft); border: 1px solid color-mix(in oklab, var(--accent) 22%, transparent); }
.tip-card h3 { font-size: 15px; color: var(--accent-text); display: flex; align-items: center; gap: 8px; }
.tip-card h3::before { content: ''; width: 18px; height: 18px; border-radius: 50%; background: #e09a1f; box-shadow: 0 0 0 4px rgb(224 154 31 / 22%); }
.tip-card p { margin-top: 10px; line-height: 1.55; }
.tip-card .btn { min-height: 34px; padding: 0 10px; font-size: 13px; }

.open-sessions h2 { font-size: 18px; margin-bottom: 12px; }
.open-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.open-card {
  display: grid; gap: 6px; padding: 16px; border-radius: var(--radius-m); text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
}
.open-card:hover { border-color: var(--accent); }
.open-card b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.open-go { font-weight: 650; color: var(--accent-text); font-size: 14px; }

.grid-tools { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.search { max-width: 320px; }
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.quiz-card {
  display: flex; flex-direction: column; border-radius: var(--radius-m); background: var(--surface);
  border: 1px solid var(--line); border-top: 6px solid var(--strip); transition: box-shadow .15s, transform .15s;
}
.quiz-card:hover { box-shadow: var(--shadow); }
.quiz-card-body { flex: 1; padding: 18px 18px 8px; color: var(--text); text-decoration: none; display: grid; gap: 4px; align-content: start; }
.quiz-card-body h3 { font-size: 18px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.quiz-card-body p { font-size: 14px; color: var(--text-2); }
.quiz-card-actions { display: flex; align-items: center; gap: 6px; padding: 12px 14px 14px; }
.quiz-card-actions .menu { margin-left: auto; }

.help pre.help-example {
  margin: 10px 0 0; padding: 14px 16px; border-radius: var(--radius-s); background: var(--surface-2);
  font: 14px/1.6 ui-monospace, 'Cascadia Mono', Consolas, monospace; white-space: pre-wrap;
}
.help-block h3 { font-size: 16px; margin-bottom: 6px; }
.help-block p { color: var(--text-2); line-height: 1.6; }
.help-block .btn { margin-top: 10px; }
.help-keys { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; color: var(--text-2); }
kbd { display: inline-block; min-width: 26px; padding: 2px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); font: 600 13px/1.4 var(--font); color: var(--text); text-align: center; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button {
  border: 0; background: none; padding: 12px 14px; font: 600 15px/1 var(--font); color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tabs button[aria-selected='true'] { color: var(--text); border-bottom-color: var(--accent); }

.list { display: grid; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.item:first-child { border-radius: var(--radius-m) var(--radius-m) 0 0; }
.item:last-child { border-radius: 0 0 var(--radius-m) var(--radius-m); }
.item .menu { position: relative; z-index: 2; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 16px 18px; }
.item + .item { border-top: 1px solid var(--line); }
.item h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item p { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.item .actions { display: flex; gap: 6px; }
@media (max-width: 640px) {
  .item { grid-template-columns: minmax(0, 1fr); }
  .item .actions { flex-wrap: wrap; }
}

/* Editor */
.editor { display: grid; gap: 18px; padding: 28px 0 120px; }
.editor-bar {
  position: sticky; bottom: 0; z-index: 10; padding: 12px 0;
  background: color-mix(in oklab, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.editor-bar .wrap { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.editor-bar .status { margin-right: auto; font-size: 14px; color: var(--text-2); }

.qcard { display: grid; gap: 14px; }
.title-input { font-size: 22px; font-weight: 650; min-height: 54px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 10px 0; border-block: 1px solid var(--line); }
.drop {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 10px 14px;
  border: 1.5px dashed var(--line); border-radius: var(--radius-s); background: none; color: var(--text-3);
  font: 500 14px/1.3 var(--font); cursor: pointer; text-align: center;
}
.drop svg { width: 20px; height: 20px; flex: none; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.drop.busy { opacity: .6; pointer-events: none; }
.qimage { display: grid; gap: 8px; justify-items: start; }
.qimage img { max-width: 100%; max-height: 260px; border-radius: var(--radius-s); border: 1px solid var(--line); background: #fff; }
.qcard-head { display: flex; align-items: center; gap: 8px; }
.qcard-head h3 { margin-right: auto; }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .opts { grid-template-columns: minmax(0, 1fr); } }
.opt {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 6px 6px 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface);
}
.opt.correct { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }
.opt .sym { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--a0); }
.opt:nth-child(2) .sym { background: var(--a1); }
.opt:nth-child(3) .sym { background: var(--a2); }
.opt:nth-child(4) .sym { background: var(--a3); }
.opt .sym svg { width: 20px; height: 20px; }
.opt input[type='text'] { border: 0; min-height: 36px; padding: 6px 4px; box-shadow: none; }
.opt label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); padding-right: 6px; cursor: pointer; white-space: nowrap; }
.opt label input { accent-color: var(--ok); width: 18px; height: 18px; }

/* ==========================================================================
   Report
   ========================================================================== */

.report { padding: 28px 0 56px; }
.report-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: end; margin-bottom: 22px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.kpi b { display: block; font-size: 28px; font-weight: 750; letter-spacing: -0.02em; }
.kpi span { font-size: 14px; color: var(--text-2); }

.section-title { margin: 32px 0 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; color: var(--text-2); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.cell { text-align: center; padding: 8px 4px; }
td.cell.ok { color: var(--ok); font-weight: 700; }
td.cell.bad { color: var(--bad); font-weight: 700; }
td.cell.none { color: var(--text-3); }

.meter { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.meter i { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i::after { content: ''; display: block; height: 100%; width: var(--v); background: var(--accent); }
.meter.low i::after { background: var(--bad); }

.print-only { display: none; }

/* ==========================================================================
   Print (PDF)
   ========================================================================== */

@media print {
  :root:root {
    --bg: #fff; --surface: #fff; --surface-2: #f1f3f7; --line: #cfd5e0;
    --text: #111a2e; --text-2: #3d4659; --text-3: #5d6578; --shadow: none;
    --accent-text: var(--accent); color-scheme: light;
  }
  @page { size: A4; margin: 14mm 12mm; }
  body { font-size: 11pt; }
  .site-header, .site-footer, .no-print, .toast-host, .editor-bar, .player-bar { display: none !important; }
  .player-stage.center { justify-content: flex-start; }
  .result-card { border: 0; padding: 0; width: 100%; }
  .print-only { display: block; }
  .report, .player-stage { padding: 0; }
  .table-wrap { overflow: visible; border-radius: 0; }
  table { font-size: 9pt; }
  th, td { padding: 5px 6px; }
  tr, .kpi, .result-card { break-inside: avoid; }
  .print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--text); padding-bottom: 8px; margin-bottom: 16px; }
  .print-head .brand-mark { width: 24px; height: 24px; }
  .print-foot { margin-top: 18px; font-size: 8pt; color: var(--text-3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* templates */
.templates { margin-top: 40px; display: grid; gap: 16px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tpl-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px 16px; padding: 18px;
  border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface);
}
.tpl-icon {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px;
  background: color-mix(in oklab, var(--strip) 18%, var(--surface)); color: color-mix(in oklab, var(--strip) 75%, var(--text));
}
.tpl-icon svg { width: 26px; height: 26px; }
.tpl-text { display: grid; gap: 6px; align-content: start; }
.tpl-text h3 { font-size: 17px; }
.tpl-text p { color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.tpl-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.tpl-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.tpl-list li { display: grid; gap: 6px; }
.tpl-choices { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 14.5px; }
.tpl-choices .ok { color: var(--ok); font-weight: 650; display: inline-flex; align-items: center; gap: 4px; }
.tpl-choices .ok svg { width: 16px; height: 16px; }

/* medals and awards */
.medal-wrap { display: inline-grid; line-height: 0; }
.medal { display: block; filter: drop-shadow(0 3px 6px rgb(0 0 0 / 18%)); }
.step .medal-wrap { animation: medal-in .6s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: inherit; }
.podium .p1 .medal-wrap { animation-delay: 1.5s; }
.podium .p2 .medal-wrap { animation-delay: 1s; }
.podium .p3 .medal-wrap { animation-delay: .5s; }
@keyframes medal-in { from { opacity: 0; transform: translateY(-24px) scale(.6) rotate(-12deg); } }
.rank-cell .medal-wrap { vertical-align: middle; }
.award-block {
  display: grid; gap: 12px; justify-items: center; padding: 16px; text-align: center;
  border-radius: var(--radius-m); background: color-mix(in oklab, #f2b632 14%, var(--surface));
}
.award-title { font-size: 20px; font-weight: 750; }
.award-badges { justify-content: center; gap: 8px; }
.award-badge {
  display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 650; background: color-mix(in oklab, #f2b632 30%, var(--surface)); color: var(--text);
}
.award-badge.perfect { background: var(--ok-soft); color: var(--ok); }
.award-badge.tiny { margin-left: 8px; padding: 2px 8px; font-size: 11.5px; vertical-align: middle; }
.btn-sm { padding: 7px 10px; font-size: 13.5px; }
.btn-sm svg { width: 16px; height: 16px; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti i {
  position: absolute; top: -20px; border-radius: 2px; opacity: .95;
  animation: confetti-fall var(--d) cubic-bezier(.3, .6, .5, 1) var(--delay) forwards;
}
@keyframes confetti-fall {
  to { transform: translate(var(--x), 110vh) rotate(var(--r)); opacity: .9; }
}

/* certificate dialog */
.modal-wide { width: min(980px, calc(100% - 24px)); }
.cert-preview { display: grid; place-items: center; min-height: 200px; }
.cert-canvas { width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow); background: #fffdf7; }
.cert-actions { flex-wrap: wrap; }
