:root {
  --paper: #e8e7e1;
  --ink: #20201e;
  --aodake: #4f615f;
  --benikaba: #91483c;
  --rule: rgba(32, 32, 30, 0.42);
  --paper-soft: rgba(232, 231, 225, 0.92);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  --rail-width: 106px;
  --wordmark-width: 82px;
  --global-progress: 0;
  --before-progress: 0;
  --coda-progress: 0;
  --coda-boundary: 43.331%;
  --coda-span: 56.669%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button,
a,
[role="slider"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.875rem;
  text-decoration: none;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--benikaba);
  outline-offset: 4px;
}

.soundtrack {
  position: fixed;
  z-index: 80;
  right: 1rem;
  bottom: 1rem;
  max-width: min(34rem, calc(100vw - 2rem));
}

.js .soundtrack {
  display: none;
}

.experience {
  position: fixed;
  inset: 0;
  isolation: isolate;
  overflow: hidden;
  background: var(--paper);
}

.visual-scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  opacity: var(--scene-opacity, 0);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 900ms linear;
}

.visual-scene.is-visible {
  visibility: visible;
}

.split-photo {
  --gap: 18px;
  position: absolute;
  z-index: 1;
  inset: 4vh calc(var(--wordmark-width) + 22px) 4vh calc(var(--rail-width) + 8px);
  margin: 0;
}

.photo-pane {
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc((100% - var(--gap)) / 2);
  overflow: hidden;
  background: #d6d5cf;
  transform: translateY(var(--pane-y, 0)) translateX(var(--pane-x, 0));
  will-change: width, transform;
}

.photo-pane--left {
  left: 0;
  --pane-y: var(--left-y, 0);
  --pane-x: var(--left-x, 0);
}

.photo-pane--right {
  right: 0;
  --pane-y: var(--right-y, 0);
  --pane-x: var(--right-x, 0);
}

.photo-pane img {
  position: absolute;
  top: 0;
  width: calc(200% + var(--gap));
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.84) contrast(0.98);
  user-select: none;
}

.photo-pane--left img {
  left: 0;
}

.photo-pane--right img {
  right: 0;
}

.visual-scene--life .split-photo {
  --gap: var(--life-gap, 18px);
}

.visual-scene--fate .split-photo {
  --gap: var(--fate-gap, 200px);
  inset-block: 0;
}

.visual-scene--fate .photo-pane--left {
  --left-y: var(--fate-left-y, 0);
}

.visual-scene--fate .photo-pane--right {
  --right-y: var(--fate-right-y, 0);
}

.visual-scene--game .split-photo {
  --gap: var(--game-gap, 320px);
  inset-block: 5vh;
}

.visual-scene--game .photo-pane--left {
  --left-y: var(--game-left-y, 0);
  --left-x: var(--game-left-x, 0);
}

.visual-scene--game .photo-pane--right {
  --right-y: var(--game-right-y, 0);
  --right-x: var(--game-right-x, 0);
}

.opening-statement {
  position: absolute;
  z-index: 3;
  inset: 4vh calc(var(--wordmark-width) + 22px) 4vh calc(var(--rail-width) + 8px);
  opacity: var(--intro-opacity, 1);
  will-change: opacity;
}

.opening-statement h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.8rem, 4.5vw, 5.4rem);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: 0.035em;
}

.opening-phrase {
  position: absolute;
  top: 49%;
  width: calc((100% - var(--life-gap, 18px)) / 2);
  color: #f3f0e9;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 2px 14px rgba(20, 20, 18, 0.74);
}

.opening-phrase--left {
  left: 0;
  transform: translateY(-50%) translateX(var(--opening-left-x, 0));
}

.opening-phrase--right {
  right: 0;
  transform: translateY(-50%) translateX(var(--opening-right-x, 0));
}

.opening-statement > p {
  position: absolute;
  right: 7%;
  bottom: 4.5%;
  left: 7%;
  margin: 0;
  color: #e9ece7;
  font-family: var(--serif);
  font-size: clamp(0.9rem, 1.2vw, 1.16rem);
  line-height: 1.75;
  letter-spacing: 0.06em;
  text-align: center;
  text-shadow: 0 1px 10px rgba(20, 20, 18, 0.9);
}

.scene-copy {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  color: var(--ink);
  font-family: var(--serif);
  opacity: var(--copy-opacity, 1);
  transform: translate(-50%, -50%);
}

.scene-copy--life,
.scene-copy--fate {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: min(calc(var(--life-gap, 180px) - 20px), 15rem);
  max-height: 72vh;
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.scene-copy--life {
  --copy-opacity: var(--life-copy-opacity, 0);
}

.scene-copy--fate {
  width: min(calc(var(--fate-gap, 240px) - 24px), 18rem);
}

.scene-copy h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 4vw, 4.7rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.12em;
}

.scene-copy p {
  margin: 0 1.6rem 0 0;
  font-size: clamp(0.94rem, 1.18vw, 1.15rem);
  line-height: 2;
  letter-spacing: 0.08em;
}

.scene-number {
  margin: 0 0 0.8rem;
  color: var(--aodake);
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  writing-mode: horizontal-tb;
}

.scene-copy--game {
  width: min(calc(var(--game-gap, 360px) - 38px), 28rem);
  text-align: left;
}

.scene-copy--game h2 {
  margin-bottom: 1.4rem;
}

.scene-copy--game p {
  margin: 0;
  font-size: clamp(1rem, 1.35vw, 1.28rem);
  line-height: 2;
}

.scene-copy--game .scene-number {
  display: block;
  margin-bottom: 0.8rem;
}

.visual-scene--coda {
  background: var(--paper);
}

.coda-boundary {
  position: absolute;
  z-index: 3;
  top: 13vh;
  left: calc(var(--rail-width) + 4vw);
  max-width: min(46rem, 62vw);
  opacity: var(--coda-copy-opacity, 1);
}

.coda-boundary time {
  display: block;
  margin-bottom: 3rem;
  color: var(--benikaba);
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.coda-boundary .original-time {
  display: inline-block;
  margin-left: 0.75rem;
  color: var(--ink);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  opacity: 0.58;
}

.coda-boundary h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3vw, 3.5rem);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.055em;
}

.breath-field {
  position: absolute;
  z-index: 2;
  top: 43%;
  right: calc(var(--wordmark-width) + 24px);
  left: calc(var(--rail-width) + 8px);
  height: 32vh;
}

.breath-line {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.breath-line path {
  fill: none;
  stroke: url(#breath-color);
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: var(--breath-offset, 1);
  vector-effect: non-scaling-stroke;
}

.coda-end {
  position: absolute;
  right: 0;
  bottom: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.82rem;
  opacity: var(--coda-end-opacity, 0);
}

.coda-light {
  position: absolute;
  width: 34vw;
  height: 34vw;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.23);
  filter: blur(68px);
  opacity: var(--coda-light-opacity, 0);
  transform: translate3d(var(--light-x, 0), var(--light-y, 0), 0);
}

.coda-light--one {
  top: 6%;
  right: 7%;
}

.coda-light--two {
  right: 36%;
  bottom: -9%;
  width: 24vw;
  height: 24vw;
}

.time-rail {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--rail-width);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.69rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.rail-scrubber {
  position: absolute;
  top: 48px;
  bottom: 48px;
  left: 34px;
  width: 42px;
  cursor: ns-resize;
  touch-action: none;
}

.rail-track,
.rail-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 1px;
}

.rail-track {
  background: var(--rule);
}

.rail-fill {
  transform-origin: 50% 0;
}

.rail-fill--before {
  bottom: auto;
  height: var(--coda-boundary);
  background: var(--aodake);
  transform: scaleY(var(--before-progress));
}

.rail-fill--coda {
  top: var(--coda-boundary);
  height: var(--coda-span);
  background: var(--benikaba);
  transform: scaleY(var(--coda-progress));
}

.rail-marker {
  position: absolute;
  z-index: 2;
  top: calc(var(--global-progress) * 100%);
  left: 20px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--paper);
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-43%, -50%);
}

.rail-marker time {
  position: absolute;
  top: 50%;
  left: 13px;
  padding: 0.16rem 0.28rem;
  background: var(--paper-soft);
  color: var(--ink);
  font-size: 0.65rem;
  line-height: 1;
  transform: translateY(-50%);
  white-space: nowrap;
}

.rail-label {
  position: absolute;
  left: 14px;
}

.rail-label--start {
  top: 22px;
  color: var(--aodake);
}

.rail-label--coda {
  top: var(--coda-boundary);
  color: var(--benikaba);
  transform: translateY(-50%);
}

.rail-label--end {
  bottom: 20px;
}

.wordmark {
  position: fixed;
  z-index: 42;
  top: 3rem;
  right: 1.9rem;
  display: inline-flex;
  flex-direction: column;
  gap: 0.16em;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1;
  text-decoration: none;
}

.wordmark::after {
  width: 1px;
  height: 6rem;
  margin: 0.8rem auto 0;
  background: var(--rule);
  content: "";
}

.audio-dock {
  position: fixed;
  z-index: 50;
  right: 1.65rem;
  bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 48px;
  padding: 0.55rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}

.play-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  cursor: pointer;
  place-items: center;
}

.play-toggle svg {
  width: 17px;
  height: 19px;
}

.play-toggle path {
  fill: currentColor;
}

.icon-play,
.audio-dock.is-paused .icon-pause {
  display: none;
}

.audio-dock.is-paused .icon-play {
  display: block;
}

.audio-meta {
  display: grid;
  gap: 0.16rem;
  min-width: 8.5rem;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.audio-status {
  color: var(--aodake);
}

.audio-time {
  color: var(--ink);
}

.autoplay-gate {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  background: rgba(232, 231, 225, 0.965);
  place-items: center;
}

.autoplay-gate[hidden] {
  display: none;
}

.autoplay-gate-button {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: min(28rem, calc(100vw - 3rem));
  padding: 1.35rem 0;
  border: 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.autoplay-gate-button svg {
  width: 24px;
  height: 28px;
}

.autoplay-gate-button path {
  fill: var(--benikaba);
}

.autoplay-gate-button span {
  display: grid;
  gap: 0.35rem;
}

.autoplay-gate-button strong {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.autoplay-gate-button small {
  color: var(--aodake);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

@media (max-width: 900px) {
  :root {
    --rail-width: 0px;
    --wordmark-width: 0px;
  }

  .split-photo,
  .visual-scene--fate .split-photo,
  .visual-scene--game .split-photo {
    inset: 3.6rem 1rem 4.6rem;
  }

  .opening-statement {
    inset: 3.6rem 1rem 4.6rem;
  }

  .opening-statement h1 {
    font-size: clamp(2.1rem, 9.3vw, 4.2rem);
  }

  .opening-phrase {
    padding-inline: 0.25rem;
  }

  .opening-statement > p {
    right: 3%;
    bottom: 3.5%;
    left: 3%;
    font-size: 0.82rem;
    line-height: 1.65;
  }

  .scene-copy--life,
  .scene-copy--fate,
  .scene-copy--game {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: min(calc(var(--life-gap, 96px) - 12px), 7.25rem);
    max-height: 66vh;
    text-align: left;
    writing-mode: vertical-rl;
    text-orientation: upright;
  }

  .scene-copy--fate {
    width: min(calc(var(--fate-gap, 112px) - 12px), 7.8rem);
  }

  .scene-copy--game {
    width: min(calc(var(--game-gap, 136px) - 12px), 8.4rem);
  }

  .scene-copy h2,
  .scene-copy--game h2 {
    margin: 0;
    font-size: clamp(2rem, 8vw, 3.1rem);
  }

  .scene-copy p,
  .scene-copy--game p {
    margin: 0 0.8rem 0 0;
    font-size: clamp(0.78rem, 3.3vw, 0.94rem);
    line-height: 1.82;
  }

  .scene-copy--game .scene-number {
    margin: 0 0 0.7rem;
  }

  .wordmark {
    top: 1rem;
    right: 1rem;
    flex-direction: row;
    gap: 0;
    padding: 0.35rem 0;
    background: var(--paper-soft);
    font-size: 1.35rem;
  }

  .wordmark::after {
    width: 3.6rem;
    height: 1px;
    margin: auto 0 auto 0.65rem;
  }

  .time-rail {
    top: auto;
    right: 1rem;
    bottom: 0.55rem;
    left: 1rem;
    width: auto;
    height: 52px;
    background: var(--paper-soft);
  }

  .rail-scrubber {
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 30px;
    cursor: ew-resize;
  }

  .rail-track,
  .rail-fill {
    top: 14px;
    bottom: auto;
    left: 0;
    width: 100%;
    height: 1px;
  }

  .rail-fill {
    transform-origin: 0 50%;
  }

  .rail-fill--before {
    width: var(--coda-boundary);
    height: 1px;
    transform: scaleX(var(--before-progress));
  }

  .rail-fill--coda {
    top: 14px;
    left: var(--coda-boundary);
    width: var(--coda-span);
    height: 1px;
    transform: scaleX(var(--coda-progress));
  }

  .rail-marker {
    top: 14px;
    left: calc(var(--global-progress) * 100%);
    transform: translate(-50%, -43%);
  }

  .rail-marker time {
    top: -8px;
    left: 50%;
    transform: translate(-50%, -100%);
  }

  .rail-label {
    top: 32px;
    bottom: auto;
    left: auto;
  }

  .rail-label--start {
    left: 0;
  }

  .rail-label--coda {
    left: var(--coda-boundary);
    transform: translateX(-50%);
  }

  .rail-label--end {
    right: 0;
  }

  .audio-dock {
    right: 1rem;
    bottom: 4.35rem;
    padding: 0;
    border: 0;
  }

  .audio-meta {
    display: none;
  }

  .play-toggle {
    background: var(--paper-soft);
  }

  .coda-boundary {
    top: 12vh;
    right: 1.5rem;
    left: 1.5rem;
    max-width: none;
  }

  .coda-boundary time {
    margin-bottom: 2rem;
  }

  .coda-boundary h2 {
    max-width: 18rem;
    font-size: clamp(1.45rem, 6.2vw, 2.4rem);
  }

  .breath-field {
    top: 44%;
    right: 0;
    left: 0;
  }

  .coda-end {
    right: 1rem;
  }
}

@media (max-width: 480px) {
  .opening-statement > p {
    right: 0;
    left: 0;
    padding-inline: 0.45rem;
    font-size: 0.76rem;
  }

  .autoplay-gate-button {
    min-width: calc(100vw - 2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .coda-light {
    display: none;
  }
}

.no-js body {
  overflow: auto;
}

.no-js .experience {
  position: static;
  overflow: visible;
}

.no-js .visual-scene {
  position: relative;
  min-height: 100svh;
  opacity: 1;
  visibility: visible;
}

.no-js .time-rail,
.no-js .audio-dock,
.no-js .autoplay-gate {
  display: none;
}
