:root {
  color-scheme: dark;
  font-family: "Avenir Next", "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  --bg: #070f1b;
  --accent: #85e6d0;
  --secondary: #e2bd7f;
  --ink: #e9f0ef;
  --muted: #8497a7;
  --line: #bfdce215;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { min-width: 280px; background: radial-gradient(ellipse at 45% -25%, #527d9622, transparent 66%), var(--bg); transition: background-color 1s; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { border: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button:disabled { cursor: default; }
button, a { transition: color .2s, border-color .2s, background .2s, box-shadow .2s; }
button:active:not(:disabled) { transform: translateY(1px); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { height: 100vh; height: 100dvh; width: min(100%, 1600px); margin: auto; padding: 0 clamp(20px, 4vw, 64px); display: flex; flex-direction: column; }
.site-header { height: 70px; flex: 0 0 70px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 12px; font-weight: 720; letter-spacing: 2.1px; }
.brand svg { width: 30px; height: 30px; stroke-width: 1.55; color: var(--accent); }
.brand-light { margin-left: 4px; font-weight: 350; }
.header-note { color: #8ba1b4; font-size: 9px; letter-spacing: 3px; padding-right: 80px; }
.menu-button { min-height: 42px; display: flex; align-items: center; gap: 16px; padding: 4px 0 4px 16px; background: transparent; color: #b5c3cc; font-size: 11px; }
.menu-button svg { width: 21px; height: 21px; }
.menu-button:hover { color: var(--accent); }
.play-space { min-height: 0; flex: 1; display: flex; flex-direction: column; position: relative; }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); width: 540px; max-width: 75%; margin: 0 auto; flex: 0 0 78px; align-items: center; }
.hud-stat { min-width: 0; height: 39px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; position: relative; }
.hud-stat + .hud-stat:before { content: ""; position: absolute; left: 0; top: 6px; width: 1px; height: 26px; background: var(--line); }
.stat-label { font-size: 8px; font-weight: 550; letter-spacing: 2px; color: var(--muted); }
.hud-stat strong { font-size: 19px; font-weight: 500; line-height: 1; letter-spacing: 1.7px; font-variant-numeric: tabular-nums; }
.stat-suffix { font-size: 12px; letter-spacing: 1px; color: #657f94; }
.time-track { width: 58px; height: 2px; background: #b5dfeb13; position: absolute; bottom: -4px; overflow: hidden; }
.time-track i { height: 100%; display: block; background: var(--accent); width: 100%; transform-origin: left; transition: width .5s linear, background .3s; }
.timer-stat.urgent strong { color: #edaa8e; }
.timer-stat.urgent .time-track i { background: #edaa8e; }
.timer-stat.urgent { animation: urgent-breath 2s ease-in-out infinite; }
.hearts { display: flex; align-items: center; gap: 7px; height: 19px; color: var(--secondary); }
.hearts svg { width: 16px; height: 16px; fill: currentColor; stroke-width: 0; }
.hearts .lost, .hearts .empty { color: #65819b35; }
.chapter-heading { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex: 0 0 69px; padding-bottom: 13px; }
.chapter-title { display: flex; align-items: center; min-width: 0; gap: 13px; }
.chapter-roman { font-family: Georgia, "Times New Roman", serif; font-size: 27px; font-weight: 400; color: #7795ac; margin-top: 5px; }
.chapter-title h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(29px, 3.2vw, 44px); font-weight: 400; line-height: 1.1; letter-spacing: -.9px; }
.difficulty { display: inline-flex; align-items: center; color: var(--accent); font-size: 8px; letter-spacing: 1.5px; border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); border-radius: 3px; padding: 5px 7px; margin: 7px 0 0 2px; }
.chapter-whisper { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 14px; line-height: 1.5; color: #8b9fae; text-align: right; padding-top: 6px; }
.stage { position: relative; flex: 1; min-height: 0; width: 100%; isolation: isolate; background: #03091224; }
.board-frame { height: 100%; width: 100%; overflow: hidden; will-change: transform, opacity; }
#maze-canvas { display: block; height: 100%; width: 100%; outline-offset: -4px; touch-action: none; user-select: none; }
#maze-canvas:focus-visible { outline: 1px solid #87bdbb36; }
.stage-corner { position: absolute; width: 14px; height: 14px; color: #8ea7b24d; pointer-events: none; }
.top-left { left: 0; top: 0; border-left: 1px solid; border-top: 1px solid; }
.top-right { right: 0; top: 0; border-right: 1px solid; border-top: 1px solid; }
.bottom-left { left: 0; bottom: 0; border-left: 1px solid; border-bottom: 1px solid; }
.bottom-right { right: 0; bottom: 0; border-right: 1px solid; border-bottom: 1px solid; }
.targeting-banner { z-index: 3; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; max-width: calc(100% - 22px); width: max-content; padding: 10px 13px 10px 18px; border: 1px solid #b6e8db40; border-radius: 9px; background: #0c1a26ee; box-shadow: 0 8px 36px #0005; font-size: 12px; color: var(--accent); }
.targeting-banner[hidden] { display: none; }
.targeting-banner button { padding: 7px 9px; background: #ffffff09; border-radius: 4px; font-size: 10px; color: #c6d2db; white-space: nowrap; }
.targeting-banner kbd { margin-left: 4px; }
.stage-message { pointer-events: none; position: absolute; z-index: 2; bottom: 15px; left: 50%; transform: translateX(-50%); text-align: center; max-width: calc(100% - 24px); font-size: 11px; line-height: 1.5; color: #d6e8e6; background: #07111eb0; border-radius: 6px; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); text-shadow: 0 1px 3px #02070be0; }
.stage-message:not(:empty) { padding: 9px 16px; box-shadow: 0 4px 28px #0003; }
.game-bottom { flex: 0 0 86px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.exploration-status, .exit-legend { display: flex; align-items: center; gap: 13px; flex: 1 1 120px; }
.exploration-status strong { display: block; font-size: 14px; font-weight: 500; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.exploration-status small, .exit-legend small { display: block; font-size: 8px; letter-spacing: 1px; color: #7c93a6; margin-top: 6px; }
.tiny-orb { width: 7px; height: 7px; border-radius: 50%; background: var(--secondary); box-shadow: 0 0 13px color-mix(in srgb, var(--secondary) 50%, transparent); }
.powers { display: flex; align-items: center; gap: 10px; }
.power { position: relative; height: 54px; width: 145px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 9px 10px; background: #aecddd03; border: 1px solid #aac9da14; border-radius: 7px; text-align: center; color: #8ca1b1; }
.power > svg { width: 24px; height: 24px; color: var(--power-color, var(--accent)); opacity: .5; }
.power > span { min-width: 0; font-size: 11px; line-height: 1.1; text-align: center; }
.power small { display: block; color: #637c90; margin-top: 5px; font-size: 6px; font-weight: 550; line-height: 1.2; letter-spacing: .9px; }
.power kbd { position: absolute; top: 5px; left: 5px; width: 13px; height: 14px; line-height: 13px; font-size: 8px; color: #819bab; border-color: #9caaba20; }
.power .charge { position: absolute; right: 7px; top: 7px; width: 3px; height: 3px; border-radius: 50%; background: #536c7b; }
.power.bloom { --power-color: #85e6d0; }
.power.phase { --power-color: #c7acf3; }
.power.dash { --power-color: #e8bd77; }
.power.ready { border-color: color-mix(in srgb, var(--power-color) 30%, transparent); background: color-mix(in srgb, var(--power-color) 6%, transparent); color: #e0e9ea; }
.power.ready > svg, .power.active > svg { opacity: 1; }
.power.ready small, .power.active small { color: var(--power-color); }
.power.ready .charge { background: var(--power-color); box-shadow: 0 0 6px var(--power-color); }
.power.ready:hover { background: color-mix(in srgb, var(--power-color) 12%, transparent); border-color: color-mix(in srgb, var(--power-color) 60%, transparent); }
.power.active { border-color: var(--power-color); background: color-mix(in srgb, var(--power-color) 11%, transparent); color: white; }
.power.teaching { border-color: var(--power-color); outline: 3px solid color-mix(in srgb, var(--power-color) 22%, transparent); outline-offset: 4px; box-shadow: 0 0 34px color-mix(in srgb, var(--power-color) 28%, transparent); }
.power.picked { animation: pickup-pop .65s ease-out; }
.power.bloom.picked > svg { animation: bloom-turn .65s ease-out; }
.power.phase.picked > svg { animation: phase-echo .65s ease-out; }
.power.dash.picked > svg { animation: dash-rise .65s ease-out; }
@keyframes pickup-pop { 35% { transform: translateY(-3px) scale(1.05); box-shadow: 0 0 30px color-mix(in srgb, var(--power-color) 30%, transparent); border-color: var(--power-color); } }
@keyframes bloom-turn { from { transform: rotate(-110deg) scale(.65); } 55% { transform: rotate(12deg) scale(1.2); } }
@keyframes phase-echo { 30% { transform: translateX(-5px); filter: drop-shadow(9px 0 2px #c7acf3aa); } 65% { transform: translateX(3px); } }
@keyframes dash-rise { from { transform: translate(-8px, 8px) scale(.65); } 60% { transform: translate(2px, -3px) scale(1.2); } }
.power-reference { display: flex; align-items: flex-start; gap: 20px; padding: 21px 0; border-bottom: 1px solid var(--line); }
.power-reference > svg { width: 32px; height: 32px; margin-top: 5px; color: #85e6d0; }
.power-reference.phase > svg { color: #c7acf3; }
.power-reference.dash > svg { color: #e8bd77; }
.power-reference h3 { margin: 0 0 7px; font-size: 14px; font-weight: 500; }
.power-reference kbd { margin-left: 6px; }
.power-reference p { margin: 0 0 6px; font-size: 12px; color: #c2d8df; }
.power-reference small, .power-guide-note { font-size: 10px; line-height: 1.8; color: #859eae; }
.power-guide-note { margin: 15px 0; }
.exit-legend { justify-content: flex-end; font-size: 8px; letter-spacing: 1.4px; color: #a5b7c4; }
.exit-legend small { font-size: 10px; letter-spacing: 0; }
.exit-symbol { color: var(--accent); font-size: 30px; font-family: Georgia, serif; line-height: 1; }
.control-strip { flex: 0 0 27px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #758ca0; font-size: 9px; }
.desktop-hint { display: flex; align-items: center; gap: 4px; }
.desktop-hint > span { margin: 0 4px; }
.desktop-hint b { font-size: 9px; font-weight: 500; letter-spacing: 1.5px; }
.hint-rule { width: 19px; height: 1px; background: #bcd5dd30; margin: 0 10px !important; }
#journey-status { color: #637e91; font-size: 8px; letter-spacing: 2px; }
.desktop-input-hint { display: inline; }
.touch-input-hint { display: none; }
.touch-hint { display: none; }
.site-footer { flex: 0 0 43px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 7px; letter-spacing: 1.6px; color: #60798b; }
.seed-label { display: flex; align-items: center; gap: 7px; min-width: 0; }
.seed-label b { color: #8ba7b6; font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd { display: inline-block; min-width: 17px; height: 17px; padding: 0 3px; border: 1px solid #a5b6c527; border-radius: 3px; background: #a2c3d407; font: 9px/15px "Segoe UI", sans-serif; text-align: center; color: #99aebf; vertical-align: middle; }

/* Secondary UI floats over the world; game geometry does not change. */
dialog { color: var(--ink); background: linear-gradient(145deg, #142434f7, #0a1522fc 70%); border: 1px solid #adcbd42a; border-radius: 16px; padding: 32px; box-shadow: 0 28px 130px #0009, inset 0 1px #c1dfed08; width: min(640px, calc(100vw - 36px)); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow: auto; scrollbar-width: thin; scrollbar-color: #436075 #0c1925; }
dialog::backdrop { background: #020811a8; backdrop-filter: blur(9px); }
dialog[open] { animation: dialog-enter .3s cubic-bezier(.2,.8,.2,1) both; }
dialog h2 { margin: 0; color: #f0f1e9; font: 400 37px/1.1 Georgia, "Times New Roman", serif; letter-spacing: -.8px; }
#restart-journey-dialog { width: min(460px, calc(100vw - 36px)); }
#restart-journey-title { font-size: 30px; }
#restart-journey-description { color: #b3c6d3; font-size: 13px; line-height: 1.65; margin: 20px 0 24px; }
.journey-reset-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.journey-reset-actions > button { flex: 1 1 150px; min-height: 48px; }
.eyebrow { font-size: 8px; line-height: 1.6; letter-spacing: 2.3px; color: var(--accent); margin: 0 0 9px; font-weight: 500; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #b4cfde24; border-radius: 50%; background: transparent; color: #a9bccb; }
.icon-button:hover { color: white; border-color: #b4cfde70; background: #ffffff05; }
.icon-button svg { width: 18px; height: 18px; }
.menu-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.menu-tabs { display: flex; gap: 28px; margin-bottom: 23px; border-bottom: 1px solid var(--line); }
.menu-tabs button { position: relative; padding: 0 0 13px; min-height: 36px; background: transparent; color: #8ba0b3; font-size: 12px; }
.menu-tabs button[aria-selected="true"] { color: var(--accent); }
.menu-tabs button[aria-selected="true"]:after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.campaign-map { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); row-gap: 30px; padding: 4px 0 20px; }
.map-node { min-width: 0; position: relative; text-align: center; color: #5b7388; }
.map-node i { position: relative; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; margin: 0 auto 9px; border-radius: 50%; background: #0f1d2b; border: 1px solid #718ea632; color: #6a8598; font-size: 10px; font-style: normal; }
.map-node strong { display: block; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-size: 10px; line-height: 1.3; font-weight: 400; }
.map-node small { display: block; font-size: 6px; letter-spacing: 1.2px; line-height: 1.4; margin-top: 5px; color: #577186; }
.map-node:before { content: ""; position: absolute; height: 1px; width: calc(100% - 30px); left: calc(50% + 15px); top: 15px; background: #789bb12a; }
.map-node:nth-child(5):before { width: 1px; height: calc(100% + 30px); left: 50%; }
.map-node:nth-child(6) { grid-column: 5; grid-row: 2; }
.map-node:nth-child(7) { grid-column: 4; grid-row: 2; }
.map-node:nth-child(8) { grid-column: 3; grid-row: 2; }
.map-node:nth-child(9) { grid-column: 2; grid-row: 2; }
.map-node:nth-child(10) { grid-column: 1; grid-row: 2; }
.map-node:nth-child(n+6):before { left: auto; right: calc(50% + 15px); }
.map-node:nth-child(10):before { display: none; }
.map-node.done, .map-node.completed { color: #9bbcbf; }
.map-node.done i, .map-node.completed i { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: #142c31; }
.map-node.done:before, .map-node.completed:before { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.map-node.current { color: var(--ink); }
.map-node.current i { color: #07221e; background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 8%, transparent), 0 0 25px color-mix(in srgb, var(--accent) 13%, transparent); }
.map-node.current small { color: var(--accent); }
.record-row { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; }
.record-row:has(#seed-best-stat:not([hidden])) { grid-template-columns: 1fr 1fr; column-gap: 16px; }
#seed-best-stat { border-left: 1px solid var(--line); padding-left: 16px; }
#walk-path-again { width: 100%; margin-top: 14px; }
.record-row > span { font-size: 8px; color: #7b95a9; letter-spacing: 1px; }
.record-row strong { display: block; color: #d4e4e4; font-size: 24px; font-weight: 400; letter-spacing: 1px; margin-top: 7px; }
.fine-print { color: #8196a8; font-size: 10px; line-height: 1.7; margin: 12px 0; }
#seed-form { margin-top: 23px; }
#seed-form > label { display: block; font-size: 8px; color: #93a9b8; letter-spacing: 1.4px; margin-bottom: 9px; }
.seed-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seed-form-row input { grid-column: 1 / -1; min-width: 0; width: 100%; padding: 12px; border: 1px solid #aac9d928; border-radius: 6px; background: #070f1b7a; color: #e3eeeb; font-size: 12px; letter-spacing: 1px; }
.primary-button, .secondary-button { min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: 20px; border-radius: 6px; padding: 12px 18px; font-size: 12px; font-weight: 550; }
.primary-button { background: var(--accent); color: #082623; box-shadow: 0 3px 19px color-mix(in srgb, var(--accent) 8%, transparent); }
.primary-button:hover { background: color-mix(in srgb, var(--accent) 84%, white); box-shadow: 0 4px 24px color-mix(in srgb, var(--accent) 18%, transparent); }
.primary-button svg { width: 18px; height: 18px; }
.secondary-button { background: #a6c8dc08; border: 1px solid #a6c8dc2b; color: #c2d4df; white-space: nowrap; font-size: 10px; }
.secondary-button:hover { border-color: #a6c8dc60; background: #a6c8dc10; }
.pause-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: -6px 0 24px; }
.pause-actions:has(#restart-level-button[hidden]) { grid-template-columns: 1fr; }
.menu-heading { gap: 12px; }
.menu-heading h2 { font-size: clamp(28px, 5vw, 37px); }
.menu-heading .icon-button { flex-shrink: 0; }
#return-journey { margin: -16px auto 18px; }
.map-node { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 0; background: transparent; font-family: inherit; }
.map-node:disabled { cursor: default; }
.map-node:not(:disabled):hover i { box-shadow: 0 0 0 4px #e9c67b24; border-color: #e9c67b; }
.stars { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.stars .star { width: 47px; height: 47px; fill: #172b3b; stroke: #506574; stroke-width: 1.2; }
.stars .star.earned { fill: #f1c76f; stroke: #ffe1a1; filter: drop-shadow(0 0 9px #eeb65035); }
.compact-stars { gap: 3px; }
.compact-stars .star { width: 13px; height: 13px; }
.map-node .compact-stars { display: flex; margin-top: 7px; }
.map-node .map-best-score { color: #b5c8cc; font-size: 7px; letter-spacing: .3px; }
.story-card.result-card { padding: 29px 32px 23px; }
.result-card > .stars { margin: 9px 0 18px; }
.result-card > .stars .earned { animation: star-arrive .45s calc(var(--star-index) * .12s) both; }
.story-card.result-card h2 { font-size: 32px; margin-bottom: 8px; }
.result-message { font-size: 12px; color: #a5bbc9; margin: 0 0 21px; }
.result-points strong { display: block; color: #edf1e8; font-size: 29px; font-weight: 450; font-variant-numeric: tabular-nums; }
.result-points strong span { font-size: 19px; color: #8ea8ba; }
.result-points small, .result-stats span { display: block; font-size: 8px; letter-spacing: 1.2px; color: #8ba7b9; margin-top: 5px; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; margin: 19px 0 15px; padding: 14px 0; border-block: 1px solid var(--line); }
.result-stats > div + div { border-left: 1px solid var(--line); }
.result-stats strong { font-size: 21px; font-weight: 450; color: var(--accent); font-variant-numeric: tabular-nums; }
.result-best { width: 100%; min-height: 28px; padding: 0; background: transparent; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 12px; row-gap: 6px; font-size: 8px; letter-spacing: 1.2px; color: #91a7b5; }
.score-details { margin: 14px 0; text-align: left; color: #91a7b5; font-size: 11px; }
.score-details summary { cursor: pointer; padding: 8px 0; }
.score-details summary b { float: right; color: #d7e3df; font-weight: 500; }
.score-details .breakdown { margin: 3px 0 8px; }
@keyframes star-arrive { from { opacity: .1; transform: scale(.65) rotate(-10deg); } to { opacity: 1; transform: none; } }
@media (max-width: 400px), (max-height: 650px) {
  .story-card.result-card { padding: 21px 20px 17px; }
  .result-card > .stars { margin: 4px 0 12px; }
  .result-card > .stars .star { width: 35px; height: 35px; }
  .story-card.result-card h2 { font-size: 27px; }
  .result-message { margin-bottom: 14px; font-size: 11px; }
  .result-stats { margin: 13px 0 12px; padding: 11px 0; }
  .result-stats span { font-size: 7px; letter-spacing: .6px; }
  .score-details { margin: 9px 0; }
  .map-node .compact-stars { gap: 2px; }
  .map-node .compact-stars .star { width: 10px; height: 10px; }
}
.guide-intro { display: flex; gap: 22px; align-items: center; padding: 0 0 18px; }
.guide-intro p { font: 20px/1.35 Georgia, serif; margin: 0; color: #cfe0df; }
.guide-orb { width: 19px; height: 19px; border-radius: 50%; margin: 0 12px; background: #e9fff1; box-shadow: 0 0 10px #94e8d5, 0 0 35px #85e6d060; }
.guide-list p { color: #97afbf; font-size: 11px; line-height: 1.8; margin: 0 0 14px; }
.guide-list strong { display: block; color: #e0e8e7; font-size: 12px; font-weight: 500; margin-bottom: 3px; }
.guide-list b { color: #bdd0d8; font-weight: 500; }
.scoring-guide { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; row-gap: 11px; padding: 18px 0; margin: 3px 0 18px; border-block: 1px solid var(--line); }
.scoring-guide span { display: flex; justify-content: space-between; gap: 9px; color: #8fa5b6; font-size: 10px; }
.scoring-guide b { color: #d8dfca; font-weight: 500; font-variant-numeric: tabular-nums; }
.settings-list { padding: 0 0 8px; }
.settings-list label { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 21px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.settings-list label:first-child { padding-top: 5px; }
.settings-list strong { color: #dae6e6; font-weight: 500; font-size: 13px; }
.settings-list small { display: block; margin-top: 5px; color: #809aad; font-size: 11px; line-height: 1.5; }
.settings-list input { appearance: none; flex: 0 0 38px; width: 38px; height: 22px; border: 1px solid #97b6c933; border-radius: 12px; background: #203448; position: relative; cursor: pointer; transition: background .2s; }
.settings-list input:after { content: ""; display: block; position: absolute; width: 14px; height: 14px; top: 3px; left: 3px; border-radius: 50%; background: #90a8b9; transition: transform .2s, background .2s; }
.settings-list input:checked { background: color-mix(in srgb, var(--accent) 24%, #0c1b24); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.settings-list input:checked:after { transform: translateX(16px); background: var(--accent); }
#story-dialog { width: min(478px, calc(100vw - 36px)); padding: 0; overflow: auto; }
.story-card { position: relative; text-align: center; padding: 37px 36px 30px; overflow: hidden; }
.story-card:before { content: ""; z-index: -1; position: absolute; width: 300px; height: 210px; left: calc(50% - 150px); top: -100px; pointer-events: none; background: radial-gradient(ellipse, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%); }
.story-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 20px; color: var(--accent); }
.story-icon svg { width: 42px; height: 42px; stroke-width: 1.2; }
.story-icon.light { width: 21px; height: 21px; margin: 14px auto 31px; border-radius: 50%; background: #e9fff4; box-shadow: 0 0 13px #a2f2dd, 0 0 39px #76e8ca60, 0 0 80px #7cdac02a; }
.story-card h2 { font-size: 39px; margin: 0 0 16px; }
.story-description { font-size: 12px; line-height: 1.9; color: #a5bbc9; margin: 0 auto 22px; max-width: 350px; }
.story-description strong { color: #d7e5e6; font-weight: 500; }
.lesson-controls { display: flex; justify-content: center; flex-wrap: wrap; align-items: center; gap: 7px; margin: 18px 0 24px; font-size: 10px; line-height: 1.7; color: #9bb4c5; }
.lesson-controls kbd { min-width: 25px; height: 25px; line-height: 23px; font-size: 10px; }
.story-card > .primary-button { width: 100%; }
.story-card > .secondary-button { width: 100%; margin-top: 8px; }
.story-card > small { display: block; color: #829aaa; font-size: 8px; letter-spacing: 1.5px; }
.secondary-link { display: block; min-height: 40px; margin: 9px auto -7px; padding: 9px 12px; color: #9ab7c7; background: transparent; font-size: 10px; }
.secondary-link:hover { color: var(--accent); }
.story-footnote { color: #738fa3; font-size: 9px; line-height: 1.6; margin: 14px 0 0; }
.breakdown { margin: 21px 0 23px; text-align: left; border-top: 1px solid var(--line); padding-top: 9px; }
.breakdown > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; color: #8fa8ba; font-size: 11px; }
.breakdown b { color: #dce7e5; font-weight: 500; font-variant-numeric: tabular-nums; }
.breakdown .total { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 9px; color: #dbe7e4; }
.breakdown .total b { color: var(--accent); font-size: 17px; }
.mini-map { display: flex; justify-content: center; align-items: center; gap: 13px; margin: 22px 0; }
.mini-map i { display: block; position: relative; width: 6px; height: 6px; border: 1px solid #597a8f; border-radius: 50%; background: #172a39; }
.mini-map i:not(:last-child):after { content: ""; position: absolute; top: 2px; left: 6px; width: 12px; height: 1px; background: #597a8f50; }
.mini-map i.done { background: var(--accent); border-color: var(--accent); }
.mini-map i.current { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
.final-score { font-size: 42px; font-weight: 350; color: var(--accent); letter-spacing: 2px; margin: 20px 0 7px; font-variant-numeric: tabular-nums; }
.finale .story-icon { color: #e9dfad; filter: drop-shadow(0 0 12px #e9dfad35); }
.finale:after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 0 5%, #bc96db0e, transparent 45%), radial-gradient(ellipse at 100% 10%, #cbb27912, transparent 45%); }
.board-frame.slide-out { animation: board-out .42s cubic-bezier(.55,0,.8,.45) both; }
.board-frame.slide-in { animation: board-in .52s cubic-bezier(.15,.6,.25,1) both; }
@keyframes board-out { to { transform: translateX(-105%); opacity: .15; } }
@keyframes board-in { from { transform: translateX(105%); opacity: .15; } to { transform: translateX(0); opacity: 1; } }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes urgent-breath { 50% { opacity: .72; } }

@media (max-width: 1000px) {
  .app-shell { padding-inline: clamp(16px, 2.5vw, 24px); }
  .header-note { padding-right: 40px; }
  .chapter-whisper { font-size: 12px; max-width: 240px; }
  .power { width: 134px; padding-right: 11px; gap: 8px; }
  .game-bottom { gap: 12px; }
  .exploration-status, .exit-legend { flex-basis: 100px; gap: 9px; }
  .exit-legend { font-size: 7px; letter-spacing: .8px; }
  .exit-legend small { font-size: 9px; }
}
@media (max-width: 760px) {
  .app-shell { padding-inline: 18px; }
  .site-header { height: 52px; flex-basis: 52px; }
  .brand { font-size: 10px; letter-spacing: 1.7px; gap: 8px; }
  .brand svg { width: 25px; height: 25px; }
  .header-note { display: none; }
  .menu-button { gap: 10px; font-size: 10px; }
  .hud { max-width: none; width: min(100%, 440px); flex-basis: 62px; }
  .hud-stat strong { font-size: 17px; letter-spacing: 1px; }
  .hud-stat { height: 35px; gap: 6px; }
  .stat-label { font-size: 7px; letter-spacing: 1.5px; }
  .stat-suffix { font-size: 10px; }
  .hearts { gap: 5px; }
  .hearts svg { width: 14px; height: 14px; }
  .chapter-heading { flex-basis: 56px; padding-bottom: 12px; }
  .chapter-title { gap: 8px; }
  .chapter-title h1 { font-size: 32px; }
  .chapter-roman { font-size: 22px; margin-top: 4px; }
  .difficulty { font-size: 7px; padding: 4px 6px; letter-spacing: 1px; margin-top: 5px; }
  .chapter-whisper { display: none; }
  .game-bottom { flex-basis: 70px; justify-content: center; gap: 15px; }
  .exit-legend { display: none; }
  .exploration-status { flex: 0 1 auto; }
  .exploration-status strong { font-size: 11px; }
  .exploration-status small { font-size: 6px; letter-spacing: .6px; }
  .powers { gap: 7px; }
  .power { width: 119px; height: 50px; padding: 7px 7px; gap: 7px; }
  .power > svg { width: 20px; height: 20px; }
  .power > span { font-size: 10px; }
  .power small { font-size: 5px; letter-spacing: .6px; }
  .control-strip { flex-basis: 21px; }
  .desktop-hint { font-size: 8px; }
  #journey-status { font-size: 6px; letter-spacing: 1.4px; }
  .site-footer { flex-basis: 27px; font-size: 6px; letter-spacing: .9px; }
}
@media (max-width: 560px) {
  .app-shell { padding-inline: 14px; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .site-header { flex-basis: 46px; }
  .hud { flex-basis: 55px; }
  .chapter-heading { flex-basis: 51px; padding-bottom: 10px; }
  .chapter-title h1 { font-size: 30px; }
  .chapter-roman { font-size: 21px; }
  .game-bottom { flex-basis: 66px; gap: 0; }
  .powers { width: 100%; justify-content: space-between; gap: 6px; }
  .power { width: auto; min-width: 0; flex: 1; max-width: 160px; height: 48px; padding: 7px 5px; gap: 5px; }
  .power > svg { width: 18px; height: 18px; }
  .power > span { font-size: 10px; }
  .power small { font-size: 5px; letter-spacing: .25px; }
  .power kbd { left: 4px; top: 4px; min-width: 11px; width: 11px; height: 12px; line-height: 11px; font-size: 7px; }
  .power .charge { top: 5px; right: 5px; }
  .exploration-status { position: absolute; top: 76px; right: 2px; gap: 6px; white-space: nowrap; }
  .exploration-status small { display: none; }
  .exploration-status strong { font-size: 9px; letter-spacing: .3px; }
  .tiny-orb { width: 5px; height: 5px; }
  .control-strip { display: none; }
  .site-footer { justify-content: center; flex-basis: 23px; }
  .site-footer > span:first-child { display: none; }
  .seed-label { justify-content: center; font-size: 6px; letter-spacing: .9px; }
  .seed-label b { max-width: 85px; }
  dialog { padding: 24px 21px; width: calc(100vw - 26px); max-height: calc(100dvh - 26px); border-radius: 13px; }
  dialog h2 { font-size: 33px; }
  .menu-heading { margin-bottom: 22px; }
  .menu-tabs { gap: 24px; margin-bottom: 22px; }
  .menu-tabs button { font-size: 11px; }
  .campaign-map { row-gap: 25px; }
  .map-node i { width: 25px; height: 25px; font-size: 9px; margin-bottom: 8px; }
  .map-node strong { font-size: 7px; }
  .map-node small { font-size: 5px; letter-spacing: .6px; }
  .map-node:before { width: calc(100% - 25px); left: calc(50% + 12.5px); top: 12px; }
  .map-node:nth-child(5):before { height: calc(100% + 25px); }
  .map-node:nth-child(n+6):before { right: calc(50% + 12.5px); }
  .record-row { padding: 14px 0; }
  .record-row > span { font-size: 7px; }
  .record-row strong { font-size: 23px; }
  .seed-form-row { grid-template-columns: 1fr; }
  .seed-form-row .secondary-button { width: 100%; }
  .story-card { padding: 30px 24px 25px; }
  .story-card h2 { font-size: 33px; }
  .story-description { font-size: 11px; }
  .settings-list { padding-bottom: 0; }
  .settings-list small { font-size: 10px; }
  .scoring-guide { column-gap: 18px; }
  .scoring-guide span { font-size: 9px; }
  .targeting-banner { font-size: 10px; gap: 10px; padding: 7px 9px 7px 12px; }
}
@media (max-width: 560px) and (max-height: 680px) {
  .app-shell { padding-inline: 10px; }
  .site-header { flex-basis: 40px; }
  .brand { font-size: 9px; }
  .brand svg { width: 23px; height: 23px; }
  .menu-button { min-height: 35px; }
  .hud { flex-basis: 48px; }
  .hud-stat { height: 32px; gap: 5px; }
  .hud-stat strong { font-size: 15px; }
  .stat-label { font-size: 6px; letter-spacing: 1.2px; }
  .time-track { width: 44px; bottom: -2px; }
  .chapter-heading { flex-basis: 42px; padding-bottom: 8px; }
  .chapter-title h1 { font-size: 26px; }
  .chapter-roman { font-size: 18px; }
  .difficulty { font-size: 6px; padding: 4px 5px; }
  .exploration-status { top: 65px; }
  .game-bottom { flex-basis: 59px; }
  .power { height: 44px; }
  .site-footer { flex-basis: 20px; }
  .story-card { padding: 25px 22px 23px; }
  .story-icon { margin-bottom: 14px; }
  .story-icon.light { margin-top: 6px; margin-bottom: 22px; }
  .story-description { margin-bottom: 16px; }
  .lesson-controls { margin-block: 12px 18px; }
}
@media (max-width: 360px) {
  .chapter-title { gap: 6px; }
  .chapter-title h1 { font-size: 25px; }
  .power { padding-inline: 3px; gap: 4px; }
  .power > svg { width: 16px; height: 16px; }
  .power > span { font-size: 9px; }
  .power small { font-size: 4.6px; letter-spacing: .05px; }
  .power kbd { left: 3px; top: 3px; width: 10px; min-width: 10px; }
  .exploration-status { gap: 4px; }
  .exploration-status strong { font-size: 8px; }
  .difficulty { letter-spacing: .6px; }
}
@media (max-width: 560px) {
  /* Keep point progress clear of longer chapter names on narrow boards. */
  .exploration-status { top: -25px; right: 66px; }
}
@media (pointer: coarse) and (min-width: 561px) and (min-height: 501px) {
  .desktop-hint { display: none; }
  .touch-hint { display: inline; }
}
@media (pointer: coarse), (max-width: 760px) {
  .desktop-input-hint, .desktop-hint, .power > kbd, .power-reference h3 > kbd { display: none !important; }
  .touch-input-hint, .touch-hint { display: inline !important; }
  .power { min-height: 44px; }
}
@media (max-height: 500px) and (min-width: 561px) {
  .app-shell { padding: 0 18px; }
  .site-header { flex-basis: 40px; }
  .brand { font-size: 9px; gap: 6px; letter-spacing: 1px; }
  .brand svg { width: 23px; height: 23px; }
  .header-note { display: none; }
  .menu-button { min-height: 34px; }
  .hud { position: absolute; z-index: 1; top: -36px; left: 50%; transform: translateX(-50%); width: min(330px, 45vw); max-width: none; height: 30px; }
  .hud-stat { height: 27px; gap: 4px; }
  .stat-label { font-size: 5px; letter-spacing: 1px; }
  .hud-stat strong { font-size: 13px; letter-spacing: .6px; }
  .stat-suffix { font-size: 8px; }
  .hud-stat + .hud-stat:before { height: 19px; top: 3px; }
  .hearts { height: 13px; gap: 3px; }
  .hearts svg { width: 11px; height: 11px; }
  .time-track { bottom: -1px; height: 1px; width: 36px; }
  .chapter-heading { flex-basis: 33px; padding-bottom: 6px; }
  .chapter-title { gap: 8px; }
  .chapter-title h1 { font-size: 23px; }
  .chapter-roman { font-size: 17px; margin-top: 2px; }
  .difficulty { font-size: 5px; padding: 3px 5px; margin-top: 3px; }
  .chapter-whisper { display: block; font-size: 10px; padding-top: 0; }
  .game-bottom { flex-basis: 48px; gap: 12px; }
  .power { width: 120px; height: 35px; padding-top: 4px; padding-bottom: 4px; }
  .power > svg { height: 18px; width: 18px; }
  .power > span { font-size: 9px; }
  .power small { margin-top: 3px; font-size: 5px; }
  .power kbd { font-size: 6px; height: 11px; line-height: 10px; min-width: 11px; width: 11px; }
  .exploration-status { position: static; flex-basis: 90px; }
  .exploration-status strong { font-size: 10px; }
  .exploration-status small { font-size: 5px; margin-top: 3px; }
  .exit-legend { display: flex; font-size: 6px; flex-basis: 90px; }
  .exit-legend small { font-size: 7px; margin-top: 3px; }
  .exit-symbol { font-size: 23px; }
  .control-strip, .site-footer { display: none; }
  .story-card { padding: 22px 27px; }
  .story-icon { margin-bottom: 12px; height: 36px; }
  .story-icon.light { height: 17px; width: 17px; margin: 2px auto 18px; }
  .story-card h2 { font-size: 30px; margin-bottom: 12px; }
  .story-description { margin-bottom: 13px; font-size: 11px; }
  .lesson-controls { margin: 12px 0 16px; }
}
.tutorial-card .story-description { font-size: 13px; line-height: 1.75; }
.tutorial-card h2 { font-size: 32px; }
.tutorial-card .story-icon { margin-bottom: 14px; }
.lesson-basics { text-align: left; border-top: 1px solid var(--line); margin: -6px 0 18px; }
.lesson-basics p { margin: 13px 0 0; font-size: 12px; line-height: 1.65; color: #a5bbc9; }
.lesson-basics strong { display: block; color: #d7e5e6; font-weight: 550; margin-bottom: 3px; }
.lesson-paused { color: var(--accent); font-size: 11px; margin: 0 0 15px; }
@media (max-width: 400px), (max-height: 650px) {
  .tutorial-card.story-card { padding: 20px; }
  .tutorial-card .story-icon.light { margin: 2px auto 18px; }
  .tutorial-card .story-description { margin-bottom: 16px; }
  .tutorial-card h2 { font-size: 28px; }
}
@media (min-width: 500px) and (max-height: 450px) {
  #story-dialog:has(.tutorial-card) { width: min(600px, calc(100vw - 36px)); }
  .tutorial-card.story-card { padding: 10px 24px; }
  .tutorial-card .story-icon { display: none; }
  .tutorial-card h2 { font-size: 26px; margin-bottom: 10px; }
  .tutorial-card .story-description { max-width: none; margin-bottom: 13px; }
  .lesson-basics { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 13px; }
  .lesson-basics p { margin-top: 10px; }
  .tutorial-card .lesson-paused { margin-bottom: 10px; }
  .tutorial-card .story-footnote { margin-top: 10px; }
}
.reduced-motion *, .reduced-motion *:before, .reduced-motion *:after { animation-delay: 0s !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation-delay: 0s !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
