:root {
  --paper: #f3efe4;
  --ink: #1c1915;
  --muted: #5f584c;
  --navy: #1b3a4b;
  --navy-deep: #102833;
  --copper: #b8612d;
  --card: #fffdf8;
  --line: #e3d9c6;
  --good: #1c6b45;
  --good-bg: #e4f3ea;
  --bad: #9d2430;
  --bad-bg: #fdecea;
  --warn: #8a5a12;
  --warn-bg: #fff3d8;
  --info-bg: #e7f0f4;
  --shadow: 0 10px 30px rgba(28, 25, 21, 0.06);
  --radius: 14px;
  --serif: "Segoe UI", Candara, "Trebuchet MS", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(184, 97, 45, 0.08), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 2rem; letter-spacing: -0.03em; line-height: 1.15; }
h2 { font-size: 1.25rem; letter-spacing: -0.02em; }
h3 { font-size: 1rem; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: white;
  padding: 8px 12px;
  z-index: 5;
}
.skip:focus { top: 12px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: var(--navy-deep);
  color: #f6f1e6;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a {
  color: #f6f1e6;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
}
.nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.12); }
.nav a:hover { background: rgba(255, 255, 255, 0.08); }

#main { width: min(1180px, calc(100% - 32px)); margin: 28px auto 48px; }
.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 32px;
  color: var(--muted);
  font-size: 0.88rem;
}
.site-footer p { margin: 0 0 6px; }

.banner {
  background: var(--warn-bg);
  border: 1px solid #efd3a0;
  color: #5c3d09;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.banner.error { background: var(--bad-bg); border-color: #f3c1c4; color: var(--bad); }

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
}
.lede { color: var(--muted); font-size: 1.05rem; max-width: 62ch; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}
.panel + .panel { margin-top: 16px; }
.panel h2 { margin-bottom: 8px; }

.stat-grid, .metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.metric-grid { grid-template-columns: repeat(3, 1fr); }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.stat b, .metric b {
  display: block;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat span, .metric span { color: var(--muted); font-size: 0.86rem; }
.metric.good b { color: var(--good); }
.metric.bad b { color: var(--bad); }

.btn {
  appearance: none;
  border: 1px solid var(--navy);
  background: white;
  color: var(--navy);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { background: #f4f8f9; }
.btn.primary { background: var(--navy); color: white; }
.btn.primary:hover { background: #244b60; }
.btn.copper { background: var(--copper); border-color: var(--copper); color: white; }
.btn.copper:hover { background: #9d4e22; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #d88a52;
  outline-offset: 2px;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; }
select, input[type="text"], input[type="number"], input[type="search"] {
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.92rem; }
.check input { margin-top: 4px; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; gap: 10px; align-items: center; font-size: 0.92rem; }
.bar { height: 10px; background: #efe7d8; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--navy); border-radius: inherit; }
.bar > span.warn { background: var(--copper); }
.bar > span.bad { background: var(--bad); }
.bar > span.good { background: var(--good); }

.trend { display: flex; align-items: flex-end; gap: 6px; height: 84px; }
.trend a, .trend span.tick {
  flex: 1;
  min-width: 12px;
  background: var(--navy);
  border-radius: 6px 6px 2px 2px;
  display: block;
  text-decoration: none;
}
.trend a.miss { background: var(--copper); }

table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click:hover { background: #faf6ee; }

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  background: var(--info-bg);
  color: var(--navy);
}
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.neutral { background: #efeae0; color: var(--muted); }

.exam-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.2rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.timer.warn { color: var(--warn); border-color: #efd3a0; }
.timer.over { color: var(--bad); border-color: #f3c1c4; }
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.stem { font-size: 1.12rem; line-height: 1.55; white-space: pre-wrap; }
.choices { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: white;
  cursor: pointer;
}
.choice input { margin-top: 4px; }
.choice:has(input:checked) { border-color: var(--navy); background: #f4f8f9; }
.choice.right { background: var(--good-bg); border-color: #b7dfc6; cursor: default; }
.choice.wrong { background: var(--bad-bg); border-color: #f0b8bd; cursor: default; }
.choice.missed { background: var(--warn-bg); border-color: #efd3a0; cursor: default; }
.choice .key { font-weight: 700; color: var(--navy); }
.choice .mark { float: right; font-size: 0.78rem; color: var(--muted); }

.navgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.navgrid button {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.navgrid button.is-answered { background: #d9e6ec; border-color: #b7cdd6; }
.navgrid button.is-flagged { box-shadow: inset 0 -3px 0 var(--copper); }
.navgrid button.is-current { background: var(--navy); color: white; border-color: var(--navy); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 0.8rem; margin-top: 8px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); vertical-align: -1px; margin-right: 4px; }
.swatch.answered { background: #d9e6ec; }
.swatch.flagged { box-shadow: inset 0 -3px 0 var(--copper); background: white; }
.swatch.current { background: var(--navy); border-color: var(--navy); }

.qcard { scroll-margin-top: 76px; }
.qcard header { margin-bottom: 8px; }
.explain {
  white-space: pre-wrap;
  background: #f7f4ec;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 12px;
}
.meta { color: var(--muted); font-size: 0.86rem; display: flex; gap: 8px; flex-wrap: wrap; }

.filters { position: sticky; top: 62px; z-index: 5; background: rgba(243, 239, 228, 0.94); padding: 8px 0; backdrop-filter: blur(6px); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button[aria-pressed="true"] { background: var(--navy); color: white; }

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(16, 40, 51, 0.46);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 18px;
}
.modal {
  width: min(520px, 100%);
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.kvs { display: grid; grid-template-columns: 180px 1fr; gap: 6px 12px; font-size: 0.94rem; }
.kvs dt { color: var(--muted); }
.kvs dd { margin: 0; }

.activity { max-height: 280px; overflow: auto; font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.coverage { font-size: 0.9rem; }
.coverage summary { cursor: pointer; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.score-xl { font-size: 3.2rem; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; margin: 0; }

@media (max-width: 900px) {
  .hero, .exam-layout, .two, .stat-grid, .metric-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; }
  .kvs { grid-template-columns: 1fr; }
  .topbar { padding: 12px 14px; }
  #main { width: min(1180px, calc(100% - 20px)); }
  .filters { top: 56px; }
}
@media print {
  .topbar, .site-footer, .filters, .no-print { display: none !important; }
  body { background: white; }
  #main { width: 100%; margin: 0; }
  .panel { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
