:root {
  color-scheme: light;
  --bg: #f6f6f5;
  --ink: #111820;
  --muted: #526171;
  --deep: #252b30;
  --orange: #ff601b;
  --orange-dark: #b83b0a;
  --line: #d1d6dc;
  --soft: #fff1e9;
  --white: #fff;
  --gutter: clamp(20px, 2vw, 36px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
body { font-size: 16px; }
button, input, select { font: inherit; }
button { min-height: 44px; border: 0; cursor: pointer; color: inherit; background: none; }
button:disabled { cursor: default; }
button, a, input, summary, select, [tabindex] { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--orange-dark); outline-offset: 3px; }
.game { max-width: 1800px; margin: auto; padding: 0 var(--gutter) 16px; }
.topbar { background: var(--deep); color: white; }
.topbar-inner { max-width: 1800px; margin: auto; display: flex; align-items: center; gap: 28px; min-height: 88px; padding: 14px var(--gutter); }
.wordmark { color: white; font-size: clamp(20px, 2vw, 30px); font-weight: 800; letter-spacing: -.055em; text-decoration: none; white-space: nowrap; }
.wordmark b { font-weight: inherit; }
.wordmark span { display: block; margin-top: 4px; color: #b4bfc7; font-size: 9px; font-weight: 500; letter-spacing: .18em; }
.stats { display: flex; justify-content: center; gap: clamp(20px, 3vw, 48px); margin: 0; flex: 1; }
.stats div { min-width: 40px; }
.stats dt { margin-bottom: 5px; color: #c6cdd3; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.stats dd { margin: 0; font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stats .day-stat dd { color: var(--orange); }
.view-actions { display: flex; gap: 6px; align-items: center; }
.tool-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 44px; padding: 8px; color: #e0e5e8; font-size: 12px; white-space: nowrap; border-radius: 5px; }
.tool-button:hover { background: #ffffff10; color: white; }
.tool-button[aria-pressed=true] { color: var(--orange); }
.tool-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#sound-toggle[aria-pressed=true] .sound-mute-mark, #sound-toggle[aria-pressed=false] .sound-on-mark { display: none; }
#vote-fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.view-actions .tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
main { display: grid; grid-template-columns: minmax(0, 70fr) minmax(0, 30fr); grid-template-rows: auto auto; align-items: start; gap: 32px 28px; margin-top: 24px; }
.cinema { min-width: 0; grid-column: 1; grid-row: 1; }
.screen { position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; background: #111820; border-radius: 6px; }
.backdrop, #videos { position: absolute; inset: 0; }
.backdrop { background: #192127; }
#videos { z-index: 1; }
#videos video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.screen::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(transparent 70%, #11182099); }
.waiting { position: absolute; z-index: 3; inset: 0; display: grid; place-content: center; gap: 12px; padding: 24px; text-align: center; color: white; background: #11182099; pointer-events: none; }
.loading-note { max-width: 340px; font-size: 13px; color: #e0e5e8; }
.loading-ring { display: none; }
.is-loading .loading-ring { display: block; width: 22px; height: 22px; margin: auto; border: 2px solid #ffffff66; border-top-color: var(--orange); border-radius: 50%; animation: spin 1s linear infinite; }
.scene-context { position: absolute; z-index: 4; top: 16px; left: 16px; right: 16px; margin: 0; padding: 8px 10px; color: white; background: #111820cc; font-size: 12px; }
.video-toolbar { position: absolute; z-index: 5; right: 0; bottom: 0; left: 0; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 12px; color: white; font-size: 12px; }
#cinema-location { margin-right: auto; }
#video-length { position: absolute; top: -24px; left: 20px; font-size: 11px; color: #e1e6ea; }
.video-toolbar button { padding: 8px 10px; color: white; background: #111820aa; font-size: 12px; border-radius: 4px; }
.video-toolbar .video-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 10px; flex: 0 0 44px; }
.video-icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.video-toolbar button:hover { background: #111820; }
.story-panel { position: relative; grid-column: 1 / -1; grid-row: 2; min-width: 0; padding-top: 24px; border-top: 2px solid var(--deep); }
.story-panel::before { content: ""; position: absolute; top: -3px; left: 0; width: 72px; height: 4px; background: var(--orange); }
.reading-heading { display: grid; gap: 18px; margin-bottom: 28px; }
.chapter-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 24px; min-width: 0; margin: 0; font-size: 13px; }
#story-name { margin: 0; font-size: clamp(25px, 2.3vw, 34px); font-weight: 750; letter-spacing: -.045em; line-height: 1.2; overflow-wrap: anywhere; }
.story-challenge { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.story-facts { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 16px 28px; }
.chapter-meta div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.chapter-meta dt { color: var(--muted); }
.chapter-meta dt::after { content: " ·"; }
.chapter-meta dd { margin: 0; font-weight: 600; }
.chapter-meta #chapter { color: var(--orange-dark); font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.chapter-meta #stage { color: var(--ink); }
.chapter { display: flex; align-items: center; gap: 9px; color: var(--orange-dark); font-size: 11px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.wealth-details { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 24px; margin: 0 0 0 auto; font-size: 13px; }
.wealth-details div { display: flex; align-items: baseline; gap: 8px; }
.wealth-details dt { color: var(--muted); }
.wealth-details dd { margin: 0; color: var(--ink); font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.story-scroll { padding-bottom: 24px; }
#story { max-width: none; columns: 2; column-gap: clamp(36px, 4vw, 72px); column-fill: balance; font-size: clamp(17px, 1.35vw, 20px); line-height: 1.7; }
#story p { orphans: 2; widows: 2; }
#story p:first-child { display: flow-root; break-inside: avoid; }
#story p:first-child::first-letter { float: left; padding: 6px 12px 0 0; color: var(--orange); font-family: Georgia, "Times New Roman", serif; font-size: 5.2em; line-height: .78; }
.story-goal { display: flex; align-items: center; gap: 18px; padding: 20px 0 12px; border-top: 1px solid var(--line); }
.story-goal svg { width: 38px; height: 38px; flex: 0 0 38px; fill: none; stroke: var(--orange); stroke-width: 2; }
.goal-label { color: var(--orange-dark); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.story-goal strong { padding-left: 22px; border-left: 1px solid var(--line); font-size: 16px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.story { max-width: 76ch; color: var(--ink); font-size: 17px; line-height: 1.65; overflow-wrap: anywhere; }
.story p { margin: 0 0 18px; white-space: pre-wrap; }
#decision-host { grid-column: 2; grid-row: 1; align-self: stretch; min-width: 0; min-height: 0; contain: size; overflow-y: auto; scrollbar-width: thin; }
.decision { min-width: 0; }
.decision-heading::before { content: "YOUR CHOICE"; display: block; margin: 0 0 12px; color: var(--orange-dark); font-size: 11px; letter-spacing: .14em; font-weight: 750; }
.decision-heading h2 { margin: 0; font-size: clamp(28px, 2.8vw, 42px); font-weight: 800; letter-spacing: -.045em; line-height: 1.12; text-wrap: balance; }
.status-panel { margin: 22px 0 20px; padding: 20px; background: var(--deep); color: white; border-radius: 5px; }
.status-line { display: flex; flex-direction: column; gap: 8px; }
.decision-label { margin: 0; color: var(--orange); font-size: clamp(21px, 2.1vw, 30px); line-height: 1.2; font-weight: 750; letter-spacing: -.025em; }
#decision-count { color: #d4dbe1; font-size: 15px; }
#decision-count:empty { display: none; }
.vote-progress { display: flex; gap: 8px; height: 20px; margin-top: 18px; }
.vote-segment { display: block; flex: 1; min-width: 0; height: 100%; background: #ffffff06; border: 1px solid #7f8a93; border-radius: 2px; transition: background 180ms ease; }
.vote-segment.is-filled { background: var(--orange); border-color: #ffa26d; }
.decision-feedback { margin: 0 0 14px; color: var(--orange-dark); font-size: 14px; }
.decision-feedback:empty { display: none; }
.choices { display: grid; gap: 16px; }
.choice { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 110px; padding: 20px 16px; text-align: left; border: 1px solid var(--line); border-radius: 5px; transition: border-color 180ms, background 180ms; }
@media (hover: hover) { .choice:hover:not(:disabled) { border-color: var(--orange-dark); background: white; } }
.choice.selected, .choice.is-submitting { border-color: var(--orange-dark); background: var(--soft); }
.choice.winner { box-shadow: inset 0 0 0 1px var(--orange-dark); }
.choice:disabled:not(.selected):not(.is-submitting) { color: var(--muted); }
.choice-number { color: var(--orange-dark); font-size: 30px; font-weight: 800; letter-spacing: -.06em; padding-right: 14px; border-right: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.choice-text { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; line-height: 1.45; }
.choice-votes { color: var(--orange-dark); font-size: 13px; font-weight: 650; white-space: nowrap; }
.choice.is-submitting { cursor: progress; }
.choice.is-submitting .choice-votes::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -2px; animation: spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .choice.is-submitting .choice-votes::before { animation: none; } }
.choice.selected .choice-votes::before { content: "✓ "; }
.decision-empty { margin: 12px 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.decision-play { padding: 8px 14px; color: white; background: var(--deep); border-radius: 5px; }
.notice { margin-top: 18px; padding: 13px 14px; background: var(--soft); border-left: 3px solid var(--orange); color: var(--orange-dark); font-size: 13px; line-height: 1.6; }
.notice p { margin: 0 0 8px; overflow-wrap: anywhere; }
.retry-button { padding: 8px 13px; border: 1px solid var(--line); border-radius: 4px; }
.storage-warning { color: var(--orange-dark); font-size: 12px; }
#vote-fab { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#vote-dialog, #share-dialog, #history-dialog { border: 0; border-radius: 12px; padding: 24px; background: var(--bg); color: var(--ink); box-shadow: 0 20px 70px #11182044; }
dialog::backdrop { background: #11182099; }
.dialog-close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; font-size: 26px; }
#vote-dialog { max-width: 600px; width: 100%; max-height: 90dvh; margin: 0 auto; inset: auto 0 0; border-radius: 20px 20px 0 0; padding: 52px 20px max(20px, env(safe-area-inset-bottom)); }
#vote-dialog::before { content: ""; position: absolute; top: 12px; left: calc(50% - 20px); width: 40px; height: 4px; background: #b8c0c6; border-radius: 4px; }
#vote-dialog .decision { display: block; padding: 0; height: auto; overflow: visible; border: 0; border-radius: 0; }
#vote-close { position: sticky; display: block; top: -44px; margin: -44px -12px 0 auto; background: var(--bg); border-radius: 50%; z-index: 2; }
#vote-dialog .decision-heading::before { display: none; }
#share-dialog { width: min(460px, calc(100% - 32px)); }
#share-title { margin: 12px 0; font-size: 24px; font-weight: 700; }
#share-dialog input { width: 100%; min-height: 44px; margin: 10px 0; padding: 9px; border: 1px solid var(--line); border-radius: 4px; }
#toast { position: fixed; z-index: 50; right: 18px; bottom: 80px; max-width: calc(100% - 36px); padding: 12px 16px; color: white; background: var(--deep); border-radius: 5px; font-size: 14px; }
body.modal-open { overflow: hidden; }
.action-button, .icon-button { display: inline-flex; justify-content: center; align-items: center; gap: 9px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); font-size: 13px; font-weight: 600; transition: background 150ms, border-color 150ms; }
.action-button svg, .icon-button svg, .media-button svg, .round-trigger svg { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button { width: 44px; padding: 10px; flex: 0 0 44px; }
.action-button:hover:not(:disabled), .icon-button:hover:not(:disabled) { border-color: var(--orange-dark); background: var(--soft); }
.action-button:disabled { opacity: .38; }
.action-button:focus-visible, .icon-button:focus-visible, .media-button:focus-visible, .round-trigger:focus-visible { outline-width: 2px; outline-offset: 3px; }
.scene-mode-bar { display: none; }
body.scene-view { min-height: 100dvh; background: #141a1f; color: #e8edf0; }
body.scene-view .game { background: transparent; padding-bottom: 28px; }
body.scene-view .story-panel, body.scene-view #decision-host, body.scene-view #vote-fab { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
body.scene-view main { display: block; height: auto; margin-top: 20px; }
body.scene-view .cinema { width: min(100%, calc((100dvh - 220px) * 16 / 9)); margin-inline: auto; }
body.scene-view .scene-mode-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.scene-eyebrow { color: #b3bdc5; font-size: 10px; font-weight: 650; letter-spacing: .14em; }
.scene-mode-title { font-weight: 700; margin: 4px 0 0; font-size: 22px; letter-spacing: -.03em; }
#scene-back { color: #f6f6f5; background: #ffffff08; border-color: #ffffff30; }
#scene-back:hover { background: #ffffff16; border-color: #ffffff70; }
body.scene-view .screen { height: auto; max-height: none; aspect-ratio: 16/9; border-radius: 10px; box-shadow: 0 16px 48px #0004; }
body.scene-view #videos video { object-fit: contain; }
body.scene-view .video-toolbar { padding: 12px 16px; gap: 8px; }
.video-toolbar button { border: 1px solid #ffffff28; border-radius: 8px; backdrop-filter: blur(12px); }
.video-toolbar button:hover { border-color: #ffffff80; }
#exit-full-view { min-height: 44px; padding-inline: 18px; font-weight: 600; }
body.scene-view .screen:fullscreen, body.scene-view .screen.full-view-fallback, .screen:fullscreen, .screen.full-view-fallback { width: 100dvw; height: 100dvh; max-height: none; aspect-ratio: auto; background: black; border-radius: 0; }
.screen.full-view-fallback { position: fixed; z-index: 40; inset: 0; }
body.full-view-open { overflow: hidden; }
body.full-view-open .screen #videos video { object-fit: contain; }
.player-full-view .video-toolbar { top: max(8px, env(safe-area-inset-top)); bottom: auto; padding-inline: max(12px, env(safe-area-inset-left)); justify-content: flex-end; pointer-events: none; }
.player-full-view .video-toolbar > * { display: none; }
.player-full-view .video-toolbar #exit-full-view { display: block; pointer-events: auto; }
.player-full-view::after { display: none; }
.player-full-view .waiting { display: none; }
.player-full-view .scene-context { right: 160px; }
#history-dialog { width: min(1280px, calc(100vw - 64px)); height: min(1000px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; border: 1px solid #ffffff88; border-radius: 16px; }
#history-dialog[open] { display: flex; flex-direction: column; }
.history-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 16px 28px; }
.history-heading .chapter { margin: 0 0 6px; font-size: 10px; }
#history-title { font-weight: 700; margin: 0; font-size: 26px; letter-spacing: -.04em; }
.history-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0 0; }
#history-close { background: transparent; }
.history-selectors { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 10px 28px; border-block: 1px solid var(--line); background: #eef0f1; }
.field-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .12em; }
.history-story-name { min-width: 0; padding-bottom: 8px; }
.history-story-name strong { font-size: 16px; }
/* Single rounds read as metadata; multiple rounds use a compact disclosure menu. */
.history-round-field { position: relative; width: 220px; max-width: 55%; }
.round-summary { display: flex; align-items: center; min-height: 44px; gap: 8px; font-size: 14px; font-weight: 600; }
.round-trigger { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); text-align: left; font-size: 13px; font-weight: 600; }
.round-trigger svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--muted); transition: transform 150ms; }
.round-trigger:hover, .round-trigger[aria-expanded=true] { border-color: #8f9ba5; background: #fafbfb; }
.round-trigger[aria-expanded=true] svg { transform: rotate(180deg); }
.round-trigger:focus-visible { outline: 2px solid var(--orange-dark); outline-offset: 2px; }
.round-menu { position: absolute; z-index: 4; top: calc(100% + 6px); right: 0; width: max(100%, 220px); max-width: calc(100vw - 64px); max-height: min(280px, 35dvh); overflow-y: auto; overscroll-behavior: contain; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); box-shadow: 0 8px 24px #1118201a; }
.round-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 5px; text-align: left; font-size: 13px; }
.round-option:hover, .round-option:focus-visible { background: #eef0f1; outline: none; box-shadow: inset 0 0 0 1px #c9d0d5; }
.round-option[aria-checked=true] { background: var(--soft); color: var(--orange-dark); font-weight: 600; }
.round-option .round-check { visibility: hidden; }
.round-option[aria-checked=true] .round-check { visibility: visible; }
.history-status { display: flex; align-items: center; gap: 16px; padding-inline: 28px; }
#history-message { margin: 16px 0; color: var(--muted); font-size: 14px; }
#history-message:empty { display: none; }
.history-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "media narrative" "stats choices"; align-content: start; gap: 20px 24px; padding: 20px 28px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 1; scrollbar-width: thin; }
.history-media { grid-area: media; position: relative; min-width: 0; align-self: start; }
#history-video-note { position: absolute; left: 12px; right: 12px; top: 12px; margin: 0; padding: 8px 10px; border-radius: 5px; background: #111820dd; color: white; font-size: 12px; }
#history-video-note:empty { display: none; }
.history-media:has(.history-player[hidden]) { aspect-ratio: 16/9; background: #eceeef; border-radius: 10px; }
.history-narrative { grid-area: narrative; position: relative; min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.history-reading { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 16px 18px 28px; }
.history-reading:focus-visible { outline: 2px solid var(--orange-dark); outline-offset: -3px; }
.history-scroll-hint { position: absolute; inset: auto 0 0; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 8px; background: var(--bg); color: var(--muted); font-size: 11px; pointer-events: none; }
.history-state-panel { grid-area: stats; }
.history-options-panel { grid-area: choices; }
.history-state-panel, .history-options-panel { display: flex; flex-direction: column; min-width: 0; }
.history-section-heading { flex: 0 0 auto; margin: 0 0 10px; color: var(--muted); font-size: 11px; font-weight: 650; line-height: 16px; letter-spacing: .05em; text-transform: uppercase; }
.history-player { position: relative; background: #111820; border-radius: 10px; overflow: hidden; }
.history-player video { display: block; width: 100%; aspect-ratio: 16/9; object-fit: contain; background: #111820; }
.media-controls { display: flex; align-items: center; gap: 8px; padding: 6px 8px; color: #eef2f5; background: #1b232a; }
.media-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 10px; border-radius: 7px; color: inherit; }
.media-button:hover { background: #ffffff14; color: #ff8a53; }
.media-button .pause-symbol, .media-button .volume-off { display: none; }
.media-button.is-playing .pause-symbol, .media-button[aria-pressed=true] .volume-off { display: initial; }
.media-button.is-playing .play-symbol, .media-button[aria-pressed=true] .volume-on { display: none; }
.media-time { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#history-seek { min-width: 24px; width: 100%; height: 32px; margin: 0 4px; accent-color: var(--orange); cursor: pointer; }
.history-player:fullscreen, .history-player.history-full-fallback { width: 100%; height: 100%; border-radius: 0; background: #000; }
.history-player.history-full-fallback { position: fixed; inset: 0; z-index: 5; }
.history-player:fullscreen video, .history-player.history-full-fallback video { height: 100%; aspect-ratio: auto; }
.history-player:fullscreen .media-controls, .history-player.history-full-fallback .media-controls { position: absolute; bottom: 0; width: 100%; padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: #1b232ae6; }
.history-stats { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, 1fr); align-items: center; gap: 16px 12px; min-height: 156px; margin: 0; padding: 20px; background: #eceeef; border-radius: 8px; }
.history-stats dt { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.history-stats dd { margin: 0; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.history-content .story { max-height: none; overflow: visible; font-size: 14px; line-height: 1.75; }
.history-content .story p:last-child { margin-bottom: 0; }
.history-choice { margin: 0 0 14px; padding-left: 12px; border-left: 3px solid var(--orange); font-size: 13px; font-weight: 600; line-height: 1.5; }
#history-choices { list-style: none; display: grid; grid-auto-rows: 76px; gap: 8px; margin: 0; padding: 0; }
#history-choices li { min-width: 0; border-radius: 6px; background: #eceeef; }
.history-option-control { display: grid; grid-template-columns: 24px minmax(0, 1fr) 16px; grid-template-rows: minmax(0, 1fr) 14px; align-items: start; gap: 3px 10px; width: 100%; height: 100%; padding: 10px 12px; text-align: left; border-radius: inherit; font-size: 13px; line-height: 19px; }
.history-option-control:hover { background: #11182008; }
.history-option-control:focus-visible { outline-width: 2px; outline-offset: -2px; }
.history-option-number { grid-row: 1 / span 2; color: var(--muted); font-variant-numeric: tabular-nums; }
.history-option-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-option-tally { grid-column: 2; color: var(--muted); font-size: 11px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-option-chevron { grid-column: 3; grid-row: 1 / span 2; align-self: center; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; color: var(--muted); }
#history-choices li.chosen { background: var(--soft); box-shadow: inset 3px 0 var(--orange); }
#history-choices li.chosen .history-option-tally { color: var(--orange-dark); }
#history-option-dialog { width: min(480px, calc(100vw - 40px)); max-height: calc(100dvh - 48px); padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); overflow-y: auto; }
#history-option-close { float: right; margin: -8px -8px 8px 12px; }
#history-option-dialog .chapter { margin: 0 0 8px; font-size: 10px; }
#history-option-title { font-weight: 700; margin: 0 0 20px; font-size: 22px; }
#history-option-detail { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.7; }
#history-option-result { color: var(--muted); font-size: 12px; }
.history-navigation { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: 0 0 auto; margin-top: auto; padding: 10px 28px; border-top: 1px solid var(--line); background: var(--bg); }
#history-position { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (min-width: 901px) {
  .history-media .media-button { min-height: 36px; width: 36px; height: 36px; flex-basis: 36px; padding: 8px; }
  .history-media .media-controls { padding: 4px 8px; }
}
@media (max-width: 900px) {
  .history-content { grid-template-columns: 1fr; grid-template-areas: "media" "narrative" "stats" "choices"; grid-auto-rows: max-content; }
  .history-narrative { border: 0; border-radius: 0; overflow: visible; }
  .history-reading { position: static; overflow: visible; padding: 0; }
  .history-scroll-hint { display: none; }
  #history-choices { grid-auto-rows: auto; }
  .history-option-control { grid-template-rows: auto auto; }
  .history-option-text { display: block; overflow: visible; }
  .history-option-tally { white-space: normal; }
}
@media (min-width: 1100px) {
  #decision-host .decision { min-height: 100%; display: flex; flex-direction: column; }
  #decision-host .decision-heading::before { margin-bottom: 7px; font-size: 10px; }
  #decision-host .decision-heading h2 { font-size: clamp(26px, 2.3vw, 38px); }
  #decision-host .status-panel { margin: 14px 0; padding: 14px 18px; }
  #decision-host .status-line { gap: 4px; }
  #decision-host .decision-label { font-size: clamp(21px, 1.8vw, 28px); }
  #decision-host #decision-count { font-size: 13px; }
  #decision-host .vote-progress { height: 14px; margin-top: 12px; }
  #decision-host .decision-feedback { font-size: 12px; margin-bottom: 8px; }
  #decision-host .choices { flex: 1; grid-auto-rows: minmax(min-content, 1fr); gap: 12px; }
  #decision-host .choice { min-height: 64px; padding: 12px; gap: 12px; }
  #decision-host .choice-number { font-size: 28px; padding-right: 12px; }
  #decision-host .choice-text { font-size: clamp(14px, 1.1vw, 16px); line-height: 1.4; }
  #decision-host .choice-votes { font-size: 12px; }
}
@media (min-width: 1100px) and (max-width: 1359px) {
  #decision-host .decision-heading::before { display: none; }
  #decision-host .decision-heading h2 { font-size: 26px; }
  #decision-host .status-panel { margin: 10px 0; padding: 10px 14px; }
  #decision-host .vote-progress { height: 12px; margin-top: 8px; }
  #decision-host .choices { gap: 8px; }
  #decision-host .choice { min-height: 60px; padding: 6px 10px; gap: 10px; }
  #decision-host .choice-number { font-size: 24px; padding-right: 8px; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1099px) {
  main { display: flex; flex-direction: column; height: auto; }
  .cinema, .story-panel { width: 100%; }
  .screen { aspect-ratio: 5/4; max-height: 65dvh; }
  .screen #videos video { object-fit: cover; }
  .story-panel { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  #story { columns: 1; }
  #decision-host { display: none; }
  #vote-fab { display: inline-flex; position: fixed; z-index: 15; right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); align-items: center; justify-content: center; width: 56px; height: 56px; padding: 0; color: var(--ink); background: var(--orange); border-radius: 50%; box-shadow: 0 4px 14px #11182026; transition: background 150ms, box-shadow 150ms; }
  #vote-fab.is-voted { background: var(--deep); color: white; }
  #vote-fab:hover { box-shadow: 0 6px 20px #11182038; }
  #vote-fab:active { box-shadow: 0 2px 6px #11182026; }
  .decision-heading h2 { font-size: 28px; }
  .decision-label { font-size: 23px; }
  .status-panel { margin: 18px 0; padding: 18px; }
  .choice { min-height: 98px; padding: 16px 12px; gap: 12px; }
  .choice-number { font-size: 26px; padding-right: 10px; }
  .choice-text { font-size: 15px; }
  .choice-votes { font-size: 12px; }
  .choices { gap: 12px; }
}
@media (max-width: 1099px) {
  .topbar-inner { flex-wrap: wrap; gap: 14px; }
  .stats { order: 3; flex-basis: 100%; justify-content: space-between; }
  .view-actions { margin-left: auto; }
  .wordmark { font-size: 24px; }
}
@media (max-width: 680px) {
  :root { --gutter: 16px; }
  .game { padding-bottom: env(safe-area-inset-bottom); }
  .topbar-inner { gap: 12px 8px; padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); }
  .wordmark { font-size: 20px; }
  .wordmark span { font-size: 7px; letter-spacing: .14em; }
  .stats { gap: 10px; }
  .stats dt { font-size: 8px; letter-spacing: .03em; }
  .stats dd { font-size: 22px; }
  .view-actions { gap: 0; }
  .tool-button { width: 44px; padding: 0; }
  .tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  main { margin-top: 16px; gap: 18px; }
  .story { font-size: 16px; line-height: 1.7; }
  .story-panel { padding-top: 20px; }
  .reading-heading { gap: 14px; margin-bottom: 22px; }
  .chapter-meta { gap: 8px 12px; }
  .wealth-details { margin-left: 0; width: 100%; gap: 12px 24px; }
  #story { font-size: 16px; }
  #story p:first-child::first-letter { font-size: 4.5em; }
  .story-scroll { padding-bottom: 8px; }
  .story-goal { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 6px 12px; padding-top: 18px; }
  .story-goal svg { grid-row: 1 / span 2; width: 30px; height: 30px; align-self: start; }
  .story-goal strong { grid-column: 2; border: 0; padding: 0; font-size: 15px; }
  .video-toolbar { padding: 6px 8px; gap: 4px; }
  .video-toolbar button { padding-inline: 8px; font-size: 11px; }
  #cinema-location { font-size: 11px; }
  #video-length { left: 16px; top: -20px; font-size: 10px; }
  #vote-dialog { max-width: none; padding-inline: 16px; }
  #vote-dialog .choice { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px 12px; }
  #vote-dialog .choice-number { grid-row: 1 / span 2; align-self: center; }
  #vote-dialog .choice-votes { grid-column: 2; }
  #history-dialog { width: calc(100% - 20px); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); padding: 0; border-radius: 12px; }
  .history-heading { padding: 18px 16px 16px; gap: 12px; }
  #history-title { font-size: 24px; }
  .history-selectors { padding: 12px 16px; gap: 12px; }
  .history-round-field { width: 180px; }
  .history-story-name strong { font-size: 14px; }
  .select-shell select { font-size: 12px; padding-left: 10px; }
  .history-content { padding: 16px; gap: 24px; }
  .history-status { padding-inline: 16px; }
  .media-controls { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px 44px; gap: 2px; }
  #history-seek { grid-column: 1 / -1; grid-row: 1; width: calc(100% - 8px); }
  .media-time { font-size: 12px; }
  .history-stats { gap: 16px 10px; padding: 16px; }
  .history-navigation { padding: 12px; gap: 8px; }
  .history-navigation .action-button { font-size: 12px; padding: 10px; gap: 5px; }
  #history-position { display: none; }
  body.scene-view .cinema { width: min(100%, calc((100dvh - 250px) * 16 / 9)); }
  .scene-mode-title { font-size: 20px; }
  #scene-back { padding-inline: 12px; font-size: 12px; }

}
@media (max-width: 374px) {
  .view-actions { justify-content: flex-end; }
  .wordmark { font-size: 18px; max-width: 125px; white-space: normal; }
  .wordmark span { display: none; }
  .tool-button { min-width: 44px; width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Platform identity and the shared first-visit / help dialog. */
.brand-heading { margin: 0; flex: 0 0 auto; line-height: 1; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; letter-spacing: -.045em; }
.wordmark img { flex: 0 0 auto; }
#help-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); margin: auto; padding: 0; border: 1px solid #ffffff80; border-radius: 16px; background: var(--white); color: var(--ink); box-shadow: 0 24px 100px #1118204d; overflow: hidden; }
#help-dialog[open] { display: flex; flex-direction: column; }
.help-scroll { padding: 28px 32px 24px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; min-height: 0; }
.help-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; padding-right: 40px; font-weight: 750; font-size: 12px; letter-spacing: .05em; }
#help-close { position: absolute; right: 16px; top: 16px; background: var(--white); }
#help-title { font-weight: 700; margin: 0 0 10px; font-size: clamp(30px, 3vw, 38px); line-height: 1.1; letter-spacing: -.045em; }
#help-title:focus { outline: none; }
#help-intro { margin: 0; max-width: 360px; font-size: 17px; line-height: 1.5; color: var(--muted); }
.help-steps { margin: 26px 0; padding: 0; list-style: none; display: grid; gap: 22px; }
.help-steps li { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 16px; }
.help-step-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: #f0f2f3; color: var(--orange-dark); }
.help-step-icon svg, .help-rules > svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.help-step-title { margin: 2px 0 5px; font-size: 16px; font-weight: 750; letter-spacing: -.02em; }
.help-step-title span { color: var(--orange-dark); margin-right: 12px; font-variant-numeric: tabular-nums; }
.help-steps p, .help-rules p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
.help-rules { display: grid; grid-template-columns: 25px minmax(0, 1fr); gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #f2f4f5; }
.help-rules strong { display: block; font-size: 13px; margin: 2px 0 6px; }
.help-rules .help-generation-note { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; font-size: 12px; }
.help-actions { flex-shrink: 0; padding: 16px 32px 20px; background: white; border-top: 1px solid #edf0f2; }
#help-start { width: 100%; min-height: 48px; border-radius: 8px; background: var(--orange); color: var(--ink); font-weight: 750; transition: background 150ms; }
#help-start:hover { background: #ff7c43; }
.help-actions p { text-align: center; color: var(--muted); font-size: 11px; margin: 10px 0 0; }
@media (min-width: 1100px) and (max-width: 1359px) {
  .topbar-inner { gap: 16px; }
  .stats { gap: 20px; }
  .wordmark { font-size: 24px; }
  #help-open .tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-width: 680px) {
  .brand-heading { flex-basis: 100%; }
  .wordmark { font-size: 24px; max-width: none; white-space: nowrap; }
  .wordmark img { width: 40px; height: 20px; }
  .view-actions { position: static; margin: 0; width: 100%; justify-content: space-between; }
  .stats { order: 0; }
  #help-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 14px; }
  .help-scroll { padding: 24px 20px 18px; }
  .help-brand { margin-bottom: 24px; }
  .help-steps { gap: 20px; }
  .help-steps li { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
  .help-step-icon { width: 36px; height: 36px; }
  .help-step-icon svg { width: 21px; height: 21px; }
  .help-step-title span { margin-right: 8px; }
  .help-actions { padding: 14px 20px max(16px, env(safe-area-inset-bottom)); }
}
