/* =========================================================
   PrepLab — CBSE Class 10 practice
   Plain CSS, no build step, no dependencies.
   ========================================================= */

:root {
  --bg: #f4f5fa;
  --bg-glow: rgba(99, 102, 241, 0.16);
  --surface: #ffffff;
  --surface-2: #fafaff;
  --surface-3: #f1f2f9;
  --line: #e5e7f0;
  --line-strong: #d3d6e4;
  --text: #12152a;
  --text-2: #4a5069;
  --muted: #6d7490;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: #eef0ff;
  --accent-ink: #3730a3;
  --good: #0f9d58;
  --good-soft: #e6f7ee;
  --bad: #d92d20;
  --bad-soft: #fdeceb;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 20, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 20, 40, 0.04), 0 12px 32px -16px rgba(16, 20, 40, 0.25);
  --shadow-lg: 0 24px 60px -28px rgba(16, 20, 40, 0.35);
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.22);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #080a12;
  --bg-glow: rgba(99, 102, 241, 0.22);
  --surface: #111521;
  --surface-2: #141926;
  --surface-3: #1b2130;
  --line: #232a3b;
  --line-strong: #303850;
  --text: #eef1f9;
  --text-2: #c3c9db;
  --muted: #949db4;
  --accent: #818cf8;
  --accent-2: #a5b4fc;
  --accent-soft: #1e2340;
  --accent-ink: #c7d2fe;
  --good: #34d399;
  --good-soft: #0f2e22;
  --bad: #f87171;
  --bad-soft: #35171a;
  --warn: #fbbf24;
  --warn-soft: #332611;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
  --ring: 0 0 0 3px rgba(129, 140, 248, 0.3);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: -30vh -10vw auto;
  height: 70vh;
  background:
    radial-gradient(45% 60% at 20% 20%, var(--bg-glow), transparent 70%),
    radial-gradient(40% 55% at 80% 10%, rgba(14, 165, 233, 0.12), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.15; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
h2 { font-size: 1.06rem; }
p { margin: 0; }
a { color: var(--accent); }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

.small { font-size: 0.86rem; }
.tiny { font-size: 0.78rem; }
.center { text-align: center; }
.muted { color: var(--muted); }
.grad {
  background: linear-gradient(100deg, var(--accent), #0ea5e9 60%, #14b8a6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}

.topbar-inner { display: flex; align-items: center; gap: 16px; height: 64px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 4px;
  margin-right: auto;
  color: inherit;
  cursor: pointer;
  border-radius: 12px;
  font-family: inherit;
}
.brand:focus-visible { outline: none; box-shadow: var(--ring); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), #7c3aed 55%, #0ea5e9);
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.8);
}
.brand-mark svg { width: 21px; height: 21px; }

.brand-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.brand-text strong { font-size: 1.02rem; letter-spacing: -0.02em; }
.brand-text small { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

.nav { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-3); }

.nav-btn {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--bad);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn svg { width: 18px; height: 18px; }
[data-theme="light"] .i-sun, [data-theme="dark"] .i-moon { display: none; }

/* ---------------- Views / hero ---------------- */
.view { padding: 34px 0 80px; animation: fade 0.35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { max-width: 720px; margin-bottom: 28px; }
.hero.compact { margin-bottom: 22px; }

.eyebrow {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.lede { margin-top: 14px; color: var(--text-2); font-size: 1.02rem; max-width: 62ch; }

.hero-points { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 18px; font-size: 0.86rem; color: var(--muted); }
.point { display: inline-flex; align-items: center; gap: 7px; }
.point i {
  font-style: normal;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--good-soft);
  color: var(--good);
  display: grid;
  place-items: center;
  font-size: 0.66rem;
  font-weight: 800;
}

/* ---------------- Banner ---------------- */
.banner {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 16px 18px;
  margin-bottom: 22px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line));
  background: linear-gradient(120deg, var(--warn-soft), var(--surface));
}
.banner-text { display: flex; flex-direction: column; gap: 2px; }
.banner-text strong { font-size: 0.95rem; }

/* ---------------- Subject switch ---------------- */
.subject-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 5px;
  border-radius: 16px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  margin-bottom: 22px;
  max-width: 560px;
}

.subject-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.subject-tab:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.subject-tab.is-active {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.subj-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: none;
}
.subj-icon svg { width: 20px; height: 20px; }
.subj-science { background: #e7f8f1; color: #0d9668; }
.subj-maths { background: #eef0ff; color: #4f46e5; }
[data-theme="dark"] .subj-science { background: #0d2a22; color: #4ade80; }
[data-theme="dark"] .subj-maths { background: #1e2340; color: #a5b4fc; }

.subj-text { display: flex; flex-direction: column; line-height: 1.2; }
.subj-text strong { font-size: 0.95rem; }
.subj-text small { font-size: 0.74rem; color: var(--muted); }

/* ---------------- Layout grid ---------------- */
.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 6px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------------- Chapter cards ---------------- */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.chapter-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 32px 13px 14px;
  text-align: left;
  font-family: inherit;
  color: inherit;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, transform 0.16s, box-shadow 0.16s;
}
.chapter-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.chapter-card:focus-visible { outline: none; box-shadow: var(--ring); }
.chapter-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 6px 18px -14px var(--accent);
}
.chapter-card:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.chapter-no {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--muted);
  margin-top: 1px;
}
.chapter-card.is-selected .chapter-no { background: var(--accent); color: #fff; }

.chapter-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chapter-name { font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
.chapter-sub { font-size: 0.74rem; color: var(--muted); }

.chapter-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 0.6rem;
  color: transparent;
  background: var(--surface);
  transition: all 0.16s;
}
.chapter-card.is-selected .chapter-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------------- Settings ---------------- */
.settings { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 18px; }
.settings h2 { margin-bottom: 2px; }

.field { display: flex; flex-direction: column; gap: 9px; }
.field-label {
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px -8px var(--accent);
}
.chip:focus-visible { outline: none; box-shadow: var(--ring); }

/* switch */
.switch {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  padding: 7px 0;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 40px;
  height: 23px;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  position: relative;
  flex: none;
  transition: background 0.18s, border-color 0.18s;
}
.switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch-text { display: flex; flex-direction: column; line-height: 1.25; font-size: 0.88rem; font-weight: 500; }
.switch-text small { font-size: 0.74rem; color: var(--muted); font-weight: 400; }

.mode-row { display: flex; flex-wrap: wrap; gap: 6px; }
.mode {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}
.mode.is-on {
  border-style: solid;
  border-color: color-mix(in srgb, var(--good) 40%, var(--line));
  background: var(--good-soft);
  color: var(--good);
}

.summary {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.summary-row { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted); }
.summary-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.summary-row.total { padding-top: 7px; border-top: 1px dashed var(--line); font-size: 0.95rem; color: var(--text); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.1s, box-shadow 0.16s, opacity 0.16s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 22px -12px var(--accent);
}
.btn-primary:hover { filter: brightness(1.05); background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.btn-primary:disabled { filter: grayscale(0.4); box-shadow: none; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: var(--surface); }
.btn-danger:hover { background: var(--bad-soft); }

.btn-lg { padding: 13px 20px; font-size: 0.95rem; border-radius: 13px; }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; border-radius: 9px; }
.btn-block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }

/* ---------------- Quiz ---------------- */
.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.quiz-meta { display: flex; align-items: center; gap: 14px; font-size: 0.84rem; }
.quiz-meta .muted { max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 5px 11px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.timer svg { width: 15px; height: 15px; color: var(--muted); }
.timer.is-low { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: var(--bad-soft); }
.timer.is-low svg { color: var(--bad); }

.progress-track {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  margin-bottom: 20px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #0ea5e9);
  transition: width 0.3s ease;
}

.quiz-card { padding: clamp(20px, 3vw, 34px); box-shadow: var(--shadow); }

.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.q-count { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.pill {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-2);
  text-transform: capitalize;
}
.pill.easy { background: var(--good-soft); color: var(--good); }
.pill.medium { background: var(--warn-soft); color: var(--warn); }
.pill.hard { background: var(--bad-soft); color: var(--bad); }

.q-text { font-size: clamp(1.05rem, 1.9vw, 1.3rem); font-weight: 600; line-height: 1.45; margin-bottom: 22px; letter-spacing: -0.01em; }

.options { display: flex; flex-direction: column; gap: 9px; }

.option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  padding: 13px 15px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.option:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.option:focus-visible { outline: none; box-shadow: var(--ring); }
.option:active:not(:disabled) { transform: scale(0.995); }
.option:disabled { cursor: default; }

.option .key {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: all 0.15s;
}

.option.is-chosen { border-color: var(--accent); background: var(--accent-soft); }
.option.is-chosen .key { background: var(--accent); border-color: var(--accent); color: #fff; }

.option.is-correct { border-color: var(--good); background: var(--good-soft); }
.option.is-correct .key { background: var(--good); border-color: var(--good); color: #fff; }

.option.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.is-wrong .key { background: var(--bad); border-color: var(--bad); color: #fff; }

.feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.9rem;
  animation: fade 0.25s ease both;
}
.feedback.ok { border-color: color-mix(in srgb, var(--good) 35%, var(--line)); background: var(--good-soft); }
.feedback.no { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: var(--bad-soft); }
.feedback strong { display: block; margin-bottom: 4px; }
.feedback.ok strong { color: var(--good); }
.feedback.no strong { color: var(--bad); }
.feedback p { color: var(--text-2); font-size: 0.88rem; }

.quiz-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }

.quiz-top, .progress-track, .quiz-card, .quiz-footer, .kbd-hint {
  max-width: 940px;
  margin-left: auto;
  margin-right: auto;
}

.dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; max-width: 340px; }
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  padding: 0;
  cursor: pointer;
  transition: all 0.15s;
}
.dot.is-current { background: var(--accent); border-color: var(--accent); transform: scale(1.3); }
.dot.is-done { background: color-mix(in srgb, var(--accent) 40%, var(--surface)); border-color: transparent; }
.dot.is-right { background: var(--good); border-color: var(--good); }
.dot.is-wrong { background: var(--bad); border-color: var(--bad); }

.kbd-hint { margin-top: 14px; }
kbd {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.72rem;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  background: var(--surface);
}

/* ---------------- Results ---------------- */
.result-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(20px, 4vw, 40px);
  align-items: center;
  padding: clamp(22px, 3.4vw, 36px);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.ring { position: relative; width: 148px; height: 148px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 10; }
.ring-fill {
  fill: none;
  stroke: url(#none);
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.ring-label strong { font-size: 1.9rem; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring-label small { font-size: 0.76rem; color: var(--muted); }

.result-body h1 { margin-bottom: 6px; }
.result-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.stat-pill {
  font-size: 0.79rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-2);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.stat-pill b { color: var(--text); }

.review-list { display: flex; flex-direction: column; gap: 12px; }

.review-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 16px;
  background: var(--surface-2);
  border-left: 3px solid var(--line-strong);
}
.review-item.is-right { border-left-color: var(--good); }
.review-item.is-wrong { border-left-color: var(--bad); }

.review-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.review-num { font-size: 0.72rem; font-weight: 800; color: var(--muted); letter-spacing: 0.05em; }
.review-chapter { font-size: 0.72rem; color: var(--muted); margin-left: auto; }
.review-q { font-size: 0.94rem; font-weight: 600; line-height: 1.45; margin-bottom: 11px; }

.review-opts { display: flex; flex-direction: column; gap: 6px; }
.ro {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.87rem;
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--text-2);
}
.ro .key { flex: none; font-weight: 700; font-size: 0.76rem; width: 16px; }
.ro.is-correct { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); color: var(--text); }
.ro.is-correct .key { color: var(--good); }
.ro.is-chosen-wrong { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--text); }
.ro.is-chosen-wrong .key { color: var(--bad); }
.ro .tag { margin-left: auto; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; white-space: nowrap; padding-left: 8px; }

.explain {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  font-size: 0.86rem;
  color: var(--text-2);
  line-height: 1.5;
}
.explain b { color: var(--text); }
.explain .skipped { color: var(--bad); font-weight: 600; }

/* ---------------- Progress ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat-card .label { font-size: 0.73rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.stat-card .value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-card .value small { font-size: 0.85rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }

.accuracy-list { display: flex; flex-direction: column; gap: 13px; }
.acc-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 74px; gap: 14px; align-items: center; }
.acc-name { font-size: 0.88rem; font-weight: 500; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.acc-name small { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.acc-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.acc-bar span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.6s ease; }
.acc-bar span.low { background: var(--bad); }
.acc-bar span.mid { background: #f59e0b; }
.acc-bar span.high { background: var(--good); }
.acc-pct { text-align: right; font-size: 0.8rem; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.acc-pct b { color: var(--text); }

.attempt-list { display: flex; flex-direction: column; }
.attempt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.87rem;
}
.attempt:last-child { border-bottom: 0; padding-bottom: 0; }
.attempt:first-child { padding-top: 0; }
.attempt-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attempt-what strong { font-weight: 600; }
.attempt-what small { color: var(--muted); font-size: 0.75rem; }
.attempt-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.attempt-acc { font-size: 0.75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.attempt-acc.high { background: var(--good-soft); color: var(--good); }
.attempt-acc.mid { background: var(--warn-soft); color: var(--warn); }
.attempt-acc.low { background: var(--bad-soft); color: var(--bad); }

.empty-state {
  padding: 26px 18px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  font-size: 0.88rem;
  background: var(--surface-2);
}

.mistake-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--warn-soft), var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--warn) 25%, var(--line));
}
.mistake-count { display: flex; align-items: baseline; gap: 9px; }
.mistake-count strong { font-size: 2rem; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.mistake-count span { color: var(--text-2); font-size: 0.88rem; }

.panel.danger { border-color: color-mix(in srgb, var(--bad) 25%, var(--line)); }
.footnote { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 26px; }

/* ---------------- Sticky start bar ---------------- */
.action-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 40;
  width: min(700px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 10px 10px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  animation: rise 0.25s ease;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.action-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.action-info strong { font-size: 0.88rem; }
.action-info span { font-size: 0.74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-bar .btn { flex: none; }

#view-home { padding-bottom: 120px; }

/* ---------------- Toast ---------------- */.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: #111527;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 90;
  max-width: min(92vw, 420px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[data-theme="dark"] .toast { background: #eef1f9; color: #111527; }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .setup-grid { grid-template-columns: 1fr; }
  .settings { position: static; }
  .result-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .result-body .btn-row, .result-stats { justify-content: center; }
  .result-body .eyebrow { text-align: center; }
}

@media (max-width: 640px) {
  .topbar-inner { height: 58px; gap: 8px; }
  .brand-text small { display: none; }
  .view { padding: 22px 0 84px; }
  .hero-points { gap: 6px 14px; }
  .subject-switch { max-width: none; }
  .subject-tab { padding: 9px 10px; gap: 9px; }
  .subj-icon { width: 32px; height: 32px; border-radius: 9px; }
  .subj-text strong { font-size: 0.86rem; }
  .chapter-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; border-radius: 15px; }
  .quiz-footer { position: sticky; bottom: 0; padding: 12px 0 8px; background: linear-gradient(transparent, var(--bg) 30%); }
  .dots { display: none; }
  .quiz-footer .btn { flex: 1; }
  .acc-row { grid-template-columns: minmax(0, 1fr) 72px; gap: 10px; }
  .acc-bar { display: none; }
  .attempt { grid-template-columns: minmax(0, 1fr) auto; }
  .attempt-acc { display: none; }
  .kbd-hint { display: none; }
  .banner { flex-direction: column; align-items: stretch; }
  .banner .btn { width: 100%; }
}

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