:root {
  --bg-navy-dark: #0a1424;
  --bg-navy-main: #0f1d33;
  --bg-navy-surface: #162642;
  --bg-navy-card: rgba(22, 38, 66, 0.82);
  --gold: #d4af37;
  --gold-dark: #b38f28;
  --gold-light: #f59e0b;
  --gold-bright: #facc15;
  --gold-gradient: linear-gradient(135deg, #f59e0b, #d4af37);
  --text: #e2e8f0;
  --text-white: #ffffff;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(212, 175, 55, 0.35);
  --font-heading: "Outfit", sans-serif;
  --font-body: "Inter", sans-serif;
  --shadow-gold: 0 10px 30px -10px rgba(212, 175, 55, 0.3);
  --shadow-navy: 0 20px 40px rgba(0, 0, 0, 0.4);
  --ok: #4ade80;
  --warn: #fbbf24;
  --soft: #60a5fa;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-navy-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.2;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--gold);
  color: #0a1424;
  padding: 0.5rem 1rem;
  z-index: 10000;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 20, 36, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo-pill {
  display: inline-flex;
  align-items: center;
  background: #fff;
  padding: 0.3rem 0.7rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.logo-pill img { height: 42px; width: auto; }

.header-tag {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

.header-meta { text-align: right; color: var(--text-muted); font-size: 0.8rem; }

main { flex: 1; }

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.wide { max-width: 960px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--border-gold);
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  margin-bottom: 1.1rem;
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.gold-line { color: var(--gold); }

.lede {
  font-size: 1.08rem;
  color: #cbd5e1;
  margin-bottom: 1.75rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.75rem 0 2rem;
}

.info-card {
  background: var(--bg-navy-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
}

.info-card h3 { font-size: 1.02rem; margin-bottom: 0.35rem; color: var(--gold); }
.info-card p { font-size: 0.9rem; color: var(--text-muted); }

.centres {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.centre {
  background: var(--bg-navy-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
}

.centre h3 { font-size: 1.05rem; margin-bottom: 0.25rem; }
.centre p { font-size: 0.88rem; color: var(--text-muted); }

.actions { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0.85rem 1.6rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.btn-gold {
  background: var(--gold-gradient);
  color: #0a1424;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.28);
}

.btn-gold:hover { transform: translateY(-2px); box-shadow: var(--shadow-gold); }

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--border-gold);
}

.btn-outline:hover { background: rgba(212, 175, 55, 0.12); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.fine-print { margin-top: 1.25rem; font-size: 0.85rem; color: var(--text-muted); }

.form-card, .test-card, .results-card {
  background: var(--bg-navy-surface);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 1.75rem 1.6rem;
  box-shadow: var(--shadow-navy);
}

.form-card h1, .test-card h2, .results-card h1 { margin-bottom: 0.4rem; }
.form-intro { color: var(--text-muted); margin-bottom: 1.4rem; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1rem;
}

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field.full { grid-column: 1 / -1; }

label { font-size: 0.85rem; font-weight: 600; color: var(--text); }

input, select, textarea {
  width: 100%;
  background: rgba(10, 20, 36, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.95rem;
  color: var(--text-white);
  font-family: var(--font-body);
  font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.22);
}

.field-error { color: #fca5a5; font-size: 0.8rem; min-height: 1.1em; }

.year-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--font-heading);
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
}

.chip[aria-pressed="true"], .chip.selected {
  background: var(--gold-gradient);
  color: #0a1424;
  border-color: transparent;
}

.choice-set { display: grid; gap: 0.65rem; }

.choice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(10, 20, 36, 0.35);
  cursor: pointer;
}

.choice:hover, .choice:focus-within { border-color: var(--border-gold); }
.choice.picked { border-color: var(--gold); background: rgba(212, 175, 55, 0.08); }
.choice input { width: auto; margin-top: 0.2rem; accent-color: var(--gold); }
.choice strong { display: block; color: var(--text-white); }
.choice span { font-size: 0.85rem; color: var(--text-muted); }

.progress-wrap { margin-bottom: 1.2rem; }
.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--gold-gradient);
  width: 0;
  transition: width 0.35s ease;
}

.level-note {
  display: none;
  margin-bottom: 1rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-gold);
  background: rgba(212, 175, 55, 0.1);
  color: #fde68a;
  font-size: 0.92rem;
}

.level-note.visible { display: block; }

.q-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.prompt { font-size: 1.15rem; color: var(--text-white); margin-bottom: 1.15rem; }
.prompt p { margin: 0 0 0.7rem; }
.prompt p:last-child { margin-bottom: 0; }
.prompt strong { color: var(--gold-bright); font-weight: 700; }

.options { display: grid; gap: 0.6rem; }

.option {
  text-align: left;
  width: 100%;
  background: rgba(10, 20, 36, 0.55);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.98rem;
  cursor: pointer;
  font-family: var(--font-body);
}

.option:hover { border-color: var(--border-gold); }
.option.selected { border-color: var(--gold); background: rgba(212, 175, 55, 0.12); color: var(--text-white); }
.option:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.option-key {
  display: inline-flex;
  width: 1.5rem;
  height: 1.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  margin-right: 0.55rem;
}

.writing-tips {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.word-count { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.4rem; }
.word-count.ok { color: var(--ok); }

.test-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}
.test-nav .btn { min-width: 7.5rem; }

.results-hero { margin-bottom: 1.5rem; }

.next-step-panel {
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.18), rgba(212, 175, 55, 0.08));
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 1.25rem 1.3rem 1.35rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-gold);
}

.next-step-kicker {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #0a1424;
  background: var(--gold-gradient);
  display: inline-block;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.65rem;
}

.next-step-panel h2 {
  font-size: 1.35rem;
  color: var(--gold-bright);
  margin-bottom: 0.45rem;
}

.next-step-panel p {
  color: #e2e8f0;
  font-size: 1.02rem;
}

.contact-banner {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.4rem;
  color: var(--text);
}

.results-actions { margin-top: 0.35rem; }
.secondary-actions-label {
  width: 100%;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.15rem;
}

.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.score-card {
  background: rgba(10, 20, 36, 0.45);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.15rem;
}

.score-card h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.band-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.45rem;
}
.band-strong { background: rgba(74, 222, 128, 0.15); color: var(--ok); }
.band-track { background: rgba(251, 191, 36, 0.15); color: var(--warn); }
.band-towards { background: rgba(96, 165, 250, 0.15); color: var(--soft); }

.mark-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  vertical-align: middle;
}
.mark-correct { background: rgba(27, 122, 78, 0.2); color: #4ade80; }
.mark-incorrect { background: rgba(180, 35, 24, 0.2); color: #fca5a5; }
.mark-skipped { background: rgba(245, 158, 11, 0.22); color: #fbbf24; }
.mark-writing { background: rgba(96, 165, 250, 0.18); color: #93c5fd; }
.mark-unanswered { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }

.answer-log {
  list-style: none;
  display: grid;
  gap: 0.45rem;
  margin: 0.7rem 0 0;
}
.answer-log li {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.band-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 0.6rem; }
.band-table th { text-align: left; color: var(--gold); font-weight: 600; padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.band-table td { padding: 0.4rem 0; color: var(--text-muted); border-bottom: 1px solid var(--border); }

.skill-list { list-style: none; display: grid; gap: 0.45rem; margin: 0.6rem 0 0; }
.skill-list li {
  font-size: 0.88rem;
  padding-left: 1.1rem;
  position: relative;
  color: var(--text-muted);
}
.skill-list li::before { position: absolute; left: 0; }
.skill-list .ok::before { content: "▸"; color: var(--ok); }
.skill-list .gap::before { content: "▸"; color: #f87171; }

.writing-review {
  background: rgba(10, 20, 36, 0.45);
  border: 1px dashed var(--border-gold);
  border-radius: 14px;
  padding: 1.1rem 1.15rem;
  margin-bottom: 1.4rem;
}

.writing-preview {
  white-space: pre-wrap;
  color: #cbd5e1;
  font-size: 0.95rem;
  max-height: 180px;
  overflow: auto;
  margin-top: 0.6rem;
}

.app-footer {
  background: #060d18;
  border-top: 1px solid var(--border);
  padding: 1.6rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-inner { max-width: 1080px; margin: 0 auto; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.app-footer a { color: var(--text-muted); }
.app-footer a:hover { color: var(--gold); }

.hidden { display: none !important; }

@media (max-width: 720px) {
  .card-grid, .centres, .form-grid, .score-grid { grid-template-columns: 1fr; }
  .header-tag { display: none; }
  .logo-pill img { height: 36px; }
  .form-card, .test-card, .results-card { padding: 1.25rem 1rem; }
  .test-nav { flex-direction: column-reverse; }
  .test-nav .btn { width: 100%; }
  .footer-inner { flex-direction: column; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.timer-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.55rem 0.35rem 0.75rem;
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.08);
}

.timer-label {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

.timer-display {
  font-family: var(--font-heading);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-white);
  min-width: 3.4rem;
}

.timer-wrap.warn {
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.12);
}
.timer-wrap.warn .timer-display { color: #fca5a5; }

.btn-timer {
  appearance: none;
  border: 0;
  background: var(--gold-gradient);
  color: #0a1424;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.pause-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 13, 24, 0.78);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.pause-card {
  max-width: 420px;
  background: var(--bg-navy-surface);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 1.6rem 1.5rem;
  text-align: center;
}
.pause-card h2 { margin-bottom: 0.5rem; }
.pause-card p { color: var(--text-muted); margin-bottom: 1.2rem; }

.intro-sections {
  margin: 0 0 1.1rem;
  padding-left: 1.15rem;
  color: #cbd5e1;
}
.intro-sections li { margin-bottom: 0.35rem; }
.intro-time { color: var(--text-muted); font-size: 0.95rem; }

.section-heading {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.7rem;
}

.time-warn {
  margin-bottom: 1rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  font-size: 0.92rem;
}

.reading-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
}
.reading-layout.has-passage {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}

.passage-panel {
  background: rgba(10, 20, 36, 0.55);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 1rem 1.05rem;
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.65;
}
.passage-panel h4 {
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 0.55rem;
}
.passage-panel p { margin-bottom: 0.7rem; }
.passage-panel p:last-child { margin-bottom: 0; }

@media (min-width: 860px) {
  #view-test.wrap { max-width: 1080px; }
  .passage-panel {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 120px);
    overflow: auto;
  }
}

.section-score {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
}
.section-score strong { color: var(--text-white); }

@media (max-width: 859px) {
  .reading-layout.has-passage { grid-template-columns: 1fr; }
  .header-tag { display: none; }
  .timer-label { display: none; }
}

.form-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.course-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.course-set {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 0.95rem 1rem;
  background: rgba(10, 20, 36, 0.35);
}

.course-set legend {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--gold);
  padding: 0 0.35rem;
}

.course-choice { margin-top: 0.5rem; }

.prompt .katex, .option .katex, .passage-panel .katex, .explanation-math .katex {
  color: inherit;
  font-size: 1.05em;
}

.prompt .katex-display {
  margin: 0.65rem 0;
  overflow-x: auto;
}

.option { line-height: 1.45; }

@media (max-width: 720px) {
  .course-grid { grid-template-columns: 1fr; }
}

.why-card h1 { margin-bottom: 0.55rem; }
.why-section { margin: 1.35rem 0 0; padding-top: 1.15rem; border-top: 1px solid var(--border); }
.why-section h2 {
  font-size: 1.18rem;
  color: var(--gold);
  margin-bottom: 0.45rem;
}
.why-section p { color: #cbd5e1; font-size: 1.02rem; }


.booking-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 13, 24, 0.82);
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem;
  overflow-y: auto;
}
.booking-card {
  width: min(560px, 100%);
  margin: 2rem auto;
  background: var(--bg-navy-surface);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 1.45rem 1.35rem 1.5rem;
  box-shadow: var(--shadow-navy);
}
.booking-card h2 {
  margin: 0.35rem 0 0.55rem;
  font-size: 1.45rem;
}
.booking-lede {
  color: #cbd5e1;
  margin-bottom: 1.1rem;
  font-size: 0.98rem;
}
.booking-card .form-grid { margin-top: 0.2rem; }
.booking-overlay.hidden { display: none; }
