/* Helm · Skylearn. See docs/skylearn-DESIGN.md for the source system. */
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/static/fonts/atkinson-regular.woff2") format("woff2");
  font-style: normal; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/static/fonts/atkinson-bold.woff2") format("woff2");
  font-style: normal; font-weight: 700; font-display: swap;
}
@font-face {
  font-family: "Hubot Sans";
  src: url("/static/fonts/hubot-sans.woff2") format("woff2");
  font-style: normal; font-weight: 100 900; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono.woff2") format("woff2");
  font-style: normal; font-weight: 100 800; font-display: swap;
}
:root {
  color-scheme: light;
  --sky: #3b82f6;
  --sky-bright: #60a5fa;
  --sky-deep: #1d4ed8;
  --sky-soft: #dbeafe;
  --sun: #fbbf24;
  --sun-bright: #fcd34d;
  --sun-deep: #d97706;
  --leaf: #22c55e;
  --leaf-soft: #dcfce7;
  --leaf-deep: #16a34a;
  --coral: #f87171;
  --coral-soft: #fee2e2;
  --berry: #a855f7;
  --berry-soft: #f3e8ff;
  --background: #fff;
  --surface: #f8fafc;
  --surface-elevated: #fff;
  --surface-sunken: #f1f5f9;
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-subtle: #94a3b8;
  --ink-faint: #cbd5e1;
  --outline: #e2e8f0;
  --outline-strong: #94a3b8;
  --action: #3b82f6;
  --action-hover: #1d4ed8;
  --on-action: #fff;
  --on-accent: #fff;
  --on-success: #fff;
  --sky-outline: #bfdbfe;
  --berry-outline: #e9d5ff;
  --sun-soft: #fffbeb;
  --sound-halo: rgb(255 255 255 / 50%);
  --ruler-wash: rgb(59 130 246 / 14%);
  --ruler-outline: rgb(29 78 216 / 45%);
  --body: "Atkinson Hyperlegible", "Nunito Sans", sans-serif;
  --display: "Hubot Sans", "Nunito", sans-serif;
  --mono: "JetBrains Mono", monospace;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --shadow: 0 8px 24px rgb(15 23 42 / 6%);
  --active-shadow: 0 12px 32px rgb(59 130 246 / 15%);
  --sidebar-width: 264px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #0b1220;
  --surface: #101d30;
  --surface-elevated: #15243a;
  --surface-sunken: #0c1829;
  --ink: #edf4ff;
  --ink-muted: #b3c4d9;
  --ink-subtle: #a0b4cb;
  --ink-faint: #6f88a6;
  --outline: #30445e;
  --outline-strong: #6f88a6;
  --sky: #60a5fa;
  --sky-bright: #bfdbfe;
  --sky-deep: #93c5fd;
  --sky-soft: #183453;
  --sky-outline: #365a84;
  --sun-deep: #fcd34d;
  --sun-soft: #342b18;
  --leaf: #4ade80;
  --leaf-soft: #16382d;
  --leaf-deep: #4ade80;
  --coral: #fda4af;
  --coral-soft: #402732;
  --berry: #c084fc;
  --berry-soft: #2b2144;
  --berry-outline: #6e4a92;
  --action: #60a5fa;
  --action-hover: #93c5fd;
  --on-action: #081629;
  --on-accent: #081629;
  --on-success: #062216;
  --sound-halo: rgb(192 132 252 / 12%);
  --ruler-wash: rgb(147 197 253 / 14%);
  --ruler-outline: rgb(147 197 253 / 60%);
  --shadow: 0 8px 24px rgb(0 0 0 / 20%);
  --active-shadow: 0 12px 32px rgb(0 0 0 / 24%);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0; background: var(--background); color: var(--ink);
  font: 18px/1.56 var(--body); letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; letter-spacing: inherit; color: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button { border: 0; }
button:disabled { cursor: wait; opacity: .65; }
svg { display: block; }
img { max-width: 100%; }
form { margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -.035em; }
h1 { font-size: 40px; line-height: 1.2; }
h2 { font-size: 32px; line-height: 1.25; }
h3 { font-size: 24px; line-height: 1.33; font-weight: 600; }
p { line-height: 1.6; }
small { font-size: 16px; }
strong { font-weight: 700; }
:where(button, a, input, select, summary):focus-visible {
  outline: 3px solid var(--sky-deep); outline-offset: 4px;
}
main:focus, .challenge:focus { outline: none; }
::selection { background: var(--sky-soft); color: var(--ink); }
.icon { height: 24px; width: 24px; flex: 0 0 24px; }
.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
.skip-link { position: fixed; top: 12px; left: 20px; z-index: 100; padding: 16px 24px; border-radius: 16px; background: var(--sky-deep); color: var(--on-accent); clip-path: inset(100%); }
.skip-link:focus { clip-path: none; }
.muted, .tiny, .subtle-label { color: var(--ink-muted); }
.tiny, .subtle-label { font-size: 16px; line-height: 1.5; }
.eyebrow { font-size: 16px; font-weight: 700; letter-spacing: .055em; line-height: 1.5; color: var(--sky-deep); }
.eyebrow .icon { display: inline-block; vertical-align: middle; margin-right: 8px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 16px;
  min-height: 64px; padding: 16px 32px; border: 1px solid transparent; border-radius: 16px;
  font-size: 20px; font-weight: 700; line-height: 1.4; text-align: center;
  transition: background 240ms, transform 240ms var(--spring), box-shadow 240ms;
}
.button:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.button:active { transform: scale(.97); transition-duration: 120ms; }
.button-primary { background: var(--action); color: var(--on-action); }
.button-primary:hover { background: var(--action-hover); box-shadow: inset 0 -2px var(--sky-bright), var(--active-shadow); }
.button-outline { background: var(--surface-elevated); color: var(--sky-deep); border-color: var(--outline-strong); }
.button-outline:hover { background: var(--sky-soft); border-color: var(--sky); }
.button-success { background: var(--leaf-soft); color: var(--ink); border: 2px solid var(--leaf-deep); }
.button-success:hover { background: var(--leaf); color: #062216; }
.button-full { width: 100%; }
.icon-button { display: grid; place-items: center; height: 56px; width: 56px; padding: 12px; border: 1px solid var(--outline); border-radius: 16px; background: var(--background); }
.text-link { display: inline-flex; align-items: center; gap: 12px; min-height: 56px; color: var(--sky-deep); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.text-link:hover { text-decoration-thickness: 2px; }
.pill, .edition-tag, .rule-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; color: var(--sky-deep); background: var(--sky-soft); font-size: 16px; font-weight: 700; }
.status-dot, .live-dot { display: inline-block; width: 8px; height: 8px; background: var(--leaf-deep); border-radius: 50%; flex-shrink: 0; }
.live-dot { margin-right: 8px; }
.panel { background: var(--surface-elevated); border: 1px solid var(--outline); border-radius: 20px; padding: 32px; }
.text-input, select, .search-input {
  min-height: 64px; padding: 16px 20px; border: 1px solid var(--outline-strong); border-radius: 12px;
  font-size: 18px; background: var(--surface); max-width: 100%; min-width: 0;
}
.text-input:focus, select:focus, .search-input:focus-within { outline: 0; border-color: var(--sky-deep); box-shadow: 0 0 0 4px var(--sky-soft); }
input::placeholder { color: var(--ink-muted); opacity: 1; }
select { cursor: pointer; padding-right: 28px; }
.field-label { display: block; font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.form-error { padding: 16px; background: var(--coral-soft); border: 2px solid var(--coral); border-radius: 12px; margin-bottom: 24px; }

/* Navigation, shared chrome, and reading controls. */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--outline); padding: 32px 20px 20px; z-index: 30;
  overflow-y: auto;
}
.brand { display: inline-flex; align-items: center; gap: 4px; width: fit-content; min-height: 64px; font-family: var(--display); font-size: 44px; font-weight: 850; line-height: 1; letter-spacing: -.075em; }
.brand-mark { width: 64px; height: 64px; flex-shrink: 0; transition: transform 240ms var(--spring); }
.brand-wordmark { display: block; padding-right: 8px; font-style: italic; transform: rotate(-5deg); text-shadow: 2px 3px 0 var(--sky-soft); }
.brand-dot { color: var(--sky-deep); }
.brand:hover .brand-mark { transform: rotate(-8deg); }
.sidebar .brand { padding-left: 0; }
.sidebar-caption { font-size: 16px; color: var(--ink-muted); margin: 12px 0 40px 12px; letter-spacing: .025em; }
.nav-label { color: var(--ink-muted); font-size: 16px; font-weight: 700; margin: 0 12px 16px; }
.primary-nav { display: grid; gap: 8px; }
.nav-link { min-height: 64px; display: flex; gap: 12px; align-items: center; border-radius: 16px; padding: 16px 12px; font-size: 18px; color: var(--ink-muted); transition: background 240ms; }
.nav-link:hover { background: var(--surface-sunken); color: var(--ink); }
.nav-link.active { background: var(--sky-soft); color: var(--sky-deep); font-weight: 700; box-shadow: inset 3px 0 var(--sky); }
.nav-link .icon { color: var(--sky); }
.nav-link.active .icon { color: var(--sky-deep); }
.nav-dot { display: none; }
.sidebar-bottom { margin-top: auto; padding-top: 32px; }
.sidebar-note { border: 1px solid var(--outline); background: var(--background); border-radius: 20px; padding: 24px 16px; margin-bottom: 24px; }
.sidebar-note > .icon { color: var(--sky); margin-bottom: 12px; width: 32px; height: 32px; }
.sidebar-note p { font-size: 16px; color: var(--ink-muted); line-height: 1.5; margin-bottom: 12px; }
.sidebar-note p strong { color: var(--ink); font-weight: 400; }
.sidebar-note .tiny { color: var(--sky-deep); }
.captain-link { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--outline); padding-top: 20px; min-height: 80px; }
.captain-link img { width: 56px; height: 56px; object-fit: cover; background: var(--sky-soft); border-radius: 50%; border: 3px solid white; outline: 2px solid var(--sky); }
.captain-link > span { min-width: 0; flex: 1; }
.captain-link strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.captain-link small { display: block; color: var(--ink-muted); font-size: 16px; }
.captain-link > .icon { width: 20px; height: 20px; flex-basis: 20px; color: var(--sky-deep); }
.workspace { margin-left: var(--sidebar-width); min-width: 0; width: calc(100% - var(--sidebar-width)); display: flex; flex-direction: column; }
.topbar { min-height: 96px; padding: 16px 32px; border-bottom: 1px solid var(--outline); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.breadcrumb { color: var(--ink-muted); font-size: 16px; display: flex; align-items: center; gap: 12px; }
.breadcrumb > span { color: var(--outline-strong); }
.breadcrumb strong { color: var(--ink); text-transform: capitalize; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 20px; }
.topbar .edition-tag { background: transparent; padding: 0; color: var(--ink-muted); white-space: nowrap; }
.topbar-divider { width: 1px; height: 32px; background: var(--outline); }
.xp-top, .nav-streak { display: flex; align-items: center; gap: 8px; font-size: 16px; white-space: nowrap; }
.xp-top .icon, .nav-streak .icon { color: var(--sun-deep); fill: var(--sun); stroke-width: 1.5; }
.xp-top strong, .nav-streak strong { font-family: var(--mono); font-size: 18px; }
.mobile-menu { display: none; }
.main-content { width: 100%; max-width: 1328px; padding: 40px 32px 64px; margin: 0 auto; flex: 1; }
.app-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px 24px; border-top: 1px solid var(--outline); padding: 20px 32px; color: var(--ink-muted); font-size: 16px; }
.app-footer a { min-height: 56px; display: inline-flex; gap: 8px; align-items: center; color: var(--sky-deep); }
.app-footer > span:last-child { display: none; }
.reading-settings { position: relative; flex-shrink: 0; }
.theme-toggle { color: var(--sky-deep); flex-shrink: 0; }
.theme-toggle:hover { background: var(--sky-soft); border-color: var(--sky); }
.theme-sun { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
[data-theme="dark"] .theme-moon { display: none; }
.reading-settings > summary { min-height: 56px; display: flex; gap: 8px; align-items: center; border: 1px solid var(--outline); border-radius: 16px; padding: 12px 16px; font-size: 16px; font-weight: 700; color: var(--sky-deep); list-style: none; background: var(--background); }
.reading-settings > summary::-webkit-details-marker, details > summary::-webkit-details-marker { display: none; }
.reading-settings[open] > summary { background: var(--sky-soft); border-color: var(--sky); }
.settings-panel { position: absolute; top: calc(100% + 12px); right: 0; z-index: 50; width: 344px; max-width: calc(100vw - 40px); max-height: min(640px, calc(100dvh - 120px)); overflow-y: auto; overscroll-behavior: contain; background: var(--surface-elevated); padding: 24px; border: 1px solid var(--outline); border-radius: 28px; box-shadow: 0 24px 48px rgb(0 0 0 / 16%); }
.settings-panel > strong { display: block; font-size: 20px; line-height: 1.4; }
.settings-panel > p { font-size: 16px; color: var(--ink-muted); margin: 8px 0 16px; }
.settings-panel label { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--outline); cursor: pointer; }
.settings-panel label small { display: block; color: var(--ink-muted); font-size: 16px; }
.settings-panel input[type="checkbox"] { appearance: none; border: 2px solid var(--outline-strong); border-radius: 999px; width: 48px; height: 28px; flex: 0 0 48px; background: var(--surface-sunken); position: relative; cursor: pointer; }
.settings-panel input[type="checkbox"]::after { content: ""; display: block; position: absolute; left: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-muted); transition: transform 240ms var(--spring); }
.settings-panel input[type="checkbox"]:checked { background: var(--sky-deep); border-color: var(--sky-deep); }
.settings-panel input[type="checkbox"]:checked::after { background: var(--on-accent); transform: translateX(20px); }
.settings-panel .settings-note { margin-bottom: 0; padding-top: 16px; border-top: 1px solid var(--outline); }
.appearance-settings { padding: 16px 0; border-top: 1px solid var(--outline); }
.appearance-settings legend { font-weight: 700; padding: 0; }
.theme-choices { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 4px; padding: 4px; border: 1px solid var(--outline); border-radius: 16px; background: var(--surface-sunken); }
.settings-panel .theme-choice { display: grid; place-items: center; position: relative; min-height: 56px; border: 2px solid transparent; border-radius: 12px; font-size: 16px; font-weight: 700; }
.theme-choice input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.theme-choice:has(input:checked) { color: var(--sky-deep); background: var(--sky-soft); border-color: var(--sky); }
.theme-choice:has(input:focus-visible) { outline: 3px solid var(--sky-deep); outline-offset: 2px; }
.theme-help { font-size: 16px; line-height: 24px; color: var(--ink-muted); margin-top: 12px; }
.read-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 12px 20px; border-radius: 16px; font-size: 18px; font-weight: 700; background: var(--sky-soft); color: var(--sky-deep); }
.read-button:hover, .read-button[aria-pressed="true"] { background: var(--sky-deep); color: var(--on-accent); }
[data-reading] { position: relative; }
[data-ruler="true"] [data-read-text] { cursor: text; }
[data-ruler="true"] [data-read-text]:focus-visible { outline: 3px solid var(--sky-deep); outline-offset: 4px; border-radius: 4px; }
#reading-ruler { position: fixed; z-index: 60; height: 32px; background: var(--ruler-wash); border-block: 1px solid var(--ruler-outline); pointer-events: none; border-radius: 4px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 40px)); border: 2px solid var(--sky); border-radius: 20px; background: var(--surface-elevated); color: var(--ink); padding: 20px 24px; z-index: 100; box-shadow: var(--active-shadow); }

/* Arrival and captain customization. */
.welcome-page { max-width: 1328px; padding: 0 24px; margin: 0 auto; }
.welcome-header { display: flex; align-items: center; gap: 24px; min-height: 120px; }
.welcome-tagline { color: var(--ink-muted); font-size: 16px; margin-right: auto; }
.welcome-tagline strong { display: block; font-weight: 400; }
.welcome-header .edition-tag { min-height: 56px; background: transparent; padding-inline: 0; color: var(--ink-muted); font-weight: 400; }
.welcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
.welcome-story { position: sticky; top: 24px; overflow: hidden; border-radius: 28px; padding: 48px 40px 24px; background: var(--sky-soft); }
.welcome-story .eyebrow { margin-bottom: 24px; }
.welcome-story h1 { font-size: 56px; line-height: 60px; letter-spacing: -.05em; }
.welcome-story h1 > span { color: var(--sky-deep); }
.welcome-story > p { margin-top: 24px; font-size: 20px; line-height: 32px; }
.welcome-chart { margin: 12px -24px 0; }
.welcome-chart img { width: 100%; display: block; }
.story-bottom { display: flex; flex-wrap: wrap; gap: 12px 20px; padding-top: 20px; border-top: 1px solid rgb(29 78 216 / 20%); }
.story-bottom > span { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.story-bottom .icon { color: var(--sky-deep); width: 20px; height: 20px; flex-basis: 20px; }
.story-coordinates { display: none; }
.onboarding { padding: 24px 0; min-width: 0; }
.onboarding h2 { font-size: 40px; line-height: 48px; margin-top: 12px; }
.onboarding > p { margin-top: 12px; }
.captain-form { margin-top: 24px; }
.character-stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 224px; margin-bottom: 32px; background: var(--surface); border: 1px solid var(--outline); border-radius: 20px; overflow: hidden; }
.avatar-preview { position: relative; width: 120px; height: 120px; border-radius: 50%; border: 3px solid #fff; outline: 2px solid var(--sky); background: var(--sky-soft); object-fit: cover; }
.character-label { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--surface-elevated); margin-top: 16px; border-radius: 999px; font-size: 16px; color: var(--ink-muted); }
.avatar-orbit { position: absolute; width: 220px; height: 220px; border: 1px solid var(--outline); border-radius: 50%; top: -12px; left: 50%; transform: translateX(-50%); }
.orbit-two { width: 340px; height: 340px; top: -72px; }
.avatar-spark { position: absolute; font-size: 32px; color: var(--sky-bright); }
.spark-one { top: 40px; left: 20%; }
.spark-two { top: 104px; right: 18%; color: var(--berry); }
.randomize { position: absolute; right: 16px; bottom: 16px; display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid var(--outline); border-radius: 16px; background: var(--background); color: var(--sky-deep); }
.randomize:hover { background: var(--sky-soft); }
.captain-form .text-input { width: 100%; }
.preset-label { margin-top: 24px; }
.preset-label span { font-weight: 400; color: var(--ink-muted); display: block; font-size: 16px; }
.preset-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.preset { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; min-height: 96px; padding: 16px 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--outline); font-size: 16px; line-height: 24px; }
.preset .icon { color: var(--sky-deep); }
.preset:hover { border-color: var(--sky); }
.preset.selected { background: var(--sky-soft); border-color: var(--sky); box-shadow: inset 0 0 0 2px var(--sky); color: var(--sky-deep); font-weight: 700; }
.swatches { display: flex; gap: 8px; }
.swatches label { display: block; position: relative; cursor: pointer; flex-shrink: 0; }
.swatches input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.swatches label > span { display: block; width: 56px; height: 56px; border: 2px solid transparent; border-radius: 50%; padding: 8px; background: var(--surface-elevated); }
.swatches label > span::before { content: ""; display: block; width: 100%; height: 100%; background: var(--swatch); border: 1px solid rgb(15 23 42 / 20%); border-radius: 50%; }
.swatches input:checked + span { border-color: var(--sky-deep); background: var(--sky-soft); }
.swatches input:checked + span::after { content: "✓"; display: grid; place-items: center; position: absolute; right: 1px; bottom: 0; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface-elevated); color: var(--on-accent); background: var(--sky-deep); font-size: 16px; font-weight: 700; line-height: 1; }
.swatches input:focus-visible + span { outline: 3px solid var(--sky-deep); outline-offset: 3px; }
.chicken-builder .character-stage { position: relative; top: 16px; z-index: 5; height: 320px; min-height: 320px; padding: 16px 16px 52px; gap: 8px; box-shadow: var(--shadow); }
.chicken-builder[data-builder-ready] .character-stage { position: sticky; }
.chicken-builder .avatar-preview { width: 196px; height: 210px; border: 0; outline: 0; border-radius: 0; background: transparent; object-fit: contain; }
.stage-caption { position: relative; font: 700 16px/24px var(--body); letter-spacing: .06em; color: var(--ink-muted); }
.chicken-builder .character-label { position: absolute; bottom: 16px; left: 16px; margin-top: 0; padding: 4px 12px; font: 400 16px/24px var(--body); }
.chicken-builder .avatar-orbit { top: 40px; width: 240px; height: 240px; }
.chicken-builder .orbit-two { top: -20px; width: 360px; height: 360px; }
.chicken-builder .spark-one { top: 60px; left: 16%; }
.chicken-builder .spark-two { top: 150px; right: 14%; }
.chicken-builder .preset img { display: block; width: 64px; height: 68px; }
.chicken-builder .preset { min-height: 124px; padding-block: 12px; }
.captain-customization { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--outline); }
.builder-heading { margin-bottom: 20px; }
.builder-heading h3 { font-size: 24px; line-height: 32px; }
.builder-heading p { margin-top: 8px; font-size: 16px; line-height: 24px; }
.avatar-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--surface-sunken); border: 1px solid var(--outline); border-radius: 18px; }
.avatar-tabs button { min-height: 56px; border: 2px solid transparent; border-radius: 14px; color: var(--ink-muted); background: transparent; font-size: 16px; font-weight: 700; }
.avatar-tabs button:hover { color: var(--sky-deep); background: var(--surface-elevated); }
.avatar-tabs button[aria-selected="true"] { color: var(--sky-deep); background: var(--sky-soft); border-color: var(--sky); }
.avatar-panel { padding-top: 24px; }
.avatar-panel-intro { margin-bottom: 24px; font-size: 18px; line-height: 28px; color: var(--ink-muted); }
.avatar-control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
.avatar-palette { grid-column: 1 / -1; min-width: 0; }
.avatar-palette legend, .avatar-select > label { font-size: 16px; font-weight: 700; line-height: 24px; margin-bottom: 8px; }
.avatar-select > label { display: block; }
.avatar-select select { width: 100%; min-width: 0; padding-left: 12px; font-size: 16px; }
.chicken-builder .swatches { flex-wrap: wrap; gap: 8px; }
.avatar-help { color: var(--ink-muted); font-size: 16px; line-height: 24px; margin-top: 8px; }
.captain-save { margin-top: 32px; }
.chicken-builder input, .chicken-builder select, .chicken-builder .avatar-tabs, .chicken-builder .preset-row { scroll-margin-top: 360px; }
@media (max-width: 820px) {
  .chicken-builder .character-stage { top: 8px; min-height: 248px; height: 248px; padding: 12px 12px 48px; gap: 4px; margin-bottom: 24px; }
  .chicken-builder .avatar-preview { width: 146px; height: 156px; }
  .chicken-builder .avatar-orbit { top: 10px; width: 208px; height: 208px; }
  .chicken-builder .orbit-two { top: -48px; width: 324px; height: 324px; }
  .chicken-builder .spark-one { left: 12%; top: 56px; font-size: 24px; }
  .chicken-builder .spark-two { right: 10%; top: 88px; font-size: 24px; }
  .chicken-builder .randomize { right: 12px; bottom: 12px; }
  .chicken-builder .character-label { bottom: 12px; left: 12px; }
  .chicken-builder input, .chicken-builder select, .chicken-builder .avatar-tabs, .chicken-builder .preset-row { scroll-margin-top: 272px; }
}
@media (max-width: 400px) {
  .avatar-control-grid { grid-template-columns: minmax(0, 1fr); }
  .chicken-builder .swatches { gap: 4px; }
}
@media (max-height: 620px) {
  .chicken-builder[data-builder-ready] .character-stage { position: relative; top: 0; }
  .chicken-builder input, .chicken-builder select, .chicken-builder .avatar-tabs, .chicken-builder .preset-row { scroll-margin-top: 24px; }
}
.onboarding-note { margin-top: 20px; text-align: center; color: var(--ink-muted); font-size: 16px; }
.welcome-footer { display: flex; justify-content: space-between; gap: 24px; padding: 32px 0; margin-top: 32px; border-top: 1px solid var(--outline); color: var(--ink-muted); font-size: 16px; }
.captain-edit { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.captain-edit-form .captain-form { margin: 0; }
.captain-side { padding: 40px 32px; border: 1px solid var(--outline); border-radius: 28px; background: var(--sky-soft); }
.captain-side h2 { margin: 16px 0 8px; overflow-wrap: anywhere; }
.captain-side > p { color: var(--ink-muted); }
.captain-side > p:last-child { margin-top: 32px; font-size: 16px; }
.captain-stat { padding-top: 24px; margin-top: 24px; border-top: 1px solid rgb(29 78 216 / 20%); }
.captain-stat strong { display: block; font: 700 40px/1.2 var(--mono); }
.captain-stat span { display: block; margin-top: 8px; }

/* The bridge and practice paths. */
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-heading > div:first-child { min-width: 0; }
.page-heading > .streak-pill { display: none; }
.page-heading h1 { margin: 12px 0; overflow-wrap: anywhere; }
.heading-star { color: var(--sky); padding-left: 12px; font-weight: 400; }
.streak-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--sun); border-radius: 999px; background: var(--sun-soft); padding: 12px 20px; font-size: 16px; white-space: nowrap; }
.streak-pill .icon { color: var(--sun-deep); fill: var(--sun); }
.streak-pill strong { font-family: var(--mono); }
.dashboard-top { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 32px; }
.voyage-hero { position: relative; overflow: hidden; background: var(--sky-soft); border: 1px solid var(--sky-outline); border-radius: 28px; padding: 32px; min-height: 380px; }
.hero-copy { position: relative; z-index: 1; }
.hero-copy .eyebrow { max-width: 290px; }
.hero-copy h2 { font-size: 40px; line-height: 48px; margin: 20px 0; }
.hero-copy h2 > span { color: var(--sky-deep); }
.hero-copy > p { font-size: 18px; line-height: 28px; max-width: 360px; margin-bottom: 24px; }
.hero-copy .button { position: relative; }
.hero-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--ink-muted); font-size: 16px; margin-top: 20px; }
.hero-meta .icon { width: 20px; height: 20px; flex-basis: 20px; }
.hero-chart { position: absolute; width: 58%; right: -10%; top: 32px; opacity: .9; pointer-events: none; }
.hero-chart img { width: 100%; }
.progress-card { border: 1px solid var(--outline); border-radius: 20px; background: var(--surface); padding: 28px 24px; display: flex; flex-direction: column; }
.card-topline { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-topline > .icon { width: 32px; height: 32px; color: var(--sun-deep); fill: var(--sun); }
.level-display { display: flex; align-items: center; gap: 20px; margin: 24px 0; }
.level-ring { width: 104px; height: 104px; border-radius: 50%; background: conic-gradient(var(--leaf) var(--progress), var(--sky-soft) 0); padding: 8px; flex-shrink: 0; }
.level-ring > div { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%; background: var(--surface); }
.level-ring span { font-size: 16px; color: var(--ink-muted); line-height: 1; }
.level-ring strong { font: 700 40px/1.15 var(--display); margin-top: 4px; }
.level-display h3 { font-size: 24px; }
.level-display p { font-size: 16px; color: var(--ink-muted); margin-top: 8px; }
.progress-track, .session-progress { display: block; background: var(--sky-soft); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-track > span, .session-progress > span { display: block; height: 100%; background: var(--leaf); border-radius: inherit; transition: width 480ms ease-out; }
.progress-caption { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; color: var(--ink-muted); margin-top: 12px; }
.progress-caption > span:last-child { display: inline-flex; gap: 4px; align-items: center; }
.progress-caption .icon { width: 16px; height: 16px; flex-basis: 16px; color: var(--sun-deep); }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; padding-top: 24px; margin-top: auto; }
.mini-stats > div { border-top: 1px solid var(--outline); padding-top: 20px; }
.mini-stats strong { font: 600 28px/1.3 var(--mono); display: block; }
.mini-stats strong small { font-size: 18px; }
.mini-stats span { color: var(--ink-muted); font-size: 16px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin: 48px 0 24px; }
.section-heading h2 { margin-top: 8px; }
.section-heading > .subtle-label { max-width: 210px; text-align: right; }
.mode-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 32px; }
.mode-card { border: 1px solid var(--outline); border-radius: 20px; background: var(--surface); overflow: hidden; transition: transform 240ms var(--spring), box-shadow 240ms, border-color 240ms; }
.mode-card:hover, .topic-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--sky-bright); }
.mode-card:focus-within, .topic-card:focus-within { border-color: var(--sky); box-shadow: inset 0 0 0 2px var(--sky), var(--active-shadow); }
.mode-card > button { display: grid; grid-template-columns: 88px 1fr; grid-template-rows: auto auto auto; gap: 8px 20px; width: 100%; height: 100%; padding: 24px; text-align: left; background: transparent; border-radius: inherit; }
.mode-art { display: grid; place-items: center; grid-row: 1 / 4; align-self: start; width: 88px; min-height: 96px; border-radius: 20px; overflow: hidden; background: var(--sky-soft); }
.mode-art > svg { width: 100%; height: auto; }
.art-signals { background: #0f172a; }
.art-match { background: var(--sky-soft); }
.art-flash { background: var(--berry-soft); }
.mode-title { font: 700 22px/1.3 var(--display); letter-spacing: -.025em; display: flex; align-items: center; gap: 12px; }
.mode-title > .icon { margin-left: auto; color: var(--sky-deep); width: 20px; height: 20px; flex-basis: 20px; }
.mode-description { color: var(--ink-muted); font-size: 18px; line-height: 28px; }
.mode-meta { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--ink-muted); margin-top: 8px; }
.mode-meta .icon { width: 20px; height: 20px; flex-basis: 20px; color: var(--sky-deep); }
.topic-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 32px; }
.topic-card { border: 1px solid var(--outline); border-radius: 20px; background: var(--surface-elevated); transition: transform 240ms var(--spring), box-shadow 240ms, border-color 240ms; }
.topic-card > button { width: 100%; height: 100%; display: flex; align-items: flex-start; gap: 20px; padding: 24px; background: transparent; text-align: left; border-radius: inherit; }
.topic-icon { display: grid; place-items: center; width: 64px; height: 64px; flex: 0 0 64px; border-radius: 16px; color: var(--sky-deep); background: var(--sky-soft); }
.topic-icon .icon { width: 32px; height: 32px; }
.topic-icon.sage, .topic-icon.green, .topic-icon.mint { background: var(--leaf-soft); color: var(--ink); }
.topic-icon.lavender, .topic-icon.purple, .topic-icon.rose { background: var(--berry-soft); color: var(--ink); }
.topic-icon.sand, .topic-icon.gold { background: var(--surface-sunken); color: var(--ink); }
.topic-content { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.topic-eyebrow { font-size: 16px; color: var(--ink-muted); }
.topic-eyebrow > span { padding-inline: 4px; }
.topic-content > strong { font: 600 22px/1.4 var(--display); letter-spacing: -.025em; }
.topic-description { font-size: 18px; color: var(--ink-muted); line-height: 28px; }
.topic-bottom { display: flex; align-items: center; gap: 12px; font-size: 16px; color: var(--ink-muted); margin-top: 12px; }
.topic-bottom .progress-track { flex: 1; }
.topic-arrow { display: none; }
.assessment-banner { display: flex; align-items: center; gap: 24px; padding: 32px; margin-top: 48px; border: 1px solid var(--outline); background: var(--surface); border-radius: 28px; }
.assessment-medal { display: grid; place-items: center; width: 80px; height: 80px; flex: 0 0 80px; border-radius: 50%; background: var(--sky-soft); color: var(--sky-deep); }
.assessment-medal > .icon { height: 40px; width: 40px; }
.assessment-banner h3 { font-size: 24px; margin: 4px 0 8px; }
.assessment-banner p { font-size: 18px; color: var(--ink-muted); }
.assessment-banner .button { margin-left: auto; flex-shrink: 0; }
.curriculum-note { display: flex; align-items: flex-start; gap: 12px; font-size: 16px; color: var(--ink-muted); padding: 24px 0 0; }
.curriculum-note .icon { color: var(--sky); }

/* Challenges, encounter chart, and answer feedback. */
.session-breadcrumb { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; color: var(--ink-muted); font-size: 16px; }
.session-breadcrumb > a { display: inline-flex; align-items: center; gap: 8px; min-height: 56px; color: var(--sky-deep); }
.challenge-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.challenge-heading h1 { margin-top: 8px; }
.question-counter { font: 400 20px/1.5 var(--mono); white-space: nowrap; padding: 12px 20px; background: var(--sky-soft); border-radius: 999px; }
.question-counter strong { color: var(--sky-deep); }
.session-progress { margin: 24px 0 32px; }
.challenge-grid { display: grid; grid-template-columns: minmax(0,.95fr) minmax(0,1.05fr); gap: 32px; align-items: start; }
.text-challenge { display: block; max-width: 880px; margin: 0 auto; }
.visual-panel { position: sticky; top: 24px; min-width: 0; border-radius: 28px; background: var(--sky-soft); border: 1px solid var(--sky-outline); overflow: hidden; }
.visual-topline { padding: 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font-size: 16px; color: var(--ink-muted); }
.visual-topline > span:first-child { font-weight: 700; color: var(--sky-deep); }
.scenario-stage svg { width: 100%; height: auto; }
.chart-text { font-family: var(--body); font-size: 18px; fill: var(--ink-muted); font-weight: 700; }
.chart-text.coordinates { display: none; }
.chart-north { font-family: var(--body); font-size: 20px; font-weight: 700; fill: var(--ink-muted); }
.course-line { stroke-width: 2; fill: none; stroke-dasharray: 6 9; opacity: .7; }
.other-course { stroke: var(--berry); }
.safe-route { stroke: var(--leaf-deep); stroke-width: 3; stroke-dasharray: 6 6; fill: none; opacity: 0; }
.playing .safe-route { opacity: 1; }
.own-ship, .other-ship { transform-origin: 0 0; }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; padding: 20px 20px 8px; font-size: 16px; color: var(--ink-muted); }
.chart-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend > span:last-child { flex-basis: 100%; justify-content: center; }
.legend-dot { height: 12px; width: 12px; border-radius: 50%; display: inline-block; }
.legend-dot.own { background: var(--sky-deep); }
.legend-dot.other { background: var(--berry); }
.visual-footnote { color: var(--ink-muted); font-size: 16px; line-height: 24px; text-align: center; padding: 20px 24px 24px; }
.replay-button { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 56px; padding: 12px 20px; border-radius: 16px; margin: 16px auto 0; background: var(--surface-elevated); color: var(--sky-deep); font-size: 18px; font-weight: 700; max-width: calc(100% - 32px); }
.light-panel { background: #0f172a; color: #fff; border-color: #334155; }
.light-panel .visual-topline, .light-panel .visual-topline > span:first-child, .light-panel .visual-footnote { color: #e2e8f0; }
.light-scene { position: relative; height: 260px; display: flex; justify-content: center; align-items: center; overflow: hidden; }
.star-field { position: absolute; inset: 0; background-image: radial-gradient(#e2e8f0 1px,transparent 1px); background-size: 43px 57px; opacity: .2; }
.mast { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 32px; padding: 24px 0; }
.mast-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #94a3b8; }
.nav-light { z-index: 1; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 0 20px 6px rgb(255 255 255 / 30%); border: 2px solid #fff; }
.light-red { background: #ff4747; border-color: #ff9595; box-shadow: 0 0 20px 6px rgb(255 71 71 / 25%); }
.light-green { background: #22c55e; border-color: #86efac; box-shadow: 0 0 20px 6px rgb(34 197 94 / 25%); }
.light-yellow { background: #fbbf24; border-color: #fde68a; box-shadow: 0 0 20px 6px rgb(251 191 36 / 25%); }
.light-caption { font-size: 20px; text-align: center; text-transform: capitalize; padding: 8px 20px; color: white; }
.light-caption span { color: #cbd5e1; font-size: 16px; margin: 0 4px; }
.sound-panel { background: var(--berry-soft); border-color: var(--berry-outline); }
.sound-stage { display: flex; align-items: center; justify-content: center; gap: 24px; min-height: 200px; }
.sound-play { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; color: var(--on-accent); background: var(--sky-deep); box-shadow: 0 0 0 16px var(--sound-halo); }
.sound-play .icon { width: 40px; height: 40px; margin-left: 4px; }
.sound-play.is-playing .icon { fill: currentColor; }
.sound-waves { display: flex; gap: 6px; height: 64px; align-items: center; }
.sound-waves span { display: block; width: 4px; height: 20px; background: var(--sky-deep); border-radius: 99px; }
.sound-waves span:nth-child(2n) { height: 44px; }
.sound-waves span:nth-child(3n) { height: 60px; }
.is-playing .sound-waves span { animation: sound-wave 700ms ease-in-out infinite alternate; }
.is-playing .sound-waves span:nth-child(2n) { animation-delay: -400ms; }
.signal-notation { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; padding: 16px; }
.blast { display: block; height: 12px; background: var(--sky-deep); border-radius: 999px; }
.blast.short { width: 16px; }
.blast.long { width: 64px; }
.signal-text { color: var(--ink); text-align: center; padding-inline: 20px; font-size: 18px; }
.question-panel { min-width: 0; }
.question-type { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--sky-deep); font-weight: 700; margin-bottom: 16px; }
.question-panel h2 { font-family: var(--body); font-size: 24px; line-height: 34px; letter-spacing: .01em; }
.question-panel > .read-button { margin: 16px 0 24px; }
.answer-options { display: grid; gap: 16px; margin-bottom: 24px; }
.answer-option { position: relative; display: flex; align-items: center; gap: 16px; padding: 20px; min-height: 96px; font-size: 18px; line-height: 28px; border: 1px solid var(--outline-strong); border-radius: 16px; background: var(--surface); transition: transform 240ms var(--spring), border-color 240ms, box-shadow 240ms; }
label.answer-option { cursor: pointer; }
label.answer-option:hover { transform: translateY(-2px); box-shadow: var(--active-shadow); border-color: var(--sky); }
.answer-option > input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.option-letter { display: grid; place-items: center; height: 40px; width: 40px; flex: 0 0 40px; border: 1px solid var(--outline-strong); border-radius: 12px; background: var(--background); font: 600 18px var(--mono); color: var(--ink-muted); }
.answer-option > span:nth-of-type(2) { flex: 1; min-width: 0; }
.option-selector { height: 24px; width: 24px; flex: 0 0 24px; border: 2px solid var(--outline-strong); border-radius: 50%; background: var(--background); }
.answer-option:has(input:checked) { background: var(--sky-soft); border-color: var(--sky); box-shadow: inset 0 0 0 2px var(--sky); }
.answer-option:has(input:checked) .option-letter { background: var(--sky-deep); border-color: var(--sky-deep); color: var(--on-accent); }
.answer-option:has(input:checked) .option-selector { background: var(--sky-deep); border-color: var(--sky-deep); box-shadow: inset 0 0 0 4px white; }
.answer-option:has(input:focus-visible) { outline: 3px solid var(--sky-deep); outline-offset: 4px; }
.answer-option.correct { border: 2px solid var(--leaf-deep); background: var(--leaf-soft); }
.answer-option.incorrect { border: 2px dashed var(--coral); background: var(--coral-soft); animation: gentle-shake 240ms ease-in-out 2; }
.answer-option.correct > .icon { padding: 4px; width: 32px; height: 32px; flex-basis: 32px; border-radius: 50%; background: var(--leaf-deep); color: var(--on-success); }
.answer-option.incorrect > .icon { color: var(--ink); }
.answer-option.correct .option-letter, .answer-option.incorrect .option-letter { border-color: var(--ink-muted); background: var(--background); color: var(--ink); }
.feedback { padding: 24px; border: 2px solid var(--leaf-deep); background: var(--leaf-soft); border-radius: 20px; margin-bottom: 24px; }
.feedback.is-learning { background: var(--coral-soft); border-color: var(--coral); border-style: dashed; }
.feedback-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; }
.feedback-title > span { margin-left: auto; padding: 4px 12px; border-radius: 999px; background: var(--sun-soft); color: var(--ink); font: 600 16px var(--mono); }
.feedback-explanation { margin-top: 8px; }
.feedback-explanation > summary { display: flex; align-items: center; gap: 8px; min-height: 56px; font-size: 18px; font-weight: 700; list-style: none; text-decoration: underline; text-underline-offset: 4px; }
.feedback-explanation > summary > .icon { margin-left: auto; }
.feedback-explanation[open] > summary > .icon { transform: rotate(90deg); }
.feedback-explanation p { font-size: 19px; line-height: 32px; margin: 8px 0 16px; }
.feedback-explanation > a { display: flex; align-items: center; gap: 8px; min-height: 56px; margin-top: 16px; font-size: 16px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.question-help { color: var(--ink-muted); font-size: 16px; text-align: center; margin-top: 16px; }
.matching-pairs { display: grid; gap: 20px; margin-bottom: 32px; }
.matching-pairs > label { display: grid; grid-template-columns: minmax(0,1fr) 24px minmax(0,1fr); gap: 16px; align-items: center; padding: 20px; border: 2px dashed var(--outline-strong); background: var(--surface-sunken); border-radius: 16px; }
.match-left { font-size: 18px; font-weight: 700; }
.matching-pairs > label > .icon { color: var(--sky-deep); }
.matching-pairs select { width: 100%; padding-left: 12px; background: var(--surface-elevated); }
.match-answers { display: grid; gap: 16px; margin-bottom: 24px; }
.match-answers > div { display: grid; grid-template-columns: minmax(0,1fr) 24px minmax(0,1fr); align-items: center; gap: 16px; padding: 20px; border: 1px solid var(--outline); border-radius: 16px; background: var(--surface); }
.match-answers > div > .icon { color: var(--sky-deep); }
.session-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; border-top: 1px solid var(--outline); padding-top: 24px; margin-top: 48px; color: var(--ink-muted); font-size: 16px; }
.session-bottom > span { display: inline-flex; align-items: center; gap: 8px; }
.session-bottom .icon { color: var(--sky-deep); }

/* Recall practice and completion rewards. */
.flashcard { max-width: 800px; margin: 0 auto; padding: 40px; border: 1px solid var(--outline); border-radius: 28px; background: var(--surface); text-align: center; box-shadow: var(--shadow); }
.flashcard.revealed { background: var(--sky-soft); border-color: var(--sky-outline); }
.flashcard-label { color: var(--ink-muted); font-size: 16px; font-weight: 700; }
.flashcard-icon { display: grid; place-items: center; width: 80px; height: 80px; border-radius: 20px; background: var(--berry-soft); color: var(--sky-deep); margin: 24px auto; }
.flashcard-icon .icon { width: 40px; height: 40px; }
.flashcard .rule-pill { background: var(--surface-elevated); border: 1px solid var(--outline); margin-bottom: 16px; }
.flashcard h2 { margin-bottom: 24px; }
.flashcard p { font-size: 19px; line-height: 32px; max-width: 660px; margin: 0 auto 24px; }
.flashcard > .read-button { display: flex; margin: 20px auto 0; }
.flashcard .memory-hook { text-align: left; background: var(--surface-elevated); }
.memory-hook { display: flex; align-items: flex-start; gap: 12px; padding: 20px 24px; margin: 24px 0 16px; border: 1px solid var(--sky-outline); background: var(--sky-soft); border-radius: 20px 20px 20px 4px; font-size: 19px; line-height: 32px; font-weight: 700; }
.memory-hook > .icon { color: var(--sky-deep); margin-top: 4px; }
.flash-rating { text-align: center; margin-top: 32px; }
.flash-rating > p { margin-bottom: 16px; font-size: 20px; }
.flash-rating > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-bottom: 16px; }
.flash-rating .button { min-width: 200px; }
.results-hero { padding: 40px; text-align: center; border: 1px solid var(--outline); border-radius: 28px; background: var(--surface); }
.result-emblem { display: grid; place-items: center; margin: 0 auto 20px; width: 80px; height: 80px; border-radius: 50%; background: var(--sun-soft); color: var(--sun-deep); border: 1px solid var(--sun); }
.result-emblem > .icon { width: 40px; height: 40px; }
.results-hero h1 { margin: 16px auto; max-width: 760px; }
.results-hero > p { color: var(--ink-muted); max-width: 650px; margin-inline: auto; }
.star-row { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 32px 0; }
.star-badge { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--surface-sunken); color: var(--outline-strong); border: 1px solid var(--outline); }
.star-badge > .icon { width: 32px; height: 32px; fill: transparent; }
.star-badge.earned { background: var(--sun-soft); color: var(--sun-deep); border: 2px solid var(--sun); }
.star-badge.earned > .icon { fill: var(--sun); }
.star-badge.earned.silver { background: #f8fafc; border-color: #94a3b8; color: #475569; }
.star-badge.earned.silver > .icon { fill: #cbd5e1; }
.star-badge.earned.gold { background: var(--sun); color: var(--ink); border-color: var(--sun-deep); }
.star-badge.earned.gold > .icon { fill: var(--sun-bright); }
.celebrating .star-badge.earned { animation: star-arrive 480ms var(--spring) both, reward-glow 2s ease-out; }
.celebrating .star-badge:nth-child(2) { animation-delay: 120ms; }
.celebrating .star-badge:nth-child(3) { animation-delay: 240ms; }
.result-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); max-width: 800px; margin: 32px auto; }
.result-stats > div { padding: 0 24px; border-right: 1px solid var(--outline); }
.result-stats > div:last-child { border: 0; }
.result-stats strong { display: block; font: 700 56px/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.045em; }
.result-stats strong small { font: 400 24px var(--mono); letter-spacing: -.04em; }
.result-stats span { display: block; color: var(--ink-muted); font-size: 18px; margin-top: 12px; }
.result-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; margin-top: 32px; }
.result-reflection { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 32px; margin-top: 32px; }
.result-reflection > section { border: 1px solid var(--leaf-deep); border-radius: 20px; padding: 32px; background: var(--leaf-soft); }
.result-reflection > .reflection-next { border: 1px dashed var(--coral); background: var(--coral-soft); }
.result-reflection h2 { font-size: 24px; line-height: 32px; margin: 16px 0 12px; }
.result-reflection p { font-size: 19px; line-height: 32px; }
.review-list { display: grid; gap: 16px; }
.review-item, .rule-item { border: 1px solid var(--outline); border-radius: 20px; background: var(--surface-elevated); overflow: hidden; }
.review-item > summary, .rule-item > summary { display: flex; gap: 20px; align-items: center; min-height: 112px; padding: 24px; list-style: none; cursor: pointer; }
.review-item > summary:hover, .rule-item > summary:hover { background: var(--surface); }
.review-item summary > span:nth-child(2), .rule-item summary > span:nth-child(2) { flex: 1; min-width: 0; }
.review-item summary > .icon, .rule-item summary > .icon { color: var(--sky-deep); }
.review-item[open] > summary > .icon, .rule-item[open] > summary > .icon { transform: rotate(90deg); }
.review-item summary strong, .rule-item summary strong { display: block; font-size: 20px; line-height: 28px; }
.review-item small, .rule-item small { display: block; color: var(--ink-muted); font-size: 16px; line-height: 24px; margin-top: 4px; }
.review-status { display: grid; place-items: center; width: 56px; height: 56px; flex: 0 0 56px; border-radius: 16px; background: var(--coral-soft); border: 1px dashed var(--coral); color: var(--ink); }
.review-correct .review-status { background: var(--leaf-soft); border: 1px solid var(--leaf-deep); }
.review-body { border-top: 1px solid var(--outline); padding: 24px 32px 32px; font-size: 19px; line-height: 32px; }
.review-body > p { margin-bottom: 24px; line-height: 32px; }
.review-choice, .review-best { padding: 20px; background: var(--surface); border: 1px solid var(--outline); border-radius: 16px; margin-bottom: 20px; }
.review-best { background: var(--leaf-soft); border-color: var(--leaf-deep); }
.review-choice > span, .review-best > span { display: block; font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.review-body .read-button { margin-right: 16px; }
.completion-confetti { position: fixed; inset: 0; z-index: 80; overflow: hidden; pointer-events: none; }
.completion-confetti i { position: absolute; top: -24px; left: var(--left); width: 10px; height: 16px; border-radius: 3px; background: var(--confetti-color); animation: confetti-fall 1.6s var(--delay) cubic-bezier(.2,.6,.5,1) both; }

/* Assessment, rulebook, and voyage history. */
.assessment-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 32px; align-items: start; }
.assessment-intro { padding: 40px; background: var(--sky-soft); border: 1px solid var(--sky-outline); border-radius: 28px; }
.assessment-big-icon { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 28px; background: var(--surface-elevated); color: var(--sky-deep); margin-bottom: 24px; }
.assessment-big-icon > .icon { width: 48px; height: 48px; }
.assessment-intro > .pill { padding: 0; background: transparent; }
.assessment-intro h2 { font-size: 40px; line-height: 48px; margin: 20px 0; }
.assessment-intro > p { font-size: 20px; line-height: 32px; }
.assessment-facts { display: grid; gap: 20px; margin: 32px 0; }
.assessment-facts > span { display: flex; align-items: center; gap: 12px; }
.assessment-facts .icon { color: var(--sky-deep); }
.assessment-intro .tiny { font-size: 16px; line-height: 24px; text-align: center; margin-top: 16px; }
.assessment-outline h2 { margin: 12px 0 16px; }
.outline-row { display: flex; gap: 16px; align-items: center; padding: 24px 0; border-bottom: 1px solid var(--outline); }
.outline-row > div { min-width: 0; flex: 1; }
.outline-row strong { display: block; font-size: 18px; }
.outline-row small { display: block; font-size: 16px; color: var(--ink-muted); margin-top: 4px; }
.outline-row > span:last-child { font: 600 20px var(--mono); }
.assessment-note { display: flex; align-items: flex-start; gap: 12px; background: var(--sky-soft); border-radius: 20px 20px 20px 4px; padding: 20px; margin-top: 24px; }
.assessment-note > .icon { color: var(--sky-deep); }
.assessment-note p { font-size: 18px; line-height: 28px; }
.library-search { display: flex; flex-wrap: wrap; gap: 16px; padding: 24px; border: 1px solid var(--outline); border-radius: 20px; background: var(--surface); }
.search-input { flex: 1 1 250px; display: flex; align-items: center; gap: 12px; background: var(--background); }
.search-input .icon { color: var(--ink-muted); }
.search-input input { border: 0; outline: 0; min-width: 0; width: 100%; background: transparent; }
.library-search > select { flex: 1 1 230px; max-width: 360px; background: var(--background); }
.library-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding: 20px 0; font-size: 16px; color: var(--ink-muted); }
.library-meta a { display: inline-flex; align-items: center; gap: 8px; min-height: 56px; color: var(--sky-deep); }
.rules-list { display: grid; gap: 16px; }
.rule-number { width: 56px; height: 56px; flex: 0 0 56px; display: grid; place-items: center; border-radius: 16px; background: var(--sky-soft); color: var(--sky-deep); font: 600 24px var(--mono); }
.rule-item summary small { margin-bottom: 4px; margin-top: 0; }
.rule-body { border-top: 1px solid var(--outline); padding: 24px 32px 32px; font-size: 19px; line-height: 32px; }
.rule-body > p { line-height: 32px; }
.rule-body .read-button { margin-right: 16px; }
.library-jumps { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0 0 32px; }
.library-jumps a { display: inline-flex; align-items: center; min-height: 48px; color: var(--sky-deep); text-decoration: underline; text-underline-offset: 4px; }
.rule-item { scroll-margin-top: 32px; }
.rule-item:target { border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-soft); }
.legal-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.legal-toolbar .read-button { margin: 0; }
.legal-section { color: var(--ink-muted); padding-bottom: 24px; border-bottom: 1px solid var(--outline); margin-bottom: 24px; }
.legal-text { max-width: 74ch; overflow-wrap: break-word; }
.legal-text p { margin: 0 0 24px; font-size: 19px; line-height: 32px; }
.legal-text h3 { font-size: 22px; line-height: 32px; margin: 40px 0 24px; }
.legal-text h3:first-child { margin-top: 0; }
.legal-text .legal-level-1 { margin-left: 24px; padding-left: 16px; border-left: 2px solid var(--outline); }
.legal-text .legal-formula { font-family: var(--mono); padding: 20px; background: var(--surface); border: 1px solid var(--outline); border-radius: 12px; }
.legal-text .legal-footnote { color: var(--ink-muted); font-size: 17px; line-height: 28px; }
.legal-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-top: 24px; }
.legal-links a { min-height: 48px; display: inline-flex; align-items: center; gap: 8px; }
.legal-table-scroll { max-width: 100%; overflow-x: auto; margin: 24px 0 32px; border: 1px solid var(--outline); border-radius: 12px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 17px; line-height: 28px; text-align: left; }
.legal-table caption { text-align: left; padding: 16px; font-weight: 600; background: var(--surface); }
.legal-table th, .legal-table td { padding: 12px 16px; border-top: 1px solid var(--outline); vertical-align: top; min-width: 96px; }
.legal-table thead th { background: var(--surface); font-weight: 600; }
.legal-table tbody th { font-weight: 500; }
.study-notes { margin-top: 32px; border-top: 1px solid var(--outline); padding-top: 16px; }
.rule-item .study-notes > summary { display: flex; align-items: center; gap: 12px; min-height: 64px; list-style: none; color: var(--sky-deep); font-weight: 600; cursor: pointer; }
.rule-item .study-notes > summary > span { flex: 1; color: var(--ink-muted); font-size: 16px; font-weight: 400; }
.study-notes[open] > summary > .icon:last-child { transform: rotate(90deg); }
.study-note-body { margin-top: 16px; }
.study-note-body > p { margin-bottom: 24px; }
.study-note-body > .tiny { margin: 16px 0 0; }
.annex-section { margin-top: 48px; }
.annex-section .section-heading { flex-wrap: wrap; gap: 16px; }
.annex-item .rule-number { font-size: 20px; }
@media (max-width: 600px) {
  .legal-text .legal-level-1 { margin-left: 0; padding-left: 12px; }
  .legal-text .legal-formula { font-size: 16px; padding: 12px; }
  .rule-item .study-notes > summary { flex-wrap: wrap; font-size: 18px; gap: 8px; }
  .rule-item .study-notes > summary > span { flex: 1 1 100%; order: 1; padding-left: 32px; }
  .study-notes > summary > .icon:last-child { margin-left: auto; }
}
.sources-panel { margin-top: 48px; background: var(--surface); }
.sources-panel h2 { margin: 12px 0 24px; }
.sources-panel p { font-size: 19px; line-height: 32px; margin-top: 24px; }
.sources-panel p a { color: var(--sky-deep); text-decoration: underline; text-underline-offset: 3px; }
.sources-panel > .read-button { margin-top: 24px; margin-right: 16px; }
.annex-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; margin-top: 32px; }
.annex-grid > div { border: 1px solid var(--outline); border-radius: 16px; padding: 24px; background: var(--surface-elevated); }
.annex-grid strong { display: block; margin-bottom: 8px; }
.annex-grid span { display: block; color: var(--ink-muted); }
.source-scope { padding-top: 24px; border-top: 1px solid var(--outline); }
.logbook-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 24px; }
.logbook-stats .panel { padding: 24px; background: var(--surface); }
.logbook-stats .icon { color: var(--sky); width: 32px; height: 32px; margin-bottom: 24px; }
.logbook-stats .panel:first-child .icon { color: var(--sun-deep); fill: var(--sun); }
.logbook-stats strong { display: block; font: 600 40px/1.2 var(--mono); }
.logbook-stats strong small { font-size: 24px; }
.logbook-stats span { display: block; margin-top: 12px; font-size: 16px; color: var(--ink-muted); }
.logbook-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(0,1fr); gap: 32px; margin-top: 48px; align-items: start; }
.logbook-grid .section-heading { margin: 0 0 24px; flex-wrap: wrap; }
.logbook-grid .section-heading h2 { margin: 0; }
.history-list { display: grid; gap: 16px; }
.history-item { display: flex; align-items: center; gap: 16px; border: 1px solid var(--outline); padding: 24px; border-radius: 20px; min-width: 0; background: var(--surface); }
.history-item:hover { border-color: var(--sky); box-shadow: var(--shadow); }
.history-icon { width: 56px; height: 56px; flex: 0 0 56px; display: grid; place-items: center; border-radius: 16px; background: var(--sky-soft); color: var(--sky-deep); }
.history-item > span:nth-child(2) { flex: 1; min-width: 0; }
.history-item strong { display: block; font-size: 18px; }
.history-item small { display: block; font-size: 16px; color: var(--ink-muted); margin-top: 8px; }
.history-score { font: 600 24px/1.4 var(--mono); text-align: right; }
.history-score small { font: 400 16px/1.5 var(--body); }
.history-item > .icon { color: var(--sky-deep); }
.focus-panel { background: var(--surface); }
.focus-panel h2 { font-size: 24px; line-height: 32px; margin: 12px 0 32px; }
.focus-row { margin-top: 24px; }
.focus-row > div:first-child { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; font-size: 16px; margin-bottom: 12px; }
.focus-row > div:first-child > span { white-space: nowrap; color: var(--ink-muted); }
.focus-panel > p { margin: 24px 0; }
.focus-panel > p:last-child { margin-bottom: 0; }
.focus-panel .button { font-size: 18px; padding-inline: 16px; }
.empty-state { padding: 48px 24px; text-align: center; }
.empty-state > .icon { width: 48px; height: 48px; color: var(--sky); margin: 0 auto 24px; }
.empty-state h2 { font-size: 24px; line-height: 32px; }
.empty-state p { margin: 16px auto 24px; color: var(--ink-muted); }

@keyframes sound-wave { from { transform: scaleY(.35); } to { transform: scaleY(1); } }
@keyframes gentle-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes star-arrive { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes reward-glow { 0%,35% { box-shadow: 0 0 24px rgb(252 211 77 / 40%); } 100% { box-shadow: none; } }
@keyframes confetti-fall { from { transform: translateY(-5vh) rotate(0); opacity: 1; } to { transform: translateY(105vh) rotate(480deg); opacity: 0; } }

/* A comfortable layout at every viewport; type never shrinks below 16px. */
@media (min-width: 1700px) {
  .mode-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .mode-card > button { display: flex; flex-direction: column; gap: 12px; }
  .mode-art { min-height: 80px; margin-bottom: 8px; }
  .mode-title { width: 100%; }
  .mode-meta { margin-top: auto; padding-top: 12px; }
  .hero-chart { right: -2%; width: 50%; top: 8px; }
}
@media (max-width: 1350px) {
  :root { --sidebar-width: 240px; }
  .sidebar { padding-inline: 16px; }
  .topbar, .main-content { padding-inline: 24px; }
  .breadcrumb { display: none; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .page-heading > .streak-pill { display: none; }
  .dashboard-top { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); gap: 24px; }
  .hero-chart { opacity: .35; width: 68%; right: -28%; top: 48px; }
  .hero-copy { width: 100%; }
  .level-display { gap: 16px; flex-direction: column; align-items: flex-start; }
  .level-ring { width: 88px; height: 88px; }
  .mode-card > button { grid-template-columns: 64px 1fr; gap: 8px 16px; padding: 24px; }
  .mode-art { width: 64px; height: 64px; min-height: 64px; border-radius: 16px; }
  .mode-art > svg { width: 100%; }
  .mode-title { display: block; }
  .mode-title > .icon { display: none; }
  .mode-meta { grid-column: 1 / -1; }
  .topic-card > button { padding: 24px 20px; gap: 16px; }
  .topic-icon { width: 56px; height: 56px; flex-basis: 56px; }
  .assessment-banner { flex-wrap: wrap; }
  .assessment-banner > div { flex: 1; }
  .assessment-banner .button { margin-left: 104px; }
  .challenge-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; }
  .answer-option { padding: 16px; gap: 12px; }
  .option-selector { display: none; }
  .captain-edit { grid-template-columns: minmax(0,1.35fr) minmax(0,1fr); gap: 24px; }
  .logbook-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  :root { --sidebar-width: 224px; }
  .sidebar { padding-inline: 12px; }
  .sidebar-caption { font-size: 16px; letter-spacing: 0; }
  .nav-link { padding-inline: 12px; gap: 8px; }
  .captain-link { flex-wrap: wrap; }
  .captain-link > .icon { display: none; }
  .topbar-right { gap: 16px; }
  .topbar .edition-tag { display: none; }
  .welcome-grid { gap: 32px; }
  .welcome-story { padding: 32px; }
  .welcome-story h1 { font-size: 48px; line-height: 56px; }
  .welcome-tagline { display: none; }
  .welcome-header .brand { margin-right: auto; }
  .dashboard-top { grid-template-columns: 1fr; }
  .voyage-hero { min-height: 0; }
  .hero-chart { opacity: .65; right: -10%; width: 54%; top: 16px; }
  .progress-card { padding: 24px; }
  .level-display { flex-direction: row; align-items: center; }
  .mini-stats { margin-top: 16px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .section-heading > .subtle-label { text-align: left; max-width: none; }
  .mode-grid, .topic-grid { gap: 24px; }
  .mode-card > button { display: flex; flex-direction: column; gap: 12px; }
  .mode-art { margin-bottom: 4px; }
  .mode-meta { margin-top: auto; padding-top: 8px; }
  .topic-card > button { flex-direction: column; }
  .topic-content { width: 100%; }
  .topic-bottom { margin-top: auto; padding-top: 12px; }
  .challenge-grid { grid-template-columns: 1fr; max-width: 800px; margin-inline: auto; }
  .visual-panel { position: relative; top: auto; }
  .scenario-stage { max-width: 560px; margin-inline: auto; }
  .visual-topline { padding-bottom: 12px; }
  .chart-legend { padding-top: 0; }
  .chart-legend > span:last-child { flex-basis: auto; }
  .question-panel { margin-top: 8px; }
  .answer-option { padding: 20px; gap: 16px; }
  .option-selector { display: block; }
  .captain-edit { grid-template-columns: 1fr; }
  .assessment-layout { grid-template-columns: 1fr; }
  .result-stats > div { padding-inline: 16px; }
  .result-stats strong { font-size: 48px; }
  .result-stats strong small { font-size: 20px; }
  .result-reflection { gap: 24px; }
  .result-reflection > section { padding: 24px; }
  .logbook-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .sidebar { visibility: hidden; transform: translateX(-100%); width: 280px; box-shadow: 24px 0 48px rgb(15 23 42 / 12%); transition: transform 240ms var(--spring), visibility 240ms; }
  .sidebar.open { visibility: visible; transform: translateX(0); }
  .sidebar-note { display: none; }
  .sidebar-caption { margin-bottom: 32px; }
  .workspace { margin-left: 0; width: 100%; }
  .mobile-menu { display: grid; flex-shrink: 0; }
  .topbar { min-height: 88px; padding: 16px 20px; gap: 16px; }
  .topbar-right { width: auto; flex: 1; gap: 12px; }
  .topbar .reading-settings > summary > span { display: none; }
  .topbar .reading-settings > summary { width: 56px; height: 56px; justify-content: center; padding: 12px; }
  .main-content { padding: 32px 20px 48px; }
  .welcome-page { padding-inline: 20px; }
  .welcome-header { min-height: 96px; gap: 12px; flex-wrap: wrap; }
  .welcome-header .edition-tag { display: none; }
  .welcome-grid { grid-template-columns: 1fr; gap: 32px; }
  .welcome-story { position: relative; top: auto; }
  .welcome-story h1 { font-size: 48px; line-height: 56px; }
  .welcome-story .welcome-chart { position: absolute; width: 54%; right: -16%; top: 120px; opacity: .7; }
  .welcome-story > p, .welcome-story h1 { position: relative; z-index: 1; }
  .story-bottom { margin-top: 32px; }
  .onboarding { padding: 0; max-width: 560px; width: 100%; margin-inline: auto; }
  .onboarding h2 { font-size: 32px; line-height: 40px; }
  .welcome-footer { flex-direction: column; gap: 12px; }
  .app-footer { padding: 24px 20px; gap: 8px; }
}
@media (max-width: 560px) {
  h1 { font-size: 32px; line-height: 40px; }
  h2 { font-size: 28px; line-height: 36px; }
  .button { padding-inline: 20px; }
  .panel { padding: 24px; }
  .welcome-header .brand { margin-right: auto; font-size: 38px; }
  .welcome-header .brand-mark { width: 56px; height: 56px; }
  .welcome-header .reading-settings > summary { padding-inline: 12px; }
  .welcome-header .reading-settings > summary > span { display: none; }
  .welcome-header .reading-settings > summary { width: 56px; height: 56px; justify-content: center; }
  .welcome-story { padding: 32px 24px; }
  .welcome-story h1 { font-size: 40px; line-height: 48px; }
  .welcome-story > p { font-size: 18px; line-height: 28px; }
  .welcome-story .welcome-chart { display: none; }
  .story-bottom { gap: 12px 16px; }
  .story-bottom > span:last-child { display: none; }
  .character-stage { min-height: 224px; }
  .avatar-preview { width: 112px; height: 112px; }
  .randomize { right: 12px; bottom: 12px; }
  .preset-row { gap: 8px; }
  .preset { padding-inline: 4px; min-height: 104px; }
  .swatches { gap: 8px; flex-wrap: wrap; }
  .swatches label > span { width: 56px; height: 56px; }
  .topbar-right { justify-content: flex-end; gap: 16px; }
  .nav-streak > span { display: none; }
  .topbar-divider { display: none; }
  .topbar .xp-top { gap: 4px; }
  .page-heading { display: block; margin-bottom: 24px; }
  .page-heading h1 { margin-block: 12px; }
  .page-heading > .pill { margin-top: 12px; }
  .heading-star { display: none; }
  .voyage-hero { padding: 28px 24px; }
  .hero-copy .eyebrow { max-width: none; }
  .hero-copy h2 { font-size: 36px; line-height: 44px; margin: 24px 0 16px; }
  .hero-copy > p { margin-bottom: 24px; }
  .hero-copy .button { width: 100%; gap: 12px; }
  .hero-chart { display: none; }
  .hero-meta { gap: 8px; }
  .progress-card { padding: 24px; }
  .level-display { gap: 20px; }
  .progress-caption { flex-wrap: wrap; }
  .mini-stats { gap: 12px; }
  .mini-stats strong { font-size: 28px; }
  .section-heading { margin-top: 48px; margin-bottom: 24px; }
  .section-heading > .subtle-label { max-width: none; }
  .mode-grid, .topic-grid { grid-template-columns: 1fr; gap: 20px; }
  .mode-card > button { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 8px 16px; padding: 24px; }
  .mode-art { grid-row: 1 / 3; margin: 0; }
  .mode-title { font-size: 22px; }
  .mode-description { font-size: 18px; }
  .mode-meta { grid-column: 1 / -1; padding-top: 12px; margin: 0; }
  .topic-card > button { flex-direction: row; gap: 16px; padding: 24px 20px; }
  .topic-content > strong { font-size: 22px; }
  .topic-icon { width: 56px; height: 56px; flex-basis: 56px; }
  .assessment-banner { padding: 24px; gap: 20px; }
  .assessment-medal { width: 64px; height: 64px; flex-basis: 64px; }
  .assessment-banner > div { flex: 1 1 180px; }
  .assessment-banner .button { margin-left: 0; width: 100%; }
  .curriculum-note { flex-wrap: wrap; }
  .session-breadcrumb { align-items: flex-start; flex-wrap: wrap; gap: 4px; margin-bottom: 24px; }
  .session-breadcrumb > span { flex-basis: 100%; }
  .challenge-heading { align-items: flex-start; gap: 16px; }
  .challenge-heading h1 { font-size: 28px; line-height: 36px; }
  .challenge-heading .eyebrow { font-size: 16px; }
  .question-counter { font-size: 16px; padding: 8px 12px; }
  .session-progress { margin-top: 24px; }
  .visual-topline { padding: 24px 20px 8px; }
  .chart-legend { gap: 8px 16px; padding-top: 12px; }
  .chart-legend > span:last-child { flex-basis: 100%; }
  .visual-footnote { padding-inline: 20px; }
  .question-panel h2 { font-size: 24px; line-height: 34px; }
  .answer-option { padding: 20px 16px; gap: 12px; }
  .option-letter { width: 36px; height: 36px; flex-basis: 36px; }
  .option-selector { display: none; }
  .feedback { padding: 20px; }
  .feedback-title > span { margin: 4px 0 0 32px; }
  .matching-pairs > label, .match-answers > div { grid-template-columns: minmax(0,1fr) 24px; padding: 20px; }
  .matching-pairs select, .match-answers > div > strong { grid-column: 1 / -1; }
  .matching-pairs > label > .icon { transform: rotate(90deg); }
  .flashcard { padding: 32px 24px; }
  .flashcard .memory-hook { padding: 20px; }
  .flash-rating > div { flex-direction: column-reverse; }
  .flash-rating .button { width: 100%; }
  .session-bottom { align-items: flex-start; flex-direction: column; }
  .results-hero { padding: 32px 20px; }
  .results-hero h1 { font-size: 32px; line-height: 40px; }
  .result-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 0; }
  .result-stats > div { padding: 0 12px; }
  .result-stats > div:first-child { grid-column: 1 / -1; border: 0; padding-bottom: 24px; border-bottom: 1px solid var(--outline); }
  .result-stats > div:first-child > strong { font-size: 56px; }
  .result-stats strong { font-size: 40px; }
  .result-stats strong small { font-size: 18px; }
  .result-stats span { font-size: 16px; }
  .result-actions { flex-direction: column; align-items: stretch; }
  .result-actions .button { width: 100%; }
  .result-reflection { grid-template-columns: 1fr; gap: 20px; }
  .review-item > summary, .rule-item > summary { padding: 20px 16px; gap: 12px; }
  .review-status, .rule-number { width: 48px; height: 48px; flex-basis: 48px; }
  .review-item summary strong, .rule-item summary strong { font-size: 20px; }
  .review-item summary > .icon, .rule-item summary > .icon { width: 20px; height: 20px; flex-basis: 20px; }
  .review-body, .rule-body { padding: 24px 20px; }
  .review-body .read-button, .rule-body .read-button { margin-bottom: 12px; }
  .assessment-intro { padding: 32px 24px; }
  .assessment-intro h2 { font-size: 36px; line-height: 44px; }
  .assessment-outline { padding: 24px 20px; }
  .outline-row { gap: 12px; }
  .assessment-note { padding: 20px 16px; }
  .library-search { padding: 20px; }
  .search-input { flex-basis: 100%; padding-inline: 16px; }
  .library-search > select { width: 100%; max-width: none; }
  .library-search > .button { width: 100%; }
  .library-meta { padding: 24px 0; gap: 8px; }
  .annex-grid { grid-template-columns: 1fr; gap: 16px; }
  .sources-panel { padding: 24px 20px; }
  .logbook-stats { gap: 20px; }
  .logbook-stats .panel { padding: 20px; }
  .logbook-stats strong { font-size: 32px; }
  .history-item { gap: 12px; padding: 20px 16px; flex-wrap: wrap; }
  .history-icon { width: 48px; height: 48px; flex-basis: 48px; }
  .history-item > span:nth-child(2) { min-width: calc(100% - 72px); }
  .history-score { margin-left: 60px; text-align: left; flex: 1; font-size: 24px; }
  .history-score small { display: inline; margin-left: 12px; }
  .captain-edit-form { padding: 24px 16px; }
  .captain-edit-form .swatches { gap: 4px; }
  .captain-side { padding: 32px 24px; }
}
@media (max-width: 359px) {
  .welcome-header { gap: 8px; }
  .welcome-header .brand { font-size: 32px; }
  .welcome-header .brand-mark { width: 48px; height: 48px; }
  .topbar-right { gap: 8px; }
  .nav-streak { display: none; }
  .welcome-header .reading-settings > summary > span { display: none; }
  .welcome-header .reading-settings > summary { width: 56px; }
  .mode-card > button { padding: 20px; }
  .topic-card > button { flex-direction: column; }
  .captain-edit-form { padding-inline: 12px; }
  .swatches { gap: 0; }
  .captain-edit-form .swatches { flex-wrap: wrap; }
  .result-stats strong { font-size: 36px; }
}

/* Keep functional lights and vessel charts: only decorative artwork is removed. */
:root[data-contrast="true"] {
  --background: #fff; --surface: #fff; --surface-elevated: #fff; --surface-sunken: #fff;
  --ink: #000; --ink-muted: #000; --ink-subtle: #000; --outline: #334155; --outline-strong: #000;
  --sky: #1d4ed8; --sky-deep: #163aa3; --sky-soft: #fff; --leaf-soft: #fff; --coral-soft: #fff;
  --berry-soft: #fff; --action: #1d4ed8; --action-hover: #163aa3; --on-action: #fff; --on-accent: #fff; --on-success: #fff; --shadow: none; --active-shadow: none;
}
[data-contrast="true"] :is(.welcome-chart,.hero-chart,.mode-art,.avatar-orbit,.avatar-spark,.heading-star,.star-field) { display: none; }
[data-contrast="true"] .completion-confetti { display: none; }
[data-contrast="true"] :is(.voyage-hero,.welcome-story,.captain-side,.assessment-intro,.results-hero,.progress-card,.panel,.feedback,.answer-option,.result-reflection > section) { background: var(--background); color: var(--ink); border-color: var(--ink); }
[data-contrast="true"] :is(.eyebrow,.text-link,.question-type,.rule-pill,.pill,.nav-link,.read-button,.streak-pill,.nav-streak,.edition-tag) { color: var(--ink); }
[data-contrast="true"] .read-button { border: 2px solid var(--ink); }
[data-contrast="true"] .read-button:hover, [data-contrast="true"] .read-button[aria-pressed="true"] { color: var(--background); background: var(--ink); }
[data-contrast="true"] .nav-link.active { text-decoration: underline; text-underline-offset: 4px; outline: 2px solid var(--ink); }
[data-contrast="true"] .answer-option.correct { border: 3px solid var(--ink); }
[data-contrast="true"] .answer-option.incorrect { border: 3px dashed var(--ink); }
[data-contrast="true"] .mode-card > button { display: flex; flex-direction: column; }
[data-contrast="true"] .light-panel { background: #0f172a; }
[data-contrast="true"] .visual-panel:not(.light-panel) { border: 2px solid var(--ink); }
[data-contrast="true"] .star-badge { border-color: var(--ink); }
[data-contrast="true"] .star-badge.earned { border-width: 3px; }
[data-contrast="true"] #reading-ruler { background: rgb(0 0 0 / 8%); border-color: var(--ink); }
/* High contrast respects the chosen appearance. Exercise light colors stay fixed. */
:root[data-theme="dark"][data-contrast="true"] {
  --background: #060b13; --surface: #060b13; --surface-elevated: #060b13; --surface-sunken: #060b13;
  --ink: #fff; --ink-muted: #fff; --ink-subtle: #fff; --outline: #cbd5e1; --outline-strong: #fff;
  --sky: #93c5fd; --sky-deep: #bfdbfe; --sky-soft: #060b13; --leaf-soft: #060b13;
  --coral-soft: #060b13; --berry-soft: #060b13; --action: #93c5fd; --action-hover: #bfdbfe;
  --on-action: #060b13; --on-accent: #060b13; --on-success: #060b13;
}
[data-theme="dark"][data-contrast="true"] #reading-ruler { background: rgb(255 255 255 / 12%); }
:root[data-motion="true"] *, :root[data-motion="true"] *::before, :root[data-motion="true"] *::after {
  scroll-behavior: auto !important; animation: none !important; transition: none !important;
}
:root[data-motion="true"] .completion-confetti { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  .completion-confetti { display: none; }
}
