:root {
  --ink: #122022;
  --muted: #657574;
  --paper: #f6f0e4;
  --panel: #fffaf1;
  --line: rgba(18, 32, 34, 0.16);
  --dawn: #d36e50;
  --day: #2f766e;
  --noon: #b38425;
  --dusk: #b95040;
  --night: #253b59;
  --current: var(--dawn);
  --current-soft: rgba(211, 110, 80, 0.18);
  --archive: #fff1d3;
  --archive-deep: #6f4722;
  --field-dark: rgba(18, 26, 27, 0.74);
  --field-line: rgba(255, 250, 241, 0.22);
  --scene-count: 6;
  --scene-width: 100vw;
  --world-width: 600vw;
  --city-bg-image: url("./assets/imgs/bg.png");
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 18px 55px rgba(12, 24, 28, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  touch-action: manipulation;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: #172331;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body[data-period="dawn"] {
  --current: var(--dawn);
  --current-soft: rgba(211, 110, 80, 0.2);
}

body[data-period="day"] {
  --current: var(--day);
  --current-soft: rgba(47, 118, 110, 0.2);
}

body[data-period="noon"] {
  --current: var(--noon);
  --current-soft: rgba(179, 132, 37, 0.22);
}

body[data-period="dusk"] {
  --current: var(--dusk);
  --current-soft: rgba(185, 80, 64, 0.22);
}

body[data-period="night"] {
  --current: var(--night);
  --current-soft: rgba(37, 59, 89, 0.26);
}

.scroll-app {
  position: relative;
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  background:
    linear-gradient(180deg, #d8e3e4 0%, #ead0a7 58%, #172331 100%);
  transition: background 520ms var(--ease);
}

.hud {
  position: absolute;
  top: auto;
  right: 0;
  bottom: calc(78px + env(safe-area-inset-bottom));
  left: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 14px;
  pointer-events: none;
}

.hud-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
  pointer-events: auto;
}

.autoplay-btn,
.ambient-btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  gap: 8px;
  padding: 8px 10px;
  color: #fffaf1;
  background: rgba(18, 26, 27, 0.64);
  border: 1px solid rgba(255, 250, 241, 0.18);
  border-radius: 999px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 18px rgba(10, 20, 24, 0.14);
}

.ambient-btn {
  min-height: 34px;
  padding: 7px 10px;
  color: rgba(255, 250, 241, 0.74);
  font-size: 12px;
}

.ambient-btn[aria-pressed="true"] {
  color: #fffaf1;
  border-color: rgba(244, 197, 108, 0.38);
}

.play-dot {
  width: 9px;
  height: 9px;
  background: #f4c56c;
  border-radius: 50%;
  box-shadow: none;
  animation: none;
}

.autoplay-btn[aria-pressed="false"] .play-dot {
  background: rgba(255, 255, 255, 0.5);
  animation: none;
}

.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  --focus-x: 50vw;
}

.viewport::after {
  position: absolute;
  inset: 0;
  z-index: 11;
  content: "";
  background:
    linear-gradient(180deg, rgba(9, 17, 23, 0.08), transparent 24%, transparent 72%, rgba(9, 17, 23, 0.16)),
    linear-gradient(90deg, rgba(9, 17, 23, 0.14), transparent 18%, transparent 82%, rgba(9, 17, 23, 0.14));
  opacity: 0.78;
  pointer-events: none;
  transition:
    background 520ms var(--ease),
    opacity 520ms var(--ease);
}

.viewport.is-dragging {
  cursor: grabbing;
}

.viewport.is-autoplaying::after {
  animation: focusBreathe 3.8s ease-in-out infinite;
}

.city-scroll {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--world-width);
  height: 100%;
  transform: translate3d(0, 0, 0);
  transition: transform 900ms var(--ease);
  will-change: transform;
}

.city-scroll::before {
  position: absolute;
  inset: 0;
  content: "";
  background-image: var(--city-bg-image);
  background-position: left center;
  background-repeat: no-repeat;
  background-size: var(--world-width) 100%;
}

.city-scroll::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(10, 18, 25, 0.18), transparent 22%, transparent 72%, rgba(10, 18, 25, 0.2)),
    linear-gradient(90deg, rgba(10, 18, 25, 0.12), transparent 12%, transparent 88%, rgba(10, 18, 25, 0.14));
  pointer-events: none;
}

.viewport.is-dragging .city-scroll {
  transition: none;
}

.sky-layer {
  position: absolute;
  inset: 0;
  display: none;
  background:
    linear-gradient(90deg, rgba(16, 27, 38, 0.38), transparent 14%, transparent 75%, rgba(14, 21, 34, 0.7)),
    linear-gradient(180deg, #cfdde4 0%, #f3d3a6 48%, #172331 100%);
}

.sun-or-moon {
  position: absolute;
  top: 13vh;
  left: 2700px;
  display: none;
  width: 70px;
  height: 70px;
  background: #f6c86a;
  border-radius: 50%;
  box-shadow: 0 0 38px rgba(246, 200, 106, 0.35);
}

.mountain-layer {
  position: absolute;
  right: 0;
  bottom: 30vh;
  left: 0;
  display: none;
  height: 42vh;
  background-repeat: repeat-x;
  background-size: 720px 100%;
}

.layer-back {
  opacity: 0.88;
  background-image: url("data:image/svg+xml,%3Csvg width='720' height='260' viewBox='0 0 720 260' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 190c72-60 132-80 204-34 54 35 94 13 148-45 58-62 112-66 176-8 66 60 118 78 192 42v115H0z' fill='%23b9d0c5'/%3E%3C/svg%3E");
}

.layer-front {
  bottom: 25vh;
  opacity: 0.95;
  background-image: url("data:image/svg+xml,%3Csvg width='720' height='250' viewBox='0 0 720 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 180c90-48 160-44 230-8 70 36 128 20 190-30 92-74 184-54 300 32v76H0z' fill='%23d2dfd5'/%3E%3C/svg%3E");
}

.river-layer {
  position: absolute;
  right: 0;
  bottom: 15vh;
  left: 0;
  display: none;
  height: 22vh;
  background:
    linear-gradient(90deg, rgba(91, 139, 160, 0.14), rgba(91, 139, 160, 0.38), rgba(25, 46, 69, 0.42)),
    repeating-linear-gradient(-8deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 48px);
  clip-path: polygon(0 42%, 12% 28%, 26% 52%, 42% 30%, 58% 48%, 74% 24%, 100% 40%, 100% 100%, 0 100%);
}

.road-layer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  height: 18vh;
  background:
    linear-gradient(180deg, #64584b, #302c2d),
    repeating-linear-gradient(90deg, transparent 0 120px, rgba(255, 255, 255, 0.16) 120px 160px);
  border-top: 8px solid rgba(255, 250, 241, 0.54);
}

.building-layer {
  position: absolute;
  right: 0;
  bottom: 17vh;
  left: 0;
  height: 32vh;
  display: none;
}

.building {
  position: absolute;
  bottom: 0;
  width: var(--w);
  height: var(--h);
  background: rgba(255, 250, 241, 0.82);
  border: 2px solid rgba(18, 32, 34, 0.18);
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.building::before {
  position: absolute;
  inset: 18px 14px auto;
  height: calc(var(--h) - 36px);
  content: "";
  background:
    repeating-linear-gradient(0deg, transparent 0 20px, rgba(18, 32, 34, 0.16) 20px 24px),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(18, 32, 34, 0.16) 26px 30px);
}

.station-layer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 6;
  height: 100%;
  pointer-events: none;
}

.station-plate {
  position: absolute;
  bottom: 55vh;
  left: var(--x);
  display: grid;
  gap: 3px;
  min-width: 112px;
  max-width: 172px;
  padding: 9px 10px 8px;
  color: #fffaf1;
  background:
    linear-gradient(180deg, rgba(18, 26, 27, 0.62), rgba(18, 26, 27, 0.38)),
    rgba(18, 26, 27, 0.46);
  border: 1px solid rgba(255, 250, 241, 0.16);
  border-top: 3px solid var(--paper-color);
  border-radius: 3px;
  box-shadow: 0 14px 26px rgba(8, 16, 20, 0.18);
  backdrop-filter: blur(4px);
  transform: translateX(-12%);
}

.station-plate::after {
  position: absolute;
  top: 100%;
  left: 16px;
  width: 1px;
  height: 34px;
  content: "";
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.42), transparent);
}

.station-plate b,
.station-plate em,
.station-plate i {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-plate b {
  color: #f4c56c;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.station-plate em {
  color: rgba(255, 250, 241, 0.9);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.station-plate i {
  color: rgba(255, 250, 241, 0.62);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.workers-layer {
  position: absolute;
  right: 0;
  bottom: 16vh;
  left: 0;
  height: 48vh;
}

.worker-figure {
  position: absolute;
  bottom: var(--bottom, 0px);
  left: var(--x);
  z-index: 8;
  display: grid;
  width: min(38vw, 144px);
  gap: 6px;
  place-items: center;
  padding: 0;
  color: #fffaf1;
  background: transparent;
  border: 0;
  cursor: pointer;
  isolation: isolate;
  opacity: 0.7;
  transform: translateX(-50%);
  transition:
    transform 360ms var(--ease),
    filter 360ms var(--ease),
    opacity 360ms var(--ease);
}

.worker-figure.is-active {
  opacity: 1;
  filter: drop-shadow(0 16px 26px rgba(13, 23, 28, 0.28));
  transform: translateX(-50%) translateY(-8px) scale(1.08);
}

.worker-figure.is-picked {
  animation: pickPulse 520ms var(--ease);
}

.viewport.is-autoplaying .worker-figure:not(.is-active) {
  opacity: 0.52;
}

.worker-figure:focus-visible {
  outline: none;
}

.paper-person {
  position: relative;
  z-index: 1;
  display: block;
  width: min(38vw, 144px);
  aspect-ratio: 1;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  transform-origin: 50% 78%;
  will-change: transform;
  filter:
    drop-shadow(0 10px 0 rgba(255, 250, 241, 0.45))
    drop-shadow(0 18px 20px rgba(13, 23, 28, 0.22));
}

.worker-figure[data-worker-id="cleaner"].is-active .paper-person,
.story-modal[data-worker-id="cleaner"] .story-avatar .paper-person {
  animation: cleanerBody 1.35s ease-in-out infinite;
}

.worker-figure[data-worker-id="breakfast"].is-active .paper-person,
.story-modal[data-worker-id="breakfast"] .story-avatar .paper-person {
  animation: breakfastBody 1.45s ease-in-out infinite;
}

.worker-figure[data-worker-id="driver"].is-active .paper-person,
.story-modal[data-worker-id="driver"] .story-avatar .paper-person {
  animation: driverBody 1.2s ease-in-out infinite;
}

.worker-figure[data-worker-id="municipal"].is-active .paper-person,
.story-modal[data-worker-id="municipal"] .story-avatar .paper-person {
  animation: municipalBody 1.7s ease-in-out infinite;
}

.worker-figure[data-worker-id="courier"].is-active .paper-person,
.story-modal[data-worker-id="courier"] .story-avatar .paper-person {
  animation: courierBody 1.05s ease-in-out infinite;
}

.worker-figure[data-worker-id="night"].is-active .paper-person,
.story-modal[data-worker-id="night"] .story-avatar .paper-person {
  animation: nightBody 2.2s ease-in-out infinite;
}

.sound-mark {
  position: absolute;
  top: 5%;
  right: 8%;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 32px;
  height: 24px;
  color: #172331;
  background: rgba(255, 250, 241, 0.88);
  border: 1px solid rgba(23, 35, 49, 0.18);
  border-radius: 4px;
  box-shadow: 0 6px 12px rgba(13, 23, 28, 0.14);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 360ms var(--ease),
    transform 360ms var(--ease);
}

.sound-mark::before {
  width: auto;
  height: auto;
  content: "";
  background: none;
  border-radius: 0;
  box-shadow: none;
}

.sound-mark i {
  width: 3px;
  height: 8px;
  background: var(--paper-color);
  border-radius: 1px;
  transform-origin: 50% 100%;
  animation: soundBar 1.1s ease-in-out infinite;
  animation-play-state: paused;
}

.sound-mark i:nth-child(2) {
  height: 12px;
  animation-delay: 120ms;
}

.sound-mark i:nth-child(3) {
  height: 9px;
  animation-delay: 240ms;
}

.worker-figure.is-active .sound-mark {
  opacity: 1;
  transform: translateY(0);
  animation: none;
}

.worker-figure.is-active .sound-mark i {
  animation-play-state: running;
}

.current-card {
  position: absolute;
  top: var(--card-top, calc(6vh + env(safe-area-inset-top)));
  right: auto;
  bottom: auto;
  left: var(--card-left, clamp(18px, 6vw, 82px));
  z-index: 21;
  width: var(--card-width, min(44vw, 460px));
  max-width: calc(100vw - 190px);
  padding: 18px 20px 18px 22px;
  color: #fffaf1;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  filter: drop-shadow(0 18px 26px rgba(7, 14, 18, 0.22));
  isolation: isolate;
  opacity: 1;
  pointer-events: none;
  transform: translateX(var(--card-shift-x, 0)) translateY(0);
  transform-origin: 50% 50%;
  transition:
    top 1200ms var(--ease),
    left 1200ms var(--ease),
    opacity 1280ms ease,
    transform 1200ms var(--ease),
    filter 980ms var(--ease);
}

.current-card::before {
  position: absolute;
  inset: -10px -18px -11px -16px;
  z-index: -1;
  content: "";
  background:
    radial-gradient(circle at 18% 0%, color-mix(in srgb, var(--current) 24%, transparent), transparent 46%),
    linear-gradient(105deg, rgba(18, 26, 27, 0.58), rgba(18, 26, 27, 0.34) 58%, rgba(18, 26, 27, 0.08)),
    rgba(255, 250, 241, 0.08);
  border: 1px solid rgba(255, 250, 241, 0.12);
  border-radius: 4px 18px 6px 14px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 241, 0.06),
    0 18px 38px rgba(6, 15, 19, 0.18);
  opacity: 0.84;
  transform: rotate(-0.7deg) skewX(-1deg);
  mask-image: linear-gradient(90deg, #000 0 78%, rgba(0, 0, 0, 0.28) 100%);
}

.current-card::after {
  position: absolute;
  bottom: 8px;
  left: 20px;
  width: min(148px, 42%);
  height: 3px;
  content: "";
  background: linear-gradient(90deg, var(--current), rgba(244, 197, 108, 0.42), transparent);
  border-radius: 999px;
  opacity: 0.86;
}

.current-card h2 {
  display: grid;
  gap: 4px;
  margin: 0;
  font-family: "Songti SC", "STKaiti", "KaiTi", serif;
  font-size: clamp(28px, 4vw, 54px);
  font-weight: 900;
  line-height: 0.98;
  text-shadow:
    0 2px 0 rgba(18, 26, 27, 0.18),
    0 12px 24px rgba(6, 15, 19, 0.26);
}

.current-card time {
  display: block;
  color: #f6ce80;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 4.8vw, 64px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 0.86;
}

.current-card span {
  min-width: 0;
  color: rgba(255, 250, 241, 0.96);
  overflow-wrap: anywhere;
}

.current-card time::after {
  content: "";
}

.current-card.is-closing {
  filter: drop-shadow(0 22px 34px rgba(7, 14, 18, 0.24));
}

.current-card.is-switching {
  opacity: 0;
  transform: translateX(var(--card-shift-x, 0)) translateY(-12px) scale(0.985);
}

.current-card[data-caption-align="center"] {
  text-align: center;
}

.current-card[data-caption-align="center"]::after {
  right: 0;
  left: 0;
  margin: auto;
}

.current-card[data-caption-align="right"] {
  text-align: right;
}

.current-card[data-caption-align="right"]::before {
  transform: rotate(0.7deg) skewX(1deg);
}

.current-card[data-caption-align="right"]::after {
  right: 20px;
  left: auto;
}

.current-card.is-closing h2 {
  color: #fff4dc;
}

.summary-panel {
  position: absolute;
  right: 14px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 17;
  display: grid;
  gap: 12px;
  max-width: 680px;
  padding: 18px 16px 15px;
  color: #fffaf1;
  background:
    linear-gradient(180deg, rgba(18, 26, 27, 0.9), rgba(18, 26, 27, 0.78)),
    rgba(18, 26, 27, 0.82);
  border: 1px solid rgba(255, 250, 241, 0.2);
  border-left: 4px solid var(--current);
  border-radius: 4px;
  box-shadow: 0 20px 42px rgba(8, 16, 20, 0.3);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition:
    opacity 520ms var(--ease),
    transform 520ms var(--ease);
}

.summary-panel::before {
  position: absolute;
  top: 14px;
  right: 16px;
  content: "24H";
  color: rgba(255, 250, 241, 0.18);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.summary-panel[hidden] {
  display: none;
}

.summary-panel.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.summary-copy p,
.summary-copy h2 {
  margin: 0;
}

.summary-copy p {
  color: #f4c56c;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.summary-copy h2 {
  max-width: 420px;
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.16;
}

.summary-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.summary-worker {
  display: grid;
  min-width: 0;
  gap: 4px;
  justify-items: center;
  padding: 9px 5px 8px;
  color: rgba(255, 250, 241, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.1), rgba(255, 250, 241, 0.04));
  border: 1px solid rgba(255, 250, 241, 0.16);
  border-radius: 3px;
  cursor: pointer;
  box-shadow: none;
}

.summary-worker:focus-visible,
.time-node:focus-visible,
.audio-btn:focus-visible,
.summary-actions button:focus-visible,
.close-btn:focus-visible {
  outline: 2px solid rgba(244, 197, 108, 0.82);
  outline-offset: 3px;
}

.summary-worker img {
  display: block;
  width: 38px;
  aspect-ratio: 1;
  object-fit: contain;
  pointer-events: none;
}

.summary-worker strong,
.summary-worker span {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-worker strong {
  color: #f4c56c;
  font-size: 11px;
}

.summary-worker span {
  font-size: 10px;
  font-weight: 800;
}

.summary-actions {
  display: flex;
  justify-content: flex-end;
}

.summary-actions button {
  min-height: 36px;
  padding: 8px 16px;
  color: #fffaf1;
  background: rgba(255, 250, 241, 0.1);
  border: 1px solid rgba(255, 250, 241, 0.3);
  border-radius: 3px;
  cursor: pointer;
  font-weight: 900;
}

.timeline {
  position: absolute;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 18;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  padding: 22px 10px 8px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 250, 241, 0.08) 0 1px, transparent 1px 18px),
    linear-gradient(180deg, rgba(18, 26, 27, 0.84), rgba(18, 26, 27, 0.72));
  border: 1px solid rgba(255, 250, 241, 0.16);
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(8, 16, 20, 0.22);
  backdrop-filter: blur(9px);
  isolation: isolate;
  --timeline-progress: 0%;
}

.timeline-scale {
  position: absolute;
  top: 6px;
  right: 12px;
  left: 12px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  color: rgba(255, 250, 241, 0.42);
  font-size: 10px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.timeline-progress {
  position: absolute;
  top: 26px;
  right: 14px;
  left: 14px;
  z-index: 0;
  height: 3px;
  overflow: visible;
  background:
    repeating-linear-gradient(90deg, rgba(255, 250, 241, 0.28) 0 1px, transparent 1px 14px),
    rgba(255, 250, 241, 0.12);
  border-radius: 0;
  pointer-events: none;
}

.timeline-progress i {
  position: relative;
  display: block;
  width: var(--timeline-progress);
  height: 100%;
  background: var(--current);
  border-radius: inherit;
  transition: width 160ms linear;
}

.timeline-progress i::after {
  position: absolute;
  top: 50%;
  right: 0;
  width: 8px;
  height: 18px;
  content: "";
  background: #fffaf1;
  border: 1px solid rgba(18, 26, 27, 0.28);
  border-radius: 2px;
  box-shadow: 0 0 0 3px rgba(18, 26, 27, 0.48);
  transform: translate(50%, -50%);
}

.time-node {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 34px;
  padding: 0;
  color: rgba(255, 250, 241, 0.7);
  background: transparent;
  border: 0;
  border-right: 1px solid rgba(255, 250, 241, 0.08);
  cursor: pointer;
}

.time-node:last-child {
  border-right: 0;
}

.time-node::before {
  position: absolute;
  top: 3px;
  left: 50%;
  width: 2px;
  height: 18px;
  content: "";
  background: rgba(255, 250, 241, 0.34);
  border: 0;
  border-radius: 1px;
  transform: translateX(-50%);
  transition:
    background 240ms var(--ease),
    box-shadow 240ms var(--ease),
    transform 240ms var(--ease);
}

.time-node.is-active {
  color: #fffaf1;
}

.time-node.is-active::before {
  background: var(--current);
  box-shadow: 0 0 0 3px rgba(255, 250, 241, 0.12);
  transform: translateX(-50%) scaleY(1.2);
}

.time-node span {
  position: absolute;
  top: 23px;
  left: 50%;
  color: rgba(255, 250, 241, 0.54);
  font-size: 10px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transform: translateX(-50%);
  transition: color 240ms var(--ease);
}

.time-node.is-active span {
  color: #fffaf1;
}

.timeline.is-complete .time-node {
  color: #fffaf1;
}

.timeline.is-complete .time-node::before {
  background: var(--current);
  box-shadow: 0 0 0 4px rgba(255, 250, 241, 0.12);
}

.story-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
  perspective: 1200px;
}

.story-modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 250, 241, 0.08), transparent 34%),
    rgba(8, 16, 20, 0.58);
  backdrop-filter: blur(3px);
  animation: backdropWarmIn 840ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.story-sheet {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  width: min(100%, 540px);
  height: min(80vh, 620px);
  height: min(80dvh, 620px);
  max-height: calc(100vh - 58px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 58px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(111, 75, 35, 0.08), transparent 9%, transparent 91%, rgba(111, 75, 35, 0.08)),
    repeating-linear-gradient(0deg, rgba(102, 71, 39, 0.035) 0 1px, transparent 1px 10px),
    #f4e4c4;
  border: 1px solid rgba(92, 58, 28, 0.22);
  border-radius: 6px;
  box-shadow:
    0 22px 46px rgba(8, 16, 20, 0.38),
    0 0 0 1px rgba(62, 42, 24, 0.18);
  transform-origin: 50% 54%;
  animation: sheetIn 960ms cubic-bezier(0.18, 0.86, 0.22, 1) both;
}

.story-sheet::before {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 1;
  content: "";
  border: 1px solid rgba(104, 70, 35, 0.16);
  border-radius: 3px;
  box-shadow: none;
  pointer-events: none;
}

.story-sheet::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.22), transparent 24%, transparent 76%, rgba(104, 70, 35, 0.06));
  pointer-events: none;
}

.close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 6;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #5c3a1c;
  background: rgba(255, 246, 226, 0.78);
  border: 1px solid rgba(104, 70, 35, 0.18);
  border-radius: 4px;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  box-shadow: none;
}

.story-header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 126px;
  padding: 22px 60px 16px 20px;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, 0.36), rgba(255, 250, 241, 0.12)),
    rgba(255, 250, 241, 0.2);
  border-bottom: 1px solid rgba(104, 70, 35, 0.16);
}

.story-header::after {
  position: absolute;
  right: 64px;
  bottom: -1px;
  left: 20px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, var(--current), rgba(111, 71, 34, 0.18), transparent);
}

.story-avatar {
  position: relative;
  display: grid;
  width: 84px;
  aspect-ratio: 1;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.56), rgba(255, 250, 241, 0.18));
  border: 1px solid rgba(104, 70, 35, 0.2);
  border-left: 3px solid var(--current);
  border-radius: 3px;
  box-shadow: none;
  animation: portraitIn 760ms cubic-bezier(0.18, 0.86, 0.22, 1) 90ms both;
}

.story-avatar::after {
  position: absolute;
  inset: -8px;
  content: "";
  border: 1px solid rgba(104, 70, 35, 0.2);
  border-radius: 6px;
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}

.story-avatar .paper-person {
  position: relative;
  z-index: 1;
  width: 82px;
  filter:
    drop-shadow(0 5px 0 rgba(255, 250, 241, 0.42))
    drop-shadow(0 10px 14px rgba(8, 16, 20, 0.16));
}

.story-heading {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.story-file {
  display: inline-flex;
  justify-self: start;
  max-width: 100%;
  padding: 5px 8px 4px;
  overflow: hidden;
  color: #513318;
  background: rgba(255, 250, 241, 0.5);
  border: 1px solid rgba(104, 70, 35, 0.18);
  border-left: 3px solid var(--current);
  border-radius: 3px;
  box-shadow: none;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-content {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 0;
  gap: 10px;
  align-content: start;
  overflow-y: auto;
  padding: 18px 20px 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.story-content::-webkit-scrollbar {
  width: 0;
}

.story-content > * {
  width: 100%;
  max-width: 560px;
  justify-self: center;
}

.story-time {
  margin: 0;
  color: #76522d;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  text-align: left;
}

.story-heading h2 {
  margin: 0;
  color: #442b16;
  font-size: clamp(24px, 6vw, 31px);
  line-height: 1.12;
  text-align: left;
}

.story-scene,
.story-meaning,
.audio-panel p {
  margin: 0;
  color: #63513d;
  font-size: 14px;
  line-height: 1.68;
}

.story-scene {
  margin-top: 0;
  padding: 13px 14px;
  color: #4f3c2b;
  background: rgba(255, 250, 241, 0.34);
  border: 1px solid rgba(104, 70, 35, 0.12);
  border-radius: 3px;
}

blockquote {
  position: relative;
  margin: 2px 0;
  padding: 14px 15px 14px 16px;
  color: #442b16;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, 0.56), rgba(255, 250, 241, 0.28));
  border: 1px solid rgba(104, 70, 35, 0.14);
  border-left: 5px solid var(--current);
  border-radius: 3px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.64;
  box-shadow: none;
}

.audio-panel {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  overflow: hidden;
  margin: 0 16px 16px;
  padding: 13px 13px 12px;
  color: #332415;
  background:
    repeating-linear-gradient(90deg, rgba(104, 70, 35, 0.04) 0 1px, transparent 1px 9px),
    rgba(255, 250, 241, 0.42);
  border: 1px solid rgba(104, 70, 35, 0.2);
  border-left: 4px solid var(--current);
  border-radius: 3px;
  box-shadow: none;
}

.audio-panel::before {
  display: none;
}

.audio-panel::after {
  position: absolute;
  top: 16px;
  right: 14px;
  width: 8px;
  height: 8px;
  content: "";
  background: rgba(104, 70, 35, 0.36);
  border-radius: 2px;
  box-shadow: none;
}

.audio-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  color: #2f261d;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.74), rgba(255, 250, 241, 0.42));
  border: 1px solid rgba(104, 70, 35, 0.2);
  border-radius: 3px;
  cursor: pointer;
  font-weight: 900;
  box-shadow: none;
}

#audioIcon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  color: #fffaf1;
  background: var(--current);
  border-radius: 2px;
  font-size: 13px;
  line-height: 1;
}

.audio-progress {
  position: relative;
  z-index: 1;
  overflow: hidden;
  height: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(104, 70, 35, 0.16) 0 1px, transparent 1px 10px),
    rgba(104, 70, 35, 0.12);
  border-radius: 0;
}

.audio-progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--current);
  transition: width 120ms linear;
}

.story-meaning {
  padding: 12px 14px;
  color: #5d655a;
  background: rgba(255, 250, 241, 0.24);
  border: 1px solid rgba(104, 70, 35, 0.1);
  border-radius: 3px;
}

.audio-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 18px;
  color: #5f3d1f;
  font-size: 12px;
  font-weight: 900;
}

.audio-head span:last-child {
  color: rgba(95, 61, 31, 0.74);
  font-variant-numeric: tabular-nums;
}

.audio-panel p {
  position: relative;
  z-index: 1;
  color: rgba(78, 60, 42, 0.84);
  font-size: 12px;
  line-height: 1.5;
}

.story-modal.is-listening .story-avatar::after {
  animation: portraitSignal 1.8s ease-out infinite;
}

.story-modal.is-listening .audio-panel::after {
  background: var(--current);
  animation: audioRecPulse 1.2s ease-out infinite;
}

.story-modal.has-listened .audio-panel::after {
  background: #5f3d1f;
  box-shadow: none;
}

.intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(8, 16, 20, 0.46);
  backdrop-filter: blur(2px);
  animation: introFadeIn 620ms var(--ease) both;
}

.intro-overlay[hidden] {
  display: none;
}

.intro-overlay.is-leaving {
  animation: introFadeOut 520ms var(--ease) both;
}

.intro-card {
  display: grid;
  gap: 10px;
  width: min(86vw, 420px);
  padding: 22px 20px;
  color: #fffaf1;
  text-align: left;
  background: rgba(18, 26, 27, 0.76);
  border: 1px solid rgba(255, 250, 241, 0.18);
  border-left: 4px solid var(--current);
  border-radius: 4px;
  box-shadow: 0 18px 38px rgba(8, 16, 20, 0.28);
}

.intro-card p,
.intro-card h2,
.intro-card span {
  margin: 0;
}

.intro-card p {
  color: #f4c56c;
  font-size: 13px;
  font-weight: 900;
}

.intro-card h2 {
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.08;
}

.intro-card span {
  color: rgba(255, 250, 241, 0.76);
  font-size: 14px;
  line-height: 1.65;
}

.intro-card button {
  justify-self: start;
  min-height: 42px;
  margin-top: 4px;
  padding: 9px 18px;
  color: #fffaf1;
  background: rgba(255, 250, 241, 0.08);
  border: 1px solid rgba(255, 250, 241, 0.32);
  border-radius: 4px;
  cursor: pointer;
  font-weight: 900;
}

@keyframes soundBar {
  0%,
  100% {
    transform: scaleY(0.55);
  }
  48% {
    transform: scaleY(1.22);
  }
}

@keyframes portraitSignal {
  0% {
    opacity: 0.58;
    transform: scale(0.92);
  }
  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

@keyframes audioRecPulse {
  0% {
    opacity: 0.58;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.58;
  }
}

@keyframes cleanerBody {
  0%,
  100% {
    transform: rotate(-1.5deg) translateX(-1px);
  }
  50% {
    transform: rotate(2.5deg) translateX(2px);
  }
}

@keyframes breakfastBody {
  0%,
  100% {
    transform: translateY(0) scaleY(1);
  }
  50% {
    transform: translateY(3px) scaleY(0.985);
  }
}

@keyframes driverBody {
  0%,
  100% {
    transform: rotate(-0.8deg);
  }
  50% {
    transform: rotate(0.8deg);
  }
}

@keyframes municipalBody {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(2px);
  }
}

@keyframes courierBody {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-4px) rotate(1deg);
  }
}

@keyframes nightBody {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.015);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(244, 197, 108, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(244, 197, 108, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(244, 197, 108, 0);
  }
}

@keyframes figureFloat {
  0%,
  100% {
    margin-bottom: 0;
  }
  50% {
    margin-bottom: 5px;
  }
}

@keyframes pickPulse {
  0% {
    filter: drop-shadow(0 16px 26px rgba(13, 23, 28, 0.28));
  }
  42% {
    filter:
      drop-shadow(0 0 0 rgba(244, 197, 108, 0.9))
      drop-shadow(0 22px 34px rgba(13, 23, 28, 0.3));
  }
  100% {
    filter: drop-shadow(0 16px 26px rgba(13, 23, 28, 0.28));
  }
}

@keyframes focusBreathe {
  0%,
  100% {
    opacity: 0.82;
  }
  50% {
    opacity: 1;
  }
}

@keyframes introFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes introFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: scale(1.01);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes backdropWarmIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(2px);
  }
}

@keyframes sheetIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes portraitIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 760px) {
  .hud {
    bottom: calc(92px + env(safe-area-inset-bottom));
    padding: 0 28px;
  }

  .current-card {
    top: var(--card-top, calc(6vh + env(safe-area-inset-top)));
    left: var(--card-left, clamp(18px, 6vw, 82px));
    max-width: calc(100vw - 210px);
    padding: 18px 20px 18px 22px;
  }

  .current-card h2 {
    font-size: clamp(30px, 4vw, 54px);
  }

  .summary-panel {
    right: auto;
    bottom: calc(112px + env(safe-area-inset-bottom));
    left: 28px;
    width: 520px;
  }

  .summary-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .timeline {
    right: 28px;
    bottom: 18px;
    left: 28px;
    border-radius: 8px;
  }

  .story-modal {
    place-items: center;
    padding: calc(22px + env(safe-area-inset-top)) 22px calc(22px + env(safe-area-inset-bottom));
  }

  .story-sheet {
    width: min(100%, 620px);
    height: min(80vh, 660px);
    height: min(80dvh, 660px);
    max-height: calc(100vh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    max-height: calc(100dvh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 8px;
  }

  .story-header {
    grid-template-columns: 96px minmax(0, 1fr);
    min-height: 124px;
    padding: 24px 62px 16px 24px;
  }

  .story-avatar,
  .story-avatar .paper-person {
    width: 92px;
  }

  .story-content {
    max-height: none;
    padding-right: 32px;
    padding-left: 32px;
  }
}

@media (max-width: 390px) {
  .current-card {
    max-width: none;
  }

  .autoplay-btn {
    max-width: 112px;
    font-size: 12px;
  }

  .ambient-btn {
    max-width: 96px;
    font-size: 11px;
  }

  .summary-panel {
    bottom: calc(98px + env(safe-area-inset-bottom));
    padding: 12px;
  }

  .summary-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .worker-figure {
    width: min(36vw, 128px);
  }

  .paper-person {
    width: min(36vw, 128px);
  }

  .story-header {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    min-height: 106px;
    padding: 18px 54px 12px 16px;
  }

  .timeline-scale {
    left: 10px;
    font-size: 9px;
  }

  .story-avatar,
  .story-avatar .paper-person {
    width: 70px;
  }

  .story-content {
    max-height: none;
    gap: 10px;
    padding-right: 18px;
    padding-bottom: 18px;
    padding-left: 18px;
  }

  .story-heading h2 {
    font-size: 22px;
  }

  blockquote {
    font-size: 15px;
  }

  .audio-btn {
    min-height: 40px;
  }
}

/* Production polish layer */
.scroll-app {
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.08), transparent 34%),
    linear-gradient(180deg, #d7e3e2 0%, #edc993 54%, #172331 100%);
}

body[data-period="day"] .scroll-app {
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.1), transparent 38%),
    linear-gradient(180deg, #c6dfde 0%, #e9d6a7 58%, #1f3d46 100%);
}

body[data-period="noon"] .scroll-app {
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.14), transparent 34%),
    linear-gradient(180deg, #d7e4df 0%, #efc86f 54%, #25333d 100%);
}

body[data-period="dusk"] .scroll-app {
  background:
    linear-gradient(180deg, rgba(255, 238, 208, 0.16), transparent 34%),
    linear-gradient(180deg, #d1dce1 0%, #d98968 58%, #1d2737 100%);
}

body[data-period="night"] .scroll-app {
  background:
    radial-gradient(circle at 70% 17%, rgba(244, 197, 108, 0.2), transparent 16%),
    linear-gradient(180deg, #1d2c44 0%, #283a52 50%, #111923 100%);
}

.city-scroll::before {
  filter: saturate(0.98) contrast(1.03);
}

.city-scroll::after {
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.16), transparent 18%, transparent 68%, rgba(8, 16, 20, 0.32)),
    linear-gradient(90deg, rgba(8, 16, 20, 0.22), transparent 16%, transparent 82%, rgba(8, 16, 20, 0.26)),
    repeating-linear-gradient(90deg, rgba(255, 250, 241, 0.05) 0 1px, transparent 1px 74px);
  mix-blend-mode: normal;
}

.viewport::before {
  position: absolute;
  inset: 0;
  z-index: 12;
  content: "";
  background:
    radial-gradient(circle at var(--focus-x) 62%, rgba(255, 250, 241, 0.28), transparent 16%),
    radial-gradient(circle at var(--focus-x) 64%, rgba(244, 197, 108, 0.16), transparent 26%);
  opacity: 0.74;
  pointer-events: none;
  transition: background 420ms var(--ease), opacity 420ms var(--ease);
}

.viewport.is-dragging::before {
  opacity: 0.48;
}

.worker-figure::before,
.worker-figure::after {
  position: absolute;
  left: 50%;
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
}

.worker-figure::before {
  bottom: 7%;
  z-index: 0;
  width: 72%;
  height: 14%;
  background: radial-gradient(ellipse, rgba(9, 17, 23, 0.28), transparent 70%);
  filter: blur(1px);
}

.worker-figure::after {
  bottom: 3%;
  z-index: 0;
  width: 58%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 250, 241, 0.42), transparent);
  opacity: 0;
  transition: opacity 320ms var(--ease);
}

.worker-figure.is-active::after {
  opacity: 1;
}

.worker-label {
  position: absolute;
  right: 50%;
  bottom: -30px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 170px;
  padding: 5px 8px;
  overflow: hidden;
  color: rgba(255, 250, 241, 0.92);
  background: rgba(18, 26, 27, 0.7);
  border: 1px solid rgba(255, 250, 241, 0.16);
  border-left: 3px solid var(--paper-color);
  border-radius: 3px;
  box-shadow: 0 8px 18px rgba(8, 16, 20, 0.18);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(50%) translateY(4px);
  transition: opacity 260ms var(--ease), transform 260ms var(--ease);
}

.worker-label b {
  color: #f4c56c;
  font-variant-numeric: tabular-nums;
}

.worker-figure.is-active .worker-label {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

.current-card {
  display: grid;
  gap: 8px;
}

.current-card p,
.current-card strong {
  margin: 0;
}

.current-card p {
  width: max-content;
  max-width: 100%;
  padding: 5px 8px 4px;
  color: #1a2322;
  background: color-mix(in srgb, var(--current) 78%, #fffaf1);
  border-radius: 2px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  justify-self: start;
  box-shadow: 0 8px 18px rgba(7, 14, 18, 0.12);
}

.current-card[data-caption-align="center"] p {
  justify-self: center;
}

.current-card[data-caption-align="right"] p {
  justify-self: end;
}

.current-card strong {
  max-width: 100%;
  color: rgba(255, 250, 241, 0.78);
  font-family: "Songti SC", "STKaiti", "KaiTi", serif;
  font-size: clamp(14px, 1.45vw, 18px);
  font-weight: 700;
  line-height: 1.55;
  text-shadow: 0 8px 18px rgba(7, 14, 18, 0.28);
}

.summary-panel {
  max-width: 760px;
}

.summary-copy {
  display: grid;
  gap: 4px;
  padding-right: 58px;
}

.summary-copy span {
  color: rgba(255, 250, 241, 0.68);
  font-size: 13px;
  line-height: 1.45;
}

.summary-copy p {
  letter-spacing: 0;
}

.summary-worker {
  align-content: start;
  min-height: 118px;
  text-align: center;
}

.summary-worker em {
  display: -webkit-box;
  overflow: hidden;
  max-width: 100%;
  margin-top: 1px;
  color: rgba(255, 250, 241, 0.58);
  font-size: 10px;
  font-style: normal;
  font-weight: 650;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.intro-overlay {
  place-items: center;
  padding: clamp(22px, 5vw, 72px);
  color: #fffaf1;
  background:
    linear-gradient(90deg, #0d171d 0 1px, transparent 1px 100%),
    linear-gradient(180deg, #0d171d 0 1px, transparent 1px 100%),
    linear-gradient(180deg, #15242d 0%, #101b22 48%, #0b1218 100%);
  background-size: 44px 44px, 44px 44px, auto;
  backdrop-filter: none;
}

.intro-overlay::before,
.intro-overlay::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.intro-overlay::before {
  inset: 18px;
  border: 1px solid #2d4348;
  border-radius: 6px;
}

.intro-overlay::after {
  right: clamp(18px, 5vw, 58px);
  bottom: clamp(18px, 5vw, 58px);
  left: clamp(18px, 5vw, 58px);
  height: 8px;
  background: linear-gradient(90deg, #d36e50 0 16%, #c8872a 16% 32%, #2f766e 32% 48%, #b38425 48% 64%, #b95040 64% 80%, #253b59 80% 100%);
  border: 1px solid #fffaf1;
  border-radius: 999px;
}

.intro-card {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 760px);
  gap: 14px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-shadow: none;
}

.intro-card p {
  color: #f4c56c;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.intro-range {
  width: max-content;
  padding: 7px 10px;
  color: #101b22;
  background: #fffaf1;
  border-left: 4px solid #f4c56c;
  border-radius: 3px;
  font-size: clamp(22px, 6vw, 42px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.intro-card h1 {
  margin: 0;
  color: #fffaf1;
  max-width: 720px;
  font-size: clamp(48px, 12vw, 104px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.94;
}

.intro-card > span {
  max-width: 560px;
  color: #cbd8d4;
  font-size: clamp(15px, 2.2vw, 19px);
  font-weight: 650;
  line-height: 1.7;
}

.intro-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.intro-meta i {
  padding: 7px 10px;
  color: #fffaf1;
  background: #182933;
  border: 1px solid #3a5558;
  border-radius: 3px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.intro-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  width: min(100%, 620px);
  margin-top: 10px;
  border-top: 1px solid #60746f;
}

.intro-rail b {
  position: relative;
  padding-top: 12px;
  color: #8da09c;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.intro-rail b::before {
  position: absolute;
  top: -5px;
  left: 0;
  width: 9px;
  height: 9px;
  content: "";
  background: #f4c56c;
  border: 2px solid #101b22;
  border-radius: 50%;
}

.intro-card button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  justify-self: start;
  margin-top: 6px;
  padding: 11px 24px;
  background: #fffaf1;
  color: #172331;
  border-color: transparent;
  border-radius: 3px;
  box-shadow: 0 16px 0 #0d171d;
  transition:
    transform 220ms var(--ease),
    box-shadow 220ms var(--ease);
}

.intro-card button::after {
  padding-left: 12px;
  content: "→";
}

.intro-card button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 0 #0d171d;
}

.intro-card button:active {
  transform: translateY(2px);
  box-shadow: 0 10px 0 #0d171d;
}

.story-file {
  letter-spacing: 0;
}

.story-scene,
.story-meaning,
blockquote {
  display: grid;
  gap: 7px;
}

.story-scene strong,
.story-meaning strong,
blockquote strong {
  color: #8b5b2d;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.story-scene span,
.story-meaning span,
blockquote span {
  display: block;
}

.story-meaning strong {
  color: #68703d;
}

.audio-panel {
  background:
    linear-gradient(90deg, rgba(255, 250, 241, 0.62), rgba(255, 250, 241, 0.34)),
    repeating-linear-gradient(90deg, rgba(104, 70, 35, 0.04) 0 1px, transparent 1px 9px);
}

@media (min-width: 760px) {
  .current-card {
    width: var(--card-width, min(44vw, 500px));
  }

  .summary-panel {
    width: 720px;
  }

  .summary-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .summary-worker {
    min-height: 132px;
  }

  .intro-overlay {
    padding-left: clamp(56px, 10vw, 128px);
  }
}

@media (max-width: 520px) {
  .hud {
    bottom: calc(76px + env(safe-area-inset-bottom));
    padding: 0 12px;
  }

  .current-card {
    top: calc(18px + env(safe-area-inset-top));
    right: 14px;
    left: 14px;
    width: auto;
    max-width: none;
    padding: 15px 16px 16px;
    text-align: left;
    transform: translateY(0);
  }

  .current-card[data-caption-align],
  .current-card[data-caption-align="right"],
  .current-card[data-caption-align="center"] {
    text-align: left;
  }

  .current-card[data-caption-align] p,
  .current-card[data-caption-align="right"] p,
  .current-card[data-caption-align="center"] p {
    justify-self: start;
  }

  .current-card[data-caption-align]::after,
  .current-card[data-caption-align="right"]::after,
  .current-card[data-caption-align="center"]::after {
    right: auto;
    left: 20px;
    margin: 0;
  }

  .current-card.is-switching {
    transform: translateY(-12px) scale(0.985);
  }

  .current-card h2 {
    font-size: clamp(29px, 11vw, 44px);
  }

  .current-card strong {
    font-size: 13px;
  }

  .worker-label {
    bottom: -24px;
    max-width: 132px;
    font-size: 10px;
  }

  .station-plate {
    bottom: 46vh;
    min-width: 104px;
    max-width: 140px;
    padding: 8px 9px 7px;
    transform: translateX(-8%);
  }

  .station-plate b {
    font-size: 16px;
  }

  .station-plate em {
    font-size: 11px;
  }

  .station-plate i {
    font-size: 10px;
  }

  .summary-panel {
    bottom: calc(94px + env(safe-area-inset-bottom));
    max-height: min(55vh, 430px);
    overflow-y: auto;
  }

  .summary-worker {
    min-height: 110px;
  }

  .intro-overlay {
    place-items: center;
    padding: calc(30px + env(safe-area-inset-top)) 22px calc(72px + env(safe-area-inset-bottom));
  }

  .intro-overlay::before {
    inset: 10px;
  }

  .intro-overlay::after {
    right: 22px;
    bottom: calc(22px + env(safe-area-inset-bottom));
    left: 22px;
    height: 7px;
  }

  .intro-card h1 {
    font-size: clamp(44px, 15vw, 68px);
  }

  .intro-card > span {
    font-size: 14px;
    line-height: 1.62;
  }

  .intro-range {
    font-size: clamp(22px, 8vw, 34px);
  }

  .intro-rail {
    width: 100%;
  }

  .intro-rail b {
    font-size: 10px;
  }

  .intro-card button {
    width: 100%;
    justify-content: center;
  }
}

.summary-panel {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: center;
  width: auto;
  max-width: none;
  max-height: none;
  gap: clamp(18px, 4vh, 34px);
  padding: calc(34px + env(safe-area-inset-top)) clamp(22px, 6vw, 80px) calc(34px + env(safe-area-inset-bottom));
  overflow: hidden;
  color: #fffaf1;
  background:
    linear-gradient(90deg, #0d171d 0 1px, transparent 1px 100%),
    linear-gradient(180deg, #0d171d 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(15, 27, 35, 0.96) 0%, rgba(14, 22, 29, 0.94) 54%, rgba(8, 13, 18, 0.98) 100%);
  background-size: 44px 44px, 44px 44px, auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  opacity: 0;
  pointer-events: none;
  transform: none;
  transition: opacity 620ms var(--ease);
}

.summary-panel::before,
.summary-panel::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.summary-panel::before {
  inset: 18px;
  border: 1px solid #2d4348;
  border-radius: 6px;
}

.summary-panel::after {
  right: clamp(18px, 5vw, 58px);
  bottom: clamp(18px, 5vw, 58px);
  left: clamp(18px, 5vw, 58px);
  height: 8px;
  background: linear-gradient(90deg, #d36e50 0 16%, #c8872a 16% 32%, #2f766e 32% 48%, #b38425 48% 64%, #b95040 64% 80%, #253b59 80% 100%);
  border: 1px solid #fffaf1;
  border-radius: 999px;
}

.summary-panel.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.summary-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  width: min(100%, 780px);
  padding-right: 0;
}

.summary-copy p {
  color: #f4c56c;
  font-size: 13px;
  letter-spacing: 0;
}

.summary-copy h2 {
  max-width: 760px;
  color: #fffaf1;
  font-size: clamp(36px, 8vw, 76px);
  line-height: 0.98;
}

.summary-copy span {
  max-width: 560px;
  color: #cbd8d4;
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 650;
  line-height: 1.65;
}

.ending-collage {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  height: min(48vh, 430px);
  min-height: 260px;
  justify-self: center;
  isolation: isolate;
}

.ending-photo {
  position: absolute;
  display: grid;
  place-items: center;
  width: clamp(128px, 17vw, 220px);
  min-height: clamp(178px, 24vw, 292px);
  margin: 0;
  padding: 12px 12px 14px;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(239, 230, 211, 0.96));
  border: 1px solid rgba(255, 250, 241, 0.68);
  border-bottom: 6px solid color-mix(in srgb, var(--photo-color) 52%, #fffaf1);
  border-radius: 3px;
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: translateY(34px) scale(0.96) rotate(var(--photo-rotate, -2deg));
  transform-origin: 50% 70%;
}

.summary-panel.is-visible .ending-photo {
  animation: endingPhotoIn 1500ms var(--ease) forwards;
  animation-delay: calc(360ms + var(--photo-index) * 820ms);
}

.ending-photo:nth-child(1) {
  top: 10%;
  left: 5%;
  z-index: 1;
  --photo-rotate: -8deg;
}

.ending-photo:nth-child(2) {
  top: 24%;
  left: 19%;
  z-index: 2;
  --photo-rotate: 5deg;
}

.ending-photo:nth-child(3) {
  top: 5%;
  left: 36%;
  z-index: 3;
  --photo-rotate: -3deg;
}

.ending-photo:nth-child(4) {
  top: 27%;
  right: 29%;
  z-index: 4;
  --photo-rotate: 7deg;
}

.ending-photo:nth-child(5) {
  top: 12%;
  right: 13%;
  z-index: 5;
  --photo-rotate: -5deg;
}

.ending-photo:nth-child(6) {
  top: 31%;
  right: 1%;
  z-index: 6;
  --photo-rotate: 4deg;
}

.ending-photo img {
  display: block;
  width: 100%;
  height: clamp(116px, 16vw, 190px);
  object-fit: contain;
  background:
    linear-gradient(135deg, rgba(211, 110, 80, 0.1), rgba(47, 118, 110, 0.1)),
    #e9dfcf;
  pointer-events: none;
}

.ending-photo figcaption {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  gap: 8px;
  margin-top: 10px;
  color: #172331;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.ending-photo figcaption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-actions {
  position: relative;
  z-index: 1;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 520ms var(--ease),
    transform 520ms var(--ease);
}

.summary-panel.is-ready .summary-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.summary-actions button {
  min-height: 48px;
  padding: 12px 28px;
  color: #172331;
  background: #fffaf1;
  border-color: transparent;
  border-radius: 3px;
  box-shadow: 0 16px 0 #0d171d;
  font-weight: 900;
  transition:
    transform 220ms var(--ease),
    box-shadow 220ms var(--ease);
}

.summary-actions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 0 #0d171d;
}

.summary-actions button:active {
  transform: translateY(2px);
  box-shadow: 0 10px 0 #0d171d;
}

@keyframes endingPhotoIn {
  from {
    opacity: 0;
    transform: translateY(34px) scale(0.96) rotate(var(--photo-rotate, -2deg));
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(var(--photo-rotate, -2deg));
  }
}

@media (min-width: 760px) {
  .summary-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
  }
}

@media (max-width: 640px) {
  .summary-panel {
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-height: none;
    padding: calc(30px + env(safe-area-inset-top)) 22px calc(58px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .summary-panel::before {
    inset: 10px;
  }

  .summary-panel::after {
    right: 22px;
    bottom: calc(22px + env(safe-area-inset-bottom));
    left: 22px;
    height: 7px;
  }

  .summary-copy h2 {
    font-size: clamp(40px, 13vw, 62px);
  }

  .ending-collage {
    width: 100%;
    height: min(46vh, 390px);
    min-height: 300px;
  }

  .ending-photo {
    width: clamp(104px, 35vw, 150px);
    min-height: clamp(152px, 46vw, 204px);
    padding: 9px 9px 11px;
  }

  .ending-photo img {
    height: clamp(94px, 30vw, 128px);
  }

  .ending-photo figcaption {
    display: grid;
    gap: 5px;
    font-size: 11px;
  }

  .ending-photo:nth-child(1) {
    top: 2%;
    left: 0;
  }

  .ending-photo:nth-child(2) {
    top: 16%;
    left: 24%;
  }

  .ending-photo:nth-child(3) {
    top: 4%;
    right: 0;
    left: auto;
  }

  .ending-photo:nth-child(4) {
    top: 44%;
    left: 4%;
    right: auto;
  }

  .ending-photo:nth-child(5) {
    top: 54%;
    left: 32%;
    right: auto;
  }

  .ending-photo:nth-child(6) {
    top: 39%;
    right: 0;
  }

  .summary-actions button {
    width: min(100%, 280px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
