/* ==========================================================================
   MCAT Prep Tool — Medpath Ecosystem design system
   Ported from the Medpath Academy site: navy + gold on warm cream, Playfair
   Display headings, DM Sans body, pill buttons, soft-shadowed white cards
   with a gold top-accent reveal. Exam-mode "moments" (section intro, break)
   use the same navy gradient blocks Medpath uses for its hero/CTA sections,
   so timed simulation reads as a distinct mode within the same brand system.
   ========================================================================== */
:root{
  --primary:#4a7fc1; --primary-dark:#3a6cb5;
  --navy:#0f1929; --navy-mid:#162236;
  --gold:#c9a84c; --gold-light:#e8c96a; --gold-deep:#b8922a;
  --accent2:#c84b2f;
  --bg:#f5f2ed; --card:#ffffff; --text:#0c0f14; --muted:#7a7570; --border:#ddd9d0;
  --success:#1f7a4b; --warning:#b8872a;
  --gold-dim: rgba(201,168,76,.12); --gold-border: rgba(201,168,76,.3);
  --incorrect-dim: rgba(200,75,47,.10); --success-dim: rgba(31,122,75,.10);

  --font-display:'Playfair Display', Georgia, serif;
  --font-body:'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(12,15,20,.08), 0 1px 4px rgba(12,15,20,.04);
  --shadow-lg: 0 12px 48px rgba(12,15,20,.15);
}

*{ box-sizing:border-box; }
/* Guard against author `display` rules (e.g. `.modal-overlay{display:flex}`)
   silently overriding the HTML `hidden` attribute — without this, an element
   that is both `.modal-overlay` and `hidden` would stay visible. */
[hidden]{ display:none !important; }
html{ scroll-behavior:smooth; }
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:var(--font-body); font-size:16px; line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3{ font-family:var(--font-display); font-weight:700; color:var(--navy); margin:0 0 .4em; line-height:1.2; }
h1{ font-size:clamp(2.1rem, 4vw, 3.2rem); line-height:1.14; }
h2{ font-size:clamp(1.6rem, 3vw, 2.2rem); }
h3{ font-size:1.25rem; color:var(--navy); }
h1 em, h2 em{ color:var(--gold-deep); font-style:italic; }
p{ margin:0 0 1em; color:var(--muted); }
a{ color:var(--gold-deep); }
ul{ color:var(--muted); }
::selection{ background:var(--gold); color:var(--navy); }
button{ font-family:var(--font-body); cursor:pointer; }
:focus-visible{ outline:2px solid var(--gold-deep); outline-offset:2px; }
code{ background:rgba(12,15,20,.06); padding:1px 6px; border-radius:4px; font-size:.9em; }

.eyebrow{
  font-size:.72rem; font-weight:700; letter-spacing:.18em; text-transform:uppercase;
  color:var(--gold-deep); margin:0 0 .6em; display:flex; align-items:center; gap:.5em;
}
.eyebrow::before{ content:''; display:inline-block; width:24px; height:1.5px; background:var(--gold-deep); }

/* ---------------- layout shells ---------------- */
.site-header{
  position:sticky; top:0; z-index:40; background:rgba(15,25,41,.96);
  backdrop-filter:blur(16px); border-bottom:1px solid rgba(201,168,76,.15);
}
.header-inner{
  max-width:1100px; margin:0 auto; padding:0 24px; min-height:62px;
  display:flex; align-items:center; gap:24px;
}
.brand{ display:flex; align-items:center; gap:10px; text-decoration:none; }
.brand-mark{
  font-family:var(--font-display); font-weight:700; font-size:1.15rem; color:#fff;
  border:1.5px solid var(--gold); border-radius:8px; width:34px; height:34px;
  display:flex; align-items:center; justify-content:center; font-size:.66rem; color:var(--gold); flex-shrink:0;
}
.brand-sub{ font-family:var(--font-display); font-style:italic; font-size:1.05rem; color:#fff; font-weight:600; }
.brand-sub::before{ content:'MedPath '; font-style:normal; font-weight:700; color:#fff; }
.main-nav{ display:flex; gap:2px; flex:1; }
.nav-link{
  background:none; border:none; color:rgba(255,255,255,.65); font-size:.82rem; font-weight:500;
  padding:8px 14px; border-radius:50px; transition:color .15s, background .15s; font-family:var(--font-body);
  text-decoration:none; display:inline-block; cursor:pointer;
}
.nav-link:hover{ color:#fff; background:rgba(255,255,255,.08); }
.bank-status{ font-size:.7rem; color:rgba(255,255,255,.45); white-space:nowrap; }

#app{ max-width:1100px; margin:0 auto; padding:36px 24px 80px; min-height:60vh; }
.view{ display:none; }
.view.active{ display:block; animation:fadein .25s ease; }
@keyframes fadein{ from{opacity:0; transform:translateY(4px);} to{opacity:1; transform:none;} }

.site-footer{
  background:var(--navy); border-top:3px solid transparent;
  border-image:linear-gradient(90deg,transparent,var(--gold),transparent) 1;
  padding:22px 24px; margin-top:56px;
  display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap;
  font-size:.8rem; color:rgba(255,255,255,.55);
}
.site-footer .nav-link{ padding:4px 10px; color:rgba(255,255,255,.55); }
.site-footer .nav-link:hover{ color:#fff; }

/* ---------------- hero ---------------- */
.hero{ padding:20px 0 40px; border-bottom:1px solid var(--border); margin-bottom:36px; }
.hero-sub{ max-width:640px; font-size:1.05rem; }
.hero-actions{ display:flex; gap:14px; margin-top:22px; flex-wrap:wrap; }

/* ---------------- buttons (pill, Medpath-style) ---------------- */
.btn{
  font-family:var(--font-body); font-weight:600; font-size:.9rem; border-radius:50px;
  padding:.75rem 1.6rem; border:1.5px solid transparent; transition:all .2s ease; white-space:nowrap;
  display:inline-flex; align-items:center; gap:.5em;
}
.btn-primary{ background:linear-gradient(135deg,var(--gold-deep),var(--gold)); color:var(--navy); box-shadow:0 4px 18px rgba(201,168,76,.3); }
.btn-primary:hover{ transform:translateY(-1px); box-shadow:0 7px 24px rgba(201,168,76,.45); }
.btn-primary:disabled{ background:var(--border); color:var(--muted); box-shadow:none; cursor:not-allowed; transform:none; }
.btn-ghost{ background:transparent; color:var(--navy); border-color:var(--border); }
.btn-ghost:hover{ border-color:var(--gold); color:var(--gold-deep); background:var(--gold-dim); }
.btn-text{ background:none; border:none; color:var(--muted); font-size:.85rem; padding:6px 10px; border-radius:50px; }
.btn-text:hover{ color:var(--gold-deep); }
.btn-small{ padding:.4rem 1rem; font-size:.78rem; background:transparent; border:1.5px solid var(--border); color:var(--navy); }
.btn-small:hover{ border-color:var(--gold); color:var(--gold-deep); }
.btn-large{ padding:1rem 2.2rem; font-size:1rem; }

/* ---------------- cards / dashboard ---------------- */
.card{
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:22px; box-shadow:var(--shadow); position:relative; overflow:hidden;
}
.card-label{ font-size:.7rem; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:var(--gold-deep); margin:0 0 10px; }
.dash-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:18px; margin-bottom:24px; }
.stat-big{ font-family:var(--font-display); font-size:2.4rem; font-weight:700; color:var(--navy); margin:0; }
.stat-caption{ font-size:.85rem; color:var(--muted); margin:2px 0 12px; }
.stat-line{ font-size:.85rem; color:var(--gold-deep); font-weight:600; margin:0; }
.section-bar{ display:flex; height:8px; border-radius:4px; overflow:hidden; margin-top:6px; background:var(--bg); }
.section-bar span{ height:100%; }
.weak-areas{ margin-top:6px; }
.weak-item{ display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid var(--border); font-size:.9rem; }
.weak-item:last-child{ border-bottom:none; }
.weak-item .pct{ color:var(--accent2); font-weight:700; }

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

/* ---------------- setup screens (learn + test) ---------------- */
.view-sub{ max-width:640px; margin-bottom:26px; font-size:1rem; }
.setup-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:20px; }
@media (max-width:760px){ .setup-grid{ grid-template-columns:1fr; } }
.chip-row{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{
  background:var(--card); border:1.5px solid var(--border); color:var(--muted);
  border-radius:50px; padding:8px 16px; font-size:.85rem; font-weight:500; transition:all .15s;
}
.chip:hover{ border-color:var(--gold); color:var(--navy); }
.chip.active{ background:linear-gradient(135deg,var(--gold-deep),var(--gold)); border-color:var(--gold); color:var(--navy); font-weight:700; }
.matched-count{ display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:14px; font-size:.95rem; color:var(--navy); font-weight:600; }

/* Section chips (multi-select toggle): make on/off state unambiguous at a
   glance — filled gold + checkmark = included, dimmed/outlined + empty
   circle = excluded. Don't rely on a subtle border-color difference alone. */
.section-chip{ display:inline-flex; align-items:center; gap:8px; }
.section-chip .chip-indicator{
  display:inline-flex; align-items:center; justify-content:center;
  width:16px; height:16px; border-radius:50%; font-size:.7rem; line-height:1;
  border:1.5px solid currentColor; flex-shrink:0;
}
.section-chip.active .chip-indicator{ border-color:var(--navy); }
.section-chip.is-off{ opacity:.55; border-style:dashed; }
.section-chip.is-off .chip-text{ text-decoration:line-through; text-decoration-color:var(--muted); }
.chip-summary{ margin:10px 2px 0; font-size:.82rem; color:var(--muted); font-weight:600; }

.mode-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:16px; }
@media (max-width:900px){ .mode-grid{ grid-template-columns:1fr; } }
.mode-card{
  text-align:left; background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:24px; color:var(--text); transition:all .22s ease; display:flex; flex-direction:column; gap:6px;
  box-shadow:var(--shadow); position:relative; overflow:hidden;
}
.mode-card::before{
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background:linear-gradient(90deg,transparent,var(--gold),transparent); opacity:0; transition:opacity .3s;
}
.mode-card:hover{ transform:translateY(-4px); box-shadow:var(--shadow-lg); }
.mode-card:hover::before{ opacity:1; }
.mode-eyebrow{ font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.14em; color:var(--gold-deep); }
.mode-card p{ font-size:.9rem; margin-bottom:0; color:var(--muted); }
.mode-meta{ font-size:.75rem; color:var(--muted); margin-top:10px; font-weight:600; }
.single-section-panel{ margin-top:8px; display:flex; flex-direction:column; gap:16px; align-items:flex-start; }
.fine-print{ font-size:.8rem; color:var(--muted); max-width:680px; margin-top:20px; }

/* ---------------- question shell (shared by learn + exam) ---------------- */
.question-shell{ display:flex; flex-direction:column; gap:22px; }
.passage-panel{
  background:var(--card); border:1px solid var(--border); border-left:4px solid var(--gold);
  border-radius:var(--radius); padding:24px; max-height:340px; overflow-y:auto; box-shadow:var(--shadow);
}
.passage-panel h4{ font-family:var(--font-display); color:var(--navy); font-size:1.15rem; margin:0 0 10px; }
.passage-panel .passage-text{ white-space:pre-line; font-size:.98rem; color:var(--text); }
.passage-panel .data-table{ width:100%; border-collapse:collapse; margin:14px 0; font-size:.85rem; }
.passage-panel .data-table th, .passage-panel .data-table td{ border:1px solid var(--border); padding:7px 10px; text-align:left; }
.passage-panel .data-table th{ color:var(--navy); background:var(--bg); font-weight:700; }

.stem-card{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow); }
.stem-meta{ font-size:.72rem; color:var(--gold-deep); font-weight:700; text-transform:uppercase; letter-spacing:.1em; margin-bottom:10px; }
.stem-text{ font-size:1.08rem; color:var(--text); margin:0; }

/* scantron-style choice bubbles: the signature element, in Medpath tones */
.choices{ display:flex; flex-direction:column; gap:10px; }
.choice-row{
  display:flex; align-items:center; gap:14px; background:var(--card); border:1.5px solid var(--border);
  border-radius:var(--radius-sm); padding:14px 18px; text-align:left; color:var(--text); width:100%;
  transition:all .15s ease; box-shadow:0 1px 4px rgba(12,15,20,.03);
}
.choice-row:hover:not(.locked){ border-color:var(--gold); background:var(--gold-dim); }
.choice-bubble{
  flex:0 0 auto; width:30px; height:30px; border-radius:50%; border:2px solid var(--border);
  display:flex; align-items:center; justify-content:center; font-size:.85rem; font-weight:700;
  color:var(--muted); transition:all .15s ease;
}
.choice-row.selected .choice-bubble{ border-color:var(--gold); background:var(--gold); color:var(--navy); }
.choice-row.correct-reveal{ border-color:var(--success); background:var(--success-dim); }
.choice-row.correct-reveal .choice-bubble{ border-color:var(--success); background:var(--success); color:#fff; }
.choice-row.incorrect-reveal{ border-color:var(--accent2); background:var(--incorrect-dim); }
.choice-row.incorrect-reveal .choice-bubble{ border-color:var(--accent2); background:var(--accent2); color:#fff; }
.choice-label{ font-size:.98rem; }

.feedback-panel{ border-radius:var(--radius-sm); padding:18px 22px; border:1.5px solid var(--border); background:var(--card); }
.feedback-panel.is-correct{ border-color:var(--success); background:var(--success-dim); }
.feedback-panel.is-incorrect{ border-color:var(--accent2); background:var(--incorrect-dim); }
.feedback-title{ font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.1em; margin-bottom:8px; }
.feedback-panel.is-correct .feedback-title{ color:var(--success); }
.feedback-panel.is-incorrect .feedback-title{ color:var(--accent2); }
.feedback-text{ color:var(--text); font-size:.95rem; margin:0; }

.session-topbar, .exam-topbar{
  display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; flex-wrap:wrap; gap:10px;
}
.session-bottombar, .exam-bottombar{
  display:flex; justify-content:space-between; gap:12px; margin-top:24px; flex-wrap:wrap;
}
.bookmark-btn.is-bookmarked{ color:var(--gold-deep); font-weight:700; }

/* ---------------- exam-specific chrome: navy "test mode" moments ---------------- */
.exam-topbar{
  background:linear-gradient(135deg,var(--navy),var(--navy-mid)); border:1px solid rgba(201,168,76,.2);
  border-radius:var(--radius); padding:16px 22px; box-shadow:var(--shadow);
}
.exam-topbar-left{ display:flex; flex-direction:column; }
.exam-section-name{ font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.14em; color:var(--gold); }
.exam-q-counter{ font-size:.95rem; color:#fff; }
.exam-timer{
  font-family:var(--font-display); font-size:1.5rem; font-weight:700; color:var(--gold); letter-spacing:.03em;
  border:1.5px solid rgba(201,168,76,.35); border-radius:50px; padding:6px 22px; background:rgba(255,255,255,.05);
}
.exam-timer.time-low{ color:#ff9a86; border-color:#ff9a86; animation:pulse 1s infinite; }
@keyframes pulse{ 50%{ opacity:.55; } }
.exam-topbar-right{ display:flex; gap:4px; }
.exam-topbar-right .btn-text{ color:rgba(255,255,255,.6); }
.exam-topbar-right .btn-text:hover{ color:var(--gold-light); }
.exam-bottombar .btn-primary{ margin-left:auto; }

.exam-intro-shell{
  max-width:640px; margin:20px auto 0; text-align:center; color:#fff;
  background:linear-gradient(135deg,var(--navy) 0%,#0d1f38 60%,#1a2a44 100%);
  border-radius:var(--radius); padding:48px 40px; position:relative; overflow:hidden; box-shadow:var(--shadow-lg);
}
.exam-intro-shell::before{
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background:linear-gradient(90deg,transparent,var(--gold),transparent);
}
.exam-intro-shell h2{ color:#fff; }
.exam-intro-shell .eyebrow{ color:var(--gold); justify-content:center; }
.exam-intro-shell .eyebrow::before{ background:var(--gold); }
.exam-intro-details{
  text-align:left; margin:26px 0; background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.12);
  border-radius:var(--radius-sm); padding:20px 22px;
}
.exam-intro-details p{ margin-bottom:8px; font-size:.95rem; color:rgba(255,255,255,.75); }
.exam-intro-details strong{ color:#fff; }

.break-shell{
  max-width:520px; margin:20px auto 0; text-align:center; color:#fff;
  background:linear-gradient(135deg,var(--navy) 0%,#0d1f38 100%);
  border-radius:var(--radius); padding:56px 40px; box-shadow:var(--shadow-lg); position:relative; overflow:hidden;
}
.break-shell::before{
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background:linear-gradient(90deg,transparent,var(--gold),transparent);
}
.break-shell .eyebrow{ color:var(--gold); justify-content:center; }
.break-shell .eyebrow::before{ background:var(--gold); }
.break-shell h2{ color:#fff; }
.break-shell p{ color:rgba(255,255,255,.7); }
.break-timer{
  font-family:var(--font-display); font-size:3rem; font-weight:700; color:var(--gold); margin:26px 0; letter-spacing:.04em;
}

/* modal overlays (disclaimer + review grid): white card on dimmed navy scrim */
.modal-overlay{
  position:fixed; inset:0; background:rgba(15,20,28,.72); z-index:100;
  display:flex; align-items:center; justify-content:center; padding:20px;
}
.modal-panel{
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius); max-width:480px; width:100%;
  padding:32px; box-shadow:var(--shadow-lg); max-height:88vh; overflow-y:auto; position:relative;
}
.modal-panel::before{
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background:linear-gradient(90deg,transparent,var(--gold),transparent); border-radius:var(--radius) var(--radius) 0 0;
}
.modal-panel h2{ color:var(--navy); }
.modal-body p{ font-size:.88rem; color:var(--muted); }
.ack-row{ display:flex; align-items:flex-start; gap:10px; font-size:.85rem; color:var(--text); margin:16px 0; }
.ack-row input{ margin-top:3px; }
.modal-legal-link{ display:block; text-align:center; font-size:.78rem; margin-top:14px; color:var(--muted); }
#ackButton{ width:100%; justify-content:center; }

.review-grid-panel{ max-width:560px; }
.review-grid-panel h3{ color:var(--navy); }
.review-grid-legend{ font-size:.78rem; display:flex; gap:16px; align-items:center; color:var(--muted); }
.legend-dot{ display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:4px; }
.legend-answered{ background:var(--success); }
.legend-flagged{ background:var(--gold); }
.legend-unseen{ background:var(--bg); border:1px solid var(--border); }
.review-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(44px,1fr)); gap:8px; margin:18px 0; }
.review-cell{
  aspect-ratio:1; border-radius:8px; border:1.5px solid var(--border); background:var(--bg);
  color:var(--muted); font-size:.78rem; font-weight:600; display:flex; align-items:center; justify-content:center;
}
.review-cell.answered{ background:var(--success-dim); border-color:var(--success); color:var(--navy); }
.review-cell.flagged{ box-shadow:0 0 0 2px var(--gold) inset; }
.review-cell.current{ border-color:var(--gold-deep); border-width:2px; }
.review-grid-actions{ display:flex; justify-content:space-between; gap:12px; margin-top:6px; }

/* ---------------- results ---------------- */
.results-summary{
  text-align:center; padding:36px; margin-bottom:18px;
  background:linear-gradient(135deg,var(--navy),var(--navy-mid)); color:#fff; border-radius:var(--radius);
  box-shadow:var(--shadow-lg); position:relative; overflow:hidden;
}
.results-summary::before{
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background:linear-gradient(90deg,transparent,var(--gold),transparent);
}
.results-summary .card-label{ color:var(--gold); }
.results-summary .score-big{ font-family:var(--font-display); font-size:3.4rem; font-weight:700; color:#fff; margin:0; }
.results-summary p{ color:rgba(255,255,255,.75); }
#resultsBreakdownCard, #resultsDifficultyCard{ margin-bottom:18px; }
.breakdown-row{ display:flex; align-items:center; gap:14px; padding:10px 0; border-bottom:1px solid var(--border); }
.breakdown-row:last-child{ border-bottom:none; }
.breakdown-label{ width:220px; font-size:.88rem; flex:0 0 auto; color:var(--text); }
.breakdown-track{ flex:1; height:10px; background:var(--bg); border-radius:5px; overflow:hidden; }
.breakdown-fill{ height:100%; background:linear-gradient(90deg,var(--gold-deep),var(--gold)); }
.breakdown-pct{ font-size:.82rem; width:64px; text-align:right; color:var(--muted); font-weight:600; }
.results-actions{ display:flex; gap:14px; margin:20px 0; flex-wrap:wrap; }
.review-list{ display:flex; flex-direction:column; gap:16px; }
.review-list-item{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:20px; box-shadow:var(--shadow); }
.review-list-item .your-answer{ font-size:.85rem; margin-top:8px; }
.review-list-item .your-answer.wrong{ color:var(--accent2); }
.review-list-item .your-answer.right{ color:var(--success); }

/* ---------------- history ---------------- */
.history-item{
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:18px 22px; margin-bottom:12px; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px;
}
.history-item .h-meta{ font-size:.8rem; color:var(--muted); }
.history-item .h-score{ font-family:var(--font-display); font-size:1.4rem; font-weight:700; color:var(--gold-deep); }

/* ---------------- legal ---------------- */
.legal-body{ max-width:720px; }
.legal-body h3{ margin-top:28px; color:var(--navy); }

/* empty state */
.empty-state{ text-align:center; padding:60px 20px; color:var(--muted); }
