/* =========================================================
   Paramedic NREMT — First Responder palette
   Dark LifePak-monitor surfaces, vital-sign accents, mono numerals.
   Exam screen stays calm; personality lives on Home / Results / History.
   ========================================================= */
/* ===== Dark = default. Light overrides further below. ===== */
:root {
  /* base — Trauma Bay: deep oxblood + plum surfaces, bone-white text */
  --bg:           #1a0e10;   /* deep oxblood */
  --bg-2:         #241418;   /* card surface */
  --bg-3:         #2c1a1f;   /* elevated panel / option fill — dark plum */
  --ink:          #f4ece4;   /* bone white */
  --ink-2:        #d4c4ba;
  --muted:        #a89a92;
  --line:         rgba(244,236,228,0.08);
  --line-2:       rgba(244,236,228,0.14);
  --panel:        rgba(36,20,24,0.72);
  --panel-solid:  #241418;

  /* vital-sign accents */
  --ecg:          #3ee685;   /* correct, primary highlight */
  --ecg-soft:     rgba(62,230,133,0.14);
  --siren:        #ff4d5e;   /* wrong, danger */
  --siren-soft:   rgba(255,77,94,0.14);
  --pulse:        #ffaf3d;   /* primary actions */
  --pulse-soft:   rgba(255,175,61,0.14);
  --dispatch:     #ffce5c;   /* warnings, borderline */
  --dispatch-soft: rgba(255,206,92,0.14);

  /* aliases — keep existing class refs working */
  --accent:       var(--pulse);
  --accent-2:     #d68a1e;
  --accent-soft:  var(--pulse-soft);
  --good:         var(--ecg);
  --good-soft:    var(--ecg-soft);
  --bad:          var(--siren);
  --bad-soft:     var(--siren-soft);
  --warn:         var(--dispatch);

  /* shape — tighter than the old 14px */
  --shadow-1:     0 0 0 1px var(--line),  0 4px 12px rgba(0,0,0,0.30);
  --shadow-2:     0 0 0 1px var(--line-2),0 12px 32px rgba(0,0,0,0.45);
  --radius:       8px;
  --radius-sm:    6px;

  --serif:        ui-serif, "Iowan Old Style", "Charter", "Source Serif Pro", Georgia, serif;
  --sans:         "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono:         "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ===== Light theme overrides ===== */
:root[data-theme="light"] {
  --bg:           #F4F7FA;   /* cool alabaster */
  --bg-2:         #FFFFFF;   /* card surface */
  --bg-3:         #EEF3F7;   /* option/elevated panel */
  --ink:          #0E1A24;
  --ink-2:        #2D3D4D;
  --muted:        #6B7785;
  --line:         rgba(14,26,36,0.10);
  --line-2:       rgba(14,26,36,0.18);
  --panel:        rgba(255,255,255,0.92);
  --panel-solid:  #FFFFFF;

  --ecg:          #0FA958;   /* deeper for white-bg contrast */
  --ecg-soft:     rgba(15,169,88,0.12);
  --siren:        #DC3022;
  --siren-soft:   rgba(220,48,34,0.10);
  --pulse:        #b8253b;
  --pulse-soft:   rgba(184,37,59,0.10);
  --dispatch:     #B7770A;
  --dispatch-soft: rgba(183,119,10,0.12);

  --accent:       var(--pulse);
  --accent-2:     #8e1d31;
  --accent-soft:  var(--pulse-soft);
  --good:         var(--ecg);
  --good-soft:    var(--ecg-soft);
  --bad:          var(--siren);
  --bad-soft:     var(--siren-soft);
  --warn:         var(--dispatch);

  --shadow-1:     0 0 0 1px var(--line),  0 4px 12px rgba(14,26,36,0.06);
  --shadow-2:     0 0 0 1px var(--line-2),0 12px 32px rgba(14,26,36,0.10);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--bg);
  -webkit-user-select: none; user-select: none;
  position: relative;
  overflow-x: hidden;
}

/* ===== Ambient EMS-gear backdrop =====
   Two stacked layers behind everything:
   - body::before  → bright ECG grid (5mm minor + 25mm major) tinted green,
                     plus a slow horizontal scan-line glow.
   - body::after   → corner gradients (pulse blue top-left, ecg green
                     bottom-right, dispatch amber bottom-left) + center
                     vignette so cards stay readable. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    /* major grid 50px — brighter */
    linear-gradient(rgba(62,230,133,0.13) 1px, transparent 1px) 0 0 / 50px 50px,
    linear-gradient(90deg, rgba(62,230,133,0.13) 1px, transparent 1px) 0 0 / 50px 50px,
    /* minor grid 10px — brighter */
    linear-gradient(rgba(62,230,133,0.06) 1px, transparent 1px) 0 0 / 10px 10px,
    linear-gradient(90deg, rgba(62,230,133,0.06) 1px, transparent 1px) 0 0 / 10px 10px,
    var(--bg);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    /* moving horizontal scan glow — stronger */
    linear-gradient(180deg,
      transparent 0%,
      transparent 46%,
      rgba(62,230,133,0.10) 50%,
      transparent 54%,
      transparent 100%),
    /* corner radial accents — bumped */
    radial-gradient(ellipse 65% 50% at 0% 0%,   rgba(255,175,61,0.38), transparent 60%),
    radial-gradient(ellipse 60% 45% at 100% 100%, rgba(62,230,133,0.30),  transparent 65%),
    radial-gradient(ellipse 50% 40% at 0% 100%,  rgba(255,206,92,0.20),  transparent 70%),
    radial-gradient(ellipse 45% 35% at 100% 0%,  rgba(255,77,94,0.16),   transparent 70%),
    /* center mid accent so the middle isn't dead */
    radial-gradient(ellipse 35% 25% at 50% 45%, rgba(255,175,61,0.10), transparent 70%),
    /* lighter center vignette so colors stay vivid */
    radial-gradient(ellipse 80% 65% at 50% 50%, transparent 0%, rgba(13,6,8,0.30) 100%);
  background-size: 100% 200%, auto, auto, auto, auto, auto, auto;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
  animation: scanGlow 7s linear infinite;
  pointer-events: none;
}
@keyframes scanGlow {
  0%   { background-position: 0 -200%, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
  100% { background-position: 0 200%,  0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
}

button { font: inherit; cursor: pointer; color: inherit; }
input { font: inherit; }
a { color: var(--pulse); text-decoration: none; }
a:hover { color: var(--accent-2); }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 36px 24px 64px;
  animation: pageIn .35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ===== Brand mark — animated monitor ===== */
.brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
/* New logo: stylized Star of Life with an animated ECG trace through its core */
.brand-logo {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: cover;
  filter: drop-shadow(0 0 8px var(--siren-soft));
  transition: filter .25s ease, transform .25s ease;
}
.brand-logo:hover { transform: rotate(-6deg) scale(1.06); }
:root[data-theme="light"] .brand-logo {
  filter: drop-shadow(0 0 8px var(--siren-soft));
}
.brand-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ===== Cards ===== */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  margin: 16px 0;
  box-shadow: var(--shadow-1);
  transition: border-color .18s ease, box-shadow .18s ease;
}
@media (max-width: 540px) { .card { padding: 22px 18px; } }

/* ===== Headings ===== */
h1 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: var(--ink);
}
h2 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  color: var(--ink);
}
h3 { font-family: var(--sans); font-weight: 600; margin: 0 0 10px; color: var(--ink); }
.muted { color: var(--muted); font-size: 14px; line-height: 1.55; }

/* Mono utility — apply to numerals, stats, badges, option letters */
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* ===== Buttons — tactical console style ===== */
.btn {
  background: linear-gradient(180deg, #3a2329 0%, var(--bg-3) 100%);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 1px 0 rgba(0,0,0,0.40),
    0 2px 6px rgba(0,0,0,0.25);
  transition: background .15s ease, border-color .15s ease, transform .08s ease, box-shadow .15s ease;
}
.btn:hover {
  background: linear-gradient(180deg, #2a151a 0%, #1f0f12 100%);
  border-color: rgba(255,255,255,0.22);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 2px 0 rgba(0,0,0,0.40),
    0 6px 14px rgba(0,0,0,0.35);
}
.btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.40),
    0 0 0 rgba(0,0,0,0);
}

/* Dark mode primary: ambulance amber — pairs with deep oxblood. */
.btn.primary {
  background: linear-gradient(180deg, #ffd07a 0%, var(--pulse) 100%);
  color: #1a0e10;
  border-color: rgba(255,175,61,0.55);
  text-shadow: 0 1px 0 rgba(255,255,255,0.30);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.40),
    inset 0 -1px 0 rgba(0,0,0,0.20),
    0 0 0 1px var(--pulse-soft),
    0 2px 0 rgba(0,0,0,0.35),
    0 6px 18px rgba(255,175,61,0.30);
}
.btn.primary:hover {
  background: linear-gradient(180deg, #ffe199 0%, #ffbf57 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.50),
    inset 0 -1px 0 rgba(0,0,0,0.22),
    0 0 0 2px var(--pulse-soft),
    0 4px 0 rgba(0,0,0,0.35),
    0 10px 26px rgba(255,175,61,0.45);
}
.btn.primary:active {
  background: linear-gradient(180deg, var(--pulse) 0%, #d68a1e 100%);
  box-shadow:
    inset 0 2px 5px rgba(0,0,0,0.32),
    0 0 0 1px var(--pulse-soft);
}

/* Light mode primary: deep medical crimson — matches the heart logo. */
:root[data-theme="light"] .btn.primary {
  background: linear-gradient(180deg, #d4334a 0%, #b8253b 100%);
  color: #ffffff;
  border-color: rgba(184,37,59,0.55);
  text-shadow: 0 1px 0 rgba(0,0,0,0.20);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    inset 0 -1px 0 rgba(0,0,0,0.18),
    0 0 0 1px rgba(184,37,59,0.20),
    0 2px 0 rgba(120,20,35,0.30),
    0 6px 18px rgba(184,37,59,0.32);
}
:root[data-theme="light"] .btn.primary:hover {
  background: linear-gradient(180deg, #e8475e 0%, #c82c44 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.20),
    0 0 0 2px rgba(184,37,59,0.30),
    0 4px 0 rgba(120,20,35,0.35),
    0 10px 26px rgba(184,37,59,0.42);
}
:root[data-theme="light"] .btn.primary:active {
  background: linear-gradient(180deg, #b8253b 0%, #8e1d31 100%);
  box-shadow:
    inset 0 2px 5px rgba(0,0,0,0.25),
    0 0 0 1px rgba(184,37,59,0.40);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  box-shadow: none;
}
.btn.ghost:hover {
  background: var(--bg-3);
  border-color: var(--pulse);
  color: var(--pulse);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px var(--pulse-soft), 0 4px 12px rgba(0,0,0,0.30);
}
.btn.ghost:active { transform: translateY(0); box-shadow: none; }

.btn.danger {
  background: transparent;
  color: var(--siren);
  border-color: rgba(255,77,94,0.40);
  box-shadow: none;
}
.btn.danger:hover {
  background: var(--siren-soft);
  border-color: var(--siren);
  box-shadow: 0 0 0 1px rgba(255,77,94,0.25), 0 4px 12px rgba(255,77,94,0.20);
}

.btn.good {
  background: linear-gradient(180deg, #6ff5b0 0%, var(--ecg) 100%);
  color: #052812;
  border-color: rgba(62,230,133,0.55);
  text-shadow: 0 1px 0 rgba(255,255,255,0.20);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.20),
    0 0 0 1px var(--ecg-soft),
    0 2px 0 rgba(0,0,0,0.35),
    0 6px 18px rgba(62,230,133,0.30);
}
.btn.good:hover {
  background: linear-gradient(180deg, #4DFFAA 0%, #15E78A 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.40),
    0 0 0 2px var(--ecg-soft),
    0 4px 0 rgba(0,0,0,0.35),
    0 10px 26px rgba(62,230,133,0.45);
}

.btn.big {
  padding: 16px 26px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: var(--mono);
  margin-top: 10px;
}
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn[disabled] {
  opacity: .35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== Action tiles — 2-col grid on Home ===== */
.action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 540px) { .action-grid { grid-template-columns: 1fr; } }

.action-tile {
  --tile-accent: var(--pulse);
  --tile-accent-soft: var(--pulse-soft);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, var(--bg-2) 0%, #16080a 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
  color: var(--ink);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 2px 6px rgba(0,0,0,0.25);
  transition: transform .15s ease, border-color .15s ease, box-shadow .2s ease;
}
.action-tile::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--tile-accent);
  opacity: 0.6;
  transition: opacity .15s ease, width .15s ease;
}
.action-tile::after {
  content: "";
  position: absolute; right: -40%; top: -40%;
  width: 220%; height: 220%;
  background: radial-gradient(circle, var(--tile-accent-soft) 0%, transparent 50%);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.action-tile:hover {
  transform: translateY(-2px);
  border-color: var(--tile-accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 0 0 1px var(--tile-accent-soft),
    0 10px 24px rgba(0,0,0,0.40);
}
.action-tile:hover::before { opacity: 1; width: 4px; }
.action-tile:hover::after  { opacity: 0.5; }
.action-tile:active { transform: translateY(0); }

.action-tile .at-icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--tile-accent-soft);
  border: 1px solid var(--tile-accent);
  color: var(--tile-accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--tile-accent-soft);
}
.action-tile .at-icon svg { width: 18px; height: 18px; }
.action-tile .at-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}
.action-tile .at-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}

.action-tile.tile-ecg     { --tile-accent: var(--ecg);      --tile-accent-soft: var(--ecg-soft); }
.action-tile.tile-pulse   { --tile-accent: var(--pulse);    --tile-accent-soft: var(--pulse-soft); }
.action-tile.tile-dispatch{ --tile-accent: var(--dispatch); --tile-accent-soft: var(--dispatch-soft); }
.action-tile.tile-siren   { --tile-accent: var(--siren);    --tile-accent-soft: var(--siren-soft); }

/* ===== Big primary CTA card on Home ===== */
.cta-card {
  position: relative;
  background:
    linear-gradient(135deg, rgba(255,175,61,0.10) 0%, rgba(62,230,133,0.06) 100%),
    var(--bg-2);
  border: 1px solid rgba(255,175,61,0.30);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin: 16px 0;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.cta-card::before {
  content: "";
  position: absolute; left: -25%; top: -50%;
  width: 60%; height: 200%;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.04) 50%, transparent 60%);
  animation: ctaShine 4.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ctaShine {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(220%); }
}
.cta-card .cta-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pulse);
  margin-bottom: 6px;
}
.cta-card .cta-title {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 8px;
}
.cta-card .cta-sub {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 14px;
}
.cta-card .btn.primary { width: 100%; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ===== Inputs ===== */
.input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 11px 14px;
  margin: 6px 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--muted); }
.input:focus {
  outline: none;
  border-color: var(--pulse);
  box-shadow: 0 0 0 3px var(--pulse-soft);
}
label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.kbd {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--ink-2);
}

/* =====================  Exam runner — calm, focused  ===================== */
.exam-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: rgba(13,6,8,0.92);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  font-size: 13px;
  font-family: var(--mono);
  color: var(--ink-2);
}
.exam-bar strong { font-weight: 600; color: var(--ink); letter-spacing: 0.05em; text-transform: uppercase; font-size: 12px; }

/* PLAIN linear progress bar — no shimmer, no blip, no animation */
.progress {
  height: 4px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
  flex: 1;
  margin: 0 18px;
  max-width: 460px;
}
.progress-bar {
  height: 100%;
  background: var(--ecg);
  border-radius: 999px;
  transition: width .35s cubic-bezier(0.4, 0, 0.2, 1);
}

.q-stem {
  font-family: var(--sans);
  font-size: 19px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  margin: 8px 0 22px;
  color: var(--ink);
  font-weight: 500;
}
@media (max-width: 540px) { .q-stem { font-size: 17px; } }

.q-image {
  max-width: 100%; max-height: 420px;
  display: block;
  margin: 14px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

/* MC / multi-response options — calm, no animation on correct/wrong */
.options { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
  position: relative;
}
.opt:hover { background: #3a2329; border-color: var(--line-2); }
.opt.selected {
  border-color: var(--pulse);
  background: var(--pulse-soft);
  box-shadow: 0 0 0 1px var(--pulse) inset;
}
.opt-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  flex-shrink: 0;
  transition: background .12s ease, border-color .12s ease;
  position: relative;
}
.opt.selected .opt-dot { background: var(--pulse); border-color: var(--pulse); }
.opt.selected .opt-dot::after {
  content: "";
  position: absolute; inset: 4px;
  background: var(--bg);
  border-radius: 50%;
}

/* Post-answer reveal — color-only, NO animation */
.opt.correct {
  border-color: var(--ecg);
  background: var(--ecg-soft);
  box-shadow: 0 0 0 1px var(--ecg) inset;
}
.opt.correct .opt-dot { background: var(--ecg); border-color: var(--ecg); }
.opt.correct .opt-dot::after {
  content: "✓";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--bg);
  background: transparent; border-radius: 0;
}
.opt.wrong {
  border-color: var(--siren);
  background: var(--siren-soft);
  opacity: 0.95;
}
.opt.wrong .opt-dot { background: var(--siren); border-color: var(--siren); }
.opt.wrong .opt-dot::after {
  content: "✕";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: #fff;
  background: transparent; border-radius: 0;
}

/* Build list — click-based reorder */
.buildlist { display: grid; gap: 8px; }
.buildlist .item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.buildlist .bl-num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  width: 26px; height: 26px;
  border-radius: 5px;
  background: var(--pulse-soft);
  color: var(--pulse);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.buildlist .bl-label { flex: 1; line-height: 1.45; }
.buildlist .bl-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-arrow {
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  width: 32px; height: 32px;
  font-size: 16px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn-arrow:hover { background: var(--pulse-soft); border-color: var(--pulse); color: var(--pulse); }
.btn-arrow:active { transform: scale(0.95); }

/* TEI table */
.tei-table {
  width: 100%; border-collapse: collapse;
  margin-top: 8px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
}
.tei-table th, .tei-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.tei-table th { background: var(--bg); font-weight: 600; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-family: var(--mono); }
.tei-table td:first-child { color: var(--ink); }
.tei-radio {
  width: 18px; height: 18px;
  border: 2px solid var(--line-2);
  border-radius: 50%;
  display: inline-block;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.tei-radio.on { background: var(--pulse); border-color: var(--pulse); }

/* Click-to-place categorize */
.dragdrop { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.dd-col {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-height: 140px;
  transition: border-color .15s ease, background .15s ease;
}
.dd-col[data-target="1"] { cursor: pointer; }
.dd-col[data-target="1"]:hover { background: #3a2329; }
.dd-col.target-active {
  border-color: var(--pulse);
  background: var(--pulse-soft);
  box-shadow: 0 0 0 1px var(--pulse) inset;
}
.dd-col h3 {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}
.dd-chip {
  padding: 10px 13px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  margin: 6px 0;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
  font-size: 14px;
  color: var(--ink);
}
.dd-chip:hover { background: var(--bg-3); border-color: var(--line-2); }
.dd-chip.picked {
  background: var(--pulse);
  color: #061321;
  border-color: var(--pulse);
  font-weight: 600;
}

.footer-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 22px;
}

/* ===== Difficulty badges ===== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--mono);
}
.badge.easy    { background: var(--ecg-soft);      color: var(--ecg); }
.badge.medium  { background: var(--dispatch-soft); color: var(--dispatch); }
.badge.hard    { background: var(--pulse-soft);    color: var(--pulse); }
.badge.extreme { background: var(--siren-soft);    color: var(--siren); }

/* =====================  KPI / monitor readouts  ===================== */
.kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kpi .tile {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: left;
  transition: border-color .15s ease;
}
.kpi .tile:hover { border-color: var(--line-2); }
.kpi .tile .muted {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi .big {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  margin-top: 8px;
  letter-spacing: -0.01em;
  color: var(--ecg);
}
.weak-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.weak-row:last-child { border-bottom: none; }
.bar-mini {
  width: 140px; height: 6px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
}
.bar-mini > div { height: 100%; background: var(--ecg); transition: width .4s ease; }
.bar-mini.bad > div { background: var(--siren); }
.bar-mini.good > div { background: var(--ecg); }

/* =====================  Feedback panel  ===================== */
.feedback {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-3);
  animation: slideUp .35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.feedback-good {
  border-color: rgba(62,230,133,0.35);
  background: var(--ecg-soft);
}
.feedback-bad {
  border-color: rgba(255,77,94,0.35);
  background: var(--siren-soft);
}
.fb-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.fb-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}
.feedback-good .fb-icon { background: var(--ecg); color: #052812; }
.feedback-bad  .fb-icon { background: var(--siren); color: #2A0807; }
.fb-title {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.fb-section { margin-top: 12px; }
.fb-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 4px;
  font-weight: 700;
  font-family: var(--mono);
}
.fb-body { line-height: 1.55; color: var(--ink-2); }
.fb-pre {
  white-space: pre-wrap;
  font-family: var(--sans);
  margin: 0;
  line-height: 1.55;
  color: var(--ink-2);
}

/* ===== Scenario banner ===== */
.scenario-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  margin: 10px 0 16px;
  border-radius: var(--radius-sm);
  background: var(--pulse-soft);
  border: 1px solid rgba(255,175,61,0.30);
  border-left-width: 3px;
}
.scenario-tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--pulse);
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.scenario-title {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  font-style: italic;
}

/* Multi-response checkbox */
.mr-box { border-radius: 4px; }
.opt.mr-opt.selected .mr-box { position: relative; }
.opt.mr-opt.selected .mr-box::after {
  content: "\2713";
  color: var(--bg);
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -58%);
  font-size: 14px; font-weight: bold; line-height: 1;
}

/* ===== Lockdown overlay ===== */
.lock-warn {
  position: fixed; inset: 0;
  background: rgba(13,6,8,0.96);
  color: var(--ink);
  display: none; align-items: center; justify-content: center;
  z-index: 9999; text-align: center; padding: 40px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-family: var(--mono);
  letter-spacing: 0.06em;
}
.lock-warn.show { display: flex; }
.lock-warn h2 {
  color: var(--siren);
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ===== Adaptive callout on home ===== */
.callout {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pulse);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 12px 0;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.55;
}
.callout strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: inline-block;
  margin-right: 6px;
}

/* ===== Lock rules list ===== */
ul.lock-rules { margin: 0; padding-left: 20px; }
ul.lock-rules li {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 4px;
}

/* =========================================================
   Notes + post-exam suggestions + modal + iOS safe area
   ========================================================= */

.note-body, textarea.input { -webkit-user-select: text; user-select: text; }
.input { -webkit-user-select: text; user-select: text; }

textarea.input {
  width: 100%;
  min-height: 200px;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  resize: vertical;
}
textarea.input:focus {
  outline: none;
  border-color: var(--pulse);
  box-shadow: 0 0 0 3px var(--pulse-soft);
}

/* ===== Notes ===== */
.notes-hero { margin-bottom: 18px; }
.notes-hero h1 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--ink);
}
.notes-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

.search-wrap {
  position: relative;
  margin-top: 18px;
}
.search-wrap .search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.search-wrap .input {
  padding-left: 42px;
  height: 42px;
  font-size: 14.5px;
  background: var(--bg-3);
  border-radius: 999px;
}

.notes-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.notes-group-header {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.notes-group:first-child .notes-group-header { margin-top: 4px; }

.notes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .notes-grid { grid-template-columns: repeat(2, 1fr); }
}

.note-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .05s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 130px;
}
.note-card:hover {
  border-color: var(--pulse);
  box-shadow: 0 0 0 1px var(--pulse-soft);
}
.note-card:active { transform: translateY(1px); }
.note-card-topic {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pulse);
  background: var(--pulse-soft);
  border-radius: 3px;
  font-family: var(--mono);
}
.note-card-title {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.note-card-preview {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.note-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}
.note-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .15s, transform .15s;
}
.note-card:hover .note-card-actions,
.note-card:focus-within .note-card-actions {
  opacity: 1;
  transform: none;
}
@media (hover: none) {
  .note-card-actions { opacity: 1; transform: none; }
}
.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .12s;
}
.icon-btn:hover { background: var(--pulse-soft); color: var(--pulse); border-color: rgba(255,175,61,0.30); }
.icon-btn.danger:hover { background: var(--siren-soft); color: var(--siren); border-color: rgba(255,77,94,0.35); }
.icon-btn svg { width: 16px; height: 16px; }

.notes-empty {
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.notes-empty-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: var(--pulse-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--pulse);
}
.notes-empty-icon svg { width: 28px; height: 28px; }
.notes-empty h3 {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}
.notes-empty p {
  color: var(--muted);
  font-size: 14px;
  max-width: 380px;
  margin: 0 auto 18px;
  line-height: 1.55;
}

/* Post-exam note suggestions */
.note-suggest-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.note-suggest {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.note-suggest-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
  animation: fadeIn .15s ease;
}
.modal-card {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 22px;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  animation: pop .18s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }

/* iOS PWA safe-area */
.wrap {
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
  padding-bottom: max(64px, calc(env(safe-area-inset-bottom) + 24px));
}
@media (display-mode: standalone) {
  .wrap { padding-top: max(36px, calc(env(safe-area-inset-top) + 12px)); }
}

/* =========================================================
   Flashcards — 3D flip, category chips, large readable face
   ========================================================= */
.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--sans);
}
.chip:hover { border-color: var(--pulse); color: var(--pulse); }
.chip.active {
  background: var(--pulse);
  border-color: var(--pulse);
  color: #061321;
}
.chip-n {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  font-family: var(--mono);
}
.chip.active .chip-n { background: rgba(0,0,0,0.20); }

.flashcard-card { padding-bottom: 22px; }
.fc-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.flashcard {
  perspective: 1500px;
  width: 100%;
  min-height: 320px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 320px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}
.flashcard-inner.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 320px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 28px 26px 22px;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.flashcard-front {
  background: var(--bg-2);
  border-color: rgba(255,175,61,0.30);
  border-left: 3px solid var(--pulse);
}
.flashcard-back {
  transform: rotateY(180deg);
  background: var(--bg-2);
  border-left: 3px solid var(--ecg);
}
.fc-side-label {
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 14px;
  font-family: var(--mono);
}
.fc-front-text {
  font-family: var(--sans);
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  display: flex;
  align-items: center;
}
.fc-back-text {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-wrap;
  flex: 1;
}
.fc-source {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
}
.fc-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}
@media (max-width: 540px) {
  .fc-front-text { font-size: 19px; }
  .fc-back-text { font-size: 14px; }
  .flashcard, .flashcard-inner, .flashcard-face { min-height: 360px; }
}

/* Study deck card on results */
.study-deck-card {
  background: var(--bg-3);
  border: 1px solid rgba(255,175,61,0.30);
  border-left: 3px solid var(--pulse);
}

.topic-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.topic-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  font-family: var(--mono);
}
.topic-stat.bad { color: var(--siren); border-color: rgba(255,77,94,0.35);    background: var(--siren-soft); }
.topic-stat.mid { color: var(--dispatch); border-color: rgba(255,206,92,0.35); background: var(--dispatch-soft); }
.topic-stat.ok  { color: var(--ecg); border-color: rgba(62,230,133,0.35);       background: var(--ecg-soft); }

.fc-owner-actions { padding-top: 4px; }

/* =========================================================
   Past Exams (history)
   ========================================================= */
.exam-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}
.exam-row {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .05s;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.exam-row:hover {
  border-color: var(--pulse);
  box-shadow: 0 0 0 1px var(--pulse-soft);
}
.exam-row:active { transform: translateY(1px); }

.exam-row-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}
.exam-row-date {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-transform: uppercase;
}
.exam-row-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.exam-stat-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
}
.exam-stat-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 4px;
}
.exam-stat-value.good { color: var(--ecg); }
.exam-stat-value.mid  { color: var(--dispatch); }
.exam-stat-value.bad  { color: var(--siren); }

.exam-row-topics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.exam-topic-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.exam-topic-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 3px;
  flex-shrink: 0;
}
.exam-topic-label.good { color: var(--ecg);   background: var(--ecg-soft); }
.exam-topic-label.bad  { color: var(--siren); background: var(--siren-soft); }

.exam-row-cta {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pulse);
  align-self: flex-end;
}
.exam-row:hover .exam-row-cta { color: var(--ink); }

/* =========================================================
   ECG hero strip — Home + Past Exams headers only
   Animated SVG-style ECG trace as a decorative band.
   ========================================================= */
.ecg-hero {
  position: relative;
  margin: 8px 0 18px;
  padding: 16px 18px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  height: 84px;
  display: flex;
  align-items: center;
}
.ecg-hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(rgba(62,230,133,0.04) 1px, transparent 1px) 0 0 / 100% 12px,
    linear-gradient(90deg, rgba(62,230,133,0.04) 1px, transparent 1px) 0 0 / 12px 100%;
  pointer-events: none;
}
.ecg-hero-trace {
  width: 100%;
  height: 52px;
  display: block;
  position: relative;
  z-index: 1;
}
.ecg-hero-trace path {
  fill: none;
  stroke: var(--ecg);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(62,230,133,0.55));
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
  animation: ecgDraw 4.5s linear infinite;
}
@keyframes ecgDraw {
  0%   { stroke-dashoffset: 2400; }
  60%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -2400; }
}
.ecg-hero-label {
  position: absolute;
  top: 10px; left: 14px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ecg);
  z-index: 2;
}
.ecg-hero-readout {
  position: absolute;
  top: 10px; right: 14px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  z-index: 2;
}

/* =========================================================
   Image lightbox
   ========================================================= */
.q-image-wrap { position: relative; display: inline-block; cursor: zoom-in; border-radius: var(--radius-sm); overflow: hidden; }
.q-image { transition: filter .12s; display: block; background: var(--bg-3); border-radius: var(--radius-sm); }
.q-image:hover { filter: brightness(1.08); }
.q-image-hint {
  position: absolute;
  bottom: 8px; right: 12px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  pointer-events: none;
  letter-spacing: 0.02em;
  font-family: var(--mono);
}

.lightbox-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.96);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .15s ease;
}
.lightbox-stage {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  touch-action: none;
}
.lightbox-img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  transform-origin: center center;
  transition: transform .15s;
  user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
}
.lightbox-img:active { cursor: grabbing; }
.lightbox-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.10);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.20); }
.lightbox-hint {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  text-align: center;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

/* =========================================================
   Light theme component overrides
   Dark theme bakes some literal hex colors into gradients,
   button shadows, and overlays. Re-skin those for light mode.
   ========================================================= */
:root[data-theme="light"] body::before {
  background:
    /* major + minor grid in siren red — light mode signature */
    linear-gradient(rgba(220,48,34,0.10) 1px, transparent 1px) 0 0 / 50px 50px,
    linear-gradient(90deg, rgba(220,48,34,0.10) 1px, transparent 1px) 0 0 / 50px 50px,
    linear-gradient(rgba(220,48,34,0.05) 1px, transparent 1px) 0 0 / 10px 10px,
    linear-gradient(90deg, rgba(220,48,34,0.05) 1px, transparent 1px) 0 0 / 10px 10px,
    var(--bg);
}
:root[data-theme="light"] body::after {
  background:
    /* horizontal scan glow in red */
    linear-gradient(180deg,
      transparent 0%, transparent 46%,
      rgba(220,48,34,0.11) 50%,
      transparent 54%, transparent 100%),
    /* corners — bump red so the room reads warm-ambulance */
    radial-gradient(ellipse 65% 50% at 0% 0%,    rgba(220,48,34,0.20),   transparent 60%),
    radial-gradient(ellipse 60% 45% at 100% 100%, rgba(184,37,59,0.13), transparent 65%),
    radial-gradient(ellipse 50% 40% at 0% 100%,  rgba(183,119,10,0.10),  transparent 70%),
    radial-gradient(ellipse 45% 35% at 100% 0%,  rgba(220,48,34,0.12),   transparent 70%),
    radial-gradient(ellipse 35% 25% at 50% 45%,  rgba(220,48,34,0.07),   transparent 70%),
    radial-gradient(ellipse 80% 65% at 50% 50%, transparent 0%, rgba(244,247,250,0.40) 100%);
}
/* ECG hero trace — flip to siren red in light mode (the signature line) */
:root[data-theme="light"] .ecg-hero-trace path {
  stroke: var(--siren);
  filter: drop-shadow(0 0 4px rgba(220,48,34,0.55));
}
:root[data-theme="light"] .ecg-hero-label { color: var(--siren); }
/* In light mode the hero ECG trace path glow becomes red too */
:root[data-theme="light"] .ecg-hero-trace path { filter: drop-shadow(0 0 4px rgba(220,48,34,0.55)); }

:root[data-theme="light"] .btn {
  background: linear-gradient(180deg, #FFFFFF 0%, #F1F5F9 100%);
  color: var(--ink);
  border-color: var(--line-2);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.80),
    0 1px 0 rgba(14,26,36,0.04),
    0 2px 6px rgba(14,26,36,0.06);
}
:root[data-theme="light"] .btn:hover {
  background: linear-gradient(180deg, #FFFFFF 0%, #E8EFF6 100%);
  border-color: rgba(14,26,36,0.30);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.80),
    0 4px 12px rgba(14,26,36,0.10);
}
:root[data-theme="light"] .btn:active {
  box-shadow: inset 0 2px 4px rgba(14,26,36,0.08);
}

:root[data-theme="light"] .btn.good {
  background: linear-gradient(180deg, #34C77A 0%, var(--ecg) 100%);
  color: #FFFFFF;
  border-color: rgba(15,169,88,0.55);
  text-shadow: 0 1px 1px rgba(0,0,0,0.20);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 2px 0 rgba(14,26,36,0.10),
    0 6px 18px rgba(15,169,88,0.30);
}
:root[data-theme="light"] .btn.ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--ink-2);
  box-shadow: none;
}
:root[data-theme="light"] .btn.ghost:hover {
  background: var(--bg-3);
  border-color: var(--pulse);
  color: var(--pulse);
  box-shadow: 0 0 0 1px var(--pulse-soft), 0 4px 12px rgba(14,26,36,0.06);
}

:root[data-theme="light"] .action-tile {
  background: linear-gradient(180deg, #FFFFFF 0%, #F4F7FA 100%);
  border-color: var(--line);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.80),
    0 2px 8px rgba(14,26,36,0.06);
}
:root[data-theme="light"] .action-tile:hover {
  border-color: var(--tile-accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.80),
    0 0 0 1px var(--tile-accent-soft),
    0 10px 24px rgba(14,26,36,0.10);
}

:root[data-theme="light"] .cta-card {
  background:
    linear-gradient(135deg, rgba(184,37,59,0.06) 0%, rgba(255,175,61,0.05) 100%),
    var(--bg-2);
  border-color: rgba(184,37,59,0.25);
}
:root[data-theme="light"] .cta-card::before {
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.50) 50%, transparent 60%);
}

:root[data-theme="light"] .exam-bar {
  background: rgba(255,255,255,0.92);
}
:root[data-theme="light"] .lock-warn {
  background: rgba(244,247,250,0.96);
  color: var(--ink);
}
:root[data-theme="light"] .lock-warn h2 { color: var(--siren); }

:root[data-theme="light"] .modal-overlay { background: rgba(14,26,36,0.35); }

:root[data-theme="light"] .opt:hover { background: var(--bg-3); }
:root[data-theme="light"] .dd-col[data-target="1"]:hover { background: var(--bg-3); }
:root[data-theme="light"] .dd-chip:hover { background: var(--bg-3); }

:root[data-theme="light"] .lightbox-overlay { background: rgba(14,26,36,0.92); }

:root[data-theme="light"] .ecg-hero { background: var(--bg-2); }

/* ===== Profile avatar (brand row + settings) ===== */
.brand-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pulse);
  background: var(--bg-3);
  box-shadow:
    0 0 0 3px var(--pulse-soft),
    0 0 14px rgba(255,175,61,0.45),
    0 4px 12px rgba(0,0,0,0.30);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.brand-avatar:hover {
  transform: scale(1.06);
  border-color: var(--ecg);
  box-shadow:
    0 0 0 3px var(--ecg-soft),
    0 0 18px rgba(62,230,133,0.60),
    0 6px 16px rgba(0,0,0,0.35);
}
/* Light mode: red ring instead of blue, plus a subtle online dot */
:root[data-theme="light"] .brand-avatar {
  border-color: var(--siren);
  box-shadow:
    0 0 0 3px var(--siren-soft),
    0 0 14px rgba(220,48,34,0.40),
    0 4px 12px rgba(14,26,36,0.10);
}
:root[data-theme="light"] .brand-avatar:hover {
  border-color: var(--ecg);
  box-shadow:
    0 0 0 3px var(--ecg-soft),
    0 0 18px rgba(15,169,88,0.55),
    0 6px 16px rgba(14,26,36,0.15);
}
/* Initial-letter fallback when no avatar uploaded */
div.brand-avatar {
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-family: var(--mono) !important;
  font-weight: 700 !important;
  font-size: 17px !important;
  color: var(--ink) !important;
  background: var(--bg-3) !important;
}
/* Profile button positioning so the avatar sits clean in the brand row */
#settings-btn {
  position: relative;
  border-radius: 50%;
  display: inline-flex;
}
#settings-btn::after {
  content: "";
  position: absolute;
  bottom: 1px; right: 1px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--ecg);
  border: 2px solid var(--bg);
  box-shadow: 0 0 6px var(--ecg);
  pointer-events: none;
}
.avatar-large {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pulse);
  box-shadow: 0 0 0 4px var(--pulse-soft), 0 6px 20px rgba(0,0,0,0.30);
  background: var(--bg-3);
}
.avatar-placeholder {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 2px dashed var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--muted);
}

/* ===== Theme toggle pill ===== */
.theme-toggle {
  display: inline-flex;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.theme-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
  font: inherit;
}
.theme-toggle button.active {
  background: var(--pulse);
  color: #FFFFFF;
}
:root[data-theme="light"] .theme-toggle button.active { color: #FFFFFF; }

/* Settings page sections */
.settings-section { margin-bottom: 18px; }
.settings-section h2 {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  font-weight: 700;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .label-col {
  flex: 0 0 160px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.settings-row .field-col { flex: 1; min-width: 0; }
@media (max-width: 540px) {
  .settings-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .settings-row .label-col { flex: none; }
}

.settings-msg {
  margin-top: 10px;
  font-size: 13px;
  font-family: var(--mono);
}
.settings-msg.ok  { color: var(--ecg); }
.settings-msg.err { color: var(--siren); }

/* =========================================================
   Auth screen — its own visual identity, NOT theme-dependent.
   Body gets .auth-screen class while login/register is showing.
   Removed when navigating to home.
   ========================================================= */
body.auth-screen {
  background: #0d0608;
  overflow: hidden;
}
body.auth-screen::before,
body.auth-screen::after { display: none !important; }

.auth-screen .wrap {
  max-width: none;
  padding: 0;
  margin: 0;
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1100px 700px at 20% 10%, rgba(255,175,61,0.18), transparent 60%),
    radial-gradient(900px 600px at 85% 90%, rgba(255,206,92,0.14), transparent 60%),
    radial-gradient(700px 500px at 50% 50%, rgba(62,230,133,0.05), transparent 70%),
    linear-gradient(180deg, #0d0608 0%, #050203 100%);
}
.auth-bg::after {
  /* fine grid scan — same vibe as the LifePak monitor on the home screen */
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px) 0 0 / 28px 100%;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  pointer-events: none;
}

/* Sweeping ECG line at the bottom — slow, ambient, NOT distracting */
.auth-ecg {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 12%;
  height: 90px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.55;
}
.auth-ecg svg { width: 100%; height: 100%; display: block; }
.auth-ecg .trace {
  fill: none;
  stroke: #3ee685;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(62,230,133,0.55));
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
  animation: authEcgSweep 7s linear infinite;
}
@keyframes authEcgSweep {
  0%   { stroke-dashoffset: 2400; }
  60%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -2400; }
}

.auth-stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, rgba(36,20,24,0.92) 0%, rgba(13,6,8,0.92) 100%);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 36px 32px 28px;
  box-shadow:
    0 0 0 1px rgba(62,230,133,0.06),
    0 24px 60px rgba(0,0,0,0.55),
    0 0 80px rgba(255,175,61,0.10);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  /* thin accent rule across the very top of the card */
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #3ee685 30%, #ffaf3d 70%, transparent 100%);
  opacity: 0.7;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.auth-brand .brand-logo {
  width: 56px !important;
  height: 56px !important;
  filter: drop-shadow(0 0 14px rgba(255,175,61,0.55));
}
.auth-brand .auth-wordmark {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
  color: #E6EDF3;
  text-align: center;
}
.auth-brand .auth-tagline {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #6F7A86;
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-brand .auth-tagline::before,
.auth-brand .auth-tagline::after {
  content: '';
  height: 1px;
  width: 24px;
  background: rgba(111,122,134,0.5);
}

.auth-eyebrow {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #3ee685;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ee685;
  box-shadow: 0 0 10px #3ee685;
  animation: authPulse 1.4s ease-in-out infinite;
}
@keyframes authPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.85); }
}
.auth-title {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.01em;
  color: #F4F7FA;
  margin: 0 0 6px 0;
}
.auth-sub {
  font-size: 13px;
  line-height: 1.55;
  color: #8B97A4;
  margin: 0 0 22px 0;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.auth-field-label {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6F7A86;
}
.auth-input {
  background: rgba(13,6,8,0.65);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: "Inter", sans-serif;
  color: #E6EDF3;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-user-select: text;
  user-select: text;
}
.auth-input:hover { border-color: rgba(255,255,255,0.18); }
.auth-input:focus {
  border-color: #ffaf3d;
  background: rgba(13,6,8,0.85);
  box-shadow: 0 0 0 3px rgba(255,175,61,0.20);
}
.auth-input::placeholder { color: #4F5862; }

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}
.btn-auth {
  width: 100%;
  padding: 14px 18px;
  border-radius: 9px;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.btn-auth-primary {
  background: linear-gradient(180deg, #ffd07a 0%, #ffaf3d 100%);
  color: #1a0e10;
  border-color: rgba(255,175,61,0.55);
  text-shadow: 0 1px 0 rgba(255,255,255,0.30);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.45),
    0 0 0 1px rgba(255,175,61,0.30),
    0 8px 24px rgba(255,175,61,0.30);
}
.btn-auth-primary:hover {
  background: linear-gradient(180deg, #ffe199 0%, #ffbf57 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.55),
    0 0 0 2px rgba(255,175,61,0.42),
    0 12px 32px rgba(255,175,61,0.42);
}
.btn-auth-primary:active {
  transform: translateY(1px);
  background: linear-gradient(180deg, #ffaf3d 0%, #d68a1e 100%);
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.30),
    0 0 0 1px rgba(255,175,61,0.40);
}
.btn-auth-ghost {
  background: rgba(255,255,255,0.03);
  color: #B8C2CC;
  border-color: rgba(255,255,255,0.10);
  font-weight: 600;
}
.btn-auth-ghost:hover {
  background: rgba(255,255,255,0.06);
  color: #E6EDF3;
  border-color: rgba(255,255,255,0.18);
}
.btn-auth-ghost:active {
  transform: translateY(1px);
  background: rgba(0,0,0,0.20);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.08);
}
.auth-divider-text {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #4F5862;
}

.auth-err {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(255,77,94,0.10);
  border: 1px solid rgba(255,77,94,0.30);
  border-radius: 8px;
  color: #FF6B61;
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
  display: none;
}
.auth-err.show { display: block; }

.auth-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #4F5862;
}
.auth-foot .auth-foot-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3ee685;
  box-shadow: 0 0 6px #3ee685;
  margin: 0 8px;
  vertical-align: middle;
}

@media (max-width: 480px) {
  .auth-stage { padding: 16px; }
  .auth-card { padding: 28px 22px 22px; }
  .auth-title { font-size: 22px; }
}

/* =========================================================
   Subscription / billing UI
   ========================================================= */
.upgrade-pill {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd07a 0%, #ffaf3d 100%);
  color: #1a0e10;
  border: 1px solid rgba(255,175,61,0.6);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.45),
    0 0 0 1px rgba(255,175,61,0.30),
    0 6px 18px rgba(255,175,61,0.30);
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
}
.upgrade-pill:hover {
  background: linear-gradient(180deg, #ffe199 0%, #ffbf57 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.55),
    0 0 0 2px rgba(255,175,61,0.40),
    0 8px 22px rgba(255,175,61,0.40);
}
.upgrade-pill:active { transform: translateY(1px); }
.upgrade-pill .up-spark { font-size: 13px; }

@media (max-width: 540px) {
  .upgrade-pill {
    top: 10px;
    right: 10px;
    padding: 7px 10px 7px 9px;
  }
  .upgrade-pill .up-label { display: none; }
  .upgrade-pill .up-spark { font-size: 14px; }
}

.sub-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 720px) {
  .sub-grid { grid-template-columns: 1fr; }
}

.sub-tier {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
}
.sub-tier.sub-recommended {
  border: 1px solid rgba(255,175,61,0.45);
  box-shadow: 0 0 0 1px rgba(255,175,61,0.25), 0 12px 32px rgba(0,0,0,0.30);
}
.sub-tier.sub-current {
  border: 1px solid rgba(62,230,133,0.40);
}

.sub-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.sub-pro .sub-eyebrow { color: var(--pulse); }
.sub-price {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 14px 0;
}
.sub-price .sub-price-mo {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-left: 4px;
}
.sub-features {
  list-style: none;
  padding: 0;
  margin: 0 0 6px 0;
  flex: 1;
}
.sub-features li {
  position: relative;
  padding: 8px 0 8px 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.sub-features li:last-child { border-bottom: none; }
.sub-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 8px;
  color: var(--ecg);
  font-weight: 700;
}
.sub-features li.sub-feat-locked {
  color: var(--muted);
}
.sub-features li.sub-feat-locked::before {
  content: '✕';
  color: rgba(255,77,94,0.6);
}
.sub-current-tag {
  margin-top: 14px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ecg);
  padding: 10px 0;
  border: 1px dashed rgba(62,230,133,0.40);
  border-radius: 8px;
}

/* Modal — used by free-tier throttle and other interrupt points */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(13,6,8,0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  max-width: 460px;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 26px 24px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.modal-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pulse);
  margin-bottom: 10px;
}
.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px 0;
  line-height: 1.3;
}
.modal-sub {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
  margin: 0;
}
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.modal-actions .btn { width: 100%; }

/* Locked-section state on Past Exams + Results for free users */
.lock-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 22px;
  text-align: center;
  margin-top: 14px;
}
.lock-card::before {
  content: '🔒';
  display: block;
  font-size: 30px;
  margin-bottom: 10px;
  filter: grayscale(0.2);
}
.lock-card h3 {
  font-size: 17px;
  margin: 0 0 6px 0;
  color: var(--ink);
}
.lock-card p {
  margin: 0 0 16px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
