:root {
  --navy: #0b1f3a;
  --navy-2: #122a4d;
  --navy-3: #1b3c68;
  --navy-soft: #e8eef8;
  --gold: #c9a227;
  --gold-2: #e0bc4a;
  --gold-soft: #f8efd4;
  --cream: #f7f4ee;
  --cream-2: #efe8db;
  --ink: #1c2430;
  --muted: #5c6775;
  --line: #e4dccf;
  --white: #ffffff;
  --success: #157a48;
  --success-soft: #e6f6ee;
  --danger: #b42318;
  --danger-soft: #fdecec;
  --warn: #9a6700;
  --shadow: 0 18px 50px rgba(11, 31, 58, 0.12);
  --shadow-sm: 0 8px 24px rgba(11, 31, 58, 0.08);
  --radius: 18px;
  --max: 1120px;
  --header-h: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
img { max-width: 100%; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 24px;
  background: rgba(11, 31, 58, 0.96);
  color: var(--white);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 162, 39, 0.28);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--gold), #a88412);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-family: Fraunces, Georgia, serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.04em;
}
.brand-name {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}
.brand small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: rgba(255,255,255,0.62);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 8px;
}
.nav a, .nav-link {
  color: rgba(255,255,255,0.82);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}
.nav a:hover, .nav a.active {
  background: rgba(255,255,255,0.1);
  color: var(--white);
}
.nav a.cta {
  background: var(--gold);
  color: var(--navy);
}
.nav a.cta:hover { background: var(--gold-2); }

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(201,162,39,0.22), transparent 55%),
    linear-gradient(180deg, var(--navy) 0%, #16345f 100%);
  color: var(--white);
  padding: 72px 24px 88px;
}
.hero-inner, .wrap {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(201,162,39,0.14);
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero h1 {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.12;
  margin: 18px 0 14px;
  max-width: 16ch;
  font-weight: 650;
}
.hero p.lead {
  max-width: 54ch;
  color: rgba(255,255,255,0.78);
  font-size: 1.08rem;
  margin: 0 0 36px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: -56px;
  padding-bottom: 12px;
  position: relative;
  z-index: 2;
}
.choice-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(11,31,58,0.06);
  display: flex;
  flex-direction: column;
  min-height: 250px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.choice-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(11,31,58,0.16);
}
.choice-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--navy-soft);
  color: var(--navy);
  margin-bottom: 16px;
  font-size: 22px;
}
.choice-card.accent .choice-icon {
  background: var(--gold-soft);
  color: #8a6c0d;
}
.choice-card h2 {
  font-family: Fraunces, Georgia, serif;
  margin: 0 0 8px;
  font-size: 1.6rem;
}
.choice-card p {
  color: var(--muted);
  margin: 0 0 22px;
  flex: 1;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  transition: 0.15s ease;
}
.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover { background: var(--navy-3); }
.btn-gold {
  background: var(--gold);
  color: var(--navy);
}
.btn-gold:hover { background: var(--gold-2); }
.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--cream-2); }
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { filter: brightness(0.95); }
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.section { padding: 56px 0; }
.section h2 {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.8rem;
  margin: 0 0 8px;
}
.section .sub {
  color: var(--muted);
  margin: 0 0 28px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.stat b {
  display: block;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.7rem;
  color: var(--navy);
}
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }

.weight {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}
.weight-row { display: grid; grid-template-columns: 220px 1fr 52px; gap: 12px; align-items: center; }
.weight-row span { font-size: 14px; font-weight: 600; }
.bar {
  height: 10px;
  background: var(--cream-2);
  border-radius: 999px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.bar.mf i { width: 45%; background: var(--navy); }
.bar.ed i { width: 35%; background: #2a6f97; }
.bar.ird i { width: 20%; background: var(--gold); }

.site-footer {
  padding: 36px 0 28px;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  background: var(--navy);
  border-top: 1px solid rgba(201, 162, 39, 0.28);
  margin-top: 24px;
}
.site-footer .wrap {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
  align-items: start;
}
.site-footer h3 {
  font-family: Fraunces, Georgia, serif;
  color: var(--gold-2);
  margin: 0 0 8px;
  font-size: 1.15rem;
}
.site-footer a { color: var(--gold-2); font-weight: 650; }
.site-footer a:hover { color: var(--white); }
.site-footer p, .site-footer li { margin: 0 0 6px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.footer-note {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  font-size: 12px;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.contact-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.contact-card span {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}
.contact-card a, .contact-card strong {
  color: var(--navy);
  font-size: 1.02rem;
}
body:has(#exam:not(.hidden)) .site-footer { display: none; }

.page-head {
  padding: 28px 0 8px;
}
.page-head h1 {
  font-family: Fraunces, Georgia, serif;
  margin: 8px 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 18px 0 20px;
}
.search {
  flex: 1;
  min-width: 220px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 16px;
  outline: none;
}
.search:focus { border-color: var(--navy-3); box-shadow: 0 0 0 4px rgba(27,60,104,0.12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 650;
  font-size: 13px;
  color: var(--navy);
}
.chip.active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.q-list { display: grid; gap: 16px; }
.q-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.q-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: 999px;
}
.badge.mutual_funds { background: var(--navy-soft); color: var(--navy); }
.badge.equity_derivatives { background: #e4f2f8; color: #1b5878; }
.badge.interest_rate_derivatives { background: var(--gold-soft); color: #7a5d0c; }
.q-stem {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0 0 14px;
  white-space: pre-wrap;
}
.options { display: grid; gap: 8px; margin: 0 0 16px; }
.option {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfaf7;
}
.option.correct {
  border-color: #8dcea8;
  background: var(--success-soft);
}
.option.wrong {
  border-color: #f0b4b0;
  background: var(--danger-soft);
}
.option.chosen { outline: 2px solid var(--navy-3); }
.answer-box, .explain-box {
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 8px;
}
.answer-box { background: var(--success-soft); color: #0f5132; font-weight: 650; }
.explain-box { background: #f4f1ea; color: #334155; }
.explain-box strong { color: var(--navy); }

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 22px 0 40px;
  flex-wrap: wrap;
}
.muted { color: var(--muted); }

.exam-shell {
  height: calc(100vh - var(--header-h));
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.exam-top {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  z-index: 2;
}
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  background: var(--navy);
  color: white;
  padding: 8px 14px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.timer.warn { background: var(--danger); }
.exam-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0;
  min-height: 0;
}
.exam-main { padding: 24px; overflow: auto; }
.exam-side {
  background: var(--white);
  border-left: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
}
.palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.pal {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--cream);
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}
.pal.current { outline: 2px solid var(--navy); background: var(--navy-soft); }
.pal.answered { background: #d9efe4; border-color: #9fd4b6; }
.pal.marked { background: var(--gold-soft); border-color: #e0bc4a; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }

.opt-btn {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}
.opt-btn:hover { border-color: var(--navy-3); }
.opt-btn.selected {
  border-color: var(--navy);
  background: var(--navy-soft);
}
.opt-key {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--cream-2);
  display: grid;
  place-items: center;
  font-weight: 800;
  flex: none;
}
.exam-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: var(--white);
  border-top: 1px solid var(--line);
  justify-content: space-between;
  z-index: 2;
}
.exam-actions .group { display: flex; gap: 10px; flex-wrap: wrap; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
  max-width: 760px;
  margin: 40px auto;
}
.panel h1 { font-family: Fraunces, Georgia, serif; margin-top: 0; }
.rules { display: grid; gap: 10px; margin: 18px 0 24px; }
.rules li { margin-left: 18px; }

.result-hero {
  text-align: center;
  padding: 28px 16px 8px;
}
.result-score {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 1;
  margin: 8px 0;
}
.pass { color: var(--success); }
.fail { color: var(--danger); }
.pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.pill.pass { background: var(--success-soft); color: var(--success); }
.pill.fail { background: var(--danger-soft); color: var(--danger); }

.bars { display: grid; gap: 14px; margin: 8px 0 28px; }
.sub-bar-track {
  height: 12px;
  background: var(--cream-2);
  border-radius: 999px;
  overflow: hidden;
}
.sub-bar-track span { display: block; height: 100%; background: var(--navy); }

.hidden { display: none !important; }
.loading, .empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}

.review-nav {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .choice-grid, .stats, .exam-body, .site-footer .wrap, .contact-grid { grid-template-columns: 1fr; }
  .weight-row { grid-template-columns: 1fr; }
  .hero { padding-top: 48px; }
  .nav { display: flex; flex-wrap: wrap; justify-content: flex-end; }
  .nav a { padding: 6px 10px; font-size: 12px; }
  .exam-side { border-left: 0; border-top: 1px solid var(--line); }
  .site-header {
    height: auto;
    min-height: var(--header-h);
    padding: 10px 16px;
    gap: 8px;
    flex-wrap: wrap;
  }
}

@media (max-width: 520px) {
  .choice-card { min-height: 0; }
  .palette { grid-template-columns: repeat(6, 1fr); }
}
