/* ============ Tokens ============ */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --surface-3: #f0ede6;
  --border: #e4dfd5;
  --border-strong: #d3ccbf;
  --text: #1f1d1a;
  --text-2: #5b564e;
  --text-3: #8a847a;
  --accent: #c2653c;
  --accent-hover: #ad5530;
  --accent-soft: #f7e7de;
  --accent-text: #9c4a26;
  --ok: #2f7d4f;
  --ok-soft: #e3f2e8;
  --ok-border: #9fd0b0;
  --bad: #c0392b;
  --bad-soft: #fbe6e3;
  --bad-border: #f0b1a9;
  --warn: #b7791f;
  --warn-soft: #fcf1dc;
  --info: #3c6fb0;
  --info-soft: #e5eef9;
  --flag: #d08a12;
  --shadow-sm: 0 1px 2px rgba(31, 29, 26, .05);
  --shadow: 0 1px 3px rgba(31, 29, 26, .06), 0 6px 20px -8px rgba(31, 29, 26, .12);
  --shadow-lg: 0 20px 50px -12px rgba(31, 29, 26, .28);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513; --surface: #1f1e1b; --surface-2: #242320; --surface-3: #2c2a26;
    --border: #35332e; --border-strong: #46433c;
    --text: #efece6; --text-2: #b7b1a6; --text-3: #857f75;
    --accent: #e0825a; --accent-hover: #eb9571; --accent-soft: #3a2a21; --accent-text: #f0a383;
    --ok: #5cc185; --ok-soft: #1c3226; --ok-border: #2f6b47;
    --bad: #f07a6c; --bad-soft: #3b2220; --bad-border: #7a3a33;
    --warn: #e4b155; --warn-soft: #3a3020; --info: #7fa9e3; --info-soft: #1f2a3a; --flag: #f0b33c;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 24px -10px rgba(0,0,0,.5);
    --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161513; --surface: #1f1e1b; --surface-2: #242320; --surface-3: #2c2a26;
  --border: #35332e; --border-strong: #46433c;
  --text: #efece6; --text-2: #b7b1a6; --text-3: #857f75;
  --accent: #e0825a; --accent-hover: #eb9571; --accent-soft: #3a2a21; --accent-text: #f0a383;
  --ok: #5cc185; --ok-soft: #1c3226; --ok-border: #2f6b47;
  --bad: #f07a6c; --bad-soft: #3b2220; --bad-border: #7a3a33;
  --warn: #e4b155; --warn-soft: #3a3020; --info: #7fa9e3; --info-soft: #1f2a3a; --flag: #f0b33c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 24px -10px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.tnum { font-variant-numeric: tabular-nums; }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  height: 60px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand-mark svg { width: 28px; height: 28px; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { stroke: #fff; stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.brand-text span { color: var(--text-3); font-weight: 500; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px; white-space: nowrap;
  text-decoration: none; color: var(--text-2); font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.nav-badge:empty { display: none; }
.nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--bad-soft); color: var(--bad); font-size: 11.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.topbar-right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.exam-pill[hidden] { display: none; }
.exam-pill {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none;
}

/* ============ Layout ============ */
.view { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--text-2); }
h2 { font-size: 16px; margin: 0 0 14px; letter-spacing: -.01em; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-2 { grid-template-columns: 1.4fr 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

/* ============ Buttons & inputs ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--bad); border-color: var(--bad-border); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface-2); color: var(--text-2);
}
.input, select.input {
  height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; min-width: 0;
}
.input:focus, .btn:focus-visible, .opt:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 10px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button .c { color: var(--text-3); font-weight: 500; margin-left: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip.info { background: var(--info-soft); color: var(--info); }

/* ============ Stats ============ */
.stat .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 15px; color: var(--text-3); font-weight: 500; }
.stat .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }
.bar .ok { background: var(--ok); }
.bar .bad { background: var(--bad); }
.bar .acc { background: var(--accent); }
.topic-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.topic-row:first-of-type { border-top: 0; padding-top: 0; }
.topic-row .name { font-weight: 600; font-size: 14px; }
.topic-row .nums { font-size: 13px; color: var(--text-2); text-align: right; }
.topic-row .bar { grid-column: 1 / -1; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 24px; margin-bottom: 16px;
  background: linear-gradient(120deg, var(--accent-soft), var(--surface) 70%);
}
.hero h2 { font-size: 20px; margin-bottom: 4px; }
.hero p { margin: 0; color: var(--text-2); }
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .big { font-size: 40px; margin-bottom: 6px; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border);
  text-decoration: none;
}
.list-row:first-child { border-top: 0; }
a.list-row:hover, .list-row.clickable:hover { background: var(--surface-2); cursor: pointer; }
.score-ring { position: relative; width: 44px; height: 44px; flex: none; }
.score-ring svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.score-ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; }

/* ============ Question UI ============ */
.qlayout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.qcard { padding: 28px 30px; }
.qmeta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.qnum { font-weight: 700; font-size: 14px; color: var(--accent-text); }
.qtext { font-size: 17px; line-height: 1.65; margin: 0 0 22px; letter-spacing: -.003em; }
.opts { display: grid; gap: 10px; }
.opt {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; align-items: start; text-align: left;
  padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; line-height: 1.5; font-size: 15px; transition: border-color .12s, background .12s, box-shadow .12s;
}
.opt:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }
.opt .letter {
  width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; background: var(--surface-3); color: var(--text-2);
}
.opt .mark { width: 22px; height: 22px; margin-top: 4px; }
.opt .mark svg { width: 22px; height: 22px; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.opt:disabled { cursor: default; }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.opt.selected .letter { background: var(--accent); color: #fff; }
.opt.correct { border-color: var(--ok-border); background: var(--ok-soft); }
.opt.correct .letter { background: var(--ok); color: #fff; }
.opt.correct .mark svg { stroke: var(--ok); }
.opt.wrong { border-color: var(--bad-border); background: var(--bad-soft); }
.opt.wrong .letter { background: var(--bad); color: #fff; }
.opt.wrong .mark svg { stroke: var(--bad); }
.opt.dim { opacity: .6; }
.feedback {
  display: flex; align-items: center; gap: 10px; margin: 22px 0 0; padding: 12px 16px; border-radius: 12px; font-weight: 600;
}
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.expl { margin-top: 14px; display: grid; gap: 12px; }
.ex-sec { padding: 16px 18px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.ex-sec.ex-right { background: color-mix(in srgb, var(--ok-soft) 55%, var(--surface-2)); border-color: color-mix(in srgb, var(--ok) 25%, var(--border)); }
.ex-sec h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.ex-sec h3 svg { width: 15px; height: 15px; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ex-right h3 { color: var(--ok); } .ex-right h3 svg { stroke: var(--ok); }
.ex-sec:not(.ex-right) h3 svg { stroke: var(--bad); }
.ex-sec p { margin: 6px 0 0; line-height: 1.65; }
.ex-opt { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.ex-opt + .ex-opt { margin-top: 5px; }
.ex-opt .L { flex: none; cursor: default; margin-top: 0; }
.ex-otext { flex: 1; min-width: 0; }
.ex-opt .chip { flex: none; height: 20px; font-size: 11px; }
.ex-list { list-style: none; margin: 0; padding: 0; display: grid; }
.ex-list li { padding: 12px 0; border-top: 1px solid var(--border); }
.ex-list li:first-child { border-top: 0; padding-top: 2px; }
.ex-list li:last-child { padding-bottom: 0; }
.ref { font-weight: 600; white-space: nowrap; }
.L {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 4px;
  border-radius: 5px; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); cursor: help;
  vertical-align: 1px;
}
.L.ok { background: var(--ok); color: #fff; }
.L.bad { background: var(--bad); color: #fff; }
.note {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px; font-size: 13.5px;
  background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  display: flex; gap: 10px;
}
.note b { color: var(--warn); }
.history { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.hdot { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.hdot.ok { background: var(--ok-soft); color: var(--ok); }
.hdot.bad { background: var(--bad-soft); color: var(--bad); }
.qnav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.flag-btn.on { color: var(--flag); border-color: color-mix(in srgb, var(--flag) 50%, transparent); background: color-mix(in srgb, var(--flag) 12%, transparent); }
.flag-btn.on svg { fill: var(--flag); }
.side { position: sticky; top: 80px; display: grid; gap: 14px; }
.side .card { padding: 16px; }
.side h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; max-height: 360px; overflow-y: auto; padding: 2px; }
.palette button {
  height: 32px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-2); position: relative; font-variant-numeric: tabular-nums;
}
.palette button:hover { border-color: var(--border-strong); }
.palette button.cur { outline: 2px solid var(--accent); outline-offset: 1px; color: var(--text); }
.palette button.ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.palette button.bad { background: var(--bad-soft); border-color: var(--bad-border); color: var(--bad); }
.palette button.ans { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-text); }
.palette button.flg::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--flag); }
.kv { display: flex; justify-content: space-between; font-size: 13.5px; padding: 4px 0; }
.kv span:first-child { color: var(--text-2); }
.kv b { font-variant-numeric: tabular-nums; }
.progress-line { height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 0 0 18px; }
.progress-line > span { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.sess-row { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--border); }
.sess-main { flex: 1; min-width: 0; }
.sess-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sess-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; margin-top: 3px; }
.sess-meta .mono { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.sess-meta .ic { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sess-actions { flex: none; }
.done-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
  background: color-mix(in srgb, var(--ok-soft) 60%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 30%, var(--border)); }
@media (max-width: 760px) { .sess-row { flex-wrap: wrap; padding: 14px 16px; } .sess-actions { width: 100%; justify-content: flex-end; } }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.timer { font-family: var(--mono); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.timer-btn { border: 0; background: transparent; padding: 5px 8px; border-radius: 8px; cursor: pointer; color: inherit; }
.timer-btn:hover { background: var(--surface-3); }
.timer-btn .pen { width: 13px; height: 13px; opacity: .45; }
.timer-btn:hover .pen { opacity: 1; }
.timer svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ============ Exam ============ */
.exam-bar {
  position: sticky; top: 60px; z-index: 10; margin: -28px -24px 20px; padding: 12px 24px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.exam-bar .grow { flex: 1; min-width: 120px; }
.countdown {
  font-family: var(--mono); font-size: 22px; font-weight: 500; letter-spacing: .02em;
  padding: 4px 14px; border-radius: 10px; background: var(--surface-3); display: inline-flex; align-items: center; gap: 8px;
}
.countdown svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.countdown.warn { background: var(--warn-soft); color: var(--warn); }
.countdown.crit { background: var(--bad-soft); color: var(--bad); animation: pulse 1s ease-in-out infinite; }
.countdown.paused { opacity: .6; }
@keyframes pulse { 50% { opacity: .65; } }
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.preset {
  text-align: left; padding: 16px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; display: grid; gap: 2px;
}
.preset:hover { border-color: var(--border-strong); }
.preset.on { border-color: var(--accent); background: var(--accent-soft); }
.preset b { font-size: 15px; }
.preset span { font-size: 13px; color: var(--text-2); }
.form-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.form-row:first-child { border-top: 0; }
.form-row label { font-weight: 600; font-size: 14px; }
.form-row .hint { font-size: 12.5px; color: var(--text-3); margin-top: 2px; font-weight: 400; }
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.big-ring { width: 150px; height: 150px; position: relative; }
.big-ring svg { width: 150px; height: 150px; transform: rotate(-90deg); }
.big-ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.big-ring .center b { font-size: 34px; letter-spacing: -.02em; }
.big-ring .center span { font-size: 12.5px; color: var(--text-2); }
.verdict { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; }
.verdict.pass { color: var(--ok); }
.verdict.fail { color: var(--bad); }
.review-item { border-top: 1px solid var(--border); }
.review-item:first-child { border-top: 0; }
.review-item > summary {
  list-style: none; display: flex; gap: 12px; align-items: center; padding: 14px 20px; cursor: pointer;
}
.review-item > summary::-webkit-details-marker { display: none; }
.review-item > summary:hover { background: var(--surface-2); }
.review-item .snippet { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: 14px; }
.review-item[open] .snippet { white-space: normal; color: var(--text); }
.review-body { padding: 4px 20px 20px 20px; }
.review-body .opts .opt { cursor: default; padding: 10px 12px; font-size: 14px; }
.status-ic { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; font-weight: 700; font-size: 12px; }
.status-ic.ok { background: var(--ok-soft); color: var(--ok); }
.status-ic.bad { background: var(--bad-soft); color: var(--bad); }
.status-ic.skip { background: var(--surface-3); color: var(--text-3); }
.status-ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* ============ Table / bank ============ */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2);
  font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .qsnip { max-width: 520px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--text); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.count-pill { display: inline-flex; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 7px; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.count-pill.bad { background: var(--bad-soft); color: var(--bad); }
.count-pill.zero { color: var(--text-3); }
.sdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.sdot.ok { background: var(--ok); }
.sdot.bad { background: var(--bad); }
mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ============ Toast & modal ============ */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 500; font-size: 14px;
  box-shadow: var(--shadow-lg); transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(20, 18, 15, .45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; padding: 24px; border: 1px solid var(--border); }
.modal h3 { margin: 0 0 8px; font-size: 18px; }
.modal p { margin: 0 0 20px; color: var(--text-2); }
.modal .btn-row { justify-content: flex-end; }

/* ============ Responsive ============ */
@media (max-width: 1000px) {
  .qlayout { grid-template-columns: 1fr; }
  .side { position: static; }
  .cols-2 { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 10px; height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 8px; }
  .nav { order: 3; flex-basis: 100%; padding-bottom: 8px; }
  .topbar-right { margin-left: auto; }
  .brand-text span { display: none; }
  .view { padding: 20px 16px 72px; }
  .exam-bar { top: 0; margin: -20px -16px 16px; padding: 10px 16px; }
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .qcard { padding: 20px 18px; }
  .qtext { font-size: 16px; }
  .opt { grid-template-columns: 30px 1fr auto; gap: 10px; padding: 12px; }
  .form-row { grid-template-columns: 1fr; gap: 6px; }
  .result-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .table .hide-sm { display: none; }
  .table td, .table th { padding: 10px 10px; }
  .stat .value { font-size: 24px; }
  .kbd-hints { display: none; }
}
