@charset "UTF-8";

:root {
  color-scheme: dark;
  --ink: #171A17;
  --paper: #F3E7D0;
  --gold: #BCA175;
  --cinnabar: #873D35;
  --indigo: #263C3A;
  --paper-muted: rgba(243, 231, 208, .68);
  --line: rgba(188, 161, 117, .28);
  --font-body: "PingFang SC", "Microsoft YaHei", "Heiti SC", sans-serif;
  --font-title: "Songti SC", "STSong", "SimSun", serif;
  font-family: var(--font-body);
  font-synthesis: none;
  color: var(--paper);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

button,
a { -webkit-tap-highlight-color: transparent; }

button {
  appearance: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled { cursor: default; }

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -3px;
}

.hidden,
[hidden] { display: none !important; }

/* Same three-part stage geometry; the surrounding frame is ink and old gold. */
.page-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(30px, 5vw, 92px);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 620px;
  padding: 5vh 5vw;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 17% 18%, rgba(38, 59, 58, .42), transparent 48%),
    radial-gradient(ellipse at 80% 85%, rgba(188, 161, 117, .055), transparent 48%),
    var(--ink);
}

.world-panel {
  position: relative;
  min-width: 0;
  color: var(--paper-muted);
}

.title-panel {
  justify-self: end;
  width: min(100%, 220px);
  text-align: center;
}

.title-plaque {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 18px 25px;
  border-block: 1px solid var(--line);
  background: linear-gradient(90deg, transparent, rgba(243, 231, 208, .018), transparent);
}

.title-plaque::before,
.title-plaque::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 28px;
  height: 4px;
  border-inline: 1px solid var(--gold);
  opacity: .55;
  transform: translateX(-50%);
  pointer-events: none;
}

.title-plaque::before { top: -2px; }
.title-plaque::after { bottom: -2px; }

.title-kicker {
  margin: 0 0 28px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: .3em;
  text-indent: .3em;
}

.title-plaque h1 {
  margin: 0;
  color: var(--paper);
  font-family: var(--font-title);
  font-size: clamp(34px, 3.5vw, 48px);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: .18em;
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.title-seal {
  display: inline-block;
  margin-top: 22px;
  padding: 5px 4px;
  border: 1px solid rgba(243, 231, 208, .18);
  outline: 1px solid var(--cinnabar);
  outline-offset: 2px;
  background: var(--cinnabar);
  color: var(--paper);
  font: 12px/1.1 var(--font-title);
  letter-spacing: .12em;
  writing-mode: vertical-rl;
}

.title-caption {
  margin: 24px 0 0;
  color: rgba(243, 231, 208, .42);
  font-size: 10px;
  letter-spacing: .22em;
  text-indent: .22em;
}

.episode-panel { width: min(100%, 205px); }

.panel-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 20px;
  color: var(--gold);
  font: 400 19px/1.4 var(--font-title);
  letter-spacing: .18em;
}

.panel-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.game-stage {
  position: relative;
  z-index: 2;
  width: min(49.5vh, 440px);
  aspect-ratio: 9 / 16;
  max-height: 88dvh;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(188, 161, 117, .42);
  background: var(--ink);
  box-shadow:
    0 0 0 5px var(--ink),
    0 0 0 6px rgba(188, 161, 117, .14),
    0 24px 56px rgba(0, 0, 0, .3);
}

.game-stage::before,
.game-stage::after {
  content: "";
  position: absolute;
  z-index: 18;
  width: 13px;
  height: 13px;
  border-color: rgba(188, 161, 117, .6);
  border-style: solid;
  pointer-events: none;
}

.game-stage::before {
  top: 7px;
  left: 7px;
  border-width: 1px 0 0 1px;
  border-top-left-radius: 4px;
}

.game-stage::after {
  right: 7px;
  bottom: 7px;
  border-width: 0 1px 1px 0;
  border-bottom-right-radius: 4px;
}

.story-video,
.image-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: var(--ink);
}

.image-backdrop { z-index: 1; }

/* Footage is never tinted, blurred, or otherwise filtered. */
.vignette {
  position: absolute;
  z-index: 7;
  inset: 0;
  background: linear-gradient(180deg, rgba(23, 26, 23, .16), transparent 16%, transparent 78%, rgba(23, 26, 23, .22));
  pointer-events: none;
}

.hud {
  position: absolute;
  z-index: 15;
  left: 0;
  display: flex;
  align-items: center;
  width: 100%;
  padding-inline: 14px;
  color: var(--paper-muted);
  font-size: 11px;
  line-height: 1.5;
}

.hud--top {
  top: 0;
  height: 57px;
  gap: 3px;
  background: linear-gradient(180deg, rgba(23, 26, 23, .87), transparent);
}

.episode-label {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 10px;
  white-space: nowrap;
}

.hud-button,
.skip-button,
.dialog-close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: rgba(243, 231, 208, .84);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
  touch-action: manipulation;
}

.hud-link { margin-left: auto; }

.hud-button:disabled,
.skip-button:disabled { opacity: .45; }

.hud--bottom {
  bottom: 0;
  height: 58px;
  gap: 8px;
  padding-inline: 20px;
  background: linear-gradient(0deg, rgba(23, 26, 23, .9), transparent);
}

.chapter-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skip-button { margin-left: auto; }

.story-layer {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 74px 20px 69px;
  pointer-events: none;
}

.story-layer > * { pointer-events: auto; }

/* Original compact choice geometry, with no option numbers or badges. */
.timed-choice-overlay {
  position: relative;
  isolation: isolate;
  width: 100%;
  margin: auto 0 0;
  padding: 12px 0 4px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.timed-choice-overlay.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.timed-choice-overlay::before {
  content: "";
  position: absolute;
  z-index: -1;
  right: -20px;
  bottom: -69px;
  left: -20px;
  height: 260px;
  background: linear-gradient(0deg, rgba(23, 26, 23, .96), rgba(23, 26, 23, .72) 58%, transparent);
  pointer-events: none;
}

.timed-choice-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--gold);
  font: 800 8px/1 var(--font-body);
  letter-spacing: .13em;
}

.timed-choice-meta b { color: var(--paper); font-size: 11px; }

.timed-choice-overlay h2 {
  margin: 0 0 10px;
  color: var(--paper);
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: .035em;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .65);
}

.decision-prompt {
  margin: -3px 0 10px;
  color: var(--paper-muted);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.decision-options-scroll {
  min-width: 0;
  max-height: min(38dvh, 320px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(188, 161, 117, .48) transparent;
}

.timed-choice-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 7px;
}

.timed-choice-options > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
  width: calc((100% - 7px) / 2);
  justify-self: center;
}

.timed-choice-button,
.timed-choice-options > #nodeAction {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(188, 161, 117, .48);
  border-radius: 2px;
  background: rgba(23, 26, 23, .76);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  backdrop-filter: blur(8px);
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
  touch-action: manipulation;
}

.timed-choice-button:focus-visible,
.timed-choice-options > #nodeAction:focus-visible { outline-offset: -3px; }

.timed-choice-button.is-selected,
.timed-choice-options > #nodeAction.is-selected {
  border-color: var(--gold);
  background: rgba(188, 161, 117, .16);
  color: var(--gold);
}

.timed-choice-button:disabled,
.timed-choice-options > #nodeAction:disabled { opacity: .45; }
.timed-choice-button.is-selected:disabled,
.timed-choice-options > #nodeAction.is-selected:disabled { opacity: 1; }

.decision-label--play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.option-play-icon { display: inline-block; width: 0; height: 0; flex: 0 0 auto; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid currentColor; }

/* An opt-in E03 POV sequence. Ordinary story choices keep their original two columns. */
.story-layer > .inline-qte {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.qte-hotspot {
  position: absolute;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--paper);
  border-radius: 50%;
  background: rgba(23, 26, 23, .68);
  box-shadow: 0 0 0 5px rgba(188, 161, 117, .22);
  color: var(--paper);
  font: 400 21px/1 var(--font-title);
  transform: translate(-50%, -50%);
  pointer-events: auto;
  animation: qte-breathe 1.4s ease-in-out infinite;
}
@keyframes qte-breathe {
  50% { box-shadow: 0 0 0 9px rgba(188, 161, 117, .08); border-color: var(--gold); }
}
.qte-hotspot__count {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--paper);
  font: 700 11px/1 var(--font-body);
  text-shadow: 0 1px 3px #171A17, 0 0 5px #171A17;
  pointer-events: none;
}
.qte-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) { .qte-hotspot { animation: none; } }

/* Branch proposals and the open ending stay in the same bottom overlay. */
.placeholder-tag {
  display: inline-block;
  margin: 0 0 9px;
  padding: 3px 6px;
  border-left: 2px solid var(--cinnabar);
  background: rgba(23, 26, 23, .65);
  color: var(--gold);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: .04em;
}

.placeholder-copy,
.ending-copy {
  max-height: 20dvh;
  margin: 0 0 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: rgba(243, 231, 208, .8);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-line;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
  scrollbar-color: rgba(188, 161, 117, .48) transparent;
}

.story-layer > .episode-transition-hint {
  position: absolute;
  right: 20px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  left: 20px;
  margin: 0;
  color: rgba(243, 231, 208, .76);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: .03em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .85);
  pointer-events: none;
  user-select: none;
}

.tap-to-play,
.loading-indicator {
  position: absolute;
  z-index: 22;
  top: 50%;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 48px);
  margin: 0;
  padding: 14px 20px;
  border: 1px solid rgba(188, 161, 117, .5);
  border-radius: 2px;
  background: rgba(23, 26, 23, .88);
  color: var(--paper);
  font: 400 14px/1.6 var(--font-title);
  letter-spacing: .06em;
  text-align: center;
  transform: translate(-50%, -50%);
}

.loading-indicator { color: var(--gold); pointer-events: none; }

.runtime-error {
  position: absolute;
  z-index: 30;
  top: 50%;
  left: 24px;
  right: 24px;
  max-height: calc(100% - 148px);
  margin: 0;
  padding: 20px;
  overflow-y: auto;
  border: 1px solid rgba(188, 161, 117, .5);
  border-top: 2px solid var(--cinnabar);
  background: rgba(23, 26, 23, .97);
  font-size: 12px;
  line-height: 1.8;
  transform: translateY(-50%);
  overscroll-behavior: contain;
}

.runtime-error h2 {
  margin: 0 0 10px;
  font: 400 20px/1.4 var(--font-title);
}

.runtime-error p {
  margin: 0 0 16px;
  color: var(--paper-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.recovery-button {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--gold);
  border-radius: 2px;
  background: transparent;
  color: var(--paper);
  font-size: 12px;
}

.source-notice {
  position: absolute;
  z-index: 16;
  top: calc(65px + env(safe-area-inset-top, 0px));
  right: 20px;
  left: 20px;
  max-height: 64px;
  margin: 0;
  padding: 6px 8px;
  overflow-y: auto;
  border-left: 1px solid var(--gold);
  background: rgba(23, 26, 23, .82);
  color: var(--paper-muted);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
}

.episode-navigation {
  display: grid;
  width: 100%;
  gap: 7px;
  max-height: min(46vh, 420px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(188, 161, 117, .4) transparent;
}

.episode-navigation__item,
.episode-navigation > button {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(243, 231, 208, .025);
  color: var(--paper-muted);
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.episode-navigation > button > span {
  color: var(--gold);
  font-family: var(--font-title);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.episode-navigation > button b,
.episode-navigation > button strong {
  min-width: 0;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.episode-navigation > button:is(.is-active, [aria-current="true"], [aria-current="step"], [aria-current="page"]) {
  border-color: rgba(188, 161, 117, .7);
  background: rgba(188, 161, 117, .09);
  color: var(--paper);
  box-shadow: inset 2px 0 var(--cinnabar);
}

.episode-navigation > button:disabled { opacity: .4; }

.episode-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  margin: auto;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(188, 161, 117, .6);
  border-radius: 3px;
  background:
    linear-gradient(150deg, rgba(38, 59, 58, .26), transparent 65%),
    var(--ink);
  color: var(--paper);
  box-shadow: 0 18px 56px rgba(0, 0, 0, .32);
}

.episode-dialog::backdrop { background: rgba(12, 16, 14, .76); }

.episode-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.episode-dialog__header h2 {
  margin: 0;
  color: var(--paper);
  font: 400 21px/1.4 var(--font-title);
  letter-spacing: .08em;
}

.dialog-close { min-width: 44px; }
.episode-dialog .episode-navigation { max-height: none; }
.episode-dialog .episode-navigation > button { min-height: 52px; }
.episode-dialog .episode-navigation > button b { font-size: 12px; }

@media (hover: hover) {
  .hud-button:hover:not(:disabled),
  .skip-button:hover:not(:disabled),
  .dialog-close:hover {
    border-color: var(--line);
    background: rgba(23, 26, 23, .35);
    color: var(--paper);
  }

  .timed-choice-button:hover:not(:disabled),
  .timed-choice-options > #nodeAction:hover:not(:disabled) {
    border-color: var(--gold);
    background: rgba(188, 161, 117, .16);
    color: var(--gold);
  }

  .episode-navigation > button:hover:not(:disabled) {
    border-color: rgba(188, 161, 117, .65);
    background: rgba(188, 161, 117, .075);
    color: var(--paper);
  }

  .tap-to-play:hover,
  .recovery-button:hover {
    border-color: var(--paper);
    background: rgba(38, 59, 58, .94);
  }
}

@media (max-width: 980px) {
  .page-shell {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 24px;
    padding-inline: 3vw;
  }

  .title-plaque { padding-inline: 8px; }
  .title-plaque h1 { font-size: 34px; }
  .episode-navigation > button { grid-template-columns: 38px minmax(0, 1fr); gap: 5px; padding-inline: 6px; }
}

/* The original handheld / short-window full-bleed breakpoint. */
@media (max-width: 720px), (max-height: 700px) {
  .page-shell {
    display: block;
    min-height: 0;
    padding: 0;
    background: var(--ink);
  }

  .world-panel { display: none; }

  .game-stage {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    aspect-ratio: auto;
    border: 0;
    box-shadow: none;
  }

  .game-stage::before,
  .game-stage::after { display: none; }

  .story-layer {
    padding-right: max(20px, env(safe-area-inset-right, 0px));
    padding-bottom: max(69px, calc(env(safe-area-inset-bottom, 0px) + 59px));
    padding-left: max(20px, env(safe-area-inset-left, 0px));
  }

  .timed-choice-overlay::before {
    right: calc(-1 * max(20px, env(safe-area-inset-right, 0px)));
    bottom: calc(-1 * max(69px, calc(env(safe-area-inset-bottom, 0px) + 59px)));
    left: calc(-1 * max(20px, env(safe-area-inset-left, 0px)));
  }

  .hud--top {
    height: calc(57px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
  }

  .hud--bottom {
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: max(20px, env(safe-area-inset-left, 0px));
  }
}

@media (max-width: 380px) {
  .episode-label { display: none; }
  .hud--top { gap: 4px; justify-content: space-between; }
  .hud-link { margin-left: 0; }
  .episode-dialog { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
