:root {
  --bg:        #09090B;
  --surface:   #111113;
  --surface-2: #18181B;
  --surface-3: #1F1F23;
  --border:    #27272A;
  --border-2:  #3F3F46;
  --fg:        #FAFAFA;
  --fg-dim:    #A1A1AA;
  --fg-mute:   #52525B;
  --accent:    #3ECF8E;
  --accent-hi: #4FE39F;
  --accent-dim:#18332A;
  --red:       #EF4444;
  --red-dim:   #3F1F1F;
  --amber:     #F59E0B;
  --blue:      #60A5FA;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Geist", -apple-system, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; }

/* ============ HEADER ============ */
header.site {
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  position: sticky;
  top: 0;
  background: rgba(9,9,11,0.85);
  backdrop-filter: blur(12px);
  z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 500; font-size: 14px;
  flex-shrink: 0;
}
.logo {
  width: 24px; height: 24px;
  background: var(--fg);
  border-radius: 6px;
  position: relative;
}
.logo::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 10px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--bg);
}
nav.tabs {
  display: flex; gap: 2px;
  margin-left: 12px;
}
nav.tabs button {
  background: none;
  border: none;
  color: var(--fg-dim);
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
nav.tabs button:hover { background: var(--surface-2); color: var(--fg); }
nav.tabs button.active { background: var(--surface-2); color: var(--fg); }

.header-spacer { flex: 1; }

.track-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--fg-dim);
}
.track-pill select {
  background: transparent;
  color: var(--fg-dim);
  border: none;
  font: inherit;
  cursor: pointer;
  outline: none;
}
.track-pill select option {
  background: var(--surface);
  color: var(--fg);
}
.track-pill .dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent);
  flex-shrink: 0;
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3ECF8E, #0EA5E9);
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: var(--bg);
  flex-shrink: 0;
}

/* ============ LAYOUT ============ */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.view { display: none; }
.view.active { display: block; animation: fadeUp 220ms ease-out; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.crumb {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
  margin-bottom: 12px;
}
.crumb .sep { margin: 0 6px; color: var(--border-2); }

h1.hero {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.sub {
  color: var(--fg-dim);
  font-size: 14px;
  max-width: 60ch;
}
.hero-wrap { margin-bottom: 40px; }

.panel-meta {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
}

/* ============ STATS ============ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 40px;
}
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  transition: border-color 120ms;
}
.stat:hover { border-color: var(--border-2); }
.stat .k { font-size: 12px; color: var(--fg-dim); margin-bottom: 12px; }
.stat .v {
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat .v .u {
  font-family: "Geist Mono", monospace;
  font-size: 14px;
  color: var(--fg-mute);
  margin-left: 2px;
  font-weight: 400;
}
.stat .delta {
  margin-top: 10px;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
}

/* ============ GRID / PANELS ============ */
.grid2 {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}
@media (max-width: 920px) { .grid2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.panel + .panel { margin-top: 24px; }
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-head h2 { font-size: 14px; font-weight: 500; }
.panel-head .link {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 12px;
  font-family: "Geist Mono", monospace;
  cursor: pointer;
  background: none;
  border: none;
}
.panel-head .link:hover { color: var(--fg); }

.submod-row {
  display: grid;
  grid-template-columns: 32px 1fr 160px 64px;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 120ms;
  cursor: pointer;
}
.submod-row:last-child { border-bottom: none; }
.submod-row:hover { background: var(--surface-2); }
.submod-row .num {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
}
.submod-row .name { font-weight: 500; font-size: 13px; }
.submod-row .name small {
  display: block; font-weight: 400;
  color: var(--fg-dim); font-size: 11px;
  margin-top: 2px;
}
.bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}
.bar span {
  position: absolute; inset: 0;
  background: var(--accent);
  width: 0;
  transition: width 400ms ease-out;
}
.submod-row .pct {
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  text-align: right;
  color: var(--fg-dim);
}
@media (max-width: 560px) {
  .submod-row { grid-template-columns: 32px 1fr 64px; }
  .submod-row .bar-wrap { display: none; }
}

.session-row, .weak-row {
  display: flex;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.session-row:last-child, .weak-row:last-child { border-bottom: none; }
.session-row .info, .weak-row .info { font-size: 13px; }
.session-row .when, .weak-row .where {
  display: block;
  font-family: "Geist Mono", monospace;
  color: var(--fg-mute);
  font-size: 11px;
  margin-top: 2px;
}
.badge {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
}
.badge.pass { color: var(--accent); border-color: var(--accent-dim); background: rgba(62,207,142,0.08); }
.badge.fail { color: var(--red); border-color: var(--red-dim); background: rgba(239,68,68,0.08); }
.badge.neutral { color: var(--fg-dim); border-color: var(--border); }
.weak-row .pct {
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  color: var(--red);
}
.empty {
  padding: 24px 18px;
  color: var(--fg-mute);
  font-size: 13px;
  text-align: center;
}

.cta {
  margin-top: 32px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.cta h3 { font-size: 16px; font-weight: 500; }
.cta p { color: var(--fg-dim); font-size: 13px; margin-top: 4px; }

/* ============ BUTTONS ============ */
.btn {
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  padding: 9px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-2);
}
.btn.ghost:hover { background: var(--surface-2); color: var(--fg); border-color: var(--border-2); }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { background: inherit; }

/* ============ SETUP FORMS ============ */
.setup {
  max-width: 520px;
  display: grid;
  gap: 20px;
}
.setup label {
  display: block;
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.setup select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: border-color 120ms;
}
.setup select:hover, .setup select:focus { border-color: var(--border-2); }
.setup select:disabled { opacity: 0.6; cursor: not-allowed; }
.setup .inline-row { display: flex; gap: 12px; }
.setup .inline-row > div { flex: 1; }

/* ============ QUESTION CARD ============ */
.session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  color: var(--fg-dim);
}
.session-bar .right { display: flex; gap: 20px; align-items: center; }
.session-bar .streak-label { color: var(--fg-mute); margin-right: 4px; }
.session-bar .streak-val { color: var(--accent); font-weight: 600; }

.timer {
  font-family: "Geist Mono", monospace;
  font-size: 15px;
  color: var(--fg);
  font-weight: 500;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 68px;
  text-align: center;
}
.timer.warn {
  color: var(--red);
  border-color: var(--red-dim);
  background: rgba(239,68,68,0.08);
  animation: flash 1s infinite;
}
@keyframes flash { 50% { opacity: 0.6; } }

.qcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 36px;
}
@media (max-width: 560px) { .qcard { padding: 24px 20px; } }
.qtag {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.qtag .dot { color: var(--accent); }
.qstem {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.4;
  margin-bottom: 24px;
  color: var(--fg);
}

.choices { display: grid; gap: 8px; }
.choice {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  border-radius: 8px;
  transition: background 120ms, border-color 120ms;
  font-family: inherit;
}
.choice:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-2); }
.choice:disabled { cursor: default; }
.choice .letter {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-dim);
  padding-top: 3px;
  text-align: center;
}
.choice.correct {
  background: rgba(62,207,142,0.1);
  border-color: var(--accent-dim);
}
.choice.correct .letter { color: var(--accent); }
.choice.wrong {
  background: rgba(239,68,68,0.08);
  border-color: var(--red-dim);
}
.choice.wrong .letter { color: var(--red); }
.choice.dim { opacity: 0.4; }
.choice.selected {
  background: var(--surface-3);
  border-color: var(--border-2);
}
.choice.selected .letter { color: var(--fg); }

.feedback {
  margin-top: 24px;
  padding: 20px 22px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}
.feedback.err { border-left-color: var(--red); }
.feedback h4 {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.feedback.err h4 { color: var(--red); }
.feedback h4 .answer {
  color: var(--fg);
  text-transform: none;
  letter-spacing: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
}
.feedback p { font-size: 14px; line-height: 1.6; color: var(--fg); }
.feedback p + p { margin-top: 8px; }
.why-wrong {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.why-wrong h5 {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin-bottom: 10px;
}
.why-wrong p {
  font-size: 13px;
  color: var(--fg-dim);
  margin-bottom: 6px;
  line-height: 1.55;
}
.why-wrong p strong {
  font-family: "Geist Mono", monospace;
  font-weight: 600;
  font-size: 11px;
  color: var(--red);
  margin-right: 6px;
}
.feedback .src {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
}

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.mock-nav {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mock-nav button {
  width: 32px; height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 120ms;
}
.mock-nav button:hover { border-color: var(--border-2); color: var(--fg); }
.mock-nav button.answered {
  background: var(--surface-3);
  color: var(--fg);
  border-color: var(--border-2);
}
.mock-nav button.current {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============ RESULTS ============ */
.result-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  margin-bottom: 40px;
  align-items: center;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
@media (max-width: 640px) { .result-hero { grid-template-columns: 1fr; padding: 24px; gap: 20px; } }
.big-score {
  font-weight: 300;
  font-size: 88px;
  line-height: 0.95;
  letter-spacing: -0.04em;
}
.big-score .sm { color: var(--fg-mute); font-size: 48px; }
.big-score.ok { color: var(--accent); }
.big-score.ko { color: var(--red); }
.result-meta {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
  margin-top: 6px;
}
.verdict {
  display: inline-block;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid;
  border-radius: 4px;
  margin-bottom: 12px;
}
.verdict.pass { color: var(--accent); border-color: var(--accent-dim); background: rgba(62,207,142,0.08); }
.verdict.fail { color: var(--red); border-color: var(--red-dim); background: rgba(239,68,68,0.08); }

h2.section {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 40px 0 16px;
}

.review-q {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}
.review-q summary {
  cursor: pointer;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 14px;
  align-items: center;
  list-style: none;
  transition: background 120ms;
}
.review-q summary::-webkit-details-marker { display: none; }
.review-q summary:hover { background: var(--surface-2); }
.review-q .tag {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid;
  border-radius: 4px;
}
.review-q .tag.ok { color: var(--accent); border-color: var(--accent-dim); background: rgba(62,207,142,0.08); }
.review-q .tag.no { color: var(--red); border-color: var(--red-dim); background: rgba(239,68,68,0.08); }
.review-q .stem-preview {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 12px;
}
.review-q .hint {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--fg-mute);
  letter-spacing: 0.1em;
}
.review-q[open] .hint { color: var(--accent); }
.review-body {
  border-top: 1px solid var(--border);
  padding: 24px;
  background: var(--bg);
}
.review-body .labelrow {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}
.review-body .qstem {
  font-size: 17px;
  margin-bottom: 16px;
}
.review-body .row { font-size: 13px; margin-bottom: 8px; }
.review-body .row strong {
  font-weight: 500;
  color: var(--fg-dim);
  margin-right: 6px;
}
.review-body .row .ans-ok { color: var(--accent); }
.review-body .row .ans-ko { color: var(--red); }

/* ============ NOTES ============ */
.notes-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
}
@media (max-width: 820px) { .notes-layout { grid-template-columns: 1fr; gap: 24px; } }
.notes-nav { position: sticky; top: 80px; align-self: start; }
@media (max-width: 820px) { .notes-nav { position: static; } }
.notes-nav-title {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin-bottom: 12px;
  padding: 0 8px;
}
.notes-nav ul { list-style: none; }
.notes-nav li button {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 13px;
  color: var(--fg-dim);
  padding: 10px 12px;
  text-align: left; width: 100%;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 8px;
  border-radius: 6px;
  align-items: center;
  transition: background 120ms, color 120ms;
}
.notes-nav li button:hover { background: var(--surface-2); color: var(--fg); }
.notes-nav li button.active {
  background: var(--surface-2);
  color: var(--fg);
  font-weight: 500;
}
.notes-nav li button.active .num { color: var(--accent); }
.notes-nav li button .num {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
}

.notes-content .note-meta {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.notes-content h3 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
}
.notes-content h4 {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 32px 0 12px;
}
.notes-content h4:first-of-type { margin-top: 0; }
.notes-content p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
  margin-bottom: 14px;
}
.notes-content ul { margin-bottom: 20px; padding-left: 0; list-style: none; }
.notes-content li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg-dim);
  margin-bottom: 8px;
  padding-left: 20px;
  position: relative;
}
.notes-content li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  width: 4px;
  height: 4px;
  background: var(--border-2);
  border-radius: 50%;
}
.notes-content li ul { margin-top: 8px; margin-bottom: 0; }
.notes-content strong { color: var(--fg); font-weight: 500; }
.notes-content code {
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
  border: 1px solid var(--border);
}
.notes-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  color: var(--fg-dim);
}

/* ============ FOOTER ============ */
footer.site {
  border-top: 1px solid var(--border);
  margin-top: 80px;
  padding: 20px 24px;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--fg-mute);
  text-align: center;
}
footer.site button {
  background: none; border: none;
  color: var(--accent);
  font: inherit; cursor: pointer;
  text-decoration: underline;
  padding: 0 4px;
}
