/* NurseGulf Prep design system
   Scrub navy + marigold. Atkinson Hyperlegible for reading (built to tell 1/l and mg/mL apart),
   Bricolage Grotesque for numbers and screen titles. */

:root {
  --ink: #10233f;          /* scrub navy: text, hero, primary surfaces */
  --ink-2: #1c3558;
  --paper: #f3f5f8;        /* cool clinical off-white */
  --surface: #ffffff;
  --sunken: #e9edf3;
  --line: #dde3eb;
  --muted: #5a6b80;
  --marigold: #f5a524;     /* the one accent: primary actions, streak, today */
  --marigold-soft: #fdf0d6;
  --on-marigold: #10233f;
  --good: #1f8a5b;
  --good-soft: #e2f3ea;
  --bad: #c8423b;
  --bad-soft: #fbe8e6;
  --on-ink: #ffffff;
  --on-ink-muted: #a9b8cc;

  --font-read: "Atkinson Hyperlegible", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif;

  --r-lg: 24px;   /* hero panels */
  --r-md: 16px;   /* sheets, grouped lists */
  --r-sm: 12px;   /* answer options, buttons */
  --tap: 56px;    /* primary button height */
  --nav-h: 68px;
  --pad: 20px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #0b1626;
    --ink-2: #16243c;
    --paper: #0f1a2b;
    --surface: #17253b;
    --sunken: #1d2d47;
    --line: #2a3b57;
    --muted: #9fb0c6;
    --marigold-soft: #3a2e14;
    --good: #5fd39b;
    --good-soft: #15392b;
    --bad: #ff8f86;
    --bad-soft: #3d1f22;
    --text: #e9eff7;
    --hero: #1f3a63;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 17px/1.5 var(--font-read);
  background: var(--paper);
  color: var(--text, var(--ink));
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; border-radius: 6px; }

/* ---------- Type ---------- */
.title { font: 700 1.75rem/1.15 var(--font-display); letter-spacing: -0.01em; margin: 0; }
.h2 { font: 700 1.2rem/1.25 var(--font-display); margin: 0 0 12px; }
.lead { color: var(--muted); margin: 6px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }

/* ---------- App frame ---------- */
#view { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
.screen { padding: 16px var(--pad) calc(var(--nav-h) + 32px); }
.screen--focus { padding-bottom: 140px; }
.screen-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 0 20px; }
.section { margin-top: 28px; }
.section > .h2 { display: flex; justify-content: space-between; align-items: baseline; }
.section > .h2 a { font: 600 0.9rem var(--font-read); color: var(--muted); text-decoration: none; }

body.focus .nav { display: none; }

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line);
}
.nav__inner { display: flex; width: 100%; max-width: 560px; }
.nav a {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 700;
}
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--text, var(--ink)); }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; top: 8px; width: 56px; height: 32px; border-radius: 16px; background: var(--marigold-soft); z-index: -1;
}
.nav .dot {
  position: absolute; top: 8px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: 0.7rem; line-height: 18px; text-align: center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 0 22px; border-radius: var(--r-sm); border: 0;
  background: var(--marigold); color: var(--on-marigold);
  font-weight: 700; font-size: 1.05rem; text-decoration: none; cursor: pointer;
  transition: transform 0.08s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { background: var(--sunken); color: var(--muted); cursor: not-allowed; transform: none; }
.btn--block { width: 100%; }
.btn--ink { background: var(--ink-2); color: var(--on-ink); }
.btn--line { background: transparent; color: var(--text, var(--ink)); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--text { background: transparent; color: var(--muted); min-height: 44px; padding: 0 8px; }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: 0.9rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: transparent; border: 0; cursor: pointer; color: inherit;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn[aria-pressed="true"] { color: var(--marigold); }

/* ---------- Readiness hero (the signature element) ---------- */
.hero {
  background: var(--hero, var(--ink)); color: var(--on-ink); border-radius: var(--r-lg); padding: 22px 20px 20px;
}
.hero__top { display: flex; justify-content: space-between; align-items: flex-start; }
.hero__score { font: 800 4.25rem/0.9 var(--font-display); letter-spacing: -0.03em; }
.hero__score small { font-size: 1.6rem; font-weight: 700; margin-left: 2px; }
.hero__label { color: var(--on-ink-muted); margin-top: 6px; }
.hero__exam { text-align: right; }
.hero__days { font: 800 1.9rem/1 var(--font-display); }
.hero__note { color: var(--on-ink-muted); font-size: 0.875rem; margin: 16px 0 0; }

.blueprint { display: flex; gap: 4px; margin-top: 22px; }
.blueprint__seg { min-width: 0; }
.blueprint__bar { height: 14px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.blueprint__bar > i { display: block; height: 100%; background: var(--marigold); }
.bp-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; margin-top: 12px; font-size: 0.875rem; }
.bp-legend > div { display: flex; justify-content: space-between; gap: 8px; color: var(--on-ink-muted); }
.bp-legend b { color: var(--on-ink); font-size: 0.95rem; }
.blueprint--light .blueprint__bar { background: var(--sunken); }
.blueprint--light .bp-legend > div { color: var(--muted); }
.blueprint--light .bp-legend b { color: var(--text, var(--ink)); }

/* ---------- Continue card ---------- */
.continue { margin-top: 14px; }
.continue .btn { justify-content: space-between; padding: 0 18px 0 22px; min-height: 64px; }
.continue__sub { display: block; font-weight: 400; font-size: 0.85rem; opacity: 0.8; }

/* ---------- Streak week ---------- */
.week { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.week__day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); }
.week__mark {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sunken); color: var(--muted);
}
.week__mark svg { width: 18px; height: 18px; }
.week__day.is-done .week__mark { background: var(--marigold); color: var(--on-marigold); }
.week__day.is-today .week__mark { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--marigold); }
.goal { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.goal__streak { font: 800 1.5rem/1 var(--font-display); display: flex; align-items: center; gap: 6px; }
.goal__streak svg { width: 22px; height: 22px; color: var(--marigold); }

/* ---------- Grouped list ---------- */
.list { background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.list__row {
  display: flex; align-items: center; gap: 14px; padding: 16px; text-decoration: none; color: inherit;
  border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer;
}
.list__row + .list__row { border-top: 1px solid var(--line); }
.list__icon {
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--sunken); color: var(--text, var(--ink));
}
.list__icon svg { width: 22px; height: 22px; }
.list__icon--accent { background: var(--marigold-soft); color: #a46a06; }
.list__icon--bad { background: var(--bad-soft); color: var(--bad); }
.list__body { flex: 1; min-width: 0; }
.list__title { font-weight: 700; }
.list__sub { color: var(--muted); font-size: 0.875rem; }
.list__end { flex: none; text-align: right; color: var(--muted); font-size: 0.9rem; }
.list__end .num { color: var(--text, var(--ink)); font-size: 1.1rem; font-weight: 700; }
.chev { width: 20px; height: 20px; color: var(--muted); flex: none; }
.meter { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--ink-2); border-radius: inherit; }

.tip { background: var(--marigold-soft); border-radius: var(--r-md); padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.tip svg { flex: none; width: 22px; height: 22px; color: #a46a06; margin-top: 2px; }

/* ---------- Question screen (focus mode) ---------- */
.qbar { position: sticky; top: 0; z-index: 5; background: var(--paper); display: flex; align-items: center; gap: 10px; padding: 10px 0 12px; }
.qbar__progress { flex: 1; display: flex; gap: 4px; }
.qbar__progress i { flex: 1; height: 6px; border-radius: 3px; background: var(--sunken); }
.qbar__progress i.is-done { background: var(--ink-2); }
.qbar__progress i.is-right { background: var(--good); }
.qbar__progress i.is-wrong { background: var(--bad); }
.qbar__count { font: 700 0.95rem var(--font-display); min-width: 44px; text-align: right; }

.q-topic { color: var(--muted); font-size: 0.875rem; margin: 6px 0 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; background: var(--sunken); color: var(--muted); }
.tag--draft { background: var(--marigold-soft); color: #8a5a05; }
.q-stem { font-size: 1.2rem; line-height: 1.5; font-weight: 700; margin: 0 0 20px; }

.options { display: grid; gap: 10px; }
.option {
  display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left;
  padding: 14px 16px; min-height: 60px; border-radius: var(--r-sm);
  background: var(--surface); border: 2px solid var(--line); cursor: pointer; line-height: 1.4;
}
.option__key {
  flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  font: 700 0.95rem var(--font-display); background: var(--sunken); color: var(--muted);
}
.option__text { padding-top: 3px; }
.option[aria-pressed="true"] { border-color: var(--ink-2); }
.option[aria-pressed="true"] .option__key { background: var(--ink-2); color: var(--on-ink); }
.option.is-correct { border-color: var(--good); background: var(--good-soft); }
.option.is-correct .option__key { background: var(--good); color: #fff; }
.option.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.is-wrong .option__key { background: var(--bad); color: #fff; }
.option:disabled { cursor: default; }
.option:disabled:not(.is-correct):not(.is-wrong) { opacity: 0.6; }

/* Sticky action bar at the bottom of question screens */
.actionbar {
  position: fixed; inset: auto 0 0 0; z-index: 8; display: flex; justify-content: center;
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--line);
}
.actionbar__inner { width: 100%; max-width: 520px; display: flex; gap: 10px; align-items: center; }
.actionbar .btn { flex: 1; }

/* Explanation panel: the one animated moment, it answers the user's "Check" */
.explain {
  position: fixed; inset: auto 0 0 0; z-index: 9; display: flex; justify-content: center;
  animation: rise 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.explain__panel {
  width: 100%; max-width: 560px; max-height: 62dvh; overflow-y: auto;
  border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 20px var(--pad) calc(16px + env(safe-area-inset-bottom));
  background: var(--surface); box-shadow: 0 -12px 32px rgba(16, 35, 63, 0.18);
}
.explain__head { display: flex; align-items: center; gap: 10px; font: 800 1.35rem var(--font-display); margin-bottom: 8px; }
.explain__head svg { width: 28px; height: 28px; }
.explain--good .explain__head { color: var(--good); }
.explain--bad .explain__head { color: var(--bad); }
.explain__answer { font-weight: 700; margin: 0 0 8px; }
.explain__text { margin: 0; }
.explain__ref { color: var(--muted); font-size: 0.85rem; margin: 10px 0 0; }
.explain__actions { display: flex; gap: 10px; margin-top: 16px; }
.explain__actions .btn:last-child { flex: 1; }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }

/* Session summary */
.summary { text-align: center; padding-top: 32px; }
.summary__score { font: 800 4.5rem/1 var(--font-display); letter-spacing: -0.03em; }
.summary__score small { font-size: 1.8rem; color: var(--muted); }
.dots { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--sunken); }
.dots i.is-right { background: var(--good); }
.dots i.is-wrong { background: var(--bad); }
.streak-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--marigold-soft); font-weight: 700;
}
.streak-chip svg { width: 18px; height: 18px; color: var(--marigold); }

/* ---------- Mock exam ---------- */
.timer {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--ink); color: var(--on-ink); font: 700 0.95rem var(--font-display); font-variant-numeric: tabular-nums;
}
.timer svg { width: 16px; height: 16px; }
.timer.is-low { background: var(--bad); }
.qgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.qgrid button {
  position: relative; height: 46px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface);
  font: 700 0.9rem var(--font-display); cursor: pointer;
}
.qgrid button.is-answered { background: var(--ink-2); border-color: var(--ink-2); color: var(--on-ink); }
.qgrid button.is-flagged::after {
  content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--marigold);
}
.qgrid button.is-current { outline: 3px solid var(--marigold); outline-offset: 1px; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 0.85rem; margin: 12px 0 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: var(--r-md); overflow: hidden; margin: 16px 0; }
.facts > div { background: var(--surface); padding: 14px 12px; }
.facts b { display: block; font: 800 1.5rem/1.1 var(--font-display); }
.facts span { color: var(--muted); font-size: 0.8rem; }

/* Results: score against the pass line */
.passbar { position: relative; height: 16px; border-radius: 8px; background: rgba(255, 255, 255, 0.14); margin: 26px 0 8px; }
.passbar > i { position: absolute; inset: 0 auto 0 0; border-radius: 8px; background: var(--marigold); }
.passbar__line { position: absolute; top: -8px; bottom: -8px; width: 2px; background: var(--on-ink); }
.passbar__label { position: absolute; top: -28px; transform: translateX(-50%); font-size: 0.75rem; color: var(--on-ink-muted); white-space: nowrap; }
.verdict { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 0.9rem; }
.verdict--pass { background: var(--good); color: #fff; }
.verdict--fail { background: var(--bad); color: #fff; }

.review-card { background: var(--surface); border-radius: var(--r-md); padding: 16px; margin-bottom: 12px; }
.review-card .q-stem { font-size: 1.05rem; }
.review-card .explain__text { margin-top: 12px; }

.seg { display: inline-flex; background: var(--sunken); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 700; font-size: 0.875rem; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text, var(--ink)); }

/* ---------- Onboarding ---------- */
.onboard { padding: 28px var(--pad) 120px; }
.brandmark { display: flex; align-items: center; gap: 10px; font: 800 1.1rem var(--font-display); }
.brandmark img { width: 36px; height: 36px; border-radius: 10px; }
.steps { display: flex; gap: 6px; margin: 24px 0 18px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--sunken); }
.steps i.is-on { background: var(--marigold); }
.exam-card { display: flex; gap: 14px; align-items: center; }
.exam-card__flag {
  flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font: 800 0.95rem var(--font-display); background: var(--sunken);
}
.option[aria-pressed="true"] .exam-card__flag { background: var(--ink-2); color: var(--on-ink); }
.goal-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.goal-pick .option { flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 16px 8px; }
.goal-pick b { font: 800 1.6rem var(--font-display); }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; margin-bottom: 8px; }
input, select {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line);
  background: var(--surface); color: inherit; font: inherit;
}
.card { background: var(--surface); border-radius: var(--r-md); padding: 18px; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 400; width: 40%; padding-right: 12px; }
tr:last-child th, tr:last-child td { border-bottom: 0; }

/* ---------- Sheets, toasts, ad simulator ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(9, 20, 36, 0.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 12px var(--pad) calc(20px + env(safe-area-inset-bottom)); animation: rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 16px; }
.sheet .h2 { margin-bottom: 8px; }
.sheet__actions { display: grid; gap: 10px; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: var(--on-ink); padding: 12px 18px; border-radius: 12px; font-size: 0.95rem; max-width: 90vw;
  box-shadow: 0 8px 24px rgba(16, 35, 63, 0.25);
}
body.focus .toast { bottom: 110px; }

.ad-sim { position: fixed; inset: 0; z-index: 40; background: #05080d; color: #fff; display: grid; place-items: center; }
.ad-sim__box { text-align: center; padding: 24px; }
.ad-sim__tag { opacity: 0.6; font-size: 0.85rem; }
.ad-sim__count { font: 700 1.3rem var(--font-display); margin-bottom: 24px; }
.ad-sim .btn { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px #3a4556; }

.disclaimer { font-size: 0.8rem; color: var(--muted); margin-top: 24px; }
.center { text-align: center; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.screen--revealed { padding-bottom: 64dvh; }
