/* ============================================================
   PiTests — quiet-luxury design system
   Monochrome dark canvas · hairlines · one accent · serif accents
   ============================================================ */
:root {
  --bg: #08090d;
  --surface: rgba(255, 255, 255, 0.028);
  --surface-2: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f5f8;
  --muted: #8f94a6;
  --faint: #5b6070;
  --accent: #8b93ff;
  --accent-dim: rgba(139, 147, 255, 0.14);
  --green: #5fd0a5;
  --red: #f27d92;
  --amber: #e8b45a;
  --cyan: #6cc9e8;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.55;
}
img { max-width: 100%; border-radius: 8px; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input { font-family: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(139, 147, 255, 0.32); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 99px; border: 2.5px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

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

/* ---------- ambience: vignette + film grain ---------- */
.bg-decor { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.bg-decor::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgba(120, 128, 255, 0.075), transparent 62%),
    radial-gradient(ellipse 55% 40% at 88% 108%, rgba(108, 201, 232, 0.05), transparent 60%),
    var(--bg);
}
.bg-noise {
  position: absolute; inset: 0; opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.028 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px clamp(18px, 5vw, 52px);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  background: rgba(8, 9, 13, 0.68);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(255,255,255,0.055), rgba(255,255,255,0.015));
  border: 1px solid var(--line-strong);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-name {
  display: inline-flex; align-items: baseline;
  font-weight: 500; font-size: 17px; letter-spacing: -0.025em; color: var(--text);
}
.brand-pi {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 21px; line-height: 1; margin-right: 5px; letter-spacing: -0.01em;
  background: linear-gradient(115deg, #ffffff 20%, #b9c0ff 75%, #6cc9e8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.batch-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line);
}
.batch-chip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); animation: pulse 2.4s ease infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid transparent; border-radius: 12px; padding: 12px 21px;
  font-size: 14px; font-weight: 550; letter-spacing: 0.005em;
  transition: transform 0.16s var(--ease), background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: #f4f5f8; color: #0b0c11; font-weight: 620; }
.btn-primary:hover { background: #ffffff; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.4; pointer-events: none; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-warn { background: transparent; border-color: var(--line); color: var(--amber); }
.btn-warn:hover { background: rgba(232, 180, 90, 0.07); border-color: rgba(232, 180, 90, 0.35); }
.btn-warn.active { background: rgba(232, 180, 90, 0.14); border-color: rgba(232, 180, 90, 0.45); }
.btn-success { background: var(--text); color: #0b0c11; font-weight: 620; width: 100%; margin-top: 16px; }
.btn-success:hover { background: #fff; }
.btn-danger { background: transparent; border-color: rgba(242, 125, 146, 0.35); color: var(--red); }
.btn-danger:hover { background: rgba(242, 125, 146, 0.08); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- layout ---------- */
main { max-width: 1140px; margin: 0 auto; padding: 0 clamp(18px, 5vw, 52px) 110px; }

/* ================= HOME ================= */
.view-home { animation: fadeUp 0.7s var(--ease) both; }
.hero { text-align: center; padding: clamp(72px, 13vh, 130px) 0 24px; }
.kicker {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 11.5px; font-weight: 560; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 30px;
}
.kicker::before, .kicker::after { content: ""; width: 26px; height: 1px; background: var(--line-strong); }
.hero h1 {
  font-size: clamp(38px, 6.4vw, 74px); line-height: 1.04; letter-spacing: -0.045em; font-weight: 650;
}
.hero h1 em {
  font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.02em;
  background: linear-gradient(100deg, #aab1ff, #6cc9e8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { max-width: 520px; margin: 26px auto 0; color: var(--muted); font-size: 16px; line-height: 1.7; }

.batch-form {
  display: flex; gap: 10px; justify-content: center;
  max-width: 640px; margin: 44px auto 0;
}
.input-wrap { position: relative; flex: 1; min-width: 0; }
#batchInput {
  width: 100%; height: 52px; padding: 0 18px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 13px;
  color: var(--text); font-family: var(--mono); font-size: 13.5px; letter-spacing: 0.03em; outline: none;
  transition: border-color 0.2s, box-shadow 0.25s, background 0.2s;
}
#batchInput::placeholder { color: var(--faint); font-family: var(--font); letter-spacing: 0; }
#batchInput:focus { border-color: rgba(139, 147, 255, 0.55); box-shadow: 0 0 0 4px rgba(139, 147, 255, 0.1); background: rgba(255,255,255,0.04); }
.batch-form .btn-primary { height: 52px; padding: 0 26px; }
.error-line { margin-top: 16px; color: var(--red); font-size: 13.5px; }

.features {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0; margin-top: clamp(72px, 10vh, 110px);
  border-top: 1px solid var(--line);
  text-align: left;
}
.feature-card {
  padding: 30px 26px 34px 0; margin-right: 26px;
  border-right: 1px solid var(--line);
  transition: opacity 0.3s;
}
.feature-card:last-child { border-right: none; margin-right: 0; }
.feature-card svg { width: 19px; height: 19px; color: var(--accent); margin-bottom: 42px; opacity: 0.9; }
.feature-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 7px; letter-spacing: -0.01em; }
.feature-card p { color: var(--muted); font-size: 13px; line-height: 1.6; }
@media (max-width: 900px) {
  .features { grid-template-columns: 1fr 1fr; }
  .feature-card:nth-child(2n) { border-right: none; margin-right: 0; }
  .feature-card { border-bottom: 1px solid var(--line); padding-bottom: 26px; }
  .feature-icon-gap { display: block; height: 26px; }
}
@media (max-width: 480px) {
  .features { grid-template-columns: 1fr; }
  .feature-card { border-right: none !important; margin-right: 0 !important; padding-right: 0; }
}

/* ================= BATCH BROWSER (home) ================= */
#view-batches { animation: fadeUp 0.5s var(--ease) both; }
.cat-hero { text-align: center; padding: clamp(40px, 7vh, 76px) 0 34px; }
.cat-title { font-size: clamp(30px, 4.6vw, 52px); line-height: 1.08; letter-spacing: -0.04em; font-weight: 650; margin-top: 4px; }
.cat-title em {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  background: linear-gradient(100deg, #aab1ff, #6cc9e8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cat-search {
  display: flex; align-items: center; gap: 12px;
  max-width: 560px; margin: 34px auto 0; padding: 0 20px;
  height: 56px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line-strong);
  transition: border-color 0.2s, box-shadow 0.25s, background 0.2s;
}
.cat-search:focus-within {
  border-color: rgba(139, 147, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(139, 147, 255, 0.1), 0 14px 44px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.045);
}
.cat-search > svg { width: 19px; height: 19px; color: var(--faint); flex-shrink: 0; }
#batchSearch {
  flex: 1; min-width: 0; height: 100%; padding: 0;
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 15.5px;
}
#batchSearch::placeholder { color: var(--faint); }
.pill-note {
  flex-shrink: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--faint); border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px;
}
.quick-pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.quick-pills button {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em;
  padding: 8px 16px; border-radius: 99px;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.15s var(--ease);
}
.quick-pills button:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface); transform: translateY(-1px); }

.cat-results { max-width: 720px; margin: 26px auto 0; }
.batches-count {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 6px; min-height: 14px;
}
.grow { flex: 1; min-width: 0; }
.batch-list { display: flex; flex-direction: column; }
.batch-row {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  padding: 14px 6px; color: var(--text);
  transition: background 0.18s;
}
.batch-row:hover { background: var(--surface); }
.batch-row img {
  width: 46px; height: 46px; object-fit: cover; border-radius: 10px; flex-shrink: 0;
  border: 1px solid var(--line-strong); background: var(--surface-2);
}
.br-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.br-name {
  font-size: 14.5px; font-weight: 550; letter-spacing: -0.01em; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.br-sub {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.br-id {
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.batch-row > svg { width: 15px; height: 15px; color: var(--faint); flex-shrink: 0; transition: transform .2s var(--ease), color .2s; }
.batch-row:hover > svg { transform: translateX(3px); color: var(--text); }
.chunk { animation: fadeIn 0.35s ease both; }

@media (max-width: 520px) {
  .batch-row { gap: 11px; padding: 12px 2px; }
  .batch-row img { width: 40px; height: 40px; border-radius: 9px; }
  .br-name { font-size: 13.5px; -webkit-line-clamp: 2; }
  .br-sub { font-size: 11.5px; }
  .br-id { font-size: 9px; letter-spacing: 0.02em; }
  .batch-row > svg { width: 13px; height: 13px; }
  #batchSearch { font-size: 14px; }
  .direct-icon { width: 40px; height: 40px; font-size: 15px; }
  .pill-note { display: none; }
  .cat-search { height: 50px; padding: 0 16px; gap: 10px; margin-top: 28px; }
  .cat-hero { padding-bottom: 24px; }
}
.sentinel { display: grid; place-items: center; padding: 26px 0; }
.spinner-sm { width: 20px; height: 20px; border-width: 1.5px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 22px; padding: 6px 2px;
  background: none; border: none; color: var(--muted);
  font-size: 13.5px; font-weight: 500; letter-spacing: 0.01em;
  transition: color 0.2s;
}
.link-btn svg { width: 14px; height: 14px; transition: transform 0.25s var(--ease); }
.link-btn:hover { color: var(--text); }
.link-btn:hover svg { transform: translateX(3px); }
.manual-link { display: flex; width: max-content; margin: 30px auto 0; }

/* direct batch-ID result */
.batch-row.direct {
  background: var(--accent-dim); border-radius: 12px;
  border-bottom-color: transparent; margin: 8px 0 4px; padding: 14px 12px;
}
.batch-row.direct:hover { background: rgba(139, 147, 255, 0.19); }
.batch-row.direct .br-name { color: #c9cdff; }
.direct-icon {
  width: 46px; height: 46px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 17px; font-weight: 700; color: var(--accent);
  border: 1px solid rgba(139, 147, 255, 0.45);
}

.th-left { display: flex; align-items: center; gap: 14px; }

/* ================= TEST LIST ================= */
#view-tests { animation: fadeUp 0.5s var(--ease) both; }
.tests-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 52px 0 30px; }
.tests-head h2 { font-size: clamp(26px, 4vw, 38px); letter-spacing: -0.035em; font-weight: 650; }
.tests-head .muted { font-size: 13.5px; margin-top: 6px; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
#testSearch {
  height: 42px; width: 250px; max-width: 60vw; padding: 0 4px 0 28px;
  background: transparent; border: none; border-bottom: 1px solid var(--line-strong);
  color: var(--text); outline: none; font-size: 14px; transition: border-color 0.2s;
}
#testSearch:focus { border-bottom-color: var(--accent); }
#testSearch::placeholder { color: var(--faint); }

.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.test-card {
  position: relative; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 22px 22px 20px;
  transition: transform 0.25s var(--ease), border-color 0.25s, background 0.25s;
  animation: fadeUp 0.5s var(--ease) both;
}
.test-card:hover {
  transform: translateY(-3px); border-color: var(--line-strong); background: var(--surface-2);
}
.tc-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.tc-badge { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--faint); }
.tc-arrow { color: var(--faint); transition: transform 0.25s var(--ease), color 0.25s; }
.test-card:hover .tc-arrow { transform: translateX(4px); color: var(--text); }
.tc-name {
  font-size: 15.5px; font-weight: 570; line-height: 1.45; letter-spacing: -0.012em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.9em; margin-bottom: 18px;
}
.tc-meta {
  display: flex; gap: 0; align-items: center;
  border-top: 1px solid var(--line); padding-top: 15px;
}
.tc-meta > span {
  display: inline-flex; align-items: baseline; gap: 6px; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.09em; font-weight: 530;
  padding-right: 18px; margin-right: 18px; border-right: 1px solid var(--line);
}
.tc-meta > span:last-child { border-right: none; margin-right: 0; padding-right: 0; }
.tc-meta b { color: var(--text); font-family: var(--mono); font-size: 12.5px; letter-spacing: 0; }
.tc-resume {
  margin-top: 15px; display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 530; color: var(--amber);
}
.tc-resume i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--amber);
  animation: pulse 2s ease infinite;
}

.empty-state { text-align: center; padding: 90px 0 50px; }
.empty-art { color: var(--faint); margin-bottom: 18px; }
.empty-art svg { width: 34px; height: 34px; }
.empty-state h3 { font-size: 17px; font-weight: 570; margin-bottom: 7px; }
.empty-state p { color: var(--muted); font-size: 13.5px; }

/* ================= RUNNER ================= */
.runner-bar {
  position: sticky; top: 65px; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  background: rgba(8, 9, 13, 0.75);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.runner-title {
  flex: 1; font-weight: 560; font-size: 15px; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.timer-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-weight: 500; font-size: 15.5px; letter-spacing: 0.04em;
  padding: 8px 15px; border-radius: 11px;
  border: 1px solid var(--line); color: var(--text);
  font-variant-numeric: tabular-nums;
}
.timer-chip svg { width: 14px; height: 14px; color: var(--muted); }
.progress-track { height: 2px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 34px; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 99px; transition: width 0.4s var(--ease); }

.runner-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 30px; align-items: start; }

.q-pane { animation: fadeIn 0.3s ease both; min-width: 0; }
.q-meta-row { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 10.5px; font-weight: 570; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line); border-radius: 99px; padding: 5.5px 12px;
  background: transparent;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.chip-marks { font-family: var(--mono); letter-spacing: 0.06em; text-transform: none; font-size: 11px; }
.chip-marks::before { display: none; }
.chip-type { color: var(--cyan); }
.chip-diff.easy { color: var(--green); }
.chip-diff.medium { color: var(--amber); }
.chip-diff.hard { color: var(--red); }

.q-number {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 14px;
}
.q-body { font-size: 16.5px; line-height: 1.72; letter-spacing: -0.005em; margin-bottom: 26px; max-width: 68ch; }
.q-body img { display: block; margin-top: 16px; max-height: 400px; width: auto; max-width: 100%; border: 1px solid var(--line); }
/* rich upstream content (HTML + MathJax) */
.q-body p, .rev-q p, .rev-solution p, .opt-text p { margin: 0 0 0.7em; }
.q-body > :last-child, .rev-q > :last-child, .rev-solution > :last-child { margin-bottom: 0; }
mjx-container { max-width: 100% !important; }
mjx-container[display="true"], mjx-container[jax="CHTML"][display] {
  display: block !important; overflow-x: auto; overflow-y: hidden; padding: 4px 0;
}

.options { display: flex; flex-direction: column; gap: 9px; max-width: 620px; }
.option {
  position: relative; display: flex; align-items: center; gap: 15px; width: 100%; text-align: left;
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 14px 46px 14px 15px; color: var(--text); font-size: 14.5px; line-height: 1.5;
  transition: border-color 0.18s, background 0.18s;
}
.option:hover { border-color: var(--line-strong); background: var(--surface); }
.option .opt-key {
  flex-shrink: 0; width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 8px; font-family: var(--mono); font-weight: 500; font-size: 12px;
  border: 1px solid var(--line-strong); color: var(--muted);
  transition: all 0.18s;
}
.opt-text { flex: 1; min-width: 0; }
.opt-text img { max-height: 120px; width: auto; max-width: 100%; }
.option.selected { border-color: rgba(139, 147, 255, 0.6); background: var(--accent-dim); }
.option.selected .opt-key { background: var(--accent); color: #0b0c11; border-color: var(--accent); font-weight: 700; }
.opt-check {
  position: absolute; right: 15px; top: 50%; transform: translateY(-50%) scale(0.6);
  width: 17px; height: 17px; color: var(--accent); opacity: 0;
  transition: opacity 0.18s, transform 0.25s var(--ease);
}
.option.selected .opt-check { opacity: 1; transform: translateY(-50%) scale(1); }

.numeric-input label {
  display: block; font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px;
}
#numericAns {
  width: 240px; height: 48px; padding: 0 15px;
  background: transparent; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  color: var(--text); font-family: var(--mono); font-size: 17px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#numericAns:focus { border-color: rgba(139, 147, 255, 0.55); box-shadow: 0 0 0 4px rgba(139, 147, 255, 0.1); }
#numericAns::-webkit-outer-spin-button, #numericAns::-webkit-inner-spin-button { -webkit-appearance: none; }
#numericAns { -moz-appearance: textfield; appearance: textfield; }

.q-actions {
  display: flex; gap: 9px; flex-wrap: wrap;
  margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line);
  max-width: 620px;
}
.q-actions .btn-primary { margin-left: auto; }

/* palette */
.palette-card {
  position: sticky; top: 132px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 19px;
  background: var(--surface);
}
.palette-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.palette-head h4 {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint);
}
.palette-close { display: none; width: 32px; height: 32px; font-size: 13px; }
.legend { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 18px; }
.lg { font-size: 12px; font-weight: 480; display: inline-flex; align-items: center; gap: 9px; color: var(--muted); }
.lg::before { content: ""; width: 8px; height: 8px; border-radius: 2.5px; flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--line-strong); }
.lg-answered::before { background: var(--accent); border-color: var(--accent); }
.lg-unanswered::before { background: transparent; border-color: var(--red); }
.lg-marked::before { background: transparent; border-color: var(--amber); }
.lg-marked::after { content: ""; position: relative; margin-left: -14px; width: 8px; height: 8px; border-radius: 2.5px; background: var(--amber); clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.lg-unseen::before { background: var(--surface-2); }
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 7px; max-height: 264px; overflow-y: auto; padding-right: 3px; }
.pq {
  aspect-ratio: 1; border-radius: 9px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: transform 0.15s var(--ease), border-color 0.2s, background 0.2s, color 0.2s;
}
.pq:hover { transform: scale(1.07); border-color: var(--line-strong); color: var(--text); z-index: 2; }
.pq.answered { background: var(--accent); border-color: var(--accent); color: #0b0c11; font-weight: 700; }
.pq.unanswered { border-color: rgba(242, 125, 146, 0.5); color: var(--red); }
.pq.marked { border-color: var(--amber); color: var(--amber); }
.pq.current { outline: 1.5px solid var(--text); outline-offset: 2px; }
.palette-stats {
  display: flex; gap: 0; justify-content: space-between;
  margin: 18px 0 0; padding-top: 15px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
}
.palette-stats b { color: var(--text); font-family: var(--mono); letter-spacing: 0; }

.fab {
  display: none; position: fixed; right: 18px; bottom: 20px; z-index: 60;
  align-items: center; gap: 10px; padding: 13px 19px; border-radius: 99px;
  background: rgba(20, 22, 30, 0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong); color: var(--text); font-weight: 550; font-size: 13.5px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
}
.fab svg { width: 16px; height: 16px; color: var(--muted); }
.fab-badge { font-family: var(--mono); font-size: 12px; color: var(--accent); }

/* ================= RESULT ================= */
#view-review { animation: fadeUp 0.55s var(--ease) both; }
.result-hero {
  display: flex; gap: clamp(30px, 6vw, 70px); align-items: center; flex-wrap: wrap;
  margin-top: 52px; padding: clamp(28px, 5vw, 52px) clamp(24px, 5vw, 54px);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(175deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012));
}
.score-ring-wrap { position: relative; width: 172px; height: 172px; flex-shrink: 0; margin: 0 auto; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 6; }
.ring-fg {
  fill: none; stroke: url(#ringGrad); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 474; stroke-dashoffset: 474;
  transform: rotate(-90deg); transform-origin: center;
  transition: stroke-dashoffset 1.5s var(--ease);
}
.score-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.score-pct {
  font-family: var(--serif); font-size: 58px; font-weight: 400; line-height: 1; letter-spacing: -0.02em;
}
.score-marks { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 8px; letter-spacing: 0.05em; }
.result-info { flex: 1; min-width: 300px; }
.result-info h2 { font-size: clamp(23px, 3.4vw, 31px); letter-spacing: -0.03em; font-weight: 630; margin-bottom: 5px; }
.result-info > p { color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }
.stat-grid { display: flex; flex-wrap: wrap; border-top: 1px solid var(--line); }
.stat {
  flex: 1 1 90px; padding: 16px 18px 4px 0; margin-right: 18px;
  border-top: 1px solid transparent;
}
.stat b {
  display: block; font-family: var(--mono); font-weight: 500; font-size: 21px;
  letter-spacing: -0.02em; margin-bottom: 2px; font-variant-numeric: tabular-nums;
}
.stat span { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 530; }
.st-correct b { color: var(--green); } .st-wrong b { color: var(--red); }
.st-skip b { color: var(--muted); } .st-acc b { color: var(--cyan); }
.st-time b { color: var(--amber); } .st-rank b { color: var(--accent); }
.result-actions { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }

.review-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 54px 0 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.review-toolbar h3 { font-size: 19px; font-weight: 620; letter-spacing: -0.025em; }
.filter-tabs { display: flex; gap: 4px; }
.ftab {
  position: relative; border: none; background: transparent; color: var(--faint);
  font-size: 12.5px; font-weight: 540; letter-spacing: 0.02em; padding: 9px 13px;
  transition: color 0.2s;
}
.ftab::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 4px; height: 1.5px;
  background: var(--text); transform: scaleX(0); transform-origin: center;
  transition: transform 0.28s var(--ease);
}
.ftab:hover { color: var(--muted); }
.ftab.active { color: var(--text); }
.ftab.active::after { transform: scaleX(1); }
.ft-correct.active { color: var(--green); } .ft-wrong.active { color: var(--red); } .ft-unattempted.active { color: var(--amber); }
.ft-correct.active::after { background: var(--green); } .ft-wrong.active::after { background: var(--red); } .ft-unattempted.active::after { background: var(--amber); }

.review-list { display: flex; flex-direction: column; }
.rev-item {
  background: transparent; border-bottom: 1px solid var(--line);
  animation: fadeIn 0.4s ease both;
}
.rev-head {
  width: 100%; display: flex; align-items: center; gap: 15px; text-align: left;
  background: transparent; border: none; color: var(--text); padding: 19px 6px;
  transition: background 0.2s;
}
.rev-head:hover { background: var(--surface); }
.rev-status {
  flex-shrink: 0; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%;
}
.rev-status svg { width: 13px; height: 13px; }
.correct .rev-status { background: rgba(95, 208, 165, 0.1); color: var(--green); }
.wrong .rev-status { background: rgba(242, 125, 146, 0.1); color: var(--red); }
.unattempted .rev-status { background: var(--surface-2); color: var(--muted); }
.rev-title { flex: 1; min-width: 0; }
.rev-title b { display: block; font-size: 14px; font-weight: 570; letter-spacing: -0.01em; }
.rev-title small { color: var(--faint); font-size: 12px; }
.rev-award { font-family: var(--mono); font-weight: 500; font-size: 13.5px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.award-pos { color: var(--green); } .award-neg { color: var(--red); } .award-zero { color: var(--faint); }
.rev-chevron { transition: transform 0.3s var(--ease); color: var(--faint); flex-shrink: 0; }
.rev-item.open .rev-chevron { transform: rotate(180deg); }
.rev-preview {
  padding: 2px 6px 16px 51px;
  cursor: pointer;
}
.rev-snippet {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13px; line-height: 1.55; color: var(--muted); max-width: 72ch;
}
.rev-thumb {
  display: block; max-height: 64px; width: auto; max-width: min(420px, 100%);
  border-radius: 6px; border: 1px solid var(--line); opacity: 0.9;
}
.rev-item.open .rev-preview { display: none; }
.rev-body { display: none; padding: 6px 6px 26px 51px; }
.rev-item.open .rev-body { display: block; animation: fadeSlide 0.35s var(--ease) both; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.rev-q { font-size: 15px; line-height: 1.7; margin-bottom: 18px; max-width: 66ch; }
.rev-q img, .rev-solution img { margin-top: 12px; max-height: 360px; width: auto; max-width: 100%; border: 1px solid var(--line); }
.rev-answer-row { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 20px; }
.ans-pill {
  display: inline-flex; align-items: baseline; gap: 9px; font-size: 13px; font-weight: 530;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line);
}
.ans-pill .tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.ans-pill.you.ok { border-color: rgba(95, 208, 165, 0.4); }
.ans-pill.you.ok .tag, .ans-pill.you.ok { color: var(--green); }
.ans-pill.you.bad { border-color: rgba(242, 125, 146, 0.4); }
.ans-pill.you.bad .tag, .ans-pill.you.bad { color: var(--red); }
.ans-pill.key { border-color: rgba(108, 201, 232, 0.35); }
.ans-pill.key .tag, .ans-pill.key { color: var(--cyan); }
.rev-solution h5 {
  font-family: var(--mono); font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--faint); margin-bottom: 10px;
}
.rev-solution { font-size: 14px; line-height: 1.7; color: #c3c8d6; max-width: 66ch; }
.rev-video {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px;
  font-size: 13px; font-weight: 530; color: var(--text); text-decoration: none;
  border: 1px solid var(--line-strong); padding: 9px 16px; border-radius: 9px;
  transition: border-color 0.2s, background 0.2s;
}
.rev-video:hover { border-color: var(--line-strong); background: var(--surface-2); }
.rev-video svg { width: 13px; height: 13px; color: var(--red); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background: rgba(4, 5, 8, 0.72);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.2s ease both;
}
.modal {
  width: 100%; max-width: 420px; padding: 30px;
  border-radius: var(--r-lg); border: 1px solid var(--line-strong);
  background: #101118;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  animation: popIn 0.3s var(--ease) both;
}
.modal h3 { font-size: 18px; font-weight: 620; letter-spacing: -0.02em; margin-bottom: 8px; }
.modal p { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.submit-summary {
  display: flex; margin: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.ss-box { flex: 1; padding: 15px 6px 13px; text-align: center; }
.ss-box + .ss-box { border-left: 1px solid var(--line); }
.ss-box b { display: block; font-family: var(--mono); font-weight: 500; font-size: 19px; }
.ss-box span { font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.13em; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- toast & loader ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 200; padding: 12px 20px; border-radius: 11px;
  background: rgba(18, 20, 28, 0.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong);
  font-size: 13.5px; font-weight: 500; box-shadow: 0 18px 50px rgba(0,0,0,.5);
  animation: popIn 0.25s var(--ease) both; max-width: 90vw;
}
.toast.err { border-color: rgba(242, 125, 146, 0.45); color: var(--red); }
.loader-overlay {
  position: fixed; inset: 0; z-index: 150; display: grid; place-content: center; justify-items: center; gap: 20px;
  background: rgba(5, 6, 10, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.loader-overlay p { color: var(--muted); font-size: 13px; letter-spacing: 0.06em; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.7s linear infinite; }

/* ---------- animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.96) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .runner-layout { grid-template-columns: 1fr; }
  .palette-pane {
    position: fixed; inset: 0; z-index: 90; place-items: end stretch;
    background: rgba(4, 5, 8, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    padding: 0; display: none;
  }
  .palette-pane.open { display: grid; }
  .palette-card {
    position: static; border-radius: 22px 22px 0 0; max-height: 80vh; overflow-y: auto;
    background: #0d0f15; animation: slideUp 0.3s var(--ease) both;
    border-left: none; border-right: none; border-bottom: none;
  }
  .legend { grid-template-columns: 1fr 1fr; }
  .palette-close { display: grid; }
  .fab { display: inline-flex; }
  .result-hero { justify-content: center; text-align: center; }
  .stat-grid { justify-content: center; }
  .stat { text-align: center; padding: 16px 10px 4px; margin-right: 0; }
  .batch-form { flex-direction: column; }
  .rev-body { padding-left: 6px; }
}
@media (max-width: 480px) {
  .timer-chip { font-size: 14px; padding: 7px 12px; }
  .filter-tabs { width: 100%; justify-content: space-between; }
  .ftab { padding: 9px 9px; font-size: 12px; }
  .tc-meta > span { padding-right: 12px; margin-right: 12px; }
}
