:root {
  --inkBlack: #171814;
  --inkSoft: #2e3029;
  --nightBlack: #10120f;
  --nightBlue: #242a28;
  --paperBase: #d8c7a0;
  --paperLight: #ecdfbd;
  --paperDim: #b9a882;
  --earthBrown: #594631;
  --earthDark: #3a3329;
  --ashGray: #9b9888;
  --ashLight: #c0bba7;
  --sealRed: #89271f;
  --sealBright: #c84634;
  --strawGold: #c19b57;
  --dangerRed: #c9553d;
  --safeGreen: #7d8d6a;
  --focusGold: #f3c766;
  --paperShadow: rgba(3, 5, 4, 0.58);
  --hairline: rgba(224, 208, 169, 0.23);
  --wideContent: 1440px;
  --storyMeasure: 42rem;
  --edgeInset: clamp(1rem, 3vw, 3.5rem);
  --touchSize: 3rem;
  font-size: 16px;
  color-scheme: dark;
}

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

html {
  min-height: 100%;
  background: var(--nightBlack);
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-width: 0;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--paperLight);
  background:
    radial-gradient(circle at 74% 12%, rgba(104, 91, 65, 0.13), transparent 32rem),
    repeating-linear-gradient(92deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 5px),
    var(--nightBlack);
  font-family: "Noto Serif CJK SC", "Source Han Serif SC", "FangSong", "STFangsong", "SimSun", serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: inherit;
}

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

button:not(:disabled),
select,
label[for] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

::selection {
  color: var(--paperLight);
  background: var(--sealRed);
}

[hidden] {
  display: none !important;
}

.screen {
  min-height: 100svh;
  isolation: isolate;
}

.skipLink {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--inkBlack);
  background: var(--focusGold);
  border: 2px solid currentColor;
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skipLink:focus {
  transform: translateY(0);
}

.visuallyHidden {
  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;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focusGold);
  outline-offset: 4px;
}

.titleScreen {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  padding: max(1.1rem, env(safe-area-inset-top)) var(--edgeInset) max(1rem, env(safe-area-inset-bottom));
  overflow: hidden;
  color: var(--paperLight);
  background:
    linear-gradient(90deg, rgba(12, 14, 12, 0.97) 0%, rgba(12, 14, 12, 0.82) 42%, rgba(12, 14, 12, 0.34) 75%, rgba(12, 14, 12, 0.66) 100%),
    linear-gradient(180deg, rgba(8, 9, 8, 0.1), rgba(8, 9, 8, 0.44)),
    #1b1e1a;
}

.titleScreen::before {
  position: absolute;
  z-index: -2;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.6;
  background:
    radial-gradient(ellipse at 72% 15%, rgba(211, 182, 119, 0.16), transparent 12%),
    repeating-radial-gradient(ellipse at 72% 116%, rgba(219, 208, 175, 0.055) 0 1px, transparent 1px 11px),
    linear-gradient(177deg, transparent 0 44%, rgba(13, 15, 13, 0.86) 45% 100%);
}

.titleScreen::after {
  position: absolute;
  z-index: 5;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.3;
  mix-blend-mode: multiply;
  background:
    repeating-linear-gradient(4deg, transparent 0 7px, rgba(0, 0, 0, 0.12) 7px 8px),
    repeating-linear-gradient(93deg, transparent 0 19px, rgba(226, 213, 177, 0.05) 19px 20px),
    radial-gradient(ellipse at center, transparent 38%, rgba(0, 0, 0, 0.7) 110%);
}

.titleAtmosphere {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
}

.ridge {
  position: absolute;
  right: -7%;
  bottom: 0;
  width: 74%;
  height: 58%;
  transform-origin: bottom right;
  background: #161916;
  clip-path: polygon(0 100%, 0 71%, 12% 64%, 20% 51%, 28% 58%, 37% 38%, 47% 48%, 58% 23%, 68% 43%, 78% 33%, 88% 49%, 100% 38%, 100% 100%);
}

.ridgeFar {
  right: -4%;
  bottom: 13%;
  width: 72%;
  height: 55%;
  opacity: 0.38;
  filter: blur(1px);
  background: #545b50;
}

.ridgeNear {
  filter: drop-shadow(-1.5rem -1rem 0 rgba(7, 8, 7, 0.17));
}

.roadLine {
  position: absolute;
  right: 10%;
  bottom: -9%;
  width: 29%;
  height: 55%;
  opacity: 0.42;
  border-left: 0.35rem solid rgba(218, 200, 153, 0.27);
  border-radius: 50%;
  transform: rotate(31deg);
}

.watchLight {
  position: absolute;
  right: 24%;
  top: 35%;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #f0c873;
  box-shadow:
    0 0 0 0.2rem rgba(241, 199, 106, 0.12),
    0 0 1.8rem 0.9rem rgba(240, 186, 77, 0.16);
  animation: watchBreath 4.6s ease-in-out infinite;
}

@keyframes watchBreath {
  0%,
  100% {
    opacity: 0.42;
    transform: scale(0.86);
  }
  50% {
    opacity: 0.82;
    transform: scale(1.15);
  }
}

.titleUtility,
.titleFooter,
.titlePanel {
  width: min(100%, var(--wideContent));
  margin-inline: auto;
}

.titleUtility {
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touchSize);
}

.workMark {
  margin: 0;
  color: var(--paperDim);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.32em;
}

.quietButton {
  min-height: var(--touchSize);
  padding: 0.45rem 0.8rem;
  color: var(--paperDim);
  background: rgba(14, 16, 13, 0.68);
  border: 1px solid var(--hairline);
  border-radius: 0;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.quietButton:hover {
  color: var(--paperLight);
  background: rgba(49, 46, 37, 0.85);
  border-color: rgba(224, 208, 169, 0.55);
}

.utilityButton,
.gameSettingsButton {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  justify-content: center;
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.utilityButton span:first-child,
.gameSettingsButton span:first-child {
  display: grid;
  width: 1.5rem;
  aspect-ratio: 1;
  place-items: center;
  color: var(--paperLight);
  border: 1px solid currentColor;
}

.titlePanel {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(31rem, 1.45fr) minmax(18rem, 0.72fr);
  gap: clamp(2.5rem, 7vw, 8rem);
  align-items: center;
  padding-block: clamp(2rem, 6vh, 5rem);
}

.titleLead {
  max-width: 48rem;
}

.dateLine,
.placeLine,
.titleOverline,
.briefLabel,
.noteLabel,
.dialogKicker,
.endingKicker,
.sceneEyebrow {
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
}

.dateLine {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin: 0;
  color: var(--strawGold);
  font-size: clamp(0.78rem, 1vw, 0.9rem);
  letter-spacing: 0.18em;
}

.dateLine::before {
  width: clamp(2rem, 4vw, 4.2rem);
  height: 1px;
  content: "";
  background: currentColor;
}

.placeLine {
  margin: 0.35rem 0 1.5rem clamp(2.75rem, 5vw, 5rem);
  color: var(--ashLight);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
}

.titleLockup {
  display: flex;
  gap: clamp(0.85rem, 2.4vw, 1.7rem);
  align-items: flex-end;
}

.titleSeal {
  display: grid;
  flex: 0 0 auto;
  width: clamp(3.8rem, 7vw, 5.8rem);
  aspect-ratio: 1;
  place-items: center;
  margin-bottom: 0.8rem;
  color: var(--paperLight);
  background:
    linear-gradient(16deg, transparent 4%, rgba(0, 0, 0, 0.13) 5% 7%, transparent 8%),
    var(--sealRed);
  border: 0.18rem double rgba(235, 218, 179, 0.67);
  box-shadow:
    0.25rem 0.35rem 0 rgba(0, 0, 0, 0.22),
    inset 0 0 0 0.18rem var(--sealRed),
    inset 0 0 0 0.28rem rgba(235, 218, 179, 0.36);
  font-size: clamp(2rem, 4vw, 3.35rem);
  font-weight: 900;
  line-height: 1;
  transform: rotate(-4deg);
}

.titleOverline {
  margin: 0 0 0.28rem;
  color: var(--paperDim);
  font-size: clamp(0.7rem, 1.1vw, 0.84rem);
  letter-spacing: 0.34em;
}

.titleLockup h1 {
  margin: 0;
  color: var(--paperLight);
  font-size: clamp(4.3rem, 9vw, 8.6rem);
  font-weight: 900;
  letter-spacing: -0.065em;
  line-height: 0.92;
  text-shadow:
    0.12rem 0.12rem 0 rgba(0, 0, 0, 0.5),
    -0.04rem 0.05rem 0 rgba(223, 207, 169, 0.25);
}

.titleSubtitle {
  max-width: 36rem;
  margin: clamp(1.6rem, 3vh, 2.5rem) 0 0;
  padding-left: 1rem;
  color: var(--paperLight);
  border-left: 0.25rem solid var(--sealRed);
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 0.045em;
  line-height: 1.55;
}

.titlePremise {
  max-width: 35rem;
  margin: 1rem 0 0 1.25rem;
  color: var(--paperDim);
  font-size: clamp(0.92rem, 1.25vw, 1.05rem);
  line-height: 1.9;
}

.titleActions {
  display: grid;
  grid-template-columns: minmax(11rem, 16rem) minmax(10rem, 14rem);
  gap: 0.75rem;
  align-items: stretch;
  margin-top: clamp(1.6rem, 3vh, 2.3rem);
}

.actionButton {
  position: relative;
  min-height: 3.6rem;
  padding: 0.85rem 1.1rem;
  overflow: hidden;
  border-radius: 0;
  font-weight: 700;
  transition: transform 150ms ease, color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.actionButton::after {
  position: absolute;
  right: -0.2rem;
  bottom: -0.7rem;
  width: 3.4rem;
  height: 2.3rem;
  content: "";
  opacity: 0.18;
  border: 0.22rem solid currentColor;
  transform: rotate(-13deg);
}

.actionButton:not(:disabled):hover {
  transform: translateY(-2px);
}

.primaryAction {
  color: var(--paperLight);
  background:
    repeating-linear-gradient(8deg, transparent 0 6px, rgba(0, 0, 0, 0.09) 6px 7px),
    var(--sealRed);
  border: 1px solid var(--sealBright);
  box-shadow: 0.32rem 0.38rem 0 rgba(0, 0, 0, 0.26);
}

.primaryAction:hover {
  background-color: #b43b2e;
}

.secondaryAction {
  color: var(--paperLight);
  background: rgba(43, 43, 36, 0.86);
  border: 1px solid rgba(218, 202, 165, 0.34);
}

.secondaryAction:not(:disabled):hover {
  border-color: rgba(232, 216, 175, 0.72);
}

.secondaryAction:disabled {
  color: rgba(223, 209, 177, 0.38);
  background: rgba(35, 36, 31, 0.44);
  border-color: rgba(218, 202, 165, 0.12);
}

.buttonKicker,
.buttonLabel {
  display: block;
}

.buttonKicker {
  margin-bottom: 0.12rem;
  opacity: 0.72;
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.buttonLabel {
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.textButton {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 2.75rem;
  padding: 0.4rem 0.2rem;
  color: var(--paperDim);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(218, 202, 165, 0.26);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.textButton::after {
  margin-left: 0.6rem;
  content: "→";
}

.textButton:hover {
  color: var(--paperLight);
  border-bottom-color: currentColor;
}

.durationNote {
  margin: 0.7rem 0 0;
  color: var(--ashLight);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
}

.durationNote span {
  margin-right: 0.35rem;
  color: var(--strawGold);
}

.fieldBrief {
  position: relative;
  align-self: center;
  max-width: 25rem;
  padding: clamp(1.4rem, 2.5vw, 2.2rem);
  color: var(--inkBlack);
  background:
    linear-gradient(89deg, transparent 0 3%, rgba(74, 54, 31, 0.05) 3.2% 4%, transparent 4.2%),
    repeating-linear-gradient(2deg, rgba(49, 39, 26, 0.035) 0 1px, transparent 1px 8px),
    var(--paperBase);
  box-shadow:
    0.85rem 1.1rem 2.6rem var(--paperShadow),
    inset 0 0 4.5rem rgba(83, 61, 33, 0.16);
  transform: rotate(0.45deg);
}

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

.fieldBrief::before {
  inset: 0.45rem;
  border: 1px solid rgba(64, 48, 29, 0.32);
}

.fieldBrief::after {
  right: -0.7rem;
  bottom: 1.8rem;
  width: 4.5rem;
  height: 4.5rem;
  opacity: 0.38;
  border: 0.22rem double var(--sealRed);
  transform: rotate(-9deg);
}

.contentNotice {
  position: relative;
  z-index: 1;
  margin: 0 0 1.25rem;
  padding: 0.8rem 0.9rem 0.75rem;
  color: #efe0bd;
  background: var(--inkSoft);
  border-left: 0.28rem solid var(--sealRed);
}

.contentNotice p {
  margin: 0;
}

.contentNotice .briefLabel {
  margin-bottom: 0.12rem;
  color: #e6b567;
  font-size: 0.63rem;
  letter-spacing: 0.25em;
}

.contentNotice p:last-child {
  font-size: 0.78rem;
  line-height: 1.6;
}

.factPair {
  position: relative;
  z-index: 1;
}

.factPair section + section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(52, 43, 29, 0.36);
}

.factPair h2 {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  margin: 0;
  color: var(--sealRed);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
}

.factPair h2::before {
  width: 0.55rem;
  height: 0.55rem;
  content: "";
  border: 1px solid currentColor;
  transform: rotate(45deg);
}

.factPair p {
  margin: 0.4rem 0 0;
  color: var(--inkSoft);
  font-size: 0.78rem;
  line-height: 1.75;
}

.fieldBrief blockquote {
  position: relative;
  z-index: 1;
  margin: 1.2rem 0 0;
  padding: 0.85rem 0 0;
  border-top: 2px solid rgba(46, 48, 41, 0.66);
}

.fieldBrief blockquote p {
  margin: 0;
  font-size: 0.93rem;
  font-weight: 700;
}

.fieldBrief blockquote footer {
  margin-top: 0.28rem;
  color: var(--earthBrown);
  font-size: 0.7rem;
}

.fieldBrief .briefClosing {
  position: relative;
  z-index: 1;
  margin: 1.2rem 0 0;
  padding: 0.85rem 0 0;
  border-top: 2px solid rgba(46, 48, 41, 0.66);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.7;
}

.titleFooter {
  z-index: 10;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  color: var(--ashGray);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.editionMark {
  text-align: right;
}

.gameScreen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100svh;
  color: var(--paperLight);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px) 0 0 / 4rem 100%,
    repeating-linear-gradient(3deg, transparent 0 9px, rgba(222, 205, 167, 0.014) 9px 10px),
    #171a17;
}

.gameHeader {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: minmax(13rem, 1fr) minmax(28rem, 1.45fr) minmax(4.7rem, 1fr);
  gap: clamp(1rem, 3vw, 3rem);
  align-items: center;
  min-height: 5.15rem;
  padding: 0.72rem var(--edgeInset);
  background:
    repeating-linear-gradient(91deg, transparent 0 11px, rgba(240, 224, 184, 0.025) 11px 12px),
    rgba(16, 18, 15, 0.96);
  border-bottom: 1px solid rgba(215, 197, 156, 0.22);
  box-shadow: 0 0.6rem 1.8rem rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(10px);
}

.brandButton {
  display: inline-flex;
  gap: 0.75rem;
  align-items: center;
  justify-self: start;
  min-height: var(--touchSize);
  padding: 0;
  color: var(--paperLight);
  text-align: left;
  background: transparent;
  border: 0;
}

.brandSeal {
  display: grid;
  width: 2.25rem;
  aspect-ratio: 1;
  place-items: center;
  color: var(--paperLight);
  background: var(--sealRed);
  border: 1px solid rgba(235, 218, 179, 0.5);
  font-size: 1.25rem;
  font-weight: 900;
  transform: rotate(-3deg);
}

.brandWords {
  display: grid;
  line-height: 1.2;
}

.brandWords strong {
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.brandWords small {
  margin-top: 0.25rem;
  color: var(--paperDim);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.statusBoard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.8rem, 2vw, 1.8rem);
}

.statusItem {
  min-width: 0;
}

.statusLine {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.32rem;
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.72rem;
  line-height: 1.2;
}

.statusName {
  color: var(--ashLight);
  letter-spacing: 0.15em;
}

.statusLine strong {
  min-width: 0;
  overflow: hidden;
  color: var(--paperLight);
  font-size: 0.7rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meterTrack {
  position: relative;
  height: 0.3rem;
  overflow: hidden;
  background: rgba(225, 210, 174, 0.12);
  border-left: 1px solid rgba(225, 210, 174, 0.42);
  border-right: 1px solid rgba(225, 210, 174, 0.42);
}

.meterTrack::after {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0.35;
  background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), rgba(11, 12, 10, 0.8) calc(25% - 1px) 25%);
}

.meterFill {
  display: block;
  width: 50%;
  height: 100%;
  background: var(--paperDim);
  transition: width 480ms cubic-bezier(0.2, 0.75, 0.25, 1), background-color 220ms ease;
}

.timeStatus .meterFill {
  width: 78%;
  background: var(--strawGold);
}

.soundStatus .meterFill {
  width: 8%;
  background: var(--dangerRed);
}

.bondStatus .meterFill {
  width: 18%;
  background: var(--safeGreen);
}

.gameSettingsButton {
  justify-self: end;
}

.gameStage {
  display: grid;
  grid-template-columns: minmax(10.5rem, 0.58fr) minmax(26rem, 2.15fr) minmax(15rem, 0.85fr);
  min-height: 0;
  width: min(100%, var(--wideContent));
  margin-inline: auto;
}

.routePanel,
.memoryTray {
  min-width: 0;
  padding: clamp(1.3rem, 2.5vw, 2.5rem) clamp(1rem, 2.5vw, 2rem);
  background: rgba(16, 18, 15, 0.42);
}

.routePanel {
  border-right: 1px solid rgba(216, 199, 158, 0.12);
}

.memoryTray {
  border-left: 1px solid rgba(216, 199, 158, 0.12);
}

.panelHeading {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  color: var(--paperLight);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

.panelHeading > span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.panelHeading small {
  color: var(--ashGray);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.routeRail {
  position: relative;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.routeRail::before {
  position: absolute;
  top: 0.6rem;
  bottom: 0.6rem;
  left: 0.48rem;
  width: 1px;
  content: "";
  background: rgba(218, 202, 165, 0.24);
}

.routeRail li {
  position: relative;
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  gap: 0.72rem;
  align-items: start;
  min-height: 3.3rem;
  color: var(--ashGray);
  font-size: 0.7rem;
  line-height: 1.45;
}

.routeRail li::before {
  position: relative;
  z-index: 1;
  width: 0.55rem;
  height: 0.55rem;
  margin: 0.26rem 0 0 0.22rem;
  content: "";
  background: var(--nightBlack);
  border: 1px solid var(--ashGray);
  transform: rotate(45deg);
}

.routeRail li[data-state="past"] {
  color: var(--paperDim);
}

.routeRail li[data-state="past"]::before {
  background: var(--earthBrown);
  border-color: var(--paperDim);
}

.routeRail li[data-state="current"] {
  color: var(--paperLight);
  font-weight: 700;
}

.routeRail li[data-state="current"]::before {
  background: var(--sealRed);
  border-color: var(--sealBright);
  box-shadow: 0 0 0 0.28rem rgba(157, 48, 37, 0.15);
}

.routeRail li[data-state="locked"] {
  opacity: 0.48;
}

.storyPanel {
  position: relative;
  min-width: 0;
  padding: clamp(2rem, 5vw, 5rem) clamp(1.5rem, 5vw, 5.5rem) max(3rem, env(safe-area-inset-bottom));
  background:
    linear-gradient(90deg, transparent, rgba(224, 208, 168, 0.02) 50%, transparent),
    rgba(25, 27, 23, 0.48);
}

.storyPanel::before {
  position: absolute;
  top: 1.2rem;
  right: clamp(1rem, 3vw, 2.8rem);
  width: 3.7rem;
  height: 3.7rem;
  content: "";
  opacity: 0.12;
  border: 0.2rem double var(--sealBright);
  transform: rotate(8deg);
}

.sceneHeading,
.storyCopy,
.dialogueList,
.choiceArea {
  width: min(100%, var(--storyMeasure));
  margin-inline: auto;
}

.sceneHeading {
  position: relative;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(218, 202, 165, 0.18);
}

.sceneEyebrow {
  margin: 0 0 0.4rem;
  color: var(--strawGold);
  font-size: 0.67rem;
  letter-spacing: 0.22em;
}

.sceneHeading h1 {
  margin: 0;
  color: var(--paperLight);
  font-size: clamp(1.9rem, 4vw, 3.3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.storyCopy {
  padding-top: clamp(1.5rem, 3vw, 2.4rem);
  color: #ded2b2;
  font-size: clamp(1rem, 1.3vw, 1.12rem);
  line-height: 2;
}

.storyCopy p {
  margin: 0;
}

.storyCopy p + p {
  margin-top: 1.2em;
}

.storyCopy p:first-child::first-letter {
  float: left;
  margin: 0.15rem 0.38rem 0 0;
  color: var(--paperLight);
  font-size: 2.7rem;
  font-weight: 900;
  line-height: 0.8;
}

.storyCopy em {
  color: var(--paperLight);
  font-style: normal;
  border-bottom: 1px dashed rgba(222, 210, 179, 0.36);
}

.storyCopy .storyAside {
  padding: 0.8rem 1rem;
  color: var(--paperDim);
  background: rgba(0, 0, 0, 0.16);
  border-left: 2px solid var(--earthBrown);
  font-size: 0.88em;
}

.dialogueList {
  display: grid;
  gap: 0.8rem;
  padding-top: 1.4rem;
}

.dialogueLine {
  display: grid;
  grid-template-columns: minmax(3.8rem, auto) 1fr;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.75rem 1rem;
  background: rgba(8, 10, 8, 0.22);
  border-left: 1px solid rgba(222, 205, 164, 0.25);
}

.dialogueName {
  color: var(--strawGold);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.dialogueText {
  color: var(--paperLight);
  font-size: 0.94rem;
  line-height: 1.75;
}

.choiceArea {
  padding-top: clamp(2rem, 5vh, 3.7rem);
}

.choicePrompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 0.72rem;
  color: var(--paperDim);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.63rem;
  letter-spacing: 0.16em;
}

.keyHint {
  color: var(--ashGray);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.choiceList {
  display: grid;
  gap: 0.65rem;
}

.choiceButton {
  position: relative;
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  min-height: 4rem;
  padding: 0.78rem 1rem;
  overflow: hidden;
  color: var(--paperLight);
  text-align: left;
  background:
    repeating-linear-gradient(3deg, transparent 0 8px, rgba(228, 210, 171, 0.018) 8px 9px),
    rgba(44, 43, 35, 0.72);
  border: 1px solid rgba(218, 201, 161, 0.26);
  border-radius: 0;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.choiceButton:hover {
  background-color: rgba(67, 60, 45, 0.88);
  border-color: rgba(231, 214, 174, 0.62);
  transform: translateX(0.2rem);
}

.choiceIndex {
  display: grid;
  width: 1.8rem;
  aspect-ratio: 1;
  place-items: center;
  color: var(--strawGold);
  border: 1px solid rgba(193, 155, 87, 0.5);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.68rem;
}

.choiceCopy {
  display: grid;
  gap: 0.15rem;
}

.choiceCopy strong {
  font-size: 0.95rem;
  letter-spacing: 0.025em;
}

.choiceCopy small {
  color: var(--paperDim);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.75rem;
  line-height: 1.5;
}

.choiceCost {
  color: var(--ashLight);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.62rem;
  white-space: nowrap;
}

.choiceButton[data-tone="danger"] {
  border-left: 0.18rem solid var(--dangerRed);
}

.choiceButton[data-tone="bond"] {
  border-left: 0.18rem solid var(--safeGreen);
}

.choiceButton[data-tone="time"] {
  border-left: 0.18rem solid var(--strawGold);
}

.memoryTray {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.memorySection {
  min-height: 0;
}

.memoryHeading {
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(216, 198, 158, 0.16);
}

.inventoryList {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.inventoryList li {
  position: relative;
  padding: 0.75rem 0.8rem 0.75rem 2rem;
  color: var(--paperDim);
  background: rgba(222, 205, 166, 0.045);
  border: 1px solid rgba(222, 205, 166, 0.11);
  font-size: 0.72rem;
  line-height: 1.55;
}

.inventoryList li::before {
  position: absolute;
  top: 0.95rem;
  left: 0.78rem;
  width: 0.5rem;
  height: 0.5rem;
  content: "";
  border: 1px solid var(--earthBrown);
  transform: rotate(45deg);
}

.inventoryList .itemName {
  display: block;
  color: var(--paperLight);
  font-size: 0.78rem;
  font-weight: 700;
}

.inventoryList .itemNote {
  display: block;
  margin-top: 0.18rem;
}

.inventoryList .emptyItem {
  color: var(--ashGray);
  font-style: italic;
}

.noteSection {
  margin-top: auto;
  padding: 1rem;
  color: var(--inkSoft);
  background:
    repeating-linear-gradient(4deg, transparent 0 7px, rgba(53, 40, 25, 0.045) 7px 8px),
    var(--paperBase);
  box-shadow: 0.35rem 0.45rem 0 rgba(0, 0, 0, 0.2);
  transform: rotate(-0.45deg);
}

.noteLabel {
  margin: 0;
  color: var(--sealRed);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

.noteSection > p:not(.noteLabel) {
  margin: 0.38rem 0 0.75rem;
  font-size: 0.75rem;
  line-height: 1.6;
}

.noteButton {
  min-height: var(--touchSize);
  padding: 0.45rem 0;
  color: var(--inkBlack);
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(46, 48, 41, 0.35);
  border-bottom: 1px solid rgba(46, 48, 41, 0.35);
  font-size: 0.72rem;
  font-weight: 700;
}

.noteButton::after {
  margin-left: 0.5rem;
  content: "↗";
}

.saveStatus {
  margin: -1rem 0 0;
  color: var(--ashGray);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.7rem;
  line-height: 1.5;
  text-align: center;
}

.saveStatus[data-state="saving"]::before {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.4rem;
  content: "";
  background: var(--strawGold);
  border-radius: 50%;
  animation: savePulse 900ms ease-in-out infinite alternate;
}

@keyframes savePulse {
  to {
    opacity: 0.3;
  }
}

.endingScreen {
  display: grid;
  min-height: 100svh;
  padding: max(2rem, env(safe-area-inset-top)) var(--edgeInset) max(2rem, env(safe-area-inset-bottom));
  place-items: center;
  color: var(--paperLight);
  background:
    radial-gradient(circle at 50% 18%, rgba(216, 183, 113, 0.17), transparent 31rem),
    linear-gradient(180deg, #202521 0%, #131512 72%),
    var(--nightBlack);
}

.endingFrame {
  display: grid;
  grid-template-columns: minmax(5rem, 0.25fr) minmax(20rem, 42rem);
  gap: clamp(1.5rem, 6vw, 6rem);
  align-items: start;
  width: min(100%, 58rem);
}

.endingMark {
  display: grid;
  gap: 0.2rem;
  justify-items: center;
  padding: 1.2rem 0.7rem;
  color: var(--sealBright);
  border: 0.15rem solid currentColor;
  box-shadow: inset 0 0 0 0.25rem var(--nightBlack), inset 0 0 0 0.32rem currentColor;
  font-weight: 900;
  line-height: 1.1;
  transform: rotate(-3deg);
}

.endingMark span:first-child {
  font-size: clamp(1rem, 3vw, 1.5rem);
  letter-spacing: 0.15em;
}

.endingMark span:last-child {
  font-size: clamp(2.3rem, 6vw, 4.5rem);
}

.endingLetter {
  position: relative;
  padding: clamp(1.7rem, 5vw, 4rem);
  color: var(--inkBlack);
  background:
    linear-gradient(93deg, transparent 0 7%, rgba(76, 57, 33, 0.05) 7.2% 8%, transparent 8.2%),
    repeating-linear-gradient(2deg, rgba(52, 42, 29, 0.028) 0 1px, transparent 1px 9px),
    var(--paperBase);
  box-shadow: 1.2rem 1.6rem 3rem var(--paperShadow);
}

.endingLetter::before {
  position: absolute;
  inset: 0.8rem;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(53, 41, 27, 0.24);
}

.endingKicker {
  position: relative;
  margin: 0;
  color: var(--sealRed);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
}

.endingLetter h1 {
  position: relative;
  margin: 0.35rem 0 1.4rem;
  color: var(--inkBlack);
  font-size: clamp(2.1rem, 5vw, 4.1rem);
  line-height: 1.18;
}

.endingCopy {
  position: relative;
  color: var(--inkSoft);
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
  line-height: 2;
}

.endingCopy p {
  margin: 0;
}

.endingCopy p + p {
  margin-top: 1em;
}

.endingSummary {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 1.5rem;
  background: rgba(48, 43, 33, 0.22);
  border: 1px solid rgba(48, 43, 33, 0.22);
}

.summaryItem {
  padding: 0.85rem;
  background: rgba(232, 219, 184, 0.6);
}

.summaryItem small,
.summaryItem strong {
  display: block;
}

.summaryItem small {
  color: var(--earthBrown);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.summaryItem strong {
  margin-top: 0.2rem;
  font-size: 0.9rem;
}

.endingActions {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.endingActions .secondaryAction {
  color: var(--inkBlack);
  background: transparent;
  border-color: rgba(48, 43, 33, 0.45);
}

.endingContext {
  grid-column: 2;
  margin: 0;
  color: var(--ashLight);
  font-size: 0.7rem;
  text-align: center;
}

.paperDialog {
  width: min(calc(100% - 2rem), 42rem);
  max-height: min(48rem, calc(100svh - 2rem));
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--inkBlack);
  background:
    repeating-linear-gradient(3deg, transparent 0 8px, rgba(56, 42, 26, 0.035) 8px 9px),
    var(--paperBase);
  border: 1px solid rgba(238, 221, 180, 0.5);
  border-radius: 0;
  box-shadow: 1rem 1.2rem 3rem rgba(0, 0, 0, 0.58);
}

.paperDialog::backdrop {
  background:
    radial-gradient(circle at center, rgba(20, 22, 18, 0.52), rgba(5, 6, 5, 0.88));
  backdrop-filter: blur(4px);
}

.dialogHeader {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem clamp(1.1rem, 4vw, 2rem);
  background: rgba(216, 199, 160, 0.96);
  border-bottom: 1px solid rgba(50, 41, 29, 0.25);
}

.dialogKicker {
  margin: 0 0 0.15rem;
  color: var(--sealRed);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

.dialogHeader h2 {
  margin: 0;
  color: var(--inkBlack);
  font-size: 1.65rem;
  line-height: 1.2;
}

.dialogCloseButton {
  display: grid;
  flex: 0 0 auto;
  width: var(--touchSize);
  height: var(--touchSize);
  place-items: center;
  padding: 0;
  color: var(--inkBlack);
  background: transparent;
  border: 1px solid rgba(45, 39, 29, 0.35);
  border-radius: 0;
  font-family: Arial, sans-serif;
  font-size: 1.6rem;
  line-height: 1;
}

.dialogCloseButton:hover {
  color: var(--paperLight);
  background: var(--sealRed);
  border-color: var(--sealRed);
}

.archiveContent {
  max-height: min(36rem, calc(100svh - 9rem));
  padding: clamp(1.2rem, 4vw, 2rem);
  overflow-y: auto;
}

.emptyArchive {
  margin: 0;
  padding: 2rem 1rem;
  color: var(--earthBrown);
  text-align: center;
  border: 1px dashed rgba(61, 49, 32, 0.34);
}

.archiveEntry {
  display: grid;
  grid-template-columns: minmax(5.5rem, 0.3fr) 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(55, 44, 29, 0.2);
}

.archiveEntry time {
  color: var(--sealRed);
  font-family: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
}

.archiveEntry h3 {
  margin: 0;
  font-size: 1rem;
}

.archiveEntry p {
  margin: 0.35rem 0 0;
  color: var(--earthBrown);
  font-size: 0.76rem;
  line-height: 1.65;
}

.settingsList {
  display: grid;
  padding: 0 clamp(1.1rem, 4vw, 2rem);
}

.toggleRow,
.selectRow {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(52, 43, 30, 0.18);
}

.toggleRow > span:first-child,
.selectRow > span:first-child {
  display: grid;
}

.toggleRow strong,
.selectRow strong {
  font-size: 0.92rem;
}

.toggleRow small,
.selectRow small {
  margin-top: 0.15rem;
  color: var(--earthBrown);
  font-size: 0.75rem;
}

.toggleControl {
  position: relative;
  flex: 0 0 auto;
}

.toggleControl input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  opacity: 0;
}

.toggleTrack {
  position: relative;
  display: block;
  width: 3.2rem;
  height: 1.7rem;
  background: rgba(49, 45, 35, 0.15);
  border: 1px solid rgba(49, 45, 35, 0.42);
  transition: background-color 160ms ease, border-color 160ms ease;
}

.toggleTrack::after {
  position: absolute;
  top: 0.21rem;
  left: 0.23rem;
  width: 1.12rem;
  height: 1.12rem;
  content: "";
  background: var(--earthBrown);
  transition: transform 180ms ease, background-color 180ms ease;
}

.toggleControl input:checked + .toggleTrack {
  background: rgba(157, 48, 37, 0.15);
  border-color: var(--sealRed);
}

.toggleControl input:checked + .toggleTrack::after {
  background: var(--sealRed);
  transform: translateX(1.48rem);
}

.toggleControl input:focus-visible + .toggleTrack {
  outline: 3px solid var(--focusGold);
  outline-offset: 3px;
}

.selectRow select {
  min-width: 7rem;
  min-height: var(--touchSize);
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  color: var(--inkBlack);
  background: rgba(236, 223, 189, 0.62);
  border: 1px solid rgba(48, 43, 33, 0.4);
  border-radius: 0;
}

.settingsFootnote {
  margin: 0;
  padding: 1rem clamp(1.1rem, 4vw, 2rem) 1.4rem;
  color: var(--earthBrown);
  font-size: 0.75rem;
}

.settingsDialog {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.toast {
  position: fixed;
  z-index: 100;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  max-width: min(24rem, calc(100% - 2rem));
  padding: 0.75rem 1rem;
  color: var(--paperLight);
  background: rgba(24, 26, 22, 0.96);
  border: 1px solid rgba(225, 209, 170, 0.35);
  border-left: 0.25rem solid var(--sealRed);
  box-shadow: 0.5rem 0.6rem 1.5rem rgba(0, 0, 0, 0.36);
  font-size: 0.78rem;
  animation: toastArrive 180ms ease-out;
}

@keyframes toastArrive {
  from {
    opacity: 0;
    transform: translateY(0.6rem);
  }
}

.noScriptNotice {
  position: fixed;
  z-index: 120;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  padding: 1rem;
  color: var(--paperLight);
  background: var(--sealRed);
  border: 1px solid var(--paperLight);
  text-align: center;
}

html[data-text-size="large"],
html[dataTextSize="large"] {
  font-size: 18px;
}

html[data-text-size="largest"],
html[dataTextSize="largest"] {
  font-size: 20px;
}

body.textSizeLarge {
  font-size: 1.125rem;
}

body.textSizeLargest {
  font-size: 1.25rem;
}

@media (max-width: 68rem) {
  .titlePanel {
    grid-template-columns: minmax(26rem, 1.25fr) minmax(17rem, 0.75fr);
    gap: 2.5rem;
  }

  .titleLockup h1 {
    font-size: clamp(4.1rem, 8.5vw, 6.5rem);
  }

  .gameHeader {
    grid-template-columns: minmax(12rem, 0.8fr) minmax(22rem, 1.3fr) auto;
    gap: 1rem;
  }

  .gameStage {
    grid-template-columns: minmax(8.5rem, 0.5fr) minmax(24rem, 2fr) minmax(13rem, 0.75fr);
  }

  .storyPanel {
    padding-inline: clamp(1.4rem, 3.5vw, 3rem);
  }
}

@media (max-width: 72rem) {
  :where(html[data-text-size="largest"]) .titleScreen {
    overflow-y: auto;
  }

  :where(html[data-text-size="largest"]) .titlePanel {
    grid-template-columns: 1fr;
    gap: 2.4rem;
    align-items: start;
    padding-block: 2.5rem;
  }

  :where(html[data-text-size="largest"]) .titleLead,
  :where(html[data-text-size="largest"]) .fieldBrief {
    max-width: 42rem;
  }

  :where(html[data-text-size="largest"]) .fieldBrief {
    transform: none;
  }

  :where(html[data-text-size="largest"]) .gameHeader {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand settings"
      "status status";
    gap: 0.55rem 1rem;
    padding-block: 0.55rem;
  }

  :where(html[data-text-size="largest"]) .brandButton {
    grid-area: brand;
  }

  :where(html[data-text-size="largest"]) .statusBoard {
    grid-area: status;
  }

  :where(html[data-text-size="largest"]) .gameSettingsButton {
    grid-area: settings;
  }

  :where(html[data-text-size="largest"]) .gameStage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "route"
      "story"
      "memory";
  }

  :where(html[data-text-size="largest"]) .routePanel {
    position: sticky;
    z-index: 20;
    top: 7.6rem;
    grid-area: route;
    padding: 0.65rem var(--edgeInset);
    overflow: hidden;
    background: rgba(19, 21, 18, 0.96);
    border-right: 0;
    border-bottom: 1px solid rgba(216, 199, 158, 0.14);
    backdrop-filter: blur(8px);
  }

  :where(html[data-text-size="largest"]) .routePanel .panelHeading {
    display: none;
  }

  :where(html[data-text-size="largest"]) .routeRail {
    display: flex;
    gap: 0;
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  :where(html[data-text-size="largest"]) .routeRail::before {
    top: 0.52rem;
    right: 0.75rem;
    bottom: auto;
    left: 0.75rem;
    width: auto;
    height: 1px;
  }

  :where(html[data-text-size="largest"]) .routeRail li {
    flex: 1 0 7.5rem;
    grid-template-columns: 1rem minmax(0, 1fr);
    min-height: 2.6rem;
    padding-right: 0.6rem;
    font-size: 0.65rem;
  }

  :where(html[data-text-size="largest"]) .storyPanel {
    grid-area: story;
  }

  :where(html[data-text-size="largest"]) .memoryTray {
    grid-area: memory;
    display: grid;
    grid-template-columns: 1fr minmax(14rem, 0.7fr);
    border-top: 1px solid rgba(216, 199, 158, 0.12);
    border-left: 0;
  }

  :where(html[data-text-size="largest"]) .saveStatus {
    grid-column: 1 / -1;
    margin-top: -1rem;
  }
}

@media (max-width: 56rem) {
  .titleScreen {
    overflow-y: auto;
  }

  .titlePanel {
    grid-template-columns: 1fr;
    gap: 2.4rem;
    align-items: start;
    padding-block: 2.5rem;
  }

  .titleLead {
    max-width: 42rem;
  }

  .fieldBrief {
    max-width: 42rem;
    transform: none;
  }

  .gameHeader {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand settings"
      "status status";
    gap: 0.55rem 1rem;
    padding-block: 0.55rem;
  }

  .brandButton {
    grid-area: brand;
  }

  .statusBoard {
    grid-area: status;
  }

  .gameSettingsButton {
    grid-area: settings;
  }

  .gameStage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "route"
      "story"
      "memory";
  }

  .routePanel {
    position: sticky;
    z-index: 20;
    top: 7.6rem;
    grid-area: route;
    padding: 0.65rem var(--edgeInset);
    overflow: hidden;
    background: rgba(19, 21, 18, 0.96);
    border-right: 0;
    border-bottom: 1px solid rgba(216, 199, 158, 0.14);
    backdrop-filter: blur(8px);
  }

  .routePanel .panelHeading {
    display: none;
  }

  .routeRail {
    display: flex;
    gap: 0;
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .routeRail::before {
    top: 0.52rem;
    right: 0.75rem;
    bottom: auto;
    left: 0.75rem;
    width: auto;
    height: 1px;
  }

  .routeRail li {
    flex: 1 0 7.5rem;
    grid-template-columns: 1rem minmax(0, 1fr);
    min-height: 2.6rem;
    padding-right: 0.6rem;
    font-size: 0.65rem;
  }

  .storyPanel {
    grid-area: story;
  }

  .memoryTray {
    grid-area: memory;
    display: grid;
    grid-template-columns: 1fr minmax(14rem, 0.7fr);
    border-top: 1px solid rgba(216, 199, 158, 0.12);
    border-left: 0;
  }

  .saveStatus {
    grid-column: 1 / -1;
    margin-top: -1rem;
  }
}

@media (max-width: 40rem) {
  :root {
    --edgeInset: 1rem;
    --touchSize: 3rem;
  }

  .titleScreen {
    min-height: 100svh;
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }

  .titleScreen::before {
    opacity: 0.42;
  }

  .ridge {
    right: -32%;
    width: 125%;
    opacity: 0.72;
  }

  .ridgeFar {
    opacity: 0.22;
  }

  .watchLight {
    right: 18%;
    top: 23%;
  }

  .workMark {
    font-size: 0.58rem;
    letter-spacing: 0.2em;
  }

  .utilityButton span:last-child,
  .gameSettingsButton span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .utilityButton,
  .gameSettingsButton {
    width: var(--touchSize);
    padding: 0;
  }

  .titlePanel {
    gap: 2rem;
    padding-block: clamp(1.8rem, 5vh, 3rem);
  }

  .dateLine {
    letter-spacing: 0.09em;
  }

  .dateLine::before {
    width: 1.5rem;
  }

  .placeLine {
    margin-left: 2.2rem;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
  }

  .titleLockup {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr);
    align-items: center;
    gap: 0.7rem;
  }

  .titleLockup > div {
    min-width: 0;
  }

  .titleSeal {
    width: 3rem;
    margin-bottom: 0;
    font-size: 1.9rem;
  }

  .titleOverline {
    letter-spacing: 0.21em;
  }

  .titleLockup h1 {
    font-size: clamp(2.3rem, 14vw, 4.4rem);
  }

  .titleSubtitle {
    margin-top: 1.4rem;
    font-size: 1.05rem;
  }

  .titlePremise {
    margin-left: 0;
    font-size: 0.88rem;
  }

  .titleActions {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .actionButton {
    min-height: 3.75rem;
  }

  .textButton {
    grid-column: auto;
  }

  .fieldBrief {
    padding: 1.3rem;
  }

  .titleFooter {
    display: grid;
    gap: 0.2rem;
  }

  .editionMark {
    text-align: left;
  }

  .gameHeader {
    min-height: 7rem;
    padding-inline: 0.8rem;
  }

  .brandSeal {
    width: 2rem;
  }

  .brandWords strong {
    font-size: 0.88rem;
  }

  .brandWords small {
    max-width: 12rem;
    font-size: 0.68rem;
  }

  .statusBoard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .statusLine {
    display: grid;
    gap: 0.1rem;
  }

  .statusLine strong {
    font-size: 0.64rem;
  }

  .routePanel {
    top: 7.55rem;
  }

  .storyPanel {
    padding: 2.2rem 1rem max(2.2rem, env(safe-area-inset-bottom));
  }

  .sceneHeading h1 {
    font-size: 2rem;
  }

  .storyCopy {
    font-size: 1rem;
    line-height: 1.9;
  }

  .dialogueLine {
    grid-template-columns: 1fr;
    gap: 0.18rem;
  }

  .choiceArea {
    position: sticky;
    z-index: 15;
    bottom: 0;
    width: calc(100% + 2rem);
    margin: 2rem -1rem -2.2rem;
    padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(23, 26, 23, 0), rgba(23, 26, 23, 0.98) 1.2rem);
  }

  .choicePrompt {
    padding-top: 0.45rem;
  }

  .choiceButton {
    grid-template-columns: 2rem minmax(0, 1fr);
    min-height: 3.75rem;
    padding: 0.7rem 0.8rem;
  }

  .choiceCost {
    grid-column: 2;
    white-space: normal;
  }

  .keyHint {
    display: none;
  }

  .memoryTray {
    grid-template-columns: 1fr;
    gap: 1.2rem;
    padding: 1.4rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  }

  .saveStatus {
    grid-column: auto;
    margin: 0;
  }

  .endingFrame {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .endingMark {
    grid-template-columns: auto auto;
    gap: 0.5rem;
    justify-self: start;
    padding: 0.65rem 1rem;
  }

  .endingMark span:first-child,
  .endingMark span:last-child {
    font-size: 1rem;
  }

  .endingLetter {
    padding: 1.6rem 1.25rem;
  }

  .endingSummary {
    grid-template-columns: 1fr;
  }

  .endingActions {
    grid-template-columns: 1fr;
  }

  .endingContext {
    grid-column: 1;
  }

  .paperDialog {
    width: calc(100% - 1rem);
    max-height: calc(100svh - 1rem);
  }

  .toggleRow,
  .selectRow {
    min-height: 4.7rem;
  }

  .toggleRow small,
  .selectRow small {
    max-width: 13rem;
    line-height: 1.4;
  }

  .archiveEntry {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .toast {
    right: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    left: 0.75rem;
    max-width: none;
  }
}

@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;
  }
}

html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after,
html[dataMotion="reduced"] *,
html[dataMotion="reduced"] *::before,
html[dataMotion="reduced"] *::after,
body.reduceMotion *,
body.reduceMotion *::before,
body.reduceMotion *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

@media (prefers-contrast: more) {
  :root {
    --paperLight: #fff4d4;
    --paperDim: #e2d0a4;
    --ashGray: #c8c5b5;
    --hairline: rgba(255, 244, 212, 0.62);
  }

  button,
  .meterTrack,
  .inventoryList li {
    border-color: currentColor;
  }
}

html[data-contrast="high"],
html[dataContrast="high"],
body.highContrast,
body.contrastMode {
  --inkBlack: #090a08;
  --inkSoft: #171914;
  --nightBlack: #030403;
  --paperBase: #eee0b9;
  --paperLight: #fff5d8;
  --paperDim: #e7d4a8;
  --ashGray: #cbc8b6;
  --hairline: rgba(255, 245, 216, 0.7);
}

html[data-contrast="high"] button,
html[data-contrast="high"] .meterTrack,
html[data-contrast="high"] .inventoryList li,
html[dataContrast="high"] button,
html[dataContrast="high"] .meterTrack,
html[dataContrast="high"] .inventoryList li,
body.highContrast button,
body.highContrast .meterTrack,
body.highContrast .inventoryList li,
body.contrastMode button,
body.contrastMode .meterTrack,
body.contrastMode .inventoryList li {
  border-color: currentColor;
}

@media (forced-colors: active) {
  * {
    forced-color-adjust: auto;
  }

  .titleScreen,
  .gameScreen,
  .endingScreen,
  .fieldBrief,
  .endingLetter,
  .paperDialog,
  .noteSection {
    background: Canvas;
    color: CanvasText;
  }

  .titleScreen::before,
  .titleScreen::after,
  .titleAtmosphere,
  .storyPanel::before,
  .fieldBrief::after {
    display: none;
  }

  .meterFill,
  .titleSeal,
  .brandSeal {
    background: Highlight;
    color: HighlightText;
  }

  button,
  select,
  .contentNotice,
  .choiceButton {
    border: 2px solid ButtonText;
  }

  button:focus-visible,
  select:focus-visible,
  input:focus-visible,
  [tabindex]:focus-visible,
  a:focus-visible {
    outline: 3px solid Highlight;
  }
}

@media print {
  .titleUtility,
  .titleActions,
  .titleFooter,
  .gameHeader,
  .routePanel,
  .choiceArea,
  .memoryTray,
  .endingActions,
  .toast {
    display: none !important;
  }

  body,
  .screen,
  .storyPanel,
  .endingScreen {
    min-height: 0;
    color: #111;
    background: #fff;
  }

  .storyPanel,
  .endingLetter {
    width: 100%;
    padding: 0;
    color: #111;
    background: #fff;
    box-shadow: none;
  }
}
