@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap');

/* ------------------------------------------------------------------
   CFA Level I Reviewer.

   The exam is 180 items, three options, 90 seconds each. Two things
   follow from that and drive the whole design:

   1. Candidates read a lot of dense prose against a clock, so the
      question surface is paper — light, serif, generous leading — and
      never a dark panel.
   2. The item map (one cell per question) is a real artifact of the
      CBT interface. It is the signature element here: navigator during
      an attempt, heat map afterwards.

   Palette is ink navy on cool paper with brass for anything holding
   time or attention. Green and carmine are reserved strictly for
   right and wrong, so they never appear as decoration.
   ------------------------------------------------------------------ */
:root {
  --ground: #e7ebef;
  --paper: #fdfdfc;
  --card: #ffffff;
  --ink: #14212b;
  --ink-soft: #43566a;
  --ink-faint: #7d8fa1;
  --rule: #ccd6de;
  --rule-soft: #e0e7ec;

  --brass: #9a6b1f;
  --brass-tint: #f6ecd9;
  --navy: #1d3f63;
  --navy-tint: #e4ecf4;
  --right: #1e6e4b;
  --right-tint: #e2f0e8;
  --wrong: #9e2b32;
  --wrong-tint: #f7e5e5;

  --display: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --read: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --data: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --radius: 4px;
  --rail: 216px;
  --lift: 0 1px 1px rgba(20, 33, 43, .05), 0 6px 18px rgba(20, 33, 43, .07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
p { margin: 0 0 .8em; }
a { color: var(--navy); text-underline-offset: 2px; }

.mono, .num {
  font-family: var(--data);
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-family: var(--display);
  font-size: 10.5px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.hidden { display: none !important; }
.right-ink { color: var(--right); }
.wrong-ink { color: var(--wrong); }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* --- controls ---------------------------------------------------- */
.btn {
  font-family: var(--display);
  font-size: 13.5px;
  font-weight: 600;
  padding: .5em 1em;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover:not(:disabled) { background: #f2f5f8; border-color: #b3c2ce; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #27527f; border-color: #27527f; }

.btn-brass { background: var(--brass); border-color: var(--brass); color: #fff; }
.btn-brass:hover:not(:disabled) { background: #b07d29; border-color: #b07d29; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover:not(:disabled) { background: #dde4ea; color: var(--ink); }

.btn-sm { font-size: 12.5px; padding: .36em .75em; }
.btn-danger { border-color: #d8b3b5; color: var(--wrong); }
.btn-danger:hover:not(:disabled) { background: var(--wrong-tint); border-color: #b9868a; }

.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }

label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: .35em; }

input[type=text], input[type=password], select {
  width: 100%;
  font-family: var(--display);
  font-size: 14px;
  padding: .55em .7em;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
}
input:focus, select:focus { border-color: var(--navy); }

.field { margin-bottom: 1.05em; }

.form-error {
  background: var(--wrong-tint);
  border: 1px solid #ddb4b6;
  border-radius: var(--radius);
  color: #7c2128;
  font-size: 13px;
  padding: .6em .8em;
  margin-bottom: 1em;
}

.form-note {
  background: var(--brass-tint);
  border: 1px solid #e2cfa8;
  border-radius: var(--radius);
  color: #6f4c14;
  font-size: 13px;
  padding: .7em .9em;
}

/* --- sign-in gate ------------------------------------------------ */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, #f2f5f8 0%, transparent 70%),
    var(--ground);
}

.gate-card {
  width: 100%;
  max-width: 372px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 2rem 1.9rem 1.7rem;
  box-shadow: var(--lift);
}

.gate-mark {
  font-family: var(--data);
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--brass);
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.gate-card h1 { font-size: 24px; margin-bottom: .3rem; }
.gate-sub { color: var(--ink-soft); font-size: 13.5px; margin-bottom: 1.5rem; }
.gate-switch { margin-top: 1.15rem; font-size: 13px; color: var(--ink-soft); text-align: center; }
.gate-rules { font-size: 12px; color: var(--ink-faint); margin-top: -.55em; }

/* --- shell ------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  border-right: 1px solid var(--rule);
  background: var(--paper);
  padding: 1.5rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail-mark {
  font-family: var(--data);
  font-size: 10.5px;
  letter-spacing: .2em;
  color: var(--brass);
  font-weight: 600;
  padding: 0 .6rem;
  margin-bottom: 1.6rem;
  line-height: 1.5;
}
.rail-mark b { display: block; color: var(--ink); font-weight: 600; letter-spacing: .16em; }

.rail nav { display: flex; flex-direction: column; gap: 1px; }
.rail-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5em;
  font-family: var(--display);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  padding: .5em .6rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.rail-link:hover { background: #eaeff3; color: var(--ink); }
.rail-link.active { background: var(--navy-tint); color: var(--navy); font-weight: 600; }

.rail-badge {
  font-family: var(--data);
  font-size: 10.5px;
  background: var(--brass);
  color: #fff;
  border-radius: 8px;
  padding: 0 .45em;
}

.rail-foot { margin-top: auto; padding: 0 .6rem; }
.rail-user { font-size: 13px; margin-bottom: .5em; }
.rail-user strong { display: block; font-weight: 600; }

.main { flex: 1; min-width: 0; padding: 2rem 2.2rem 5rem; max-width: 1120px; }

.page-head { margin-bottom: 1.6rem; }
.page-head h2 { font-size: 22px; margin-bottom: .15em; }
.page-head p { color: var(--ink-soft); font-size: 14px; margin: 0; }
.head-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1em; flex-wrap: wrap;
}

/* --- panels ------------------------------------------------------ */
.panel {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  margin-bottom: 1.4rem;
  overflow: hidden;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1em; padding: .85rem 1.15rem; border-bottom: 1px solid var(--rule-soft);
}
.panel-head h3 { font-size: 14.5px; }
.panel-body { padding: 1.15rem; }

.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1.4rem;
}
.readout-cell { background: var(--card); padding: .95rem 1.1rem; }
.readout-cell .eyebrow { display: block; margin-bottom: .4em; }
.readout-value {
  font-family: var(--data);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.readout-value small { font-size: 13px; color: var(--ink-faint); }
.readout-note { font-size: 11.5px; color: var(--ink-faint); margin-top: .3em; }

/* --- rows -------------------------------------------------------- */
.row-item {
  display: flex; align-items: center; gap: .9em;
  padding: .7em 1.15rem; border-bottom: 1px solid var(--rule-soft);
}
.row-item:last-child { border-bottom: none; }
.row-item .grow { flex: 1; min-width: 0; }
.row-title { font-size: 14px; font-weight: 500; }
.row-sub { font-size: 12px; color: var(--ink-faint); }

.meter { height: 5px; border-radius: 3px; background: #e4eaef; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 3px; }

.tag {
  font-family: var(--data);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .1em .45em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.tag.easy { color: #2c6c4c; border-color: #b2d3c1; }
.tag.moderate { color: #8a5f1c; border-color: #ddc79c; }
.tag.hard { color: #93343a; border-color: #ddb0b3; }

/* --- marks at risk: the analysis signature ----------------------- */
/* Bar width encodes the subject's official exam weight; the filled part
   is what the candidate currently gets right. The empty tail is
   therefore, literally, the marks on the table. */
.risk-row {
  display: grid;
  grid-template-columns: 190px 1fr 62px;
  align-items: center;
  gap: .9em;
  padding: .55em 1.15rem;
}
.risk-label { font-size: 13px; font-weight: 500; }
.risk-label small { display: block; font-size: 11px; color: var(--ink-faint); font-weight: 400; }
.risk-track { height: 22px; display: flex; align-items: stretch; }
.risk-bar {
  position: relative;
  background: var(--wrong-tint);
  border: 1px solid #e2c4c6;
  border-radius: 2px;
  overflow: hidden;
}
.risk-bar i { display: block; height: 100%; background: var(--right); opacity: .82; }
.risk-bar.untried {
  background: repeating-linear-gradient(
    45deg, #eef2f5, #eef2f5 4px, #e3e9ee 4px, #e3e9ee 8px);
  border-color: var(--rule);
}
.risk-value { font-family: var(--data); font-size: 13px; text-align: right; }

/* --- item map: the exam signature -------------------------------- */
.map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(26px, 1fr));
  gap: 3px;
}
.map.compact { grid-template-columns: repeat(auto-fill, minmax(20px, 1fr)); gap: 2px; }

.cell {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--card);
  color: var(--ink-faint);
  font-family: var(--data);
  font-size: 10px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.cell:hover { border-color: var(--navy); }
.cell.answered { background: var(--navy); border-color: var(--navy); color: #fff; }
.cell.correct { background: var(--right); border-color: var(--right); color: #fff; }
.cell.wrong { background: var(--wrong); border-color: var(--wrong); color: #fff; }
.cell.current { outline: 2px solid var(--brass); outline-offset: 1px; z-index: 1; }
.cell.flagged::after {
  content: '';
  position: absolute; top: 1px; right: 1px;
  border-top: 5px solid var(--brass);
  border-left: 5px solid transparent;
}

.map-key {
  display: flex; flex-wrap: wrap; gap: .9em;
  font-size: 11.5px; color: var(--ink-faint); margin-top: .8rem;
}
.map-key span { display: inline-flex; align-items: center; gap: .35em; }
.swatch { width: 11px; height: 11px; border-radius: 2px; border: 1px solid var(--rule); display: inline-block; }

/* --- exam surface ------------------------------------------------ */
.exam-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1.1em;
  flex-wrap: wrap;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: .6rem .9rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--lift);
}
.exam-bar .grow { flex: 1; min-width: 90px; }

.clock {
  font-family: var(--data);
  font-size: 21px;
  font-weight: 500;
  padding: .05em .45em;
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: var(--card);
}
.clock.warn { color: var(--brass); border-color: #e0c795; background: var(--brass-tint); }
.clock.urgent { color: var(--wrong); border-color: #ddb4b6; background: var(--wrong-tint); }
.clock-label {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600;
}

.progress-track { height: 4px; background: #dde4ea; border-radius: 2px; overflow: hidden; }
.progress-track span { display: block; height: 100%; background: var(--navy); }

.qcard {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.6rem 1.8rem 1.5rem;
  box-shadow: var(--lift);
}

.qmeta {
  display: flex; align-items: baseline; gap: .8em; flex-wrap: wrap;
  padding-bottom: .8rem; margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--rule-soft);
}
.qnum { font-family: var(--data); font-size: 12px; font-weight: 600; color: var(--brass); letter-spacing: .06em; }
.qwhere { font-size: 12px; color: var(--ink-faint); }

.stem {
  font-family: var(--read);
  font-size: 17.5px;
  line-height: 1.62;
  margin-bottom: 1.3rem;
  white-space: pre-wrap;
}

.options { display: flex; flex-direction: column; gap: .55rem; }

.option {
  display: flex;
  align-items: flex-start;
  gap: .85em;
  width: 100%;
  text-align: left;
  font-family: var(--read);
  font-size: 16px;
  line-height: 1.5;
  padding: .8em 1em;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.option:hover:not(:disabled) { border-color: var(--navy); background: #f7fafc; }
.option:disabled { cursor: default; }

.option-letter {
  flex: 0 0 auto;
  font-family: var(--data);
  font-size: 12.5px;
  font-weight: 600;
  width: 1.55em; height: 1.55em;
  display: grid; place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-soft);
  margin-top: .12em;
}

.option.picked { border-color: var(--navy); background: var(--navy-tint); }
.option.picked .option-letter { background: var(--navy); border-color: var(--navy); color: #fff; }

.option.is-right { border-color: var(--right); background: var(--right-tint); }
.option.is-right .option-letter { background: var(--right); border-color: var(--right); color: #fff; }
.option.is-wrong { border-color: var(--wrong); background: var(--wrong-tint); }
.option.is-wrong .option-letter { background: var(--wrong); border-color: var(--wrong); color: #fff; }

.verdict {
  margin-top: 1.2rem;
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--card);
  padding: .9rem 1.1rem;
}
.verdict.good { border-left-color: var(--right); }
.verdict.bad { border-left-color: var(--wrong); }
.verdict-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1em; flex-wrap: wrap; margin-bottom: .5em;
}
.verdict-title { font-size: 14px; font-weight: 600; }
.verdict-body { font-family: var(--read); font-size: 15px; line-height: 1.6; }
.page-ref {
  font-family: var(--data); font-size: 11.5px; color: var(--brass);
  border: 1px solid #e2cfa8; background: var(--brass-tint);
  border-radius: 3px; padding: .1em .45em; white-space: nowrap;
}

.qfoot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1em; flex-wrap: wrap; margin-top: 1.3rem;
  padding-top: 1rem; border-top: 1px solid var(--rule-soft);
}
.shortcut-hint { font-size: 11.5px; color: var(--ink-faint); }
.shortcut-hint kbd {
  font-family: var(--data); font-size: 10.5px;
  border: 1px solid var(--rule); border-bottom-width: 2px;
  border-radius: 3px; padding: 0 .3em; background: var(--card);
}

/* --- review ------------------------------------------------------ */
.review-item {
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: 6px;
  background: var(--card);
  padding: 1.1rem 1.3rem;
  margin-bottom: .9rem;
}
.review-item.good { border-left-color: var(--right); }
.review-item.bad { border-left-color: var(--wrong); }
.review-item.blank { border-left-color: var(--ink-faint); }
.review-item .stem { font-size: 16px; margin-bottom: 1rem; }
.review-item .option { font-size: 15px; padding: .6em .85em; cursor: default; }

.note {
  margin-top: .9rem;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: .85rem 1.05rem;
  font-family: var(--read);
  font-size: 14.5px;
  line-height: 1.6;
}
.note h4 { font-family: var(--display); font-size: 13px; margin: 1em 0 .4em; }
.note h4:first-child { margin-top: 0; }
.note ul, .note ol { margin: .4em 0; padding-left: 1.2em; }
.note li { margin-bottom: .25em; }
.note code {
  font-family: var(--data); font-size: 13px;
  background: #eef2f5; border-radius: 3px; padding: .05em .3em;
}
.note-meta { font-size: 11px; color: var(--ink-faint); margin-top: .6em; }

/* --- weak spots -------------------------------------------------- */
.weak-card {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--card);
  padding: 1.05rem 1.2rem;
  margin-bottom: .9rem;
}
.weak-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1em; flex-wrap: wrap; margin-bottom: .6em;
}
.weak-title { font-size: 15px; font-weight: 600; }
.weak-where { font-size: 12px; color: var(--ink-faint); }
.chip-row { display: flex; flex-wrap: wrap; gap: .4em; margin-top: .6em; }
.chip {
  font-size: 11.5px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: .12em .6em;
  color: var(--ink-soft);
  background: var(--paper);
}
.chip b { font-family: var(--data); color: var(--wrong); font-weight: 500; }

.provisional {
  font-family: var(--data); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brass);
}

/* --- tables ------------------------------------------------------ */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 600;
  padding: .6em 1.15rem; border-bottom: 1px solid var(--rule);
}
td { padding: .6em 1.15rem; border-bottom: 1px solid var(--rule-soft); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-family: var(--data); }

/* --- setup choices ----------------------------------------------- */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: .7rem;
}
.choice {
  text-align: left;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--card);
  padding: .85rem 1rem;
  cursor: pointer;
  font-family: var(--display);
  color: var(--ink);
}
.choice:hover { border-color: var(--navy); background: #f7fafc; }
.choice.picked { border-color: var(--navy); background: var(--navy-tint); }
.choice.disabled { opacity: .5; cursor: not-allowed; }
.choice-name { font-size: 14px; font-weight: 600; display: block; }
.choice-meta { font-size: 11.5px; color: var(--ink-faint); font-family: var(--data); }
.choice-body { font-size: 12.5px; color: var(--ink-soft); margin-top: .4em; }

.size-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.size-btn {
  font-family: var(--data); font-size: 14px; font-weight: 500;
  padding: .5em 1.1em; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--card); color: var(--ink);
  cursor: pointer;
}
.size-btn.picked { border-color: var(--navy); background: var(--navy); color: #fff; }

/* --- toasts and dialogs ------------------------------------------ */
#toasts {
  position: fixed; bottom: 1.1rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: .5rem; z-index: 60;
  align-items: center; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  font-size: 13px; padding: .55em 1em; border-radius: 20px;
  box-shadow: var(--lift); max-width: 90vw;
}
.toast.bad { background: var(--wrong); }

.empty { text-align: center; padding: 2.4rem 1rem; color: var(--ink-soft); }
.empty h3 { font-size: 16px; margin-bottom: .35em; }

.dialog-scrim {
  position: fixed; inset: 0; background: rgba(20, 33, 43, .38);
  display: grid; place-items: center; z-index: 50; padding: 1rem;
}
.dialog {
  background: var(--card); border-radius: 6px; border: 1px solid var(--rule);
  padding: 1.4rem 1.5rem; max-width: 430px; width: 100%;
  box-shadow: 0 12px 40px rgba(20, 33, 43, .22);
}
.dialog h3 { font-size: 16px; margin-bottom: .5em; }
.dialog p { font-size: 13.5px; color: var(--ink-soft); }

/* --- responsive -------------------------------------------------- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail {
    width: 100%; flex: none; height: auto; position: static;
    border-right: 0; border-bottom: 1px solid var(--rule);
    padding: .9rem 1rem;
  }
  .rail-mark { margin-bottom: .8rem; }
  .rail nav { flex-direction: row; flex-wrap: wrap; }
  .rail-foot {
    margin-top: .8rem; padding: 0; display: flex;
    justify-content: space-between; align-items: center;
  }
  .rail-user { margin-bottom: 0; }
  .main { padding: 1.3rem 1.1rem 4rem; }
  .qcard { padding: 1.2rem 1.1rem; }
  .stem { font-size: 16.5px; }
  .risk-row { grid-template-columns: 1fr; gap: .25em; }
  .risk-value { text-align: left; }
}
