:root {
  color-scheme: dark;
  --ink: #f3f6fb;
  --muted: #a9b4c4;
  --bg: #0a0d12;
  --panel: #12161f;
  --panel-2: #1a2029;
  --line: rgba(255, 255, 255, 0.11);
  --blue: #2f6fb0;
  --blue-light: #5aa8ea;
  --green: #67c08a;
  --red: #da6e6e;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 4%, rgba(47, 111, 176, 0.16), transparent 30%),
    radial-gradient(circle at 86% 94%, rgba(79, 106, 148, 0.12), transparent 28%),
    #060810;
}

button { font: inherit; cursor: pointer; }

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 8, 16, 0.9);
  backdrop-filter: blur(6px);
}

.brand { font-weight: 800; letter-spacing: -0.01em; }

.exam-meta { display: flex; align-items: center; gap: 16px; font-weight: 700; }
.exam-meta[hidden] { display: none; }

.timer-badge {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.timer-badge.urgent { color: var(--red); border-color: rgba(218, 110, 110, 0.5); background: rgba(218, 110, 110, 0.08); }

.content {
  flex: 1;
  width: min(94vw, 1180px);
  margin: 0 auto;
  padding: 40px 8px 60px;
}

.screen { display: none; }
.screen.active { display: block; animation: enter 0.3s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

.eyebrow {
  margin: 0 0 14px;
  color: var(--blue-light);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 { margin: 0; letter-spacing: -0.03em; font-size: clamp(38px, 4.4vw, 60px); line-height: 1.05; }
h1 span { color: var(--blue-light); }

.subline { max-width: 760px; margin: 20px 0; color: var(--muted); font-size: 18px; line-height: 1.5; }
.subline.small { font-size: 15px; margin: 0 0 20px; }

.facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0; }
.facts span {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 14px;
}
.facts b { color: var(--ink); }

.disclaimer { max-width: 760px; color: #8993a3; font-size: 13px; line-height: 1.55; margin-bottom: 26px; }

.start-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }

.primary {
  padding: 15px 22px;
  border: 1px solid rgba(90, 168, 234, 0.4);
  border-radius: 12px;
  color: #0b1420;
  background: var(--blue-light);
  font-weight: 850;
  font-size: 16px;
}
.primary:hover { background: #7cc0f5; }
.primary.full-width { width: 100%; margin-top: 14px; }

.ghost-btn {
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
  font-weight: 700;
  font-size: 15px;
}
.ghost-btn:hover { background: rgba(255, 255, 255, 0.07); }
.ghost-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ghost-btn.is-marked { color: var(--blue-light); border-color: rgba(90, 168, 234, 0.4); }
.ghost-btn.is-revealed { color: #b7ecc7; border-color: rgba(103, 192, 138, 0.5); background: rgba(103, 192, 138, 0.08); }
.question-actions { display: flex; gap: 10px; }

.pill {
  display: inline-block;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.marked-pill { color: var(--blue-light); border-color: rgba(90, 168, 234, 0.4); }

/* Exam screen */
.exam-layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }

.question-pane {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 32px;
  background: linear-gradient(150deg, #151b26, #0d1119);
}

.question-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }

#questionText { font-size: clamp(21px, 2vw, 28px); line-height: 1.32; letter-spacing: -0.01em; margin: 0; }
.select-hint { margin: 10px 0 20px; color: var(--muted); font-size: 14px; }

.options { display: grid; gap: 12px; }
.option-row {
  display: grid;
  grid-template-columns: 22px 34px 1fr;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  font-size: 16px;
  line-height: 1.4;
}
.option-row:hover { background: rgba(255, 255, 255, 0.05); }
.option-row.selected { border-color: rgba(90, 168, 234, 0.55); background: rgba(47, 111, 176, 0.14); }
.option-row.correct { border-color: rgba(103, 192, 138, 0.6); background: rgba(103, 192, 138, 0.12); }
.option-row.correct .letter { border-color: var(--green); color: #07160d; background: var(--green); }
.option-row.correct .input-shape { border-color: var(--green); background: var(--green); }
.option-row.incorrect-pick { border-color: rgba(218, 110, 110, 0.55); background: rgba(218, 110, 110, 0.1); }
.option-row.incorrect-pick .letter { border-color: var(--red); color: #1a0909; background: var(--red); }
.option-row.incorrect-pick .input-shape { border-color: var(--red); background: var(--red); }

.input-shape { width: 20px; height: 20px; border: 2px solid var(--muted); }
.input-shape.is-radio { border-radius: 50%; }
.input-shape.is-checkbox { border-radius: 5px; }
.option-row.selected .input-shape { border-color: var(--blue-light); background: var(--blue-light); }

.option-row .letter {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid rgba(90, 168, 234, 0.28);
  border-radius: 8px;
  color: var(--blue-light);
  background: rgba(47, 111, 176, 0.1);
  font-weight: 900;
  font-size: 13px;
}

.exam-controls { display: flex; justify-content: space-between; margin-top: 26px; }

.navigator {
  position: sticky;
  top: 90px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  background: var(--panel);
}
.navigator h3 { margin: 0 0 12px; font-size: 15px; }

.nav-legend { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 12px; color: var(--muted); }
.nav-legend span { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid var(--line); }
.dot.is-answered { background: var(--green); border-color: var(--green); }
.dot.is-unanswered { background: transparent; }
.dot.is-marked { background: var(--blue-light); border-color: var(--blue-light); }

.nav-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}
.nav-cell {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.nav-cell.is-answered { background: rgba(103, 192, 138, 0.16); border-color: rgba(103, 192, 138, 0.5); color: #d7f3e0; }
.nav-cell.is-marked { box-shadow: inset 0 0 0 2px var(--blue-light); }
.nav-cell.is-current { border-color: var(--blue-light); background: rgba(90, 168, 234, 0.22); color: var(--ink); }

/* Results */
.score-block {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px;
  background: linear-gradient(150deg, #151b26, #0d1119);
  text-align: center;
  margin-bottom: 30px;
}
.score-number { font-size: clamp(46px, 6vw, 74px); font-weight: 850; line-height: 1; }
.score-fraction { color: var(--muted); margin-top: 8px; font-size: 16px; }
.pass-badge {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 850;
  font-size: 14px;
}
.pass-badge.pass { background: rgba(103, 192, 138, 0.18); color: #b7ecc7; border: 1px solid rgba(103, 192, 138, 0.5); }
.pass-badge.fail { background: rgba(218, 110, 110, 0.18); color: #f5c2c2; border: 1px solid rgba(218, 110, 110, 0.5); }
.pass-badge.small { padding: 6px 12px; font-size: 12px; }
.pass-line { margin-top: 12px; color: var(--muted); font-size: 13px; }

.section-heading { margin: 0 0 14px; font-size: 18px; }
.domains-heading { margin-top: 34px; }

.domain-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.domain-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.domain-card-top { display: flex; }
.domain-card-weight {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(90, 168, 234, 0.16);
  color: var(--blue-light);
  font-size: 12px;
  font-weight: 800;
}
.domain-card h3 { margin: 0; font-size: 17px; line-height: 1.32; }
.domain-card-count { margin: -4px 0 4px; color: var(--muted); font-size: 13px; }
.domain-card .full-width { margin-top: auto; }
.domain-breakdown { display: grid; gap: 14px; margin-bottom: 30px; }
.domain-row-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.domain-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.domain-bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue-light)); }

/* Review */
.filter-tabs { display: flex; gap: 10px; margin-bottom: 24px; }
.filter-tab {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.filter-tab.active { color: #0b1420; background: var(--blue-light); border-color: transparent; }

.review-list { display: grid; gap: 20px; margin-bottom: 30px; }
.review-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 26px;
  background: var(--panel);
}
.review-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.result-tag { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.result-tag.correct { background: rgba(103, 192, 138, 0.18); color: #b7ecc7; }
.result-tag.wrong { background: rgba(218, 110, 110, 0.18); color: #f5c2c2; }
.review-card h3 { margin: 0 0 16px; font-size: 19px; line-height: 1.35; }

.review-options { display: grid; gap: 8px; margin-bottom: 16px; }
.review-options .option {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: #dbe2ec;
}
.review-options .option .letter {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  border: 1px solid rgba(90, 168, 234, 0.28);
  color: var(--blue-light);
  background: rgba(47, 111, 176, 0.1);
  font-weight: 900;
  font-size: 12px;
}
.review-options .option.correct { border-color: rgba(103, 192, 138, 0.5); background: rgba(103, 192, 138, 0.1); }
.review-options .option.correct .letter { border-color: var(--green); color: #07160d; background: var(--green); }
.review-options .option.incorrect-pick { border-color: rgba(218, 110, 110, 0.5); background: rgba(218, 110, 110, 0.08); }
.review-options .option.incorrect-pick .letter { border-color: var(--red); color: #1a0909; background: var(--red); }

.answer-panel {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid rgba(103, 192, 138, 0.35);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  background: rgba(103, 192, 138, 0.06);
}
.answer-kicker { color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.answer-panel p { margin: 6px 0 0; color: #c8d8cd; font-size: 14px; line-height: 1.5; }

.explanation-section + .explanation-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.explanation-section h4 {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.explanation-section p { margin: 0; }
.correct-answer-text { color: #e1f6e8 !important; font-weight: 800; font-size: 15px !important; }
.wrong-answer-list { display: grid; gap: 12px; }
.wrong-answer-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: start;
}
.wrong-answer-item strong { color: var(--blue-light); line-height: 1.5; }
.wrong-answer-item p { margin: 0; }
.takeaway-section {
  padding: 16px 18px !important;
  border: 1px solid rgba(90, 168, 234, 0.28) !important;
  border-radius: 9px;
  background: rgba(47, 111, 176, 0.1);
}
.takeaway-section h4 { color: var(--blue-light); }
.takeaway-section p { color: var(--ink); font-weight: 750; }

.empty-note { color: var(--muted); }

/* History */
.history-list { display: grid; gap: 10px; margin-bottom: 24px; }
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.history-date { font-weight: 700; }
.history-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

footer {
  padding: 20px 34px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #737d8d;
  font-size: 12px;
  text-align: center;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(3, 4, 8, 0.72);
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: min(92vw, 460px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  background: #12161f;
}
.modal h3 { margin: 0 0 12px; }
.modal p { margin: 0 0 22px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

@media (max-width: 900px) {
  .exam-layout { grid-template-columns: 1fr; }
  .navigator { position: static; }
  .topbar { padding: 14px 18px; }
  .exam-meta { gap: 10px; font-size: 13px; }
}
