﻿:root {
  --paper: #ece3d1;
  --paper-bright: #f4ecdc;
  --paper-deep: #d9cdb6;
  --ink: #2e2a21;
  --ink-soft: #5c5344;
  --ink-faint: rgba(46, 42, 33, 0.5);
  --red: #a44732;
  --red-deep: #7d3225;
  --teal: #2d5651;
  --sand: #b79d76;
  --line: rgba(48, 41, 31, 0.19);
  --shadow-soft: 0 24px 70px rgba(46, 38, 26, 0.16);
  --chrome-ink: #2d2921;
  --chrome-soft: rgba(45, 41, 33, 0.8);
  --chrome-faint: rgba(45, 41, 33, 0.56);
  --chrome-line: rgba(45, 41, 33, 0.28);
  --chrome-panel: rgba(243, 235, 219, 0.54);
  --chrome-panel-solid: rgba(246, 238, 223, 0.78);
  --chrome-scrim: rgba(236, 227, 210, 0.7);
  --chapter-wash: radial-gradient(ellipse at 24% 48%, rgba(243, 234, 218, 0.78) 0%, rgba(240, 231, 214, 0.5) 38%, rgba(236, 227, 210, 0) 74%);
  --gutter: clamp(18px, 3.2vw, 48px);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Hiragino Sans GB", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
}

body.theme-light {
  --chrome-ink: #f2e9d7;
  --chrome-soft: rgba(242, 233, 215, 0.86);
  --chrome-faint: rgba(242, 233, 215, 0.6);
  --chrome-line: rgba(242, 233, 215, 0.32);
  --chrome-panel: rgba(18, 27, 29, 0.3);
  --chrome-panel-solid: rgba(18, 27, 29, 0.46);
  --chrome-scrim: rgba(12, 22, 25, 0.48);
  --chapter-wash: radial-gradient(ellipse at 24% 48%, rgba(15, 26, 28, 0.46) 0%, rgba(15, 26, 28, 0.24) 40%, rgba(15, 26, 28, 0) 76%);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  touch-action: none;
}

::selection {
  background: rgba(164, 71, 50, 0.22);
  color: var(--ink);
}

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

button {
  font: inherit;
  color: inherit;
}

button:focus-visible,
a:focus-visible,
[role="slider"]:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

#world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  cursor: grab;
  touch-action: none;
  background: transparent;
}

body.is-dragging #world {
  cursor: grabbing;
}

.paper-grain {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.62'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

.paper-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(31, 28, 22, 0.12) 0%, transparent 17%, transparent 74%, rgba(37, 31, 22, 0.1) 100%),
    radial-gradient(ellipse at 50% 48%, transparent 44%, rgba(38, 31, 22, 0.17) 100%);
  mix-blend-mode: multiply;
}

/* ------------------------------------------------------------------ boot */
.boot-screen {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 68% 31%, rgba(255, 231, 185, 0.93) 0 5.5%, rgba(255, 225, 170, 0.38) 5.6%, transparent 20%),
    linear-gradient(180deg, #d9e2d9 0%, #eee1c7 61%, #cdb994 100%);
  transition: opacity 0.9s ease, visibility 0.9s;
}

.boot-screen::before {
  content: "";
  position: absolute;
  inset: auto -8% -13% -8%;
  height: 48%;
  background:
    linear-gradient(175deg, transparent 50%, rgba(93, 111, 86, 0.38) 50.4%, rgba(93, 111, 86, 0.38) 57%, transparent 57.4%),
    linear-gradient(170deg, transparent 55%, rgba(75, 95, 77, 0.44) 55.4%, rgba(75, 95, 77, 0.44) 68%, transparent 68.4%),
    linear-gradient(180deg, transparent 62%, #a99978 62.5%, #cab897 100%);
  filter: blur(1px);
  opacity: 0.7;
}

.boot-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.24;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.boot-screen.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-copy {
  position: relative;
  z-index: 2;
  width: min(1220px, 92vw);
  text-align: center;
  color: var(--ink);
  transform: translateY(-3vh);
}

.boot-eyebrow {
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--ink-faint);
}

.boot-copy h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(44px, 7.3vw, 126px);
  font-weight: 600;
  letter-spacing: -0.075em;
  line-height: 0.9;
}

.boot-copy h1 span {
  color: var(--red);
  margin: 0 0.035em;
}

.boot-copy > p:not(.boot-eyebrow) {
  margin: 24px 0 0;
  font-family: var(--serif);
  font-size: clamp(13px, 1.5vw, 17px);
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.boot-rule {
  width: min(310px, 50vw);
  height: 1px;
  margin: 34px auto 18px;
  background: rgba(66, 55, 39, 0.21);
  overflow: hidden;
}

.boot-rule i {
  display: block;
  width: 38%;
  height: 100%;
  background: var(--red);
  animation: bootline 1.7s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

.boot-copy small {
  font-family: var(--mono);
  font-size: 9px;
  color: rgba(66, 55, 39, 0.48);
  letter-spacing: 0.12em;
}

@keyframes bootline {
  0% {
    transform: translateX(-110%);
  }
  55%,
  65% {
    transform: translateX(270%);
  }
  100% {
    transform: translateX(270%);
  }
}

/* --------------------------------------------------------------- masthead */
.masthead {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 22px var(--gutter) 34px;
  color: var(--chrome-ink);
  pointer-events: none;
  transition: color 0.8s ease;
}

.masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, var(--chrome-scrim) 0%, color-mix(in srgb, var(--chrome-scrim) 30%, transparent) 62%, transparent 100%);
  transition: background 0.8s ease;
}

.wordmark {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}

.wordmark-seal {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  color: #f1e5cc;
  background: var(--red);
  border: 1px solid rgba(242, 230, 206, 0.36);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1;
  transform: rotate(-3deg);
  box-shadow: inset 0 0 0 2px rgba(242, 230, 206, 0.13);
}

.wordmark-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wordmark-text b {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.wordmark-text em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--chrome-faint);
}

.masthead-note {
  position: absolute;
  left: 50%;
  top: 29px;
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--chrome-soft);
  white-space: nowrap;
  pointer-events: none;
}

.toolbar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 35px;
  padding: 8px 12px;
  border: 1px solid var(--chrome-line);
  border-radius: 999px;
  background: var(--chrome-panel);
  color: var(--chrome-ink);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: border-color 0.25s, background 0.25s, color 0.8s, transform 0.25s;
}

.pill-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#autoBtn svg {
  fill: currentColor;
  stroke: none;
}

#soundBtn .sound-wave {
  opacity: 0.36;
  transition: opacity 0.3s;
}

#soundBtn.is-on .sound-wave {
  opacity: 1;
}

.pill-btn:hover {
  border-color: var(--chrome-ink);
  background: var(--chrome-panel-solid);
  transform: translateY(-1px);
}

.pill-btn:active {
  transform: translateY(0);
}

#autoBtn.is-on {
  color: #f5e8d0;
  background: var(--red);
  border-color: var(--red);
}

.source-btn {
  font-family: var(--serif);
  letter-spacing: 0.08em;
}

/* ------------------------------------------------------------------- HUD */
.hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.chapter-block {
  position: absolute;
  top: clamp(92px, 12.5vh, 132px);
  left: var(--gutter);
  z-index: 1;
  width: min(600px, 48vw);
  color: var(--chrome-ink);
  transition: color 0.8s ease;
  isolation: isolate;
}

.chapter-block::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -34px -76px -48px -48px;
  pointer-events: none;
  background: var(--chapter-wash);
  filter: blur(10px);
  transition: background 0.8s ease;
}

.year-heading {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.year-number {
  font-family: var(--serif);
  font-size: clamp(100px, 12.7vw, 186px);
  font-weight: 600;
  line-height: 0.73;
  letter-spacing: -0.07em;
  font-variant-numeric: tabular-nums;
  color: var(--chrome-ink);
  text-shadow: 0 1px 0 rgba(255, 250, 235, 0.24), 0 16px 48px rgba(31, 26, 20, 0.08);
  transition: color 0.8s ease;
}

.year-side {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-left: 12px;
  margin-bottom: 5px;
  border-left: 1px solid var(--chrome-line);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.45;
  letter-spacing: 0.13em;
  color: var(--chrome-soft);
  white-space: nowrap;
  transition: border-color 0.8s, color 0.8s;
}

.year-side span:last-child {
  letter-spacing: 0.08em;
  color: var(--chrome-faint);
}

.chapter-copy {
  margin-top: 22px;
  max-width: 480px;
}

.kicker {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.17em;
  color: var(--chrome-soft);
  text-transform: uppercase;
}

#eraTitle {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(27px, 3vw, 43px);
  line-height: 1.17;
  letter-spacing: -0.025em;
  color: var(--chrome-ink);
}

.dek {
  max-width: 410px;
  margin: 11px 0 0;
  font-family: var(--serif);
  font-size: clamp(12px, 1.05vw, 14px);
  line-height: 1.72;
  color: var(--chrome-soft);
}

.anchor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-width: 530px;
  margin: 19px 0 0;
  padding: 0;
  list-style: none;
}

.anchor-list li {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--chrome-soft);
  white-space: nowrap;
}

.anchor-list .a-kind {
  display: inline-block;
  padding: 0 3px 1px;
  border: 1px solid var(--chrome-line);
  font-family: var(--serif);
  font-size: 8.5px;
  line-height: 1.35;
  color: var(--chrome-faint);
}

.scale-note {
  max-width: 420px;
  margin: 13px 0 0;
  font-family: var(--serif);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: var(--chrome-faint);
}

.chapter-block.is-changing .year-number,
.chapter-block.is-changing .chapter-copy,
.chapter-block.is-changing .anchor-list {
  animation: chapterIn 0.68s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.chapter-block.is-changing .chapter-copy {
  animation-delay: 0.04s;
}

.chapter-block.is-changing .anchor-list {
  animation-delay: 0.1s;
}

@keyframes chapterIn {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* --------------------------------------------------------------- drag hint */
.drag-hint {
  position: absolute;
  top: auto;
  bottom: clamp(218px, 27vh, 292px);
  left: var(--gutter);
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: 300px;
  padding: 11px 14px 11px 11px;
  color: var(--ink);
  background: rgba(241, 232, 215, 0.82);
  border: 1px solid rgba(69, 55, 37, 0.18);
  box-shadow: 0 15px 40px rgba(37, 30, 21, 0.1);
  transform: rotate(-1.1deg);
  transition: opacity 0.7s ease, transform 0.7s ease, visibility 0.7s;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.drag-hint::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 27px;
  width: 34px;
  height: 9px;
  background: rgba(218, 200, 166, 0.62);
  transform: rotate(-3deg);
  box-shadow: 0 1px 2px rgba(35, 27, 17, 0.06);
}

.drag-hint.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(9px) rotate(-1deg);
}

.drag-hint-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 27px;
  flex-shrink: 0;
  border: 1px solid rgba(87, 68, 42, 0.38);
  background: #eee2c8;
  color: var(--red);
  font-size: 17px;
  transform: rotate(-8deg);
  box-shadow: 1px 2px 0 rgba(98, 76, 46, 0.1);
}

.drag-hint div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drag-hint b {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.drag-hint small {
  font-size: 9.5px;
  line-height: 1.5;
  color: rgba(59, 51, 40, 0.62);
}

.drag-hint-arrow {
  margin-left: auto;
  padding-left: 4px;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--red);
  animation: hintArrow 1.7s ease-in-out infinite;
}

@keyframes hintArrow {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.54;
  }
  50% {
    transform: translateX(5px);
    opacity: 1;
  }
}

.letter-instruction {
  position: absolute;
  right: calc(var(--gutter) + 5vw);
  top: 51.5%;
  display: none;
  flex-direction: column;
  gap: 5px;
  color: var(--chrome-soft);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.16em;
  writing-mode: vertical-rl;
  opacity: 0.72;
  pointer-events: none;
}

.letter-instruction::after {
  content: "";
  width: 1px;
  height: 28px;
  background: var(--chrome-line);
  margin: 0 auto;
}

/* --------------------------------------------------------------- end card */
.end-card {
  position: absolute;
  right: var(--gutter);
  top: 96px;
  bottom: auto;
  z-index: 16;
  width: 270px;
  padding: 18px 19px 16px;
  color: var(--ink);
  background: rgba(242, 233, 216, 0.94);
  border: 1px solid rgba(76, 59, 37, 0.22);
  box-shadow: var(--shadow-soft);
  transform: rotate(0.8deg);
  pointer-events: auto;
  animation: endIn 0.7s ease both;
}

.end-card[hidden] {
  display: none;
}

.end-card::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 48px;
  height: 12px;
  background: rgba(207, 188, 151, 0.65);
  transform: translateX(-50%) rotate(-2deg);
}

.end-card-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

.end-card strong {
  display: block;
  margin: 11px 0 2px;
  font-family: var(--serif);
  font-size: 46px;
  line-height: 0.9;
  letter-spacing: -0.045em;
  color: var(--red);
}

.end-card p {
  margin: 7px 0 15px;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.end-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 11px;
}

.end-card-actions button:first-child {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-bright);
  padding: 7px 11px;
  font-size: 10px;
  cursor: pointer;
}

.text-btn {
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 2px 0;
  background: transparent;
  font-family: var(--serif);
  font-size: 10px;
  color: var(--ink-soft);
  cursor: pointer;
}

@keyframes endIn {
  from {
    opacity: 0;
    transform: translateY(9px) rotate(0.8deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0.8deg);
  }
}

/* --------------------------------------------------------------- footer */
.street-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  padding: 76px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  color: var(--ink);
  background: linear-gradient(180deg, transparent 0%, rgba(44, 36, 26, 0.08) 36%, rgba(223, 211, 190, 0.72) 75%, rgba(230, 219, 199, 0.9) 100%);
  pointer-events: none;
}

.caption-row {
  display: grid;
  grid-template-columns: minmax(0, 680px) minmax(185px, 255px);
  justify-content: space-between;
  align-items: end;
  gap: 38px;
  max-width: 1540px;
  margin: 0 auto;
}

.caption-card {
  position: relative;
  min-height: 118px;
  padding: 14px 18px 13px;
  background: rgba(243, 235, 219, 0.9);
  border: 1px solid rgba(73, 58, 38, 0.18);
  box-shadow: 0 17px 50px rgba(39, 31, 21, 0.1);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.caption-card::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 22px;
  width: 50px;
  height: 8px;
  background: rgba(215, 197, 164, 0.64);
  transform: rotate(-1.7deg);
}

.caption-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  color: rgba(54, 46, 35, 0.51);
}

.caption-label {
  color: var(--red);
}

.caption-text {
  margin: 8px 0 0;
  max-width: 650px;
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.72;
  letter-spacing: 0.005em;
  color: #373126;
}

.source-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  pointer-events: auto;
}

.source-ref {
  border: 1px solid rgba(74, 58, 37, 0.22);
  border-radius: 999px;
  background: rgba(232, 219, 194, 0.45);
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  color: rgba(68, 55, 38, 0.7);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.source-ref:hover {
  border-color: var(--red);
  background: rgba(164, 71, 50, 0.08);
  color: var(--red-deep);
}

.sound-block {
  padding: 9px 11px 8px;
  color: var(--ink);
  background: rgba(243, 235, 219, 0.88);
  border: 1px solid rgba(73, 58, 38, 0.16);
  box-shadow: 0 10px 26px rgba(39, 31, 21, 0.08);
  backdrop-filter: blur(8px);
}

.sound-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  color: rgba(48, 41, 31, 0.66);
}

.sound-title b {
  color: var(--ink-soft);
  font-weight: 500;
}

.sound-index {
  color: var(--red);
}

.sound-eq {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 3px;
  height: 22px;
  margin: 9px 0 7px;
}

.sound-eq i {
  display: block;
  width: 2px;
  height: 100%;
  min-height: 2px;
  background: var(--teal);
  transform-origin: bottom center;
  transform: scaleY(0.18);
  opacity: 0.62;
  transition: transform 0.08s linear;
}

.sound-eq i:nth-child(2) {
  background: var(--red);
  opacity: 0.58;
}

.sound-layers {
  margin: 0;
  font-family: var(--serif);
  font-size: 10.5px;
  line-height: 1.55;
  text-align: right;
  color: rgba(42, 35, 25, 0.86);
}

.rail-area {
  max-width: 1540px;
  margin: 17px auto 0;
}

.rail-instruction {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 1px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.13em;
  color: rgba(43, 36, 27, 0.58);
}

.rail-title {
  color: rgba(43, 36, 27, 0.8);
}

.rail-sub {
  color: rgba(43, 36, 27, 0.42);
}

.year-rail {
  position: relative;
  height: 41px;
  cursor: ew-resize;
  touch-action: none;
  pointer-events: auto;
  outline: none;
}

.year-rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 20px;
  height: 18px;
  background: transparent;
}

.rail-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 21px;
  height: 1px;
  background: rgba(45, 37, 26, 0.28);
}

.rail-fill {
  position: absolute;
  left: 0;
  top: 19.5px;
  width: 0%;
  height: 4px;
  background: linear-gradient(90deg, rgba(126, 103, 73, 0.6), var(--red));
  border-radius: 3px;
  transition: width 0.06s linear;
}

.rail-ticks {
  position: absolute;
  left: 0;
  right: 0;
  top: 15px;
  height: 14px;
}

.rail-ticks span {
  position: absolute;
  top: 0;
  width: 1px;
  height: 12px;
  background: rgba(48, 39, 27, 0.28);
  transform: translateX(-0.5px);
}

.rail-ticks span.is-past {
  background: rgba(113, 81, 56, 0.58);
}

.rail-thumb {
  position: absolute;
  top: 2px;
  left: 0;
  width: 34px;
  height: 39px;
  transform: translateX(-50%);
  will-change: left;
  pointer-events: none;
}

.rail-thumb > span {
  position: absolute;
  inset: 4px 3px auto;
  display: grid;
  place-items: center;
  height: 25px;
  border: 1px solid rgba(79, 57, 34, 0.38);
  background: #f3e7cf;
  color: var(--red);
  font-size: 15px;
  line-height: 1;
  box-shadow: 1px 2px 0 rgba(85, 64, 39, 0.13), 0 4px 14px rgba(58, 43, 25, 0.11);
  transform: rotate(-7deg);
}

.rail-thumb > i {
  position: absolute;
  left: 50%;
  top: 31px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  transform: translateX(-50%);
  box-shadow: 0 0 0 3px rgba(243, 235, 217, 0.7);
}

.rail-labels {
  position: relative;
  height: 14px;
  margin-top: -2px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.02em;
  color: rgba(48, 41, 31, 0.52);
  pointer-events: none;
}

.rail-labels span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  transition: color 0.3s, font-weight 0.3s, opacity 0.3s;
}

.rail-labels span:first-child {
  transform: translateX(0);
}

.rail-labels span:last-child {
  transform: translateX(-100%);
}

.rail-labels span.is-active {
  color: var(--red-deep);
  font-weight: 700;
}

.footer-fineprint {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  max-width: 1540px;
  margin: 10px auto 0;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  color: rgba(45, 37, 27, 0.4);
}

/* ----------------------------------------------------------------- toast */
.toast {
  position: absolute;
  left: 50%;
  bottom: 288px;
  z-index: 30;
  max-width: min(430px, calc(100vw - 36px));
  padding: 9px 13px;
  border: 1px solid rgba(62, 49, 33, 0.2);
  background: rgba(242, 234, 219, 0.94);
  box-shadow: 0 12px 30px rgba(37, 29, 19, 0.12);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 7px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --------------------------------------------------------------- dialog */
.sources-dialog {
  touch-action: pan-y;
  width: min(1040px, calc(100vw - 36px));
  max-width: 1040px;
  max-height: min(88vh, 920px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.sources-dialog::backdrop {
  background: rgba(17, 22, 20, 0.58);
  backdrop-filter: blur(7px);
}

.sheet {
  display: flex;
  touch-action: pan-y;
  flex-direction: column;
  max-height: min(88vh, 920px);
  background: #eee4d1;
  background-image:
    radial-gradient(circle at 14% 8%, rgba(255, 247, 226, 0.54), transparent 42%),
    linear-gradient(90deg, rgba(126, 98, 57, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(126, 98, 57, 0.025) 1px, transparent 1px);
  background-size: auto, 5px 5px, 5px 5px;
  border: 1px solid rgba(64, 48, 29, 0.25);
  box-shadow: 0 40px 120px rgba(14, 17, 14, 0.3);
  animation: sheetIn 0.35s ease both;
}

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

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 28px 34px 23px;
  border-bottom: 1px solid var(--line);
}

.sheet-head .eyebrow {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  color: var(--ink-faint);
}

.sheet-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(26px, 2.8vw, 42px);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.close-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.close-btn:hover {
  background: rgba(66, 51, 32, 0.07);
  border-color: var(--ink-soft);
}

.sheet-body {
  touch-action: pan-y;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 27px 34px 32px;
  scrollbar-width: thin;
  scrollbar-color: rgba(70, 53, 33, 0.3) transparent;
}

.about-copy {
  max-width: 950px;
}

.lead {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: clamp(17px, 1.55vw, 21px);
  line-height: 1.75;
  letter-spacing: 0.005em;
}

.lead strong {
  font-weight: 700;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 21px 40px;
  padding: 21px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.about-grid h3 {
  margin: 0 0 7px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--red-deep);
  font-weight: 600;
}

.about-grid p {
  margin: 0;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-soft);
}

.about-warning {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: 10.5px;
  line-height: 1.75;
  color: rgba(63, 51, 34, 0.62);
  padding-left: 13px;
  border-left: 2px solid rgba(164, 71, 50, 0.35);
}

.sources-section {
  margin-top: 31px;
}

.sources-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.sources-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
}

.sources-head p {
  margin: 0;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  text-align: right;
}

.source-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: source;
}

.source-item {
  position: relative;
  padding: 13px 0 13px 47px;
  border-bottom: 1px solid rgba(70, 54, 34, 0.12);
  counter-increment: source;
}

.source-item::before {
  content: "S" counter(source);
  position: absolute;
  left: 0;
  top: 15px;
  width: 33px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--red);
}

.source-item:target {
  background: rgba(164, 71, 50, 0.06);
  box-shadow: inset 2px 0 0 var(--red);
}

.source-title {
  display: block;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  width: fit-content;
}

.source-title:hover {
  color: var(--red-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.source-meta {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.6;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}

.source-note {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.source-url {
  display: inline-block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 8px;
  color: rgba(95, 74, 44, 0.65);
  word-break: break-all;
  max-width: 100%;
}

.sheet-foot {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 34px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}

.sheet-foot .text-btn {
  font-family: var(--serif);
  font-size: 10px;
}

/* --------------------------------------------------------------- fallback */
.no-script {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  padding: 30px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
}

.no-script h2 {
  font-family: var(--serif);
  font-size: 32px;
}

.no-script p {
  color: var(--ink-soft);
}

/* --------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .chapter-block {
    width: min(540px, 54vw);
  }

  .masthead-note {
    display: none;
  }

  .caption-row {
    grid-template-columns: minmax(0, 620px) 210px;
    gap: 25px;
  }
}

@media (max-width: 900px) {
  .chapter-block {
    width: min(510px, 64vw);
  }

  .year-number {
    font-size: clamp(86px, 13.5vw, 140px);
  }

  .dek {
    font-size: 12px;
  }

  .drag-hint {
    top: auto;
    bottom: 292px;
    max-width: 270px;
  }

  .street-footer {
    padding-top: 52px;
  }

  .caption-row {
    grid-template-columns: minmax(0, 1fr) 170px;
    gap: 18px;
  }

  .caption-text {
    font-size: 13px;
  }

  .sound-layers {
    font-size: 9px;
  }

  .footer-desktop-only {
    display: none;
  }
}

@media (max-width: 720px) {
  .masthead {
    padding: 13px 15px 25px;
    align-items: center;
  }

  .wordmark-seal {
    width: 31px;
    height: 31px;
    font-size: 18px;
  }

  .wordmark-text b {
    font-size: 14px;
  }

  .wordmark-text em {
    font-size: 6.5px;
    letter-spacing: 0.12em;
  }

  .toolbar {
    gap: 6px;
  }

  .pill-btn {
    min-height: 38px;
    min-width: 38px;
    padding: 8px 10px;
    font-size: 9px;
    justify-content: center;
  }

  .pill-btn span {
    display: none;
  }

  .pill-btn svg {
    width: 15px;
    height: 15px;
  }

  .chapter-block {
    top: 72px;
    left: 15px;
    width: calc(100vw - 30px);
  }

  .chapter-block::before {
    inset: -18px -22px -26px -24px;
    filter: blur(3px);
  }

  .year-heading {
    gap: 10px;
  }

  .year-number {
    font-size: clamp(78px, 23vw, 112px);
    line-height: 0.72;
  }

  .year-side {
    gap: 6px;
    padding-left: 9px;
    font-size: 7.5px;
    margin-bottom: 3px;
  }

  .chapter-copy {
    margin-top: 15px;
    max-width: calc(100vw - 32px);
  }

  .kicker {
    font-size: 8px;
    margin-bottom: 5px;
  }

  #eraTitle {
    font-size: clamp(23px, 6.8vw, 31px);
  }

  .dek {
    max-width: 82vw;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.55;
  }

  .anchor-list {
    gap: 3px 9px;
    margin-top: 10px;
    max-width: calc(100vw - 30px);
  }

  .anchor-list li {
    font-size: 9px;
    gap: 3px;
  }

  .anchor-list .a-kind {
    font-size: 7.5px;
    padding: 0 2px 1px;
  }

  .scale-note {
    display: none;
  }

  .drag-hint {
    display: none;
  }

  .drag-hint b {
    font-size: 11px;
  }

  .drag-hint small {
    font-size: 8px;
  }

  .drag-hint-mark {
    width: 29px;
    height: 23px;
    font-size: 14px;
  }

  .drag-hint-arrow {
    font-size: 18px;
  }

  .letter-instruction {
    display: none;
  }

  .street-footer {
    padding: 55px 15px calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent 0%, rgba(42, 34, 24, 0.12) 26%, rgba(222, 210, 189, 0.86) 62%, rgba(233, 222, 202, 0.96) 100%);
  }

  .caption-row {
    display: flex;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 5px;
    max-width: none;
  }

  .caption-card {
    min-height: 0;
    padding: 10px 12px 9px;
  }

  .caption-card::before {
    left: 18px;
    width: 38px;
    height: 6px;
  }

  .caption-topline {
    font-size: 7.5px;
  }

  .caption-text {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.62;
    max-width: none;
  }

  .source-refs {
    margin-top: 6px;
  }

  .sound-block {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 26px;
    padding: 3px 9px;
    background: rgba(243, 235, 219, 0.92);
    border: 1px solid rgba(73, 58, 38, 0.16);
    color: var(--ink);
  }

  .sound-head {
    flex-shrink: 0;
    gap: 4px;
    font-size: 7px;
  }

  .sound-title {
    white-space: nowrap;
  }

  .sound-title b {
    color: var(--ink-soft);
  }

  .sound-index {
    display: none;
  }

  .sound-eq {
    order: 3;
    flex-shrink: 0;
    gap: 2px;
    width: 43px;
    height: 16px;
    margin: 0;
  }

  .sound-eq i {
    width: 2px;
  }

  .sound-layers {
    margin: 0;
    flex: 1;
    text-align: left;
    font-size: 9px;
    color: rgba(42, 35, 25, 0.86);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .rail-area {
    margin-top: 8px;
  }

  .rail-instruction {
    margin-bottom: 0;
    font-size: 7.5px;
    letter-spacing: 0.08em;
  }

  .rail-title::before {
    content: "✉ ";
    color: var(--red);
    font-family: var(--serif);
  }

  .rail-sub {
    display: none;
  }

  .year-rail {
    height: 36px;
  }

  .rail-track {
    top: 19px;
  }

  .rail-fill {
    top: 17.5px;
  }

  .rail-ticks {
    top: 13px;
  }

  .rail-thumb {
    top: 0;
    width: 31px;
    height: 35px;
  }

  .rail-thumb > span {
    height: 23px;
    font-size: 13px;
  }

  .rail-thumb > i {
    top: 29px;
  }

  .rail-labels {
    height: 12px;
    font-size: 7.5px;
    margin-top: -3px;
  }

  .footer-fineprint {
    margin-top: 6px;
    font-size: 6.5px;
    gap: 8px;
  }

  .footer-fineprint span:nth-child(2) {
    display: none;
  }

  .end-card {
    left: 15px;
    right: 15px;
    top: auto;
    bottom: 278px;
    width: auto;
    max-width: none;
    margin-left: 0;
    padding: 8px 11px;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    row-gap: 3px;
    align-items: center;
    transform: rotate(0.4deg);
  }

  .end-card::before {
    display: none;
  }

  .end-card-kicker {
    grid-column: 1 / -1;
    font-size: 7px;
  }

  .end-card strong {
    font-size: 28px;
    line-height: 1;
    margin: 0;
  }

  .end-card p {
    display: none;
  }

  .end-card-actions {
    border-top: 0;
    padding-top: 0;
    justify-content: flex-end;
    gap: 8px;
  }

  .end-card-actions button:first-child {
    padding: 5px 8px;
    font-size: 9px;
  }

  .toast {
    bottom: 266px;
    font-size: 10px;
  }

  .sources-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100svh;
    height: 100svh;
    margin: 0;
  }

  .sheet {
    max-height: 100svh;
    height: 100%;
    border: 0;
  }

  .sheet-head {
    padding: 18px 16px 15px;
  }

  .sheet-head .eyebrow {
    font-size: 7px;
    margin-bottom: 5px;
  }

  .sheet-head h2 {
    font-size: 26px;
  }

  .close-btn {
    width: 30px;
    height: 30px;
    font-size: 21px;
  }

  .sheet-body {
    padding: 17px 16px 24px;
  }

  .lead {
    font-size: 15px;
    line-height: 1.75;
    margin-bottom: 17px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 15px 0;
  }

  .about-grid p {
    font-size: 11px;
  }

  .about-warning {
    font-size: 9.5px;
    line-height: 1.7;
  }

  .sources-section {
    margin-top: 22px;
  }

  .sources-head {
    display: block;
  }

  .sources-head h3 {
    font-size: 19px;
  }

  .sources-head p {
    margin-top: 5px;
    text-align: left;
    font-size: 7px;
    line-height: 1.6;
  }

  .source-item {
    padding: 11px 0 11px 36px;
  }

  .source-item::before {
    top: 13px;
    width: 28px;
    font-size: 8px;
  }

  .source-title {
    font-size: 12px;
  }

  .source-note {
    font-size: 9.5px;
  }

  .source-meta,
  .source-url {
    font-size: 7.5px;
  }

  .sheet-foot {
    padding: 10px 16px calc(9px + env(safe-area-inset-bottom));
    font-size: 6.5px;
  }

  .sheet-foot > span {
    max-width: 60%;
    line-height: 1.5;
  }

  .boot-copy {
    width: 87vw;
  }

  .boot-eyebrow {
    font-size: 8px;
    letter-spacing: 0.24em;
  }

  .boot-copy h1 {
    font-size: clamp(50px, 15.5vw, 82px);
  }

  .boot-copy > p:not(.boot-eyebrow) {
    font-size: 11px;
    letter-spacing: 0.12em;
    margin-top: 17px;
  }

  .boot-rule {
    margin-top: 23px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .chapter-block {
    top: 66px;
  }

  .year-number {
    font-size: 74px;
  }

  .chapter-copy {
    margin-top: 9px;
  }

  .dek,
  .scale-note,
  .anchor-list {
    display: none;
  }

  .drag-hint {
    bottom: 175px;
    top: auto;
    max-width: 260px;
    padding: 7px 9px;
  }

  .street-footer {
    padding-top: 25px;
  }

  .caption-card {
    min-height: 0;
    padding: 9px 12px;
  }

  .caption-text {
    font-size: 11.5px;
    line-height: 1.55;
    margin-top: 4px;
  }

  .caption-row {
    grid-template-columns: minmax(0, 1fr) 160px;
  }

  .sound-eq {
    height: 14px;
    margin: 4px 0;
  }

  .rail-area {
    margin-top: 7px;
  }

  .year-rail {
    height: 29px;
  }

  .rail-track {
    top: 15px;
  }

  .rail-fill {
    top: 13.5px;
  }

  .rail-ticks {
    top: 9px;
    height: 10px;
  }

  .rail-thumb {
    top: -4px;
    transform: translateX(-50%) scale(0.86);
  }

  .rail-instruction,
  .footer-fineprint {
    display: none;
  }

  .sound-layers {
    font-size: 8px;
  }

  .end-card {
    top: auto;
    bottom: 170px;
  }
}

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

  .drag-hint-arrow,
  .boot-rule i {
    animation: none;
  }
}








