/* =============================================================================
   BCBA Study OS, Design System
   One stylesheet, no frameworks, no CDN. Theming via CSS custom properties on
   [data-theme]. Mobile-first with progressive enhancement at >900px.
   ========================================================================== */

/* ---- Design tokens -------------------------------------------------------- */
:root {
  /* Brand ramp (indigo→violet→teal accents) */
  --brand-50:#eef2ff; --brand-100:#e0e7ff; --brand-200:#c7d2fe; --brand-300:#a5b4fc;
  --brand-400:#818cf8; --brand-500:#6366f1; --brand-600:#4f46e5; --brand-700:#4338ca;
  --teal-400:#2dd4bf; --teal-500:#14b8a6; --teal-600:#0d9488;
  --amber-400:#fbbf24; --amber-500:#f59e0b;
  --rose-400:#fb7185;  --rose-500:#f43f5e;  --rose-600:#e11d48;
  --green-400:#34d399; --green-500:#10b981; --green-600:#059669;

  --radius-xs:6px; --radius-sm:10px; --radius:14px; --radius-lg:20px; --radius-xl:28px;
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-5:24px;
  --space-6:32px; --space-7:48px; --space-8:64px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1180px;
  --sidebar-w: 268px;

  --ease: cubic-bezier(.22,.61,.36,1);
  --transition: 180ms var(--ease);

  --fs: 16px; /* base font-size, scaled by Settings */
}

/* ---- Light theme (default) ------------------------------------------------ */
:root, [data-theme="light"] {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --bg-elev-2: #fbfbfe;
  --bg-sunken: #eef0f7;
  --ink: #161a2b;
  --ink-soft: #444a62;
  --ink-mute: #6b7187;
  --line: #e4e7f0;
  --line-strong:#d2d7e6;
  --brand: var(--brand-600);
  --brand-ink: #ffffff;
  --accent: var(--teal-600);
  --shadow-sm: 0 1px 2px rgba(20,24,48,.06), 0 1px 3px rgba(20,24,48,.05);
  --shadow: 0 4px 16px rgba(20,24,48,.08), 0 2px 6px rgba(20,24,48,.05);
  --shadow-lg: 0 18px 50px rgba(20,24,48,.14);
  --ring: 0 0 0 3px rgba(99,102,241,.35);
  --good: var(--green-600); --good-bg:#e7f8f0;
  --bad: var(--rose-600);   --bad-bg:#fdecef;
  --warn: var(--amber-500); --warn-bg:#fef6e6;
  --info: var(--brand-600); --info-bg:#eceefe;
  --glass: rgba(255,255,255,.72);
}

/* ---- Dark theme ----------------------------------------------------------- */
[data-theme="dark"] {
  --bg: #0c0e16;
  --bg-elev: #151826;
  --bg-elev-2: #1b1f30;
  --bg-sunken: #0f111b;
  --ink: #eef0fa;
  --ink-soft: #c2c7db;
  --ink-mute: #8b91a9;
  --line: #262b3e;
  --line-strong:#333a52;
  --brand: var(--brand-400);
  --brand-ink: #0c0e16;
  --accent: var(--teal-400);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 8px 24px rgba(0,0,0,.45);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
  --ring: 0 0 0 3px rgba(129,140,248,.45);
  --good: var(--green-400); --good-bg:#0f2a22;
  --bad: var(--rose-400);   --bad-bg:#2c1620;
  --warn: var(--amber-400); --warn-bg:#2a2310;
  --info: var(--brand-400); --info-bg:#181d33;
  --glass: rgba(21,24,38,.72);
}

/* ---- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { font-size: var(--fs); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.25em; }
h1,h2,h3,h4 { line-height: 1.2; font-weight: 750; letter-spacing: -0.01em; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }

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

/* ---- App shell ------------------------------------------------------------ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  background: var(--bg-elev); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
}
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--brand-500), var(--teal-500));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: var(--shadow-sm);
}
.brand .brand-name { font-weight: 800; font-size: 1.02rem; letter-spacing: -.02em; }
.brand .brand-sub { font-size: .7rem; color: var(--ink-mute); letter-spacing: .08em; text-transform: uppercase; }

.nav { flex: 1; overflow-y: auto; padding: var(--space-2) var(--space-3) var(--space-5); }
.nav-group-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-mute);
  padding: var(--space-4) var(--space-3) var(--space-2); font-weight: 700;
}
.nav-link {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
  padding: 9px var(--space-3); border-radius: var(--radius-sm); color: var(--ink-soft);
  font-weight: 600; font-size: .92rem; text-align: left; transition: var(--transition);
  border: 1px solid transparent;
}
.nav-link:hover { background: var(--bg-sunken); color: var(--ink); text-decoration: none; }
.nav-link.active { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
[data-theme="dark"] .nav-link.active { background: var(--info-bg); color: var(--brand-300); border-color: var(--line-strong); }
.nav-link .ico { width: 20px; text-align: center; font-size: 1.05rem; flex: none; }
.nav-link .badge { margin-left: auto; }

.sidebar-foot { padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--line); }

/* ---- Topbar (mobile) ------------------------------------------------------ */
.topbar {
  display: none; align-items: center; gap: var(--space-3);
  /* safe-area top inset: in the installed PWA the canvas extends under the
     status bar/notch, so the bar reserves that space on any device shape. */
  padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-4) var(--space-3);
  position: sticky; top: 0; z-index: 50;
  background: var(--glass); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center;
  color: var(--ink-soft); border: 1px solid var(--line); background: var(--bg-elev);
  font-size: 1.15rem; transition: var(--transition);
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--ink); }

/* ---- Main ----------------------------------------------------------------- */
.main { min-width: 0; }
.view { max-width: var(--maxw); margin: 0 auto; padding: var(--space-6) var(--space-6) var(--space-8); }
@media (max-width: 700px){ .view { padding: var(--space-4) var(--space-4) var(--space-8); } }

.page-head { margin-bottom: var(--space-5); }
.page-head .eyebrow { color: var(--brand); font-weight: 700; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.page-head h1 { font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.1rem); margin-top: 4px; }
.page-head p.lead { color: var(--ink-mute); margin-top: 6px; max-width: 70ch; }

/* ---- Cards / surfaces ----------------------------------------------------- */
.card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: var(--space-5);
}
.card.pad-lg { padding: var(--space-6); }
.card.flush { padding: 0; overflow: hidden; }
.surface-2 { background: var(--bg-elev-2); }
.grid { display: grid; gap: var(--space-4); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 820px){ .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } .grid.auto{grid-template-columns:1fr;} }

.row { display: flex; align-items: center; gap: var(--space-3); }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack.sm { gap: var(--space-2); }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 650; font-size: .92rem;
  border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--ink);
  transition: var(--transition); white-space: nowrap;
}
.btn:hover { background: var(--bg-sunken); transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn[disabled]{ opacity: .5; pointer-events: none; }
.btn.primary { background: linear-gradient(135deg, var(--brand-600), var(--brand-500)); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
[data-theme="dark"] .btn.primary { background: linear-gradient(135deg, var(--brand-500), var(--brand-400)); color: #0c0e16; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.accent { background: linear-gradient(135deg, var(--teal-600), var(--teal-500)); color:#fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-sunken); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 6px 11px; font-size: .82rem; }
.btn.lg { padding: 13px 22px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn-group { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.btn-group .btn { border: none; border-radius: 0; border-right: 1px solid var(--line); }
.btn-group .btn:last-child { border-right: none; }

/* ---- Badges / chips ------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; background: var(--bg-sunken); color: var(--ink-soft);
  border: 1px solid var(--line);
}
.badge.brand { background: var(--info-bg); color: var(--brand); border-color: transparent; }
.badge.good  { background: var(--good-bg); color: var(--good); border-color: transparent; }
.badge.bad   { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge.warn  { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.dot::before { content:""; width:7px; height:7px; border-radius:50%; background: currentColor; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--ink-soft);
  font-weight: 600; font-size: .85rem; transition: var(--transition); cursor: pointer;
}
.chip:hover { background: var(--bg-sunken); color: var(--ink); }
.chip.active { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* domain color coding */
.dom-A{--d:#6366f1} .dom-B{--d:#8b5cf6} .dom-C{--d:#0ea5e9} .dom-D{--d:#14b8a6}
.dom-E{--d:#f43f5e} .dom-F{--d:#f59e0b} .dom-G{--d:#10b981} .dom-H{--d:#ec4899} .dom-I{--d:#64748b}
.dom-pill {
  display:inline-flex; align-items:center; justify-content:center; min-width:26px; height:26px;
  padding:0 7px; border-radius:8px; font-weight:800; font-size:.8rem; color:#fff;
  background: var(--d, var(--brand)); flex:none;
}
.dom-bar { height: 4px; border-radius: 4px; background: var(--d, var(--brand)); }

/* ---- Progress ------------------------------------------------------------- */
.progress { height: 9px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-500), var(--teal-500)); transition: width 600ms var(--ease); }
.progress.thin { height: 6px; }

.ring { --val: 0; --size: 116px; width: var(--size); height: var(--size); position: relative; flex: none; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring .track { fill: none; stroke: var(--bg-sunken); }
.ring .meter { fill: none; stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 800ms var(--ease); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .ring-num { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.ring .ring-cap { font-size: .68rem; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .08em; }

/* ---- Stat tiles ----------------------------------------------------------- */
.stat { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); }
.stat .stat-top { display:flex; align-items:center; gap:8px; color: var(--ink-mute); font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; }
.stat .stat-val { font-size: 1.9rem; font-weight: 820; letter-spacing: -.03em; margin-top: 4px; }
.stat .stat-sub { font-size: .82rem; color: var(--ink-mute); }

/* ---- Callouts (lesson content) ------------------------------------------- */
.callout { border-radius: var(--radius-sm); padding: var(--space-4); margin: var(--space-4) 0; border: 1px solid var(--line); border-left-width: 4px; background: var(--bg-elev-2); }
.callout .callout-h { font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout.trap   { border-left-color: var(--rose-500); background: var(--bad-bg); }
.callout.trap .callout-h { color: var(--bad); }
.callout.example{ border-left-color: var(--green-500); background: var(--good-bg); }
.callout.example .callout-h { color: var(--good); }
.callout.nonexample{ border-left-color: var(--amber-500); background: var(--warn-bg); }
.callout.nonexample .callout-h { color: var(--warn); }
.callout.discrim{ border-left-color: var(--brand-500); background: var(--info-bg); }
.callout.discrim .callout-h { color: var(--brand); }
.callout.clinical{ border-left-color: var(--teal-500); }
.callout.clinical .callout-h { color: var(--accent); }
.callout.key { border-left-color: var(--brand-500); }
.callout.mnemonic { border-left-color: var(--amber-500); background: var(--warn-bg); }
.callout.mnemonic .callout-h { color: var(--warn); }

/* ---- Lesson typography ---------------------------------------------------- */
.prose { font-size: 1.0rem; color: var(--ink-soft); }
.prose > * + * { margin-top: var(--space-4); }
.prose h2 { font-size: 1.45rem; color: var(--ink); margin-top: var(--space-6); padding-top: var(--space-2); }
.prose h3 { font-size: 1.15rem; color: var(--ink); margin-top: var(--space-5); }
.prose h4 { font-size: 1.0rem; color: var(--ink); }
.prose p, .prose li { color: var(--ink-soft); }
.prose strong { color: var(--ink); font-weight: 700; }
.prose code { font-family: var(--font-mono); font-size: .88em; background: var(--bg-sunken); padding: 1px 6px; border-radius: 6px; color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 4px; }
.prose .term { color: var(--brand); font-weight: 700; }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: var(--space-4) 0; }
.prose th, .prose td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose thead th { background: var(--bg-sunken); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-mute); }
.prose tbody tr:hover { background: var(--bg-elev-2); }
.prose blockquote { border-left: 3px solid var(--brand-300); padding-left: var(--space-4); color: var(--ink-mute); font-style: italic; }
.formula { font-family: var(--font-mono); background: var(--bg-sunken); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); display: inline-block; }

/* ---- Flashcard ------------------------------------------------------------ */
.fc-stage { perspective: 1600px; }
.flashcard {
  position: relative; width: 100%; min-height: 320px; cursor: pointer;
  transform-style: preserve-3d; transition: transform 520ms var(--ease);
}
.flashcard.flipped { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; padding: var(--space-6);
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.fc-back { transform: rotateY(180deg); background: var(--bg-elev-2); }
.fc-meta { display: flex; align-items: center; gap: 8px; margin-bottom: var(--space-4); }
.fc-body { flex: 1; display: grid; place-items: center; text-align: center; }
.fc-front-q { font-size: 1.4rem; font-weight: 700; line-height: 1.35; }
.fc-back .fc-answer { text-align: left; align-self: stretch; font-size: 1.02rem; color: var(--ink-soft); }
.fc-back .fc-answer strong { color: var(--ink); }
.fc-hint { text-align: center; color: var(--ink-mute); font-size: .8rem; margin-top: var(--space-4); }
.fc-rate { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--space-2); margin-top: var(--space-4); }
.fc-rate .btn { flex-direction: column; gap: 2px; padding: 10px 6px; }
.fc-rate .btn small { font-size: .68rem; color: var(--ink-mute); font-weight: 600; }
.fc-rate .again { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.fc-rate .good { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.fc-rate .easy { border-color: color-mix(in srgb, var(--brand-500) 45%, var(--line)); }

/* ---- Quiz / exam ---------------------------------------------------------- */
.q-stem { font-size: 1.12rem; font-weight: 650; color: var(--ink); line-height: 1.5; }
.q-scenario { background: var(--bg-elev-2); border-left: 3px solid var(--brand-300); padding: var(--space-4); border-radius: var(--radius-sm); margin-bottom: var(--space-4); color: var(--ink-soft); }
.options { display: grid; gap: var(--space-3); margin-top: var(--space-5); }
.option {
  display: flex; align-items: flex-start; gap: var(--space-3); width: 100%; text-align: left;
  padding: var(--space-4); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--bg-elev); transition: var(--transition);
}
.option:hover:not(.locked) { border-color: var(--brand-400); background: var(--bg-elev-2); }
.option .opt-key { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-weight: 800; font-size: .85rem; color: var(--ink-soft); }
.option.selected { border-color: var(--brand-500); background: var(--info-bg); }
.option.selected .opt-key { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.option.correct { border-color: var(--good); background: var(--good-bg); }
.option.correct .opt-key { background: var(--good); color: #fff; border-color: transparent; }
.option.incorrect { border-color: var(--bad); background: var(--bad-bg); }
.option.incorrect .opt-key { background: var(--bad); color: #fff; border-color: transparent; }
.option .opt-text { flex: 1; padding-top: 2px; }
.option .opt-rationale { margin-top: 8px; font-size: .88rem; color: var(--ink-mute); border-top: 1px dashed var(--line); padding-top: 8px; display: none; }
.option.revealed .opt-rationale { display: block; }
.option.locked { cursor: default; }

.q-explain { margin-top: var(--space-5); border-radius: var(--radius-sm); padding: var(--space-4); border: 1px solid var(--line); background: var(--bg-elev-2); }
.q-explain.win { border-left: 4px solid var(--good); }
.q-explain.lose { border-left: 4px solid var(--bad); }

.q-progress-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.q-progress-head .progress { flex: 1; }

/* exam navigator grid */
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px,1fr)); gap: 8px; }
.exam-cell {
  aspect-ratio: 1; border-radius: 8px; border: 1.5px solid var(--line-strong); background: var(--bg-elev);
  font-weight: 700; font-size: .82rem; color: var(--ink-soft); display: grid; place-items: center; position: relative;
}
.exam-cell.answered { background: var(--info-bg); border-color: var(--brand-400); color: var(--brand); }
.exam-cell.flagged::after { content:""; position:absolute; top:-3px; right:-3px; width:10px; height:10px; border-radius:50%; background: var(--amber-500); border:2px solid var(--bg-elev); }
.exam-cell.current { box-shadow: var(--ring); }
.exam-cell.correct { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.exam-cell.wrong { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }

.timer { font-family: var(--font-mono); font-weight: 700; font-size: 1.05rem; padding: 6px 12px; border-radius: var(--radius-sm); background: var(--bg-sunken); border: 1px solid var(--line); }
.timer.warn { color: var(--warn); background: var(--warn-bg); }
.timer.crit { color: var(--bad); background: var(--bad-bg); }

/* ---- Tables / lists generic ---------------------------------------------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }

/* ---- Tabs ----------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: var(--space-5); overflow-x: auto; }
.tab { padding: 10px 14px; font-weight: 650; color: var(--ink-mute); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---- Inputs --------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 650; font-size: .85rem; color: var(--ink-soft); }
.field .hint { font-size: .78rem; color: var(--ink-mute); }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong);
  background: var(--bg-elev); transition: var(--transition);
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-400); box-shadow: var(--ring); outline: none; }
textarea { resize: vertical; min-height: 90px; font-family: inherit; }
.search-box { position: relative; }
.search-box input { padding-left: 38px; }
.search-box .s-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--bg-sunken); border: 1px solid var(--line-strong); position: relative; transition: var(--transition); }
.switch .track::after { content:""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: var(--transition); }
.switch input:checked + .track { background: var(--brand); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ---- Modal / toast / overlay --------------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(8,10,18,.55); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: var(--space-4); animation: fade .18s var(--ease); }
.modal { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-width: 540px; width: 100%; max-height: 88vh; overflow: auto; animation: pop .22s var(--ease); }
.modal .modal-head { padding: var(--space-5) var(--space-5) var(--space-3); display:flex; align-items:center; gap:12px; }
.modal .modal-body { padding: 0 var(--space-5) var(--space-3); }
.modal .modal-foot { padding: var(--space-4) var(--space-5); display: flex; gap: var(--space-3); justify-content: flex-end; border-top: 1px solid var(--line); margin-top: var(--space-3); }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast { background: var(--bg-elev); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 12px 16px; display: flex; align-items: flex-start; gap: 10px; animation: slideIn .25s var(--ease); }
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast .t-ico { font-size: 1.1rem; }
.toast .t-msg { font-size: .9rem; }

/* confetti-free celebration burst */
.celebrate { animation: celebrate .6s var(--ease); }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97) } to { opacity: 1; transform: none } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px) } to { opacity: 1; transform: none } }
@keyframes celebrate { 0%{transform:scale(1)} 35%{transform:scale(1.04)} 100%{transform:scale(1)} }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.45} }
.skeleton { background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--bg-elev-2) 50%, var(--bg-sunken) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { from{background-position:200% 0} to{background-position:-200% 0} }

/* ---- Domain map ----------------------------------------------------------- */
.dommap-card { border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--bg-elev); transition: var(--transition); text-align: left; width: 100%; }
.dommap-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.dommap-card .dm-top { height: 6px; background: var(--d); }
.dommap-card .dm-in { padding: var(--space-4); }
.dommap-card h3 { font-size: 1.02rem; }
.dommap-card .dm-weight { color: var(--ink-mute); font-size: .8rem; }

/* TCO coverage table */
.cov-task { display: grid; grid-template-columns: 64px 1fr auto; gap: var(--space-3); align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.cov-task:hover { background: var(--bg-elev-2); }
.cov-task .cov-meta { display: flex; gap: 6px; }
.cov-dot { width: 9px; height: 9px; border-radius: 50%; }
.cov-dot.on { background: var(--good); } .cov-dot.off { background: var(--line-strong); }

/* mastery meter segmented */
.mastery-seg { display: flex; gap: 3px; }
.mastery-seg span { flex: 1; height: 8px; border-radius: 3px; background: var(--bg-sunken); }
.mastery-seg span.on1 { background: var(--rose-400); }
.mastery-seg span.on2 { background: var(--amber-400); }
.mastery-seg span.on3 { background: var(--green-500); }

/* ---- Calculators ---------------------------------------------------------- */
.calc-out { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; color: var(--brand); }
.calc-steps { font-family: var(--font-mono); font-size: .85rem; color: var(--ink-mute); white-space: pre-wrap; }

/* graphs */
.graph-card svg { width: 100%; height: auto; background: var(--bg-elev-2); border-radius: var(--radius-sm); }
.axis { stroke: var(--line-strong); stroke-width: 1.5; }
.gridline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.dataline { fill: none; stroke: var(--brand-500); stroke-width: 2.5; }
.datapt { fill: var(--bg-elev); stroke: var(--brand-600); stroke-width: 2; }
.phase-line { stroke: var(--ink-mute); stroke-width: 1.5; stroke-dasharray: 5 4; }
.phase-label { fill: var(--ink-soft); font-size: 12px; font-weight: 700; }
.axis-label { fill: var(--ink-mute); font-size: 11px; }

/* ---- Helpers -------------------------------------------------------------- */
.muted { color: var(--ink-mute); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.center { text-align: center; }
.tar { text-align: right; }
.mono { font-family: var(--font-mono); }
.hide { display: none !important; }
.nowrap { white-space: nowrap; }
.mt-0{margin-top:0}.mt-2{margin-top:var(--space-2)}.mt-4{margin-top:var(--space-4)}.mt-5{margin-top:var(--space-5)}.mt-6{margin-top:var(--space-6)}
.mb-2{margin-bottom:var(--space-2)}.mb-4{margin-bottom:var(--space-4)}
.divider { height: 1px; background: var(--line); margin: var(--space-5) 0; border: none; }
.kbd { font-family: var(--font-mono); font-size: .76rem; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--bg-elev); color: var(--ink-soft); }
.empty { text-align: center; padding: var(--space-7) var(--space-4); color: var(--ink-mute); }
.empty .big { font-size: 2.4rem; margin-bottom: 8px; }

.disclaimer-banner { background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line)); color: var(--ink-soft); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .82rem; }

/* ---- Responsive shell ----------------------------------------------------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; height: 100vh;
    transform: translateX(-102%); transition: transform .26s var(--ease); box-shadow: var(--shadow-lg);
  }
  .app.nav-open .sidebar { transform: none; }
  .topbar { display: flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
}
@media (min-width: 901px){ .scrim { display: none; } .topbar { display: none; } }

/* ---- Print (study sheets) ------------------------------------------------- */
@media print {
  .sidebar, .topbar, .toast-wrap, .no-print, .fc-rate, .nav, .scrim { display: none !important; }
  .app { display: block; }
  .view { max-width: none; padding: 0; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .callout { break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
  .prose h2 { break-after: avoid; }
}

/* =============================================================================
   Cognitive Atelier foundation
   The study system keeps its original component contracts while sharing one
   gallery-inspired visual language across every view and interaction.
   ============================================================================= */

:root {
  --brand-50:#f5ede8; --brand-100:#ead8cc; --brand-200:#dbbca8; --brand-300:#c99676;
  --brand-400:#b87655; --brand-500:#a65f43; --brand-600:#8b4b35; --brand-700:#6e392a;
  --teal-400:#789e98; --teal-500:#537d78; --teal-600:#3d625e;
  --amber-400:#d2ad69; --amber-500:#b78a43;
  --rose-400:#c97978; --rose-500:#b45d5c; --rose-600:#984746;
  --green-400:#81a17c; --green-500:#607f5d; --green-600:#486545;
  --radius-xs:4px; --radius-sm:8px; --radius:12px; --radius-lg:18px; --radius-xl:24px;
  --font-sans: "Avenir Next", Avenir, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Baskerville, Georgia, serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --maxw: 1380px;
  --sidebar-w: 252px;
  --hero-image: none;
  --hero-position: center center;
  --section-art-position: center 52%;
  --workspace-art-position: center center;
  --workspace-art-opacity: .075;
  --ease: cubic-bezier(.2,.75,.2,1);
  --transition: 190ms var(--ease);
}

:root, [data-theme="light"] {
  --bg:#eeeae2;
  --bg-elev:#f8f5ef;
  --bg-elev-2:#f2eee7;
  --bg-sunken:#e5e0d6;
  --ink:#202623;
  --ink-soft:#4e5651;
  --ink-mute:#777c77;
  --line:#d7d1c7;
  --line-strong:#c6beb2;
  --brand:var(--brand-600);
  --brand-ink:#fffaf2;
  --accent:var(--teal-600);
  --sidebar:#1d2927;
  --sidebar-ink:#f1ede5;
  --sidebar-muted:#aeb8b3;
  --shadow-sm:0 1px 1px rgba(41,39,34,.05);
  --shadow:0 14px 38px rgba(45,42,36,.08);
  --shadow-lg:0 28px 70px rgba(28,30,28,.22);
  --ring:0 0 0 3px rgba(166,95,67,.24);
  --good:var(--green-600); --good-bg:#e7eee4;
  --bad:var(--rose-600); --bad-bg:#f3e4e2;
  --warn:var(--amber-500); --warn-bg:#f3ead8;
  --info:var(--teal-600); --info-bg:#e3ebe8;
  --glass:rgba(248,245,239,.88);
}

[data-theme="dark"] {
  --bg:#151b1a;
  --bg-elev:#202826;
  --bg-elev-2:#26302d;
  --bg-sunken:#121817;
  --ink:#f2eee6;
  --ink-soft:#ccd1cb;
  --ink-mute:#939e98;
  --line:#35413e;
  --line-strong:#47534f;
  --brand:var(--brand-300);
  --brand-ink:#20150f;
  --accent:var(--teal-400);
  --sidebar:#101817;
  --sidebar-ink:#f2eee6;
  --sidebar-muted:#8e9c96;
  --shadow-sm:0 1px 2px rgba(0,0,0,.18);
  --shadow:0 16px 42px rgba(0,0,0,.24);
  --shadow-lg:0 30px 74px rgba(0,0,0,.42);
  --ring:0 0 0 3px rgba(201,150,118,.25);
  --good:var(--green-400); --good-bg:#23332a;
  --bad:var(--rose-400); --bad-bg:#3b2627;
  --warn:var(--amber-400); --warn-bg:#382f20;
  --info:var(--teal-400); --info-bg:#223532;
  --glass:rgba(21,27,26,.88);
}

body {
  background:var(--bg);
  font-family:var(--font-sans);
  letter-spacing:-.006em;
}

h1, h2, h3, h4 { letter-spacing:-.025em; }
h1, .page-head h1 { font-family:var(--font-display); font-weight:400; }
h2, h3 { font-weight:600; }
a { color:var(--brand); }
::selection { background:var(--brand-200); color:#2b1e18; }

.ui-icon {
  width:1.15em;
  height:1.15em;
  fill:none;
  stroke:currentColor;
  stroke-width:1.65;
  stroke-linecap:round;
  stroke-linejoin:round;
  flex:none;
}

/* Shell and navigation */
.app { grid-template-columns:var(--sidebar-w) minmax(0,1fr); }
.sidebar {
  isolation:isolate;
  overflow:hidden;
  background:
    radial-gradient(circle at 12% 0%,rgba(120,158,152,.09),transparent 36%),
    linear-gradient(180deg,color-mix(in srgb,var(--sidebar) 94%,#243a35),var(--sidebar) 28%),
    var(--sidebar);
  color:var(--sidebar-ink);
  border-right:0;
}
.sidebar::after {
  content:"";
  position:absolute;
  z-index:1;
  inset:0 0 0 auto;
  width:1px;
  background:linear-gradient(180deg,transparent 3%,rgba(201,150,118,.55) 24%,rgba(120,158,152,.38) 67%,transparent 97%);
  opacity:.72;
  pointer-events:none;
}
.brand {
  color:inherit;
  padding:28px 24px 22px;
  gap:13px;
  text-decoration:none;
}
.brand:hover { color:inherit; text-decoration:none; }
.brand .logo {
  width:42px;
  height:42px;
  flex:none;
  border-radius:12px;
  overflow:hidden;
  box-shadow:var(--shadow-sm);
}
/* Compact mark = mini app icon; text B uses the brand display serif (see #logoField/#ringGrad defs) */
.brand .logo .logo-mark,
.mini-nav-logo .logo-mark { width:100%; height:100%; display:block; }
.logo-mark text { font-family:var(--font-display); font-weight:700; }
.brand .brand-name { font-size:.96rem; font-weight:650; letter-spacing:.01em; }
.brand .brand-sub { color:var(--sidebar-muted); font-size:.62rem; letter-spacing:.15em; }
.nav { padding:6px 14px 26px; scrollbar-color:rgba(255,255,255,.18) transparent; }
.nav-group-label {
  color:var(--sidebar-muted);
  font-size:.59rem;
  font-weight:650;
  letter-spacing:.18em;
  padding:17px 12px 7px;
}
.nav-link {
  color:var(--sidebar-muted);
  min-height:42px;
  padding:9px 11px;
  border:0;
  border-radius:7px;
  font-size:.86rem;
  font-weight:520;
}
.nav-link:hover { background:rgba(255,255,255,.06); color:var(--sidebar-ink); }
.nav-link.active,
[data-theme="dark"] .nav-link.active {
  background:rgba(234,216,204,.13);
  color:var(--sidebar-ink);
  border:0;
}
.nav-link.active::before {
  content:"";
  width:3px;
  height:17px;
  border-radius:4px;
  background:var(--brand-300);
  margin-left:-11px;
  margin-right:8px;
}
.nav-link .ico { width:19px; font-size:1rem; }
.nav-link .badge.brand { margin-left:auto; background:var(--brand-400); color:#fff; }
.sidebar-foot { padding:12px 15px 18px; border-color:rgba(255,255,255,.1); }
.sidebar-foot .btn { color:var(--sidebar-muted); justify-content:flex-start; }
.sidebar-foot .btn:hover { background:rgba(255,255,255,.06); color:var(--sidebar-ink); }

.main { min-width:0; background:var(--bg); }
.view { max-width:var(--maxw); padding:28px clamp(22px,3vw,52px) 80px; }
.topbar {
  min-height:64px;
  padding:10px 16px;
  background:color-mix(in srgb,var(--sidebar) 93%,transparent);
  color:var(--sidebar-ink);
  border:0;
  backdrop-filter:blur(18px);
}
.topbar .brand { padding:0!important; }
.topbar .brand .logo { width:32px; height:32px; font-size:16px; }
.topbar .icon-btn { color:var(--sidebar-ink); border-color:rgba(255,255,255,.14); background:rgba(255,255,255,.05); }

/* Editorial page framing */
.page-head {
  position:relative;
  margin-bottom:32px;
  padding:10px 0 27px;
  border-bottom:1px solid var(--line);
}
.page-head::after {
  content:"";
  position:absolute;
  bottom:-1px;
  left:0;
  width:72px;
  height:1px;
  background:var(--brand-500);
}
.page-head .eyebrow,
.eyebrow,
.editorial-label {
  color:var(--brand);
  font-size:.66rem;
  font-weight:700;
  letter-spacing:.15em;
  text-transform:uppercase;
}
.page-head h1 { font-size:clamp(2.2rem,1.6rem + 2.2vw,4rem); margin-top:9px; }
.page-head p.lead { max-width:76ch; margin-top:10px; color:var(--ink-soft); }

@media (min-width:901px) {
  .main {
    position:relative;
    isolation:isolate;
    min-height:100vh;
  }
  .main::before {
    content:"";
    position:fixed;
    z-index:0;
    inset:0 0 0 var(--sidebar-w);
    background-image:var(--hero-image);
    background-position:var(--workspace-art-position);
    background-size:cover;
    opacity:var(--workspace-art-opacity);
    filter:saturate(.72) contrast(.9);
    -webkit-mask-image:linear-gradient(90deg,transparent 0%,#000 26%,#000 100%);
    mask-image:linear-gradient(90deg,transparent 0%,#000 26%,#000 100%);
    pointer-events:none;
  }
  [data-theme="dark"] .main::before { filter:saturate(.62) brightness(.72); }
  body[data-route="dashboard"] .main::before { opacity:0; }
  .view { position:relative; z-index:1; }

  .page-head {
    isolation:isolate;
    overflow:hidden;
    display:flex;
    min-height:clamp(230px,24vw,310px);
    flex-direction:column;
    justify-content:flex-end;
    margin-bottom:38px;
    padding:clamp(34px,4vw,56px);
    color:#fffaf3;
    background-color:#26322f;
    background-image:var(--hero-image);
    background-position:var(--section-art-position);
    background-size:cover;
    border:0;
    border-radius:3px;
    box-shadow:var(--shadow);
  }
  .page-head::before {
    content:"";
    position:absolute;
    z-index:0;
    inset:0;
    background:
      linear-gradient(90deg,rgba(16,25,23,.88) 0%,rgba(18,27,25,.68) 47%,rgba(21,27,25,.22) 100%),
      linear-gradient(0deg,rgba(12,19,18,.72) 0%,transparent 68%);
    pointer-events:none;
  }
  .page-head::after {
    content:"";
    position:absolute;
    z-index:0;
    inset:14px;
    width:auto;
    height:auto;
    border:1px solid rgba(255,250,243,.22);
    background:none;
    pointer-events:none;
  }
  .page-head > * { position:relative; z-index:1; }
  .page-head h1 {
    max-width:19ch;
    color:#fff;
    font-size:clamp(2.7rem,2rem + 2.4vw,4.7rem);
    line-height:.98;
    text-shadow:0 2px 24px rgba(0,0,0,.18);
  }
  .page-head .eyebrow { color:#e7b18c; }
  .page-head p.lead { max-width:70ch; color:rgba(255,250,243,.82); font-size:.96rem; }
  .page-head .breadcrumb { color:rgba(255,250,243,.78); }
  .page-head .breadcrumb:hover,
  .page-head a:not(.btn):not(.chip) { color:#fffaf3; }
  .page-head .chip {
    color:#fffaf3;
    background:rgba(18,28,26,.36);
    border-color:rgba(255,250,243,.26);
    backdrop-filter:blur(8px);
  }
  .page-head .chip:hover { background:rgba(255,250,243,.13); border-color:rgba(255,250,243,.45); }
  .page-head .btn:not(.primary) {
    color:#fffaf3;
    background:rgba(18,28,26,.35);
    border-color:rgba(255,250,243,.28);
    backdrop-filter:blur(8px);
  }
  .page-head .btn:not(.primary):hover { background:rgba(255,250,243,.14); border-color:rgba(255,250,243,.5); }
  .page-head .card {
    color:var(--ink);
    background:color-mix(in srgb,var(--bg-elev) 91%,transparent);
    border-color:rgba(255,255,255,.38);
    box-shadow:0 16px 36px rgba(10,16,15,.18);
    backdrop-filter:blur(14px);
  }
  .page-head.center { align-items:center; text-align:center; }
}

.card,
.stat,
.dommap-card {
  background:var(--bg-elev);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow-sm);
}
.card { padding:24px; }
.card.pad-lg { padding:clamp(24px,3vw,38px); }
.card h3, .card h2 { font-family:var(--font-display); font-weight:400; }
.surface-2 { background:var(--bg-elev-2); }
.grid > * { min-width:0; }
article.card.prose { min-width:0; overflow:hidden; }
article.card.prose table {
  display:block;
  width:100%;
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.lesson-nav > * { min-width:0; }
.lesson-nav .btn { white-space:normal; text-align:left; }

.btn {
  min-height:42px;
  border-radius:999px;
  border-color:var(--line-strong);
  background:transparent;
  font-size:.86rem;
  font-weight:620;
  padding:9px 17px;
}
.btn:hover { background:var(--bg-sunken); border-color:var(--ink-mute); transform:translateY(-1px); }
.btn.primary,
[data-theme="dark"] .btn.primary {
  background:var(--ink);
  color:var(--bg-elev);
  border-color:var(--ink);
  box-shadow:none;
}
.btn.primary:hover { background:var(--brand-600); border-color:var(--brand-600); filter:none; }
.btn.accent { background:var(--teal-600); border-color:var(--teal-600); }
.btn.ghost { border-color:transparent; }
.icon-btn { border-radius:50%; background:var(--bg-elev); }

.badge { border-radius:999px; padding:3px 9px; font-size:.66rem; letter-spacing:.025em; }
.chip {
  border-radius:999px;
  background:transparent;
  font-size:.77rem;
  letter-spacing:.02em;
  padding:7px 12px;
}
.chip.active { background:var(--ink); color:var(--bg-elev); }
.domain-picker .chip { width:46px; height:46px; justify-content:center; padding:0; }
.domain-picker .dom-pill { width:30px; padding:0; }

/* Dashboard artwork and editorial modules */
.dashboard-hero {
  position:relative;
  isolation:isolate;
  min-height:clamp(510px,65vh,700px);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  padding:25px clamp(24px,4vw,58px) 28px;
  color:#fffaf3;
  background-image:var(--hero-image);
  background-position:var(--hero-position);
  background-size:cover;
  border-radius:3px;
  box-shadow:var(--shadow);
}
.dashboard-hero::before {
  content:"";
  position:absolute;
  z-index:-1;
  inset:0;
  background:
    linear-gradient(90deg,rgba(18,28,27,.68) 0%,rgba(19,28,26,.28) 58%,rgba(18,24,23,.32) 100%),
    linear-gradient(0deg,rgba(11,18,17,.64) 0%,transparent 45%,rgba(19,24,23,.18) 100%);
}
.dashboard-hero-top {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  text-transform:uppercase;
  font-size:.66rem;
  font-weight:650;
  letter-spacing:.16em;
}
.dashboard-hero-status { display:flex; align-items:center; gap:9px; }
.dashboard-hero-status::before { content:""; width:7px; height:7px; border-radius:50%; background:#d7a37e; box-shadow:0 0 0 4px rgba(215,163,126,.18); }
.dashboard-hero-copy { margin:auto 0; max-width:820px; padding:60px 0 50px; }
.dashboard-hero-copy > p { margin-bottom:14px; font-size:.82rem; letter-spacing:.08em; }
.dashboard-hero-copy h1 { display:flex; flex-direction:column; color:#fff; line-height:.93; letter-spacing:-.045em; }
.dashboard-hero-copy h1 strong { font-family:var(--font-sans); font-size:clamp(2.6rem,4.8vw,5.35rem); font-weight:650; }
.dashboard-hero-copy h1 em { font-family:var(--font-display); font-size:clamp(2.75rem,5.2vw,5.7rem); font-style:normal; font-weight:400; }
.dashboard-hero-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:32px; }
.hero-action {
  min-height:48px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:11px 19px;
  border:1px solid rgba(255,255,255,.46);
  border-radius:999px;
  color:#fff;
  font-size:.84rem;
  font-weight:620;
  backdrop-filter:blur(8px);
  background:rgba(16,23,22,.16);
}
.hero-action:hover { color:#fff; background:rgba(255,255,255,.15); text-decoration:none; }
.hero-action.primary { color:#1f2826; background:#f4efe7; border-color:#f4efe7; }
.hero-action.primary:hover { background:#fff; }
.dashboard-hero-meta {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:18px;
  padding-top:20px;
  border-top:1px solid rgba(255,255,255,.34);
}
.dashboard-hero-meta > div { display:flex; flex-direction:column; gap:3px; }
.dashboard-hero-meta span { color:rgba(255,255,255,.69); font-size:.61rem; letter-spacing:.14em; text-transform:uppercase; }
.dashboard-hero-meta strong, .dashboard-hero-meta strong a { color:#fff; font-size:.85rem; font-weight:570; }

.dashboard-section { padding:64px 0 12px; }
.section-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:22px; }
.section-heading h2 { margin-top:5px; font-family:var(--font-display); font-size:clamp(1.8rem,1.45rem + 1vw,2.65rem); font-weight:400; }
.section-heading.compact { align-items:center; margin-bottom:18px; }
.section-heading.compact h2 { font-size:1.65rem; }
.text-link { display:inline-flex; align-items:center; gap:8px; color:var(--ink); font-size:.78rem; font-weight:650; }
.text-link .ui-icon { width:15px; transition:transform var(--transition); }
.text-link:hover { color:var(--brand); text-decoration:none; }
.text-link:hover .ui-icon { transform:translateX(3px); }

.dashboard-plan-grid { display:grid; grid-template-columns:minmax(310px,.85fr) minmax(0,1.4fr); gap:16px; }
.readiness-card {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:26px;
  min-height:250px;
  padding:32px;
  background:var(--sidebar);
  color:var(--sidebar-ink);
  border-radius:var(--radius);
}
.readiness-card > div:first-child { max-width:330px; }
.readiness-card .editorial-label { color:var(--brand-200); }
.readiness-card h3 { margin:14px 0 8px; font-family:var(--font-display); font-size:4.2rem; font-weight:400; line-height:.9; }
.readiness-card h3 small { font-size:1.4rem; }
.readiness-card p { color:var(--sidebar-muted); font-size:.84rem; line-height:1.6; }
.readiness-card .ring .track { stroke:rgba(255,255,255,.13); }
.readiness-card .ring-num { color:#fff; }
.readiness-card .ring-cap { color:var(--sidebar-muted); }
.study-metrics { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.study-metric {
  min-width:0;
  min-height:250px;
  display:flex;
  flex-direction:column;
  padding:24px;
  color:var(--ink);
  background:var(--bg-elev);
  border:1px solid var(--line);
  border-radius:var(--radius);
  transition:transform var(--transition),border-color var(--transition),box-shadow var(--transition);
}
.study-metric:hover { color:var(--ink); text-decoration:none; transform:translateY(-3px); border-color:var(--brand-300); box-shadow:var(--shadow); }
.study-metric .metric-icon { width:42px; height:42px; display:grid; place-items:center; border:1px solid var(--line); border-radius:50%; color:var(--brand); margin-bottom:auto; }
.study-metric .editorial-label { margin-top:24px; }
.study-metric strong { margin-top:7px; font-family:var(--font-display); font-size:3rem; font-weight:400; line-height:1; }
.study-metric small { color:var(--ink-mute); margin-top:5px; }
.dashboard-statline { display:grid; grid-template-columns:repeat(4,1fr); margin-top:16px; border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; background:var(--bg-elev); }
.dashboard-statline > div { display:flex; flex-direction:column; padding:20px 23px; border-right:1px solid var(--line); }
.dashboard-statline > div:last-child { border:0; }
.dashboard-statline span { color:var(--ink-mute); font-size:.65rem; text-transform:uppercase; letter-spacing:.12em; }
.dashboard-statline strong { margin-top:7px; font-family:var(--font-display); font-size:2rem; font-weight:400; }
.dashboard-statline strong small { font-family:var(--font-sans); font-size:.78rem; color:var(--ink-mute); }
.dashboard-statline em { color:var(--ink-mute); font-size:.73rem; font-style:normal; }

.dashboard-lower-grid { display:grid; grid-template-columns:minmax(0,1.16fr) minmax(360px,.84fr); align-items:start; gap:18px; margin-top:48px; }
.domain-panel, .quick-panel, .activity-card { padding:27px; }
.domain-readiness-row { display:flex; align-items:center; gap:13px; padding:13px 3px; color:var(--ink); border-bottom:1px solid var(--line); }
.domain-readiness-row:last-child { border-bottom:0; }
.domain-readiness-row:hover { color:var(--brand); text-decoration:none; }
.domain-readiness-copy { flex:1; min-width:0; }
.domain-readiness-copy strong { font-size:.83rem; font-weight:620; }
.domain-readiness-copy .progress { margin-top:7px; }
.domain-readiness-value { min-width:42px; text-align:right; font-family:var(--font-display); font-size:1.35rem; }
.domain-readiness-value small { font-family:var(--font-sans); font-size:.62rem; color:var(--ink-mute); }
.quick-action-grid { display:grid; grid-template-columns:repeat(2,1fr); border-top:1px solid var(--line); border-left:1px solid var(--line); }
.quick-action-grid a { min-height:112px; display:grid; grid-template-columns:32px 1fr; grid-template-rows:auto auto; align-content:center; column-gap:9px; padding:17px; color:var(--ink); border-right:1px solid var(--line); border-bottom:1px solid var(--line); }
.quick-action-grid a:hover { background:var(--bg-elev-2); color:var(--brand); text-decoration:none; }
.quick-action-grid a > span { grid-row:1 / 3; width:30px; height:30px; display:grid; place-items:center; color:var(--brand); }
.quick-action-grid strong { align-self:end; font-size:.84rem; }
.quick-action-grid small { align-self:start; color:var(--ink-mute); font-size:.7rem; }
.activity-card .text-link { display:inline-flex; }
.activity-bar { border-radius:999px 999px 3px 3px; background:var(--teal-500); }

/* Shared learning surfaces */
.dom-A{--d:#876b9b}.dom-B{--d:#a35f47}.dom-C{--d:#557c89}.dom-D{--d:#5f847b}
.dom-E{--d:#ae6d70}.dom-F{--d:#b38a4f}.dom-G{--d:#698464}.dom-H{--d:#8d6880}.dom-I{--d:#66726e}
.dom-pill { min-width:29px; height:29px; border-radius:50%; font-size:.72rem; font-weight:700; }
.dommap-card { overflow:hidden; transition:transform var(--transition),box-shadow var(--transition); }
.dommap-card:hover { transform:translateY(-4px); box-shadow:var(--shadow); border-color:var(--line-strong); }
.dommap-card .dm-top { height:4px; }
.dommap-card .dm-in { padding:22px; }
.dommap-card h3 { font-family:var(--font-display); font-size:1.2rem; font-weight:400; }
.progress { height:8px; background:var(--bg-sunken); }
.progress > span { background:var(--brand-500); }
.progress.thin { height:4px; }
.ring .track { stroke:var(--bg-sunken); }
.ring .meter { stroke:url(#ringGrad); }
.ring .ring-num { font-family:var(--font-display); font-weight:400; font-size:1.9rem; }
.ring .ring-cap { letter-spacing:.14em; }
.stat { padding:20px; }
.stat .stat-top { font-size:.65rem; letter-spacing:.12em; }
.stat .stat-val { font-family:var(--font-display); font-weight:400; font-size:2.2rem; }

.prose { font-family:var(--font-display); font-size:1.07rem; line-height:1.75; }
.prose h2, .prose h3, .prose h4 { font-family:var(--font-sans); }
.prose h2 { margin-top:42px; font-size:1.55rem; }
.prose h3 { font-size:1.13rem; }
.prose table { font-family:var(--font-sans); }
.prose thead th { background:var(--bg-sunken); }
.prose blockquote { border-color:var(--brand-400); }
.callout { border-width:1px; border-left-width:3px; border-radius:6px; }
.callout .callout-h { font-family:var(--font-sans); font-size:.7rem; letter-spacing:.11em; }
.formula { border-style:solid; }

.flashcard { min-height:390px; }
.fc-face { padding:clamp(26px,4vw,48px); border-radius:var(--radius-lg); box-shadow:var(--shadow); }
.fc-front-q { max-width:750px; font-family:var(--font-display); font-size:clamp(1.65rem,1.3rem + 1vw,2.35rem); font-weight:400; }
.fc-back .fc-answer { font-family:var(--font-display); font-size:1.12rem; line-height:1.65; }
.fc-hint { letter-spacing:.08em; text-transform:uppercase; font-size:.64rem; }
.fc-rate .btn { border-radius:8px; }

.q-stem { font-family:var(--font-display); font-size:clamp(1.3rem,1.08rem + .65vw,1.75rem); font-weight:400; line-height:1.45; }
.q-scenario { border-left-color:var(--teal-500); background:var(--bg-elev-2); }
.option { border-width:1px; border-radius:9px; background:var(--bg-elev); padding:17px; }
.option:hover:not(.locked) { border-color:var(--brand-400); background:var(--brand-50); }
[data-theme="dark"] .option:hover:not(.locked) { background:var(--bg-elev-2); }
.option .opt-key { border-radius:50%; font-weight:650; }
.option.selected { border-color:var(--brand-500); background:var(--brand-50); }
[data-theme="dark"] .option.selected { background:#372820; }
.q-explain { border-radius:8px; }
.exam-cell { border-width:1px; border-radius:50%; }
.timer { border-radius:999px; }

.tabs { gap:20px; }
.tab { padding:10px 1px; font-size:.78rem; }
.tab.active { color:var(--brand); }
.cov-task { padding:14px 16px; }
.mastery-seg span { height:5px; }

input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  min-height:44px;
  border-width:1px;
  border-radius:7px;
  background:var(--bg-elev);
}
textarea { min-height:110px; }
.field label { font-size:.78rem; }
.switch .track { background:var(--bg-sunken); }
.switch input:checked + .track { background:var(--teal-600); }

.overlay { background:rgba(13,18,17,.68); backdrop-filter:blur(10px); }
.modal { border-radius:14px; }
.modal .modal-head { border-bottom:1px solid var(--line); }
.modal .modal-head h3 { font-family:var(--font-display); font-size:1.5rem; font-weight:400; }
.toast { border-radius:8px; border-left-width:3px; }
.disclaimer-banner { border-radius:8px; background:var(--warn-bg); }
.kbd { border-radius:4px; }
.graph-card svg { border-radius:6px; }
.dataline { stroke:var(--brand-500); }
.datapt { stroke:var(--brand-600); }

@media (max-width:1120px) {
  .dashboard-plan-grid, .dashboard-lower-grid { grid-template-columns:1fr; }
  .readiness-card { min-height:230px; }
}

@media (max-width:900px) {
  .app { grid-template-columns:1fr; }
  .sidebar { width:286px; transform:translateX(-102%); }
  .app.nav-open .sidebar { transform:none; }
  .view { padding-top:22px; }
}

@media (max-width:820px) {
  .study-metrics { grid-template-columns:repeat(3,1fr); }
  .study-metric { min-height:220px; padding:18px; }
  .dashboard-statline { grid-template-columns:repeat(2,1fr); }
  .dashboard-statline > div:nth-child(2) { border-right:0; }
  .dashboard-statline > div:nth-child(-n+2) { border-bottom:1px solid var(--line); }
  .grid[style*="grid-template-columns"] { grid-template-columns:1fr!important; }
  article.prose + aside { position:static!important; }
}

@media (max-width:640px) {
  .view { padding:16px 14px 60px; }
  .dashboard-hero { min-height:650px; padding:21px 20px 23px; }
  .dashboard-hero-top { align-items:flex-start; font-size:.56rem; }
  .dashboard-hero-status { max-width:90px; text-align:right; line-height:1.4; }
  .dashboard-hero-copy { padding:54px 0 34px; }
  .dashboard-hero-copy > p { max-width:240px; line-height:1.5; }
  .dashboard-hero-copy h1 strong { font-size:2.7rem; line-height:1; }
  .dashboard-hero-copy h1 em { font-size:3rem; line-height:.96; }
  .dashboard-hero-actions { flex-direction:column; align-items:stretch; }
  .hero-action { width:100%; }
  .dashboard-hero-meta { grid-template-columns:1fr; gap:11px; }
  .dashboard-hero-meta > div { display:grid; grid-template-columns:120px 1fr; }
  .dashboard-section { padding-top:46px; }
  .section-heading { align-items:flex-start; flex-direction:column; }
  .readiness-card { align-items:flex-start; padding:24px; }
  .readiness-ring { display:none; }
  .study-metrics { grid-template-columns:1fr; }
  .study-metric { min-height:170px; }
  .dashboard-statline { grid-template-columns:1fr 1fr; }
  .dashboard-statline > div { padding:17px; }
  .dashboard-lower-grid { margin-top:38px; }
  .domain-panel, .quick-panel, .activity-card { padding:20px; }
  .domain-readiness-row { gap:9px; }
  .domain-readiness-copy .row { align-items:flex-start; }
  .domain-readiness-copy .tiny { display:none; }
  .quick-action-grid { grid-template-columns:1fr; }
  .quick-action-grid a { min-height:92px; }
  .page-head h1 { font-size:2.45rem; }
  .card { padding:20px; }
  .fc-rate { grid-template-columns:repeat(2,1fr); }
  .toast-wrap { left:14px; right:14px; bottom:14px; }
  .toast { max-width:none; }
}

@media print {
  .dashboard-hero { min-height:auto; color:#000; background:none; box-shadow:none; border:1px solid #aaa; }
  .dashboard-hero::before { display:none; }
  .dashboard-hero-actions, .dashboard-hero-meta { display:none; }
  .main::before,.page-head::before,.page-head::after { display:none; }
  .page-head {
    display:block;
    min-height:0;
    padding:0 0 18px;
    color:#000;
    background:none;
    border-bottom:1px solid #aaa;
    border-radius:0;
    box-shadow:none;
  }
  .page-head h1,.page-head p.lead,.page-head .eyebrow,.page-head .breadcrumb { color:#000; text-shadow:none; }
}

/* ---- Unified icon, control, and rule system ------------------------------ */
.btn .ui-icon,
.breadcrumb .ui-icon,
.text-link .ui-icon,
.row-arrow .ui-icon,
.inline-status .ui-icon,
.session-state .ui-icon {
  width:16px;
  height:16px;
  stroke-width:1.8;
}
.btn .ui-icon:last-child { margin-left:2px; }
.btn .ui-icon:first-child { margin-right:1px; }
.btn.primary .ui-icon { color:currentColor; }
.btn.accent { color:#fff; }
.btn.danger {
  background:transparent;
  color:var(--bad);
  border-color:color-mix(in srgb,var(--bad) 38%,var(--line));
}
.btn.danger:hover { background:var(--bad-bg); border-color:var(--bad); }
.btn[aria-pressed="true"] { color:var(--brand); background:var(--brand-50); border-color:var(--brand-200); }
[data-theme="dark"] .btn[aria-pressed="true"] { background:#38271f; }

.icon-btn.subtle {
  width:36px;
  height:36px;
  background:transparent;
  border-color:transparent;
  color:var(--ink-mute);
}
.icon-btn.subtle:hover { color:var(--brand); background:var(--bg-sunken); border-color:var(--line); }
.icon-btn.subtle.danger:hover { color:var(--bad); background:var(--bad-bg); border-color:color-mix(in srgb,var(--bad) 35%,var(--line)); }

.icon-mark {
  width:48px;
  height:48px;
  display:inline-grid;
  place-items:center;
  flex:none;
  color:var(--brand);
  background:var(--brand-50);
  border:1px solid var(--brand-100);
  border-radius:50%;
}
.icon-mark .ui-icon { width:22px; height:22px; }
.icon-mark.good { color:var(--good); background:var(--good-bg); border-color:color-mix(in srgb,var(--good) 20%,var(--line)); }
.icon-mark.warn { color:var(--warn); background:var(--warn-bg); border-color:color-mix(in srgb,var(--warn) 25%,var(--line)); }
[data-theme="dark"] .icon-mark { background:var(--bg-elev-2); border-color:var(--line); }

.status-dot,
.coverage-mark {
  width:29px;
  height:29px;
  display:inline-grid;
  place-items:center;
  flex:none;
  color:var(--ink-mute);
  border:1px solid var(--line);
  border-radius:50%;
  background:var(--bg-elev-2);
}
.status-dot .ui-icon,
.coverage-mark .ui-icon { width:14px; height:14px; }
.status-dot.good,
.coverage-mark.good { color:var(--good); background:var(--good-bg); border-color:transparent; }
.status-dot.bad,
.coverage-mark.bad { color:var(--bad); background:var(--bad-bg); border-color:transparent; }
.inline-status { display:inline-flex; align-items:center; gap:5px; }
.inline-status.good { color:var(--good); }
.inline-status.bad { color:var(--bad); }
.session-state {
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:var(--ink-mute);
  font-size:.7rem;
  letter-spacing:.08em;
  text-transform:uppercase;
  white-space:nowrap;
}

.breadcrumb {
  display:inline-flex;
  align-items:center;
  gap:7px;
  color:var(--ink-mute);
  font-size:.72rem;
  font-weight:650;
  letter-spacing:.04em;
}
.breadcrumb:hover { color:var(--brand); text-decoration:none; }
.row-arrow { display:inline-grid; place-items:center; color:var(--ink-mute); transition:transform var(--transition),color var(--transition); }
a:hover > .row-arrow { color:var(--brand); transform:translateX(3px); }

.callout {
  position:relative;
  border-left-width:1px;
  padding:18px 18px 18px 20px;
}
.callout::before {
  content:"";
  position:absolute;
  left:-1px;
  top:14px;
  bottom:14px;
  width:3px;
  border-radius:0 3px 3px 0;
  background:var(--line-strong);
}
.callout.trap::before { background:var(--bad); }
.callout.example::before { background:var(--good); }
.callout.nonexample::before,.callout.mnemonic::before { background:var(--warn); }
.callout.discrim::before,.callout.key::before { background:var(--brand-500); }
.callout.clinical::before { background:var(--teal-500); }
.callout .callout-h { min-height:22px; gap:9px; }
.callout .callout-h .ui-icon { width:16px; height:16px; }
.callout.trap .callout-h .ui-icon { color:var(--bad); }
.callout.example .callout-h .ui-icon { color:var(--good); }

.disclaimer-banner {
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:14px 16px;
  border-left:0;
}
.disclaimer-banner .icon-mark { width:32px; height:32px; }
.disclaimer-banner .icon-mark .ui-icon { width:15px; height:15px; }

.empty {
  min-height:300px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  padding:48px 24px;
  border:1px dashed var(--line-strong);
  border-radius:var(--radius);
  background:color-mix(in srgb,var(--bg-elev) 55%,transparent);
}
.empty .icon-mark { width:62px; height:62px; margin-bottom:4px; }
.empty .icon-mark .ui-icon { width:28px; height:28px; }
.empty .big { margin:0; }

.divider { height:0; border:0; border-top:1px solid var(--line); background:none; }
.list-item { min-height:52px; padding:13px 10px; transition:background var(--transition),color var(--transition); }
.list-item:hover { background:var(--bg-elev-2); }
.card.flush > .row:first-child { border-bottom:1px solid var(--line); }
.tabs { border-bottom-color:var(--line-strong); }
.tab { position:relative; border:0; }
.tab.active::after { content:""; position:absolute; left:0; right:0; bottom:-1px; height:2px; background:var(--brand-500); }

.saved-section-title,
.heading-with-icon,
.calc-card-head,
.graph-card-head {
  display:flex;
  align-items:center;
  gap:11px;
}
.saved-section-title .icon-mark { width:34px; height:34px; }
.saved-section-title .icon-mark .ui-icon { width:16px; height:16px; }
.saved-section-title .badge { margin-left:auto; }

.plan-step-number,
.plan-step-icon {
  width:32px;
  height:32px;
  display:grid;
  place-items:center;
  flex:none;
  border-radius:50%;
}
.plan-step-number { border:1px solid var(--line-strong); color:var(--ink-mute); font-size:.72rem; font-weight:700; }
.plan-step-number.good { color:var(--good); background:var(--good-bg); border-color:transparent; }
.plan-step-number .ui-icon,.plan-step-icon .ui-icon { width:15px; height:15px; }
.plan-step-icon { color:var(--brand); background:var(--brand-50); }
[data-theme="dark"] .plan-step-icon { background:var(--bg-elev-2); }

.search-box .s-ico { display:grid; place-items:center; }
.search-box .s-ico .ui-icon { width:17px; height:17px; }
.search-result-icon {
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  flex:none;
  color:var(--brand);
  background:var(--brand-50);
  border-radius:50%;
}
.search-result-icon .ui-icon { width:16px; height:16px; }
[data-theme="dark"] .search-result-icon { background:var(--bg-elev-2); }

.toast .t-ico {
  width:28px;
  height:28px;
  display:grid;
  place-items:center;
  flex:none;
  border-radius:50%;
  color:var(--brand);
  background:var(--brand-50);
}
.toast .t-ico .ui-icon { width:14px; height:14px; }
.toast.good .t-ico { color:var(--good); background:var(--good-bg); }
.toast.bad .t-ico { color:var(--bad); background:var(--bad-bg); }
.toast.warn .t-ico { color:var(--warn); background:var(--warn-bg); }

.view > h2.mt-6,
.view > h2.mb-4 {
  display:flex;
  align-items:center;
  gap:16px;
  font-family:var(--font-display);
  font-size:1.85rem;
  font-weight:400;
}
.view > h2.mt-6::after,
.view > h2.mb-4::after { content:""; flex:1; height:1px; background:var(--line); }

.calc-card { display:flex; flex-direction:column; min-height:300px; }
.calc-card-head { margin-bottom:8px; }
.calc-card-icon,
.graph-card-icon {
  width:36px;
  height:36px;
  display:grid;
  place-items:center;
  flex:none;
  color:var(--brand);
  background:var(--brand-50);
  border:1px solid var(--brand-100);
  border-radius:50%;
}
.calc-card-icon .ui-icon,.graph-card-icon .ui-icon { width:17px; height:17px; }
[data-theme="dark"] .calc-card-icon,[data-theme="dark"] .graph-card-icon { background:var(--bg-elev-2); border-color:var(--line); }
.calc-card .btn[data-calc] { align-self:flex-start; margin-top:auto; }
.calc-card [id^="out_"] { padding-top:18px; border-top:1px solid var(--line); }
.calc-out { color:var(--brand); font-family:var(--font-display); font-size:1.9rem; font-weight:400; }
.calc-steps { margin-top:10px; padding:14px; border-radius:7px; background:var(--bg-sunken); color:var(--ink-soft); }

.graph-card-head { margin-bottom:18px; }
.graph-card > svg,
#drillBody > svg { border:1px solid var(--line); }
.graph-card .callout { margin-bottom:10px; }
.answer-chip-row .chip { min-width:120px; justify-content:center; text-transform:capitalize; }

.q-explain { position:relative; border-left-width:1px; padding:18px 18px 18px 21px; }
.q-explain::before { content:""; position:absolute; left:-1px; top:13px; bottom:13px; width:3px; border-radius:3px; background:var(--line-strong); }
.q-explain.win::before { background:var(--good); }
.q-explain.lose::before { background:var(--bad); }
.option { position:relative; overflow:hidden; }
.option.selected::before,.option.correct::before,.option.incorrect::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--brand-500); }
.option.correct::before { background:var(--good); }
.option.incorrect::before { background:var(--bad); }

details.card { padding:0; overflow:hidden; }
details.card > summary { padding:18px 20px; }
details.card[open] > summary { border-bottom:1px solid var(--line); background:var(--bg-elev-2); }
details.card > .prose,details.card > .options,details.card > .q-explain { margin-left:20px; margin-right:20px; }

input[type="range"] {
  width:100%;
  accent-color:var(--brand-500);
}
input[type="range"]::-webkit-slider-runnable-track { height:4px; border-radius:4px; background:var(--bg-sunken); }
input[type="range"]::-webkit-slider-thumb { margin-top:-6px; }
input[type="checkbox"] { accent-color:var(--teal-600); }
select:hover,input:hover,textarea:hover { border-color:var(--ink-mute); }

.prose th { border-bottom-color:var(--line-strong); }
.prose td { border-bottom-color:var(--line); }
.prose tbody tr:last-child td { border-bottom:0; }
.timer { letter-spacing:.03em; }
.mobile-nav { display:none; }

/* ---- Mobile "More" sheet: the phone's full section menu ------------------- */
.more-sheet { display:flex; flex-direction:column; gap:20px; }
.more-group-label {
  margin-bottom:11px;
  color:var(--ink-mute);
  font-size:.62rem;
  font-weight:700;
  letter-spacing:.14em;
  text-transform:uppercase;
}
.more-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:9px; }
.more-tile {
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:9px;
  min-height:90px;
  padding:15px 8px;
  color:var(--ink);
  text-align:center;
  text-decoration:none;
  border:1px solid var(--line);
  border-radius:15px;
  background:var(--bg-elev);
  transition:transform var(--transition),border-color var(--transition),background var(--transition);
}
.more-tile .ui-icon { width:22px; height:22px; color:var(--brand); stroke-width:1.7; }
.more-tile span { font-size:.72rem; font-weight:600; line-height:1.2; }
.more-tile:active { transform:scale(.96); }
.more-tile.active { border-color:var(--brand-200); background:var(--brand-50); }
[data-theme="dark"] .more-tile.active { background:#38271f; border-color:var(--brand-400); }
.more-tile-badge {
  position:absolute;
  top:9px;
  right:9px;
  min-width:17px;
  height:17px;
  display:grid;
  place-items:center;
  padding:0 4px;
  color:#fff;
  background:var(--brand-400);
  border-radius:999px;
  font-size:.56rem;
  font-weight:750;
}
.more-theme {
  width:100%;
  display:flex;
  align-items:center;
  gap:13px;
  min-height:60px;
  padding:12px 15px;
  color:var(--ink);
  text-align:left;
  border:1px solid var(--line);
  border-radius:15px;
  background:var(--bg-elev);
  cursor:pointer;
}
.more-theme .ui-icon { width:20px; height:20px; color:var(--brand); flex:none; }
.more-theme-copy { display:flex; flex-direction:column; gap:2px; flex:1; min-width:0; }
.more-theme-copy strong { font-size:.9rem; font-weight:650; }
.more-theme-copy small { color:var(--ink-mute); font-size:.72rem; }
.more-theme-switch {
  position:relative;
  width:44px;
  height:26px;
  flex:none;
  border-radius:999px;
  background:var(--line-strong);
  transition:background var(--transition);
}
.more-theme-switch::after {
  content:"";
  position:absolute;
  top:3px;
  left:3px;
  width:20px;
  height:20px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 1px 3px rgba(0,0,0,.28);
  transition:transform var(--transition);
}
[data-theme="dark"] .more-theme-switch { background:var(--brand-500); }
[data-theme="dark"] .more-theme-switch::after { transform:translateX(18px); }

/* ---- Navigator sheet (opened by the mobile mini pill) --------------------- */
.navigator-exit {
  width:100%;
  display:flex;
  align-items:center;
  gap:11px;
  min-height:56px;
  padding:12px 15px;
  color:var(--bad);
  text-align:left;
  border:1px solid color-mix(in srgb,var(--bad) 38%,var(--line));
  border-radius:15px;
  background:var(--bad-bg);
  font-size:.88rem;
  font-weight:650;
  cursor:pointer;
}
.navigator-exit .ui-icon { width:18px; height:18px; flex:none; }
.navigator-exit:active { transform:scale(.98); }
.nav-primary { display:grid; grid-template-columns:repeat(4,1fr); gap:9px; }
.nav-primary-tile {
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:86px;
  padding:12px 5px;
  color:var(--sidebar-ink);
  background:color-mix(in srgb,var(--sidebar) 97%,transparent);
  border:1px solid rgba(255,255,255,.08);
  border-radius:15px;
  text-align:center;
  text-decoration:none;
  font-size:.66rem;
  font-weight:650;
  transition:transform var(--transition);
}
.nav-primary-tile .ui-icon { width:21px; height:21px; color:var(--brand-300); stroke-width:1.7; }
.nav-primary-tile.active { border-color:var(--brand-300); background:color-mix(in srgb,var(--sidebar) 84%,var(--brand-500)); }
.nav-primary-tile:active { transform:scale(.95); }
.nav-primary-tile .more-tile-badge { position:absolute; top:8px; right:8px; }
/* Staggered entrance: each tile fades in slightly after the previous one. */
@keyframes navTileIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }
.navigator [data-anim] { animation:navTileIn .38s var(--ease) both; animation-delay:calc(var(--i,0) * 22ms); }
@media (prefers-reduced-motion:reduce) {
  .navigator [data-anim] { animation:none; }
  .navigator-exit:active, .nav-primary-tile:active { transform:none; }
}

@media (max-width:640px) {
  .disclaimer-banner { align-items:flex-start; }
  .lesson-nav .btn { width:100%; }
  .answer-chip-row { display:grid; grid-template-columns:1fr; }
  .answer-chip-row .chip { width:100%; }
  .calc-card { min-height:auto; }
}

/* =============================================================================
   Purpose-built mobile experience
   Bottom navigation, compact context header, thumb-sized controls, and mobile-
   specific compositions replace the desktop/sidebar mental model below 640px.
   ============================================================================= */
@media (max-width:640px) {
  html { scroll-padding-top:calc(72px + env(safe-area-inset-top)); }
  body { background:var(--bg); }
  body.mobile-drawer-open { overflow:hidden; }
  .app { min-height:100dvh; }
  .main { width:100%; padding-bottom:0; }

  .topbar {
    min-height:64px;
    /* Reserve the status bar/notch at top and any curved edges in landscape. */
    padding:calc(8px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 8px calc(14px + env(safe-area-inset-left));
    gap:9px;
    z-index:65;
    background:color-mix(in srgb,var(--sidebar) 96%,transparent);
    border-bottom:1px solid rgba(255,255,255,.08);
    box-shadow:0 8px 24px rgba(17,23,22,.12);
  }
  .tablet-menu,.topbar-theme { display:none; }
  .topbar .mobile-brand {
    display:flex;
    min-width:0;
    min-height:44px;
    align-items:center;
    padding:0!important;
    gap:9px;
  }
  .topbar .mobile-brand .logo { width:34px; height:34px; font-size:16px; }
  .mobile-brand-copy { min-width:0; display:flex; flex-direction:column; line-height:1.05; }
  .mobile-brand-copy strong { color:var(--sidebar-ink); font-size:.82rem; font-weight:650; white-space:nowrap; }
  .mobile-brand-copy small {
    max-width:150px;
    margin-top:4px;
    overflow:hidden;
    color:var(--sidebar-muted);
    font-size:.56rem;
    letter-spacing:.1em;
    text-overflow:ellipsis;
    text-transform:uppercase;
    white-space:nowrap;
  }
  .topbar .icon-btn { width:44px; height:44px; flex:none; }

  /* One persistent mini navigation pill (replaces the 5-tab dock AND the
     per-screen exit X buttons, which sat under the iOS status bar). Floats
     above the home indicator; tapping opens the navigator sheet. */
  .mobile-nav {
    position:fixed;
    z-index:70;
    left:50%;
    bottom:calc(10px + env(safe-area-inset-bottom));
    display:block;
    transform:translateX(-50%);
    transition:transform var(--transition),opacity var(--transition);
  }
  body.mobile-drawer-open .mobile-nav { opacity:0; transform:translate(-50%,140%); pointer-events:none; }
  .mini-nav {
    display:flex;
    align-items:center;
    gap:9px;
    max-width:calc(100vw - 32px);
    min-height:46px;
    padding:5px 15px 5px 6px;
    color:var(--sidebar-ink);
    background:color-mix(in srgb,var(--sidebar) 96%,transparent);
    border:1px solid rgba(255,255,255,.12);
    border-radius:999px;
    box-shadow:0 16px 44px rgba(10,15,14,.32);
    backdrop-filter:blur(18px);
    font-size:.63rem;
    font-weight:680;
    letter-spacing:.09em;
    text-transform:uppercase;
    -webkit-tap-highlight-color:transparent;
  }
  .mini-nav:active { transform:scale(.94); }
  .mini-nav-logo {
    width:34px;
    height:34px;
    flex:none;
    border-radius:10px;
    overflow:hidden;
    display:block;
  }
  .mini-nav-label {
    max-width:44vw;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .mini-nav-badge {
    min-width:17px;
    height:17px;
    display:grid;
    place-items:center;
    flex:none;
    padding:0 4px;
    color:#fff;
    background:var(--brand-400);
    border-radius:999px;
    font-size:.54rem;
    font-weight:750;
    letter-spacing:0;
  }
  .mini-nav-caret { display:grid; place-items:center; flex:none; }
  .mini-nav-caret .ui-icon { width:15px; height:15px; color:var(--sidebar-muted); }
  /* Exit X buttons are replaced by the navigator's contextual exit row on
     phones (they were untappable under the status bar); desktop keeps them. */
  .experience-exit, .practice-exit { display:none!important; }

  .sidebar {
    z-index:85;
    width:min(88vw,340px);
    height:100dvh;
    border-radius:0 22px 22px 0;
    box-shadow:0 24px 70px rgba(0,0,0,.48);
  }
  .app.nav-open .sidebar { transform:none; }
  .scrim { z-index:80; backdrop-filter:blur(3px); }
  .sidebar .brand { padding:calc(24px + env(safe-area-inset-top)) 22px 18px; }
  .sidebar .nav { padding:4px 12px 32px; }
  .sidebar .nav-link { min-height:48px; padding:11px 13px; font-size:.91rem; }
  .sidebar .nav-group-label { padding:19px 13px 8px; }
  .sidebar-foot { padding-bottom:calc(18px + env(safe-area-inset-bottom)); }

  .view {
    width:100%;
    max-width:none;
    padding:16px 14px calc(104px + env(safe-area-inset-bottom));
  }
  .page-head {
    margin-bottom:22px;
    padding:4px 0 18px;
  }
  .page-head h1 { margin-top:7px; font-size:clamp(2.2rem,10vw,2.75rem); line-height:1.02; }
  .page-head p.lead { margin-top:9px; font-size:.91rem; line-height:1.58; }
  .page-head .eyebrow,.eyebrow,.editorial-label { font-size:.61rem; letter-spacing:.14em; }
  .page-head .row.between { align-items:flex-start; }
  .page-head .row > h1 { min-width:0; }
  .breadcrumb { min-height:36px; margin-left:-8px; padding:8px; }

  .card { padding:18px; border-radius:14px; }
  .card.pad-lg { padding:20px; }
  .grid { gap:12px; }
  .grid > * { min-width:0; }
  .stack { gap:12px; }
  .row { gap:9px; }
  .btn { min-height:46px; padding:10px 16px; }
  .btn.sm { min-height:44px; }
  .btn.lg { min-height:50px; }
  .icon-btn { width:42px; height:42px; }
  .chip { min-height:38px; padding:8px 12px; }

  /* Dashboard: compact, high-signal launch surface. */
  .dashboard-hero {
    min-height:0;
    height:auto;
    padding:18px 18px 20px;
    background-position:67% center;
    border-radius:16px;
    box-shadow:0 14px 34px rgba(35,36,31,.18);
  }
  .dashboard-hero::before {
    background:linear-gradient(90deg,rgba(17,27,25,.78) 0%,rgba(17,27,25,.4) 72%,rgba(17,27,25,.34) 100%),linear-gradient(0deg,rgba(10,17,16,.72) 0%,transparent 52%);
  }
  .dashboard-hero-top { align-items:center; font-size:.54rem; line-height:1.35; }
  .dashboard-hero-status { max-width:92px; text-align:right; }
  .dashboard-hero-copy { margin:0; padding:72px 0 34px; }
  .dashboard-hero-copy > p { max-width:270px; margin-bottom:12px; font-size:.72rem; line-height:1.55; }
  .dashboard-hero-copy h1 { gap:1px; }
  .dashboard-hero-copy h1 strong { font-size:clamp(2.2rem,10.5vw,2.75rem); line-height:.98; }
  .dashboard-hero-copy h1 em { font-size:clamp(2.35rem,11vw,2.95rem); line-height:.96; }
  .dashboard-hero-actions { display:grid; grid-template-columns:1fr; gap:8px; margin-top:24px; }
  .hero-action { width:100%; min-height:47px; padding:10px 16px; }
  .dashboard-hero-meta {
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:9px;
    padding-top:15px;
  }
  .dashboard-hero-meta > div { display:flex; grid-template-columns:none; gap:3px; min-width:0; }
  .dashboard-hero-meta span { font-size:.48rem; letter-spacing:.1em; }
  .dashboard-hero-meta strong,.dashboard-hero-meta strong a { font-size:.67rem; line-height:1.25; }

  .dashboard-section { padding:38px 0 4px; }
  .section-heading { align-items:flex-end; flex-direction:row; gap:12px; margin-bottom:17px; }
  .section-heading h2 { font-size:1.9rem; line-height:1; }
  .section-heading .text-link { flex:none; }
  .dashboard-section > .section-heading .text-link {
    width:40px;
    height:40px;
    display:grid;
    place-items:center;
    overflow:hidden;
    color:var(--ink);
    border:1px solid var(--line);
    border-radius:50%;
    background:var(--bg-elev);
    font-size:0;
  }
  .dashboard-section > .section-heading .text-link .ui-icon { width:17px; height:17px; }
  .dashboard-plan-grid { gap:12px; }
  .readiness-card { min-height:180px; align-items:center; padding:22px; gap:12px; }
  .readiness-card > div:first-child { max-width:220px; }
  .readiness-card h3 { margin:10px 0 7px; font-size:3.2rem; }
  .readiness-card p { font-size:.76rem; line-height:1.45; }
  .readiness-ring { display:block; }
  .readiness-ring .ring { width:92px!important; height:92px!important; }
  .readiness-ring .ring-num { font-size:1.35rem; }
  .readiness-ring .ring-cap { font-size:.53rem; }
  .study-metrics {
    display:flex;
    gap:10px;
    margin:0 -14px;
    padding:2px 14px 10px;
    overflow-x:auto;
    scroll-padding:14px;
    scroll-snap-type:x mandatory;
    scrollbar-width:none;
  }
  .study-metrics::-webkit-scrollbar { display:none; }
  .study-metric {
    min-width:min(76vw,285px);
    min-height:178px;
    padding:19px;
    scroll-snap-align:start;
  }
  .study-metric .metric-icon { width:38px; height:38px; }
  .study-metric .editorial-label { margin-top:18px; }
  .study-metric strong { font-size:2.55rem; }
  .dashboard-statline { grid-template-columns:repeat(2,1fr); margin-top:2px; border-radius:14px; }
  .dashboard-statline > div { min-height:112px; padding:16px; }
  .dashboard-statline strong { font-size:1.7rem; }
  .dashboard-lower-grid { margin-top:34px; gap:12px; }
  .domain-panel,.quick-panel,.activity-card { padding:18px; }
  .section-heading.compact { align-items:flex-end; flex-direction:row; }
  .section-heading.compact h2 { font-size:1.5rem; }
  .domain-readiness-row { min-height:62px; padding:11px 2px; }
  .quick-action-grid { grid-template-columns:repeat(2,1fr); }
  .quick-action-grid a { min-height:106px; padding:14px; }

  /* Study flows: readable, tappable, and free of desktop side rails. */
  .prose { font-size:1.02rem; line-height:1.68; }
  .prose h2 { margin-top:34px; font-size:1.35rem; }
  .prose h3 { font-size:1.08rem; }
  .prose table, table.prose { display:block; width:100%!important; min-width:0; max-width:100%; overflow-x:auto; white-space:normal; }
  .prose th,.prose td { min-width:135px; padding:10px; }
  article.card.prose { min-width:0; padding:20px; overflow:hidden; }
  article.card.prose + aside { position:static!important; }
  .lesson-nav { align-items:stretch; flex-direction:column; }
  .lesson-nav > span { display:none; }
  .lesson-nav .btn { justify-content:space-between; white-space:normal; text-align:left; }
  .callout { padding:16px 15px 16px 18px; }
  .callout .callout-h { font-size:.66rem; }
  .cov-task { grid-template-columns:46px minmax(0,1fr); gap:9px; padding:13px 12px; }
  .cov-task > .row:last-child { grid-column:1 / -1; justify-content:flex-end; }
  .dommap-card .dm-in { padding:18px; }

  .flashcard { min-height:390px; }
  .fc-face { padding:24px 20px; border-radius:15px; }
  .fc-front-q { font-size:1.65rem; }
  .fc-rate { gap:8px; }
  .fc-rate .btn { min-height:62px; border-radius:10px; }
  .q-progress-head { position:sticky; top:calc(65px + env(safe-area-inset-top)); z-index:10; margin:0 -14px 16px; padding:10px 14px; background:var(--glass); border-bottom:1px solid var(--line); backdrop-filter:blur(12px); }
  .q-stem { font-size:1.3rem; }
  .q-scenario { padding:15px; }
  .options { gap:10px; margin-top:18px; }
  .option { min-height:64px; padding:15px 14px; }
  .option .opt-key { width:31px; height:31px; }
  .q-explain { padding:17px; }
  .exam-grid { grid-template-columns:repeat(6,1fr); gap:7px; }
  .exam-cell { min-width:0; }
  .timer { font-size:.88rem; }
  .tabs { margin-left:-14px; margin-right:-14px; padding:0 14px; gap:18px; }

  .calc-card { padding:18px; }
  .calc-card .grid.cols-2 { gap:10px; }
  .calc-card .btn[data-calc] { width:100%; }
  .graph-card { padding:18px; }
  .graph-card > svg,#drillBody > svg { margin-left:-4px; width:calc(100% + 8px); }
  .answer-chip-row { grid-template-columns:1fr; }

  input[type=text],input[type=number],input[type=date],input[type=search],select,textarea { min-height:48px; font-size:16px; }
  textarea { min-height:120px; }
  .switch { min-height:44px; }

  .overlay { align-items:end; padding:env(safe-area-inset-top) 0 0; }
  .modal {
    width:100%;
    max-width:none;
    max-height:90dvh;
    border-radius:20px 20px 0 0;
    border-bottom:0;
    animation:mobileSheet .24s var(--ease);
  }
  .modal .modal-head { position:sticky; top:0; z-index:1; padding:18px 18px 13px; background:var(--bg-elev); }
  .modal .modal-body { padding:14px 18px 8px; }
  .modal .modal-foot { position:sticky; bottom:0; padding:14px 18px calc(14px + env(safe-area-inset-bottom)); background:var(--bg-elev); }
  .modal .modal-foot .btn { flex:1; }
  .toast-wrap { bottom:calc(86px + env(safe-area-inset-bottom)); }
  .empty { min-height:240px; padding:38px 20px; }
}

@keyframes mobileSheet {
  from { opacity:.7; transform:translateY(28px); }
  to { opacity:1; transform:none; }
}

/* =============================================================================
   Mobile polish layer
   Tactile press feedback, momentum scrolling, overscroll containment, and a
   subtle per-navigation fade. Additive on top of the mobile shell above so the
   phone reads like a native app without altering the established compositions.
   ============================================================================= */
@media (max-width:640px) {
  /* Contain the page bounce so the shell feels anchored; give every horizontal
     scroller momentum flicking. */
  body { overscroll-behavior-y:contain; }
  .study-metrics, .prose table, table.prose, .tabs, .modal .modal-body { -webkit-overflow-scrolling:touch; }

  /* Tappable surfaces dip slightly under the finger: fast and shallow so it
     reads as responsive, not bouncy. */
  .mini-nav, .btn, .icon-btn, .chip, .hero-action, .option,
  .quick-action-grid a, .domain-readiness-row, .study-metric, .cov-task,
  .list-item, .dommap-card, .fc-rate .btn {
    transition:transform .13s var(--ease), background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  }
  .btn:active, .icon-btn:active, .chip:active { transform:scale(.96); }
  .hero-action:active, .fc-rate .btn:active { transform:scale(.97); }
  .option:active, .quick-action-grid a:active, .domain-readiness-row:active,
  .study-metric:active, .cov-task:active, .list-item:active, .dommap-card:active { transform:scale(.985); }

  /* Per-navigation container fade (opacity only, so sticky descendants are
     never disturbed). Re-applied by the router on each route change. */
  .view.view-enter { animation:viewFade .28s var(--ease); }
}

@keyframes viewFade { from { opacity:.45; } to { opacity:1; } }

@media (max-width:640px) and (prefers-reduced-motion:reduce) {
  .mini-nav:active, .btn:active, .icon-btn:active, .chip:active,
  .hero-action:active, .fc-rate .btn:active, .option:active, .quick-action-grid a:active,
  .domain-readiness-row:active, .study-metric:active, .cov-task:active,
  .list-item:active, .dommap-card:active { transform:none; }
  .view.view-enter { animation:none; }
}

@media print {
  .mobile-nav { display:none!important; }
}

/* =============================================================================
   Cognitive Atelier foundation / 2026.07.3
   A visible learning protocol on the dashboard and a distraction-free Smart
   Session. The artwork remains atmospheric; retrieval content stays dominant.
   ============================================================================= */

:root { --focus-art-opacity:.16; }

.session-live-dot {
  width:7px;
  height:7px;
  display:inline-block;
  flex:none;
  border-radius:50%;
  background:#dfa47f;
  box-shadow:0 0 0 5px rgba(223,164,127,.14);
}

/* Dashboard: the default action and its evidence-based sequence share one stage. */
.dashboard-hero.immersive { min-height:clamp(590px,72vh,760px); }
.dashboard-hero-stage {
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(310px,.65fr);
  align-items:center;
  gap:clamp(28px,5vw,80px);
  margin:auto 0;
}
.dashboard-hero.immersive .dashboard-hero-copy {
  max-width:760px;
  margin:0;
  padding:58px 0 52px;
}
.dashboard-hero.immersive .dashboard-hero-copy h1 { gap:5px; }
.dashboard-hero.immersive .dashboard-hero-copy h1 strong { max-width:12ch; }
.dashboard-hero-lead {
  max-width:62ch;
  margin-top:22px;
  color:rgba(255,250,243,.78);
  font-size:.91rem!important;
  letter-spacing:0!important;
  line-height:1.65;
}
.dashboard-mission {
  align-self:center;
  overflow:hidden;
  padding:20px;
  background:rgba(15,24,22,.48);
  border:1px solid rgba(255,255,255,.22);
  border-radius:18px;
  box-shadow:0 24px 60px rgba(4,10,9,.22);
  backdrop-filter:blur(18px) saturate(115%);
}
.dashboard-mission-head,
.dashboard-mission-foot {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.dashboard-mission-head {
  padding:2px 3px 15px;
  color:rgba(255,250,243,.66);
  font-size:.61rem;
  font-weight:700;
  letter-spacing:.14em;
  text-transform:uppercase;
}
.dashboard-mission-head strong { color:#fff; font-size:.67rem; }
.dashboard-mission-steps { border-top:1px solid rgba(255,255,255,.15); }
.dashboard-mission-step {
  display:grid;
  grid-template-columns:24px 34px minmax(0,1fr) auto;
  align-items:center;
  gap:10px;
  min-height:63px;
  color:#fffaf3;
  border-bottom:1px solid rgba(255,255,255,.12);
}
.dashboard-mission-step.is-empty { opacity:.42; }
.mission-number { color:rgba(255,250,243,.45); font-family:var(--font-mono); font-size:.58rem; }
.mission-icon {
  width:32px;
  height:32px;
  display:grid;
  place-items:center;
  color:#e6b18e;
  border:1px solid rgba(255,255,255,.18);
  border-radius:50%;
}
.mission-icon .ui-icon { width:15px; height:15px; }
.dashboard-mission-step > span:nth-child(3) { display:flex; flex-direction:column; gap:2px; min-width:0; }
.dashboard-mission-step strong { font-size:.78rem; font-weight:620; }
.dashboard-mission-step small { color:rgba(255,250,243,.57); font-size:.62rem; }
.dashboard-mission-step b { font-family:var(--font-display); font-size:1.42rem; font-weight:400; }
.dashboard-mission-foot {
  justify-content:flex-start;
  padding:16px 3px 2px;
  color:rgba(255,250,243,.64);
  font-size:.61rem;
}
.dashboard-mission-foot .session-live-dot { width:5px; height:5px; box-shadow:0 0 0 4px rgba(223,164,127,.12); }

/* Smart Session briefing: an inviting threshold into effortful learning. */
.session-briefing {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  min-height:clamp(590px,72vh,760px);
  display:grid;
  grid-template-columns:minmax(0,1.25fr) minmax(320px,.75fr);
  align-items:center;
  gap:clamp(36px,7vw,96px);
  padding:clamp(34px,5vw,70px);
  color:#fffaf3;
  background-color:#24312e;
  background-image:var(--hero-image);
  background-position:var(--hero-position);
  background-size:cover;
  border-radius:4px;
  box-shadow:var(--shadow);
}
.session-briefing::before {
  content:"";
  position:absolute;
  z-index:-1;
  inset:0;
  background:linear-gradient(90deg,rgba(12,21,19,.88) 0%,rgba(14,23,21,.64) 55%,rgba(14,22,20,.48) 100%),linear-gradient(0deg,rgba(9,16,15,.72),transparent 62%);
}
.session-briefing::after {
  content:"";
  position:absolute;
  z-index:-1;
  inset:15px;
  border:1px solid rgba(255,255,255,.2);
  pointer-events:none;
}
.session-briefing-copy { max-width:730px; }
.session-kicker {
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:25px;
  color:rgba(255,250,243,.73);
  font-size:.68rem;
  font-weight:700;
  letter-spacing:.14em;
  text-transform:uppercase;
}
.session-briefing h1,
.session-complete h1 {
  color:#fff;
  font-family:var(--font-sans);
  font-size:clamp(3.15rem,5.5vw,6rem);
  font-weight:650;
  letter-spacing:-.055em;
  line-height:.91;
}
.session-briefing h1 em,
.session-complete h1 em { display:block; font-family:var(--font-display); font-weight:400; }
.session-briefing-copy > p {
  max-width:60ch;
  margin-top:25px;
  color:rgba(255,250,243,.76);
  font-size:.96rem;
  line-height:1.7;
}
.session-briefing-actions { display:flex; align-items:center; flex-wrap:wrap; gap:16px; margin-top:32px; }
.session-briefing-actions > span { color:rgba(255,250,243,.61); font-size:.7rem; letter-spacing:.06em; }
.session-briefing .hero-action { cursor:pointer; }
.session-protocol {
  overflow:hidden;
  padding:20px;
  border:1px solid rgba(255,255,255,.21);
  border-radius:18px;
  background:rgba(13,22,20,.5);
  box-shadow:0 24px 64px rgba(4,10,9,.24);
  backdrop-filter:blur(18px) saturate(115%);
}
.session-protocol-head { display:flex; justify-content:space-between; padding:2px 2px 15px; color:rgba(255,250,243,.63); font-size:.62rem; font-weight:700; letter-spacing:.13em; text-transform:uppercase; }
.session-protocol-head strong { color:#fff; }
.session-protocol-step {
  display:grid;
  grid-template-columns:25px 36px minmax(0,1fr) auto;
  align-items:center;
  gap:10px;
  min-height:67px;
  border-top:1px solid rgba(255,255,255,.13);
}
.session-protocol-step.is-empty { opacity:.4; }
.protocol-index { color:rgba(255,250,243,.4); font-family:var(--font-mono); font-size:.58rem; }
.protocol-icon { width:34px; height:34px; display:grid; place-items:center; color:#e4ad87; border:1px solid rgba(255,255,255,.18); border-radius:50%; }
.protocol-icon .ui-icon { width:16px; height:16px; }
.protocol-copy { display:flex; flex-direction:column; gap:2px; }
.protocol-copy strong { font-size:.8rem; }
.protocol-copy small { color:rgba(255,250,243,.57); font-size:.63rem; }
.protocol-count { font-family:var(--font-display); font-size:1.5rem; }
.session-protocol-foot { display:flex; justify-content:space-between; gap:8px; padding:16px 2px 2px; border-top:1px solid rgba(255,255,255,.13); color:rgba(255,250,243,.52); font-size:.54rem; letter-spacing:.1em; text-transform:uppercase; }
.session-science-note {
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:22px;
  margin-top:18px;
  padding:26px 30px;
  background:color-mix(in srgb,var(--bg-elev) 88%,transparent);
  border:1px solid var(--line);
  border-radius:var(--radius);
}
.session-science-note h2 { margin:5px 0 5px; font-family:var(--font-display); font-size:1.6rem; font-weight:400; }
.session-science-note p { max-width:80ch; color:var(--ink-mute); font-size:.78rem; line-height:1.55; }
.session-exam-countdown { min-width:105px; padding-left:24px; text-align:right; border-left:1px solid var(--line); }
.session-exam-countdown span,.session-exam-countdown small { display:block; color:var(--ink-mute); font-size:.58rem; letter-spacing:.1em; text-transform:uppercase; }
.session-exam-countdown strong { font-family:var(--font-display); font-size:2.5rem; font-weight:400; line-height:1; }

/* Active focus mode: remove navigational noise without changing app boundaries. */
body[data-study-mode="active"] .app { grid-template-columns:minmax(0,1fr); }
body[data-study-mode="active"] .sidebar,
body[data-study-mode="active"] .topbar { display:none!important; }
body[data-study-mode="active"] .main { min-height:100dvh; }
body[data-study-mode="active"] .main::before {
  inset:0;
  opacity:var(--focus-art-opacity);
  -webkit-mask-image:linear-gradient(180deg,#000 0%,transparent 92%);
  mask-image:linear-gradient(180deg,#000 0%,transparent 92%);
}
body[data-study-mode="active"] .view {
  width:100%;
  max-width:1040px;
  min-height:100dvh;
  margin:0 auto;
  padding:24px clamp(18px,4vw,48px) 58px;
}
.focus-session { width:100%; }
.focus-header {
  position:sticky;
  z-index:30;
  top:0;
  margin-bottom:clamp(28px,4vw,48px);
  /* Topbar is hidden in focus mode, so this header is the topmost element:
     reserve the status bar itself (its blur extends underneath). */
  padding:calc(10px + env(safe-area-inset-top)) 0 14px;
  background:color-mix(in srgb,var(--bg) 86%,transparent);
  backdrop-filter:blur(18px) saturate(120%);
}
.focus-header-top { display:flex; align-items:center; justify-content:space-between; min-height:42px; }
.focus-header .icon-btn.subtle { width:44px; height:44px; }
.focus-header-top > div { display:flex; align-items:center; gap:10px; color:var(--ink-mute); font-size:.68rem; }
.focus-header-top strong { color:var(--ink); font-size:.77rem; letter-spacing:.04em; }
.focus-progress-track { overflow:hidden; height:3px; background:var(--line); border-radius:999px; }
.focus-progress-track > span { display:block; height:100%; background:linear-gradient(90deg,var(--brand-500),var(--teal-500)); border-radius:inherit; transition:width 420ms var(--ease); }
.focus-phase-rail { display:flex; justify-content:center; gap:clamp(16px,4vw,42px); padding-top:13px; }
.focus-phase { display:flex; align-items:center; gap:6px; color:var(--ink-mute); font-size:.62rem; letter-spacing:.03em; }
.focus-phase .ui-icon { width:13px; height:13px; }
.focus-phase small { min-width:20px; text-align:center; color:var(--ink-mute); border:1px solid var(--line); border-radius:999px; font-size:.54rem; }
.focus-phase.active { color:var(--brand); font-weight:700; }
.focus-phase.done { color:var(--good); }
.focus-stage { max-width:880px; margin:0 auto; }
.focus-stage .flashcard { min-height:clamp(430px,60vh,620px); }
.focus-stage .fc-face { border:1px solid color-mix(in srgb,var(--line) 82%,transparent); box-shadow:0 30px 80px rgba(30,34,30,.14); }
.focus-primary-action { display:flex; flex-direction:column; align-items:center; gap:9px; margin-top:26px; }
.focus-primary-action > span { color:var(--ink-mute); font-size:.62rem; letter-spacing:.09em; text-transform:uppercase; }
.focus-question { max-width:880px; margin:0 auto; padding:clamp(25px,4vw,48px)!important; box-shadow:0 26px 70px rgba(30,34,30,.1); }
.focus-question .q-stem { max-width:32em; }
.focus-question .options { margin-top:26px; }
.focus-session .fc-rate { max-width:880px; margin-left:auto; margin-right:auto; }

/* Completion is a calm handoff to the next spaced review, not a noisy reward. */
body[data-study-mode="complete"] .view { max-width:1120px; margin:0 auto; }
.session-complete {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  min-height:clamp(620px,78vh,800px);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:clamp(38px,7vw,90px);
  color:#fffaf3;
  text-align:center;
  background-color:#22302d;
  background-image:var(--hero-image);
  background-position:var(--hero-position);
  background-size:cover;
  border-radius:4px;
  box-shadow:var(--shadow);
}
.session-complete::before { content:""; position:absolute; z-index:-1; inset:0; background:rgba(11,20,18,.76); backdrop-filter:saturate(70%); }
.session-complete-mark { width:64px; height:64px; display:grid; place-items:center; margin-bottom:22px; color:#fff; border:1px solid rgba(255,255,255,.35); border-radius:50%; background:rgba(255,255,255,.08); }
.session-complete-mark .ui-icon { width:27px; height:27px; }
.session-complete .eyebrow { color:#e7b18c; }
.session-complete h1 { max-width:13ch; margin-top:17px; font-size:clamp(3rem,5vw,5.5rem); }
.session-complete > p { max-width:62ch; margin-top:22px; color:rgba(255,250,243,.72); line-height:1.65; }
.session-complete-stats { width:min(100%,680px); display:grid; grid-template-columns:repeat(3,1fr); margin-top:34px; border-top:1px solid rgba(255,255,255,.22); border-bottom:1px solid rgba(255,255,255,.22); }
.session-complete-stats > div { display:flex; flex-direction:column; gap:7px; padding:22px 15px; border-right:1px solid rgba(255,255,255,.18); }
.session-complete-stats > div:last-child { border-right:0; }
.session-complete-stats span { color:rgba(255,250,243,.58); font-size:.58rem; letter-spacing:.12em; text-transform:uppercase; }
.session-complete-stats strong { font-family:var(--font-display); font-size:2rem; font-weight:400; }
.session-calibration-note { max-width:650px; display:flex; align-items:center; gap:12px; margin-top:22px; color:rgba(255,250,243,.75); font-size:.72rem; text-align:left; }
.session-calibration-note .ui-icon { flex:none; color:#e7b18c; }
.session-complete-actions { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:9px; margin-top:30px; }
.session-complete .btn:not(.primary) { color:#fff; border-color:rgba(255,255,255,.34); background:rgba(255,255,255,.05); }
.session-complete .btn.primary { color:#1f2826; background:#f4efe7; border-color:#f4efe7; }

@media (max-width:1120px) {
  .dashboard-hero-stage { grid-template-columns:minmax(0,1.15fr) minmax(290px,.85fr); gap:28px; }
  .dashboard-hero.immersive .dashboard-hero-copy h1 strong { font-size:clamp(2.7rem,5.2vw,4.6rem); }
  .dashboard-hero.immersive .dashboard-hero-copy h1 em { font-size:clamp(2.8rem,5.4vw,4.8rem); }
  .session-briefing { grid-template-columns:minmax(0,1fr) minmax(300px,.72fr); gap:34px; }
}

@media (max-width:820px) {
  .dashboard-hero-stage { grid-template-columns:1fr; gap:0; }
  .dashboard-hero.immersive .dashboard-hero-copy { padding-bottom:30px; }
  .dashboard-mission { margin-bottom:30px; }
  .session-briefing { grid-template-columns:1fr; }
  .session-briefing-copy { padding-top:42px; }
}

@media (max-width:640px) {
  .dashboard-hero.immersive { min-height:0; }
  .dashboard-hero.immersive .dashboard-hero-copy { padding:58px 0 26px; }
  .dashboard-hero.immersive .dashboard-hero-copy h1 strong { max-width:11ch; font-size:clamp(2.35rem,11vw,2.9rem); }
  .dashboard-hero.immersive .dashboard-hero-copy h1 em { font-size:clamp(2.55rem,11.8vw,3.12rem); }
  .dashboard-hero-lead { margin-top:17px; font-size:.78rem!important; line-height:1.55; }
  .dashboard-mission { margin:0 0 24px; padding:14px; border-radius:14px; }
  .dashboard-mission-step { min-height:49px; grid-template-columns:21px 29px minmax(0,1fr) auto; gap:8px; }
  .mission-icon { width:27px; height:27px; }
  .mission-icon .ui-icon { width:13px; height:13px; }
  .dashboard-mission-step strong { font-size:.7rem; }
  .dashboard-mission-step small { font-size:.55rem; }
  .dashboard-mission-step b { font-size:1.2rem; }
  .dashboard-mission-foot { font-size:.54rem; }

  body[data-study-mode="intro"] .view,
  body[data-study-mode="complete"] .view { padding:12px 12px calc(100px + env(safe-area-inset-bottom)); }
  .session-briefing { min-height:0; gap:26px; padding:27px 21px 24px; border-radius:16px; }
  .session-briefing::after { inset:9px; border-radius:10px; }
  .session-briefing-copy { padding-top:34px; }
  .session-kicker { margin-bottom:18px; font-size:.56rem; }
  .session-briefing h1 { font-size:clamp(2.65rem,13vw,3.45rem); }
  .session-briefing-copy > p { margin-top:18px; font-size:.82rem; line-height:1.6; }
  .session-briefing-actions { align-items:stretch; flex-direction:column; margin-top:24px; }
  .session-briefing-actions .hero-action { width:100%; min-height:50px; }
  .session-briefing-actions > span { text-align:center; }
  .session-protocol { padding:14px; border-radius:14px; }
  .session-protocol-step { min-height:54px; grid-template-columns:21px 30px minmax(0,1fr) auto; gap:8px; }
  .protocol-icon { width:28px; height:28px; }
  .protocol-icon .ui-icon { width:13px; height:13px; }
  .protocol-copy strong { font-size:.71rem; }
  .protocol-copy small { font-size:.56rem; }
  .protocol-count { font-size:1.23rem; }
  .session-science-note { grid-template-columns:auto minmax(0,1fr); align-items:start; padding:20px; }
  .session-science-note h2 { font-size:1.4rem; }
  .session-science-note p { font-size:.72rem; }
  .session-exam-countdown { grid-column:1 / -1; width:100%; display:flex; align-items:baseline; justify-content:flex-end; gap:7px; padding:14px 0 0; border-top:1px solid var(--line); border-left:0; }

  body[data-study-mode="active"] .view { padding:0 14px calc(92px + env(safe-area-inset-bottom)); }
  .focus-header { top:0; margin:0 -14px 22px; padding:calc(8px + env(safe-area-inset-top)) 14px 11px; }
  .focus-header-top { min-height:45px; }
  .focus-phase-rail { justify-content:flex-start; gap:16px; overflow-x:auto; scrollbar-width:none; }
  .focus-phase-rail::-webkit-scrollbar { display:none; }
  .focus-phase { flex:none; font-size:.57rem; }
  .focus-stage .flashcard { min-height:calc(100dvh - 324px - env(safe-area-inset-top)); max-height:610px; }
  .focus-stage .fc-face { padding:25px 21px; }
  .focus-primary-action { margin-top:19px; }
  .focus-primary-action .btn { width:100%; }
  .focus-question { padding:20px!important; }
  .focus-question .q-stem { font-size:1.28rem; }
  .focus-question .row[style*="gap:8px"] { display:grid; grid-template-columns:1fr; }

  .session-complete { min-height:calc(100dvh - 112px); padding:38px 22px; border-radius:16px; }
  .session-complete h1 { font-size:clamp(2.6rem,12vw,3.5rem); }
  .session-complete-stats { grid-template-columns:1fr; }
  .session-complete-stats > div { min-height:76px; flex-direction:row; align-items:center; justify-content:space-between; padding:15px 4px; border-right:0; border-bottom:1px solid rgba(255,255,255,.18); }
  .session-complete-stats > div:last-child { border-bottom:0; }
  .session-complete-stats strong { font-size:1.6rem; }
  .session-complete-actions { width:100%; flex-direction:column; }
  .session-complete-actions .btn { width:100%; }
}

@media (prefers-reduced-motion:reduce) {
  .focus-progress-track > span { transition:none; }
}

@media print {
  .dashboard-mission,.focus-header,.session-briefing-actions,.session-complete-actions { display:none!important; }
  .session-briefing,.session-complete { min-height:0; color:#000; background:none; box-shadow:none; }
  .session-briefing h1,.session-complete h1 { color:#000; }
}

/* =============================================================================
   Immersive practice environments / 2026.07.3
   Core practice routes own the viewport across launch, activity, and completion.
   ============================================================================= */

:root { --focus-content-width:1180px; }

body[data-experience-mode] .app { grid-template-columns:minmax(0,1fr); }
body[data-experience-mode] .sidebar,
body[data-experience-mode] .topbar { display:none!important; }
body[data-experience-mode] .main {
  position:relative;
  min-height:100dvh;
  isolation:isolate;
  background:var(--bg);
}
body[data-experience-mode] .main::before {
  content:"";
  position:fixed;
  z-index:0;
  inset:0;
  background-image:var(--hero-image);
  background-position:var(--workspace-art-position);
  background-size:cover;
  opacity:var(--focus-art-opacity);
  filter:saturate(.76) contrast(.92);
  -webkit-mask-image:radial-gradient(ellipse at 52% 35%,#000 0%,rgba(0,0,0,.82) 48%,transparent 100%);
  mask-image:radial-gradient(ellipse at 52% 35%,#000 0%,rgba(0,0,0,.82) 48%,transparent 100%);
  pointer-events:none;
}
[data-theme="dark"] body[data-experience-mode] .main::before,
body[data-experience-mode][data-theme="dark"] .main::before { filter:saturate(.65) brightness(.7); }
body[data-experience-mode] .view {
  position:relative;
  z-index:1;
  width:100%;
  max-width:var(--focus-content-width);
  min-height:100dvh;
  margin:0 auto;
  padding:24px clamp(18px,3vw,42px) 40px;
}

.experience-exit,
.practice-exit {
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  flex:none;
  color:inherit;
  border:1px solid currentColor;
  border-radius:50%;
  background:transparent;
  opacity:.72;
  cursor:pointer;
  transition:opacity var(--transition),transform var(--transition),background var(--transition);
}
.experience-exit:hover,
.practice-exit:hover { color:inherit; text-decoration:none; opacity:1; transform:scale(1.04); }
.experience-exit .ui-icon,
.practice-exit .ui-icon { width:18px; height:18px; }

/* Launch thresholds replace header + form + dead canvas with one composition. */
.experience-launch {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  min-height:calc(100dvh - 48px);
  display:grid;
  grid-template-columns:minmax(0,1.15fr) minmax(360px,.7fr);
  align-items:center;
  gap:clamp(34px,6vw,92px);
  padding:clamp(44px,6vw,84px);
  color:#fffaf3;
  background-color:#1c2926;
  background-image:var(--hero-image);
  background-position:var(--hero-position);
  background-size:cover;
  border-radius:18px;
  box-shadow:0 34px 100px rgba(15,21,19,.25);
}
.experience-launch::before {
  content:"";
  position:absolute;
  z-index:-1;
  inset:0;
  background:linear-gradient(90deg,rgba(9,18,16,.91) 0%,rgba(12,21,19,.74) 53%,rgba(12,19,18,.48) 100%),linear-gradient(0deg,rgba(7,13,12,.7),transparent 70%);
}
.experience-launch::after {
  content:"";
  position:absolute;
  z-index:-1;
  inset:16px;
  border:1px solid rgba(255,255,255,.2);
  border-radius:8px;
  pointer-events:none;
}
.experience-launch > .experience-exit {
  position:absolute;
  z-index:3;
  top:27px;
  right:27px;
  color:#fff;
  border-color:rgba(255,255,255,.35);
  background:rgba(10,18,16,.18);
  backdrop-filter:blur(10px);
}
.session-briefing > .experience-exit {
  position:absolute;
  z-index:4;
  top:27px;
  right:27px;
  color:#fff;
  border-color:rgba(255,255,255,.35);
  background:rgba(10,18,16,.18);
  backdrop-filter:blur(10px);
}
.experience-launch-copy { max-width:700px; }
.experience-launch-copy .eyebrow { color:#e7b18c; }
.experience-launch-copy h1 {
  margin-top:18px;
  color:#fff;
  font-family:var(--font-sans);
  font-size:clamp(3.4rem,6vw,6.8rem);
  font-weight:650;
  line-height:.89;
  letter-spacing:-.06em;
}
.experience-launch-copy h1 em { display:block; font-family:var(--font-display); font-weight:400; }
.experience-launch-copy > p { max-width:61ch; margin-top:27px; color:rgba(255,250,243,.75); font-size:1rem; line-height:1.72; }
.experience-proof { display:flex; flex-wrap:wrap; gap:9px; margin-top:30px; }
.experience-proof span { min-height:34px; display:inline-flex; align-items:center; gap:7px; padding:7px 11px; color:rgba(255,250,243,.72); border:1px solid rgba(255,255,255,.2); border-radius:999px; background:rgba(11,19,17,.18); font-size:.62rem; letter-spacing:.05em; text-transform:uppercase; backdrop-filter:blur(8px); }
.experience-proof .ui-icon { width:14px; height:14px; color:#e5ae88; }
.experience-config.card {
  width:100%;
  max-width:500px;
  justify-self:end;
  padding:clamp(25px,3vw,38px);
  color:var(--ink);
  background:color-mix(in srgb,var(--bg-elev) 94%,transparent);
  border-color:rgba(255,255,255,.42);
  border-radius:18px;
  box-shadow:0 26px 70px rgba(5,11,10,.28);
  backdrop-filter:blur(20px) saturate(110%);
}
.experience-config h2 { margin:7px 0 27px; font-size:2rem; }
.experience-config .domain-picker { max-height:105px; overflow:auto; padding-top:4px; }
.experience-config .btn.primary { min-height:52px; }
.experience-support-grid { display:grid; grid-template-columns:minmax(260px,.6fr) minmax(0,1fr); align-items:start; gap:16px; margin-top:16px; }
.experience-support-grid > :last-child:nth-child(3) { grid-column:1 / -1; }

/* Shared active-study stage. */
.practice-shell {
  width:100%;
  min-height:calc(100dvh - 64px);
  display:flex;
  flex-direction:column;
}
.q-progress-head.practice-toolbar,
.practice-toolbar {
  position:sticky;
  z-index:35;
  top:env(safe-area-inset-top);
  min-height:64px;
  margin:0 0 22px;
  padding:9px 12px;
  color:var(--ink);
  background:color-mix(in srgb,var(--bg-elev) 84%,transparent);
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:0 12px 34px rgba(28,32,29,.08);
  backdrop-filter:blur(18px) saturate(120%);
}
.practice-toolbar .practice-exit { margin-right:2px; color:var(--ink-mute); border-color:var(--line-strong); }
.practice-toolbar .icon-btn.subtle { width:44px; height:44px; }
.practice-shell .icon-btn.subtle { width:44px; height:44px; }
.practice-toolbar .progress { height:3px; }
.practice-toolbar .badge.brand { text-transform:uppercase; letter-spacing:.1em; }
.practice-primary-action { display:flex; flex-direction:column; align-items:center; gap:8px; margin-top:22px; }
.practice-primary-action > span { color:var(--ink-mute); font-size:.58rem; letter-spacing:.13em; text-transform:uppercase; }
.practice-primary-action .btn { min-width:190px; }

.practice-flashcards .fc-stage,
.practice-fluency .fc-stage { width:100%; max-width:1040px; flex:1; display:flex; margin:0 auto; }
.practice-flashcards .flashcard,
.practice-fluency .flashcard { width:100%; min-height:clamp(500px,65dvh,720px); }
.practice-flashcards .fc-face,
.practice-fluency .fc-face { border:1px solid color-mix(in srgb,var(--line) 88%,transparent); box-shadow:0 30px 90px rgba(28,32,29,.16); }
.practice-flashcards .fc-front-q,
.practice-fluency .fc-front-q { max-width:790px; font-size:clamp(2rem,3vw,3.1rem); line-height:1.18; }
.practice-flashcards .fc-rate,
.practice-fluency > .row { width:100%; max-width:1040px; margin-left:auto; margin-right:auto; }
.practice-flashcards .practice-actions { margin-top:18px; }

.practice-question-card {
  width:100%;
  max-width:980px;
  min-height:calc(100dvh - 130px);
  margin:0 auto;
  padding:clamp(30px,4vw,54px)!important;
  box-shadow:0 30px 90px rgba(28,32,29,.13);
}
.practice-question-card .q-stem { max-width:31em; font-size:clamp(1.55rem,2.2vw,2.15rem); }
.practice-question-card .options { margin-top:30px; }
.practice-exam > .grid { flex:1; }
.practice-exam > .grid > .card { min-height:calc(100dvh - 130px); padding:clamp(28px,4vw,50px); box-shadow:0 26px 80px rgba(28,32,29,.1); }
.practice-exam aside.card { max-height:calc(100dvh - 120px); overflow:auto; }

/* Completion keeps the learner in the environment until they choose the exit. */
.experience-complete {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  width:100%;
  max-width:none;
  min-height:calc(100dvh - 48px);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:clamp(42px,7vw,96px)!important;
  color:#fffaf3;
  background-color:#1d2a27!important;
  background-image:var(--hero-image)!important;
  background-position:var(--hero-position)!important;
  background-size:cover!important;
  border:0!important;
  border-radius:18px!important;
  box-shadow:0 34px 100px rgba(15,21,19,.25)!important;
}
.experience-complete::before { content:""; position:absolute; z-index:-1; inset:0; background:rgba(9,17,15,.77); backdrop-filter:saturate(72%); }
.experience-complete > * { position:relative; z-index:1; }
.experience-complete > .experience-exit { position:absolute; top:calc(27px + env(safe-area-inset-top)); right:27px; color:#fff; border-color:rgba(255,255,255,.35); }
.experience-complete h2 { color:#fff; font-size:clamp(2.5rem,5vw,4.7rem); }
.experience-complete p { max-width:650px; color:rgba(255,250,243,.73)!important; }
.experience-complete .icon-mark { color:#fff; background:rgba(255,255,255,.08); border-color:rgba(255,255,255,.3); }
.experience-complete .btn:not(.primary) { color:#fff; border-color:rgba(255,255,255,.3); background:rgba(255,255,255,.06); }

body[data-experience-mode="exam-complete"] > .app .view > .experience-exit {
  position:fixed;
  z-index:50;
  top:calc(28px + env(safe-area-inset-top));
  right:28px;
  color:var(--ink);
  border-color:var(--line-strong);
  background:var(--glass);
  backdrop-filter:blur(12px);
}
body[data-experience-mode="exam-complete"] .page-head { padding-right:64px; }

@media (max-width:900px) {
  .experience-launch { grid-template-columns:1fr; gap:34px; }
  .experience-config.card { max-width:none; justify-self:stretch; }
  .experience-support-grid { grid-template-columns:1fr; }
  .experience-support-grid > :last-child:nth-child(3) { grid-column:auto; }
}

@media (max-width:640px) {
  body[data-experience-mode] .view { max-width:none; padding:0; }
  body[data-experience-mode] .main::before { opacity:var(--focus-art-opacity); }

  .experience-launch {
    min-height:100dvh;
    align-content:center;
    gap:28px;
    padding:calc(74px + env(safe-area-inset-top)) 20px calc(92px + env(safe-area-inset-bottom));
    border-radius:0;
  }
  .experience-launch::after { inset:9px; border-radius:12px; }
  .experience-launch > .experience-exit { top:calc(18px + env(safe-area-inset-top)); right:18px; }
  .session-briefing > .experience-exit { top:18px; right:18px; }
  .experience-launch-copy h1 { font-size:clamp(3rem,14vw,4rem); }
  .experience-launch-copy > p { margin-top:19px; font-size:.84rem; line-height:1.6; }
  .experience-proof { margin-top:21px; }
  .experience-proof span { min-height:31px; font-size:.55rem; }
  .experience-config.card { padding:22px; border-radius:16px; }
  .experience-config h2 { margin-bottom:21px; font-size:1.65rem; }
  .experience-config .domain-picker { display:none; }
  .experience-support-grid { margin:0; padding:14px; }

  .practice-shell { min-height:100dvh; padding:0 12px calc(92px + env(safe-area-inset-bottom)); }
  .q-progress-head.practice-toolbar,
  .practice-toolbar { top:0; min-height:60px; margin:0 -12px 14px; padding:calc(8px + env(safe-area-inset-top)) 12px 8px; border-width:0 0 1px; border-radius:0; box-shadow:0 10px 24px rgba(24,29,26,.08); }
  .practice-toolbar .badge:not(.brand) { display:none; }
  .practice-toolbar .session-state { margin-left:auto; }
  .practice-toolbar .progress { min-width:48px; }

  .practice-flashcards .fc-stage,
  .practice-fluency .fc-stage { min-height:0; }
  .practice-flashcards .flashcard,
  .practice-fluency .flashcard { min-height:calc(100dvh - 254px - env(safe-area-inset-top)); max-height:none; }
  .practice-flashcards .fc-face,
  .practice-fluency .fc-face { padding:24px 20px; border-radius:18px; }
  .practice-flashcards .fc-front-q,
  .practice-fluency .fc-front-q { font-size:clamp(1.65rem,8vw,2.15rem); }
  .practice-primary-action { margin-top:14px; }
  .practice-primary-action .btn { width:100%; min-height:54px; }
  .practice-primary-action > span { display:none; }
  .practice-flashcards .practice-actions { margin-top:12px; }

  .practice-question-card { min-height:calc(100dvh - 148px - env(safe-area-inset-top)); padding:20px!important; border:0; border-radius:18px 18px 0 0; box-shadow:none; }
  .practice-question-card .q-stem { font-size:1.32rem; }
  .practice-question-card .options { margin-top:20px; }
  .practice-question-card .row[style*="gap:8px"] { display:grid; grid-template-columns:1fr; }

  .practice-exam > .grid { grid-template-columns:1fr!important; }
  .practice-exam > .grid > .card { min-height:calc(100dvh - 148px - env(safe-area-inset-top)); padding:20px; border-radius:16px; }
  .practice-exam aside.card { position:static!important; max-height:none; }
  .practice-exam .practice-toolbar > .row:first-child .badge:nth-child(3) { display:none; }

  .experience-complete { min-height:100dvh; border-radius:0!important; padding-bottom:calc(92px + env(safe-area-inset-bottom)); }
  .experience-complete > .experience-exit { top:calc(18px + env(safe-area-inset-top)); right:18px; }
  .experience-complete .row { width:100%; flex-direction:column; }
  .experience-complete .btn { width:100%; }
  body[data-experience-mode="exam-complete"] > .app .view { padding:calc(64px + env(safe-area-inset-top)) 14px calc(92px + env(safe-area-inset-bottom)); }
  body[data-experience-mode="exam-complete"] > .app .view > .experience-exit { top:calc(12px + env(safe-area-inset-top)); right:12px; }
}

@media (prefers-reduced-motion:reduce) {
  .experience-exit:hover,.practice-exit:hover { transform:none; }
}

@media print {
  body[data-experience-mode] .sidebar,body[data-experience-mode] .topbar,body[data-experience-mode] .mobile-nav { display:none!important; }
  .experience-exit,.practice-exit,.practice-toolbar { display:none!important; }
  .experience-launch,.experience-complete { min-height:0; color:#000; background:none!important; box-shadow:none!important; }
}
