/* ============================================================
   MasteryCap — trade-school workbench / competency stamp
   Light + dark (via theme.js). Oswald display + Noto Sans body.
   ============================================================ */

/* @font-face lives in institute.css (async) — keep cold LCP on system/Georgia (v5 §3d). */

:root {
  /* --- surfaces (graphite + oak undertone) --- */
  --bg: #141310;
  --bg-1: #1A1814;
  --surface: #211E19;
  --surface-2: #2A2620;
  --surface-3: #332E27;

  /* --- borders --- */
  --line: rgba(255,255,255,0.07);
  --line-2: rgba(255,255,255,0.11);
  --line-3: rgba(255,255,255,0.16);

  /* --- neutral text ramp --- */
  --t0: #F4F5F6;
  --t1: #C4C8CD;
  --t2: #878D95;
  --t3: #7A828C;
  --t4: #757C86;

  /* --- accent: safety yellow stamp --- */
  --acc: #B45309; /* darkened for white label contrast (MST-P1-01) */
  --acc-2: #FFDD33;
  --acc-dim: rgba(244,196,48,0.16);
  --acc-line: rgba(244,196,48,0.32);

  /* --- secondary: bench green --- */
  --sec: #2F9B6E;
  --sec-dim: rgba(47,155,110,0.14);
  --sec-line: rgba(47,155,110,0.28);

  /* --- market semantics --- */
  --up: #2F9B6E;
  --up-dim: rgba(47,155,110,0.13);
  --down: #C45B4E;
  --down-dim: rgba(196,91,78,0.13);
  --warn: #C4A35A;
  --warn-dim: rgba(196,163,90,0.12);

  /* --- radius (tighter, less pillowy) --- */
  --r1: 8px; --r2: 12px; --r3: 16px; --r-pill: 999px;

  /* --- motion --- */
  --spring: cubic-bezier(0.32, 1.5, 0.55, 1);
  --out: cubic-bezier(0.22, 1, 0.36, 1);

  /* --- layout --- */
  --maxw: 620px;
  --nav-h: 58px;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);

  --sans: 'Noto Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --serif: 'Oswald', 'Noto Sans', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', monospace;
  --fs: 1;
  --tabbar-bg: color-mix(in srgb, var(--bg) 88%, transparent);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--t0);
  font-family: var(--sans);
  font-size: calc(16px * var(--fs));
  font-feature-settings: "ss01","cv01","cv03";
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  letter-spacing: -0.006em;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; letter-spacing: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--acc-dim); }
::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- film grain overlay (premium texture) ---------- */
#grain {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- numeric helpers ---------- */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.up { color: var(--up); } .down { color: var(--down); }

/* ============================================================
   Shell
   ============================================================ */
.screen {
  max-width: var(--maxw); margin: 0 auto;
  padding: calc(var(--st) + 12px) 20px calc(var(--nav-h) + var(--sb) + 44px);
  animation: screen-in 0.34s var(--out);
}
@keyframes screen-in { from { opacity: 0; transform: translateY(6px) scale(0.994); } to { opacity: 1; transform: none; } }

/* ---------- large-title header (Apple-style) ---------- */
.lt-head { padding: 8px 0 18px; }
.lt-head .kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--t3); }
.lt-head h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; margin: 5px 0 0; line-height: 1.05; }
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

/* ---------- section label ---------- */
.slabel {
  font-size: 11px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--t3); margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between;
}
.slabel .sl-right { color: var(--t2); letter-spacing: 0.02em; text-transform: none; font-family: var(--mono); }

/* ---------- panel (flat, hairline) ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); }
.panel.pad { padding: 18px; }
.panel-h { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel-h .ph-t { font-size: 11px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--t2); }

/* grouped inset rows (Apple settings feel) */
.rows { }
.row-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: none; }
.row-item .ri-icon { width: 32px; height: 32px; flex: 0 0 auto; border-radius: var(--r1); display: grid; place-items: center; background: var(--surface-2); color: var(--t1); border: 1px solid var(--line); }
.row-item .ri-body { flex: 1; min-width: 0; }
.row-item .ri-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.row-item .ri-sub { font-size: 12.5px; color: var(--t3); margin-top: 2px; }
.row-item .ri-right { font-family: var(--mono); font-size: 14px; color: var(--t1); font-variant-numeric: tabular-nums; }
.chev { color: var(--t4); width: 16px; height: 16px; flex: 0 0 auto; }

/* ============================================================
   Buttons — flat, precise (no gradient pills)
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 20px; border-radius: var(--r2);
  background: var(--t0); color: #08090A; font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
  transition: transform 0.12s var(--spring), opacity 0.12s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.accent { background: var(--acc); color: #ffffff; }
.btn.secondary { background: var(--surface-2); color: var(--t0); border: 1px solid var(--line-2); }
.btn.ghost { background: transparent; color: var(--t1); border: 1px solid var(--line-2); }
.btn.sm { width: auto; padding: 9px 15px; font-size: 13px; border-radius: var(--r1); }
.btn-row { display: flex; gap: 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--t1); }

/* pill chips */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); color: var(--t1); }
.pill.mono { font-family: var(--mono); letter-spacing: -0.02em; }
.pill.up { background: var(--up-dim); border-color: transparent; color: var(--up); }
.pill.down { background: var(--down-dim); border-color: transparent; color: var(--down); }
.pill.acc { background: var(--acc-dim); border-color: transparent; color: var(--acc-2); }

/* ============================================================
   Bottom nav — flush, hairline, precise indicator
   ============================================================ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--tabbar-bg);
  backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-top: 1px solid var(--line);
  padding-bottom: var(--sb);
}
.tabbar-inner { max-width: var(--maxw); margin: 0 auto; height: var(--nav-h); display: flex; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--t3); position: relative; transition: color 0.2s var(--out);
}
.tab svg { width: 21px; height: 21px; }
.tab .tab-label { font-size: 9.5px; font-weight: 600; letter-spacing: 0.02em; }
.tab.active { color: var(--t0); }
.tab.active svg { color: var(--acc); }
.tab.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 14px; height: 1.5px; border-radius: 1px;
  background: color-mix(in srgb, var(--acc) 55%, var(--line-2));
  animation: tab-ind 0.28s var(--out);
}
@keyframes tab-ind { from { width: 0; opacity: 0; } to { width: 14px; opacity: 1; } }

/* ============================================================
   Splash — workbench assemble + competency stamp punch
   ============================================================ */
#splash {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  transition: opacity 0.5s var(--out);
}
#splash.hide { opacity: 0; pointer-events: none; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.splash-bench {
  width: min(62vw, 176px);
  height: min(36vw, 102px);
  position: relative;
  opacity: 0;
  animation: rise 0.5s var(--out) 0.05s forwards;
}
.bench-leg {
  position: absolute;
  bottom: 0;
  width: 14%;
  height: 42%;
  border-radius: 2px 2px 4px 4px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-3) 70%, #5C4A32), #3D3226);
  border: 1px solid color-mix(in srgb, var(--line-2) 80%, #6B5638);
  opacity: 0;
  transform: translateY(18px);
}
.bench-leg-l {
  left: 14%;
  animation: legIn 0.42s var(--out) 0.12s forwards;
}
.bench-leg-r {
  right: 14%;
  animation: legIn 0.42s var(--out) 0.2s forwards;
}
.bench-top {
  position: absolute;
  left: 4%; right: 4%; top: 18%;
  height: 28%;
  border-radius: 4px;
  background:
    linear-gradient(180deg, color-mix(in srgb, #C4A574 18%, var(--surface-2)), var(--surface-2)),
    repeating-linear-gradient(90deg, transparent, transparent 7px, color-mix(in srgb, var(--line) 60%, transparent) 7px, color-mix(in srgb, var(--line) 60%, transparent) 8px);
  border: 1px solid color-mix(in srgb, var(--line-2) 70%, #6B5638);
  box-shadow: 0 10px 28px rgba(0,0,0,0.38);
  opacity: 0;
  transform: translateY(-14px) scaleX(0.88);
  animation: topIn 0.48s var(--spring) 0.38s forwards;
}
.bench-peg {
  position: absolute;
  left: 50%; top: 8%;
  width: 10px; height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--sec);
  border: 2px solid color-mix(in srgb, var(--sec) 55%, var(--bg));
  box-shadow: 0 0 0 3px var(--sec-dim);
  opacity: 0;
  transform: scale(0.4);
  animation: pegIn 0.32s var(--spring) 0.62s forwards;
}
.splash-stamp {
  position: absolute;
  right: 8%;
  top: 2%;
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--acc) 85%, transparent);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 11px; /* §7.2 floor — was 8.5px (MST-V3-1) */
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--acc);
  background: color-mix(in srgb, var(--acc-dim) 55%, transparent);
  transform: rotate(-14deg) translateY(-28px) scale(1.15);
  opacity: 0;
  animation: stampPunch 0.38s var(--spring) 0.78s forwards;
}
@keyframes legIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes topIn {
  from { opacity: 0; transform: translateY(-14px) scaleX(0.88); }
  to { opacity: 1; transform: none; }
}
@keyframes pegIn {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes stampPunch {
  0% { opacity: 0; transform: rotate(-14deg) translateY(-28px) scale(1.15); }
  55% { opacity: 1; transform: rotate(-14deg) translateY(2px) scale(0.92); }
  100% { opacity: 1; transform: rotate(-14deg) translateY(0) scale(1); }
}
.splash-mark { width: 58px; height: 58px; display: none; }
.splash-word {
  font-family: var(--serif);
  font-size: 30px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
  opacity: 1; /* contentful LCP — no delayed fade-in */
}
.splash-word span { color: var(--acc); }
.splash-foot {
  position: absolute; bottom: calc(var(--sb) + 40px);
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--t3);
  opacity: 1;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.workbench-campus h1,
.dash-greet-name,
.panel-title,
.onb-title {
  font-family: var(--serif);
}

.workbench-campus {
  position: relative;
}
.workbench-campus::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--acc), color-mix(in srgb, var(--acc) 35%, var(--line)));
  opacity: 0.55;
  pointer-events: none;
}
.workbench-campus .lt-head,
.workbench-campus .panel,
.workbench-campus .stat-strip,
.workbench-campus .note-box {
  position: relative;
}
.workbench-campus .ph-t,
.workbench-campus > .panel .slabel,
.workbench-campus > .panel.pad > .slabel,
.workbench-campus #todayPath .slabel,
.workbench-campus #reportCard .slabel,
.workbench-campus .slabel {
  font-family: var(--serif);
  letter-spacing: 0.08em;
  font-weight: 600;
  text-transform: uppercase;
}

/* ============================================================
   Onboarding — editorial, full-bleed, no emoji/dots
   ============================================================ */
.onb { min-height: 100dvh; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; padding: calc(var(--st) + 20px) 24px calc(var(--sb) + 22px); }
.onb-top { display: flex; align-items: center; gap: 12px; margin-bottom: 44px; }
.onb-progress { flex: 1; height: 2px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.onb-progress i { display: block; height: 100%; background: var(--acc); border-radius: 2px; transition: width 0.4s var(--out); }
.onb-step { font-family: var(--mono); font-size: 12px; color: var(--t3); letter-spacing: 0; }
.onb-main { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.onb-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--onb-eyebrow, var(--acc-2)); margin-bottom: 14px; }
.onb-title { font-size: 32px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.08; margin: 0 0 14px; }
.onb-sub { font-size: 15.5px; line-height: 1.6; color: var(--t2); margin: 0; max-width: 30ch; }
.onb-field { margin-top: 30px; }
.onb-input {
  width: 100%; background: transparent; border: none; border-bottom: 1.5px solid var(--line-3);
  color: var(--t0); padding: 10px 2px; font-size: 26px; font-weight: 500; letter-spacing: -0.02em;
}
.onb-input:focus { outline: 0; border-color: var(--acc); }
.onb-input::placeholder { color: var(--t4); }

.opt-list { display: flex; flex-direction: column; gap: 10px; margin-top: 30px; }
.opt-card {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 16px; border-radius: var(--r2); background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.16s var(--out), background 0.16s;
}
.opt-card .oc-icon { width: 38px; height: 38px; border-radius: var(--r1); display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--t1); flex: 0 0 auto; }
.opt-card .oc-body { flex: 1; }
.opt-card .oc-t { display: block; font-size: 15px; font-weight: 500; }
.opt-card .oc-s { display: block; font-size: 12.5px; color: var(--t3); margin-top: 3px; }
.opt-card .oc-check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-3); flex: 0 0 auto; display: grid; place-items: center; color: transparent; transition: all 0.16s var(--spring); }
.opt-card.on { border-color: var(--acc-line); background: var(--acc-dim); }
.opt-card.on .oc-icon { color: var(--acc-2); border-color: var(--acc-line); }
.opt-card.on .oc-check { background: var(--acc); border-color: var(--acc); color: #0A0A0B; }
.onb-foot { margin-top: 24px; }

/* ============================================================
   Dashboard
   ============================================================ */
.avatar { width: 40px; height: 40px; border-radius: var(--r-pill); display: grid; place-items: center; font-weight: 600; font-size: 14px; color: var(--t0); background: var(--surface-2); border: 1px solid var(--line-2); cursor: pointer; }

.equity {
  padding: 20px; border: 1px solid var(--line); border-radius: var(--r3);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-1) 100%);
  position: relative; overflow: hidden; margin-bottom: 14px;
}
.equity .eq-label { font-size: 11px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--t3); }
.equity .eq-bal { font-family: var(--mono); font-size: 42px; font-weight: 500; letter-spacing: -0.04em; line-height: 1.02; margin-top: 6px; }
.equity .eq-bal .cents { color: var(--t3); }
.equity .eq-delta { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-family: var(--mono); font-size: 13px; font-weight: 500; }
.equity .eq-chart { margin: 14px -20px -20px; height: 128px; }
.equity .eq-chart svg { width: 100%; height: 100%; display: block; }
.equity .eq-empty { margin: 20px 0 4px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--t3); }

/* stat strip — flat, divided, mono */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); overflow: hidden; margin-bottom: 22px; }
.stat-cell { padding: 14px 10px; border-right: 1px solid var(--line); }
.stat-cell:last-child { border-right: none; }
.stat-cell .sc-l { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--t3); }
.stat-cell .sc-v { font-family: var(--mono); font-size: 19px; font-weight: 500; letter-spacing: -0.03em; margin-top: 5px; }
.stat-cell .sc-s { font-size: 10.5px; color: var(--t4); margin-top: 2px; }

/* checklist */
.check-row { display: flex; align-items: center; gap: 13px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: none; }
.check-box { width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto; border: 1.5px solid var(--line-3); display: grid; place-items: center; color: transparent; transition: all 0.16s var(--spring); }
.check-row.on .check-box { background: var(--acc); border-color: var(--acc); color: #0A0A0B; }
.check-row .check-t { font-size: 14.5px; font-weight: 450; transition: color 0.16s; }
.check-row.on .check-t { color: var(--t3); }

/* ============================================================
   Learn / Course
   ============================================================ */
.track-rail { display: flex; gap: 10px; overflow-x: auto; margin: 0 -20px 22px; padding: 2px 20px 6px; scroll-snap-type: x mandatory; }
.track-chip {
  scroll-snap-align: start; flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 11px 15px 11px 12px; border-radius: var(--r2); background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.16s, background 0.16s;
}
.track-chip .tc-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--t1); }
.track-chip .tc-name { font-size: 14px; font-weight: 550; letter-spacing: -0.01em; white-space: nowrap; }
.track-chip .tc-meta { font-size: 10.5px; color: var(--t3); font-family: var(--mono); }
.track-chip.on { border-color: var(--acc-line); background: var(--acc-dim); }
.track-chip.on .tc-ic { color: var(--acc-2); border-color: var(--acc-line); }
.track-chip .tc-dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-live { background: var(--up); box-shadow: 0 0 8px var(--up); }
.dot-soon { background: var(--t4); }

.prog-line { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.prog-track { flex: 1; height: 3px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.prog-track i { display: block; height: 100%; background: var(--acc); border-radius: 3px; transition: width 0.6s var(--out); }
.prog-num { font-family: var(--mono); font-size: 12.5px; color: var(--t2); }

.week-row { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--line); transition: background 0.14s; }
.week-row:last-child { border-bottom: none; }
.week-row:active { background: var(--surface-2); }
.week-row.locked { opacity: 0.42; }
.week-idx { width: 30px; font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--t3); flex: 0 0 auto; text-align: center; }
.week-row.done .week-idx, .week-row.mastered .week-idx { color: var(--up); }
.week-row.current .week-idx { color: var(--acc); }
.week-body { flex: 1; min-width: 0; }
.week-body .wb-t { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.week-body .wb-s { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 3px; }
.wb-s.s-done { color: var(--up); } .wb-s.s-current { color: var(--acc); } .wb-s.s-locked { color: var(--t4); } .wb-s.s-mastered { color: var(--warn); }
.week-state-ic { width: 20px; height: 20px; color: var(--t4); flex: 0 0 auto; }
.week-row.done .week-state-ic, .week-row.mastered .week-state-ic { color: var(--up); }

/* lesson */
.backlink { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--t2); font-weight: 500; margin-bottom: 18px; padding: 6px 0; }
.backlink svg { width: 16px; height: 16px; }
.lesson-title { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.12; margin: 0 0 4px; }
.lesson-kicker { font-family: var(--mono); font-size: 12px; color: var(--acc-2); letter-spacing: 0; margin-bottom: 16px; }
.lesson-body { font-size: 16px; line-height: 1.72; color: var(--t1); }
.lesson-body p { margin: 0 0 16px; }
.lesson-body strong { color: var(--t0); font-weight: 600; border-bottom: 1.5px solid var(--acc-line); padding-bottom: 1px; }
.lesson-body em { color: var(--acc-2); font-style: normal; }

/* quiz */
.q-block { padding: 18px 0; border-bottom: 1px solid var(--line); }
.q-block:first-of-type { padding-top: 4px; }
.q-num { font-family: var(--mono); font-size: 12px; color: var(--t3); margin-bottom: 8px; }
.q-text { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 14px; line-height: 1.4; }
.q-block.flag .q-text { color: var(--down); }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); color: var(--t1);
  border-radius: var(--r2); padding: 14px 15px; margin-bottom: 9px; font-size: 14.5px; font-weight: 450;
  transition: border-color 0.15s, background 0.15s;
}
.opt .opt-key { width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--t3); }
.opt.selected { border-color: var(--acc-line); background: var(--acc-dim); color: var(--t0); }
.opt.selected .opt-key { background: var(--acc); border-color: var(--acc); color: #0A0A0B; }
.opt.correct { border-color: rgba(22,199,132,0.4); background: var(--up-dim); color: var(--up); }
.opt.correct .opt-key { background: var(--up); border-color: var(--up); color: #0A0A0B; }
.opt.wrong { border-color: rgba(234,57,67,0.4); background: var(--down-dim); color: var(--down); }
.opt.wrong .opt-key { background: var(--down); border-color: var(--down); color: #0A0A0B; }
.explain { font-size: 13.5px; color: var(--t2); margin-top: 4px; padding: 12px 14px; background: var(--surface); border-radius: var(--r2); border: 1px solid var(--line); line-height: 1.55; display: none; }
.q-block.answered .explain { display: block; animation: screen-in 0.3s var(--out); }

.result { text-align: center; padding: 30px 16px 8px; }
.result .r-score { font-family: var(--mono); font-size: 52px; font-weight: 500; letter-spacing: -0.04em; }
.result .r-msg { color: var(--t2); font-size: 14.5px; margin-top: 8px; line-height: 1.5; }
.note-box { padding: 15px 16px; border-radius: var(--r2); font-size: 13.5px; line-height: 1.55; border: 1px solid var(--line); }
.note-box.warn { background: var(--warn-dim); border-color: rgba(245,166,35,0.25); color: var(--warn); }
.note-box.warn strong { color: var(--warn); }
.note-box.err { background: var(--down-dim); border-color: rgba(234,57,67,0.3); color: var(--down); }
.note-box.flag { background: rgba(234,57,67,0.08); border-color: rgba(234,57,67,0.35); color: var(--t1); }
.note-box.flag strong { color: var(--down); }

.formula-strip {
  position: sticky; top: 0; z-index: 5;
  padding: 10px 12px; margin: 0 0 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r2); font-size: 12px; color: var(--t2);
  overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch;
}
.lesson-progress { height: 2px; background: var(--line); margin: 8px 0 0; border-radius: 1px; }
.lesson-progress i { display: block; height: 100%; background: var(--acc); width: 0; }

/* reading mode — Apple Books–like lesson surface */
.reading-screen { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tab-h, 56px) - 24px); padding-bottom: 12px; }
.reading-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.reading-bar__back { background: none; border: 0; color: var(--t2); padding: 8px 4px; cursor: pointer; display: flex; align-items: center; }
.reading-bar__meta { flex: 1; min-width: 0; }
.reading-bar__track { display: block; font-size: 11px; color: var(--t3); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reading-bar__page { font-size: 12px; color: var(--t2); }
.reading-bar__tools { flex-shrink: 0; font-size: 12px; padding: 6px 10px; }
.reading-progress { height: 3px; background: var(--line); border-radius: 2px; margin-bottom: 20px; overflow: hidden; }
.reading-progress i { display: block; height: 100%; background: var(--acc); transition: width 0.2s ease; }
.reading-page { flex: 1; font-size: clamp(18px, 4.2vw, 22px); line-height: 1.78; color: var(--t0); max-width: 38rem; margin: 0 auto; padding: 8px 4px 24px; letter-spacing: -0.01em; }
.reading-title { font-size: clamp(26px, 5vw, 32px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; margin: 0 0 1rem; }
.reading-page p { margin: 0 0 1.1em; }
.reading-page strong { color: var(--t0); font-weight: 600; }
.reading-page em { color: var(--acc-2); font-style: normal; }
.reading-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 38rem; margin: 0 auto; width: 100%; padding: 8px 0; }
.reading-nav__btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--t1); display: grid; place-items: center; cursor: pointer; }
.reading-nav__btn:disabled { opacity: 0.35; cursor: default; }
.reading-dots { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; flex: 1; }
.reading-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.reading-dot.on { background: var(--acc); transform: scale(1.15); }
.reading-quiz-cta { width: 100%; max-width: 38rem; margin: 12px auto 0; }
.flip-x { transform: scaleX(-1); }
.reading-guide { position: fixed; inset: 0; z-index: 900; background: rgba(8, 9, 10, 0.72); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(6px); }
.reading-guide__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); padding: 24px 22px; max-width: 22rem; width: 100%; box-shadow: 0 24px 48px rgba(0,0,0,0.35); }
.reading-guide__kicker { font-family: var(--mono); font-size: 11px; color: var(--acc-2); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.reading-guide__title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 14px; }
.reading-guide__list { margin: 0 0 18px; padding-left: 18px; font-size: 14px; color: var(--t2); line-height: 1.55; }
.reading-guide__list li { margin-bottom: 8px; }

.compare-card {
  margin: 14px 0; border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden;
}
.compare-head, .compare-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  font-size: 13px;
}
.compare-head { background: var(--surface-2); font-weight: 600; color: var(--t0); }
.compare-head span, .compare-row span {
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.compare-head span + span, .compare-row span + span { border-left: 1px solid var(--line); }
.compare-row:last-child span { border-bottom: 0; }
.compare-row span { color: var(--t2); line-height: 1.4; }

.pill.xref { cursor: pointer; margin: 4px 4px 4px 0; }

/* P15 a11y */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
html[data-contrast="high"] {
  --t2: #C8CDD4;
  --t3: #A8B0BA;
  --t4: #8A939E;
  --line: rgba(255,255,255,0.16);
  --line-2: rgba(255,255,255,0.22);
}
.opt, .check-row, .tab, .pill, .backlink, .del, .sheet-x, .btn {
  min-height: 44px;
}
.opt { padding-top: 12px; padding-bottom: 12px; }
.del { min-width: 44px; display: grid; place-items: center; }

/* ============================================================
   Journal
   ============================================================ */
.balance-bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; }
.balance-bar .bb-l { font-size: 11px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--t3); }
.balance-bar .bb-in { display: flex; align-items: baseline; gap: 3px; }
.balance-bar .bb-in span { color: var(--t3); font-family: var(--mono); font-size: 18px; }
.balance-bar input { width: 120px; text-align: right; background: transparent; border: none; color: var(--t0); font-family: var(--mono); font-weight: 500; font-size: 22px; letter-spacing: -0.03em; }
.balance-bar input:focus { outline: 0; color: var(--acc-2); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; color: var(--t3); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); color: var(--t0);
  border-radius: var(--r2); padding: 13px 14px; font-size: 15px; font-weight: 450;
}
.field input.num { font-family: var(--mono); letter-spacing: -0.02em; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--acc-line); background: var(--surface-3); }
.field input::placeholder { color: var(--t4); }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f-row.three { grid-template-columns: 1fr 1fr 1fr; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 420px) {
  .grid-3 { grid-template-columns: 1fr; }
}

.calc-result { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--acc-line); border-radius: var(--r2); overflow: hidden; background: var(--acc-dim); }
.calc-result .cr { padding: 14px 12px; border-right: 1px solid var(--line); text-align: center; }
.calc-result .cr:last-child { border-right: none; }
.calc-result .cr-l { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--t3); }
.calc-result .cr-v { font-family: var(--mono); font-size: 19px; font-weight: 500; letter-spacing: -0.03em; margin-top: 5px; }
.calc-result .cr-v.acc { color: var(--acc-2); }
.calc-hint { padding: 18px; text-align: center; font-size: 13.5px; color: var(--t3); }

.dir-seg { display: flex; gap: 8px; }
.dir-seg button { flex: 1; padding: 13px; border-radius: var(--r2); border: 1px solid var(--line); background: var(--surface-2); color: var(--t2); font-weight: 500; font-size: 14.5px; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.15s; }
.dir-seg button svg { width: 16px; height: 16px; }
.dir-seg button.on.long { background: var(--up-dim); border-color: var(--up); color: var(--up); }
.dir-seg button.on.short { background: var(--down-dim); border-color: var(--down); color: var(--down); }

.rule-note { display: flex; gap: 11px; font-size: 13px; color: var(--t2); padding: 14px 16px; line-height: 1.55; }
.rule-note svg { width: 17px; height: 17px; color: var(--acc); flex: 0 0 auto; margin-top: 1px; }

.trade-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.trade-row:last-child { border-bottom: none; }
.trade-dir { width: 34px; height: 34px; border-radius: var(--r1); flex: 0 0 auto; display: grid; place-items: center; }
.trade-dir svg { width: 16px; height: 16px; }
.trade-dir.long { background: var(--up-dim); color: var(--up); }
.trade-dir.short { background: var(--down-dim); color: var(--down); }
.trade-body { flex: 1; min-width: 0; }
.trade-body .tb-t { font-size: 14.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.trade-body .tb-m { font-size: 11.5px; color: var(--t3); margin-top: 3px; font-family: var(--mono); letter-spacing: 0; }
.trade-pl { font-family: var(--mono); font-weight: 500; font-size: 15px; letter-spacing: -0.02em; }
.tag { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; background: var(--surface-3); color: var(--t3); }
.tag.flag { background: var(--warn-dim); color: var(--warn); }
.del { color: var(--t4); width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; }
.del svg { width: 15px; height: 15px; }

/* ============================================================
   Progress
   ============================================================ */
.metric-big { font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: -0.03em; }
.chart-box svg { width: 100%; display: block; }
.bar-line { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.bar-line .bl-l { width: 84px; font-size: 13px; color: var(--t1); font-weight: 450; }
.bar-line .bl-track { flex: 1; height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar-line .bl-fill { height: 100%; border-radius: 4px; transition: width 0.6s var(--out); }
.bar-line .bl-v { width: 30px; text-align: right; font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--t1); }

/* ============================================================
   Lesson figures (P1)
   ============================================================ */
.fig {
  margin: 18px 0;
  padding: 14px 12px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  overflow: hidden;
}
.fig-svg { display: block; width: 100%; height: auto; max-width: 100%; }
.fig-cap {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--t3);
  font-family: var(--sans);
}
.fig-missing { padding: 12px; color: var(--down); }

.gloss-term {
  display: inline; padding: 0; margin: 0;
  color: var(--acc-2); font: inherit; font-weight: 500;
  border: none; border-bottom: 1px dashed var(--acc-line);
  background: transparent; cursor: pointer; letter-spacing: inherit;
}
.gloss-pop {
  position: fixed; z-index: 95; width: min(260px, calc(100vw - 24px));
  padding: 12px 14px; border-radius: var(--r2);
  background: var(--surface-2); border: 1px solid var(--line-2);
  box-shadow: 0 10px 32px rgba(0,0,0,0.5);
}
.gloss-pop .gp-term { font-size: 13px; font-weight: 600; color: var(--t0); margin-bottom: 6px; }
.gloss-pop .gp-def { font-size: 13px; line-height: 1.45; color: var(--t2); }

/* ============================================================
   Utility / shared
   ============================================================ */
.empty { text-align: center; color: var(--t3); font-size: 14px; padding: 40px 20px; }
.empty .e-ic { width: 40px; height: 40px; margin: 0 auto 14px; color: var(--t4); }
.seg { display: flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; border: 1px solid var(--line); }
.seg button { font-size: 12px; font-weight: 600; color: var(--t3); padding: 6px 13px; border-radius: var(--r-pill); transition: all 0.16s; }
.seg button.on { background: var(--t0); color: #08090A; }
.hstack { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt10{margin-top:10px}.mt14{margin-top:14px}.mt18{margin-top:18px}.mt22{margin-top:22px}
.hidden { display: none !important; }

/* ============================================================
   Settings sheet + SW update toast (P0)
   ============================================================ */
.sheet-root { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.sheet-root.on { pointer-events: auto; }
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.55);
  opacity: 0; transition: opacity 0.22s var(--out);
}
.sheet-root.on .sheet-backdrop { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: min(78vh, 560px);
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r3) var(--r3) 0 0;
  padding: 0 0 calc(18px + var(--sb));
  transform: translateY(110%); transition: transform 0.28s var(--spring);
  display: flex; flex-direction: column;
}
.sheet-root.on .sheet { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px; background: var(--line-2);
  margin: 10px auto 0;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 8px;
}
.sheet-x {
  width: 36px; height: 36px; display: grid; place-items: center;
  color: var(--t2); border-radius: var(--r-pill); background: var(--surface-2);
  border: 1px solid var(--line);
}
.sheet-body { padding: 8px 18px 8px; overflow-y: auto; }
.sheet-body .btn { width: 100%; margin-bottom: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

.sw-toast {
  position: fixed; left: 50%; bottom: calc(72px + var(--sb));
  transform: translateX(-50%) translateY(16px);
  z-index: 90; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 16px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line-2);
  color: var(--t0); font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s var(--out), transform 0.28s var(--spring);
  max-width: calc(100vw - 32px); white-space: nowrap;
}
.sw-toast.on { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.sw-toast button {
  font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: var(--r-pill);
  background: var(--acc); color: #0A0A0B; border: none;
}

/* ============================================================
   Study — flashcards + notes
   ============================================================ */
.study-hub .study-launch { min-height: 52px; font-size: 16px; letter-spacing: -0.01em; }
.fc-stage {
  display: block; width: 100%; border: 0; padding: 0; background: transparent;
  perspective: 1200px; cursor: pointer; min-height: 220px;
}
.fc-inner {
  position: relative; width: 100%; min-height: 220px;
  transform-style: preserve-3d;
  transition: transform 0.45s var(--spring);
}
.fc-stage.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid var(--line-2); border-radius: var(--r3);
  background: var(--surface-2);
  padding: 22px 20px; display: flex; flex-direction: column; justify-content: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.28);
}
.fc-back { transform: rotateY(180deg); background: var(--surface-3); border-color: var(--acc-line); }
.fc-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--t3); margin-bottom: 12px;
}
.fc-text {
  font-size: 20px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.35;
  color: var(--t0); text-align: center;
}
.fc-back .fc-text { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.5; text-align: left; }
.fc-hint { margin-top: 18px; font-size: 12px; color: var(--t3); text-align: center; }
.study-burst {
  height: 4px; border-radius: var(--r-pill); margin: 0 0 18px;
  background: linear-gradient(90deg, transparent, var(--acc), transparent);
  animation: study-pulse 1.2s var(--out) infinite;
}
@keyframes study-pulse {
  0%, 100% { opacity: 0.35; transform: scaleX(0.85); }
  50% { opacity: 1; transform: scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  .fc-inner { transition: none; }
  .study-burst { animation: none; }
}

/* ── Campus workbench: mobile stack · desktop bench + tools rail ── */
.wb-bench {
  display: none;
}
.wb-layout { display: block; }
.wb-rail__label {
  display: none;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--acc);
  margin: 0 0 10px;
}
@media (min-width: 900px) {
  :root { --maxw: 1100px; }
  .wb-bench {
    display: block;
    height: 10px;
    margin: 0 0 12px;
    border-radius: 3px;
    background:
      linear-gradient(90deg, transparent, color-mix(in srgb, var(--acc) 55%, transparent), transparent),
      repeating-linear-gradient(90deg, var(--surface-3) 0 6px, transparent 6px 14px);
    border: 1px solid var(--line);
  }
  .wb-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.85fr);
    gap: 16px;
    align-items: start;
  }
  .wb-main,
  .wb-rail {
    background: var(--surface);
    border: 2px solid var(--line-2);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 3px 4px 0 color-mix(in srgb, var(--t0) 12%, transparent);
  }
  .wb-main {
    border-color: color-mix(in srgb, var(--acc) 45%, var(--line-2));
  }
  .wb-rail {
    position: sticky;
    top: 10px;
  }
  .wb-rail__label { display: block; }
  .workbench-campus::before { display: none; }
}


/* ============================================================
   Institute Terminal (v43) — tokens + campus surfaces
   ============================================================ */
:root {
  --bg: #0A0A0A;
  --bg-1: #121212;
  --surface: #161614;
  --surface-2: #1C1C18;
  --surface-3: #242420;
  --t0: #E8E4DC;
  --t1: #C8C4BC;
  --t2: #8A867E;
  --t3: #6E6A64;
  --acc: #E8590C;
  --acc-2: #F06A22;
  --acc-dim: rgba(232,89,12,0.16);
  --acc-line: rgba(232,89,12,0.35);
  --paper: #F5F1E8;
  --ink: #0A0A0A;
  --sans: 'IBM Plex Sans', 'Geist', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', 'Geist Mono', ui-monospace, monospace;
}

.lt-head h1, .onb-title, .splash-wordmark, .cert-name, .inst-h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
}

#splash {
  background: var(--ink);
}
.splash-wordmark {
  font-size: 42px;
  color: var(--t0);
  letter-spacing: -0.03em;
}
.splash-wordmark span { color: var(--acc); }
.splash-rule {
  width: 48px; height: 2px; background: var(--acc); margin: 16px 0 14px;
  animation: rule-draw 0.7s var(--out) forwards;
  transform-origin: left;
}
@keyframes rule-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.splash-tag {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--t2); font-weight: 600;
}
.splash-foot { color: var(--t3); font-size: 12px; letter-spacing: 0.04em; }

.inst-screen .inst-muted { color: var(--t2); font-size: 14px; line-height: 1.5; margin: 8px 0 0; }
.inst-lead { font-size: 18px; line-height: 1.45; color: var(--t1); margin: 12px 0 0; }
.inst-h2 { font-size: 24px; margin: 8px 0 0; line-height: 1.2; }
.inst-h3 { font-size: 17px; font-weight: 600; margin: 4px 0 0; }
.inst-card {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r2);
  padding: 18px 16px;
  text-align: left;
  width: 100%;
  color: inherit;
}
.inst-card.accent-rule { border-top: 2px solid var(--acc); }
.inst-card.dim { opacity: 0.55; }
.inst-card.school-card { cursor: pointer; }
.inst-honesty {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--acc-line);
  background: var(--acc-dim);
  font-size: 13px;
  color: var(--t1);
  line-height: 1.45;
}
.inst-list { display: flex; flex-direction: column; gap: 10px; }
.inst-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inst-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: 14px;
  text-align: left;
  display: flex; flex-direction: column; gap: 6px;
}
.inst-stat .mono { font-size: 22px; color: var(--acc); }
.inst-row-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  width: 100%; text-align: left;
}
.inst-row-item.static { cursor: default; }
.inst-row-item .grow { flex: 1; }
.inst-ul { margin: 8px 0 0; padding-left: 18px; color: var(--t1); line-height: 1.55; }
.inst-ul li { margin: 6px 0; }
.inst-foot-note { font-size: 12px; color: var(--t3); margin: 20px 0 0; line-height: 1.45; }
.inst-prose { color: var(--t1); line-height: 1.6; font-size: 15px; }
.inst-prose p { margin: 0 0 12px; }
.inst-prose code {
  font-family: var(--mono); font-size: 0.9em;
  background: var(--surface-2); padding: 1px 5px; border-radius: 4px;
}
.inst-visual {
  margin-top: 12px; padding: 12px;
  border: 1px solid var(--line-2); border-radius: var(--r1);
  color: var(--t1); overflow-x: auto;
}
.inst-diagram { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto; }
.inst-textarea {
  width: 100%; margin-top: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r1); color: var(--t0); resize: vertical;
}
.text-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--t2); font-size: 13px; margin-bottom: 8px;
}
.lesson-top, .onb-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.lesson-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.opt-list.compact { gap: 8px; }
.opt-card.pass { border-color: var(--up); }
.opt-card.fail { border-color: var(--down); opacity: 0.85; }
.srs-card { min-height: 160px; }
.srs-grades { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.inst-cert {
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink);
  padding: 20px 16px; margin-top: 10px;
  border-radius: 2px;
}
.inst-cert .kicker { color: #666; letter-spacing: 0.12em; }
.cert-name { font-family: var(--serif); font-size: 26px; margin: 8px 0; color: var(--ink); }
.cert-course { font-weight: 600; color: var(--ink); }
.cert-disc { font-size: 12px; line-height: 1.45; color: #444; margin: 12px 0; }
.inst-rule { border: none; border-top: 1px solid var(--line-2); margin: 16px 0; }
.mt10 { margin-top: 10px; }
.mt16 { margin-top: 16px; }
.onb-ul { color: var(--t1); }

@media (min-width: 900px) {
  :root { --maxw: 1100px; }
  body.inst-desktop #app-root { max-width: var(--maxw); margin: 0 auto; }
}

.tab { position: relative; }
.tab-ic-wrap { position: relative; display: inline-flex; }
.tab-badge {
  position: absolute; top: -6px; right: -10px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--acc); color: #fff;
  font-family: var(--mono); font-size: 11px; line-height: 16px; text-align: center;
  font-weight: 600;
}
.records-seg { gap: 4px; }
.branch-grid {
  display: grid;
  gap: 12px;
}
@media (min-width: 900px) {
  .branch-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .inst-list.branch-grid { display: grid; }
}
.branch-enter { position: absolute; right: 16px; bottom: 14px; color: var(--acc); font-size: 12px; }
.student-strip { margin-bottom: 14px; }
.inst-reader {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 16px;
  min-height: 220px;
}
.inst-reader-page { min-height: 160px; }
.inst-reader-nav { display: flex; gap: 8px; margin-top: 14px; }
[data-theme="sepia"] .inst-reader,
html[data-mode="sepia"] .inst-reader {
  background: #F3E9D6;
}

/* Code lab + HTTP lab */
.code-lab { margin-top: 12px; }
.code-editor, .code-starter {
  width: 100%; font-family: var(--mono); font-size: 13px; line-height: 1.45;
  background: #0E0E0C; color: var(--t0); border: 1px solid var(--line-2);
  border-radius: var(--r1); padding: 12px; resize: vertical;
}
.code-actions { display: flex; gap: 8px; margin-top: 10px; }
.code-out {
  margin-top: 10px; padding: 12px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r1);
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap;
  color: var(--t1); min-height: 48px;
}
.lab-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.inst-reg-note {
  font-size: 13px; color: var(--acc); border-left: 2px solid var(--acc);
  padding-left: 10px; margin: 0 0 12px; line-height: 1.45;
}

/* Parsons (phone) */
.parsons-lab .parsons-built,
.parsons-lab .parsons-pool {
  display: flex; flex-direction: column; gap: 6px;
  min-height: 44px; padding: 8px;
  border: 1px dashed var(--line-2); border-radius: var(--r1);
  background: var(--surface-2);
}
.parsons-line {
  text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r1); padding: 10px 12px; color: var(--t0);
  font-family: var(--mono); font-size: 13px; cursor: pointer;
}
.parsons-line.on { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 12%, var(--surface)); }
.parsons-line.used,
.parsons-line:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}
.parsons-line code { font-family: inherit; white-space: pre-wrap; }

/* Certificate print */
.cert-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
@media print {
  body * { visibility: hidden !important; }
  .inst-cert, .inst-cert * { visibility: visible !important; }
  .inst-cert {
    position: absolute; left: 0; top: 0; width: 100%;
    border: 3px solid #111; padding: 32px 28px; margin: 0;
    background: #fff !important; color: #111 !important;
    box-shadow: none; page-break-inside: avoid;
  }
  .inst-cert .kicker { letter-spacing: 0.18em; text-transform: uppercase; }
  .cert-name { font-size: 32px; }
  .cert-actions, .cert-no-print, #tabbar, .sheet-root { display: none !important; }
  .inst-cert.cert-print-hide { display: none !important; }
}


/* MST-P1 foundation list rows + section labels */
.hb-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--t3);
  margin: 0 0 0.5rem;
}
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--t0);
  cursor: pointer;
}
.list-row.static { cursor: default; }
.list-row__title { display: block; font-size: 0.95rem; font-weight: 600; }
.list-row__sub { display: block; font-size: 0.75rem; color: var(--t3); margin-top: 2px; }
.mc-name-input {
  width: 100%;
  margin-top: 12px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--t0);
  padding: 0 12px;
  font-size: 1rem;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Skip link — keyboard / VoiceOver entry to main (cap a11y baseline) */
.cap-skip-link {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 8px;
  z-index: 10000;
  padding: 10px 18px;
  background: var(--accent, #c4a35a);
  color: var(--bg, #1a1814);
  font-weight: 700;
  font-size: 14px;
  border-radius: 999px;
  transform: translateY(-250%);
  transition: transform 0.15s ease;
  text-decoration: none;
}
.cap-skip-link:focus,
.cap-skip-link:focus-visible {
  transform: none;
  outline: 2px solid var(--accent, #c4a35a);
  outline-offset: 2px;
}
