:root {
  color-scheme: light;
  --paper: #f5f1e7;
  --ink: #203a3b;
  --body: #303d3c;
  --sea: #294d50;
  --muted: #596a68;
  --copper: #7b5936;
  --line: #b7b2a3;
  font-family: "Noto Sans KR", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

body {
  margin: 0;
  color: var(--body);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.65;
}

button, select, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--copper);
  outline-offset: 4px;
}

[hidden] { display: none !important; }

.page-shell { max-width: 1488px; margin: auto; padding: 0 54px; }

.masthead {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.masthead::after { content: ""; position: absolute; width: 260px; height: 3px; left: 0; bottom: -2px; background: var(--sea); }
.wordmark { color: var(--ink); text-decoration: none; font: 700 28px/1.2 "Batang", serif; white-space: nowrap; }
.edition { font-size: 13px; color: var(--copper); letter-spacing: .08em; }
.masthead .text-button { margin-left: auto; }
.masthead .sound { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.masthead .sound .text-button, .masthead .sound ~ .text-button { margin-left: 0; }
.masthead .sound .text-button[aria-pressed="false"] { color: var(--muted); border-bottom-style: dashed; }
.sound input { width: 84px; accent-color: var(--sea); }
.text-button { border: 0; border-bottom: 1px solid currentColor; background: transparent; color: var(--sea); padding: 8px 0; border-radius: 0; }
.text-button:hover { color: #102b2d; }

.eyebrow { margin: 0; color: var(--copper); font-size: 13px; font-weight: 700; letter-spacing: .12em; }
h1, h2, p, figure { margin-top: 0; }
h1, h2 { color: var(--ink); font-family: "Batang", "Noto Serif KR", serif; }

.intro { display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr); gap: clamp(28px, 4vw, 64px); align-items: center; min-height: calc(100dvh - 72px); padding: 22px 0; }
.intro-hero, .intro-setup { min-width: 0; }
.intro-hero h1 { margin: 12px 0 14px; font-size: clamp(32px, 2.9vw, 48px); font-weight: 700; line-height: 1.3; letter-spacing: -.055em; }
.intro .lead { margin-bottom: 0; font-size: 16px; line-height: 1.6; }
.lead { color: var(--body); font-size: 19px; line-height: 1.8; max-width: 37em; }
.scope-note { max-width: 38em; margin: 14px 0 18px; padding-left: 12px; border-left: 2px solid var(--copper); color: var(--muted); font-size: 13px; line-height: 1.55; }
.intro-art { margin: 0; }
.intro-art img { aspect-ratio: 16 / 9; max-height: 30vh; }
.intro-art img, .scene-art img, .ending-art img { display: block; width: 100%; height: auto; object-fit: cover; border: 1px solid var(--line); }
.intro-art figcaption, .scene-art figcaption { margin-top: 7px; color: var(--muted); font-size: 12px; }

.mode-select, .profile-select { padding: 0; margin: 0; border: 0; }
.mode-select legend { padding: 0 0 6px; color: var(--copper); font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--sea); }
.mode-option { position: relative; cursor: pointer; }
.mode-option + .mode-option { border-left: 1px solid var(--sea); }
.mode-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mode-option span { display: block; padding: 9px 8px; color: var(--sea); text-align: center; font-size: 15px; font-weight: 700; line-height: 1.35; }
.mode-option input:checked + span { background: var(--sea); color: #fff; }
.mode-option input:focus-visible + span { position: relative; z-index: 1; outline: 3px solid var(--copper); outline-offset: 2px; }
.mode-description { margin: 7px 0 13px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.profile-select legend { padding: 0; color: var(--ink); font: 700 21px "Batang", serif; }
.profile-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 5px 0 11px; }
.profile-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.profile-toolbar .text-button { flex: 0 0 auto; padding: 2px 0; font-size: 13px; white-space: nowrap; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 13px; }
.profile-row { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.profile-row label { color: var(--ink); font-size: 13px; font-weight: 700; }
.profile-row select, .profile-row input { width: 100%; min-height: 38px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); }
.profile-row select:disabled { color: var(--muted); }
.profile-row input { margin-top: 3px; }
.profile-hint { color: var(--muted); font-size: 11px; line-height: 1.25; }
.profile-error { margin: 10px 0 0; color: #7b3e2f; font-weight: 700; }
.intro-actions, .ending-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.intro-actions { margin-top: 16px; }
.intro-screen .footer { display: none; }
.game-screen .footer { display: none; }

.primary-button, .secondary-button { min-height: 50px; padding: 11px 20px; border-radius: 0; font-weight: 700; }
.primary-button { border: 1px solid var(--sea); background: var(--sea); color: #fff; display: inline-flex; align-items: center; gap: 38px; justify-content: space-between; }
.primary-button:hover { background: #193b3d; }
.secondary-button { border: 1px solid var(--sea); background: transparent; color: var(--sea); }
.secondary-button:hover { background: #e9e8df; }
.storage-message { margin-top: 17px; color: #7b3e2f; font-size: 14px; }
.file-warning { margin: 18px 0 0; padding: 10px 14px; border-left: 2px solid #7b3e2f; color: #7b3e2f; }
.file-warning code { font-size: .95em; overflow-wrap: anywhere; }
.primary-button:disabled { cursor: not-allowed; opacity: .55; }
.save-warning { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); color: #7b3e2f; font-size: 14px; }

.game { padding-top: 12px; }
.game-topline { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 9px; }
.age-timeline { margin: 0 0 11px; }
.age-timeline-labels { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; color: var(--muted); font-size: 13px; }
.age-timeline-labels strong { color: var(--sea); font-size: 17px; }
.age-timeline-labels span:last-child { text-align: right; }
.age-track { height: 7px; margin-top: 8px; background: var(--line); }
.age-track span { display: block; height: 100%; width: 0; background: var(--sea); transition: width .3s ease-out; }
.route-trail { display: flex; align-items: baseline; gap: 10px; min-width: 0; margin: -3px 0 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.route-trail span { flex: 0 0 auto; color: var(--copper); font-weight: 700; }
.route-trail strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.crew-fx { flex: 0 0 auto; width: 38px; height: 14px; margin-left: -3px; align-self: center; image-rendering: pixelated; }
/* The full route fills the bar's width; older stops are clipped on the left so the latest stop stays visible. */
#route-trail { flex: 1 1 auto; display: flex; justify-content: flex-end; text-overflow: clip; }
.playback { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.playback select { min-height: 38px; border: 1px solid var(--line); padding: 5px 29px 5px 9px; border-radius: 0; background: var(--paper); color: var(--ink); }
.scene-layout { display: grid; grid-template-columns: minmax(0, 1.43fr) minmax(360px, 1fr); gap: 28px; align-items: start; transform: translateZ(0); backface-visibility: hidden; }
.scene-layout.scene-enter { animation: none; }
.scene-layout.scene-enter .scene-copy { animation: scene-text-enter .22s ease-out; }
.scene-layout.scene-shake { animation: scene-shake .35s ease-out; }
@keyframes scene-text-enter { 0% { opacity: .75; } 100% { opacity: 1; } }
@keyframes scene-shake { 0% { transform: translate(-4px, 2px); } 25% { transform: translate(4px, -2px); } 50% { transform: translate(-2px, 1px); } 75% { transform: translate(2px, -1px); } 100% { transform: translate(0, 0); } }
.scene-art { position: relative; margin: 0; overflow: hidden; border: 1px solid var(--line); background: #18282b; }
.scene-art img { aspect-ratio: 1672 / 941; height: min(44vh, 400px); border: 0; animation: art-breathe 14s ease-in-out infinite alternate; transform: translateZ(0); backface-visibility: hidden; }
@keyframes art-breathe { 0% { transform: scale(1) translate(0, 0); } 100% { transform: scale(1.045) translate(-1%, -.6%); } }
.scene-art[data-tone="canon"] { border-color: #b88b32; box-shadow: 0 0 24px rgba(200, 150, 30, .24); }
.scene-art[data-tone="storm"] { border-color: #465a65; box-shadow: inset 0 0 36px rgba(14, 24, 32, .45); }
.scene-art[data-tone="fire"] { border-color: #a04028; box-shadow: 0 0 26px rgba(192, 57, 43, .28); }
.scene-badge { position: absolute; left: 10px; top: 10px; z-index: 2; padding: 3px 9px; background: rgba(20, 34, 36, .82); border: 1px solid rgba(255, 255, 255, .28); color: #f6efe0; font-size: 11px; font-weight: 700; letter-spacing: .04em; animation: badge-enter .28s ease-out; }
@keyframes badge-enter { 0% { opacity: 0; transform: translateY(-4px); } 100% { opacity: 1; transform: translateY(0); } }
.scene-art[data-tone="canon"] .scene-badge { background: rgba(124, 88, 18, .88); border-color: #f0c96b; }
.scene-art[data-tone="storm"] .scene-badge, .scene-art[data-tone="fire"] .scene-badge { background: rgba(118, 30, 24, .88); border-color: #f39c8f; }
.scene-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.scene-fx span { position: absolute; left: var(--x); animation-delay: var(--d); animation-duration: var(--t); animation-iteration-count: infinite; animation-timing-function: linear; }
.scene-art[data-tone="calm"] .scene-fx span, .scene-art[data-tone="canon"] .scene-fx span { bottom: -10px; width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 248, 220, .75); box-shadow: 0 0 8px rgba(255, 232, 160, .85); animation-name: fx-rise; }
.scene-art[data-tone="canon"] .scene-fx span { width: 6px; height: 6px; background: #ffe08a; box-shadow: 0 0 10px #f5b935; }
.scene-art[data-tone="fire"] .scene-fx span { bottom: -10px; width: 5px; height: 5px; border-radius: 50%; background: #ff7b3b; box-shadow: 0 0 10px #ff3b1f; animation-name: fx-rise; }
.scene-art[data-tone="snow"] .scene-fx span { top: -10px; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .9); box-shadow: 0 0 6px #fff; animation-name: fx-fall; }
.scene-art[data-tone="storm"] .scene-fx span { top: -30px; width: 1.5px; height: 26px; background: linear-gradient(transparent, rgba(215, 232, 245, .75)); transform: rotate(16deg); animation-name: fx-rain; }
@keyframes fx-rise { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 25% { opacity: .85; } 100% { transform: translate(14px, -220px) scale(1.1); opacity: 0; } }
@keyframes fx-fall { 0% { transform: translate(0, 0); opacity: 0; } 20% { opacity: .9; } 100% { transform: translate(-22px, 340px); opacity: 0; } }
@keyframes fx-rain { 0% { transform: translate(0, 0) rotate(16deg); opacity: 0; } 20% { opacity: .85; } 100% { transform: translate(-90px, 420px) rotate(16deg); opacity: 0; } }
.scene-copy { min-width: 0; }
.scene-copy h1 { margin: 7px 0 0; padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: clamp(27px, 2.2vw, 34px); line-height: 1.28; letter-spacing: -.04em; }
.scene-copy h1:focus { outline: none; }
.scene-body { margin: 13px 0 15px; font-size: 16px; line-height: 1.6; white-space: pre-line; word-break: keep-all; overflow-wrap: anywhere; }
.observation-timeline { margin: 0 0 12px; }
.observation-head, .stat-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.observation-head { margin-bottom: 8px; color: var(--muted); font-size: 14px; }
.observation-head strong { color: var(--sea); }
.observation-track { height: 8px; background: #d7d3c8; overflow: hidden; }
.observation-track span { display: block; height: 100%; width: 0; background: var(--sea); }
.growth-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-bottom: 9px; }
.stats-panel { min-width: 0; padding: 7px 0 9px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats-panel h2 { margin: 0 0 7px; font-size: 16px; }
.stats-panel h2 small { color: var(--muted); font: 400 11px/1.3 sans-serif; }
.personality-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.personality-heading strong { color: var(--sea); font-size: 12px; font-weight: 700; text-align: right; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px 10px; }
.stat { min-width: 0; }
.stat-head { margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.stat-head strong { color: var(--ink); white-space: nowrap; }
.stat-track { height: 6px; background: #d7d3c8; overflow: hidden; }
.stat-track span { display: block; height: 100%; background: var(--stat-color); }
.stat-skill { --stat-color: #326e6a; }
.stat-health { --stat-color: #a04b43; }
.stat-supplies { --stat-color: #a06d31; }
.stat-bond { --stat-color: #79618d; }
.stat-friendBond { --stat-color: #697e42; }
.stat-trust { --stat-color: #4d6e9a; }
.trait-empathy { --stat-color: #ab664f; }
.trait-ambition { --stat-color: #a37735; }
.trait-loyalty { --stat-color: #6a618f; }
.trait-caution { --stat-color: #4b7a78; }
.trait-freedom { --stat-color: #4d6e9a; }
.scene-result { margin: 8px 0 0; border-left: 2px solid var(--copper); padding: 4px 0 4px 10px; color: var(--sea); font-size: 13px; }
.choices { border-top: 1px solid var(--line); }
.game.many-choices .choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.game.many-choices .choice:nth-child(odd) { border-right: 1px solid var(--line); }
.choice { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 6px 8px; background: transparent; color: var(--ink); }
.choice:hover, .choice:focus-visible { background: #ebe9df; }
.crew-name-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.crew-name-form label { width: 100%; font-weight: 700; }
.crew-name-form input { flex: 1 1 180px; min-height: 38px; border: 1px solid var(--line); padding: 5px 9px; background: var(--paper); color: var(--ink); }
.choice:disabled { cursor: not-allowed; background: #e7e4dd; color: #777c78; }
.choice:disabled small, .choice:disabled .choice-arrow { color: #858a84; }
.choice strong { display: block; font-size: 15px; font-weight: 700; }
.choice small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.choice-arrow { color: var(--copper); font-size: 21px; flex: 0 0 auto; }
.growth-toggle { display: none; }
.growth-toggle.fx-hit { animation: fx-hit .7s ease-out; }
.choice-copy { flex: 1 1 auto; min-width: 0; }
/* Dice terms sit in the button's empty right side instead of the condition line. */
.choice-dice { flex: 0 0 132px; display: flex; flex-direction: column; gap: 1px; border-left: 1px solid var(--line); padding: 2px 0 2px 10px; text-align: left; }
.choice-dice b { color: var(--copper); font-size: 13px; font-weight: 700; }
.choice-dice small { margin: 0; font-size: 11px; line-height: 1.3; }
/* In the two-column layout the dice terms move under the choice text so the label keeps its width. */
.game.many-choices .choice { flex-wrap: wrap; }
.game.many-choices .choice-copy { flex: 1 1 0; }
.game.many-choices .choice-dice { order: 3; flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; gap: 2px 8px; border-left: 0; border-top: 1px dashed var(--line); padding: 4px 0 0; }
/* Rises read green with a plus, drops read red with a minus, everywhere a change is shown. */
.stat-delta { margin-left: 6px; padding: 0 5px; border-radius: 9px; font-style: normal; font-weight: 800; font-size: 12px; animation: delta-pop 3s ease-out forwards; }
.stat-delta.up { color: #fff; background: #2f8f4e; }
.stat-delta.down { color: #fff; background: #c0392b; }
@keyframes delta-pop { 0% { opacity: 0; transform: scale(.6); } 10% { opacity: 1; transform: scale(1.15); } 20% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.fx-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(12, 22, 26, 0); transition: background .3s ease; cursor: pointer; will-change: background-color, opacity; transform: translateZ(0); backface-visibility: hidden; contain: layout style; }
.fx-overlay.show { background: rgba(12, 22, 26, .58); }
.fx-overlay.bursting { background: rgba(12, 22, 26, .3); transition: background .6s ease; }
.fx-overlay.leaving { background: rgba(12, 22, 26, 0); transition: background .25s ease; }
.fx-card { min-width: 260px; max-width: min(460px, 88vw); padding: 18px 24px 14px; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateZ(0) scale(.86); transition: opacity .28s ease, transform .28s ease; will-change: transform, opacity; backface-visibility: hidden; }
.fx-overlay.show .fx-card { opacity: 1; transform: scale(1); }
/* Rows dissolve into particles while the card shrinks into #scene-result. */
.fx-overlay.bursting .fx-card ul, .fx-overlay.bursting .fx-hint { opacity: 0; transition: opacity .2s ease; }
.fx-title { margin: 0 0 8px; color: var(--copper); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.fx-outcome { margin: 0 0 12px; color: var(--ink); font: 700 16px/1.55 "Batang", "Noto Serif KR", serif; word-break: keep-all; }
.fx-card ul { margin: 0; padding: 8px 0 0; border-top: 1px solid var(--line); list-style: none; }
.fx-card li { display: flex; justify-content: space-between; gap: 18px; padding: 3px 0; font-size: 15px; color: var(--ink); }
.fx-card li strong { font-size: 16px; font-weight: 800; }
.fx-card li.up strong { color: #2f8f4e; }
.fx-card li.down strong { color: #c0392b; }
.fx-hint { display: block; margin-top: 10px; color: var(--muted); font-size: 11px; text-align: right; }
.fx-particle { position: fixed; z-index: 60; border-radius: 50%; pointer-events: none; opacity: 0; }
.dice-card { min-width: 260px; text-align: center; }
.dice-face { width: 104px; height: 104px; margin: 6px auto 10px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 18px;
  background: #fffdf6; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .08), 0 8px 20px rgba(0, 0, 0, .18); color: var(--ink); font-size: 40px; font-weight: 800; }
.dice-face.rolling { animation: dice-tumble .32s linear infinite; }
.dice-face.success { border-color: #2f8f4e; color: #2f8f4e; animation: dice-land .4s ease-out; }
.dice-face.fail { border-color: #c0392b; color: #c0392b; animation: dice-land .4s ease-out; }
@keyframes dice-tumble { 0% { transform: rotate(0deg) translateY(0); } 25% { transform: rotate(12deg) translateY(-6px); } 50% { transform: rotate(-8deg) translateY(2px); } 75% { transform: rotate(9deg) translateY(-4px); } 100% { transform: rotate(0deg) translateY(0); } }
@keyframes dice-land { 0% { transform: scale(1.35); } 60% { transform: scale(.94); } 100% { transform: scale(1); } }
.dice-verdict { min-height: 28px; margin: 0; font-size: 22px; font-weight: 800; letter-spacing: .02em; }
.dice-verdict.success { color: #2f8f4e; }
.dice-verdict.fail { color: #c0392b; }
.dice-card { position: relative; }
.dice-face.great { border-color: #c8961e; color: #b07d10; background: #fff6d8; box-shadow: 0 0 0 6px rgba(232, 182, 60, .25), 0 0 34px rgba(232, 182, 60, .7); animation: dice-great .6s ease-out; }
.dice-verdict.great { color: #b07d10; font-size: 28px; text-shadow: 0 0 12px rgba(232, 182, 60, .6); }
.dice-card.verdict-great { animation: dice-glow 1.4s ease-in-out; }
.dice-card.verdict-success .dice-face { box-shadow: 0 0 0 0 rgba(47, 143, 78, .45); animation: dice-land .4s ease-out, dice-pulse 1s ease-out .2s; }
.dice-card.verdict-fail { animation: dice-shake .45s ease-in-out; }
.dice-card.verdict-fail .dice-face { background: repeating-linear-gradient(135deg, transparent 0 9px, rgba(192, 57, 43, .12) 9px 11px); }
.dice-spark { position: absolute; left: 50%; top: 45%; width: 8px; height: 8px; border-radius: 50%; background: #e8b63c; pointer-events: none;
  box-shadow: 0 0 8px #f5d27a; animation: dice-spark .9s ease-out forwards; }
@keyframes dice-great { 0% { transform: scale(1.7) rotate(-12deg); } 55% { transform: scale(.9) rotate(4deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes dice-glow { 0%, 100% { box-shadow: 0 10px 40px rgba(0, 0, 0, .25); } 40% { box-shadow: 0 0 60px rgba(232, 182, 60, .75); } }
@keyframes dice-pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 143, 78, .45); } 100% { box-shadow: 0 0 0 22px rgba(47, 143, 78, 0); } }
@keyframes dice-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px) rotate(-1deg); } 40% { transform: translateX(9px) rotate(1deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
@keyframes dice-spark { 0% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.2); opacity: 0; } }
.stat.fx-hit, #life-power.fx-hit, #life-role.fx-hit, #life-crew.fx-hit, #life-relationships.fx-hit, #scene-result.fx-hit { animation: fx-hit .7s ease-out; }
.milestone-card { position: relative; text-align: center; border-width: 2px; }
.milestone-fx { display: block; width: 192px; height: 88px; margin: 0 auto 6px; image-rendering: pixelated; }
.milestone-title { display: block; margin: 6px 0 8px; color: var(--ink); font: 800 24px/1.3 "Batang", "Noto Serif KR", serif; word-break: keep-all; }
.milestone-sub { margin: 0; color: var(--body); font-size: 14px; line-height: 1.45; word-break: keep-all; }
.milestone-rank, .milestone-bond, .milestone-canon-bond { border-color: var(--sea); box-shadow: 0 0 42px rgba(34, 73, 76, .55); }
.milestone-canon-bond { border-color: #b88b32; box-shadow: 0 0 44px rgba(184, 139, 50, .6); }
.milestone-fruit { border-color: #79458f; box-shadow: 0 0 48px rgba(121, 69, 143, .65); }
.milestone-fruit .milestone-title { color: #5b2c6f; }
.milestone-fruit .dice-spark { background: #b565d9; box-shadow: 0 0 8px #e2b4f7; }
.milestone-haki-conqueror { border-color: #a02626; box-shadow: 0 0 54px rgba(160, 38, 38, .75); }
.milestone-haki-conqueror .milestone-title { color: #8b1a1a; }
.milestone-haki-conqueror .dice-spark { background: #d63031; box-shadow: 0 0 10px #ff7675; }
.milestone-haki-armament { border-color: #2d3436; box-shadow: 0 0 46px rgba(45, 52, 54, .7); }
.milestone-haki-observation { border-color: #2e86ab; box-shadow: 0 0 46px rgba(46, 134, 171, .65); }
.milestone-bounty { margin: 0; opacity: 0; transform: scale(1.25) rotate(-3deg); transition: opacity .22s ease, transform .28s cubic-bezier(.2, 1.3, .4, 1); }
.fx-overlay.show .milestone-bounty { opacity: 1; transform: scale(1) rotate(0); }
@keyframes fx-hit { 0% { background: rgba(255, 255, 255, 0); } 30% { background: rgba(255, 236, 190, .55); } 100% { background: rgba(255, 255, 255, 0); } }
.scene-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.life-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 0 24px;
  margin: 0 0 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.life-pane {
  min-width: 0;
}
.life-pane.char-pane {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 7px;
  padding-right: 20px;
  border-right: 1px solid var(--line);
}
.char-top-row {
  display: grid;
  grid-template-columns: 1.4fr 1.05fr 0.85fr;
  gap: 4px 14px;
}
.char-bot-row {
  display: grid;
  grid-template-columns: 1.4fr 1.35fr;
  gap: 4px 14px;
}
.char-cell {
  min-width: 0;
}
.char-cell span {
  display: block;
  color: var(--copper);
  font-size: 11px;
}
.char-cell strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.char-cell small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.char-cell.char-rep-cell[data-state="renown"] {
  --stat-color: #b8860b;
}
.char-cell.char-rep-cell[data-state="renown"] .reputation-icon {
  color: #8b5e28;
}
.char-cell.char-rep-cell[data-state="renown"] #reputation-kind {
  color: #7b5936;
}
.char-cell.char-rep-cell[data-state="renown"] #reputation-val {
  color: var(--ink);
}

.char-cell.char-rep-cell[data-state="infamy"] {
  --stat-color: #8b2626;
}
.char-cell.char-rep-cell[data-state="infamy"] .reputation-icon {
  color: #7a2018;
}
.char-cell.char-rep-cell[data-state="infamy"] #reputation-kind {
  color: #8b2626;
}
.char-cell.char-rep-cell[data-state="infamy"] #reputation-val {
  color: #5c1515;
}

.reputation-inline {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin-top: 1px;
}
.reputation-badge-wrap {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reputation-icon {
  width: 26px;
  height: 26px;
  display: block;
}
#sun-gauge-rect, #skull-gauge-rect {
  transition: y .45s cubic-bezier(.4, 0, .2, 1), height .45s cubic-bezier(.4, 0, .2, 1);
}
.reputation-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.reputation-strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}
.reputation-text small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right Pane: World & Network */
.life-pane.world-pane {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  padding-left: 2px;
  min-width: 0;
}
.world-pane .route-trail,
.world-pane .life-crew,
.world-pane .life-relationships {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
}
.world-pane span {
  flex: 0 0 auto;
  color: var(--copper);
  font-weight: 700;
  font-size: 11px;
  min-width: 76px;
}
.world-pane strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
}
.world-pane #route-trail {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
  text-overflow: clip;
}
.world-pane .crew-fx {
  flex: 0 0 auto;
  width: 38px;
  height: 14px;
  margin-left: 3px;
  align-self: center;
  image-rendering: pixelated;
}

.ending { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: clamp(28px, 4vw, 56px); align-items: start; padding: 24px 0 40px; }
.ending-hero, .ending-details { min-width: 0; }
.ending h1 { margin: 10px 0 14px; font-size: clamp(28px, 3vw, 42px); line-height: 1.3; word-break: keep-all; }
.ending .lead { margin-bottom: 16px; font-size: 16px; line-height: 1.6; word-break: keep-all; }
.ending-visual { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.ending-art { flex: 1 1 260px; margin: 0; }
.ending-art img { max-height: 300px; }
.wanted-poster { width: min(250px, 100%); margin: 0; padding: 12px 16px 14px; border: 3px double #765d3a; background: #e6d6b0; color: #46331f; text-align: center; box-shadow: 3px 4px 0 #c8baa0; }
.wanted-poster span, .wanted-poster strong, .wanted-poster small, .wanted-poster b { display: block; }
.wanted-poster span { font: 900 30px/1 Georgia, serif; letter-spacing: .12em; }
.wanted-poster strong { margin: 9px 0 4px; font: 700 20px/1.3 "Batang", serif; overflow-wrap: anywhere; }
.wanted-poster small { font: 700 10px/1.4 sans-serif; letter-spacing: .15em; }
.wanted-poster b { margin-top: 4px; font: 700 19px/1.3 Georgia, serif; }
.ending-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; margin: 0 0 22px; border-top: 1px solid var(--line); }
/* A fixed label column keeps labels on one line; long rows take the full width. */
.ending-facts div { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 12px; align-items: baseline; border-bottom: 1px solid var(--line); padding: 9px 0; }
.ending-facts div.wide { grid-column: 1 / -1; }
.ending-facts dt { color: var(--copper); white-space: nowrap; font-size: 13px; }
.ending-facts dd { margin: 0; text-align: left; font-weight: 700; color: var(--ink); font-size: 14px; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
.ending-timeline { margin: 0; }
.ending-timeline h2 { margin: 0 0 8px; font-size: 18px; }
.ending-timeline ol { margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--line); }
.ending-timeline li { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; padding: 5px 0 5px 14px; font-size: 14px; line-height: 1.45; word-break: keep-all; opacity: 0; animation: timeline-enter .36s ease-out forwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes timeline-enter { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: translateY(0); } }
.ending-timeline li::before { content: ""; position: absolute; left: -6px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--copper); }
.ending-timeline li b { color: var(--copper); }
.birth { padding: 14px 0; }
.birth .intro-hero h1 { font-size: clamp(26px, 2.3vw, 36px); word-break: keep-all; }
.birth .lead { margin-bottom: 16px; word-break: keep-all; }
.birth-art img { max-height: 36vh; }
.birth .ending-facts { gap: 0 24px; margin: 0 0 16px; }
.birth .ending-facts div { grid-template-columns: 84px minmax(0, 1fr); padding: 9px 0; }
.birth .growth-panels { grid-template-columns: 1fr; gap: 12px; margin-bottom: 18px; }
.birth .stat-delta { animation: none; }

.footer { display: flex; justify-content: space-between; gap: 12px; padding: 22px 0 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.journal { width: min(760px, calc(100vw - 28px)); max-height: min(82vh, 900px); padding: 26px 31px; border: 1px solid var(--sea); border-radius: 0; background: var(--paper); color: var(--body); transform: translateZ(0); backface-visibility: hidden; }
.journal::backdrop { background: rgb(22 38 40 / 66%); }
/* The head (with its close button) stays pinned while the long record scrolls under it. */
.journal-head { position: sticky; top: -26px; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 20px;
  margin: -26px -31px 22px; padding: 14px 31px 0; border-bottom: 1px solid var(--line); background: var(--paper); box-shadow: 0 6px 10px -8px rgba(0, 0, 0, .25); }
.journal-head h2 { margin: 4px 0 12px; }
.journal h2 { margin: 7px 0 20px; font-size: 32px; }
.journal h3 { margin: 30px 0 8px; color: var(--ink); font: 700 22px "Batang", serif; }
.journal ol { padding-left: 27px; }
.journal li { margin-bottom: 18px; padding-left: 7px; }
.journal li strong { display: block; color: var(--ink); }
.journal li small { display: block; color: var(--muted); }
.journal li p { margin: 3px 0; }
.journal a { color: var(--sea); }
.past-life { display: flex; width: 100%; justify-content: space-between; gap: 10px; border: 0; border-top: 1px solid var(--line); padding: 12px 0; text-align: left; background: transparent; color: var(--sea); }
.past-life:hover { text-decoration: underline; }
.noscript { margin: 40px; text-align: center; }

@media (min-width: 701px) and (max-height: 760px) {
  .masthead { min-height: 50px; }
  .game { padding-top: 4px; }
  .game-topline { margin-bottom: 2px; }
  .playback select { min-height: 32px; }
  .age-timeline { margin-bottom: 4px; }
  .age-track { height: 5px; margin-top: 3px; }
  .route-trail { margin: -2px 0 2px; }
  .life-strip { margin-bottom: 5px; padding: 3px 0; }
  .life-strip span { font-size: 10px; }
  .life-strip strong { font-size: 12px; }
  .life-strip small { font-size: 10px; }
  .growth-panels { margin-bottom: 5px; }
  .stats-panel { padding: 3px 0 4px; }
  .stats-panel h2 { margin-bottom: 3px; }
  .stats-grid { gap: 2px 8px; }
  .stat-head { margin-bottom: 1px; line-height: 1.1; }
  .stat-track { height: 4px; }
  .scene-art img { height: min(43vh, 280px); }
  .scene-body { margin: 8px 0 9px; line-height: 1.45; }
  .choice { padding: 4px 6px; }
  .choice small { line-height: 1.25; }
}


/* Relationship overview stays small; its dialog owns long individual rosters. */
.relations-panel { grid-column: 1 / -1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); background: #faf8f1; }
.relations-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.relations-heading h2 { margin: 0; font: 700 20px/1.3 "Batang", serif; color: var(--ink); }
.relations-heading .text-button { flex: 0 0 auto; font-size: 12px; padding: 3px 0; }
.relations-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.relations-summary:has(#relations-factions-metric:not([hidden])) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.relations-metric { min-width: 0; border: 1px solid var(--line); padding: 7px 10px; background: #fffdf8; }
.relations-metric span { display: block; font-size: 11px; color: var(--muted); }
.relations-metric strong { display: block; font: 700 18px/1.35 "Batang", serif; color: var(--ink); }
.relations-preview { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.relations-dialog { width: min(650px, calc(100vw - 28px)); height: min(600px, 82dvh); max-height: calc(100dvh - 28px); padding: 24px 28px;
  border: 1px solid var(--line); background: var(--paper); color: var(--body); box-shadow: 0 18px 60px #0005; overflow: hidden; }
.relations-dialog[open] { display: flex; flex-direction: column; }
.relations-dialog-head, .relations-tabs, .relations-search-row { flex: 0 0 auto; }
.relations-dialog::backdrop { background: rgba(16, 30, 32, .6); }
.relations-dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.relations-dialog-head h2 { margin: 2px 0 14px; font: 700 28px/1.35 "Batang", serif; }
.relations-tabs { display: flex; gap: 5px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.relations-tabs button { padding: 8px 14px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); }
.relations-tabs button[aria-selected="true"] { color: var(--sea); font-weight: 700; border-bottom-color: var(--sea); }
.relations-tabs span { font-size: 12px; }
.relations-search-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 7px 12px; margin-top: 13px; }
.relations-search-row label { color: var(--copper); font-size: 12px; font-weight: 700; }
.relations-search-row input { width: 100%; min-width: 0; min-height: 40px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 3px; background: #fffdf8; color: var(--ink); }
.relations-filter-count { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.relations-pane { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 6px 8px 0 0; }
.relations-list { list-style: none; padding: 0; margin: 0; }
.relations-list li { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px;
  padding: 11px 3px; border-bottom: 1px solid var(--line); }
.relations-list strong { color: var(--ink); font-size: 15px; }
.relations-list small { color: var(--muted); font-size: 12px; text-align: right; }
.relations-list .relations-empty { color: var(--muted); font-size: 13px; }
@media (max-width: 700px) {
  /* Keep the overview visible when ability and personality meters are folded. */
  .growth-panels { display: grid; }
  .growth-panels:not(.open) > .stats-panel { display: none; }
  .relations-panel { padding: 10px 12px; }
  .relations-dialog { height: min(550px, calc(100dvh - 28px)); padding: 18px 16px; }
  .relations-dialog-head h2 { font-size: 23px; }
  .relations-search-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .relations-filter-count { grid-column: 1; }
}


/* Desktop-only schematic: coordinates express route connections, never true geography. */
.route-map { display: none; min-width: 0; }
.route-map-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.route-map-heading span { color: var(--copper); font-size: 11px; font-weight: 700; }
.route-map-heading strong { min-width: 0; color: var(--ink); font-size: 12px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-map-zones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.route-map-zones span { min-width: 0; padding: 3px 0; border-bottom: 2px solid var(--line); color: var(--muted); font-size: 10px; text-align: center; white-space: nowrap; }
.route-map-zones span[data-active="true"] { border-bottom-color: var(--sea); color: var(--sea); font-weight: 800; }
.route-map-svg { display: block; width: 100%; height: 122px; overflow: hidden; border: 1px solid #b9c4bf; border-radius: 3px;
  background: radial-gradient(ellipse at 20% 55%, #e5e4d4 0, transparent 48%),
    radial-gradient(ellipse at 88% 25%, #d7e6df 0, transparent 40%), #e8eee8; }
.route-map-svg .route-chart-line { fill: none; stroke: #72938c; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 5 7; }
.route-map-svg .route-chart-visited { stroke: #9c764d; stroke-dasharray: none; }
.route-map-svg .route-chart-point { fill: #f5f1e7; stroke: var(--sea); stroke-width: 2.5; }
.route-map-svg .route-chart-visited-point { fill: #c2a17a; stroke: #7b5936; }
.route-map-svg .route-chart-current { fill: var(--sea); stroke: #fffdf8; stroke-width: 3; }
.route-map-svg .route-chart-ring { fill: none; stroke: var(--copper); stroke-width: 2; opacity: .7; }
.route-map-svg text { fill: var(--ink); font: 600 13px/1 "Noto Sans KR", sans-serif; }
.route-map-svg .route-chart-muted { fill: var(--muted); font-size: 11px; font-weight: 500; }
.route-map-status { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.route-map-status span { color: var(--muted); font-size: 11px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-map-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.3; }

/* Desktop reading desk: the life dashboard stays beside the current chapter.
   Narrow screens retain the original stacked layout; long chapters scroll inside their pane. */
@media (min-width: 1280px) and (min-height: 780px) {
  html:has(.page-shell.game-screen) {
    overflow-y: auto;
    scrollbar-gutter: auto;
  }
  .page-shell.game-screen {
    max-width: 1920px;
    padding: 0 clamp(28px, 2.5vw, 52px);
  }

  .page-shell.game-screen .game {
    display: grid;
    grid-template-columns: minmax(390px, 33%) minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 10px 20px;
    height: calc(100dvh - 72px);
    min-height: 0;
    padding: 10px 0 14px;
  }

  .game > .game-topline,
  .game > .age-timeline {
    grid-column: 1 / -1;
    margin: 0;
  }
  .game > .game-topline { grid-row: 1; }
  .game > .age-timeline { grid-row: 2; }

  .game > .game-status-column {
    grid-column: 1;
    grid-row: 3 / 5;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    min-height: 0;
    padding: 0 8px 18px 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }
  .game > .game-status-column > .life-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    flex: 0 0 auto;
  }
  .game .life-pane,
  .game > .game-status-column > .growth-panels > .stats-panel {
    min-width: 0;
    background: #faf8f1;
    border: 1px solid var(--line);
    padding: 10px 14px;
    border-radius: 4px;
  }
  .game .life-pane.char-pane {
    display: grid;
    gap: 8px;
  }
  .game .char-top-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
  .game .char-goal-cell { grid-column: 1 / -1; }
  .game .char-bot-row { grid-template-columns: 1.25fr .75fr; gap: 16px; }
  .game .char-cell strong { font-size: 13px; }
  .game .char-cell small { overflow-wrap: anywhere; }

  .game .life-pane.world-pane {
    display: grid;
    gap: 6px;
  }
  .game .route-map { display: grid; gap: 5px; max-width: 100%; overflow: hidden; }
  .game .route-map-svg { max-width: 100%; }
  .game .route-map-zones span { min-width: 0; font-size: 10px; padding: 3px 0; }
  .game .route-map-heading span { min-width: 0; }
  .game .route-map-heading strong { min-width: 0; }
  .game .route-map-status span { min-width: 0; }
  .game .world-pane #route-trail {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .game .world-pane .route-trail,
  .game .world-pane .life-crew,
  .game .world-pane .life-relationships {
    align-items: start;
    line-height: 1.45;
    font-size: 12px;
  }
  .game .world-pane span { min-width: 94px; }
  .game .world-pane strong {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.45;
    font-size: 12px;
  }
  .game .world-pane #route-trail { justify-content: flex-start; }

  .game > .game-status-column > .growth-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-content: start;
    gap: 8px;
    min-height: 0;
    margin: 0;
    overflow: visible;
    flex: 0 0 auto;
  }
  .game > .game-status-column > .growth-panels > .stats-panel { min-height: 0; }
  .game > .game-status-column > .growth-panels > .relations-panel { min-height: 0; border-radius: 4px; }
  .game .relations-heading h2 { font-size: 19px; }
  .game > .game-status-column > .growth-panels .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 16px;
  }
  .game > .game-status-column > .growth-panels .stats-panel h2 { margin-bottom: 7px; }
  .game > .game-status-column > .growth-panels .stat-head { line-height: 1.3; }
  .game > .game-status-column > .growth-panels .stat-track { height: 6px; }

  .game > .scene-layout {
    grid-column: 2;
    grid-row: 3 / 5;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: clamp(180px, 23vh, 240px) minmax(0, 1fr);
    gap: 14px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #faf8f1;
  }
  .game .scene-art {
    height: 100%;
    min-height: 0;
    max-height: 240px;
    overflow: hidden;
  }
  .game .scene-art img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    object-position: center;
  }
  .game .scene-copy {
    min-height: 0;
    overflow-y: auto;
    padding: 0 6px 0 0;
    scrollbar-gutter: stable;
  }
  .game .scene-copy h1 {
    margin-top: 4px;
    padding-bottom: 9px;
    font-size: clamp(26px, 1.8vw, 34px);
  }
  .game .scene-body {
    max-width: 78ch;
    margin: 10px 0 16px;
    font-size: 17px;
    line-height: 1.65;
  }
  .game .choices,
  .game.many-choices .choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    border: 0;
  }
  .game .choices > .choice {
    min-height: 70px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--sea);
    border-radius: 4px;
    background: #fffdf8;
    transition: background .15s ease, border-color .15s ease;
  }
  .game .choices > .choice:hover,
  .game .choices > .choice:focus-visible {
    background: #e9eee9;
    border-color: var(--sea);
  }
  .game .choices > .choice:disabled {
    border-left-color: var(--line);
    background: #e7e4dd;
  }
  .game .choices > .choice:last-child:nth-child(odd),
  .game .choices > .crew-name-form {
    grid-column: 1 / -1;
  }
  .game.many-choices .choice:nth-child(odd) { border-right: 1px solid var(--line); }
  .game .scene-hint { margin-top: 12px; }
}

@media (max-width: 1000px) {
  .page-shell { padding: 0 30px; }
  .intro { gap: 35px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scene-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 30px; }
  .scene-copy h1 { font-size: 30px; }
  .scene-body { font-size: 17px; }
}

@media (max-width: 700px) {
  .page-shell { padding: 0 16px; }
  .masthead { min-height: 67px; gap: 12px; }
  .masthead::after { width: 120px; }
  .wordmark { font-size: 21px; }
  .edition { font-size: 11px; }
  .masthead .text-button { font-size: 13px; white-space: nowrap; }
  .intro { display: block; min-height: calc(100dvh - 67px); padding: 12px 0 16px; }
  .intro-hero h1 { margin: 6px 0 7px; font-size: 28px; line-height: 1.2; }
  .intro .lead { font-size: 13px; line-height: 1.45; }
  .scope-note { margin: 7px 0 12px; padding-left: 8px; font-size: 11px; line-height: 1.35; }
  .intro:not(.birth) .intro-art { display: none; }
  .birth-art { margin-bottom: 10px; }
  .birth-art img { max-height: 140px; }
  .mode-select legend { padding-bottom: 4px; font-size: 11px; }
  .mode-option span { padding: 7px 4px; font-size: 13px; }
  .mode-description { margin: 5px 0 10px; font-size: 11px; }
  .profile-select legend { font-size: 19px; }
  .profile-toolbar { gap: 8px; margin: 4px 0 7px; }
  .profile-help, .profile-toolbar .text-button { font-size: 11px; }
  .profile-fields { gap: 6px 8px; }
  .profile-row label { font-size: 11px; }
  .profile-row select, .profile-row input { min-height: 33px; padding: 4px 6px; font-size: 13px; }
  .profile-hint { font-size: 10px; }
  .intro-actions { gap: 8px; margin-top: 12px; }
  .intro-actions button { min-width: 0; min-height: 42px; flex: 1; gap: 10px; padding: 6px 10px; white-space: nowrap; }
  .game { padding-top: 9px; }
  .game-topline { align-items: flex-start; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
  .age-timeline { margin-bottom: 10px; }
  .age-timeline-labels { font-size: 11px; }
  .age-timeline-labels strong { font-size: 15px; }
  .game-topline .eyebrow { width: 100%; }
  .playback { width: 100%; justify-content: space-between; gap: 8px; font-size: 14px; }
  .playback select { min-height: 40px; }
  .playback .text-button { font-size: 14px; }
  .scene-layout { display: block; }
  .scene-art img { aspect-ratio: 1672 / 941; height: min(20vh, 135px); }
  .game.has-choices .scene-art img { height: 72px; }
  .game.many-choices .scene-art img { height: 42px; }
  .scene-copy h1 { margin-top: 6px; padding-bottom: 6px; font-size: 23px; }
  .scene-body { margin: 8px 0 10px; font-size: 14px; line-height: 1.48; }
  .growth-panels { gap: 9px; margin-bottom: 6px; }
  .stats-panel { padding: 4px 0 6px; }
  .stats-panel h2 { margin-bottom: 3px; font-size: 13px; }
  .personality-heading { display: block; }
  .personality-heading strong { display: block; margin: -2px 0 3px; text-align: left; font-size: 10px; }
  .stats-grid { grid-template-columns: 1fr; gap: 2px; }
  .game.many-choices .choices { display: block; }
  .game.many-choices .choice:nth-child(odd) { border-right: 0; }
  .stat-head { margin-bottom: 1px; font-size: 10px; line-height: 1.15; }
  .stat-head strong { font-size: 10px; text-align: right; }
  .stat-track { height: 4px; }
  .choice { min-height: 0; padding: 4px 5px; }
  .choice strong { font-size: 13px; }
  .choice small { font-size: 11px; }
  .choice-dice { flex-basis: 96px; padding-left: 8px; }
  .life-strip { grid-template-columns: 1fr; gap: 8px; margin: 0 0 8px; padding: 6px 0; }
  .life-pane.char-pane { padding-right: 0; border-right: none; border-bottom: 1px dashed var(--line); padding-bottom: 6px; gap: 5px; }
  .char-top-row { grid-template-columns: 1.3fr 1fr 0.9fr; gap: 4px 8px; }
  .char-bot-row { grid-template-columns: 1.2fr 1.3fr; gap: 4px 8px; }
  .char-cell span { font-size: 10px; }
  .char-cell strong { font-size: 11px; }
  .char-cell small { font-size: 10px; }
  .world-pane { padding-left: 0; gap: 3px; }
  .world-pane span { min-width: 68px; font-size: 10px; }
  .world-pane strong { font-size: 11px; }
  /* Phones fold the stat panels behind a toggle so the scene stays near the top. */
  .growth-toggle { display: block; width: 100%; margin: 0 0 6px; text-align: center; }
  .growth-panels { display: grid; }
  .growth-panels.open { display: grid; }
  .growth-panels:not(.open) > .stats-panel { display: none; }
  .scene-hint { font-size: 11px; }
  .save-warning, .storage-message { font-size: 16px; }
  .ending { display: block; padding: 37px 0 52px; }
  .ending h1 { font-size: 32px; }
  .ending-facts { grid-template-columns: 1fr; }
  .ending-facts div { grid-template-columns: 96px minmax(0, 1fr); }
  .ending-timeline li { grid-template-columns: 48px minmax(0, 1fr); }
  .ending-actions { flex-direction: column; }
  .ending-actions button { width: 100%; }
  .footer { flex-direction: column; gap: 3px; font-size: 11px; }
  .journal { padding: 20px 17px; }
  .journal-head { top: -20px; margin: -20px -17px 18px; padding: 12px 17px 0; }
}

html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  scroll-behavior: auto !important;
  animation: none !important;
  transition: none !important;
}
html[data-motion="off"] .scene-fx { display: none !important; }
html[data-motion="off"] .ending-timeline li { opacity: 1 !important; }
html[data-motion="off"] .fx-overlay { display: none !important; }
html[data-motion="off"] .fx-particle { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="on"]) *, html:not([data-motion="on"]) *::before, html:not([data-motion="on"]) *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
  html:not([data-motion="on"]) .scene-fx { display: none !important; }
  html:not([data-motion="on"]) .ending-timeline li { opacity: 1 !important; }
  html:not([data-motion="on"]) .fx-overlay { display: none !important; }
  html:not([data-motion="on"]) .fx-particle { display: none !important; }
}
