:root {
  --bg: #08111c;
  --bg-2: #0e1a2b;
  --panel: #132337;
  --panel-2: #173049;
  --line: rgba(232, 220, 196, 0.12);
  --ink: #f4efe4;
  --muted: #9aa7b8;
  --copper: #e8a54b;
  --copper-dim: #b57a2c;
  --ozone: #3dd6c6;
  --pass: #3ecf8e;
  --fail: #ef6b6b;
  --warn: #f0c35a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --serif: "Fraunces", "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 214, 198, 0.08), transparent 50%),
    radial-gradient(900px 500px at 110% 0%, rgba(232, 165, 75, 0.1), transparent 45%),
    var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--ozone); text-decoration: none; }
a:hover { text-decoration: underline; }
button, .btn {
  font-family: inherit;
  cursor: pointer;
}
img { max-width: 100%; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: rgba(8, 17, 28, 0.78);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px;
  height: 36px;
}
.brand small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
}
nav a:hover, nav a.active {
  color: var(--ink);
  background: var(--panel);
  text-decoration: none;
}

.hero {
  padding: 48px 0 28px;
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 28px;
  align-items: end;
}
.kicker {
  color: var(--copper);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 550; letter-spacing: -0.02em; }
h1 { font-size: clamp(36px, 6vw, 64px); line-height: 1.05; margin: 0 0 14px; }
h2 { font-size: 28px; margin: 0 0 10px; }
.lede { font-size: 18px; color: var(--muted); max-width: 62ch; margin: 0 0 22px; }

.hero-stat {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
  box-shadow: var(--shadow);
}
.hero-stat ol {
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}
.hero-stat li { margin: 6px 0; }
.hero-stat strong { color: var(--ink); }

.row-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 600;
  text-decoration: none;
  color: #08111c;
  background: var(--copper);
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ozone { background: var(--ozone); }
.btn.danger { background: var(--fail); color: #1a0b0b; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 8px 0 36px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 210px;
}
.card .tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ozone);
}
.card p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.meta { font-size: 12px; color: var(--muted); }
.pass-pill, .fail-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}
.pass-pill { background: rgba(62, 207, 142, 0.15); color: var(--pass); }
.fail-pill { background: rgba(239, 107, 107, 0.15); color: var(--fail); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin: 0 0 18px;
}
.note-block { margin-bottom: 18px; }
.note-block h3 { font-size: 20px; margin-bottom: 8px; }
.note-block p { color: var(--muted); margin: 0 0 8px; }

.quiz-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.progress-track {
  height: 8px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0 18px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ozone), var(--copper));
  width: 0;
}
.question {
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.25;
  margin: 0 0 18px;
}
.choices { display: grid; gap: 10px; }
.choice {
  text-align: left;
  background: var(--bg-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.choice:hover { border-color: rgba(61, 214, 198, 0.5); }
.choice .letter {
  font-family: var(--mono);
  color: var(--copper);
  min-width: 1.4em;
}
.choice.selected { border-color: var(--ozone); background: var(--panel-2); }
.choice.correct { border-color: var(--pass); background: rgba(62, 207, 142, 0.12); }
.choice.wrong { border-color: var(--fail); background: rgba(239, 107, 107, 0.12); }
.choice:disabled { cursor: default; }

.explain {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.explain strong { color: var(--ink); }

.score-ring {
  width: 140px;
  height: 140px;
  margin: 8px auto 16px;
}
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.miss-list { display: grid; gap: 12px; }
.miss-item { background: var(--bg-2); border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); }
.miss-item .q { font-weight: 600; margin-bottom: 6px; }

.flash {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.flash .term { font-family: var(--serif); font-size: 34px; }
.flash .def { color: var(--muted); font-size: 18px; max-width: 50ch; }

.glossary dt { font-weight: 650; margin-top: 12px; color: var(--copper); }
.glossary dd { margin: 4px 0 0; color: var(--muted); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.table th { color: var(--muted); font-weight: 500; }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  padding: 28px 0 40px;
  margin-top: 20px;
}

.hidden { display: none !important; }
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .hero, .grid { grid-template-columns: 1fr; }
  .card { min-height: 0; }
  nav { justify-content: flex-end; }
}
