/* Sustainment Academy
   ---------------------------------------------------------------------------
   Design language: maritime sustainment plot. Readiness is treated as a living
   system: route traces show sequence, sonar-like contours show interaction,
   and instrument labels keep technical evidence precise.
   No webfonts and no external requests.
   --------------------------------------------------------------------------- */

:root {
  --bg: #edf3f3;
  --bg-deep: #dde8e8;
  --surface: #fbfcfa;
  --surface-2: #f4f8f7;
  --surface-hover: #e7f0ef;
  --ink: #17303a;
  --ink-soft: #526a70;
  --ink-faint: #52636a;
  --on-accent: #ffffff;
  --line: #d1dddd;
  --line-strong: #adc0c0;

  --accent: #256c77;
  --accent-soft: #dcecee;
  --brass: #c98724;
  --brass-soft: #f4e8ce;
  --brass-text: #8a5a10;

  --green: #4e7759;
  --green-soft: #deece1;
  --red: #b95346;
  --red-soft: #f5dfdb;
  --amber: #c98724;
  --amber-soft: #f4e8ce;
  --violet: #665b84;
  --violet-soft: #e9e5f0;
  --teal: #277d7b;
  --teal-soft: #dbeeed;

  --radius: 18px;
  --shadow:
    0 1px 1px rgba(30, 35, 45, .04),
    0 3px 8px rgba(30, 35, 45, .05),
    0 12px 28px rgba(30, 35, 45, .06);
  --shadow-lift:
    0 2px 4px rgba(30, 35, 45, .06),
    0 10px 22px rgba(30, 35, 45, .10),
    0 24px 50px rgba(30, 35, 45, .10);
  --edge: inset 0 1px 0 rgba(255, 255, 255, .8);
  --glow: none;

  --font-display: "Avenir Next Condensed", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --math: "Cambria Math", "STIX Two Math", "Latin Modern Math", Georgia, "Times New Roman", serif;

  /* Widget series palette — referenced from SVG attributes as var(--w-*) */
  --w-blue: #0f6d8c;   --w-blue-soft: #dfeef3;
  --w-red: #b23a24;    --w-red-soft: #f9e6e1;
  --w-green: #1c7a45;  --w-green-soft: #e0f0e5;
  --w-amber: #9a6b12;  --w-amber-soft: #f6ecd6;
  --w-violet: #5c44b8;
  --w-teal: #0d7a72;
  --w-orange: #c06718; --w-yellow: #c9a114; --w-lime: #6f9f3f;
}

[data-theme="dark"] {
  /* ---- dark: the control room. Depth is blue-black, light is brass. ---- */
  --bg: #080d14;
  --bg-deep: #05090e;
  --surface: #101922;
  --surface-2: #16212c;
  --surface-hover: #1d2a37;
  --ink: #eaf1f7;
  --ink-soft: #9fb2c4;
  --ink-faint: #8295a8;
  --on-accent: #04121a;
  --line: #1e2c3a;
  --line-strong: #2c3f52;

  --accent: #4fc7e8;
  --accent-soft: rgba(79, 199, 232, .13);
  --brass: #e0ab4d;
  --brass-text: #e0ab4d;
  --brass-soft: rgba(224, 171, 77, .14);

  --green: #52c98a;
  --green-soft: rgba(82, 201, 138, .14);
  --red: #f0705f;
  --red-soft: rgba(240, 112, 95, .14);
  --amber: #e0ab4d;
  --amber-soft: rgba(224, 171, 77, .14);
  --violet: #a98cf0;
  --violet-soft: rgba(169, 140, 240, .14);
  --teal: #45cbb8;
  --teal-soft: rgba(69, 203, 184, .14);

  --shadow:
    0 1px 1px rgba(0, 0, 0, .5),
    0 4px 14px rgba(0, 0, 0, .45),
    0 16px 40px rgba(0, 0, 0, .4);
  --shadow-lift:
    0 2px 6px rgba(0, 0, 0, .55),
    0 14px 32px rgba(0, 0, 0, .55),
    0 32px 70px rgba(0, 0, 0, .5);
  /* Hairline of light along the top edge — machined panel, not flat rectangle */
  --edge: inset 0 1px 0 rgba(255, 255, 255, .055);
  --glow: 0 0 0 1px rgba(79, 199, 232, .10);

  /* Brighter series colours so charts stay legible on the dark surface */
  --w-blue: #5cc6f0;   --w-blue-soft: rgba(92, 198, 240, .17);
  --w-red: #f0705f;    --w-red-soft: rgba(240, 112, 95, .17);
  --w-green: #52c98a;  --w-green-soft: rgba(82, 201, 138, .17);
  --w-amber: #e0ab4d;  --w-amber-soft: rgba(224, 171, 77, .17);
  --w-violet: #a98cf0;
  --w-teal: #45cbb8;
  --w-orange: #f0914d; --w-yellow: #ecc94b; --w-lime: #a6d95f;
}

* { box-sizing: border-box; }

.route-focus-target:focus { outline: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Atmosphere ----------
   Two fixed, non-interactive layers behind everything: a soft brass wash from
   the top-left (instrument backlight) and a fine graticule. Both are pure CSS,
   both vanish in print. */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 620px at 8% -5%, var(--brass-soft), transparent 58%),
    radial-gradient(980px 640px at 94% 2%, var(--accent-soft), transparent 58%),
    linear-gradient(180deg, transparent 55%, var(--bg-deep) 100%);
  opacity: .9;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, var(--line-strong) 1px, transparent 1.5px);
  background-size: 28px 28px;
  opacity: .19;
  mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 78%);
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button { font-family: var(--font); }

/* Display type: rounded, energetic and legible at learning pace. */
h1, h2, .brand, .certificate h1 {
  font-family: var(--font-display);
  letter-spacing: -.015em;
  font-weight: 750;
}

/* Instrument labels: small, spaced, monospaced. Used for every kicker,
   readout label and metadata line in the app. */
.kicker, .readout .label, .complete .stat .label, .deck-count,
.ref-block h3, .rs-l, .cf-l, .search-item .kind {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--edge);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
}

.topbar .brand {
  min-height: 44px;
  font-size: 19px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: none;
  color: var(--ink);
  padding: 4px 8px;
  border-radius: 8px;
  transition: color .15s ease;
}
.topbar .brand:hover { color: var(--accent); background: none; }
.topbar .brand-mark {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: var(--accent);
}
.topbar .brand-mark svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
}
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.topbar .spacer { flex: 1; }

.xp-pill {
  background: var(--brass-soft);
  color: var(--brass-text);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  padding: 6px 13px;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brass) 28%, transparent);
}

.back-btn {
  min-height: 44px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Layout ---------- */

.page {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  flex: 1;
}

.page h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.3px; }
.page .subtitle { color: var(--ink-soft); margin: 0 0 30px; font-size: 17px; }

/* ---------- Home: course grid ---------- */

.home-page {
  max-width: 1160px;
  padding-top: 28px;
}

.home-hero {
  position: relative;
  min-height: 390px;
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(390px, .97fr);
  align-items: center;
  gap: 28px;
  overflow: hidden;
  padding: 44px 46px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 30px;
  background:
    radial-gradient(circle at 74% 48%, color-mix(in srgb, var(--accent-soft) 80%, transparent), transparent 39%),
    linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--surface) 78%, var(--accent-soft)));
  box-shadow: var(--shadow-lift), var(--edge);
  isolation: isolate;
}
.home-hero::before {
  content: "";
  position: absolute;
  width: 250px;
  height: 250px;
  left: -90px;
  bottom: -150px;
  border: 42px solid color-mix(in srgb, var(--brass) 12%, transparent);
  border-radius: 50%;
  z-index: -1;
}
.hero-copy { position: relative; z-index: 2; }
.home-hero h1 {
  max-width: 650px;
  margin: 0 0 16px;
  font-size: clamp(38px, 4.6vw, 60px);
  line-height: .99;
  letter-spacing: -.045em;
}
.home-hero .subtitle {
  max-width: 590px;
  margin-bottom: 24px;
  font-size: 17.5px;
  line-height: 1.55;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-cta { padding-inline: 25px; }
.hero-facts {
  display: flex;
  gap: 19px;
  flex-wrap: wrap;
  margin-top: 24px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10.5px;
}
.hero-facts span { white-space: nowrap; }
.hero-facts strong { color: var(--ink); font-size: 13px; }

.reliability-loop { position: relative; z-index: 1; min-width: 0; }
.reliability-loop svg { display: block; width: 100%; overflow: visible; }
.rl-guide {
  fill: color-mix(in srgb, var(--accent-soft) 34%, transparent);
  stroke: var(--line-strong);
  stroke-width: 1.5;
  stroke-dasharray: 4 9;
}
.rl-flow {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 72%, var(--line-strong));
  stroke-width: 2.5;
  stroke-linecap: round;
}
#loopArrow { fill: var(--accent); }
.rl-pulse { fill: #ff6b63; stroke: var(--surface); stroke-width: 4; }
.rl-core > circle:first-child {
  fill: #17385c;
  stroke: #0e2742;
  stroke-width: 3;
  filter: drop-shadow(0 10px 16px rgba(23, 56, 92, .18));
}
.rl-core-ring { fill: none; stroke: #5bc6df; stroke-width: 2; stroke-dasharray: 3 6; }
.rl-core-gear { fill: none; stroke: #ffb433; stroke-width: 4; stroke-linecap: round; }
.rl-core text {
  fill: #fff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-anchor: middle;
}
.rl-core .rl-core-small { fill: #a9deec; font-size: 8px; letter-spacing: .18em; }
.rl-card rect {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1.5;
  filter: drop-shadow(0 6px 10px rgba(30, 55, 85, .10));
}
.rl-card text {
  fill: var(--ink);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
}
.rl-card .rl-card-sub { fill: var(--ink-soft); font-size: 8px; font-weight: 600; }
.rl-card-icon {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rl-operate .rl-card-icon { stroke: var(--violet); }
.rl-observe .rl-card-icon { stroke: #e85c55; }
.rl-decide .rl-card-icon { stroke: var(--green); }
.rl-improve .rl-card-icon { stroke: var(--brass); }

.home-eyebrow {
  color: var(--brass-text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  margin-bottom: 9px;
}

.section-head {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin: 46px 0 18px;
  padding-bottom: 11px;
  position: relative;
}
.section-head::before {
  background: var(--accent);
  bottom: -1px;
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  width: 44px;
}
.section-head h2 {
  font-size: 24px;
  margin: 0 0 2px;
}
.section-head p {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin: 0;
}

.practice-grid { display: grid; }

.course-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.course-card {
  position: relative;
  background:
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--edge);
  padding: 23px;
  cursor: pointer;
  text-align: left;
  display: flex;
  gap: 15px;
  align-items: flex-start;
  overflow: hidden;
  transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease, border-color .18s ease;
  font-size: inherit;
  color: inherit;
  animation: cardRise .4s cubic-bezier(.2, .7, .3, 1) backwards;
}
/* Each course is identified by a colour rail and its own line illustration. */
.course-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--rail, var(--line-strong));
  opacity: .75;
  transition: width .18s ease, opacity .18s ease;
}
.course-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift), var(--edge);
  border-color: var(--line-strong);
}
.course-card:hover::before { width: 5px; opacity: 1; }
.course-card:active { transform: translateY(-1px); }

@keyframes cardRise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.course-card .icon {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.course-card .icon svg, .course-head .icon svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.course-card h2 { margin: 0 0 5px; font-size: 18px; line-height: 1.18; }
.course-card p { margin: 0 0 10px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.45; }
.course-card .meta { font-size: 13px; color: var(--ink-faint); font-weight: 600; }

.practice-grid .course-card {
  border-style: dashed;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brass-soft) 55%, transparent), transparent 58%),
    var(--surface);
}
.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 13px 0;
}
.skill-chips span {
  background: color-mix(in srgb, var(--brass) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brass) 35%, var(--line));
  border-radius: 999px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 5px 9px;
}

.app-foot {
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .04em;
  margin-top: 38px;
  padding-top: 14px;
  text-align: center;
}
.app-foot span { display: inline; }
.footer-link {
  min-height: 44px;
  margin-left: 6px;
  padding: 6px 9px;
  color: var(--accent);
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.progress-track {
  height: 7px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
  margin-top: 10px;
}
.progress-track .fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .3s ease; }

/* ---------- Course page: lesson list ---------- */

.course-head {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 26px;
}

.course-sources {
  background: var(--brass-soft);
  border: 1px solid color-mix(in srgb, var(--brass) 60%, var(--line));
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  margin: -10px 0 24px 86px;
  padding: 15px 17px;
}
.course-sources summary {
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
}
.course-sources p { margin: 8px 0 0; }
.course-sources ul { margin: 10px 0 2px; padding-left: 19px; }
.course-sources li { margin: 5px 0; }
.course-sources a { color: var(--accent); }
.course-sources a:hover { text-decoration-thickness: 2px; }
.source-citation, .source-classification { display: block; margin-top: 3px; color: var(--ink-soft); font-family: var(--mono); font-size: 10px; }
.source-classification { color: var(--red); font-weight: 800; letter-spacing: .06em; }

/* ---------- Engineering review desk ---------- */

.field-tabs {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 18px;
}
.field-tab {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 750;
  gap: 6px;
  justify-content: center;
  min-height: 74px;
  padding: 9px 7px;
  text-align: center;
}
.field-tab span { font-size: 22px; }
.field-tab:hover { border-color: var(--brass-text); color: var(--ink); }
.field-tab.active {
  background: var(--brass-soft);
  border-color: var(--brass-text);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--brass);
}

.field-body {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--edge);
  overflow: hidden;
}
.field-guide-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 15px;
  padding: 21px 24px;
}
.field-guide-head .fgh-icon {
  align-items: center;
  background: var(--brass-soft);
  border-radius: 12px;
  display: flex;
  flex: 0 0 48px;
  font-size: 25px;
  height: 48px;
  justify-content: center;
}
.field-guide-head h2 { font-size: 21px; margin: 0 0 3px; }
.field-guide-head p { color: var(--ink-soft); font-size: 14px; margin: 0; }

.field-progress {
  align-items: center;
  background:
    linear-gradient(90deg, var(--brass-soft) var(--checked, 0%), transparent var(--checked, 0%));
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  display: flex;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  justify-content: space-between;
  padding: 8px 24px;
  transition: background .2s ease;
}
.field-progress .link-btn { font-family: var(--font); }

.check-group { padding: 18px 24px 9px; }
.check-group + .check-group { border-top: 1px solid var(--line); }
.check-group h3 {
  color: var(--brass-text);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .13em;
  margin: 0 0 11px;
  text-transform: uppercase;
}
.check-item {
  align-items: flex-start;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 11px;
  margin: 2px -7px;
  padding: 7px;
}
.check-item:hover { background: var(--surface-hover); }
.check-item input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}
.check-mark {
  background: var(--bg-deep);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  flex: 0 0 19px;
  height: 19px;
  margin-top: 1px;
  position: relative;
}
.check-item input:focus-visible + .check-mark {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}
.check-item input:checked + .check-mark {
  background: var(--green);
  border-color: var(--green);
}
.check-item input:checked + .check-mark::after {
  color: #04140b;
  content: "✓";
  font-size: 13px;
  font-weight: 900;
  left: 3px;
  position: absolute;
  top: -1px;
}
.check-item input:checked ~ .check-text {
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--ink-faint) 55%, transparent);
}
.check-text { color: var(--ink); font-size: 14px; line-height: 1.45; }

.decision-template {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 18px;
  padding: 16px 19px;
}
.decision-template summary { cursor: pointer; font-weight: 800; }
.decision-template p { color: var(--ink-soft); font-size: 13.5px; }
.decision-template textarea {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  min-height: 340px;
  padding: 14px;
  resize: vertical;
  width: 100%;
}
.template-actions { align-items: center; display: flex; gap: 12px; margin-top: 10px; }
.copy-status { color: var(--green); font-size: 13px; font-weight: 700; }
.course-head .icon {
  font-size: 36px;
  width: 68px;
  height: 68px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lesson-list { display: flex; flex-direction: column; gap: 12px; }

.lesson-row {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--edge);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform .16s cubic-bezier(.2,.7,.3,1), border-color .16s ease, box-shadow .16s ease;
  font-size: inherit;
  color: inherit;
}
.lesson-row:hover {
  transform: translateX(4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lift), var(--edge);
}

.lesson-row .num {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  box-shadow: inset 0 0 0 1px currentColor;
}
.lesson-row.done .num { background: var(--green-soft); color: var(--green); }

.lesson-row .body { flex: 1; }
.lesson-row h3 { margin: 0 0 2px; font-size: 16.5px; }
.lesson-row p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.lesson-row .badge { font-size: 13px; font-weight: 700; color: var(--green); white-space: nowrap; }
.lesson-row .badge.todo { color: var(--ink-faint); }

/* ---------- Lesson player ---------- */

.player-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
}
.player-bar .quit {
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
  line-height: 1;
}
.player-bar .quit:hover { background: var(--red-soft); color: var(--red); }
.player-bar .progress-track { flex: 1; margin: 0; height: 9px; }
.player-bar .player-stats { font-size: 12px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .player-bar .player-stats { display: none; } }
.player-bar .count { font-size: 13px; font-weight: 700; color: var(--ink-faint); white-space: nowrap; }

.lesson-breadcrumb { padding: 0 16px 8px; }
.lesson-breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}
.lesson-breadcrumb-item { display: flex; align-items: center; max-width: 100%; }
.lesson-breadcrumb-item:not(:last-child)::after {
  content: "›";
  margin-left: 10px;
  color: var(--ink-faint);
  font-weight: 700;
}
.lesson-breadcrumb-link {
  background: none;
  border: none;
  padding: 4px 0;
  color: var(--teal);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  max-width: 100%;
}
:root:not([data-theme="dark"]) .lesson-breadcrumb-link { color: #17605f; }
.lesson-breadcrumb-link:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.lesson-breadcrumb-current { font-weight: 700; color: var(--ink); }
.lesson-position-note {
  margin: 0 16px 10px;
  font-size: 13px;
  color: var(--ink-faint);
  line-height: 1.45;
}
.lesson-restore-notice {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--amber-soft, #fff6e6);
  color: var(--ink);
  font-size: 14px;
}
.feedback-breadcrumb { padding: 0 0 12px; }
.feedback-return-hint { margin: 0 0 16px; }
.feedback-return-btn { max-width: 100%; white-space: normal; text-align: left; }

.card-stage {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 20px 140px;
  flex: 1;
}

.lesson-evidence {
  display: flex;
  max-width: 760px;
  align-items: flex-start;
  gap: 14px;
  margin: 12px auto -2px;
  padding: 11px 15px;
  border: 1px solid color-mix(in srgb, var(--brass) 52%, var(--line));
  border-radius: 11px;
  background: var(--brass-soft);
  color: var(--ink-soft);
  font-size: 12px;
}
.lesson-evidence > strong { flex: 0 0 auto; color: var(--ink); }
.lesson-evidence-links { display: flex; flex-wrap: wrap; gap: 5px 14px; }
.lesson-evidence a { color: var(--accent); font-weight: 700; text-underline-offset: 2px; }
.lesson-source-text { color: var(--ink); font-weight: 750; }
.lesson-evidence-links small { display: block; margin-top: 2px; color: var(--ink-soft); font-family: var(--mono); font-size: 9px; }

.kicker.overview { color: #8c5c08; }
.lesson-outcomes {
  margin: 20px 0;
  padding: 17px 19px;
  border-left: 5px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--accent-soft);
}
.lesson-outcomes ul { margin-bottom: 0; }
.term-preview {
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
}
.pf-definitions { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 18px 0; }
.pf-definitions > div { padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.pf-definitions b { display: grid; width: 42px; height: 42px; place-items: center; margin-bottom: 10px; color: #fff; border-radius: 50%; background: var(--accent); font: 800 24px/1 var(--mono); }
.pf-definitions strong { display: block; font-size: 17px; }
.pf-definitions p { margin: 7px 0 0; font-size: 14px; }
.timeline-example { display: grid; grid-template-columns: 1fr auto auto 1fr; align-items: center; gap: 11px; margin: 19px 0; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); text-align: center; }
.timeline-example i { color: var(--red); font: 750 11px/1.25 var(--mono); }

.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 30%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--edge);
  padding: 30px 36px 32px;
  animation: cardIn .3s cubic-bezier(.2, .7, .3, 1);
}
/* Corner ticks — the small instrument-panel detail that makes the card read
   as a machined object rather than a div. */
.card::before, .card::after {
  content: "";
  position: absolute;
  width: 9px; height: 9px;
  border-color: var(--line-strong);
  opacity: .6;
  pointer-events: none;
}
.card::before { top: 9px; left: 9px; border-top: 1.5px solid; border-left: 1.5px solid; border-top-left-radius: 3px; }
.card::after { bottom: 9px; right: 9px; border-bottom: 1.5px solid; border-right: 1.5px solid; border-bottom-right-radius: 3px; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(.995); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Kicker reads as an instrument label: mono, spaced, with a leading rule. */
.card .kicker {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--accent);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.card .kicker::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, currentColor, transparent);
  opacity: .3;
}
.card .kicker.quiz { color: var(--violet); }
.card .kicker.explore { color: var(--teal); }
.card .kicker.recap { color: var(--brass-text); }
.card .kicker.steps { color: var(--w-teal); }
.card .kicker.target { color: var(--brass-text); }
.card .kicker.cards { color: var(--violet); }

.card h2 { margin: 0 0 16px; font-size: 26px; line-height: 1.22; }
.evidence-note {
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-soft);
  border-radius: 0 10px 10px 0;
  background: var(--bg);
  padding: 10px 13px;
  margin: -2px 0 16px;
  font-size: 14px;
}
.evidence-note.published { border-left-color: var(--green); background: var(--green-soft); }
.evidence-note.observed { border-left-color: var(--teal); background: var(--accent-soft); }
.evidence-note.illustrative { border-left-color: var(--brass-text); background: var(--amber-soft); }
.evidence-note.simulation { border-left-color: var(--violet); background: var(--violet-soft); }
.evidence-note .evidence-kind {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.evidence-note p { color: var(--ink-soft); margin: 0 0 6px; }
.evidence-sources { color: var(--ink-soft); font-size: 13px; }
.evidence-sources a { color: var(--accent); font-weight: 750; text-decoration-thickness: 1px; }
.card p { margin: 0 0 14px; }
.card p:last-child { margin-bottom: 0; }
.card ul, .card ol { margin: 0 0 14px; padding-left: 24px; }
.card li { margin-bottom: 6px; }
.card strong { color: var(--ink); }
.card .formula {
  font-family: var(--mono);
  font-size: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 18px;
  margin: 14px 0;
  text-align: center;
  overflow-x: auto;
}
.card .callout {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  margin: 14px 0;
  font-size: 15.5px;
}
.card .callout.warn { border-color: var(--brass-text); background: var(--amber-soft); }
.card table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 15px; }
.card th, .card td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.card th { background: var(--bg); font-size: 13.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }

@media (max-width: 600px) {
  .card .timing-table,
  .card .timing-table tbody,
  .card .timing-table tr,
  .card .timing-table td { display: block; width: 100%; }
  .card .timing-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .card .timing-table { border-collapse: separate; border-spacing: 0 12px; }
  .card .timing-table tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface);
    margin-bottom: 12px;
  }
  .card .timing-table td { border: 0; border-bottom: 1px solid var(--line); padding: 11px 13px; }
  .card .timing-table td:last-child { border-bottom: 0; }
  .card .timing-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--ink-soft);
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 850;
    letter-spacing: .8px;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
}

/* ---------- Choices (MCQ) ---------- */

.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

.choice {
  position: relative;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 11px;
  padding: 14px 18px 14px 20px;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .14s ease, box-shadow .14s ease;
  color: var(--ink);
  line-height: 1.45;
  box-shadow: var(--edge);
}
.choice:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(3px);
}
.choice.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
  box-shadow: 0 0 0 3px var(--accent-soft), var(--edge);
}
.choice.correct { border-color: var(--green); background: var(--green-soft); font-weight: 600; }
.choice.wrong { border-color: var(--red); background: var(--red-soft); }
.choice:disabled { cursor: default; opacity: .85; }
.choice.dim { opacity: .45; }

/* ---------- Numeric input ---------- */

.numeric-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}
.numeric-wrap input {
  font-family: var(--mono);
  font-size: 19px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  width: 200px;
  outline: none;
  color: var(--ink);
  background: var(--surface);
}
.numeric-wrap input:focus { border-color: var(--accent); }
.numeric-wrap input.correct { border-color: var(--green); background: var(--green-soft); }
.numeric-wrap input.wrong { border-color: var(--red); background: var(--red-soft); }
.numeric-wrap .unit { color: var(--ink-soft); font-weight: 600; }

/* ---------- Feedback panel ---------- */

.feedback {
  margin-top: 20px;
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 15.5px;
  animation: cardIn .2s ease;
}
.feedback.good { background: var(--green-soft); border: 1px solid #bfe5c8; }
.feedback.bad { background: var(--red-soft); border: 1px solid #f2c7bd; }
.feedback .verdict { font-weight: 800; margin: 0 0 6px; font-size: 16px; }
.feedback.good .verdict { color: var(--green); }
.feedback.bad .verdict { color: var(--red); }
.feedback p { margin: 0 0 8px; }
.feedback p:last-child { margin-bottom: 0; }
.feedback-reasoning { margin-top: 12px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.feedback-label { display: block; margin-bottom: 7px; color: var(--ink-soft); font-family: var(--mono); font-size: 9px; font-weight: 850; letter-spacing: .13em; }
.guess-btn { margin-top: 13px; padding: 9px 13px; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font: 700 12px/1.2 var(--font); }
.guess-btn:hover { border-color: var(--accent); }
.guess-btn:disabled { cursor: default; opacity: .72; }

/* ---------- Bottom action bar ---------- */

.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, .10);
  padding: 14px 20px;
  display: flex;
  justify-content: center;
  z-index: 30;
}
.action-bar .inner {
  width: 100%;
  max-width: 720px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn {
  border: none;
  border-radius: 999px;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: .01em;
  padding: 13px 36px;
  cursor: pointer;
  transition: transform .12s cubic-bezier(.2,.7,.3,1), filter .12s ease, box-shadow .12s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 2px 8px rgba(0, 0, 0, .18);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.07); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.985); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:disabled {
  background: var(--surface-hover); color: var(--ink-faint);
  cursor: default; box-shadow: none;
}
.btn.green { background: var(--green); color: #04140b; }
.btn.ghost {
  background: none; color: var(--ink-soft);
  border: 1px solid var(--line); box-shadow: none;
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Widgets ---------- */

/* A widget is an instrument set into the page: recessed, gridded, hairlined. */
.widget {
  position: relative;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  /* Faint graticule — present enough to read as an instrument face, faint
     enough not to fight the chart's own gridlines. */
  background:
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--line) 45%, transparent) 0 1px, transparent 1px 30px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--line) 45%, transparent) 0 1px, transparent 1px 30px),
    var(--bg-deep);
  padding: 18px 20px;
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, .18);
}
.widget > * { position: relative; }
.widget svg { width: 100%; height: auto; display: block; }

.widget .controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin-top: 14px;
}
.widget .ctl { flex: 1; min-width: 200px; }
.widget .ctl label {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.widget .ctl label .val { color: var(--accent); font-family: var(--mono); font-weight: 600; }
.widget input[type=range] { width: 100%; min-height: 44px; accent-color: var(--accent); }

.widget .readouts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
/* Readouts are the gauges. Brass-lit numerals, mono, tabular. */
.readout {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 15px;
  min-width: 130px;
  flex: 1;
  box-shadow: var(--edge), 0 1px 3px rgba(0,0,0,.2);
}
.readout .label {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .15em; color: var(--ink-faint);
}
.readout .value {
  font-family: var(--mono); font-size: 20px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.readout.hi .value, .readout.lo .value, .readout.mid .value { text-shadow: 0 0 18px currentColor; }
.readout.hi .value { color: var(--green); }
.readout.lo .value { color: var(--red); }
.readout.mid .value { color: var(--brass-text); }

.widget .note { font-size: 14px; color: var(--ink-soft); margin: 12px 0 0; }
.widget .model-basis {
  margin: 12px 0;
  padding: 11px 13px;
  color: var(--ink-soft);
  border-left: 4px solid var(--brass);
  border-radius: 0 9px 9px 0;
  background: var(--brass-soft);
  font-size: 12.5px;
  line-height: 1.45;
}
.widget .model-basis strong { color: var(--ink); }

/* ---------- Lesson complete ---------- */

.complete {
  text-align: center;
  padding: 60px 20px;
}
.complete .big { font-size: 64px; margin-bottom: 10px; }
.complete h2 { font-size: 28px; margin: 0 0 8px; }
.complete p { color: var(--ink-soft); margin: 0 0 26px; }
.complete .stats { display: flex; gap: 14px; justify-content: center; margin-bottom: 34px; flex-wrap: wrap; }
.complete .stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px 28px;
}
.complete .stat .value { font-size: 28px; font-weight: 800; color: var(--accent); }
.complete .stat .label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); }

/* ---------- Modals & Command Palette ---------- */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  color: var(--ink);
}

.search-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.search-header input {
  flex: 1;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--ink);
  outline: none;
  font-family: var(--font);
}
.search-close {
  min-height: 44px;
  padding: 8px 12px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
}
.search-close:hover { color: var(--accent); border-color: var(--accent); }
.search-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 10px;
}

.shortcut-card { max-width: 760px; }
.shortcut-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}
.shortcut-kicker { color: var(--accent); font-family: var(--mono); font-size: 9px; font-weight: 850; letter-spacing: .14em; }
.shortcut-head h2 { margin: 4px 0 0; font-size: 24px; }
.shortcut-body { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; padding: 21px 22px 24px; }
.shortcut-body h3 { margin: 0 0 10px; color: var(--ink-soft); font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.shortcut-body dl { margin: 0; }
.shortcut-body dl > div { display: grid; grid-template-columns: minmax(92px, auto) 1fr; align-items: center; gap: 13px; min-height: 42px; border-top: 1px solid var(--line); }
.shortcut-body dt, .shortcut-body dd { margin: 0; }
.shortcut-body dd { color: var(--ink-soft); font-size: 12.5px; }
.shortcut-body dt span { color: var(--ink-faint); font-size: 9px; }
kbd { display: inline-grid; min-width: 27px; min-height: 27px; place-items: center; padding: 3px 7px; color: var(--ink); border: 1px solid var(--line-strong); border-bottom-width: 3px; border-radius: 6px; background: var(--surface-2); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); font: 750 11px/1 var(--mono); }
.search-item {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  color: var(--ink);
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}
.search-item:hover { background: var(--surface-hover); }
.search-item .title, .search-item .sub { display: block; }
.search-item .title { font-weight: 700; font-size: 15px; }
.search-item .sub { font-size: 13px; color: var(--ink-soft); }

@media (max-width: 560px) {
  .modal-overlay {
    align-items: flex-start;
    padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
  }
  .modal-card { border-radius: 13px; }
  .search-header { padding: 10px; }
  .search-header input { min-width: 0; font-size: 16px; }
  .shortcut-body { grid-template-columns: 1fr; gap: 22px; padding: 18px 15px 22px; }
  .shortcut-head { padding: 17px 15px 13px; }
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 15px;
  padding: 5px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.icon-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Maths (rendered by js/math.js) ---------- */

.math {
  font-family: var(--math);
  font-style: italic;
  white-space: nowrap;
  font-size: 1.04em;
}
.math.display {
  display: block;
  text-align: center;
  margin: 16px 0;
  font-size: 1.2em;
  white-space: normal;
}
.math .mn, .math .mtext, .math .mop { font-style: normal; }
.math .mop { margin: 0 .22em; }
.math .mgreek { font-style: italic; }
.math .mspace { display: inline-block; width: .18em; }
.math sub, .math sup { font-size: .68em; }

.mfrac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: -0.5em;
  text-align: center;
  margin: 0 .2em;
  font-size: .94em;
}
.mfrac .mnum { padding: 0 .35em 1px; border-bottom: 1.4px solid currentColor; }
.mfrac .mden { padding: 1px .35em 0; }
.mfrac-inline .mslash { font-style: normal; padding: 0 .1em; }
.msqrt { border-top: 1.3px solid currentColor; padding: 1px .2em 0; margin-left: .1em; }
.msqrt::before { content: "√"; margin-left: -.55em; font-style: normal; }
.mbar { border-top: 1.3px solid currentColor; padding-top: 1px; }
.mhat::before { content: "^"; position: relative; top: -.5em; font-style: normal; }

/* ---------- Chart chrome (theme-aware SVG) ---------- */

.widget svg .ax-line { stroke: var(--ink-faint); }
.widget svg .ax-grid { stroke: var(--line); }
.widget svg .ax-text { fill: var(--ink-soft); }

/* ---------- Home dashboard ---------- */

.dash {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin: 20px 0 26px;
}
.dash-tile {
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  color: inherit;
  font-size: inherit;
  box-shadow: var(--shadow), var(--edge);
  transition: border-color .16s ease, transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .16s ease;
}
.dash-tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift), var(--edge);
}
.dash-tile.primary {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: linear-gradient(180deg, var(--accent-soft), var(--surface));
}
.dash-tile .dt-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
}
.dash-tile .dt-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dash-tile .dt-icon.reference { color: var(--brass-text); background: var(--brass-soft); }
.dash-tile .dt-icon.field { color: var(--violet); background: var(--violet-soft); }
.dash-tile .dt-icon.certificate-icon { color: var(--green); background: var(--green-soft); }
.dash-tile .dt-title { font-weight: 700; font-size: 15px; }
.dash-tile .dt-sub { font-size: 13px; color: var(--ink-soft); line-height: 1.35; }

/* Seven days as a run of small indicator lamps, not a keyboard. */
.week-strip {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  box-shadow: var(--shadow), var(--edge);
}
.week-strip .day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.week-strip .dl {
  font-family: var(--mono);
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  color: var(--ink-faint);
}
.week-strip .dd {
  width: 9px; height: 9px; border-radius: 50%;
  font-size: 0;
  background: var(--bg-deep);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.week-strip .day.hit .dd {
  background: var(--green);
  box-shadow: 0 0 9px color-mix(in srgb, var(--green) 70%, transparent);
}
.week-strip .day.part .dd {
  background: var(--brass);
  box-shadow: 0 0 8px color-mix(in srgb, var(--brass) 60%, transparent);
}

.streak-pill {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  color: var(--ink-faint);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}
.streak-pill.live {
  background: var(--brass-soft); color: var(--brass-text);
  border-color: color-mix(in srgb, var(--brass) 28%, transparent);
}

.progress-pill {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}
.route-crumbs { max-width: 880px; margin: 0 auto; padding-top: 10px; }

.goal-ring { position: relative; width: 30px; height: 30px; flex-shrink: 0; }
.goal-ring svg { display: block; }
.goal-ring .ring-bg { fill: none; stroke: var(--line); stroke-width: 4; }
.goal-ring .ring-fg { fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.goal-ring span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: var(--ink-soft);
}

.course-card.complete { border-color: var(--green); }
.lesson-meta { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; margin-top: 4px; }

/* ---------- New card types ---------- */


/* Ordering */
.sort-list { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.sort-item {
  display: flex; align-items: center; gap: 12px;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--surface); padding: 10px 14px;
}
.sort-item.ok { border-color: var(--green); background: var(--green-soft); }
.sort-item.no { border-color: var(--red); background: var(--red-soft); }
.sort-rank {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.sort-text { flex: 1; font-size: 15.5px; line-height: 1.4; }
.sort-ctrls { display: flex; gap: 6px; }
.sort-btn {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft);
  border-radius: 8px; width: 44px; height: 44px; cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0;
}
.sort-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.sort-btn:disabled { opacity: .3; cursor: default; }
.sort-answer {
  margin-top: 14px; padding: 14px 18px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); font-size: 15px;
}
.sort-answer .sa-title {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--ink-faint); margin-bottom: 8px;
}
.sort-answer div { margin-bottom: 4px; }

/* Classify */
.classify-list { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.classify-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--surface); padding: 10px 14px;
}
.classify-row.ok { border-color: var(--green); }
.classify-row.no { border-color: var(--red); }
.classify-text { flex: 1; min-width: 180px; font-size: 15.5px; line-height: 1.4; }
.classify-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn {
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink-soft);
  min-height: 44px; border-radius: 999px; padding: 8px 14px; font-size: 13.5px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.seg-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.seg-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg-btn.truth { background: var(--green); border-color: var(--green); color: #fff; }
.seg-btn.bad { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.seg-btn:disabled { cursor: default; }

/* Target challenge */
.model-assumptions {
  margin: 16px 0 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 13.5px;
}
.model-assumptions summary {
  padding: 10px 14px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 750;
}
.model-assumptions > div {
  padding: 0 14px 10px;
  border-top: 1px solid var(--line);
}
.model-assumptions p { margin: 9px 0 0; }
.model-assumptions strong { color: var(--ink); }
.goals { display: flex; flex-direction: column; gap: 6px; margin: 16px 0 4px; }
.goal {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1.5px dashed var(--line); border-radius: 10px;
  padding: 9px 14px; font-size: 14.5px; color: var(--ink-soft);
  transition: all .18s ease;
}
.goal .gm { font-weight: 800; color: var(--ink-faint); }
.goal.met { border-style: solid; border-color: var(--green); background: var(--green-soft); color: var(--ink); }
.goal.met .gm { color: var(--green); }
.link-btn {
  background: none; border: none; color: var(--ink-faint);
  font-size: 13.5px; text-decoration: underline; cursor: pointer;
  padding: 8px 0 0; font-family: var(--font);
}
.link-btn:hover { color: var(--accent); }
.link-btn + .link-btn { margin-left: 18px; }

/* Multi-step problems */
.steps-intro { margin-bottom: 6px; }
.steps-host { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.step { border-left: 3px solid var(--accent); padding-left: 16px; }
.step-no {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent); margin-bottom: 6px;
}
.step-prompt { font-size: 16px; margin-bottom: 10px; }
.step-feedback {
  margin-top: 12px; border-radius: 10px; padding: 11px 15px; font-size: 14.5px;
}
.step-feedback.good { background: var(--green-soft); }
.step-feedback.bad { background: var(--red-soft); }
.steps-wrap {
  border-radius: 12px; background: var(--accent-soft);
  border-left: 4px solid var(--accent); padding: 14px 18px; font-size: 15.5px;
}
.hint { margin: 14px 0; font-size: 14.5px; }
.hint summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.hint > div { margin-top: 8px; color: var(--ink-soft); }

/* Flashcards — recall stage */
.deck { margin-top: 18px; }
.deck-count {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--ink-faint); text-align: center;
  margin: 18px 0 12px;
}
.flashcard {
  border: 2px solid var(--line); border-radius: 16px; background: var(--bg);
  min-height: 130px; display: flex; align-items: center; justify-content: center;
  padding: 26px 30px; text-align: center; font-size: 19px; line-height: 1.45;
}
.deck-hint { text-align: center; font-size: 13px; color: var(--ink-faint); margin-top: 10px; font-style: italic; }

.fc-answer {
  margin-top: 16px; border-radius: 14px; padding: 18px 22px;
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  font-size: 16px; animation: cardIn .2s ease;
}
.fc-answer-label {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.1px; color: var(--accent); margin-bottom: 8px;
}
.fc-answer p { margin: 0 0 8px; }
.fc-answer p:last-child { margin-bottom: 0; }

.grade-ask {
  text-align: center; font-size: 13.5px; font-weight: 700;
  color: var(--ink-soft); margin-top: 18px;
}

/* Grade buttons carry the schedule cost, so the choice means something. */
.btn.grade {
  flex: 1; min-width: 0; padding: 10px 6px; font-size: 14.5px; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.2;
}
.btn.grade small {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  opacity: .72; letter-spacing: .02em;
}
.btn.grade.again { background: var(--red); color: #1c0805; }
.btn.grade.hard { background: var(--amber); color: #180f00; }
.btn.grade.good { background: var(--accent); color: #04121a; }
.btn.grade.easy { background: var(--green); color: #04140b; }

.recall-intro, .recall-summary { text-align: center; padding: 16px 4px 4px; }
.recall-intro .ri-icon, .recall-summary .rs-icon { font-size: 42px; margin-bottom: 6px; }
.recall-intro h2, .recall-summary h2 { margin: 0 0 12px; font-size: 22px; }
.recall-intro p { text-align: left; margin: 0 0 12px; font-size: 15.5px; color: var(--ink-soft); }
.recall-intro .ri-how {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 16px; color: var(--ink);
}
.recall-intro .ri-seen { font-size: 13.5px; color: var(--ink-faint); text-align: center; }

.recall-summary .rs-row { display: flex; gap: 12px; justify-content: center; margin: 18px 0 16px; flex-wrap: wrap; }
.recall-summary .rs-stat {
  border-radius: 12px; padding: 12px 22px; min-width: 92px;
  border: 1px solid var(--line); background: var(--bg);
}
.recall-summary .rs-stat.good { border-color: var(--green); background: var(--green-soft); }
.recall-summary .rs-stat.hard { border-color: var(--brass-text); background: var(--amber-soft); }
.recall-summary .rs-stat.again { border-color: var(--red); background: var(--red-soft); }
.recall-summary .rs-v { font-size: 24px; font-weight: 800; }
.recall-summary .rs-stat.good .rs-v { color: var(--green); }
.recall-summary .rs-stat.hard .rs-v { color: var(--brass-text); }
.recall-summary .rs-stat.again .rs-v { color: var(--red); }
.recall-summary .rs-l { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-faint); }
.recall-summary .rs-note { font-size: 14.5px; color: var(--ink-soft); max-width: 460px; margin: 0 auto; }

/* ---------- Review mode ---------- */

.review-card .review-src {
  font-size: 11.5px; font-weight: 700; color: var(--ink-faint);
  margin-bottom: 12px; letter-spacing: .04em;
  display: flex; align-items: center; gap: 7px;
}
.review-front { font-size: 22px; font-weight: 600; text-align: center; padding: 26px 10px; line-height: 1.4; }
.review-back {
  border-top: 1px solid var(--line); padding-top: 20px; margin-top: 4px;
  font-size: 16.5px; line-height: 1.6;
}
.review-back.hidden { display: none; }

.btn.wide { flex: 1; }
.review-filters {
  display: flex;
  gap: 10px;
  overflow: auto hidden;
  padding-bottom: 4px;
  margin-bottom: 14px;
}
.review-filter {
  min-width: 160px;
  color: var(--ink);
  font-family: inherit;
  flex: 0 0 auto;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.review-filter strong { display: block; font-size: 13px; line-height: 1.2; }
.review-filter small { font-size: 11px; color: var(--ink-faint); }
.review-filter.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 78%, var(--surface));
}
.review-filter:disabled {
  opacity: .52;
  cursor: not-allowed;
}
/* Grade buttons are styled once, in the flashcard section — review mode
   reuses them so the two surfaces stay identical. */
.btn.small { padding: 8px 18px; font-size: 14px; }

.strength { margin: 22px auto; max-width: 460px; }
.st-track {
  display: flex; height: 10px; border-radius: 6px; overflow: hidden;
  background: var(--line); margin-bottom: 10px;
}
.st-seg.mature { background: var(--green); }
.st-seg.learning { background: var(--amber); }
.st-seg.unseen { background: var(--line); }
.st-key { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-soft); }
.st-key i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.st-key i.mature { background: var(--green); }
.st-key i.learning { background: var(--amber); }
.st-key i.unseen { background: var(--ink-faint); }

.empty-state {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 40px 30px; text-align: center; margin-bottom: 22px;
}
.empty-state .es-icon { font-size: 46px; margin-bottom: 10px; }
.empty-state h2, .empty-state h3 { margin: 0 0 8px; font-size: 21px; }
.empty-state p { margin: 0 auto; max-width: 520px; color: var(--ink-soft); font-size: 15.5px; }

.complete-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.practice-transfer {
  margin: 24px auto 4px;
  max-width: 560px;
  padding: 20px 22px;
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--green) 52%, var(--line));
  border-left: 5px solid var(--green);
  border-radius: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green-soft) 88%, transparent), transparent 70%),
    var(--surface);
  box-shadow: var(--edge);
}
.practice-transfer .pt-mark {
  margin-bottom: 6px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .12em;
}
.practice-transfer h3 { margin: 0 0 6px; font-size: 19px; }
.practice-transfer p { margin: 0 0 15px; color: var(--ink-soft); font-size: 14.5px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .rl-pulse { display: none; }
}

/* ---------- Search additions ---------- */

.search-empty { padding: 22px; text-align: center; color: var(--ink-faint); font-size: 14px; }
.search-item.cursor { background: var(--accent-soft); }
.search-item .kind { font-size: 11.5px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .6px; }

/* ---------- Handy billy (reference) ---------- */

.ref-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.ref-head h1 { margin: 0 0 6px; }
.ref-sheet { margin-top: 22px; column-count: 2; column-gap: 26px; }
.ref-block {
  break-inside: avoid; page-break-inside: avoid;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 16px; margin-bottom: 14px; display: inline-block; width: 100%;
}
.ref-block h3 {
  margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--accent); border-bottom: 1.5px solid var(--line); padding-bottom: 6px;
}
/* Fixed layout so the column percentages hold — a long formula must wrap
   rather than starve the note column. */
.ref-table { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.ref-table tr { border-bottom: 1px solid var(--line); }
.ref-table tr:last-child { border-bottom: none; }
.ref-table td { padding: 5px 7px 5px 0; vertical-align: top; line-height: 1.4; }
.ref-term { font-weight: 700; width: 26%; color: var(--ink); overflow-wrap: anywhere; }
.ref-formula { width: 33%; color: var(--accent); overflow-wrap: anywhere; }
.ref-formula .math, .ref-term .math { font-size: 1em; white-space: normal; }
.ref-note { width: 41%; color: var(--ink-soft); }
.ref-print-document { display: none; }

/* ---------- Certificates ---------- */

.name-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.name-row label { font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.name-row input, .cert-toolbar input {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 14px;
  font-size: 15px; font-family: var(--font); background: var(--surface); color: var(--ink);
  min-width: 240px; outline: none;
}
.name-row input:focus, .cert-toolbar input:focus { border-color: var(--accent); }

.cert-list { display: flex; flex-direction: column; gap: 10px; }
.cert-row {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 20px; cursor: pointer; color: inherit; font-size: inherit;
  margin-bottom: 10px;
}
.cert-row.unlocked { border-color: var(--green); }
.cert-row.unlocked:hover { transform: translateX(3px); }
.cert-row.locked { opacity: .6; cursor: default; }
.cert-row.master { background: var(--accent-soft); border-color: var(--accent); }
.cert-row .cr-icon { font-size: 26px; }
.cert-row .cr-body { flex: 1; }
.cert-row h3 { margin: 0 0 2px; font-size: 16.5px; }
.cert-row p { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.cert-row .cr-action { font-weight: 800; font-size: 14px; color: var(--accent); white-space: nowrap; }

.cert-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--green-soft); border: 1px solid var(--green);
  border-radius: 12px; padding: 14px 18px; margin: 0 0 22px;
  font-size: 15px;
}
.cert-banner > span { font-size: 26px; }
.cert-banner > div { flex: 1; }

.cert-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.cert-hint { text-align: center; font-size: 13.5px; color: var(--ink-faint); margin-top: 14px; }

.certificate {
  background: #fffdf8;
  color: #1a2233;
  border: 2px solid #0b7e77;
  outline: 8px solid #fffdf8;
  box-shadow: 0 0 0 10px #0b7e77, var(--shadow);
  padding: 46px 52px 40px;
  text-align: center;
  margin: 10px auto 24px;
  max-width: 720px;
  font-family: "Palatino", "Palatino Linotype", Georgia, serif;
}
.certificate .cert-seal { font-size: 40px; margin-bottom: 4px; }
.certificate .cert-kicker {
  font-size: 12px; font-weight: 700; letter-spacing: 4px;
  text-transform: uppercase; color: #0b7e77; margin-bottom: 14px;
}
.certificate h1 { font-size: 33px; margin: 0 0 6px; color: #1a2233; letter-spacing: -.3px; font-weight: 500; }
.certificate h2 { font-size: 25px; margin: 6px 0 4px; color: #0b7e77; font-weight: 600; }
.certificate .cert-rule { height: 2px; background: #0b7e77; width: 90px; margin: 16px auto; opacity: .6; }
.certificate .cert-lead { font-size: 14px; color: #5b6478; margin: 12px 0 6px; font-style: italic; }
.certificate .cert-name {
  font-size: 34px; font-weight: 600; margin: 4px 0 10px;
  border-bottom: 1px solid #c9d2dd; display: inline-block;
  padding: 0 40px 6px; min-width: 300px;
}
.certificate .cert-tagline {
  font-size: 13px; color: #5b6478; max-width: 520px; margin: 6px auto 0; line-height: 1.5;
}
.certificate .cert-facts { display: flex; justify-content: center; gap: 44px; margin: 24px 0 6px; flex-wrap: wrap; }
.certificate .cf-v { font-size: 21px; font-weight: 700; color: #0b7e77; }
.certificate .cf-l { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: #566075; }
.certificate .cert-foot { font-size: 11.5px; color: #566075; line-height: 1.6; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .home-hero {
    grid-template-columns: minmax(0, 1fr) 330px;
    min-height: 350px;
    padding: 34px 36px;
  }
  .home-hero h1 { font-size: clamp(36px, 5.2vw, 50px); }
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .ref-sheet { column-count: 1; }
  .topbar { gap: 7px; padding: 8px 10px; }
  .topbar .brand { font-size: 16px; }
  .course-sources { margin-left: 0; }
  .field-tabs { grid-template-columns: repeat(3, 1fr); }
  .home-hero {
    grid-template-columns: 1fr;
    padding: 32px 28px 12px;
  }
  .reliability-loop {
    width: min(100%, 430px);
    margin: -24px auto -6px;
  }
}

@media (max-width: 560px) {
  .page { padding: 25px 15px 70px; }
  .home-page { padding-top: 14px; }
  .home-hero { border-radius: 22px; padding: 26px 21px 6px; }
  .home-hero h1 { font-size: 37px; line-height: 1; }
  .home-hero .subtitle { font-size: 15.5px; }
  .hero-actions { flex-direction: column; }
  .hero-facts { gap: 8px 14px; }
  .reliability-loop { margin-top: -22px; }
  .page h1 { font-size: 28px; line-height: 1.08; }
  .page .subtitle { font-size: 15.5px; line-height: 1.5; }
  .topbar .brand { padding-left: 3px; }
  .topbar .brand-mark { display: none; }
  .topbar:has(.back-btn) .brand { display: none; }
  .topbar .goal-ring { display: none; }
  .topbar { gap: 5px; padding-left: 10px; padding-right: 10px; flex-wrap: wrap; }
  .topbar .streak-pill, .topbar .progress-pill, .topbar .xp-pill { order: 9; }
  .topbar .streak-pill, .topbar .progress-pill { font-size: 10px; padding: 6px 7px; }
  .topbar .mobile-secondary { display: none; }
  .topbar .icon-btn { min-height: 44px; min-width: 44px; padding: 7px 9px; }
  .topbar .xp-pill { font-size: 11px; padding: 6px 9px; }
  .section-head { margin-top: 28px; }
  .section-head h2 { font-size: 19px; }
  .section-head p { font-size: 12.5px; }
  .card { padding: 22px 20px; }
  .course-grid { grid-template-columns: 1fr; }
  .course-card.featured { padding: 23px 20px 22px 24px; }
  .course-card.featured::after { display: none; }
  .course-card.featured .icon { height: 52px; width: 52px; }
  .course-card.featured h2 { font-size: 21px; padding-right: 0; }
  .course-card.featured p { font-size: 14.5px; }
  .skill-chips { gap: 5px; }
  .course-head { align-items: flex-start; }
  .course-head .icon { height: 54px; width: 54px; }
  .field-tabs { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .field-tab { flex: 0 0 118px; min-height: 66px; }
  .field-guide-head { align-items: flex-start; padding: 18px; }
  .check-group { padding: 16px 18px 7px; }
  .field-progress { padding: 8px 18px; }
  .btn { width: 100%; }
  .action-bar .inner { flex-direction: column-reverse; }
  .btn.grade, .btn.wide { width: auto; }
  .action-bar .inner:has(.btn.grade) { flex-direction: row; }
  .certificate { padding: 30px 22px; }
  .certificate .cert-name { font-size: 26px; padding: 0 10px 6px; min-width: 0; }
  .certificate .cert-facts { gap: 22px; }
}

/* ---------- Print ---------- */

@media print {
  .topbar, .action-bar, .player-bar, .ref-head,
  .cert-toolbar, .cert-hint, .dash, .modal-overlay { display: none !important; }

  /* Atmosphere is screen-only — paper gets ink, not backlight. */
  body::before, body::after { display: none !important; }
  .card::before, .card::after { display: none !important; }
  .widget { background: #fff !important; box-shadow: none !important; }

  html, body { margin: 0; padding: 0; background: #fff; color: #000; font-size: 10pt; }
  #app { min-height: auto; }
  .page { max-width: none; padding: 0; margin: 0; }

  /* Handy billy: one title page followed by ten deliberately paginated
     reference sheets. Each useful page owns its header and page number. */
  .reference-page > .ref-sheet { display: none; }
  .ref-print-document { display: block; }
  .ref-print-title-page, .ref-print-page {
    box-sizing: border-box;
    /* Safari clips the outer sheet border and right-column ref-block borders at the
       printable edge unless the sheet is inset slightly. */
    margin-inline: 0.5mm;
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: page;
    page-break-after: always;
  }
  .ref-print-page {
    height: auto;
  }
  .ref-print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
  .ref-print-title-page {
    position: relative;
    display: flex;
    flex-direction: column;
    /* Conservative sheet height for native Safari (nominal printable ~194mm still spills a border).
       Enough flex space to centre the title block; content sheets stay height:auto. */
    min-height: 172mm;
    height: auto;
    border: 1pt solid #172334;
    padding: 14mm;
  }
  .ref-print-title-mark {
    font-family: var(--mono);
    font-size: 8pt;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
  }
  .ref-print-title-main {
    margin: auto 0;
    max-width: 220mm;
  }
  .ref-print-kicker {
    margin-bottom: 5mm;
    font-family: var(--mono);
    font-size: 9pt;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
  }
  .ref-print-title-main h2 {
    margin: 0;
    font-size: 29pt;
    line-height: 1.05;
  }
  .ref-print-title-main h3 {
    margin: 3mm 0 0;
    font-size: 20pt;
    font-weight: 500;
  }
  .ref-print-title-main p {
    margin: 7mm 0 0;
    max-width: 170mm;
    font-size: 12pt;
    line-height: 1.45;
    color: #334155;
  }
  .ref-print-title-facts {
    display: flex;
    gap: 4mm;
    margin-top: 8mm;
  }
  .ref-print-title-facts span {
    border: .7pt solid #64748b;
    border-radius: 99pt;
    padding: 2mm 4mm;
    font-family: var(--mono);
    font-size: 7.5pt;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .ref-print-title-footer {
    display: flex;
    justify-content: space-between;
    border-top: .7pt solid #64748b;
    padding-top: 3mm;
    font-size: 7.5pt;
    color: #475569;
  }
  .ref-print-page {
    display: flex;
    flex-direction: column;
  }
  .ref-print-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex: 0 0 7mm;
    border-bottom: 1pt solid #172334;
    padding: 0 1mm 2.5mm;
  }
  .ref-print-header strong {
    font-size: 10pt;
    letter-spacing: .01em;
  }
  .ref-print-header span {
    font-family: var(--mono);
    font-size: 7pt;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
  }
  .ref-print-body {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8mm;
    flex: 1 1 auto;
    min-height: 0;
    padding-top: 3mm;
  }
  .ref-print-column {
    min-width: 0;
    overflow: visible;
  }
  .ref-block {
    border: 0.5pt solid #999; border-radius: 3pt; padding: 4pt 6pt;
    margin-bottom: 4pt; background: #fff; box-shadow: none;
  }
  .ref-block h3 { font-size: 6.7pt; color: #000; border-bottom: 0.5pt solid #000; padding-bottom: 1pt; margin-bottom: 1.5pt; }
  .ref-table { font-size: 5.3pt; }
  .ref-table td { padding: .5pt 2pt .5pt 0; line-height: 1.05; }
  .ref-table tr { border-bottom: 0.4pt solid #ccc; }
  .ref-formula { color: #000; }
  .ref-term { color: #000; }
  .ref-note { color: #333; }
  .ref-print-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex: 0 0 5mm;
    border-top: .6pt solid #94a3b8;
    padding: 2mm 1mm 0;
    font-size: 7pt;
    color: #475569;
  }
  .ref-print-footer strong {
    font-family: var(--mono);
    font-size: 7.5pt;
    color: #172334;
  }

  .certificate {
    box-shadow: none; outline: none;
    border: 3pt double #0b7e77; margin: 0 auto; max-width: none;
    padding: 22mm 18mm; background: #fff;
  }
  .certificate h1 { font-size: 26pt; }
  .certificate h2 { font-size: 18pt; }
  .certificate .cert-name { font-size: 24pt; }
}

/* Page orientation is swapped at runtime by Academy.setPage() — reference
   guides print A4 landscape, certificates print A4 portrait. */
@page { size: A4 landscape; margin: 8mm; }

/* ==========================================================================
   Version 3 — path-led learning terrain
   ========================================================================== */

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brass) 72%, white);
  outline-offset: 3px;
}

.storage-warning {
  position: fixed;
  z-index: 200;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 460px;
  padding: 13px 16px;
  color: var(--ink);
  border: 1px solid var(--red);
  border-radius: 12px;
  background: var(--red-soft);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 650;
}

.journey-home { max-width: 1220px; padding-top: 22px; }

.journey-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(370px, .92fr);
  gap: 46px;
  min-height: 610px;
  overflow: hidden;
  padding: 56px 58px;
  color: #eef8f7;
  border-radius: 28px;
  background:
    radial-gradient(circle at 15% 20%, rgba(98, 192, 206, .26), transparent 44%),
    radial-gradient(circle at 88% 75%, rgba(241, 188, 79, .18), transparent 46%),
    linear-gradient(132deg, #154654 0%, #1d5a64 54%, #1f6974 100%);
  box-shadow: 0 24px 65px rgba(18, 54, 62, .24), inset 0 1px 0 rgba(255,255,255,.13);
  isolation: isolate;
}

.journey-hero::before,
.route-panel::before,
.path-head::before {
  content: "";
  position: absolute;
  inset: -18%;
  z-index: -1;
  opacity: .18;
  background:
    radial-gradient(circle at 50% 50%, rgba(234, 248, 250, .16) 0px, rgba(234, 248, 250, .16) 120px, transparent 121px),
    radial-gradient(circle at 70% 30%, rgba(241, 188, 79, .08) 0px, rgba(241, 188, 79, .08) 90px, transparent 91px);
  transform: rotate(-4deg);
  pointer-events: none;
}

.journey-hero::after {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: -1px;
  height: 160px;
  z-index: -1;
  opacity: .22;
  background:
    linear-gradient(165deg, rgba(9, 40, 47, .55) 15%, transparent 46%),
    linear-gradient(206deg, rgba(5, 34, 40, .52) 20%, transparent 62%);
  clip-path: none;
}

.journey-hero-copy { position: relative; z-index: 2; align-self: center; }
.route-label,
.section-intro > span,
.catalog-head > span,
.placement-head > span,
.path-kind,
.path-facts span,
.next-overline,
.placement-result > span {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.route-label { margin-bottom: 14px; color: #e1ad4c; }
.journey-hero h1 {
  max-width: 650px;
  margin: 0 0 19px;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(46px, 5.6vw, 76px);
  font-stretch: condensed;
  font-weight: 650;
  letter-spacing: -.045em;
  line-height: .91;
}
.journey-hero h1 em {
  color: #b9e2dc;
  font-style: normal;
  font-weight: 500;
}
.hero-lead {
  max-width: 610px;
  margin: 0 0 21px;
  color: rgba(239,250,248,.82);
  font-size: 18px;
  line-height: 1.57;
}
.sustainment-triad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 625px;
  overflow: hidden;
  margin: 0 0 24px;
  border: 1px solid rgba(235,250,246,.2);
  border-radius: 13px;
  background: rgba(7,35,42,.24);
}
.sustainment-triad > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 11px 13px 12px;
  border-right: 1px solid rgba(235,250,246,.16);
}
.sustainment-triad > span:last-child { border-right: 0; }
.sustainment-triad b {
  color: #f1bf60;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.sustainment-triad small {
  margin-top: 4px;
  color: rgba(239,250,248,.72);
  font-size: 10.5px;
  line-height: 1.3;
}
.journey-hero .btn.primary {
  color: #172d34;
  background: #e5ae45;
  box-shadow: 0 12px 30px rgba(7,30,34,.22);
}
.journey-hero .btn.primary:hover { background: #f0bf61; }
.btn.route-secondary {
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: transparent;
}
.journey-hero .btn.route-secondary {
  color: #effaf8;
  border-color: rgba(238,250,248,.32);
  background: rgba(9,39,46,.18);
}
.journey-hero .btn.route-secondary:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.56); }
.route-reassurance {
  max-width: 610px;
  margin: 17px 0 0;
  color: rgba(232,246,243,.65);
  font-size: 12.5px;
}

.route-panel {
  position: relative;
  z-index: 2;
  align-self: stretch;
  min-width: 0;
  overflow: hidden;
  padding: 24px 24px 18px;
  border: 1px solid rgba(235,250,246,.2);
  border-radius: 21px;
  background: rgba(8,37,44,.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
  backdrop-filter: blur(8px);
}

.sustainment-chain {
  position: relative;
  z-index: 2;
  align-self: center;
  padding: 24px;
  border: 1px solid rgba(235,250,246,.2);
  border-radius: 21px;
  background: rgba(8,37,44,.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
.chain-head span { display: block; color: #e2ad4b; font-family: var(--mono); font-size: 9.5px; font-weight: 800; letter-spacing: .14em; }
.chain-head strong { display: block; margin-top: 4px; color: #fff; font-size: 20px; }
.sustainment-chain ol { display: grid; gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; }
.sustainment-chain li { display: flex; align-items: flex-start; gap: 12px; }
.sustainment-chain li > b { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; color: #17323a; border-radius: 50%; background: #dfa441; font: 800 11px/1 var(--mono); }
.sustainment-chain li strong { display: block; color: #f5fbfa; font-size: 13px; }
.sustainment-chain li small { display: block; margin-top: 2px; color: rgba(232,247,243,.62); font-size: 10.5px; line-height: 1.3; }
.route-panel::before { opacity: .1; }
.rp-head { position: relative; z-index: 1; margin-bottom: 8px; }
.rp-head span {
  display: block;
  color: #e2ad4b;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .14em;
}
.rp-head strong { display: block; margin-top: 4px; color: #fff; font-size: 20px; }
.rp-head small { color: rgba(237,248,246,.62); font-size: 12px; }
.route-link {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 11px 4px 2px;
  color: #c3e6e1;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
}
.route-link:hover { color: #fff; }

.terrain {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 22px 0 8px;
  padding: 10px 0;
}
.terrain-line {
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 31px;
  width: 2px;
  background: linear-gradient(var(--path-color, var(--accent)), var(--line));
  opacity: .48;
}
.terrain-node {
  position: relative;
  display: flex;
  z-index: 1;
  width: 100%;
  align-items: center;
  gap: 14px;
  padding: 6px 10px 6px 0;
  color: var(--ink);
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.terrain-node:nth-of-type(even) { transform: translateX(46px); width: calc(100% - 46px); }
.terrain-node:hover .tn-copy strong { color: var(--node-color); }
.tn-marker {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  color: var(--ink-soft);
  border: 2px solid var(--line-strong);
  border-radius: 50% 48% 52% 46%;
  background: var(--surface);
  box-shadow: 0 3px 0 rgba(25,48,56,.08);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  transform: rotate(-4deg);
}
.terrain-node.current .tn-marker {
  color: #fff;
  border-color: var(--node-color);
  background: var(--node-color);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--node-color) 18%, transparent);
}
.terrain-node.complete .tn-marker {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}
.tn-copy { min-width: 0; }
.tn-copy strong { display: block; font-size: 14px; line-height: 1.15; }
.tn-copy small { display: block; margin-top: 3px; color: var(--ink-faint); font-size: 11px; }
.terrain.compact { gap: 10px; margin: 4px 0; }
.terrain.compact .terrain-line { left: 18px; }
.terrain.compact .terrain-node { gap: 10px; padding-block: 4px; color: #eefaF8; }
.terrain.compact .terrain-node:nth-of-type(even) { transform: translateX(24px); width: calc(100% - 24px); }
.terrain.compact .tn-marker { width: 30px; height: 30px; flex-basis: 30px; border-color: rgba(235,248,244,.35); background: #173f49; color: #d8ece8; }
.terrain.compact .terrain-node.current .tn-marker { background: #dfa441; border-color: #dfa441; color: #17323a; }
.terrain.compact .terrain-node.complete .tn-marker { background: #6e9d7b; border-color: #6e9d7b; }
.terrain.compact .tn-copy strong { color: #f5fbfa; font-size: 12.5px; }
.terrain.compact .tn-copy small { color: rgba(232,247,243,.58); font-size: 10px; }

.first-brief {
  display: grid;
  grid-template-columns: minmax(250px, .75fr) minmax(0, 1.55fr);
  gap: 36px;
  margin-top: 18px;
  padding: 25px 29px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--edge);
}
.first-brief-title > span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
}
.first-brief-title h2 { margin: 4px 0 5px; font-size: 24px; line-height: 1.05; }
.first-brief-title p { margin: 0; color: var(--ink-soft); font-size: 12.5px; }
.first-brief ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.first-brief li { display: flex; gap: 10px; min-width: 0; align-items: flex-start; }
.first-brief li > b {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  color: var(--surface);
  border-radius: 50%;
  background: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
}
.first-brief li strong { display: block; font-size: 12.5px; line-height: 1.25; }
.first-brief li small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 10.5px; line-height: 1.35; }

.learning-now, .route-library { padding-top: 70px; }
.section-intro { max-width: 650px; margin-bottom: 24px; }
.section-intro > span, .catalog-head > span, .placement-head > span { color: var(--accent); }
.section-intro h2 {
  margin: 4px 0 5px;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 650;
  letter-spacing: -.035em;
}
.section-intro p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.section-intro.compact { margin-top: 46px; }
.section-intro.compact h2 { font-size: 29px; }

.now-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; }
.next-card {
  position: relative;
  display: flex;
  min-height: 255px;
  overflow: hidden;
  flex-direction: column;
  align-items: flex-start;
  padding: 30px 32px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 6px solid var(--course-color);
  border-radius: 19px;
  background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--course-color) 8%, var(--surface)));
  box-shadow: var(--shadow), var(--edge);
  cursor: pointer;
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease;
}
.next-card::after {
  content: "";
  position: absolute;
  right: -48px;
  bottom: -62px;
  width: 230px;
  height: 180px;
  opacity: .12;
  border: 18px double var(--course-color);
  border-radius: 48% 52% 44% 56%;
  transform: rotate(-18deg);
}
.next-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.next-overline { margin-bottom: 30px; color: var(--course-color); }
.next-course { margin-bottom: 4px; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.next-card > strong { max-width: 640px; font-family: var(--font-display); font-size: 30px; line-height: 1.05; }
.next-card > span:not(.next-overline):not(.next-course) { max-width: 600px; margin-top: 9px; color: var(--ink-soft); font-size: 14px; }
.next-card > b { margin-top: auto; padding-top: 18px; color: var(--course-color); font-size: 14px; }
.now-support { display: flex; flex-direction: column; gap: 12px; }

.academy-syllabus { padding-top: 70px; }
.syllabus-list { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--edge); }
.syllabus-row { display: grid; width: 100%; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 17px 20px; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.syllabus-row:last-child { border-bottom: 0; }
.syllabus-row:hover { background: var(--surface-2); }
.syllabus-number { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font: 800 11px/1 var(--mono); }
.syllabus-row.done .syllabus-number { color: #fff; border-color: var(--green); background: var(--green); }
.syllabus-copy small, .syllabus-copy strong, .syllabus-copy span { display: block; }
.syllabus-copy small { color: var(--accent); font: 800 9px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.syllabus-copy strong { margin-top: 3px; font-size: 16px; }
.syllabus-copy span { margin-top: 3px; color: var(--ink-soft); font-size: 12px; }
.syllabus-row > b { color: var(--ink-faint); font: 700 10px/1.2 var(--mono); white-space: nowrap; }

.home-sources { padding-top: 30px; }
.home-source-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.home-source-links a, .home-source-links .source-record { display: flex; min-height: 74px; flex-direction: column; justify-content: space-between; padding: 15px 17px; color: var(--ink); border: 1px solid color-mix(in srgb, var(--brass) 45%, var(--line)); border-radius: 12px; background: var(--brass-soft); text-decoration: none; }
.home-source-links a:hover { border-color: var(--brass-text); transform: translateY(-1px); }
.home-source-links strong { font-size: 12.5px; line-height: 1.3; }
.home-source-links span { margin-top: 8px; color: var(--accent); font-size: 11px; font-weight: 800; }
.home-source-links small { margin-top: 5px; }

.journey-utility {
  display: flex;
  width: 100%;
  min-height: 106px;
  align-items: center;
  gap: 14px;
  padding: 17px 18px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--edge);
  cursor: pointer;
  text-align: left;
}
.journey-utility:hover { border-color: var(--accent); background: var(--surface-hover); }
.journey-utility.attention { border-color: color-mix(in srgb, var(--amber) 48%, var(--line)); background: color-mix(in srgb, var(--amber-soft) 48%, var(--surface)); }
.ju-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  color: var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
}
.ju-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.journey-utility strong { display: block; font-size: 14.5px; line-height: 1.2; }
.journey-utility small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 11.5px; line-height: 1.35; }

.path-group { margin-top: 34px; }
.path-group > h3 { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; font-weight: 750; }
.path-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.path-card {
  position: relative;
  display: flex;
  min-height: 265px;
  overflow: hidden;
  flex-direction: column;
  align-items: flex-start;
  padding: 23px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow), var(--edge);
  cursor: pointer;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease;
}
.path-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--path-color);
}
.path-card:hover { transform: translateY(-3px); border-color: var(--path-color); }
.path-kind { color: var(--path-color); }
.path-card-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 18px 0 14px;
  place-items: center;
  color: var(--path-color);
  border-radius: 13px;
  background: color-mix(in srgb, var(--path-color) 10%, var(--surface));
}
.path-card-icon svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.path-title { font-size: 20px; line-height: 1.1; }
.path-tagline { margin-top: 8px; color: var(--ink-soft); font-size: 13px; line-height: 1.43; }
.path-meta { margin-top: auto; padding-top: 18px; color: var(--ink-faint); font-family: var(--mono); font-size: 9.5px; }
.path-progress { width: 100%; height: 4px; overflow: hidden; margin-top: 8px; border-radius: 3px; background: var(--line); }
.path-progress i { display: block; height: 100%; background: var(--path-color); }
.toolbox-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 70px; }
.toolbox-strip .journey-utility { min-height: 92px; padding: 13px; }
.toolbox-strip .journey-utility small { font-size: 10.5px; }

/* Route detail */
.path-page { max-width: 930px; }
.path-head {
  position: relative;
  display: flex;
  overflow: hidden;
  align-items: center;
  gap: 24px;
  padding: 34px 36px;
  color: #f4fbfa;
  border-radius: 22px;
  background: linear-gradient(130deg, color-mix(in srgb, var(--path-color) 82%, #173541), var(--path-color));
  isolation: isolate;
}
.path-head::before { opacity: .12; }
.path-head-icon {
  display: grid;
  width: 70px;
  height: 70px;
  flex: 0 0 70px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 20px;
  background: rgba(4,25,30,.18);
}
.path-head-icon svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.path-head .path-kind { color: rgba(247,253,251,.68); }
.path-head h1 { margin: 3px 0 5px; color: #fff; font-size: 42px; line-height: 1; }
.path-head p { max-width: 650px; margin: 0; color: rgba(245,253,251,.78); font-size: 15px; }
.path-facts { display: grid; grid-template-columns: 1fr 1fr .65fr; gap: 12px; margin: 15px 0 0; }
.path-facts > div { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.path-facts span { margin-bottom: 5px; color: var(--ink-faint); }
.path-facts strong { display: block; font-size: 13px; line-height: 1.35; }
.path-actions { display: flex; gap: 10px; margin-top: 20px; }
.path-page > .terrain {
  gap: 28px;
  margin-top: 18px;
  padding: 18px 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    repeating-radial-gradient(ellipse at 92% 30%, transparent 0 38px, color-mix(in srgb, var(--line) 62%, transparent) 39px 40px, transparent 41px 59px),
    var(--surface);
}
.path-page > .terrain .terrain-line { left: 59px; }
.path-page > .terrain .terrain-node { max-width: 630px; padding: 10px 14px 10px 8px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.path-page > .terrain .terrain-node:nth-of-type(even) { margin-left: 105px; transform: none; width: calc(100% - 105px); }
.path-page > .terrain .tn-marker { width: 46px; height: 46px; flex-basis: 46px; }
.path-page > .terrain .tn-copy strong { font-size: 16px; }
.path-page > .terrain .tn-copy small { font-size: 12px; }

/* Placement */
.placement-page { max-width: 960px; }
.placement-head { max-width: 790px; margin-bottom: 38px; }
.placement-head h1, .catalog-head h1 {
  margin: 5px 0 10px;
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 650;
  letter-spacing: -.04em;
  line-height: 1;
}
.placement-head p, .catalog-head p { margin: 0; color: var(--ink-soft); }
.placement-block {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 4px 18px;
  margin-top: 28px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}
.pb-no {
  grid-row: 1 / span 2;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}
.pb-copy h2 { margin: 0; font-size: 23px; }
.pb-copy p { margin: 2px 0 0; color: var(--ink-soft); font-size: 13px; }
.placement-grid {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.placement-grid.goals-grid { grid-template-columns: repeat(3, 1fr); }
.placement-choice {
  display: flex;
  min-height: 124px;
  flex-direction: column;
  padding: 18px;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}
.placement-choice:hover { border-color: var(--accent); }
.placement-choice.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.placement-choice strong { font-size: 15px; line-height: 1.2; }
.placement-choice span { margin-top: 6px; color: var(--ink-soft); font-size: 12px; line-height: 1.4; }
.placement-result {
  margin-top: 30px;
  padding: 26px 28px;
  border: 1px solid color-mix(in srgb, var(--path-color, var(--accent)) 45%, var(--line));
  border-left: 6px solid var(--path-color, var(--accent));
  border-radius: 17px;
  background: color-mix(in srgb, var(--path-color, var(--accent)) 7%, var(--surface));
}
.placement-result > span { color: var(--path-color, var(--accent)); }
.placement-result h2 { margin: 4px 0 6px; font-size: 28px; }
.placement-result > p { margin: 0 0 15px; color: var(--ink-soft); }
.placement-boundary { margin: 14px 0 19px; padding: 12px 15px; border-radius: 10px; background: var(--surface); color: var(--ink-soft); font-size: 13px; }

/* Catalogue and progress */
.catalog-page { max-width: 1080px; }
.catalog-head { max-width: 790px; margin-bottom: 28px; }
.catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.catalog-course {
  display: flex;
  min-height: 132px;
  align-items: flex-start;
  gap: 16px;
  padding: 19px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 4px solid var(--course-color);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--edge);
  cursor: pointer;
  text-align: left;
}
.catalog-course:hover { border-color: var(--course-color); transform: translateY(-2px); }
.catalog-icon {
  display: grid;
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
  place-items: center;
  color: var(--course-color);
  border-radius: 13px;
  background: color-mix(in srgb, var(--course-color) 10%, var(--surface));
}
.catalog-icon svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.catalog-course strong { display: block; font-size: 16px; line-height: 1.18; }
.catalog-course small { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 12px; line-height: 1.35; }
.catalog-course b { display: block; margin-top: 11px; color: var(--ink-soft); font-family: var(--mono); font-size: 10px; }
.progress-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; }
.progress-action {
  display: flex;
  min-height: 200px;
  flex-direction: column;
  padding: 25px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow), var(--edge);
  cursor: pointer;
  text-align: left;
}
.progress-action:hover { border-color: var(--accent); }
.progress-action strong { font-size: 23px; }
.progress-action span { margin-top: 7px; color: var(--ink-soft); font-size: 14px; }
.progress-action b { margin-top: auto; color: var(--accent); font-size: 14px; }
.import-status { min-height: 24px; margin: 14px 0; font-size: 13px; }
.import-status.good { color: var(--green); }
.import-status.bad { color: var(--red); }
.privacy-note { margin-top: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.privacy-note p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.privacy-page { max-width: 820px; }
.privacy-summary {
  margin: 28px 0 20px;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--green) 48%, var(--line));
  border-radius: 15px;
  background: var(--green-soft);
}
.privacy-summary strong { font-size: 19px; }
.privacy-summary p { margin: 6px 0 0; color: var(--ink-soft); }
.privacy-details { display: grid; gap: 12px; }
.privacy-details section {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.privacy-details h2 { margin: 0 0 5px; font-size: 18px; }
.privacy-details p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }

/* New interactive foundations models */
.energy-chain-visual {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.energy-stage { display: flex; min-width: 120px; flex-direction: column; justify-content: center; padding: 14px; border-radius: 11px; background: var(--accent-soft); text-align: center; }
.energy-stage.useful { background: var(--green-soft); }
.energy-stage strong { font-family: var(--mono); font-size: 17px; }
.energy-stage span { color: var(--ink-soft); font-size: 11px; }
.energy-arrow { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--accent); font-size: 23px; }
.energy-arrow small { color: var(--red); font-family: var(--mono); font-size: 9px; white-space: nowrap; }
.hydraulic-visual { display: flex; align-items: center; gap: 8px; max-width: 560px; margin: 20px auto; }
.hyd-cylinder { position: relative; width: 100%; height: 70px; overflow: hidden; border: 4px solid var(--ink-soft); border-radius: 12px; background: var(--surface); }
.hyd-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--w-blue), color-mix(in srgb, var(--w-blue) 55%, white)); opacity: .68; transition: width .2s ease; }
.hyd-piston { position: absolute; top: 4px; bottom: 4px; width: 8px; background: var(--ink); transition: left .2s ease; }
.hyd-force { min-width: 40px; color: var(--w-red); font-size: 40px; transform-origin: left center; }
.electric-visual { position: relative; max-width: 520px; margin: 20px auto; padding: 24px; }
.circuit-loop { display: flex; align-items: center; gap: 0; }
.circuit-loop i { height: 3px; flex: 1; background: var(--w-amber); }
.battery, .resistor { padding: 12px 16px; border: 3px solid var(--w-amber); border-radius: 9px; background: var(--surface); font-family: var(--mono); font-weight: 800; }
.resistor { border-color: var(--w-red); }
.electron-flow { width: 10px; height: 10px; margin: -7px auto 0; border-radius: 50%; background: var(--accent); animation: electronPulse 1.5s linear infinite; }
@keyframes electronPulse { 0% { transform: translateX(-180px); opacity: 0; } 10%,90% { opacity: 1; } 100% { transform: translateX(180px); opacity: 0; } }
.plant-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 14px; }
.plant-tab { padding: 9px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; font-size: 11px; font-weight: 750; }
.plant-tab.active { color: #fff; border-color: var(--accent); background: var(--accent); }
.plant-map { position: relative; height: 280px; border: 1px solid var(--line); border-radius: 50% 45% 47% 53%; background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.plant-core { position: absolute; top: 50%; left: 50%; display: grid; width: 110px; height: 110px; place-items: center; transform: translate(-50%,-50%); color: #fff; border-radius: 50%; background: #1c5662; font-family: var(--mono); font-size: 11px; font-weight: 800; text-align: center; }
.plant-orbit { position: absolute; padding: 7px 9px; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); font-family: var(--mono); font-size: 9px; font-weight: 800; }
.plant-orbit.p1 { top: 25px; left: 50%; transform: translateX(-50%); }
.plant-orbit.p2 { top: 50%; right: 28px; transform: translateY(-50%); }
.plant-orbit.p3 { bottom: 25px; left: 50%; transform: translateX(-50%); }
.plant-orbit.p4 { top: 50%; left: 28px; transform: translateY(-50%); }
.plant-detail { margin-top: 12px; padding: 14px 16px; border-left: 4px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }
.plant-detail p { margin: 4px 0; font-size: 13px; }
.plant-detail span { color: var(--ink-soft); font-family: var(--mono); font-size: 9px; }
.stability-visual { position: relative; height: 260px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(#dceef0 0 55%, #81b7c0 55% 100%); }
[data-theme="dark"] .stability-visual { background: linear-gradient(#203945 0 55%, #295d6a 55% 100%); }
.waterline { position: absolute; left: 0; right: 0; height: 2px; background: rgba(255,255,255,.7); transition: top .2s ease; }
.vessel-hull { position: absolute; left: 20%; bottom: 73px; width: 60%; height: 90px; transform-origin: 50% 80%; transition: transform .2s ease; }
.vessel-hull::after { content: ""; position: absolute; inset: 38px 0 0; background: #244c59; clip-path: polygon(0 0,100% 0,86% 100%,15% 100%); border-radius: 0 0 45% 45%; }
.vessel-deck { position: absolute; left: 8%; right: 8%; top: 33px; height: 7px; border-radius: 4px; background: #173742; }
.weight-block { position: absolute; left: 50%; z-index: 2; padding: 5px 7px; transform: translateX(-50%); color: #1e2f32; border-radius: 5px; background: #e1a640; font-family: var(--mono); font-size: 9px; font-weight: 800; transition: bottom .2s ease; }

@media (max-width: 980px) {
  .journey-hero { grid-template-columns: 1fr 360px; gap: 28px; padding: 43px 40px; }
  .journey-hero h1 { font-size: 54px; }
  .first-brief { grid-template-columns: 1fr; gap: 18px; }
  .path-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbox-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .journey-home { padding-top: 12px; }
  .journey-hero { grid-template-columns: 1fr; min-height: 0; padding: 34px 29px; }
  .journey-hero::after { opacity: .3; }
  .journey-hero h1 { max-width: 570px; font-size: 52px; }
  .route-panel { margin-top: 5px; }
  .first-brief ol { grid-template-columns: 1fr; }
  .pf-definitions, .home-source-links { grid-template-columns: 1fr; }
  .timeline-example { grid-template-columns: 1fr; }
  .lesson-evidence { flex-direction: column; margin-inline: 16px; }
  .now-grid { grid-template-columns: 1fr; }
  .path-facts { grid-template-columns: 1fr; }
  .placement-grid, .placement-grid.goals-grid { grid-template-columns: repeat(2, 1fr); }
  .catalog-grid { grid-template-columns: 1fr; }
  .progress-actions { grid-template-columns: 1fr; }
  .energy-chain-visual { flex-wrap: wrap; }
  .plant-tabs { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .journey-hero { padding: 29px 21px 23px; border-radius: 20px; }
  .journey-hero h1 { font-size: 43px; }
  .hero-lead { font-size: 15.5px; }
  .sustainment-triad { grid-template-columns: 1fr; }
  .sustainment-triad > span { border-right: 0; border-bottom: 1px solid rgba(235,250,246,.16); }
  .sustainment-triad > span:last-child { border-bottom: 0; }
  .first-brief { padding: 21px; }
  .syllabus-row { grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 15px 13px; }
  .syllabus-row > b { display: none; }
  .route-reassurance { font-size: 11.5px; }
  .learning-now, .route-library { padding-top: 48px; }
  .section-intro h2 { font-size: 29px; }
  .next-card { min-height: 235px; padding: 24px; }
  .next-card > strong { font-size: 25px; }
  .path-grid, .toolbox-strip { grid-template-columns: 1fr; }
  .path-card { min-height: 235px; }
  .path-head { align-items: flex-start; padding: 25px 22px; }
  .path-head-icon { width: 54px; height: 54px; flex-basis: 54px; border-radius: 15px; }
  .path-head h1 { font-size: 32px; }
  .path-actions { flex-direction: column; }
  .path-page > .terrain { padding-inline: 13px; }
  .path-page > .terrain .terrain-line { left: 39px; }
  .path-page > .terrain .terrain-node:nth-of-type(even) { margin-left: 24px; width: calc(100% - 24px); }
  .placement-block { grid-template-columns: 40px 1fr; gap: 4px 10px; }
  .placement-grid, .placement-grid.goals-grid { grid-column: 1 / -1; grid-template-columns: 1fr; }
  .placement-choice { min-height: 105px; }
  .catalog-course { min-height: 120px; padding: 16px; }
  .progress-action { min-height: 175px; }
  .energy-stage { min-width: 100%; }
  .energy-arrow { width: 100%; transform: rotate(90deg); }
  .plant-map { height: 235px; }
  .plant-orbit.p2 { right: 8px; }
  .plant-orbit.p4 { left: 8px; }
}

/* ---------- About, changelog, feedback, what's-new ---------- */

.info-page { max-width: 820px; }
.info-section { margin-top: 28px; }
.info-section h2, .feedback-result h2 { font-size: 20px; margin: 0 0 10px; }
.info-note { color: var(--ink-soft); font-size: 14px; margin: 10px 0 0; }
.info-facts {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.info-facts > div { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.info-facts dt { color: var(--ink-faint); font-weight: 700; min-width: 100px; }
.info-facts dd { margin: 0; color: var(--ink); }
.info-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0;
}
.info-figure {
  display: flex;
  flex-direction: column-reverse;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.info-figure dt { color: var(--ink-soft); font-size: 13px; }
.info-figure .info-num { margin: 0; font-family: var(--font-display); font-size: 32px; font-weight: 800; color: var(--accent); line-height: 1.1; }
.info-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.info-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.info-table th, .info-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.info-table th { color: var(--ink-faint); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; background: var(--surface-2); }
.info-table tbody tr:last-child td { border-bottom: 0; }
.info-table td.num, .info-table th:last-child { text-align: right; }
.info-table a { color: var(--accent); font-weight: 700; text-underline-offset: 2px; display: inline-block; min-height: 24px; }
.info-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.info-links .btn { min-height: 44px; }

.changelog-list { display: grid; gap: 14px; }
.changelog-entry { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.changelog-entry h2 { font-size: 19px; margin: 0; }
.changelog-date { color: var(--ink-faint); font-size: 13px; margin: 2px 0 8px; }
.changelog-entry ul { margin: 0 0 10px; padding-left: 20px; }
.changelog-entry li { margin: 4px 0; color: var(--ink); }
.changelog-stats { margin: 0; color: var(--ink-soft); font-family: var(--mono); font-size: 12px; }

.feedback-form { display: grid; gap: 16px; }
.fb-field { display: grid; gap: 6px; }
.fb-field label { font-weight: 700; }
.fb-field small { color: var(--ink-soft); }
.fb-field select, .fb-field input, .fb-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
}
.fb-field textarea { resize: vertical; min-height: 140px; }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.feedback-ref { font-family: var(--mono); font-size: 18px; font-weight: 800; color: var(--accent); margin: 0; }
.fb-error { color: var(--red); font-weight: 700; margin: -8px 0 0; min-height: 0; }
.fb-error:empty { display: none; }
.fb-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.fb-actions .btn { min-height: 44px; }
.feedback-result { margin-top: 24px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.feedback-result[hidden] { display: none; }
.feedback-mailto { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.feedback-preview {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.player-feedback {
  min-height: 44px;
  padding: 0 10px;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--ink-faint);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.player-feedback:hover { color: var(--accent); }
.link-btn {
  display: block;
  min-height: 44px;
  margin: 14px auto 0;
  padding: 6px 10px;
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.whatsnew-overlay { align-items: center; padding: 16px; }
.whatsnew-card { max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; }
.whatsnew-body { padding: 24px 24px 8px; }
.whatsnew-kicker { color: var(--accent); font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: .15em; }
.whatsnew-body h2 { margin: 4px 0 8px; font-size: 24px; }
.whatsnew-welcome { margin: 0 0 8px; color: var(--ink-soft); }
.whatsnew-release { margin: 0 0 8px; color: var(--ink-faint); font-size: 13px; }
.whatsnew-list { margin: 0; padding-left: 20px; }
.whatsnew-list li { margin: 6px 0; }
.whatsnew-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 16px 24px 22px; }
.whatsnew-actions .btn { min-height: 44px; }
@media print { .whatsnew-overlay { display: none !important; } }

/* ---------- Help button, help dialog, settings ---------- */

.kicker-row, .review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-head h1 { margin: 0; }
.help-btn {
  flex: none;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.help-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.help-body { padding-bottom: 4px; }
.help-card { max-width: 560px; }
.help-list { margin: 0; }
.help-list div { margin: 0 0 12px; }
.help-list dt { font-weight: 700; margin: 0 0 2px; }
.help-list dd { margin: 0; color: var(--ink-soft); }
.help-foot { margin: 4px 0 0; color: var(--ink-faint); font-size: 13px; }

.settings-list { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: 0; }
.setting-copy { min-width: 0; }
.setting-label { display: block; font-weight: 700; cursor: pointer; }
.setting-desc { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.setting-switch {
  appearance: none; -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 52px; height: 30px;
  margin: 0;
  border: 2px solid var(--ink-soft);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.setting-switch::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--ink-soft);
  transition: transform .15s ease;
}
.setting-switch:checked { background: var(--accent); border-color: var(--accent); }
.setting-switch:checked::after { background: #fff; transform: translateX(22px); }
.setting-switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .setting-switch::after { transition: none; } }
@media print { #srs-help-modal { display: none !important; } }

/* Short role-based paths */
.role-paths { padding-top: 70px; }
.role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.role-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px 22px 20px;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow), var(--edge);
}
.role-card::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--path-color); }
.role-title { margin: 0; font-size: 20px; line-height: 1.15; }
.role-open { padding: 0; color: inherit; font: inherit; font-weight: 800; text-align: left; border: 0; background: none; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.role-open:hover { text-decoration-color: var(--path-color); }
.role-audience { margin: 6px 0 0; color: var(--ink-soft); font-size: 12.5px; font-weight: 700; }
.role-tagline { margin: 10px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.role-meta { margin: auto 0 0; padding-top: 16px; color: var(--ink-soft); font: 600 11px/1.4 var(--mono); }
.role-card .path-progress { margin-bottom: 14px; }
.role-go { align-self: stretch; }
.path-lessons { margin: 0; padding: 0; list-style: none; }
.path-lessons > li { margin: 0; }
.cert-subhead { margin: 34px 0 4px; font-size: 22px; }
.path-certificate { border-color: #8a5a2b; box-shadow: 0 0 0 10px #8a5a2b, var(--shadow); }
.path-certificate .cert-rule { background: #8a5a2b; }
.path-certificate h2, .path-certificate .cf-v { color: #8a5a2b; }
@media (max-width: 980px) { .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  .role-grid { grid-template-columns: minmax(0, 1fr); }
  .role-paths { padding-top: 46px; }
}
@media print { .path-certificate { box-shadow: none; border: 3pt double #8a5a2b; } }

.sub-section { margin-top: 28px; }
.sub-section h2 { margin-bottom: 8px; }
.sub-copy-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.sub-copy-row input {
  flex: 1 1 260px; min-width: 0; min-height: 44px; padding: 10px 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 10px; font: 14px var(--mono);
}
.sub-copy-row .btn { min-height: 44px; }
.sub-link { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.sub-steps { margin: 14px 0 0; padding-left: 20px; }
.sub-steps li { margin: 6px 0; }
.sub-lists { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; min-width: 0; }
.sub-lists legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.sub-check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 0; cursor: pointer; }
.sub-check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.sub-result h3 { margin: 0 0 6px; }
.sub-result[hidden], .sub-form[hidden] { display: none; }
.sub-result:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Toolkit */
.toolkit-page { max-width: 1060px; }
.toolkit-page > p { line-height: 1.65; }
.toolkit-disclaimer { border-left: 4px solid var(--accent); padding: 12px 16px; background: var(--accent-soft); }
.toolkit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 28px 0; }
.toolkit-tile { border: 1px solid var(--line-strong); border-radius: 14px; padding: 22px; background: var(--surface); min-width: 0; }
.toolkit-tile h2 { margin: 0 0 12px; font-size: 21px; }
.toolkit-page a, .toolkit-reference-link { color: var(--accent); text-underline-offset: 3px; }
.toolkit-tile p { color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.toolkit-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; padding: 24px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); margin: 24px 0; }
.toolkit-field { min-width: 0; }
.toolkit-field label { display: block; font-weight: 650; line-height: 1.45; margin-bottom: 8px; }
.toolkit-field input, .toolkit-field select { display: block; width: 100%; min-height: 44px; font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px; }
.toolkit-field input:focus-visible, .toolkit-field select:focus-visible, .toolkit-working summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.toolkit-results { background: var(--accent-soft); border-radius: 14px; padding: 24px; margin: 24px 0; overflow-wrap: anywhere; }
.toolkit-results h2 { margin-top: 0; }
.toolkit-values { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px 24px; }
.toolkit-values dt { font-weight: 600; }
.toolkit-values dd { margin: 0; font-variant-numeric: tabular-nums; }
.toolkit-working { border: 1px solid var(--line-strong); border-radius: 10px; padding: 16px; }
.toolkit-working summary { cursor: pointer; min-height: 44px; font-weight: 700; }
.toolkit-working pre, .toolkit-review { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.8; }
.toolkit-review { border-top: 1px solid var(--line-strong); padding-top: 20px; }
.toolkit-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.toolkit-actions .btn { min-height: 44px; }
.toolkit-downloads { padding-left: 22px; }
.toolkit-downloads li { padding: 8px 0; overflow-wrap: anywhere; }
.toolkit-downloads span { color: var(--ink-soft); font-size: 13px; }
.toolkit-reference-link { display: block; padding: 8px 0; font-size: 13px; }
.toolkit-sensitivity { width: 100%; border-collapse: collapse; font-size: 13px; }
.toolkit-sensitivity th, .toolkit-sensitivity td { padding: 8px 4px; text-align: left; border-bottom: 1px solid var(--line-strong); }
.toolkit-page textarea { width: 100%; min-height: 240px; font: inherit; color: var(--ink); background: var(--surface); }
.toolkit-error { font-weight: 700; }
.toolkit-download-notice { padding: 16px; border: 1px solid var(--line-strong); }
.toolkit-group { margin: 28px 0; }
.toolkit-group > h2 { margin-bottom: 12px; }
.toolkit-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.toolkit-group .toolkit-tile { min-height: 130px; }
.toolkit-editable { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 14px; }
.toolkit-editable th, .toolkit-editable td { border: 1px solid var(--line-strong); padding: 8px; text-align: left; vertical-align: top; }
.toolkit-editable th { background: var(--accent-soft); }
.toolkit-editable input, .toolkit-editable select { width: 100%; min-width: 110px; min-height: 38px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px; }
.toolkit-editable input:focus-visible, .toolkit-editable select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 620px) {
  .toolkit-grid, .toolkit-inputs { grid-template-columns: minmax(0, 1fr); }
  .toolkit-group-grid { grid-template-columns: minmax(0, 1fr); }
  .toolkit-inputs, .toolkit-results { padding: 16px; }
  .toolkit-values { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .toolkit-values dd { margin-bottom: 12px; }
  .toolkit-sensitivity { font-size: 11px; }
  .toolkit-editable { display: block; overflow-x: auto; white-space: nowrap; }
}
@media print {
  .toolkit-screen-only, .toolkit-status { display: none !important; }
  .toolkit-page { max-width: none; color: #000; background: #fff; font-size: 10pt; }
  .toolkit-page .home-eyebrow { display: none; }
  .toolkit-page h1 { font-size: 22pt; }
  .toolkit-page h2 { font-size: 14pt; }
  .toolkit-page .toolkit-inputs, .toolkit-page .toolkit-results { padding: 10pt; margin: 12pt 0; gap: 10pt; }
  .toolkit-page .toolkit-results { break-inside: avoid; }
  .toolkit-page .toolkit-values { grid-template-columns: 1.4fr 1fr; gap: 6pt 12pt; }
  .toolkit-page input, .toolkit-page select { min-height: 24pt; padding: 4pt; }
  .toolkit-page .subtitle { font-size: 10pt; }
  .toolkit-page .toolkit-inputs { display: grid; grid-template-columns: 1fr 1fr; }
  .toolkit-page .toolkit-results, .toolkit-page .toolkit-disclaimer { background: #fff; border: 1px solid #777; color: #000; }
  .toolkit-page input, .toolkit-page select { color: #000; background: #fff; }
  .toolkit-working pre { display: block; }
  .toolkit-review, .toolkit-field, .toolkit-working { break-inside: avoid; }
}

.glossary-page { max-width: 960px; overflow-wrap: anywhere; }
.glossary-controls { display: grid; gap: 10px; margin-top: 24px; }
.glossary-controls label { font-weight: 600; }
.glossary-controls input, .glossary-controls select {
  width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit;
}
.glossary-alphabet { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 24px; }
.glossary-alphabet a, .glossary-letter-empty {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
}
.glossary-alphabet a { border: 1px solid var(--line-strong); border-radius: 6px; }
.glossary-letter-empty { color: var(--ink-soft); }
.glossary-entry { padding: 20px; margin: 12px 0 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.glossary-entry h3 { margin: 0 0 12px; }
.glossary-entry p { margin: 12px 0 0; }
.glossary-tag { display: inline-block; border-radius: 6px; padding: 3px 8px; background: var(--accent-soft); color: var(--ink); font-size: .875rem; }
.glossary-secondary, .glossary-source { color: var(--ink-soft); font-size: .9rem; }
.glossary-entry, .glossary-letter { scroll-margin-top: 100px; }
.glossary-page a:focus-visible, .glossary-page input:focus-visible, .glossary-page select:focus-visible,
.glossary-entry:focus, .glossary-letter:focus { outline: 3px solid var(--accent); outline-offset: 3px; }
.glossary-page a { color: var(--accent); }
.ref-head a.btn { color: var(--ink); text-decoration: none; }
.toolkit-table-scroll { max-width: 100%; overflow-x: auto; }
.toolkit-print-value { display: none; }
.toolkit-table-scroll .toolkit-editable { display: table; white-space: normal; }
@media print {
  .toolkit-table-scroll { overflow: visible; }
  .toolkit-editable { table-layout: fixed; font-size: 8pt; }
  .toolkit-editable input, .toolkit-editable select { display: none; }
  .toolkit-print-value { display: block; overflow-wrap: anywhere; white-space: pre-wrap; }
  .toolkit-editable th, .toolkit-editable td { padding: 3pt; overflow-wrap: anywhere; }
}

.toolkit-page textarea.toolkit-note { min-height: 76px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 6px; }
.toolkit-note-print { display: none; }
@media print {
  .toolkit-field textarea.toolkit-note, .toolkit-field input.toolkit-text-record { display: none; }
  .toolkit-note-print { display: block; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 18pt; }
  .toolkit-page .toolkit-results { break-inside: auto; }
  .toolkit-sensitivity tr, .toolkit-values dd { break-inside: avoid; }
}
.toolkit-editable textarea { width: 100%; min-width: 110px; min-height: 96px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; }
.toolkit-editable textarea:focus-visible, .toolkit-field textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media print { .toolkit-editable textarea { display: none; } }

.toolkit-result-list { margin: 0; padding-left: 20px; }
.toolkit-result-list li { margin-bottom: 8px; }
