/* FinancedHub shared styles. Light by default; dark via the toggle (html[data-theme="dark"]). */
/* Fonts are self-hosted (SIL Open Font License, see assets/fonts) so no third party sees visitors. */
@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-latin-full-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-latin-full-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("../fonts/source-serif-4-latin-700-italic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/instrument-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
:root {
  --paper: #f8f7f5;
  --paper-2: #efede9;
  --card: #ffffff;
  --ink: #1d1c19;
  --ink-2: #605b52;
  --ink-3: #6e675b;
  --line: #e2ded7;
  --accent: #1f6f5c;
  --accent-soft: #d3e3d6;
  --needs: #3357a3;
  --wants: #b85a2c;
  --savings: #237a5a;
  --danger: #b83d31;
  --good: #237a5a;
  --on-color: #ffffff;
  --grain-opacity: 0;
  --glow-a: rgba(31, 111, 92, .05);
  --glow-b: rgba(214, 150, 50, .04);
  --dot: rgba(90, 70, 40, .13);
  --shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 18px 40px -24px rgba(40, 35, 25, .25);
  --highlight: #f6dd8b;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(.22, .8, .24, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #1f1e1a;
  --paper-2: #282722;
  --card: #2c2b26;
  --ink: #efe9dc;
  --ink-2: #b4ad9f;
  --ink-3: #958e81;
  --line: #3d3b33;
  --accent: #6cc3a5;
  --accent-soft: #23362f;
  --needs: #7f9fe6;
  --wants: #f0955f;
  --savings: #5cc49a;
  --danger: #ef7a6c;
  --good: #5cc49a;
  --highlight: #6b5a1e;
  --on-color: #1f1e1a;
  --grain-opacity: 0;
  --glow-a: rgba(108, 195, 165, .09);
  --glow-b: rgba(214, 160, 70, .07);
  --dot: rgba(239, 233, 220, .06);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 18px 40px -24px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html { background: var(--paper); }
body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.65;
  transition: background .4s var(--ease), color .4s var(--ease);
}
/* Paper grain over the whole page so the margins aren't flat. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Depth behind everything: soft green and amber light. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 50vh at 92% -8%, var(--glow-a), transparent 70%),
    radial-gradient(55vw 55vh at -12% 38%, var(--glow-b), transparent 70%),
    radial-gradient(50vw 45vh at 80% 108%, var(--glow-a), transparent 70%);
}
/* Keyboard users always see where they are. */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 200; background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 8px; text-decoration: none; font-weight: 600; transition: top .2s;
}
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.1; margin: 0 0 .45em; font-variation-settings: "SOFT" 100, "opsz" 72; }
h1 { font-size: clamp(40px, 7vw, 76px); letter-spacing: -.025em; }
h2 { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -.02em; }
h3 { font-size: 22px; letter-spacing: -.01em; }
h1 em, h2 em { font-style: italic; color: var(--accent); }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 3px; }
b, strong { font-weight: 650; }
.mark { color: var(--accent); font-weight: 600; white-space: nowrap; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 720px; }
.muted { color: var(--ink-2); }
.small { font-size: 15px; }
.hidden { display: none !important; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: saturate(1.2) blur(12px);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo {
  display: inline-flex; align-items: center;
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif; font-style: italic; font-size: 24px; font-weight: 700;
  color: var(--ink); text-decoration: none; letter-spacing: -.01em;
}
.logo span { color: var(--accent); }
.logo-mark { width: 1.08em; height: 1.08em; margin-right: .32em; flex: none; color: var(--accent); }
.crumb { font-size: 14px; color: var(--ink-3); }
.spacer { flex: 1; }
.xp { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.xp b { color: var(--ink); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center;
  transition: background .2s, transform .3s var(--ease);
}
.icon-btn:hover { color: var(--accent); }
.icon-btn:active { transform: rotate(30deg); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
.read-progress { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--accent); transition: width .2s linear; }

/* ---------- Section rail (desktop) ---------- */
.rail {
  position: fixed; left: 28px; top: 50%; transform: translateY(-50%); z-index: 20;
  display: none; flex-direction: column; gap: 14px;
}
.rail::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.rail a { position: relative; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink-3); font-size: 13px; }
.rail a i {
  width: 9px; height: 9px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink-3);
  transition: all .3s var(--ease); flex: none;
}
.rail a span { opacity: 0; transform: translateX(-6px); transition: all .25s var(--ease); white-space: nowrap; }
.rail:hover a span, .rail a.current span { opacity: 1; transform: none; }
.rail a.seen i { background: var(--ink-3); }
.rail a.current { color: var(--ink); }
.rail a.current i { background: var(--accent); border-color: var(--accent); transform: scale(1.35); }
@media (min-width: 1240px) { .rail { display: flex; } }

/* ---------- Sections and flowing dividers ---------- */
.chapter { position: relative; padding: 64px 0; scroll-margin-top: 40px; }
.chapter.tint { background: var(--paper-2); margin: 40px 0; }
.chapter.tint::before, .chapter.tint::after {
  content: ""; position: absolute; left: 0; right: 0; height: 48px; background: var(--paper-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 48' preserveAspectRatio='none'%3E%3Cpath d='M0 48V24C240 0 480 0 720 22s480 26 720 2v24z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 48' preserveAspectRatio='none'%3E%3Cpath d='M0 48V24C240 0 480 0 720 22s480 26 720 2v24z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.chapter.tint::before { top: -47px; }
.chapter.tint::after { bottom: -47px; transform: scaleY(-1); }
.kicker {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
  font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
}
.kicker .num { font-family: var(--serif); font-size: 15px; letter-spacing: 0; color: var(--accent); font-style: italic; text-transform: none; }
.lead { font-size: 19px; line-height: 1.55; color: var(--ink-2); max-width: 680px; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal.from-left { transform: translateX(-36px); }
.reveal.from-right { transform: translateX(36px); }
.reveal.from-left.in, .reveal.from-right.in { transform: none; }
/* Children of lists and grids: an animation so it never fights their own hover transitions. */
.rv-kid { opacity: 0; }
.rv-kid.in { animation: rvIn .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rvIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Buttons and inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 99px; padding: 13px 24px;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  background: var(--ink); color: var(--paper); text-decoration: none;
  transition: transform .2s var(--ease), background .2s, opacity .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn.line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.line:hover { box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.btn.sm { padding: 8px 16px; font-size: 14px; }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn .arrow { transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer;
  --fill: 30%; --c: var(--accent);
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px;
  background: linear-gradient(to right, var(--c) var(--fill), var(--line) var(--fill));
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--c); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--c); box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  transition: transform .15s;
}
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--card); border: 2px solid var(--c); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }
input[type="text"], textarea {
  font: inherit; color: var(--ink); background: transparent;
  border: 0; border-bottom: 1.5px solid var(--line); padding: 6px 2px; outline: none;
  transition: border-color .2s;
}
input[type="text"]:focus, textarea:focus { border-color: var(--accent); }
textarea { width: 100%; min-height: 96px; resize: vertical; line-height: 1.6; }

/* ---------- Four questions ---------- */
.four { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 40px 48px; margin-top: 56px; }
.four .word { font-family: var(--serif); font-style: italic; font-size: 40px; line-height: 1; color: var(--accent); margin-bottom: 10px; }
.four p { color: var(--ink-2); font-size: 17px; }
.four > div { border-top: 1px solid var(--line); padding-top: 20px; }

.style-pick { margin-top: 64px; font-family: var(--serif); font-size: clamp(24px, 3.4vw, 34px); line-height: 1.5; }
.style-pick .opts { display: inline; }
.style-pick button {
  font: inherit; font-style: italic; color: var(--ink-3); background: none; border: 0; padding: 0 4px; cursor: pointer;
  border-bottom: 2px dashed transparent; transition: color .2s, border-color .2s;
}
.style-pick button:hover { color: var(--ink); }
.style-pick button.on { color: var(--accent); border-bottom-color: var(--accent); }
.style-pick .sep { color: var(--ink-3); }

/* ---------- Splits and bars ---------- */
.flowbar { display: flex; height: 64px; border-radius: 32px; overflow: hidden; gap: 4px; }
.flowbar > div {
  display: flex; align-items: center; padding: 0 20px; color: var(--on-color); font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; transition: flex-basis .7s var(--ease);
}
.flowbar > div:first-child { border-radius: 32px 8px 8px 32px; }
.flowbar > div:last-child { border-radius: 8px 32px 32px 8px; }
.bg-needs { background: var(--needs); }
.bg-wants { background: var(--wants); }
.bg-savings { background: var(--savings); }
.c-needs { color: var(--needs); }
.c-wants { color: var(--wants); }
.c-savings { color: var(--savings); }
.c-danger { color: var(--danger); }
.c-good { color: var(--good); }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; margin-top: 36px; }
.figure .label { font-size: 14px; color: var(--ink-3); letter-spacing: .04em; }
.figure .val { font-family: var(--serif); font-size: 40px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.figure p { font-size: 15px; color: var(--ink-2); margin-top: 6px; }
.payline { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.payline .val { font-family: var(--serif); font-size: clamp(44px, 6vw, 68px); line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* Coin field: 100 coins, each 1% */
.coins { display: grid; grid-template-columns: repeat(20, 1fr); gap: 6px; max-width: 640px; }
.coins span {
  aspect-ratio: 1; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line);
  transition: background .5s var(--ease), box-shadow .5s var(--ease), transform .5s var(--ease);
}
.coins span.on { box-shadow: none; transform: scale(1.08); }
.give { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.give .btn { color: var(--on-color); }

/* ---------- Listen ---------- */
.player { display: flex; align-items: center; gap: 20px; margin: 32px 0 24px; flex-wrap: wrap; }
.play-btn {
  width: 72px; height: 72px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: var(--on-color); display: grid; place-items: center;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .2s var(--ease);
}
.play-btn:hover { transform: scale(1.05); }
.play-btn.playing { animation: pulse 2s infinite; }
.play-btn svg { width: 26px; height: 26px; }
.play-btn .pause { display: none; }
.play-btn.playing .pause { display: block; }
.play-btn.playing .play { display: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
.wave { display: flex; align-items: center; gap: 3px; height: 40px; }
.wave i { width: 3px; border-radius: 3px; background: var(--ink-3); height: 20%; transition: height .3s; }
.player.on .wave i { animation: wv 1s var(--ease) infinite alternate; background: var(--accent); }
@keyframes wv { from { height: 15%; } to { height: 95%; } }
.speed { display: flex; gap: 4px; }
.speed button {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-3); background: none; border: 0; padding: 6px 10px; border-radius: 99px; cursor: pointer;
}
.speed button.on { color: var(--ink); background: var(--paper-2); }
.transcript p {
  font-family: var(--serif); font-size: 19px; line-height: 1.5; color: var(--ink-3);
  cursor: pointer; margin: 0 0 14px; transition: color .4s var(--ease);
}
.transcript p:hover { color: var(--ink-2); }
.transcript p.now { color: var(--ink); }

/* ---------- Game ---------- */
.ledger {
  background: var(--card); border-radius: 28px; padding: clamp(20px, 4vw, 40px);
  box-shadow: 0 1px 0 var(--line), 0 30px 60px -30px rgba(60, 50, 30, .25);
}
:root[data-theme="dark"] .ledger { box-shadow: 0 1px 0 var(--line), 0 30px 60px -30px rgba(0, 0, 0, .6); }
.ledger-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.left-big { font-family: var(--serif); font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; transition: color .3s; }
.alloc { display: grid; grid-template-columns: 180px 1fr 84px; align-items: center; gap: 4px 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.alloc .name { font-weight: 600; }
.alloc .name small { display: block; font-weight: 500; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.alloc .amt { text-align: right; font-family: var(--serif); font-size: 22px; font-variant-numeric: tabular-nums; }
.alloc .hint { grid-column: 2 / -1; font-size: 14px; color: var(--ink-3); margin-top: -6px; }
.alloc.locked input { opacity: .4; pointer-events: none; }
.split-note { font-size: 15px; color: var(--ink-2); margin: 12px 0 0; }

.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 20px; margin-bottom: 28px; }
.gauge small { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.gauge b { display: block; font-family: var(--serif); font-weight: 500; font-size: 26px; font-variant-numeric: tabular-nums; transition: color .3s; }
.gauge .meter { height: 4px; border-radius: 4px; background: var(--line); margin-top: 6px; overflow: hidden; }
.gauge .meter div { height: 100%; transition: width .6s var(--ease); }
.bump { animation: bump .5s var(--ease); }
@keyframes bump { 40% { transform: scale(1.12); } }

.event-card {
  border-radius: 22px; padding: 28px; background: var(--paper);
  animation: deal .6s var(--ease);
}
@keyframes deal { from { opacity: 0; transform: translateY(24px) rotate(-1.5deg); } to { opacity: 1; transform: none; } }
.event-card .when { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.event-card h3 { margin: 10px 0 6px; font-size: 25px; }
.event-card .art { width: 64px; height: 64px; float: right; margin-left: 16px; color: var(--accent); }
.choices { display: grid; gap: 10px; margin-top: 20px; clear: both; }
.choice {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  text-align: left; font: inherit; font-size: 16px; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 18px; cursor: pointer;
  transition: border-color .2s, transform .2s var(--ease);
}
.choice:hover { border-color: var(--ink); transform: translateX(4px); }
.choice .arrow { color: var(--ink-3); }
.timeline { list-style: none; padding: 0; margin: 24px 0 0; font-size: 15px; color: var(--ink-2); }
.timeline li { padding: 6px 0 6px 20px; position: relative; animation: deal .4s var(--ease); }
.timeline li::before { content: ""; position: absolute; left: 0; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.timeline li.bad::before { background: var(--danger); }
.timeline li.good::before { background: var(--good); }
.grade { font-family: var(--serif); font-size: 140px; line-height: .9; font-style: italic; }
.checks { list-style: none; padding: 0; margin: 24px 0; }
.checks li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 12px; }
.checks li::before { content: "✓"; color: var(--good); font-weight: 700; }
.checks li.no::before { content: "✕"; color: var(--danger); }

/* ---------- Logic ---------- */
.formula {
  font-family: var(--serif); font-size: clamp(18px, 2.2vw, 22px); line-height: 1.6;
  padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 16px 0 32px;
}
.formula .op { color: var(--ink-3); }
.steps { list-style: none; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 0 0 28px 72px; }
.steps li::before {
  content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: -6px;
  font-family: var(--serif); font-style: italic; font-size: 36px; color: var(--accent); line-height: 1;
}
.steps li::after { content: ""; position: absolute; left: 20px; top: 40px; bottom: 6px; width: 1px; background: var(--line); }
.steps li:last-child::after { display: none; }
details.deeper { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; margin-top: 16px; }
details.deeper summary { cursor: pointer; font-family: var(--serif); font-size: 22px; list-style: none; display: flex; justify-content: space-between; }
details.deeper summary::after { content: ""; flex: none; width: 16px; height: 16px; margin: 8px 0 0 12px; background: linear-gradient(var(--accent), var(--accent)) center / 100% 2px no-repeat, linear-gradient(var(--accent), var(--accent)) center / 2px 100% no-repeat; transition: transform .3s; }
details.deeper[open] summary::after { transform: rotate(45deg); }
details.deeper > div { padding-top: 12px; color: var(--ink-2); }

/* ---------- Nature ---------- */
.flow { stroke-dasharray: 8 12; animation: flow 1.6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -40; } }
.nature-art { width: 100%; height: auto; display: block; margin: 24px 0; }

/* ---------- Notes (lined paper) ---------- */
.paper {
  background:
    linear-gradient(to right, transparent 54px, color-mix(in srgb, var(--danger) 35%, transparent) 54px, color-mix(in srgb, var(--danger) 35%, transparent) 55px, transparent 55px),
    repeating-linear-gradient(to bottom, var(--card) 0, var(--card) 35px, var(--line) 35px, var(--line) 36px);
  border-radius: 6px; padding: 36px 28px 36px 76px; line-height: 36px; font-size: 18px;
  box-shadow: 0 30px 50px -36px rgba(60, 50, 30, .35);
}
.paper ul { margin: 0; padding-left: 18px; }
.paper li { margin: 0; }
.blank {
  width: 130px; text-align: center; font-family: var(--serif); font-size: 20px; font-style: italic;
  color: var(--accent); border-bottom: 1.5px solid var(--ink-3); padding: 0 4px; line-height: 1.2;
}
.blank.right { border-color: var(--good); color: var(--good); }
.blank.wrong { border-color: var(--danger); color: var(--danger); }

/* ---------- Together / solo ---------- */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 48px; margin-top: 40px; }
.cols h3 { font-size: 22px; }
.cols p { color: var(--ink-2); }
.prompt { margin: 0 0 40px; }
.prompt .q { font-family: var(--serif); font-size: 21px; line-height: 1.35; margin-bottom: 8px; }

/* ---------- Quiz ---------- */
.question { padding: 32px 0; border-top: 1px solid var(--line); }
.question .stem { font-family: var(--serif); font-size: 21px; line-height: 1.35; margin-bottom: 18px; }
.question .stem small { display: block; font-family: var(--sans); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  font: inherit; font-size: 17px; color: var(--ink); background: transparent;
  border: 0; border-radius: 14px; padding: 12px 14px; cursor: pointer; transition: background .2s;
}
.opt:hover { background: var(--paper-2); }
.opt .letter {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--line); font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: all .3s var(--ease);
}
.opt.right .letter { background: var(--good); color: var(--on-color); box-shadow: none; }
.opt.wrong .letter { background: var(--danger); color: var(--on-color); box-shadow: none; }
.question.answered .opt:not(.right):not(.wrong) { opacity: .45; }
.question .why { display: none; margin: 14px 0 0 60px; color: var(--ink-2); font-size: 16px; }
.question.answered .why { display: block; animation: deal .5s var(--ease); }
.quiz-score { font-family: var(--serif); font-size: 24px; padding-top: 24px; border-top: 1px solid var(--line); }

/* ---------- Connections map ---------- */
.connect-map { width: 100%; height: auto; display: block; margin-top: 24px; }
.connect-map a { cursor: pointer; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 160%); z-index: 60;
  background: var(--ink); color: var(--paper); padding: 12px 22px; border-radius: 99px;
  font-size: 15px; font-weight: 600; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .35);
  transition: transform .45s var(--ease);
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- Header nav ---------- */
.topnav { display: flex; gap: 22px; margin-left: 12px; }
.topnav a { color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500; }
.topnav a:hover, .topnav a[aria-current] { color: var(--ink); }

/* ---------- Footer ---------- */
.foot { padding: 56px 0 28px; color: var(--ink-2); font-size: 15px; margin-top: 48px; }
.foot p:last-child { margin-bottom: 0; }
.foot .wrap { display: grid; gap: 18px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.foot nav a { color: var(--ink); text-decoration: none; }
.foot nav a:hover { text-decoration: underline; }
.foot .disclaimer { max-width: 640px; }

/* ---------- Legal and info pages ---------- */
.doc { padding: 72px 0 24px; }
.doc h1 { font-size: clamp(36px, 6vw, 56px); }
.doc h2 { font-size: 28px; margin-top: 48px; }
.doc h3 { font-size: 21px; margin-top: 28px; }
.doc p, .doc li { color: var(--ink-2); }
.doc li { margin-bottom: 6px; }
.doc .updated { color: var(--ink-3); font-size: 15px; }
.doc table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 16px; }
.doc th, .doc td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--ink); font-weight: 600; }
.callout { background: var(--paper-2); border-radius: 18px; padding: 20px 24px; margin: 24px 0; }

/* ---------- Storage notice (no tracking, so no consent wall) ---------- */
.notice {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 70; max-width: 560px; margin: 0 auto;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 18px; display: flex; gap: 16px; align-items: center; font-size: 15px;
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .3); animation: deal .5s var(--ease);
}
.notice p { margin: 0; flex: 1; color: var(--ink-2); }

/* ---------- Companion panel (right margin, wide screens) ---------- */
.companion {
  position: fixed; right: 24px; top: 50%; transform: translateY(-50%); z-index: 20; width: 190px;
  display: none; font-size: 14px; color: var(--ink-2);
}
.companion .who { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.companion .who svg { width: 40px; height: 40px; flex: none; }
.companion .who b { display: block; color: var(--ink); font-family: var(--serif); font-size: 18px; font-weight: 500; }
.companion dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; }
.companion dt { color: var(--ink-3); }
.companion dd { margin: 0; text-align: right; font-family: var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.companion dd.bad { color: var(--danger); }
.companion .badges { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }
.companion .badges b { color: var(--ink); font-weight: 600; }


@media (max-width: 720px) {
  body { font-size: 17px; }
  .wrap { padding: 0 16px; }
  .chapter { padding: 64px 0; }
  .crumb, .topnav { display: none; }
  .coins { grid-template-columns: repeat(10, 1fr); gap: 5px; }
  .alloc { grid-template-columns: 1fr 72px; }
  .alloc input { grid-column: 1 / -1; grid-row: 2; }
  .alloc .hint { grid-column: 1 / -1; grid-row: 3; margin-top: 0; }
  .flowbar { height: 52px; }
  .flowbar > div { padding: 0 12px; font-size: 13px; }
  .paper { padding: 28px 16px 28px 52px; background:
    linear-gradient(to right, transparent 36px, color-mix(in srgb, var(--danger) 35%, transparent) 36px, color-mix(in srgb, var(--danger) 35%, transparent) 37px, transparent 37px),
    repeating-linear-gradient(to bottom, var(--card) 0, var(--card) 35px, var(--line) 35px, var(--line) 36px); }
  .steps li { padding-left: 56px; }
  .grade { font-size: 104px; }
  .question .why { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .rv-kid { opacity: 1; transform: none; }
}

/* ---------- Lesson opening: everything you need on one screen ---------- */
#start { padding: 24px 0 56px; }
.fold {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 56px; align-items: center;
  min-height: calc(100svh / var(--z, 1) - 64px - 24px);
}
.fold h1 { font-size: clamp(42px, 4.6vw, 66px); margin-bottom: .25em; }
.fold .kicker { margin-bottom: 10px; }
.fold-art svg { width: 100%; height: auto; max-height: calc(100svh / var(--z, 1) - 120px); display: block; }
.story { font-size: 18px; margin-bottom: 0; line-height: 1.6; color: var(--ink-2); max-width: 600px; }
.story-tag {
  display: inline-block; margin-right: 6px; font-family: var(--serif); font-style: italic; color: var(--accent);
}
.four.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 32px; margin-top: 22px; }
.four.compact > div { padding-top: 12px; }
.four.compact .word { font-size: 23px; margin-bottom: 2px; }
.four.compact p { font-size: 15px; line-height: 1.5; margin: 0; }
@media (max-width: 960px) {
  .fold { grid-template-columns: 1fr; min-height: 0; gap: 24px; padding-top: 24px; }
  .fold-art { max-width: 380px; margin: 0 auto; width: 100%; }
}
@media (max-width: 560px) { .four.compact { grid-template-columns: 1fr; } }

/* ---------- Account forms ---------- */
.auth-tabs { display: flex; gap: 4px; margin: 28px 0 8px; background: var(--paper-2); padding: 4px; border-radius: 99px; width: max-content; }
.auth-tabs button { font: inherit; font-size: 15px; font-weight: 600; border: 0; background: none; color: var(--ink-2); padding: 8px 18px; border-radius: 99px; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.auth-form { display: grid; gap: 18px; max-width: 420px; margin-top: 20px; }
.auth-form label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; color: var(--ink); }
.auth-form input[type="email"], .auth-form input[type="password"], .auth-form input[type="text"] {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.auth-form input:focus { border-color: var(--accent); outline: none; }
.auth-form .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--ink-2); }
.auth-form .check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.auth-form .btn { justify-self: start; }
.linkish { font: inherit; font-size: 15px; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; justify-self: start; text-decoration: underline; text-underline-offset: 3px; }
.auth-msg { min-height: 1.6em; margin-top: 12px; color: var(--ink-2); }
.auth-msg.bad { color: var(--danger); }
.btn.danger { color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }

/* ======================================================================
   Device layer: phones, tablets, laptops and big screens.
   Breakpoints: ≤380 small phones · ≤720 phones · 721–1024 tablets ·
   phone landscape (short screens) · coarse pointers (touch) · ≥1800 big screens.
   ====================================================================== */

/* Notches and rounded corners (iPhone, Android): keep content inside the safe area. */
.wrap { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.notice { bottom: max(16px, env(safe-area-inset-bottom)); }
.toast { bottom: max(28px, calc(env(safe-area-inset-bottom) + 12px)); }
.foot { padding-bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px)); }

/* Header never wraps or squeezes its round buttons; on phones the xp count steps aside to make room. */
.topbar .btn, .xp, .logo { white-space: nowrap; }
.topbar .icon-btn, .topbar .btn { flex: none; }
@media (max-width: 430px) { .topbar .wrap { gap: 10px; } .xp { display: none; } }
html { -webkit-tap-highlight-color: transparent; }
img, svg, video { max-width: 100%; }

/* Footer: centered. */
.foot { text-align: center; }
.foot nav { justify-content: center; }
.foot .disclaimer { margin-left: auto; margin-right: auto; }

/* Touch screens: every control at least 44px tall, and no hover-only tricks. */
@media (pointer: coarse) {
  .btn.sm, .speed button, .auth-tabs button, .opt, .choice, .opts button { min-height: 44px; }
  .linkish { min-height: 44px; display: inline-flex; align-items: center; }
  input[type="range"] { height: 44px; }
  input[type="range"]::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -11px; }
  input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; }
  .icon-btn { width: 44px; height: 44px; }
  .choice:hover { transform: none; }
  .btn:hover { transform: none; }
  .foot nav a { padding: 8px 0; }
}

/* Tablets (iPad portrait, small laptops). */
@media (min-width: 721px) and (max-width: 1024px) {
  .wrap { padding-left: max(32px, env(safe-area-inset-left)); padding-right: max(32px, env(safe-area-inset-right)); }
  .chapter { padding: 56px 0; }
  .fold { grid-template-columns: 1fr; gap: 32px; min-height: 0; padding-top: 32px; }
  .fold-art { max-width: 460px; margin: 0 auto; }
  .four.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .figure .val { font-size: 40px; }
  .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px; }
  .alloc { grid-template-columns: 150px 1fr 76px; }
}

/* iPad landscape and small laptops: two columns, a little tighter. */
@media (min-width: 1025px) and (max-width: 1239px) {
  .fold { gap: 40px; }
}

/* Phones. */
@media (max-width: 720px) {
  .wrap { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .topbar .wrap { gap: 10px; height: 58px; }
  .logo { font-size: 21px; }
  h1 { font-size: clamp(36px, 10vw, 48px); }
  h2 { font-size: clamp(26px, 7vw, 32px); }
  .lead, .story { font-size: 17px; }
  .chapter.tint { margin: 32px 0; }
  .figures { grid-template-columns: 1fr; gap: 20px; }
  .figure .val { font-size: 40px; }
  .ledger { border-radius: 20px; padding: 16px; }
  .left-big { font-size: 36px; }
  .ledger-head .btn { width: 100%; }
  .event-card { padding: 20px; }
  .event-card h3 { font-size: 24px; }
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .gauge b { font-size: 24px; }
  .transcript p { font-size: 17px; }
  .player { gap: 14px; }
  .formula { font-size: 18px; }
  .question .stem { font-size: 20px; }
  .style-pick { font-size: 22px; }
  .foot nav { gap: 4px 18px; }
  .notice { flex-direction: column; align-items: stretch; text-align: left; }
  .notice .btn { width: 100%; }
}

/* Small phones (iPhone SE, older Androids). */
@media (max-width: 380px) {
  .xp { display: none; }
  .topbar .btn.sm { padding: 8px 12px; }
  .icon-btn { width: 40px; height: 40px; }
  .gauges { grid-template-columns: 1fr 1fr; }
  .grade { font-size: 88px; }
}

/* Phones turned sideways: short screens, so drop full-height layouts. */
@media (max-height: 500px) and (orientation: landscape) {
  .fold, .home-fold { min-height: 0; }
  .fold { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 28px; padding-top: 16px; }
  .fold-art { max-width: none; }
  .fold-art svg, .home-fold svg { max-height: 80vh; }
  .chapter { padding: 48px 0; }
  .topbar .wrap { height: 52px; }
  .rail, .companion { display: none !important; }
}

/* Big screens: scale everything up so the page doesn't float in empty space. */
/* zoom scales vh too, so full-height pieces divide by --z */
@media (min-width: 1800px) { html { zoom: 1.18; --z: 1.18; } }
@media (min-width: 2300px) { html { zoom: 1.4; --z: 1.4; } }
@media (min-width: 3200px) { html { zoom: 1.8; --z: 1.8; } }

/* ---------- Account page ---------- */
.auth-page { padding-top: clamp(24px, 5vw, 64px); padding-bottom: 72px; }
.auth-shell {
  display: grid; grid-template-columns: 1fr minmax(0, 460px); gap: clamp(32px, 6vw, 88px);
  align-items: center; max-width: 1060px; margin: 0 auto; min-height: calc(100svh / var(--z, 1) - 220px);
}
.auth-side-title { font-family: var(--serif); font-size: clamp(36px, 4.4vw, 56px); line-height: 1.05; margin: 8px 0 24px; color: var(--ink); letter-spacing: -.01em; }
.auth-side-title em { color: var(--accent); }
.auth-art { width: 100%; max-width: 420px; display: block; margin-bottom: 20px; }
.auth-perks { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 440px; }
.auth-perks li { position: relative; padding-left: 28px; color: var(--ink-2); font-size: 16px; line-height: 1.5; }
.auth-perks li::before { content: ""; position: absolute; left: 0; top: .5em; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.auth-perks b { color: var(--ink); }
.auth-card {
  background: var(--card); border-radius: 24px; padding: clamp(24px, 4vw, 44px);
  box-shadow: 0 1px 0 var(--line), 0 24px 60px -28px rgba(60, 40, 20, .35); border: 1px solid var(--line);
}
.auth-card h1 { font-size: clamp(30px, 3.4vw, 40px); margin: 0 0 6px; }
.auth-card .auth-tabs { width: 100%; margin: 24px 0 4px; }
.auth-card .auth-tabs button { flex: 1; }
.auth-card .auth-form { max-width: none; }
.auth-card .auth-form .btn[type="submit"] { justify-self: stretch; justify-content: center; }
.auth-card .auth-form input[type="email"], .auth-card .auth-form input[type="password"], .auth-card .auth-form input[type="text"] { width: 100%; box-sizing: border-box; }
.auth-card .auth-msg:empty { min-height: 0; margin: 0; }
.acct-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; }
.acct-stats div { background: var(--paper-2); border-radius: 14px; padding: 14px 12px; text-align: center; }
.acct-stats dt { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.acct-stats dd { margin: 4px 0 0; font-family: var(--serif); font-size: 30px; color: var(--ink); }
.acct-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.acct-danger { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 16px; }
.acct-danger summary { cursor: pointer; color: var(--danger); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.acct-danger p { color: var(--ink-2); font-size: 15px; }
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; min-height: 0; max-width: 520px; gap: 24px; }
  .auth-side { order: 2; }
  .auth-art { display: none; }
  .auth-side .kicker, .auth-side-title { display: none; }
  .auth-perks { padding: 0 4px; }
}
@media (max-width: 480px) {
  .auth-card { border-radius: 18px; padding: 22px 18px; }
  .acct-stats dd { font-size: 24px; }
  .acct-actions .btn { flex: 1; justify-content: center; }
}
.auth-shell.signed-in { grid-template-columns: minmax(0, 560px); justify-content: center; min-height: 0; }
.auth-shell.signed-in .auth-side { display: none; }

@media (max-width: 1024px) {
  .fold.home-fold svg { max-height: 52svh; max-width: 420px; justify-self: center; }
}
html[data-theme="dark"] .auth-card .auth-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }

/* ---------- Lesson 'where it leads' list (phones show this instead of the map) ---------- */
.connect-list { display: none; list-style: none; padding: 0; margin: 24px 0 0; border-left: 2px solid var(--line); }
.connect-list li { padding: 10px 0 10px 20px; position: relative; display: flex; flex-direction: column; }
.connect-list li::before { content: ""; position: absolute; left: -6px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink-3); }
.connect-list li.here::before { background: var(--accent); border-color: var(--accent); }
.connect-list li.here b { color: var(--accent); }

@media (max-width: 720px) { .connect-map { display: none; } .connect-list { display: block; } }

/* ---------- Shared lesson bits: chips and game results ---------- */
.chip {
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 16px; border-radius: 99px; cursor: pointer;
  border: 0; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); transition: all .2s var(--ease);
}
.chip:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); box-shadow: none; }
@media (pointer: coarse) { .chip { min-height: 44px; } }
.result-grade { display: flex; gap: 24px; align-items: center; margin: 28px 0 12px; }
.result-grade .grade { font-family: var(--serif); font-size: 88px; line-height: 1; color: var(--accent); }
.result-grade p { margin: 4px 0 0; color: var(--ink-2); }
@media (max-width: 720px) { .result-grade .grade { font-size: 64px; } }
/* Nature drawings: bigger labels on phones; the small captions are dropped so nothing collides. */
@media (max-width: 720px) {
  .nature-art text { font-size: 32px; }
  .nature-art text[font-size="15"] { display: none; }
}

/* Account: password rules, "check your email" screen, username prompt */
.pw-rules { list-style: none; padding: 0; margin: -8px 0 0; display: grid; gap: 4px; font-size: 14px; color: var(--ink-3); }
.pw-rules li { display: flex; gap: 8px; align-items: center; transition: color .2s; }
.pw-rules li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ink-3); flex: none; transition: all .2s; }
.pw-rules li.ok { color: var(--good); }
.pw-rules li.ok::before { background: var(--good); box-shadow: none; }
.sent { text-align: left; }
.sent-art { width: 96px; height: auto; display: block; margin-bottom: 18px; }
.sent p { color: var(--ink-2); }
.sent-steps { margin: 18px 0 26px; padding-left: 20px; color: var(--ink-2); display: grid; gap: 6px; }
.sent .btn { width: 100%; justify-content: center; }
.sent-more { font-size: 15px; margin-top: 16px; text-align: center; }
.name-form { display: flex; gap: 10px; align-items: flex-end; margin: 18px 0 0; }
.name-form label { flex: 1; }

/* Header account button once signed in: avatar initial plus username */
.btn.sm.signed-in { gap: 8px; padding-left: 5px; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); max-width: 180px; }
.btn.sm.signed-in .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-color); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.btn.sm.signed-in .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .btn.sm.signed-in .uname { display: none; } .btn.sm.signed-in { padding-right: 5px; } }

/* The eight ways every lesson teaches: setup page showcase */
.lp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; list-style: none; margin: 0; padding: 0; }
.lp-card { position: relative; padding: 12px 14px; border-radius: 14px; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); display: grid; grid-template-columns: 26px 1fr auto; column-gap: 10px; align-items: start; }
.lp-card svg { grid-row: span 2; width: 24px; height: 24px; color: var(--accent); margin-top: 1px; }
.lp-card b { font-family: var(--serif); font-weight: 500; font-size: 16px; line-height: 1.25; }
.lp-card small { grid-column: 2 / -1; font-size: 12.5px; color: var(--ink-3); line-height: 1.35; margin-top: 2px; }
.lp-card .ch { grid-column: 3; grid-row: 1; align-self: start; font-style: normal; font-size: 11.5px; font-weight: 600; white-space: nowrap; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }

/* ---------- Setup: how you learn, why, what you know ---------- */
.name-ask[hidden], .hero-setup[hidden] { display: none; }
.setup-page { padding-top: 40px; padding-bottom: 80px; }
.setup { max-width: 820px; margin: 0 auto; }
.setup h1 { font-size: clamp(36px, 4.4vw, 56px); margin: 0 0 12px; }
.setup .lead { font-size: 18px; margin-bottom: 28px; }
.setup-steps { list-style: none; padding: 0; margin: 0 0 40px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; counter-reset: s; }
.setup-steps li { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-3); }
.setup-steps li i { height: 4px; border-radius: 4px; background: var(--line); transition: background .4s var(--ease); }
.setup-steps li.done i, .setup-steps li.on i { background: var(--accent); }
.setup-steps li.on { color: var(--ink); font-weight: 600; }
.step { animation: stepIn .45s var(--ease); }
@keyframes stepIn { from { opacity: 0; transform: translateY(12px); } }
.step-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 32px; flex-wrap: wrap; }
.step-nav .btn[disabled] { opacity: .35; pointer-events: none; }
.text-link { background: none; border: 0; padding: 8px 0; font: inherit; color: var(--ink-3); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.text-link:hover { color: var(--ink); }
.name-ask { display: grid; gap: 6px; margin: 0 0 24px; padding: 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.name-ask label { font-weight: 600; }
.name-ask input { font: inherit; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); }
.name-ask small { color: var(--ink-3); font-size: 13px; }
.setup .lp-card { padding: 14px; }
.setup .lp-card b { font-size: 17px; }
.goal-grid, .level-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.goal-card, .level-card { position: relative; text-align: left; font: inherit; border: 0; cursor: pointer; padding: 22px 22px 20px; border-radius: 20px; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); display: flex; flex-direction: column; gap: 6px; transition: box-shadow .2s, background .2s, transform .2s var(--ease); }
.goal-card:hover, .level-card:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.goal-card svg { width: 30px; height: 30px; color: var(--ink-3); margin-bottom: 6px; transition: color .2s; }
.goal-card b, .level-card b { font-family: var(--serif); font-weight: 500; font-size: 21px; line-height: 1.2; padding-right: 24px; }
.goal-card small, .level-card small { color: var(--ink-3); font-size: 14.5px; line-height: 1.45; }
.goal-card .units { margin-top: 8px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); }
.goal-card .tick { position: absolute; top: 18px; right: 18px; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line); }
.goal-card.on, .level-card.on { background: color-mix(in srgb, var(--accent) 9%, var(--card)); box-shadow: inset 0 0 0 2px var(--accent); }
.goal-card.on svg, .goal-card.on .units { color: var(--accent); }
.goal-card.on .tick { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center/14px no-repeat; box-shadow: none; }
.level-card .bars { display: flex; gap: 4px; align-items: flex-end; height: 22px; margin-bottom: 8px; }
.level-card .bars i { width: 7px; border-radius: 3px; background: var(--line); }
.level-card .bars i:nth-child(1) { height: 9px; } .level-card .bars i:nth-child(2) { height: 15px; } .level-card .bars i:nth-child(3) { height: 22px; }
.level-card .bars i.f { background: var(--accent); }
.level-card .bars i.q { background: repeating-linear-gradient(-45deg, var(--line) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--line); }
.q-bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin: 6px 0 28px; }
.q-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s var(--ease); }
.q-unit { font-family: var(--serif); font-style: italic; color: var(--accent); margin: 0 0 6px; }
.q-stem { font-size: clamp(24px, 3vw, 32px); line-height: 1.25; margin: 0 0 24px; }
.q-opts { display: grid; gap: 10px; }
.q-opt { text-align: left; font: inherit; font-size: 17px; padding: 16px 18px; border-radius: 14px; border: 0; cursor: pointer; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); transition: box-shadow .2s, background .2s; }
.q-opt:hover:not([disabled]) { box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.q-opt[disabled] { cursor: default; }
.q-opt.right { background: color-mix(in srgb, var(--good) 14%, var(--card)); box-shadow: inset 0 0 0 2px var(--good); }
.q-opt.wrong { background: color-mix(in srgb, var(--danger) 12%, var(--card)); box-shadow: inset 0 0 0 2px var(--danger); }
@media (max-width: 640px) {
  .setup-steps span { display: none; }
  .setup-steps li.on span { display: block; position: absolute; }
  .setup-steps { margin-bottom: 52px; position: relative; }
  .goal-grid, .level-grid { grid-template-columns: 1fr; }
  .setup .lp-grid { grid-template-columns: 1fr; }
  .step-nav .btn { width: 100%; justify-content: center; order: -1; }
}

/* Footer sits on its own warm band so pages have a clear end. */
.foot { position: relative; background: var(--paper-2); margin-top: 80px; }
.foot::before { content: ""; position: absolute; left: 0; right: 0; top: -39px; height: 40px; background: var(--paper-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 40' preserveAspectRatio='none'%3E%3Cpath d='M0 40V22C240 2 480 0 720 14s480 26 720 4v22z'/%3E%3C/svg%3E") center / 100% 100%;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 40' preserveAspectRatio='none'%3E%3Cpath d='M0 40V22C240 2 480 0 720 14s480 26 720 4v22z'/%3E%3C/svg%3E") center / 100% 100%; }

/* Cards lift off the textured page. */
.goal-card, .level-card, .q-opt { box-shadow: inset 0 0 0 1.5px var(--line), var(--shadow); }
.learn-pick { box-shadow: var(--shadow); }


/* Key terms: highlighted where they're introduced, with the meaning on hover or tap. */
.term { position: relative; font-style: normal; font-weight: 650; color: var(--ink); background: linear-gradient(transparent 58%, color-mix(in srgb, var(--accent) 22%, transparent) 58%); padding: 0 2px; border-radius: 3px; cursor: help; outline-offset: 2px; }
.term[data-def]:hover::after, .term[data-def]:focus::after { content: attr(data-def); position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); width: max-content; max-width: min(300px, 80vw); padding: 10px 14px; border-radius: 12px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 500; line-height: 1.45; text-align: left; white-space: normal; pointer-events: none; z-index: 40; animation: termIn .2s var(--ease); }
@keyframes termIn { from { opacity: 0; transform: translate(-50%, 4px); } }
@media (max-width: 720px) {
  .term[data-def]:hover::after, .term[data-def]:focus::after { position: fixed; left: 16px; right: 16px; bottom: 16px; width: auto; max-width: none; transform: none; font-size: 15px; animation: none; box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); }
}
.term-key { font-size: 14px; color: var(--ink-3); margin-top: 8px; }
.term-key .term { cursor: default; }
.blank-ans { margin-left: 8px; font-size: 15px; font-weight: 600; color: var(--good); white-space: nowrap; }
.ppf-legend { font-size: 15px; }
.ppf-key { margin: 0 0 12px; padding-left: 20px; }
.ppf-key li { margin: 4px 0; }

/* Stacked fraction: <span class="frac"><span>top</span><span>bottom</span></span> */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .2em; line-height: 1.25; text-align: center; }
.frac > span { padding: 0 .3em; }
.frac > span:first-child { border-bottom: 2px solid currentColor; padding-bottom: .1em; }
.frac > span:last-child { padding-top: .1em; }
p .frac, li .frac { font-size: .88em; margin: .15em .15em; }
.formula { line-height: 2; }

.mini-table { width: 100%; border-collapse: collapse; margin: 16px 0 28px; font-size: 16px; }
.mini-table th { text-align: left; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.mini-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.mini-table td .frac { font-size: .85em; }
.bow-chart { display: block; width: 100%; max-width: 620px; margin: 8px 0 24px; }
@media (max-width: 560px) {
  .mini-table { font-size: 14px; }
  .mini-table th, .mini-table td { padding: 8px 5px; }
  .mini-table th { font-size: 11px; letter-spacing: 0; }
}

/* "In this example" callout: ties a new term to the lesson's real numbers. */
.in-example { margin: 4px 0 32px; padding: 16px 20px; border-left: 4px solid var(--accent); background: var(--card); border-radius: 0 14px 14px 0; box-shadow: var(--shadow, none); }
.in-example .ie-tag { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.in-example dl { margin: 0; display: grid; gap: 10px; }
.in-example dl > div { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 4px 16px; }
.in-example dt { font-weight: 700; }
.in-example dd { margin: 0; color: var(--ink-2); }
.in-example p { margin: 0; }
details .in-example { margin: 10px 0 20px; }
@media (max-width: 560px) { .in-example dl > div { grid-template-columns: 1fr; } }

/* Language switch in the header */
.lang-switch { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.lang-switch::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c2.5 2.6 3.8 5.6 3.8 9s-1.3 6.4-3.8 9c-2.5-2.6-3.8-5.6-3.8-9S9.5 5.6 12 3z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c2.5 2.6 3.8 5.6 3.8 9s-1.3 6.4-3.8 9c-2.5-2.6-3.8-5.6-3.8-9S9.5 5.6 12 3z'/%3E%3C/svg%3E") center/contain no-repeat; }
.lang-switch:hover { color: var(--ink); border-color: var(--ink-3); }
.lang-switch .ls-short { display: none; }
@media (max-width: 720px) {
  .lang-switch { padding: 0 10px; height: 34px; }
  .lang-switch .ls-long { display: none; }
  .lang-switch .ls-short { display: inline; }
}
.lang-grid .goal-card b { font-family: var(--serif); font-size: 28px; font-weight: 500; }
.lang-grid .goal-card { padding: 28px 24px; }

/* "What you're looking at" caption under every chart and illustration */
.chart-cap { max-width: 760px; margin: 12px 0 28px; font-size: 14.5px; line-height: 1.55; color: var(--ink-3); }
.chart-cap b { color: var(--ink-2); font-weight: 600; }
.fold-art .chart-cap { margin: 10px auto 0; text-align: center; max-width: 460px; }
.nature-art + .chart-cap, .connect-map + .chart-cap { margin-left: auto; margin-right: auto; text-align: center; }
.nature-art + .chart-cap { margin-top: -8px; }
@media (max-width: 720px) { .connect-map + .chart-cap { display: none; } }

/* Compact EN/ES toggle in the header; the current language is the raised half. */
.lang-toggle { flex: none; display: inline-flex; padding: 3px; border-radius: 999px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; font-weight: 600; letter-spacing: .03em; }
.lang-toggle > * { display: grid; place-items: center; min-width: 34px; height: 28px; padding: 0 8px; border-radius: 999px; color: var(--ink-3); text-decoration: none; }
.lang-toggle [aria-current] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(40, 30, 10, .18); }
.lang-toggle a:hover { color: var(--ink); }
@media (pointer: coarse) { .lang-toggle > * { height: 32px; } }
:root[data-theme="dark"] .lang-toggle [aria-current] { background: var(--line); }
.foot-lang { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.foot-lang::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c2.5 2.6 3.8 5.6 3.8 9s-1.3 6.4-3.8 9c-2.5-2.6-3.8-5.6-3.8-9S9.5 5.6 12 3z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c2.5 2.6 3.8 5.6 3.8 9s-1.3 6.4-3.8 9c-2.5-2.6-3.8-5.6-3.8-9S9.5 5.6 12 3z'/%3E%3C/svg%3E") center/contain no-repeat; }

/* Full-width header: logo hugs the left edge, account the right, the menu sits in the middle. */
.topbar .wrap.wide { max-width: none; display: grid; grid-template-columns: 1fr auto 1fr; padding-left: clamp(20px, 3vw, 48px); padding-right: clamp(20px, 3vw, 48px); }
.wrap.wide .topnav { margin: 0; }
.top-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; }
@media (max-width: 720px) { .topbar .wrap.wide { grid-template-columns: auto 1fr; } .top-right { gap: 10px; } }

/* "Where it leads" map, built up as you scroll (site.js). */
.cm-live .cm-wire { stroke-dasharray: 1; stroke-dashoffset: 1; }
.cm-live .cm-node { opacity: 0; transform-box: fill-box; transform-origin: center; }
.cm-port { fill: var(--card); stroke: var(--accent); stroke-width: 2.5; }
.cm-flow { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 7 7; opacity: 0; transition: opacity .5s; animation: cm-flow 1.1s linear infinite; }
.cm-done .cm-flow { opacity: 1; }
.cm-done .cm-wire { stroke-dashoffset: 0 !important; }
.cm-done .cm-node { opacity: 1 !important; transform: none !important; }
@keyframes cm-flow { to { stroke-dashoffset: -14; } }
@media (prefers-reduced-motion: reduce) { .cm-flow { animation: none; } }

/* Home course map: the line that fills as you scroll (site.js). */
.path-fill { position: absolute; left: 23px; top: 10px; width: 2px; height: 0; background: var(--accent); border-radius: 2px; z-index: 0; }
.unit .n { transition: background .35s, color .35s, box-shadow .35s, transform .35s var(--ease); z-index: 1; }
.unit:not(.live) .n.lit { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.unit .n.lit { transform: scale(1.06); }

/* Money charts: glowing line tips and riding value tags (FHLesson.fx in lesson-kit.js). */
.fx-halo { fill: var(--c); opacity: .22; }
.fx-dot { fill: var(--c); stroke: var(--card); stroke-width: 2; }
.fx-head { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--c) 80%, transparent)); }
.fx-tip rect { fill: var(--ink); }
.fx-tip-k { font-size: 12px; fill: var(--paper); opacity: .75; }
.fx-tip-v { font-size: 17px; font-weight: 700; fill: var(--paper); font-variant-numeric: tabular-nums; }
.fx-live .fx-halo { animation: fx-pulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes fx-pulse { 50% { transform: scale(1.35); opacity: .08; } }
@media (prefers-reduced-motion: reduce) { .fx-live .fx-halo { animation: none; } }
.fx-bar { filter: drop-shadow(0 0 8px var(--glow)); }

/* ---------- Account menu (signed in) ---------- */
.acct-menu { position: relative; flex: none; }
.acct-btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 200px;
  padding: 4px 10px 4px 4px; border: 0; border-radius: 99px; background: transparent;
  color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .2s var(--ease);
}
.acct-btn:hover, .acct-menu.open .acct-btn { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.acct-menu .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-color); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.acct-btn .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn .caret { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.acct-menu.open .caret { transform: rotate(180deg); }
.acct-pop {
  position: absolute; right: 0; top: calc(100% + 10px); width: 268px; z-index: 40;
  padding: 8px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line), 0 24px 48px -20px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top right; visibility: hidden;
  transition: opacity .18s var(--ease), transform .22s var(--ease), visibility 0s .22s;
}
.acct-menu.open .acct-pop { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.acct-who { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 10px 12px; }
.acct-who .avatar { width: 38px; height: 38px; font-size: 16px; }
.acct-who > span:last-child { display: grid; min-width: 0; }
.acct-who b, .acct-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-who small { color: var(--ink-3); font-size: 13px; }
.acct-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 10px;
  background: none; color: var(--ink); font: inherit; font-size: 15px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
.acct-row:hover, .acct-row:focus-visible { background: color-mix(in srgb, var(--ink) 6%, transparent); outline: none; }
.acct-row svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.acct-row span { flex: 1; }
.acct-row svg:last-child:not(:first-child) { width: 16px; stroke: var(--ink-3); transition: transform .2s var(--ease); }
.acct-notes[aria-expanded="true"] svg:last-child { transform: rotate(90deg); }
.acct-empty { margin: 0 10px 6px 40px; color: var(--ink-3); font-size: 14px; }
.acct-pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.acct-out span { color: var(--ink-2); }
@media (max-width: 420px) { .acct-btn .uname { display: none; } }

/* ---------- Settings (signed-in account page) ---------- */
.auth-shell.signed-in { grid-template-columns: minmax(0, 1000px); }
.auth-shell.signed-in .auth-card { background: none; border: 0; box-shadow: none; padding: 0; }
.set-head { margin-bottom: 24px; }
.set-head h1 { margin: 0 0 4px; }
.set-head p { margin: 0; }
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.set-card { display: grid; gap: 16px; align-content: start; padding: 26px 28px; border-radius: 20px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.set-card.set-wide { grid-column: 1 / -1; }
.set-card h2 { margin: 0; font-family: var(--sans); font-size: 20px; font-weight: 700; }
.set-card h3.set-sub { margin: 10px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-family: var(--sans); font-size: 16px; font-weight: 700; }
.set-card > h2 + .set-p, .set-card > h3 + .set-p { margin-top: -10px; }
.set-p { margin: 0; color: var(--ink-3); font-size: 14.5px; line-height: 1.5; }
.set-card .btn { justify-self: start; }
.set-field { display: grid; gap: 4px; font-size: 15px; font-weight: 600; color: var(--ink); }
.set-field small { font-weight: 400; font-size: 13px; color: var(--ink-3); }
.set-field input:not([type="radio"]), .set-field select { margin-top: 4px; width: 100%; box-sizing: border-box; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-weight: 400; font-size: 16px; }
.set-field input:focus, .set-field select:focus { border-color: var(--accent); outline: none; }
.set-static { margin: 4px 0 0; padding: 11px 14px; border-radius: 12px; background: var(--paper-2); font-weight: 400; color: var(--ink-2); overflow-wrap: anywhere; }
.set-card .acct-stats { margin: 0; }
.set-card .acct-stats div { background: var(--paper-2); }
.check.set-check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer; }
.set-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.set-check small { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; color: var(--ink-3); }
.seg { display: inline-flex; margin-top: 6px; padding: 4px; border-radius: 99px; background: var(--paper-2); justify-self: start; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 18px; border-radius: 99px; font-size: 14px; font-weight: 600; color: var(--ink-2); transition: background .2s, color .2s; }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.set-card.auth-form { max-width: none; }
.set-card.auth-form input { width: 100%; box-sizing: border-box; }
.set-card .pw-rules { margin: -6px 0 0; }
.set-card .auth-msg:empty { display: none; }
.set-danger { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 35%, var(--line)), var(--shadow); }
.set-danger h2 { color: var(--danger); }
.set-danger .auth-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; max-width: none; }
.set-danger .auth-form label { flex: 1 1 240px; }
.btn.danger-fill { background: var(--danger); color: #fff; }
.btn.danger-fill:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 760px) { .set-grid { grid-template-columns: 1fr; } .set-card { padding: 22px 18px; } }

/* Reduce motion: the reader's pick in Settings, or their device setting. */
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important;
}

/* ---------- Help center ---------- */
.help-hero { position: relative; margin: 0 calc(50% - 50vw); padding: 64px 20px 72px; text-align: center; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 16%, var(--paper)), var(--paper)); }
.help-hero svg.help-wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 60px; color: var(--paper); }
.help-hero h1 { margin: 0 0 20px; font-size: clamp(32px, 4vw, 44px); }
.help-search { position: relative; max-width: 560px; margin: 0 auto; }
.help-search input { width: 100%; box-sizing: border-box; padding: 15px 48px 15px 20px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 16px; box-shadow: var(--shadow); }
.help-search input:focus { outline: none; border-color: var(--accent); }
.help-search svg { position: absolute; right: 18px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.help-topics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 980px; margin: 40px auto 0; }
.help-topic { display: grid; justify-items: center; gap: 8px; padding: 26px 20px; border-radius: 20px; text-align: center; color: inherit; text-decoration: none; transition: background .2s, transform .25s var(--ease), box-shadow .2s; }
.help-topic:hover { background: var(--card); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); transform: translateY(-3px); }
.help-topic .hi { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.help-topic .hi svg { width: 32px; height: 32px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.help-topic b { font-family: var(--serif); font-weight: 500; font-size: 20px; color: var(--ink); }
.help-topic small { color: var(--ink-3); font-size: 14px; line-height: 1.45; max-width: 26ch; }
.help-faq { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 32px; max-width: 980px; margin: 56px auto 72px; }
.help-faq h2 { margin: 0; font-size: 24px; }
.help-faq > div > section + section { margin-top: 28px; }
.help-faq h3 { margin: 0 0 6px; font-family: var(--sans); font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); scroll-margin-top: 90px; }
.help-faq details { border-bottom: 1px solid var(--line); }
.help-faq summary { display: flex; gap: 12px; align-items: center; padding: 14px 0; cursor: pointer; list-style: none; font-weight: 600; color: var(--ink); }
.help-faq summary::-webkit-details-marker { display: none; }
.help-faq summary::after { content: "+"; margin-left: auto; font-size: 20px; color: var(--ink-3); transition: transform .2s; }
.help-faq details[open] summary::after { transform: rotate(45deg); }
.help-faq details p { margin: 0 0 16px; color: var(--ink-2); line-height: 1.6; }
.help-none { color: var(--ink-3); }
@media (max-width: 760px) { .help-topics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .help-faq { grid-template-columns: 1fr; gap: 12px; } .help-topic { padding: 18px 10px; } }
body:has(.help-hero) { overflow-x: clip; }

/* ---------- Course page explorer ---------- */
#course-map { scroll-margin-top: 88px; }
/* The course explorer: pick a part, then a unit, and its lessons show beside it. One screen, no long scroll. */
.explorer { padding: 56px 0 24px; border-top: 1px solid var(--line); margin-top: 24px; }
.ex-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ex-head h2 { margin: 0; font-size: clamp(28px, 2.6vw, 36px); }
.ex-head { align-items: center; }
.ex-tools { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; justify-content: flex-end; }
.ex-tools p { margin: 0; color: var(--ink-3); font-size: 15px; }
.ex-tools p b { color: var(--ink); }
.mp-bar { border-radius: 6px; background: color-mix(in srgb, var(--accent) 18%, transparent); overflow: hidden; }
.mp-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.ex-tools .mp-bar { width: 90px; height: 6px; margin: 0; flex: none; }
.ex-tools .btn { flex: none; }
.ex-tools .linkish { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--ink-3); text-decoration: underline; cursor: pointer; }
@media (max-width: 760px) { .ex-tools { justify-content: flex-start; } }
.ex-tabs { display: flex; gap: 6px; padding: 5px; border-radius: 99px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); overflow-x: auto; scrollbar-width: none; }
.ex-tabs::-webkit-scrollbar { display: none; }
.ex-tab { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 14px; border: 0; border-radius: 99px; background: none; color: var(--ink-2); font: inherit; font-size: 15px; font-weight: 600; white-space: nowrap; cursor: pointer; scroll-margin-top: 96px; transition: background .25s var(--ease), color .25s, box-shadow .25s; }
.ex-tab b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; box-shadow: inset 0 0 0 1.5px currentColor; }
.ex-tab small { display: none; }
.ex-tab:hover { color: var(--ink); }
.ex-tab[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 6px 16px -10px rgba(0,0,0,.35), inset 0 0 0 1px var(--line); }
.ex-tab[aria-selected="true"] b { background: var(--accent); color: var(--on-color); box-shadow: none; }
.ex-body { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 28px; margin-top: 24px; align-items: start; }
.ex-units { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.unit { display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border: 0; border-radius: 14px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .2s, box-shadow .2s, opacity .2s; }
.unit .n { grid-row: span 3; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 16px; box-shadow: inset 0 0 0 2px var(--line); color: var(--ink-3); }
.unit.live .n { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.unit h3 { margin: 0; font-family: var(--sans); font-size: 15.5px; font-weight: 600; line-height: 1.3; color: var(--ink-2); }
.unit.live h3 { color: var(--ink); }
.unit p { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.unit .bar { grid-column: 2; height: 4px; margin-top: 7px; border-radius: 4px; background: var(--line); overflow: hidden; }
.unit .bar i { display: block; height: 100%; width: var(--p, 0%); background: var(--accent); border-radius: inherit; transition: width .6s var(--ease); }
.unit:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.unit[aria-selected="true"] { background: var(--card); box-shadow: inset 0 0 0 1.5px var(--accent), var(--shadow); opacity: 1; }
.unit[aria-selected="true"] .n { background: var(--accent); color: var(--on-color); box-shadow: none; }
.unit .path-tag { display: inline-block; vertical-align: 1px; margin-left: 6px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; padding: 3px 7px; border-radius: 99px; background: var(--paper-2); color: var(--ink-3); }
.unit.known .path-tag { background: var(--accent-soft); color: var(--accent); }
.unit .pd { grid-column: 2; margin-top: 3px; font-size: 12px; font-weight: 600; color: var(--accent); }
.unit .pd::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.ex-lessons { min-width: 0; }
.ex-group[hidden] { display: none; }
.ex-group { animation: ex-in .35s var(--ease); }
@keyframes ex-in { from { opacity: 0; transform: translateY(8px); } }
.ex-group .kicker { margin: 4px 0 4px; color: var(--accent); }
.ex-group h3 { margin: 0 0 4px; font-size: clamp(24px, 2.4vw, 30px); }
.ex-group > p { margin: 0 0 16px; color: var(--ink-3); font-size: 15px; }
.ex-ls { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.ex-ls a, .ex-ls .soon { display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; height: 100%; box-sizing: border-box; padding: 14px 16px 14px 12px; border-radius: 16px; color: inherit; text-decoration: none; }
.ex-ls a { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s, transform .2s var(--ease); }
.ex-ls a:hover { box-shadow: inset 0 0 0 1.5px var(--accent), var(--shadow); transform: translateY(-2px); }
.ex-ls .soon { box-shadow: inset 0 0 0 1px var(--line); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent); }
.ex-ls .dot { grid-row: span 2; width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; box-shadow: inset 0 0 0 2px var(--accent); }
.ex-ls .done .dot { background: var(--accent); box-shadow: none; }
.ex-ls .soon .dot { box-shadow: inset 0 0 0 2px var(--line); }
.ex-ls b { font-family: var(--serif); font-weight: 500; font-size: 18px; line-height: 1.25; color: var(--ink); }
.ex-ls .soon b { color: var(--ink-3); }
.ex-ls small { color: var(--ink-3); font-size: 13.5px; line-height: 1.4; margin-top: 3px; }
.ex-ls .on-path { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.ex-ls .is-next { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
.ex-ls .pt { grid-column: 2; justify-self: start; margin-top: 8px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.ex-ls .is-next .pt { background: var(--accent); color: var(--on-color); }
.ex-empty { padding: 28px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); }

@media (max-width: 760px) {
  /* Phones: units become a swipeable strip, and the chosen unit's lessons sit right under it. */
.ex-body { grid-template-columns: 1fr; gap: 18px; }
.ex-units { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -16px; padding: 4px 16px; }
.ex-units li { flex: 0 0 74%; scroll-snap-align: start; }
.unit { height: 100%; background: var(--paper-2); }
.ex-ls { grid-template-columns: 1fr; }
}
.course-page .explorer { border-top: 0; margin-top: 0; padding-top: clamp(24px, 4vw, 48px); padding-bottom: 72px; }
.ex-head h1 { margin: 0; font-size: clamp(32px, 3.4vw, 44px); }

/* Footer language picker, bottom left (like Figma's). */
.lang-pick { position: absolute; left: clamp(20px, 3vw, 48px); bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px)); display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; margin-left: -10px; border-radius: 10px; color: var(--ink); font-size: 15px; font-weight: 500; cursor: pointer; transition: background .2s; }
.lang-pick:hover, .lang-pick:focus-within { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.lang-pick svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lang-pick .caret { width: 15px; height: 15px; stroke-width: 2; margin-left: -4px; pointer-events: none; }
.lang-pick select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit; padding: 0 18px 0 0; margin-right: -18px; cursor: pointer; }
.lang-pick select:focus { outline: none; }
.lang-pick select option { color: #1f1e1a; background: #fff; }
@media (max-width: 760px) { .lang-pick { position: static; justify-self: center; margin: 0; } }

/* ---------- Lessons: one section at a time ---------- */
body.paged main .chapter:not(.pg-on) { display: none; }
body.paged main .chapter.tint { margin: 0; }
body.paged main .chapter.tint::before, body.paged main .chapter.tint::after { display: none; }
body.paged main .chapter { padding: 40px 0 32px; min-height: calc(100svh - 64px); box-sizing: border-box; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager .pg-back { justify-self: start; }
.pager .pg-next { justify-self: end; }
.pager .pg-count { font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: .06em; }
@media (max-width: 640px) {
  .pager .btn { font-size: 14px; padding-left: 14px; padding-right: 14px; }
}
.chapter h3[style*="margin-top"] { margin-top: 32px !important; }
.chapter > .wrap > svg[viewBox], .chapter > .wrap > figure > svg[viewBox] { max-height: 56svh; }

/* "In this example" beside the text it explains. */
.ex-pair { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(250px, 1fr); gap: 14px 32px; align-items: start; margin: 0 0 28px; }
.ex-pair > :not(.in-example) { grid-column: 1; margin-top: 0; }
.ex-pair > .lead { max-width: none; }
.ex-pair > .in-example { grid-column: 2; grid-row: 1 / span 3; margin: 0; padding: 18px 20px; border-left: 0; border-radius: 22px;
  background: color-mix(in srgb, var(--accent) 8%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, var(--line)), var(--shadow, none); }
.ex-pair > .in-example dl { gap: 12px; }
.ex-pair > .in-example dl > div { grid-template-columns: 1fr; gap: 2px; }
.ex-pair > .in-example dl > div + div { padding-top: 12px; border-top: 1px dashed color-mix(in srgb, var(--accent) 25%, var(--line)); }
.ex-pair > .in-example dt { font-size: 15px; }
.ex-pair > .in-example dd { font-size: 15.5px; line-height: 1.5; }
@media (max-width: 860px) { .ex-pair { grid-template-columns: 1fr; } .ex-pair > .in-example { grid-column: 1; grid-row: auto; } }

body.paged .rail { display: none !important; }
.pg-steps { display: grid; justify-items: center; gap: 8px; }
.pg-dots { display: flex; align-items: center; }
.pg-dot { position: relative; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; }
.pg-dot + .pg-dot::before { content: ""; position: absolute; right: 100%; top: 50%; width: 10px; height: 2px; margin-top: -1px; background: var(--line); }
.pg-dot i { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); opacity: .55; transition: transform .2s var(--ease), background .2s, opacity .2s; }
.pg-dot.seen i { background: var(--accent); opacity: .6; }
.pg-dot.on i { width: 14px; height: 14px; background: var(--accent); opacity: 1; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.pg-dot:hover i { transform: scale(1.3); opacity: 1; }
.pg-dot:focus-visible { outline: 2px solid var(--accent); border-radius: 50%; }
.pg-dots + .pg-name { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.pg-name small { color: var(--ink-3); font-weight: 500; }
.pg-dots .pg-dot { margin-left: 10px; }
.pg-dots .pg-dot:first-child { margin-left: 0; }
@media (max-width: 640px) {
  .pager { grid-template-columns: 1fr 1fr; }
  .pager .pg-steps { grid-column: 1 / -1; grid-row: 1; margin-bottom: 4px; }
  .pg-dots .pg-dot { margin-left: 2px; width: 22px; }
  .pg-dot + .pg-dot::before { width: 4px; }
}
.pager .btn { white-space: nowrap; }
@media (max-width: 640px) { .pager .pg-label { display: none; } }
/* Your path: the whole course as numbered squares, 10 to a row like a page of a book. */
.my-path { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(10, minmax(0, 52px)); gap: 8px; }
.my-path a, .my-path span { display: grid; place-items: center; aspect-ratio: 1; border-radius: 12px; font-family: var(--serif); font-size: 18px; text-decoration: none; transition: transform .2s var(--ease), box-shadow .2s; cursor: pointer; }
.my-path .on > * { background: var(--accent); color: var(--on-color); }
.my-path .known > * { background: var(--accent-soft); color: var(--accent); }
.my-path .off > * { background: var(--paper-2); color: var(--ink-3); }
.my-path .soon > * { opacity: .55; }
.my-path .next > * { opacity: 1; box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px #e0b24a; }
.my-path a:hover, .my-path a:focus-visible, .my-path span:hover, .my-path span:focus-visible { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--ink); outline: none; }
.path-pick { min-height: 3em; margin: 16px 0 4px; font-size: 16px; }
.path-pick b { font-family: var(--serif); font-weight: 500; color: var(--accent); margin-right: 4px; }
.path-pick small { display: block; color: var(--ink-3); font-size: 14px; }
.path-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13.5px; color: var(--ink-3); margin: 0 0 8px; }
.path-key .k { width: 14px; height: 14px; border-radius: 4px; margin-left: 6px; }
.path-key .k:first-child { margin-left: 0; }
.path-key .on { background: var(--accent); } .path-key .known { background: var(--accent-soft); } .path-key .off { background: var(--paper-2); }
@media (max-width: 560px) { .my-path { gap: 5px; } .my-path a, .my-path span { font-size: 14px; border-radius: 8px; } }

.ex-ls .ln { margin-right: 8px; font-family: var(--sans); font-size: .78em; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
/* With a path set: units on the path get a green outlined number (filled once all its lessons are done), the rest are grayed out. The open unit gets a bold border. */
.unit[aria-selected="true"] { box-shadow: inset 0 0 0 2.5px var(--accent), var(--shadow); }
.path-set .unit[aria-selected="true"] .n { background: none; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.path-set .unit.on-path .n { background: none; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.path-set .unit.on-path h3 { color: var(--ink); }
.path-set .unit.on-path.all-done .n { background: var(--accent); color: var(--on-color); box-shadow: none; }
.path-set .unit.off-path { opacity: .4; }
.path-set .unit.off-path .n { box-shadow: inset 0 0 0 2px var(--line); color: var(--ink-3); }
.path-set .unit.off-path:hover { opacity: .75; }
.unit .n { grid-row: span 5; }
.unit .path-tag { grid-column: 2; justify-self: start; margin: 4px 0 1px; }
.course-page .ex-head { flex-direction: column; align-items: flex-start; } .course-page .ex-tools { justify-content: flex-start; }
/* Pager: step dots centered on their own row, Back on the left and Next on the right underneath. */
.pager { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; row-gap: 18px; }
.pager .pg-steps { grid-column: 1 / -1; grid-row: 1; }
.pager .pg-back { grid-column: 1; grid-row: 2; }
.pager .pg-next { grid-column: 2; grid-row: 2; }
/* Hovering a dot drops a little label with that step's name. */
.pg-tip { position: absolute; top: 100%; left: 50%; z-index: 5; margin-top: 4px; padding: 5px 10px; border-radius: 8px; background: var(--ink); color: var(--paper); font-size: 12.5px; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, -6px); transition: opacity .18s, transform .22s var(--ease); }
.pg-tip::before { content: ""; position: absolute; bottom: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-bottom-color: var(--ink); }
.pg-dot:hover .pg-tip, .pg-dot:focus-visible .pg-tip { opacity: 1; transform: translate(-50%, 0); }
.pg-name { transition: opacity .15s; } .pg-steps:has(.pg-dot:hover) .pg-name { opacity: 0; }

/* ---------- Certifications page ---------- */
/* Jobs on the left; the chosen job's four-stage road, tiles for each certificate, and the picked one's details on the right. */
.cert-page .cx { padding: clamp(24px, 4vw, 48px) 0 56px; }
.cx-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px 32px; flex-wrap: wrap; margin-bottom: 24px; }
.cx-head h1 { margin: 0 0 6px; font-size: clamp(32px, 3.4vw, 44px); }
.cx-head p { margin: 0; max-width: 40em; color: var(--ink-2); font-size: 16.5px; }
.cx-me { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 99px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.cx-me span { padding: 0 8px 0 10px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.cx-me button { border: 0; border-radius: 99px; padding: 8px 13px; background: none; color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .25s var(--ease), color .25s, box-shadow .25s; }
.cx-me button:hover { color: var(--ink); }
.cx-me button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 6px 16px -10px rgba(0,0,0,.35), inset 0 0 0 1px var(--line); }
.cx-body { display: grid; grid-template-columns: minmax(200px, 250px) minmax(0, 1fr); gap: 32px; align-items: start; }
.cx-jobs { list-style: none; margin: 0; padding: 0; position: sticky; top: 84px; }
.cx-group { margin: 14px 0 4px 12px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); }
.cx-group:first-child { margin-top: 0; }
.cx-group:empty { height: 1px; margin: 12px 12px 8px; background: var(--line); }
.cx-job { display: block; width: 100%; padding: 7px 12px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); font: inherit; font-size: 15px; font-weight: 500; line-height: 1.3; text-align: left; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; }
.cx-job:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); color: var(--ink); }
.cx-job[aria-selected="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px var(--line); }
.cx-all { color: var(--accent); font-weight: 600; }
.cx-panel { min-width: 0; }
.cx-pane { animation: ex-in .35s var(--ease); }
.cx-pane > .kicker { margin: 0 0 4px; color: var(--accent); }
.cx-pane > h2 { margin: 0 0 6px; font-size: clamp(26px, 2.6vw, 34px); }
.cx-does { margin: 0 0 20px; max-width: 46em; color: var(--ink-2); font-size: 16px; }
/* The road: four stages joined by a line, the learner's stage tinted. */
.cx-road { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; position: relative; }
.cx-stage { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px 12px; border-radius: 18px; transition: background .3s var(--ease), box-shadow .3s; }
.cx-stage.here { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent); }
.cx-s-head { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.cx-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 15px; background: var(--paper); box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); position: relative; z-index: 1; }
.here .cx-n { background: var(--accent); color: var(--on-color); box-shadow: none; }
.cx-stage:not(:last-child)::before { content: ""; position: absolute; left: 50px; right: -16px; top: 28px; height: 2px; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 11px); opacity: .45; }
.cx-s-head b { display: block; font-size: 14.5px; line-height: 1.3; }
.cx-s-head small { display: block; font-size: 12.5px; line-height: 1.35; color: var(--ink-3); margin-top: 2px; }
.cx-s-head em { margin-top: -2px; font-style: normal; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--accent); color: var(--on-color); }
.cx-tiles { display: grid; gap: 8px; }
.cx-tile { display: grid; gap: 2px; width: 100%; padding: 11px 12px; border: 0; border-radius: 14px; background: var(--card); color: inherit; font: inherit; text-align: left; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s, transform .2s var(--ease); }
.cx-tile:hover { box-shadow: inset 0 0 0 1.5px var(--accent), var(--shadow); transform: translateY(-2px); }
.cx-tile[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
.cx-tile b { font-family: var(--serif); font-weight: 500; font-size: 18px; line-height: 1.2; }
.cx-tile small { font-size: 12.5px; line-height: 1.35; color: var(--ink-3); }
.cx-tile .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cx-tile .tags:empty { display: none; }
.cx-tile i { font-style: normal; font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: var(--paper-2); color: var(--ink-2); }
.cx-tile .t-must { background: var(--ink); color: var(--paper); }
.cx-tile .t-free { background: var(--accent-soft); color: var(--accent); }
.cx-none { margin: 0; padding: 10px 12px; border-radius: 14px; font-size: 13px; line-height: 1.4; color: var(--ink-3); box-shadow: inset 0 0 0 1px dashed; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent); }
.cx-tip { display: flex; gap: 12px; align-items: baseline; margin: 18px 0; padding: 12px 16px; border-radius: 14px; background: var(--paper-2); font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.cx-tip b { flex: none; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--wants); }
/* The picked certificate. */
.cx-detail { padding: 20px 22px; border-radius: 22px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); animation: ex-in .3s var(--ease); }
.cx-d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.cx-d-head .kicker { margin: 0 0 2px; color: var(--accent); }
.cx-d-head h3 { margin: 0; font-size: clamp(21px, 2vw, 26px); }
.cx-d-head .btn { flex: none; }
.cx-what { margin: 10px 0 14px; font-size: 16px; color: var(--ink-2); }
.cx-detail dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 20px; margin: 0; }
.cx-detail dl div { padding-top: 10px; border-top: 1px solid var(--line); }
.cx-detail dt { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); }
.cx-detail dd { margin: 3px 0 0; font-size: 14.5px; line-height: 1.45; }
.cx-units { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 16px 0 0; font-size: 13.5px; }
.cx-units span { color: var(--ink-3); margin-right: 4px; }
.cx-units a { padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; text-decoration: none; }
.cx-units a:hover { background: var(--accent); color: var(--on-color); }
/* All certificates in one table. */
.cx-scroll { overflow-x: auto; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line); background: var(--card); }
.cx-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.45; margin: 0; }
.cx-table th, .cx-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.cx-table thead th { position: sticky; top: 0; background: var(--paper-2); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.cx-table tbody th { min-width: 150px; }
.cx-table tbody th a { font-family: var(--serif); font-weight: 500; font-size: 16px; color: var(--ink); text-decoration: none; }
.cx-table tbody th a:hover { color: var(--accent); }
.cx-table small { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-3); }
.cx-table tr.free th { box-shadow: inset 3px 0 0 var(--accent); }
.cx-table td:nth-child(2) { min-width: 170px; }
.cx-table td:last-child a { color: var(--ink-2); }
.cx-table tbody tr:last-child > * { border-bottom: 0; }
.cx-foot { margin: 28px 0 0; font-size: 13.5px; color: var(--ink-3); max-width: 60em; }
@media (max-width: 1100px) {
  .cx-road { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cx-stage:nth-child(2)::before { display: none; }
}
@media (max-width: 760px) {
  /* Phones: jobs become a swipeable strip; the road becomes a vertical timeline. */
  .cx-body { grid-template-columns: 1fr; gap: 18px; }
  .cx-jobs { position: static; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 4px 16px; }
  .cx-jobs::-webkit-scrollbar { display: none; }
  .cx-group { display: none; }
  .cx-job { white-space: nowrap; padding: 9px 14px; border-radius: 99px; background: var(--paper-2); }
  .cx-job[aria-selected="true"] { box-shadow: inset 0 0 0 1.5px var(--accent); }
  .cx-me { border-radius: 18px; }
  .cx-me span { width: 100%; padding: 4px 8px 0; }
  .cx-road { grid-template-columns: 1fr; gap: 4px; }
  .cx-stage { padding: 12px; }
  .cx-stage::before { display: none; }
  .cx-s-head { display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; }
  .cx-s-head em { grid-column: 2; }
  .cx-stage:not(:last-child)::after { content: ""; position: absolute; left: 26px; top: 46px; bottom: -6px; width: 2px; background: repeating-linear-gradient(180deg, var(--accent) 0 6px, transparent 6px 11px); opacity: .45; }
  .cx-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 40px; }
  .cx-none { grid-column: 1 / -1; }
  .cx-tip { flex-direction: column; gap: 4px; }
  .cx-d-head { flex-direction: column; gap: 10px; }
  .cx-detail { padding: 18px; }
}
.ex-certs { display: inline-block; margin-top: 6px; font-size: 14.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.ex-certs:hover { text-decoration: underline; }
.cx-kinds { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 5px; margin: 0 0 14px; border-radius: 99px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.cx-kinds button { border: 0; border-radius: 99px; padding: 8px 14px; background: none; color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.cx-kinds button small { margin-left: 4px; font-size: 12px; color: var(--ink-3); }
.cx-kinds button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 6px 16px -10px rgba(0,0,0,.35), inset 0 0 0 1px var(--line); }
.cx-table td:nth-child(3) { min-width: 120px; }
@media (max-width: 760px) { .cx-kinds { border-radius: 18px; } }
/* Social links: centered between the disclaimer and the copyright. */
.socials { display: flex; justify-content: center; gap: 6px; margin: -8px 0 -6px; }
.socials a { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--ink-2); transition: background .2s, color .2s; }
.socials a:hover, .socials a:focus-visible { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.socials svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* The plain "Ver en español" link is swapped for the language picker by site.js; keep it hidden so it doesn't flash on load. */
.foot-lang { visibility: hidden; }
/* Setup goals: two groups of compact cards; the square tick says "pick as many as you like". */
#goal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.goal-group { grid-column: 1 / -1; margin: 14px 0 0; font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.goal-group:first-child { margin-top: 0; }
#goal-grid .goal-card { padding: 16px 16px 14px; gap: 4px; border-radius: 16px; }
#goal-grid .goal-card svg { width: 24px; height: 24px; margin-bottom: 4px; }
#goal-grid .goal-card b { font-size: 17.5px; }
#goal-grid .goal-card small { font-size: 13.5px; }
#goal-grid .goal-card .units { margin-top: 4px; font-size: 11px; }
#goal-grid .goal-card .tick { top: 14px; right: 14px; width: 20px; height: 20px; border-radius: 6px; }
#goal-grid .goal-card.on .tick { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 14px no-repeat; box-shadow: none; }
.goal-count { margin-left: auto; margin-right: 14px; font-size: 14px; font-weight: 600; color: var(--accent); }
@media (max-width: 900px) { #goal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { #goal-grid { grid-template-columns: 1fr; } }
#goal-grid .goal-card { display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; row-gap: 3px; align-content: start; padding: 14px 40px 12px 14px; }
#goal-grid .goal-card svg { width: 22px; height: 22px; margin: 1px 0 0; }
#goal-grid .goal-card b { padding-right: 0; }
#goal-grid .goal-card small, #goal-grid .goal-card .units { grid-column: 2; }
#goal-grid .goal-card .tick { top: 12px; right: 12px; }
@media (max-width: 520px) { #goal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } #goal-grid .goal-card { grid-template-columns: 1fr; padding: 12px 34px 10px 12px; } #goal-grid .goal-card small { display: none; } #goal-grid .goal-card .units { grid-column: 1; } #goal-grid .goal-card b { font-size: 16px; } }

/* ---------- Continue with Google ---------- */
.oauth { margin-top: 22px; }
.oauth.off { display: none; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 99px; padding: 12px 20px; min-height: 48px; cursor: pointer;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.btn-google svg { width: 20px; height: 20px; flex: none; }
.btn-google:hover { border-color: var(--ink-3); box-shadow: 0 6px 18px -10px rgba(60, 40, 20, .35); transform: translateY(-1px); }
.btn-google:active { transform: scale(.98); }
.btn-google:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.oauth .or { display: flex; align-items: center; gap: 14px; margin: 20px 0 0; color: var(--ink-3); font-size: 14px; }
.oauth .or::before, .oauth .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.oauth + .auth-form { margin-top: 16px; }
/* Account page has two views: Settings (default) and Profile (#profile: avatar, name, progress). */
#acct-in:not(.is-profile) .view-profile, #acct-in.is-profile .view-settings { display: none; }
.set-head.view-settings { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.profile-view { display: grid; gap: 16px; max-width: 760px; }
.prof-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.prof-avatar { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--on-color); font-family: var(--serif); font-size: 32px; flex: none; }
.prof-card h1 { margin: 0 0 2px; font-size: clamp(30px, 3vw, 40px); }
.prof-card p { margin: 0; }
.prof-set { margin-left: auto; }
a.acct-who { color: inherit; text-decoration: none; border-radius: 10px; }
a.acct-who:hover, a.acct-who:focus-visible { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.set-grid > .set-card { margin-top: 0; }
