:root {
  --bg: #eef3f1;
  --ink: #1a1f24;
  --muted: #4b5563;
  --line: #d8dee6;
  --card: #ffffff;
  --magenta: #e11d74;
  --plum: #2b163c;
  --plum-hover: #3c2054;
  --pink: #ec4899;
  --ok: #16a34a;
  --ok-bg: #ecfdf3;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --chip: #e8eaed;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
}
#app { min-height: 100vh; display: flex; flex-direction: column; }
button { font-family: inherit; cursor: pointer; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Top toolbar */
.chrome-bar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: stretch;
  min-height: 64px;
  padding: 0 12px;
}
.chrome-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  white-space: nowrap;
  color: #163c3a;
  font-weight: 700;
}
.chrome-logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #163c3a;
}
.chrome-tools {
  margin-left: auto;
  display: flex;
  align-items: stretch;
}
.tool {
  border: 0;
  background: transparent;
  border-left: 1px solid #eee;
  min-width: 76px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #374151;
  font-size: 11px;
}
.tool svg { width: 20px; height: 20px; }
.tool:hover { background: #f8fafc; }

.strip {
  background: #e7eceb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  font-size: 12px;
  color: #6b7280;
}
.strip-tab {
  background: #fff;
  border: 1px solid #d1d5db;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  padding: 6px 12px;
  font-weight: 700;
  color: #163c3a;
}
.progress { height: 4px; background: #f1d4e4; }
.progress > span { display: block; height: 100%; background: var(--magenta); }

.exam-body {
  flex: 1;
  padding: 18px 40px 24px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.exam-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.exam-title { margin: 0; font-size: 20px; font-weight: 700; }
.timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 6px 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 15px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.timer svg { width: 16px; height: 16px; }
.timer.low { color: var(--bad); border-color: #fca5a5; background: #fff1f2; }
.q-kicker { margin: 0 0 12px; font-size: 0.9375em; font-weight: 650; }

.q-card {
  background: #fff;
  border-radius: 4px;
  min-height: 520px;
  padding: 28px 32px 36px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
  position: relative;
}
.flag-wrap {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 14px;
}
.flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 5px 10px 5px 6px;
  font-size: 13px;
  color: #374151;
}
.flag.on { background: #fff; border-color: #f9a8d4; color: #9d174d; }
.switch-ui {
  width: 34px;
  height: 18px;
  border-radius: 99px;
  background: #c4c4c4;
  position: relative;
  display: inline-block;
}
.switch-ui i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
}
.flag.on .switch-ui { background: var(--pink); }
.flag.on .switch-ui i { left: 18px; }

.stem {
  font-size: 1em;
  line-height: 1.55;
  margin: 0 0 22px;
  font-weight: 500;
}
.chip, .stem code, .opt-text code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--chip);
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.options { display: flex; flex-direction: column; gap: 16px; max-width: 920px; }
.opt {
  /* A button does not inherit the document font, so without this the option text ignores the
     Zoom control entirely and sits at the browser's default button size. */
  font: inherit;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 14px;
  align-items: start;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
}
.radio {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 2px solid #9ca3af;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
}
.radio b { width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.opt.picked .radio { border-color: var(--magenta); }
.opt.picked .radio b { background: var(--magenta); }
.opt.reveal-ok .radio { border-color: var(--ok); }
.opt.reveal-ok .radio b { background: var(--ok); }
.opt.reveal-bad .radio { border-color: var(--bad); }
.opt.reveal-bad .radio b { background: var(--bad); }
.opt-text { font-size: 0.9375em; line-height: 1.5; padding-top: 1px; }
.opt-text pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78em;
  line-height: 1.4;
  white-space: pre-wrap;
  background: #eceff1;
  color: #111827;
  padding: 12px 14px;
  border-radius: 6px;
}

.why {
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ok-bg);
  color: #14532d;
  max-width: 920px;
}
.why.miss { background: var(--bad-bg); color: #7f1d1d; }

.exam-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px 20px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.exam-foot .spacer { flex: 1; }
.btn-outline, .btn-plum {
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 650;
}
.btn-outline { background: #fff; border: 1px solid #d1d5db; color: #111; }
.btn-plum { background: var(--plum); border: 1px solid var(--plum); color: #fff; }
.btn-plum:hover { background: var(--plum-hover); }
.copyright {
  text-align: right;
  font-size: 11px;
  color: #9ca3af;
  padding: 0 24px 12px;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) { .item-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .item-grid { grid-template-columns: repeat(2, 1fr); } }
.item {
  background: #fff;
  border-radius: 6px;
  padding: 12px 12px 14px;
  border: 2px solid transparent;
  text-align: left;
  min-height: 88px;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.item.flagged { border-color: #60a5fa; background: #f4f9ff; }
.item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.item-name { font-weight: 700; font-size: 14px; }
.mini-flag { font-size: 12px; color: #6b7280; }
.item.flagged .mini-flag { color: #9d174d; }
.done { color: var(--ok); font-size: 13px; font-weight: 650; }
.todo { color: #9ca3af; font-size: 13px; }

/* Start + results (practice extras, sit on the same mint canvas) */
.start-wrap, .results-wrap {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 48px 24px;
}
.hero, .score-card {
  background: #fff;
  max-width: 720px;
  width: 100%;
  padding: 40px;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(16,24,40,.10);
  position: relative;
}
.hero h1, .score-card h1 { margin: 0 0 10px; font-size: 26px; }
.hero p { color: var(--muted); line-height: 1.5; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 16px; }
.chip-meta {
  background: #f3f4f6;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 650;
}
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ghost {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 9px;
  padding: 8px 14px;
  font-weight: 650;
}
.primary { background: var(--plum); color: #fff; border: 0; border-radius: 9px; padding: 8px 14px; font-weight: 650; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; padding: 10px; }
.icon-btn svg { width: 18px; height: 18px; }
.theme-corner { position: absolute; top: 16px; right: 16px; }
.options-row { display: flex; flex-wrap: wrap; gap: 16px; margin: 4px 0; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.switch input { width: 16px; height: 16px; }
.hint, .hint-sub { color: var(--muted); font-size: 12px; }
.hint { margin-top: 14px; }
.hint-sub { margin: 0 0 18px; }
.shortcuts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 14px; }
kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--line);
  background: #f3f4f6;
  border-radius: 5px;
  padding: 1px 5px;
}

.score-card { text-align: center; }
.score-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 26px; }
.score-brand .mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--plum); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none;
  overflow: hidden;
}
.score-brand .mark img { width: 100%; height: 100%; object-fit: cover; }
.score-brand-name { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; color: var(--ink); }
.score-ring {
  --pct: 0;
  --ring-track: var(--chip);
  width: 172px; height: 172px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--ring-track) 0);
}
.score-ring.pass { --ring-color: var(--ok); }
.score-ring.fail { --ring-color: var(--bad); }
.score-ring-inner {
  width: 136px; height: 136px; border-radius: 50%; background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(16,24,40,.06);
}
.score-num { font-size: 36px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.score-status { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; color: var(--muted); }
.score-ring.pass .score-num { color: var(--ok); }
.score-ring.fail .score-num { color: var(--bad); }
.pass { color: var(--ok); }
.fail { color: var(--bad); }
.score-sub { color: var(--muted); margin-bottom: 20px; font-size: 14px; }
.breakdown { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px;
  font-weight: 650; font-size: 13px; background: var(--chip); color: var(--ink);
}
.stat-pill i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #9ca3af; }
.stat-pill.ok { background: var(--ok-bg); color: #065f46; }
.stat-pill.ok i { background: var(--ok); }
.stat-pill.bad { background: var(--bad-bg); color: #7f1d1d; }
.stat-pill.bad i { background: var(--bad); }
.filters { display: flex; justify-content: center; gap: 8px; margin: 16px 0; }
.filter {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 650;
}
.filter.on { background: var(--plum); color: #fff; border-color: var(--plum); }
.review-list { text-align: left; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.review-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  background: var(--card);
  transition: box-shadow .15s ease, transform .15s ease;
}
.review-item:hover { box-shadow: 0 6px 18px rgba(16,24,40,.08); transform: translateY(-1px); }
.review-item.correct { border-left-color: var(--ok); }
.review-item.wrong { border-left-color: var(--bad); }
.review-item.blank { border-left-color: #9ca3af; }
.review-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.review-q { font-weight: 700; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tag { font-size: 11px; font-weight: 750; letter-spacing: .03em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.tag-correct { background: var(--ok-bg); color: #065f46; }
.tag-wrong { background: var(--bad-bg); color: #7f1d1d; }
.tag-blank { background: var(--chip); color: var(--muted); }
.review-stem { margin: 0 0 4px; font-size: 14px; color: var(--ink); line-height: 1.4; }
.review-meta { margin: 0; color: var(--muted); font-size: 12.5px; }
.dot-sep { margin: 0 2px; }

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 36, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}
.modal { background: #fff; border-radius: 6px; padding: 24px; max-width: 460px; width: 100%; }
.modal.wide { max-width: 640px; }
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal p { color: var(--muted); }
.note {
  width: 100%;
  min-height: 220px;
  font-family: var(--sans);
  font-size: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.calc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc input {
  grid-column: 1 / -1;
  font-size: 22px;
  padding: 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.calc button { padding: 12px; border: 1px solid var(--line); background: #f9fafb; border-radius: 4px; font-weight: 700; }

.print-only { display: none; }

:root[data-theme="dark"] {
  --bg: #101418;
  --ink: #e7ecf6;
  --muted: #93a3bd;
  --card: #1a2228;
  --chip: #2a333c;
}
:root[data-theme="dark"] .chrome-bar,
:root[data-theme="dark"] .q-card,
:root[data-theme="dark"] .item,
:root[data-theme="dark"] .hero,
:root[data-theme="dark"] .score-card,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .timer,
:root[data-theme="dark"] .strip-tab { background: var(--card); color: var(--ink); }
:root[data-theme="dark"] .strip { background: #151b20; }
:root[data-theme="dark"] .opt-text pre { background: #11161b; color: #e7ecf6; }

@media (max-width: 800px) {
  .exam-body, .exam-foot { padding-left: 16px; padding-right: 16px; }
  .chrome-tools .tool:nth-child(n+5) { display: none; }
  .flag-wrap { margin: 0 0 12px; }
}

@media print {
  .chrome-bar, .strip, .progress, .exam-foot, .no-print, .copyright { display: none !important; }
  .print-only { display: block !important; }
  .review-stem { display: none !important; }
  .review-item { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
