:root {
  color-scheme: dark;
  --ink: #ececf1;
  --muted: #a4a5b3;
  --surface: #11121c;
  --accent: #cfaaa0;
  --line: #ffffff1c;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  background: #06070b;
  color: var(--ink);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .38; }
button, a, input { outline-offset: 5px; }
:focus-visible { outline: 2px solid var(--accent); }
:focus:not(:focus-visible) { outline: none; }
button { transition: background-color 160ms, border-color 160ms, color 160ms, opacity 160ms; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.experience { position: relative; width: 100%; height: 100dvh; min-height: 0; background: #08090f; isolation: isolate; }
.scene, .art, .art-frame { position: absolute; inset: 0; overflow: hidden; }
.scene { z-index: 0; cursor: pointer; }
.art-frame { background: #08090f; }
.scene-image { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; image-rendering: pixelated; }
.character { position: absolute; bottom: 0; height: 92%; width: auto; max-width: 39%; object-fit: contain; object-position: bottom; transform: translateX(-50%) scale(var(--portrait-scale, 1)); transform-origin: center top; image-rendering: pixelated; user-select: none; pointer-events: none; }
.character[style*="--cast-count: 4"] { max-width: 30%; }
.character[data-framing="close"] { bottom: auto; max-width: none; }
.character[data-source-crop="bust"] { mask-image: linear-gradient(to bottom, #000 76%, transparent 100%); }
.chrome { position: absolute; z-index: 4; top: 0; left: 0; width: 100%; display: flex; align-items: center; justify-content: space-between; padding: clamp(12px, 2vw, 28px) clamp(18px, 3.2vw, 46px); background: linear-gradient(#06070b9c, transparent); pointer-events: none; }
.chrome > * { pointer-events: auto; }
.chapter { display: flex; gap: 16px; align-items: center; font-size: clamp(11px, 1.1vw, 14px); letter-spacing: .035em; text-shadow: 0 1px 8px #000; }
#viewpoint { color: #d4d3dc; padding-left: 16px; border-left: 1px solid #ffffff45; }
.icon-button { background: #090a1270; border: 1px solid transparent; width: 44px; height: 44px; padding: 10px; display: grid; place-items: center; border-radius: 4px; }
.icon-button:hover { background: #20212ccf; border-color: var(--line); }
.icon-button:active { background: #31313e; }
.reading { position: absolute; z-index: 3; bottom: 0; left: 0; right: 0; padding: 38px clamp(24px, 5.3vw, 78px) 15px; background: linear-gradient(transparent, #0a0b13ec 18%, #0a0b13f5); max-height: 63%; overflow-y: auto; scrollbar-width: thin; }
.dialogue { min-height: clamp(112px, 12vw, 175px); cursor: pointer; max-width: 1100px; margin: 0 auto; position: relative; padding-bottom: 26px; }
.speaker { font-size: clamp(14px, 1.4vw, 19px); font-weight: 600; letter-spacing: .035em; margin: 0 0 10px; min-height: 1.35em; }
.line { font-size: clamp(16px, 1.65vw, 24px); line-height: 1.55; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.person-name { font-weight: 500; }
.advance-hint { float: right; margin-top: 14px; color: var(--muted); font-size: 11px; letter-spacing: .04em; display: flex; gap: 6px; align-items: center; opacity: 0; transition: opacity 160ms; }
.advance-hint svg { width: 12px; height: 12px; }
.advance-hint.ready { opacity: .85; }
.reading-tools { display: flex; justify-content: flex-end; gap: 20px; margin: 6px auto 0; max-width: 1100px; }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 9px 0; font-size: 13px; line-height: 1.35; min-height: 36px; }
.text-button:hover, .text-button[aria-pressed="true"] { color: var(--ink); }
.text-button:active { color: var(--accent); }
.text-button[aria-pressed="true"]::before { content: ""; display: inline-block; width: 4px; height: 4px; background: var(--accent); margin: 0 7px 3px 0; }
.interaction { max-width: 1000px; margin: 0 auto; padding-bottom: 4px; }
.interaction-prompt { font-size: clamp(16px, 1.5vw, 21px); line-height: 1.5; margin: 0 0 18px; white-space: pre-wrap; }
.choices { display: grid; gap: 9px; }
.choice-button { display: block; width: 100%; padding: 15px 20px; color: var(--ink); text-align: left; font-size: clamp(15px, 1.35vw, 19px); line-height: 1.45; border: 1px solid #ffffff24; background: #181923d9; border-radius: 3px; }
.choice-button:hover { background: #2a2631ed; border-color: #cfaaa08a; }
.choice-button:active { background: #39313c; }
.primary-button { border: 1px solid #d9b9b0; color: #151019; background: #d4b4ab; padding: 15px 24px; min-height: 52px; display: inline-flex; justify-content: center; align-items: center; gap: 30px; border-radius: 3px; font-weight: 600; }
.primary-button:hover:not(:disabled) { background: #e5cac2; border-color: #f6dfd8; }
.primary-button:active:not(:disabled) { background: #bb978d; }
.title-screen { position: absolute; inset: 0; z-index: 5; padding: clamp(28px, 6.4vw, 96px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; background: linear-gradient(90deg, #080910e8, #0809109c 47%, #08091024); }
.title-copy { margin-bottom: clamp(24px, 4vw, 58px); }
.eyebrow { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .22em; margin: 0 0 16px; }
h1 { font-family: "Cascadia Code", "Consolas", monospace; font-size: clamp(48px, 8vw, 116px); line-height: .95; font-weight: 500; letter-spacing: .17em; margin: 0 0 20px -.055em; color: #f1e8e7; }
.tagline { font-size: clamp(15px, 1.6vw, 21px); color: #d0c9ce; margin: 0; }
.title-actions { display: flex; align-items: flex-start; flex-direction: column; gap: 12px; }
.title-actions .text-button { font-size: 15px; }
.title-note { position: absolute; left: clamp(28px, 6.4vw, 96px); bottom: clamp(16px, 2.5vw, 36px); margin: 0; font-size: 11px; color: #c0b9c5ad; letter-spacing: .08em; }
.quiet-status { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; max-width: 310px; }
.qte-steps { display: flex; gap: 10px; flex-wrap: wrap; }
.qte-button { flex: 1 1 150px; min-height: 60px; border: 1px solid #ffffff24; background: #171823; border-radius: 3px; color: var(--ink); text-align: left; padding: 10px 16px; display: flex; gap: 16px; align-items: center; }
.qte-button.current { border-color: #cfaaa0b0; background: #29232e; }
.qte-button.complete { opacity: .45; }
.qte-button kbd { font: 18px "Consolas", monospace; color: var(--accent); min-width: 20px; }
.qte-timer { width: 100%; height: 3px; border: 0; appearance: none; display: block; margin: 18px 0 9px; }
.qte-timer::-webkit-progress-bar { background: #ffffff1b; }
.qte-timer::-webkit-progress-value { background: var(--accent); }
.qte-timer::-moz-progress-bar { background: var(--accent); }
.qte-meta { color: var(--muted); font-size: 12px; margin: 0; }
.ending-title { font: 400 clamp(24px, 3vw, 40px) "Consolas", monospace; letter-spacing: .03em; margin: 0 0 16px; }
.ending-actions { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 14px; }
.overlay { color: var(--ink); border: 1px solid #ffffff1a; border-radius: 5px; background: #10111a; box-shadow: 0 28px 100px #0009; padding: 0; width: min(620px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); }
.overlay::backdrop { background: #03040ac9; }
.overlay[open] { animation: dialog-in 170ms ease-out; }
.overlay-head { padding: 26px 28px 20px; display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); }
.overlay-head .eyebrow { margin-bottom: 8px; }
.overlay-head h2 { margin: 0; font-size: 24px; font-weight: 450; }
.overlay-body { padding: 24px 28px 28px; overflow-y: auto; max-height: calc(100dvh - 184px); scrollbar-width: thin; }
.menu-actions { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.menu-actions > .text-button { text-align: left; padding: 10px 0; }
.menu-heading { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin: 26px 0 8px; }
.save-row { border-bottom: 1px solid var(--line); padding: 15px 0; display: flex; gap: 14px; align-items: center; }
.save-info { flex: 1; min-width: 0; }
.save-info strong { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.save-info small { color: var(--muted); font-size: 11px; }
.save-row .text-button { flex-shrink: 0; font-size: 12px; }
.settings { padding-top: 16px; margin-top: 14px; }
.settings summary { cursor: pointer; font-size: 14px; padding: 8px 0; }
.setting-row { display: grid; grid-template-columns: 1fr 130px; gap: 18px; align-items: center; margin: 20px 0; font-size: 13px; color: #c7c6d0; }
input[type="range"] { accent-color: #cfaaa0; width: 100%; }
.history-entry { padding: 0 0 22px; margin: 0 0 20px; border-bottom: 1px solid #ffffff0e; }
.history-entry:last-child { border-bottom: 0; margin: 0; padding-bottom: 0; }
.history-entry .speaker { font-size: 13px; margin-bottom: 6px; }
.history-entry p:last-child { font-size: 15px; line-height: 1.65; margin: 0; white-space: pre-wrap; }
.history-entry.choice { color: #c4b6c5; padding-left: 14px; border-left: 2px solid #cfaaa060; }
.toast { position: absolute; z-index: 9; top: 80px; left: 50%; transform: translateX(-50%); padding: 12px 20px; background: #12131eef; border: 1px solid #ffffff24; max-width: 90%; text-align: center; font-size: 13px; line-height: 1.45; }
.experience[data-loading="true"] .reading { opacity: .25; pointer-events: none; }
.reading { transition: opacity 140ms; }
.no-script { position: fixed; inset: 20px; padding: 40px; z-index: 100; background: #08090f; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 900px) and (min-aspect-ratio: 4/5) {
  .reading { padding-top: 22px; padding-bottom: 6px; max-height: 62%; }
  .dialogue { min-height: 80px; padding-bottom: 8px; }
  .speaker { margin-bottom: 5px; }
  .reading-tools { margin-top: 0; }
  .reading-tools .text-button { min-height: 27px; padding: 5px 0; font-size: 11px; }
  .advance-hint { margin-top: 4px; }
  .chrome { padding: 7px 14px; }
  .title-copy { margin-bottom: 22px; }
  .title-screen { padding: 28px 42px; }
  .title-note { left: 42px; bottom: 12px; }
  .eyebrow { margin-bottom: 10px; }
  .primary-button { padding: 10px 18px; min-height: 44px; }
}
@media (max-width: 700px) and (max-aspect-ratio: 4/5) {
  body { overflow: hidden; }
  .experience { width: 100%; height: 100dvh; min-height: 0; aspect-ratio: auto; top: 0; transform: none; display: flex; flex-direction: column; }
  .scene { position: relative; width: 100%; height: auto; aspect-ratio: 16/9; flex: 0 0 auto; margin-top: calc(56px + env(safe-area-inset-top)); }
  .scene-image { object-fit: contain; object-position: center; }
  .chrome { padding: calc(6px + env(safe-area-inset-top)) 16px 6px 20px; height: calc(56px + env(safe-area-inset-top)); background: #0b0c13; }
  .chapter { font-size: 11px; gap: 9px; }
  #viewpoint { padding-left: 9px; }
  .reading { position: relative; inset: auto; flex: 1 1 auto; min-height: 0; max-height: none; padding: 25px 22px max(16px, env(safe-area-inset-bottom)); background: linear-gradient(#0b0c14, #0a0b12); display: flex; flex-direction: column; overflow-y: auto; }
  .dialogue { width: 100%; min-height: 0; padding-bottom: 20px; flex: 1 0 auto; }
  .line { font-size: 18px; line-height: 1.65; }
  .speaker { font-size: 15px; margin-bottom: 15px; }
  .advance-hint { margin-top: 24px; }
  .reading-tools { margin: 10px 0 0; flex-shrink: 0; gap: 25px; }
  .reading-tools .text-button { min-height: 40px; }
  .interaction { margin: 0; width: 100%; flex: 1 0 auto; }
  .interaction-prompt { font-size: 18px; }
  .choice-button { font-size: 16px; padding: 16px; }
  .title-screen { position: absolute; inset: 0; justify-content: flex-end; padding: 38px 28px max(92px, calc(env(safe-area-inset-bottom) + 70px)); background: linear-gradient(transparent 10%, #080910ba 28%, #080910 62%); }
  .title-copy { margin-bottom: 40px; }
  h1 { font-size: 64px; margin-bottom: 22px; }
  .tagline { font-size: 18px; }
  .title-actions { gap: 16px; width: 100%; }
  .title-actions .primary-button { width: 100%; justify-content: space-between; min-height: 54px; }
  .title-note { left: 28px; bottom: max(30px, env(safe-area-inset-bottom)); }
  .overlay { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .overlay-head { padding: 22px 20px 16px; }
  .overlay-body { padding: 22px 20px; max-height: calc(100dvh - 152px); }
  .save-row { gap: 10px; }
  .setting-row { grid-template-columns: 1fr 115px; }
  .toast { top: 64px; }
  .qte-button { flex-basis: 100%; min-height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
