/* ============================================================
   Neuroanatomy Camp Prep — mobile-first PWA styles
   ============================================================ */

:root {
  --brand-1: #ec4899;   /* magenta */
  --brand-2: #8b5cf6;   /* violet  */
  --brand-3: #06b6d4;   /* cyan    */
  --brand-grad: linear-gradient(115deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
  /* deeper stops for white text on gradient buttons (AA contrast) */
  --brand-grad-deep: linear-gradient(115deg, #db2777, #7c3aed 55%, #0e7490);
  --radius: 18px;
  --radius-sm: 12px;
  --tap: 46px;
  --maxw: 640px;
  --nav-h: 62px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;

  /* accent — overridden per module */
  --accent: var(--brand-2);
}

/* ---------- Dark (default) ---------- */
:root, :root[data-theme="dark"] {
  --bg: #0a0a16;
  --bg-glow-1: rgba(139,92,246,.20);
  --bg-glow-2: rgba(6,182,212,.16);
  --bg-glow-3: rgba(236,72,153,.14);
  --surface: rgba(26,26,46,.72);
  --surface-solid: #171730;
  --surface-2: rgba(255,255,255,.05);
  --card-border: rgba(255,255,255,.09);
  --ink: #f3f3fb;
  --soft: #a9abce;
  --faint: #7c7ea3;
  --line: rgba(255,255,255,.10);
  --shadow: 0 10px 30px -12px rgba(0,0,0,.7);
  --dg-ink: #e9e9f6; --dg-soft: #9fa1c4; --dg-stroke: rgba(255,255,255,.28); --dg-fill: rgba(255,255,255,.06);
  --ok: #34d399; --ok-bg: rgba(52,211,153,.14);
  --bad: #fb7185; --bad-bg: rgba(251,113,133,.14);
  color-scheme: dark;
}

/* ---------- Light ---------- */
:root[data-theme="light"] {
  --bg: #f5f4ff;
  --bg-glow-1: rgba(139,92,246,.16);
  --bg-glow-2: rgba(6,182,212,.14);
  --bg-glow-3: rgba(236,72,153,.12);
  --surface: rgba(255,255,255,.86);
  --surface-solid: #ffffff;
  --surface-2: rgba(20,20,60,.04);
  --card-border: rgba(20,20,60,.09);
  --ink: #16152e;
  --soft: #55546f;
  --faint: #6e6d85;
  --line: rgba(20,20,60,.10);
  --shadow: 0 12px 28px -14px rgba(60,50,120,.35);
  --dg-ink: #2a2846; --dg-soft: #6a6889; --dg-stroke: rgba(30,25,70,.28); --dg-fill: rgba(120,110,200,.07);
  --ok: #059669; --ok-bg: rgba(5,150,105,.12);
  --bad: #e11d48; --bad-bg: rgba(225,29,72,.10);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--brand-3); outline-offset: 2px; border-radius: 6px; }
.opt:focus-visible, .mcard:focus-visible, .qc__btn:focus-visible, .btn-complete:focus-visible,
.btn-next:focus-visible, .video__frame:focus-visible, .reslink:focus-visible, .hero__cta:focus-visible,
.gterm__btn:focus-visible, .more>summary:focus-visible { outline-offset: -3px; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 12% -5%, var(--bg-glow-1), transparent 60%),
    radial-gradient(55% 40% at 100% 8%, var(--bg-glow-2), transparent 55%),
    radial-gradient(70% 50% at 50% 108%, var(--bg-glow-3), transparent 60%);
}
h1,h2,h3,h4,p { margin: 0; }
a { color: inherit; text-decoration: none; }
mark { background: color-mix(in srgb, var(--brand-2) 40%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--brand-2); color: #fff; }

/* ---------- App shell ---------- */
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100dvh; position: relative; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  padding: calc(var(--sat) + 9px) 14px 9px;
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  min-height: calc(var(--sat) + 52px);
}
.topbar__back {
  width: var(--tap); height: var(--tap); border-radius: 12px; flex: 0 0 auto; margin-left: -3px;
  display: grid; place-items: center; font-size: 22px;
  background: var(--surface-2); color: var(--ink);
  transition: transform .15s var(--ease), background .15s;
}
.topbar__back:active { transform: scale(.9); }
.topbar__title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__title .accent-dot { display:inline-block; width:9px; height:9px; border-radius:50%; background: var(--accent); margin-right: 7px; vertical-align: middle; }
.topbar__prog { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--soft);
  background: var(--surface-2); padding: 5px 10px; border-radius: 999px; }

.screen { padding: 16px 14px calc(var(--nav-h) + var(--sab) + 26px); }
.screen--reader { padding-top: 6px; }

/* ---------- Bottom nav ---------- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: var(--maxw); z-index: 50;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(var(--sab) + 6px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.nav__item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px; border-radius: 14px; color: var(--faint);
  font-size: 10.5px; font-weight: 700; letter-spacing: .01em;
  transition: color .2s var(--ease), background .2s, transform .1s;
}
.nav__item svg { width: 24px; height: 24px; stroke-width: 2; }
.nav__item:active { transform: scale(.92); }
.nav__item.is-active { color: var(--ink); }
.nav__item.is-active svg { stroke: url(#navgrad); }
.nav__pill {
  width: 26px; height: 3px; border-radius: 2px; margin-top: 1px;
  background: var(--brand-grad); opacity: 0; transition: opacity .2s;
}
.nav__item.is-active .nav__pill { opacity: 1; }

/* ============================================================
   Cards & shared blocks
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.stack > * + * { margin-top: 14px; }

/* ---------- Hero ---------- */
.hero { padding: 20px 18px 22px; text-align: center; position: relative; overflow: hidden; }
.hero__badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand-2); background: var(--surface-2); padding: 6px 12px; border-radius: 999px;
  margin-bottom: 14px;
}
.hero__title {
  font-size: clamp(27px, 8.4vw, 40px); line-height: 1.06; font-weight: 900; letter-spacing: -.03em;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-wrap: balance;
}
.hero__title .pop { display: inline-block; }
.hero__sub { margin-top: 12px; color: var(--soft); font-size: 15px; text-wrap: pretty; }
.hero__goal { margin-top: 12px; font-size: 13.5px; color: var(--soft); }

.hero__cta {
  margin-top: 18px; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 15px 20px; border-radius: 16px; font-size: 16.5px; font-weight: 800; color: #fff;
  background: var(--brand-grad-deep);
  box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--brand-2) 80%, transparent);
  transition: transform .12s var(--ease), filter .2s;
}
.hero__cta:active { transform: scale(.97); filter: brightness(1.05); }

/* ---------- Progress ring ---------- */
.progress {
  display: flex; align-items: center; gap: 16px; padding: 16px;
}
.ring { width: 66px; height: 66px; flex: 0 0 auto; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring__track { stroke: var(--surface-2); }
.ring__bar { stroke: url(#ringgrad); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring__pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; font-weight: 800; }
.progress__meta { flex: 1 1 auto; min-width: 0; }
.progress__meta h3 { font-size: 15px; font-weight: 800; }
.progress__meta p { font-size: 12.5px; color: var(--soft); margin-top: 2px; }

/* ---------- Section label ---------- */
.section-label {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 26px 4px 12px; }
.section-label h2 { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.section-label span { font-size: 12px; color: var(--faint); }

/* ---------- Big idea ---------- */
.bigidea { padding: 18px; position: relative; overflow: hidden; }
.bigidea::before {
  content: "💡"; position: absolute; right: -6px; top: -10px; font-size: 74px; opacity: .07; }
.bigidea h2 { font-size: 19px; font-weight: 900; letter-spacing: -.02em; }
.bigidea > p { margin-top: 8px; color: var(--soft); font-size: 14.5px; }
.bigidea__dirs { margin-top: 14px; display: grid; gap: 10px; }
.dir {
  border-left: 3px solid var(--accent); background: var(--surface-2);
  padding: 11px 13px; border-radius: 0 12px 12px 0; }
.dir h4 { font-size: 13.5px; font-weight: 800; color: var(--accent); }
.dir p { font-size: 13.5px; color: var(--ink); margin-top: 3px; }
.dir:nth-child(1) { --accent: var(--brand-3); }
.dir:nth-child(2) { --accent: var(--brand-1); }
.bigidea__kicker { margin-top: 14px; font-size: 13.5px; color: var(--soft); }

/* ---------- Module cards ---------- */
.modules { display: grid; gap: 12px; }
.mcard {
  display: flex; align-items: center; gap: 14px; padding: 15px 15px;
  position: relative; overflow: hidden; text-align: left; width: 100%;
  color: inherit; text-decoration: none;
  transition: transform .13s var(--ease); }
.mcard:active { transform: scale(.985); }
.mcard::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent); }
.mcard__icon {
  width: 50px; height: 50px; flex: 0 0 auto; border-radius: 14px; display: grid; place-items: center;
  font-size: 25px; background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.mcard__body { flex: 1 1 auto; min-width: 0; }
.mcard__kicker { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.mcard__title { font-size: 16px; font-weight: 800; letter-spacing: -.01em; margin-top: 1px; }
.mcard__focus { font-size: 12.5px; color: var(--soft); margin-top: 3px; }
.mcard__meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 11.5px; color: var(--faint); }
.mcard__time { display: inline-flex; align-items: center; gap: 4px; }
.mcard__check {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; border: 2px solid var(--line); color: transparent;
  transition: all .25s var(--ease); }
.mcard.is-done .mcard__check { background: var(--ok); border-color: var(--ok); color: #fff; }
.mcard.is-done .mcard__icon { filter: saturate(.85); }
.mcard__chev { color: var(--faint); font-size: 20px; flex: 0 0 auto; }

/* ============================================================
   Module reader
   ============================================================ */
.reader__head { padding: 20px 18px 18px; margin-bottom: 16px; position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, var(--surface-solid)), var(--surface-solid)); }
.reader__head::after {
  content: attr(data-emoji); position: absolute; right: -8px; top: -14px; font-size: 90px; opacity: .16; }
.reader__kicker { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--accent) 78%, var(--ink)); }
.reader__title { font-size: 24px; font-weight: 900; letter-spacing: -.02em; margin-top: 4px; max-width: 84%; }
.reader__focus { margin-top: 8px; font-size: 14px; color: var(--soft); max-width: 92%; }
.reader__time { margin-top: 12px; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); padding: 5px 11px; border-radius: 999px; color: var(--soft); }

.block + .block { margin-top: 16px; }
.block-h { font-size: 17px; font-weight: 800; letter-spacing: -.01em; margin: 6px 2px -2px; display:flex; align-items:center; gap:8px; }
.block-h::before { content:""; width: 16px; height: 3px; border-radius: 2px; background: var(--accent); }
.block-p { font-size: 15px; color: var(--ink); padding: 0 2px; }
.block-p strong { font-weight: 700; }

/* term chips */
.terms { display: grid; gap: 9px; }
.term {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 0; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--card-border); border-radius: 14px; }
.term dt { font-size: 14.5px; font-weight: 800; color: var(--accent); grid-column: 1 / -1; }
.term dd { margin: 0; font-size: 13.5px; color: var(--soft); grid-column: 1 / -1; }

/* steps */
.steps { display: grid; gap: 10px; counter-reset: s; padding-left: 0; margin: 0; list-style: none; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; }
.steps li::before {
  counter-increment: s; content: counter(s); flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 14px; font-weight: 800; color: #fff; background: var(--accent-deep, var(--accent));
  box-shadow: 0 4px 12px -4px var(--accent); }

/* callouts */
.callout { display: flex; gap: 12px; padding: 13px 14px; border-radius: 14px; font-size: 14px;
  border: 1px solid; }
.callout__icon { font-size: 19px; flex: 0 0 auto; line-height: 1.4; }
.callout__body { min-width: 0; }
.callout__body strong { font-weight: 700; }
.callout__title { font-weight: 800; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 3px; opacity: .9; }
.callout--why  { background: color-mix(in srgb, var(--brand-2) 12%, transparent); border-color: color-mix(in srgb, var(--brand-2) 30%, transparent); }
.callout--tip  { background: color-mix(in srgb, var(--brand-3) 12%, transparent); border-color: color-mix(in srgb, var(--brand-3) 30%, transparent); }
.callout--do   { background: color-mix(in srgb, #22c55e 13%, transparent); border-color: color-mix(in srgb, #22c55e 32%, transparent); }
.callout--dx   { background: color-mix(in srgb, #fb7185 13%, transparent); border-color: color-mix(in srgb, #fb7185 34%, transparent); }
.callout--note { background: var(--surface-2); border-color: var(--card-border); }

/* diagram */
.diagram { padding: 16px 14px 14px; }
.diagram__frame { border-radius: 14px; background: var(--surface-2); padding: 8px; }
.diagram__frame svg { width: 100%; height: auto; display: block; }
.diagram__caption { font-size: 13px; color: var(--soft); text-align: center; margin: 10px 4px 12px; font-style: italic; }
.legend { display: flex; flex-wrap: wrap; gap: 7px; }
.legend__chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--ink);
  background: var(--surface-2); padding: 6px 10px 6px 8px; border-radius: 999px; }
.legend__dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }

/* video facade */
.video { }
.video__frame {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
  background: #000; cursor: pointer; border: 1px solid var(--card-border); padding: 0;
  -webkit-appearance: none; appearance: none; font: inherit; color: inherit; }
.video__spinner { position: absolute; inset: 0; margin: auto; width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin .8s linear infinite; z-index: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.video__frame img { width: 100%; height: 100%; object-fit: cover; opacity: .82; transition: opacity .3s, transform .5s var(--ease); }
.video__frame:active img { transform: scale(1.03); }
.video__play {
  position: absolute; inset: 0; display: grid; place-items: center; }
.video__play span {
  width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px); border: 2px solid rgba(255,255,255,.85);
  transition: transform .18s var(--ease), background .2s; }
.video__frame:active .video__play span { transform: scale(1.12); background: var(--brand-1); }
.video__play svg { width: 26px; height: 26px; fill: #fff; margin-left: 3px; }
.video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; padding: 0 2px; }
.video__meta h4 { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.video__meta p { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.video__meta a { color: var(--soft); font-weight: 700; }
.video__len { flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--soft); background: var(--surface-2); padding: 4px 9px; border-radius: 999px; }

/* "more time" accordion */
.more { border: 1px dashed var(--card-border); border-radius: 14px; overflow: hidden; }
.more > summary {
  list-style: none; cursor: pointer; padding: 13px 15px; font-size: 13.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: space-between; color: var(--soft); }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: "＋"; font-size: 18px; font-weight: 400; color: var(--faint); transition: transform .2s; }
.more[open] > summary::after { transform: rotate(45deg); }
.more__inner { padding: 2px 14px 15px; }
.more__inner > * + * { margin-top: 12px; }

/* quick check flip card */
.qc { perspective: 1200px; }
.qc__inner {
  display: grid; transition: transform .6s var(--ease); transform-style: preserve-3d; }
.qc.is-flipped .qc__inner { transform: rotateY(180deg); }
.qc__face {
  grid-area: 1 / 1; /* stack both faces; tallest sizes the card */
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 16px; padding: 16px; border: 1px solid var(--card-border);
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px; min-height: 116px; }
.qc__face--front { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, var(--surface-solid)), var(--surface-solid)); }
.qc__face--back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, color-mix(in srgb, var(--ok) 18%, var(--surface-solid)), var(--surface-solid)); }
.qc__tag { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.qc__face--back .qc__tag { color: var(--ok); }
.qc__q { font-size: 15.5px; font-weight: 700; }
.qc__a { font-size: 15.5px; }
.qc__btn { align-self: flex-start; font-size: 13px; font-weight: 800; color: var(--accent);
  background: var(--surface-2); padding: 9px 15px; border-radius: 999px; display:inline-flex; align-items:center; gap:6px; }
.qc__face--back .qc__btn { color: var(--ok); }

/* mark complete bar */
.complete-bar { margin-top: 22px; display: grid; gap: 10px; }
.btn-complete {
  width: 100%; padding: 15px; border-radius: 15px; font-size: 15.5px; font-weight: 800; color: #fff;
  background: var(--accent-deep, var(--accent)); box-shadow: 0 12px 26px -12px var(--accent);
  transition: transform .12s var(--ease), filter .2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-complete:active { transform: scale(.97); }
.btn-complete.is-done { background: var(--ok); box-shadow: none; }
.btn-next {
  width: 100%; padding: 14px; border-radius: 15px; font-size: 15px; font-weight: 700; color: var(--ink);
  background: var(--surface); border: 1px solid var(--card-border);
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s var(--ease); }
.btn-next:active { transform: scale(.97); }

/* ============================================================
   Diagnose quiz
   ============================================================ */
.quiz { }
.quiz__progress { display: flex; gap: 6px; margin-bottom: 16px; }
.quiz__progress span { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-2); transition: background .3s; }
.quiz__progress span.done { background: var(--brand-grad); }
.quiz__progress span.cur { background: var(--soft); }
.quiz__count { text-align: center; font-size: 12px; font-weight: 700; color: var(--faint); margin-bottom: 8px; letter-spacing: .04em; }
.quiz__scenario { font-size: 17px; font-weight: 600; line-height: 1.5; padding: 18px; margin-bottom: 6px; }
.quiz__scenario .qmark { font-size: 34px; opacity: .25; display:block; margin-bottom: 2px; line-height: 1; }
.quiz__prompt { font-size: 13px; font-weight: 800; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin: 16px 4px 10px; }
.quiz__options { display: grid; gap: 10px; }
.opt {
  width: 100%; text-align: left; padding: 15px 16px; border-radius: 14px; font-size: 15px; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--card-border); color: var(--ink);
  display: flex; align-items: center; gap: 12px; transition: transform .1s var(--ease), border-color .2s, background .2s; }
.opt:active { transform: scale(.98); }
.opt__key { width: 26px; height: 26px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; background: var(--surface-2); color: var(--soft); transition: all .2s; }
.opt__mark { margin-left: auto; font-size: 18px; opacity: 0; transition: opacity .2s; }
.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.correct .opt__key { background: var(--ok); color: #fff; }
.opt.correct .opt__mark { opacity: 1; color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .opt__key { background: var(--bad); color: #fff; }
.opt.wrong .opt__mark { opacity: 1; color: var(--bad); }
.opt.locked { pointer-events: none; }
.opt.locked.dim { opacity: .5; }
.quiz__hint { margin-top: 12px; font-size: 13px; color: var(--faint); text-align: center; }
.quiz__explain {
  margin-top: 14px; padding: 14px 15px; border-radius: 14px; font-size: 14px;
  background: var(--surface-2); border-left: 3px solid var(--accent);
  animation: rise .35s var(--ease) both; }
.quiz__explain b { color: var(--accent); }
.quiz__next { margin-top: 16px; }

/* quiz result */
.result { text-align: center; padding: 26px 18px; }
.result__emoji { font-size: 60px; }
.result__score { font-size: 44px; font-weight: 900; letter-spacing: -.02em; margin-top: 6px;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result__label { font-size: 15px; color: var(--soft); margin-top: 4px; }
.result__msg { font-size: 15px; margin-top: 14px; text-wrap: pretty; }
.result__actions { margin-top: 22px; display: grid; gap: 10px; }

/* ============================================================
   Glossary
   ============================================================ */
.search {
  position: sticky; top: calc(var(--sat) + 52px); z-index: 20; margin-bottom: 14px;
  padding: 8px 0; background: color-mix(in srgb, var(--bg) 88%, transparent); }
.search__box { display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--card-border); border-radius: 14px; }
.search__box svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--faint); }
.search__box input { flex: 1; border: none; background: none; color: var(--ink);
  font-size: 16px; padding: 13px 0; font-family: inherit; }
.search__box input::placeholder { color: var(--faint); }
.search__clear { color: var(--faint); font-size: 22px; display:none; flex: 0 0 auto;
  width: var(--tap); height: var(--tap); margin-right: -8px; place-items: center; }
.search__box.has-text .search__clear { display: grid; }

.glossary { display: grid; gap: 8px; }
.gterm { padding: 0; overflow: hidden; }
.gterm__btn { width: 100%; text-align: left; padding: 14px 15px; display: flex; align-items: center; gap: 10px; }
.gterm__term { font-size: 15px; font-weight: 700; flex: 1; }
.gterm__chev { color: var(--faint); font-size: 15px; transition: transform .25s var(--ease); }
.gterm.is-open .gterm__chev { transform: rotate(90deg); }
.gterm__def { overflow: hidden; }
.gterm__def:not([hidden]) { animation: gdrop .22s var(--ease) both; }
@keyframes gdrop { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.gterm__def p { padding: 0 15px 14px; font-size: 14px; color: var(--soft); }
.glossary__empty { text-align: center; color: var(--faint); padding: 40px 20px; font-size: 14px; }
.glossary__count { font-size: 12px; color: var(--faint); margin: 0 4px 10px; }

/* ============================================================
   Resources / More
   ============================================================ */
.resgroup { padding: 16px; }
.resgroup h3 { font-size: 16px; font-weight: 800; }
.resgroup p.note { font-size: 13px; color: var(--soft); margin-top: 4px; margin-bottom: 12px; }
.reslink {
  display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: 12px;
  background: var(--surface-2); font-size: 14px; font-weight: 600; transition: transform .1s var(--ease); }
.reslink + .reslink { margin-top: 8px; }
.reslink:active { transform: scale(.98); }
.reslink__ico { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-solid); font-size: 16px; }
.reslink__label { flex: 1; min-width: 0; }
.reslink__ext { color: var(--faint); font-size: 15px; }

.settings { padding: 6px; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px; }
.setrow + .setrow { border-top: 1px solid var(--line); }
.setrow__label { font-size: 14.5px; font-weight: 600; }
.setrow__sub { font-size: 12px; color: var(--faint); margin-top: 2px; }
.toggle { width: 54px; height: 32px; border-radius: 999px; background: var(--surface-2); position: relative; flex: 0 0 auto;
  transition: background .25s; border: 1px solid var(--card-border); }
.toggle::before { content: ""; position: absolute; inset: -7px -8px; } /* expand hit area to >=44px */
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: transform .25s var(--ease); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.toggle.on { background: var(--brand-2); }
.toggle.on::after { transform: translateX(22px); }
.btn-reset { width: 100%; padding: 13px; border-radius: 13px; font-weight: 700; font-size: 14px;
  color: var(--bad); background: var(--bad-bg); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent);
  transition: transform .12s var(--ease); }
.btn-reset:active { transform: scale(.97); }

.footnote { text-align: center; font-size: 12px; color: var(--faint); margin-top: 22px; padding: 0 20px; text-wrap: pretty; }

/* ============================================================
   Motion & utility
   ============================================================ */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.enter > * { animation: rise .5s var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: .05s; }
.enter > *:nth-child(3) { animation-delay: .1s; }
.enter > *:nth-child(4) { animation-delay: .15s; }
.enter > *:nth-child(5) { animation-delay: .2s; }
.enter > *:nth-child(n+6) { animation-delay: .25s; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .qc__inner { transition: none; }
}

/* Light theme: vivid accents fail contrast as TEXT on white surfaces — use the deeper shade. */
:root[data-theme="light"] .mcard__kicker,
:root[data-theme="light"] .qc__face--front .qc__tag,
:root[data-theme="light"] .quiz__explain b { color: var(--accent-deep, var(--accent)); }
:root[data-theme="light"] .reader__kicker { color: var(--accent-deep, var(--accent)); }
:root[data-theme="light"] .hero__badge { color: #6d28d9; }
:root[data-theme="light"] .dir:nth-child(1) h4 { color: #0e7490; }
:root[data-theme="light"] .dir:nth-child(2) h4 { color: #be185d; }

/* wider screens: a touch more breathing room */
@media (min-width: 560px) {
  .terms { grid-template-columns: 1fr 1fr; }
  .terms .term { grid-column: auto; }
}
