:root {
  --ink: #f6f0ea;
  --ink-soft: #d1c4c2;
  --ink-faint: #8e7d82;
  --coal: #0a0709;
  --coal-2: #120a0e;
  --coal-3: #1a0d13;
  --paper: #f6eee8;
  --paper-deep: #c9b8b7;
  --line: rgba(246, 236, 232, 0.12);
  --line-strong: rgba(246, 236, 232, 0.28);
  --gold: #f1e5de;
  --gold-bright: #fffcfa;
  --red: #d31336;
  --red-deep: #6a0d24;
  --red-bright: #ff4b68;
  --jade: #9b777f;
  --jade-bright: #d3aeb5;
  --blue: #b79ca2;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
  --serif: "FangSong", "STFangsong", "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  --display: "STKaiti", "KaiTi", "FangSong", "Songti SC", serif;
  --inscription: "STSong", "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  background: var(--coal);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: #0a0709;
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
input,
summary {
  font: inherit;
}

button {
  color: inherit;
}

button,
[role="button"] {
  cursor: pointer;
}

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

::selection {
  color: #140f0a;
  background: var(--gold-bright);
}

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

.noscript-message {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 200;
  width: min(520px, calc(100vw - 32px));
  padding: 20px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: var(--coal-2);
  font-family: var(--sans);
  line-height: 1.8;
  text-align: center;
  transform: translate(-50%, -50%);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 70px minmax(0, 1fr) 190px;
  height: 100vh;
  padding: 0 22px 14px;
  isolation: isolate;
}

#ashCanvas,
.world-grain,
.vignette {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#ashCanvas {
  z-index: 8;
  opacity: 0.46;
}

.world-grain {
  z-index: 9;
  opacity: 0.18;
  mix-blend-mode: normal;
  background-image:
    repeating-radial-gradient(circle at 23% 19%, transparent 0 1px, rgba(255, 255, 255, 0.08) 1px 2px, transparent 2px 5px),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, 0.09) 3px 4px);
  background-size: 7px 7px, 4px 4px;
}

.vignette {
  z-index: 7;
  background:
    linear-gradient(90deg, rgba(8, 7, 6, 0.62), transparent 7%, transparent 93%, rgba(8, 7, 6, 0.62)),
    linear-gradient(0deg, rgba(8, 7, 6, 0.72), transparent 12%, transparent 91%, rgba(8, 7, 6, 0.5)),
    radial-gradient(ellipse at center, transparent 46%, rgba(4, 3, 3, 0.45) 100%);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto minmax(300px, 1fr);
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-decoration: none;
}

.brand-seal {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(196, 70, 47, 0.65);
  color: #e2b398;
  background:
    linear-gradient(135deg, rgba(146, 36, 24, 0.55), rgba(92, 23, 18, 0.14)),
    #1a1512;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 2px;
  line-height: 1;
  writing-mode: vertical-rl;
  box-shadow: inset 0 0 0 3px #17130f;
  transform: rotate(-2deg);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-copy strong {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.brand-copy small {
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.era-readout {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: baseline;
  min-width: 166px;
  text-align: center;
}

.era-kicker {
  grid-column: 1 / -1;
  margin-bottom: 1px;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.24em;
}

.era-readout strong {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.05em;
}

.era-phase {
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
}

.tool-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: rgba(27, 24, 20, 0.72);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.04em;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.tool-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(42, 37, 30, 0.9);
}

.archive-trigger {
  color: #e1b29e;
  border-color: rgba(169, 59, 43, 0.42);
}

.counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 18px;
  padding: 0 5px;
  color: #e7b39f;
  background: rgba(142, 44, 33, 0.18);
  font-variant-numeric: tabular-nums;
}

.sound-bars {
  display: inline-flex;
  align-items: end;
  gap: 2px;
  width: 13px;
  height: 12px;
}

.sound-bars i {
  display: block;
  width: 2px;
  background: currentColor;
  transform-origin: bottom;
}

.sound-bars i:nth-child(1) {
  height: 5px;
}

.sound-bars i:nth-child(2) {
  height: 10px;
}

.sound-bars i:nth-child(3) {
  height: 7px;
}

.is-playing .sound-bars i,
.bgm-playing .sound-bars i {
  animation: soundBar 900ms ease-in-out infinite alternate;
}

.sound-bars i:nth-child(2) {
  animation-delay: -300ms;
}

.sound-bars i:nth-child(3) {
  animation-delay: -600ms;
}

.experience {
  display: grid;
  grid-template-columns: minmax(0, 1.67fr) minmax(370px, 0.83fr);
  gap: 14px;
  min-height: 0;
  padding: 12px 0 10px;
}

.map-panel,
.chronicle,
.time-deck {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(220, 201, 164, 0.025), transparent 36%),
    rgba(23, 21, 18, 0.9);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.19);
}

.map-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  padding: 14px;
}

.map-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  padding: 0 2px 11px;
}

.section-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.map-heading h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(18px, 1.45vw, 25px);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.map-heading p {
  margin: 0;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 10px;
  white-space: nowrap;
}

.map-frame {
  position: relative;
  min-height: 250px;
  overflow: hidden;
  border: 1px solid rgba(220, 201, 164, 0.12);
  background: #15130f;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.6);
}

#mapSvg {
  display: block;
  width: 100%;
  height: 100%;
}

.map-grid path {
  fill: none;
  stroke: rgba(220, 206, 176, 0.055);
  stroke-width: 1;
  stroke-dasharray: 2 7;
}

.province {
  fill: url(#landGradient);
  stroke: rgba(30, 27, 22, 0.9);
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
  transition: fill 800ms ease, opacity 600ms ease, filter 800ms ease;
}

.province:hover {
  fill: #80735b;
  filter: brightness(1.12);
}

.province.affected {
  fill: url(#scorchGradient);
  stroke: rgba(223, 121, 81, 0.25);
  filter: drop-shadow(0 0 4px rgba(151, 52, 33, 0.15));
}

.province.affected:hover {
  fill: #7c251c;
}

.province.occupied {
  animation: provinceChar 950ms ease both;
}

.province-overlay {
  fill: url(#scorchHatch);
  stroke: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 900ms ease;
}

.province-overlay.visible {
  opacity: 0.68;
}

.province-label {
  fill: rgba(229, 218, 194, 0.42);
  font-family: var(--serif);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  pointer-events: none;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(20, 18, 15, 0.62);
  stroke-width: 2px;
}

.major-river {
  fill: none;
  stroke: rgba(114, 146, 153, 0.55);
  stroke-width: 1.8;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(85, 132, 145, 0.24));
}

.major-river.yellow {
  stroke: rgba(175, 144, 87, 0.47);
}

.event-pin {
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

.event-pin.unlocked {
  opacity: 1;
  pointer-events: auto;
}

.event-pin .event-pulse {
  fill: url(#frontPulse);
  opacity: 0;
  transform-origin: center;
}

.event-pin .event-core {
  fill: #282118;
  stroke: rgba(215, 190, 132, 0.62);
  stroke-width: 1.1;
  transition: fill 240ms ease, stroke 240ms ease, r 240ms ease;
}

.event-pin .event-center {
  fill: rgba(222, 201, 152, 0.48);
  transition: fill 240ms ease;
}

.event-pin.unlocked .event-core {
  fill: #c3a363;
  stroke: #f1dca5;
}

.event-pin.unlocked .event-center {
  fill: #20170f;
}

.event-pin.unlocked .event-pulse {
  opacity: 0.24;
  animation: none;
}

.event-pin.active .event-core {
  r: 4.7;
  fill: #f2d99e;
  stroke: #fff0c8;
}

.event-pin:hover .event-core,
.event-pin:focus-visible .event-core {
  r: 4.3;
  fill: #e4c67f;
  stroke: #fff0ca;
}

.pin-label {
  fill: rgba(238, 222, 188, 0.76);
  font-family: var(--sans);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(19, 16, 13, 0.88);
  stroke-width: 2.5px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.event-pin:hover .pin-label,
.event-pin:focus-visible .pin-label,
.event-pin.active .pin-label {
  opacity: 1;
}

.memory-pin .pin-label {
  opacity: 0;
}

.memory-pin:hover .pin-label,
.memory-pin:focus-visible .pin-label {
  opacity: 1;
}

.memory-pin {
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}

.memory-pin.available {
  opacity: 1;
  pointer-events: auto;
}

.memory-pin .memory-ring {
  fill: url(#memoryPulse);
  opacity: 0.28;
  animation: none;
  transform-origin: center;
}

.memory-pin .memory-core {
  fill: #9f3428;
  stroke: #e28d6d;
  stroke-width: 1;
}

.memory-pin .memory-mark {
  fill: #f0ccac;
  font-family: var(--sans);
  font-size: 5.2px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.memory-pin:hover .memory-core,
.memory-pin:focus-visible .memory-core {
  fill: #d85c3f;
}

.memory-pin.read .memory-ring {
  opacity: 0.15;
  animation: none;
}

.memory-pin.read .memory-core {
  fill: #715b4c;
  stroke: #a68c73;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: var(--ink-soft);
  background: rgba(14, 12, 10, 0.8);
  transition: opacity 500ms ease, visibility 500ms ease;
}

.map-loading span {
  width: 70px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: loadingLine 1.2s ease-in-out infinite;
}

.map-loading p {
  margin: 0;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.2em;
}

.map-loading.hidden {
  opacity: 0;
  visibility: hidden;
}

.map-compass {
  position: absolute;
  top: 15px;
  right: 16px;
  z-index: 3;
  display: grid;
  justify-items: center;
  color: rgba(230, 216, 185, 0.58);
  font-family: var(--serif);
  font-size: 10px;
  pointer-events: none;
}

.map-compass i {
  position: relative;
  display: block;
  width: 1px;
  height: 38px;
  margin-top: 4px;
  background: rgba(229, 209, 166, 0.3);
}

.map-compass i::before {
  position: absolute;
  top: -1px;
  left: -4px;
  width: 0;
  height: 0;
  border-right: 4px solid transparent;
  border-bottom: 8px solid rgba(229, 209, 166, 0.58);
  border-left: 4px solid transparent;
  content: "";
}

.map-legend {
  position: absolute;
  bottom: 13px;
  left: 14px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 13px;
  max-width: calc(100% - 130px);
  padding: 8px 10px;
  color: rgba(237, 226, 205, 0.7);
  background: rgba(14, 12, 10, 0.74);
  border: 1px solid rgba(218, 196, 156, 0.11);
  font-family: var(--sans);
  font-size: 8.5px;
  line-height: 1.5;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.legend-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-swatch.territory {
  border-radius: 1px;
  background: repeating-linear-gradient(135deg, #7b291e 0 2px, #331412 2px 4px);
}

.legend-swatch.event {
  background: var(--gold-bright);
}

.legend-swatch.memory {
  background: var(--red-bright);
  box-shadow: 0 0 7px rgba(224, 117, 81, 0.8);
}

.legend-swatch.river {
  width: 12px;
  height: 2px;
  border-radius: 0;
  background: rgba(121, 162, 171, 0.8);
}

.map-stamp {
  position: absolute;
  right: 17px;
  bottom: 14px;
  z-index: 3;
  display: grid;
  width: 91px;
  height: 91px;
  place-content: center;
  color: #dfb89b;
  border: 1px solid rgba(182, 64, 44, 0.72);
  background: rgba(87, 24, 19, 0.26);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: rotate(-5deg) scale(0.85);
  transition: opacity 250ms ease, transform 320ms cubic-bezier(.2, .8, .2, 1);
  box-shadow: inset 0 0 0 3px rgba(20, 15, 12, 0.7);
}

.map-stamp.show {
  opacity: 1;
  transform: rotate(-5deg) scale(1);
}

.map-stamp span,
.map-stamp small {
  font-family: var(--sans);
  font-size: 7px;
  letter-spacing: 0.14em;
}

.map-stamp strong {
  margin: 4px 0 2px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.map-tooltip {
  position: absolute;
  z-index: 3;
  max-width: 220px;
  padding: 8px 10px;
  color: var(--ink);
  border: 1px solid rgba(228, 205, 158, 0.27);
  background: rgba(17, 14, 11, 0.94);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1.55;
  pointer-events: none;
  transform: translate(12px, -50%);
}

.map-tooltip strong {
  display: block;
  margin-bottom: 2px;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 500;
}

.shock-flash {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 60% 54%, rgba(173, 44, 29, 0.48), transparent 38%),
    rgba(91, 18, 12, 0.18);
}

.map-panel.trauma .shock-flash {
  animation: traumaFlash 1.6s ease-out;
}

.map-footnote {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 8.5px;
}

.map-footnote p {
  margin: 0;
}

.text-link {
  padding: 0;
  border: 0;
  color: var(--gold);
  background: none;
  font-family: var(--sans);
  font-size: 8.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chronicle {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  padding: 17px 18px 15px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(204, 180, 137, 0.045), transparent 18%),
    repeating-linear-gradient(90deg, transparent 0 30px, rgba(219, 198, 161, 0.014) 30px 31px),
    #191713;
}

.chronicle::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
}

.chronicle-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.event-category {
  padding: 4px 7px;
  color: #d3b474;
  border: 1px solid rgba(195, 163, 99, 0.35);
  background: rgba(195, 163, 99, 0.07);
  font-family: var(--sans);
  font-size: 8.5px;
  letter-spacing: 0.12em;
}

.event-index {
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
}

.event-copy {
  min-height: 0;
  padding: 15px 2px 12px;
  overflow-y: auto;
  scrollbar-color: rgba(195, 163, 99, 0.35) transparent;
  scrollbar-width: thin;
}

.event-copy::-webkit-scrollbar {
  width: 4px;
}

.event-copy::-webkit-scrollbar-thumb {
  background: rgba(195, 163, 99, 0.3);
}

.event-date {
  margin: 0 0 5px;
  color: #cfb176;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.event-copy h2 {
  margin: 0;
  color: #eee3cb;
  font-family: var(--display);
  font-size: clamp(25px, 2.2vw, 37px);
  font-weight: 500;
  line-height: 1.17;
  letter-spacing: 0.08em;
  text-wrap: balance;
}

.event-subtitle {
  margin: 6px 0 14px;
  color: var(--ink-faint);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.narration-wrap {
  position: relative;
  margin: 12px 0 14px;
  padding: 12px 13px 12px 17px;
  border-left: 2px solid rgba(169, 59, 43, 0.68);
  background: linear-gradient(90deg, rgba(112, 39, 29, 0.12), transparent);
}

.narration-label {
  display: block;
  margin-bottom: 6px;
  color: #bf8e77;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.event-narration {
  margin: 0;
  color: #d7cbb5;
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: 0.03em;
  text-align: justify;
}

.double-line {
  display: grid;
  gap: 8px;
}

.lens-card {
  position: relative;
  padding: 11px 12px;
  border: 1px solid rgba(220, 201, 164, 0.12);
  background: rgba(221, 204, 166, 0.025);
}

.lens-card.front {
  border-left-color: rgba(195, 163, 99, 0.48);
}

.lens-card.behind {
  border-left-color: rgba(105, 139, 120, 0.62);
}

.lens-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

.lens-symbol {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  color: #d3b474;
  border: 1px solid rgba(195, 163, 99, 0.32);
  font-family: var(--display);
  font-size: 10px;
  line-height: 1;
}

.behind .lens-symbol {
  color: #a5bea8;
  border-color: rgba(105, 139, 120, 0.38);
}

.lens-title h3 {
  margin: 0;
  color: #cdbb97;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.lens-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.76;
  text-align: justify;
}

.evidence-note {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.evidence-note summary {
  padding: 10px 0 0;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.08em;
  list-style: none;
}

.evidence-note summary::-webkit-details-marker {
  display: none;
}

.evidence-note summary::before {
  display: inline-block;
  margin-right: 6px;
  content: "＋";
  transition: transform 180ms ease;
}

.evidence-note[open] summary::before {
  content: "－";
}

.evidence-note p {
  margin: 8px 0 0;
  color: var(--ink-faint);
  font-size: 10.5px;
  line-height: 1.7;
}

.chronicle-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.primary-action,
.secondary-action,
.icon-action,
.play-action,
.enter-button {
  border: 1px solid var(--line-strong);
  background: transparent;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.primary-action,
.secondary-action {
  min-height: 38px;
  padding: 0 14px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.primary-action {
  color: #201710;
  border-color: #d1bc8b;
  background: linear-gradient(135deg, #e4cd9c, #b69559);
}

.primary-action:hover {
  background: linear-gradient(135deg, #f3dfb1, #c5a76c);
  transform: translateY(-1px);
}

.secondary-action {
  color: var(--ink-soft);
}

.secondary-action:hover {
  color: var(--ink);
  border-color: var(--gold);
  background: rgba(195, 163, 99, 0.08);
}

.time-deck {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-rows: 56px minmax(60px, 1fr) auto;
  gap: 5px;
  padding: 10px 16px 8px;
  overflow: hidden;
}

.time-deck-head {
  display: grid;
  grid-template-columns: 155px 1fr 235px;
  align-items: center;
  gap: 15px;
}

.year-lockup {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.year-prefix,
.year-suffix {
  color: var(--ink-faint);
  font-size: 10px;
}

.year-lockup strong {
  color: #ead7ad;
  font-family: var(--display);
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.chapter-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.chapter-nav button {
  position: relative;
  min-width: 0;
  padding: 6px 7px;
  border: 0;
  color: var(--ink-faint);
  background: transparent;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.chapter-nav button::after {
  position: absolute;
  right: 7px;
  bottom: 1px;
  left: 7px;
  height: 1px;
  background: transparent;
  content: "";
}

.chapter-nav button:hover,
.chapter-nav button.active {
  color: var(--gold-bright);
}

.chapter-nav button.active::after {
  background: var(--gold);
}

.playback-controls {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.icon-action {
  width: 34px;
  height: 34px;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 17px;
}

.icon-action:hover {
  color: var(--ink);
  border-color: var(--gold);
  background: rgba(195, 163, 99, 0.08);
}

.play-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 124px;
  height: 34px;
  padding: 0 14px;
  color: #1a140f;
  border-color: #c9af78;
  background: #c3a363;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.play-action:hover {
  background: #ddc285;
}

.play-action[aria-pressed="true"] {
  color: #e9dfc7;
  border-color: rgba(195, 163, 99, 0.45);
  background: rgba(195, 163, 99, 0.08);
}

.play-icon {
  font-size: 8px;
}

.timeline-wrap {
  position: relative;
  min-height: 62px;
  margin: 0 11px;
  padding: 18px 11px 0;
}

.timeline-wrap:focus-within {
  outline: 1px solid rgba(231, 202, 135, 0.45);
  outline-offset: 3px;
}

.timeline-track {
  position: relative;
  height: 25px;
  border-top: 1px solid rgba(209, 189, 151, 0.24);
}

.timeline-track::before {
  position: absolute;
  top: -2px;
  right: 0;
  left: 0;
  height: 3px;
  background: rgba(219, 198, 161, 0.06);
  content: "";
}

.timeline-fill {
  position: absolute;
  top: -2px;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #6d7d68, #b69657 62%, #b94c34);
  box-shadow: 0 0 13px rgba(190, 133, 70, 0.25);
}

.timeline-head {
  position: absolute;
  top: -12px;
  left: 0;
  z-index: 2;
  width: 18px;
  height: 23px;
  transform: translateX(-50%);
  pointer-events: none;
}

.timeline-head::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 37px;
  background: linear-gradient(180deg, #f0d79d, rgba(217, 185, 126, 0));
  content: "";
}

.timeline-head span {
  position: absolute;
  top: 0;
  left: 50%;
  display: block;
  width: 12px;
  height: 12px;
  border: 2px solid #e9d39b;
  background: #33261b;
  transform: translateX(-50%) rotate(45deg);
  box-shadow: 0 0 12px rgba(233, 211, 155, 0.4);
}

.timeline-ticks {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 41px;
}

.timeline-tick {
  position: absolute;
  top: 0;
  display: grid;
  width: 1px;
  height: 100%;
  justify-items: center;
  color: var(--ink-faint);
  transform: translateX(-50%);
  pointer-events: none;
}

.timeline-tick i {
  width: 1px;
  height: 7px;
  background: rgba(214, 195, 157, 0.28);
}

.timeline-tick.major i {
  height: 11px;
  background: rgba(214, 195, 157, 0.42);
}

.timeline-tick span {
  margin-top: 12px;
  font-family: var(--sans);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.timeline-events {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.timeline-event {
  position: absolute;
  top: 8px;
  z-index: 1;
  width: 11px;
  height: 11px;
  padding: 0;
  border: 1px solid rgba(228, 205, 155, 0.5);
  border-radius: 50%;
  background: #1e1b16;
  transform: translateX(-50%);
  pointer-events: auto;
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.timeline-event::before {
  position: absolute;
  bottom: 11px;
  left: 50%;
  width: 1px;
  height: 7px;
  background: rgba(227, 205, 160, 0.3);
  content: "";
}

.timeline-event.unlocked {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(195, 163, 99, 0.1), 0 0 8px rgba(195, 163, 99, 0.22);
}

.timeline-event.active {
  background: #f0dba7;
  box-shadow: 0 0 0 4px rgba(231, 202, 135, 0.16), 0 0 13px rgba(231, 202, 135, 0.45);
  transform: translateX(-50%) scale(1.18);
}

.timeline-event.memory {
  border-color: rgba(224, 117, 81, 0.7);
  background: #5c211b;
  opacity: 0.18;
  pointer-events: none;
}

.timeline-event.memory.unlocked {
  background: #a63c2c;
  box-shadow: 0 0 8px rgba(185, 61, 42, 0.36);
  opacity: 1;
  pointer-events: auto;
}

.timeline-event:hover {
  transform: translateX(-50%) translateY(-2px) scale(1.2);
}

.timeline-range {
  position: absolute;
  right: 11px;
  bottom: 5px;
  left: 11px;
  z-index: 4;
  width: calc(100% - 22px);
  height: 40px;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

.timeline-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 6px 2px 0;
  border-top: 1px solid rgba(220, 201, 164, 0.08);
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 8.5px;
}

.timeline-bottom p {
  margin: 0;
}

.drag-glyph {
  color: var(--gold);
}

.progress-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
  justify-content: flex-end;
}

.progress-summary strong {
  color: var(--ink-soft);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.progress {
  position: relative;
  width: 86px;
  height: 2px;
  overflow: hidden;
  background: rgba(225, 205, 167, 0.12);
}

.progress i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--gold);
  transition: width 350ms ease;
}

.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(30px, 0.42fr) minmax(680px, 1.45fr) minmax(30px, 0.18fr);
  align-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(10, 9, 8, 0.84), rgba(10, 9, 8, 0.2) 40%, rgba(10, 9, 8, 0.86)),
    radial-gradient(ellipse at 58% 42%, rgba(158, 76, 36, 0.2), transparent 37%),
    radial-gradient(ellipse at 35% 74%, rgba(99, 110, 90, 0.16), transparent 39%),
    #11100e;
  transition: opacity 800ms ease, visibility 800ms ease;
}

.intro-screen::before {
  position: absolute;
  top: 8%;
  right: 9%;
  width: min(62vw, 900px);
  aspect-ratio: 1.4;
  border: 1px solid rgba(207, 179, 115, 0.08);
  border-radius: 50%;
  content: "";
  transform: rotate(-8deg);
  box-shadow:
    0 0 0 50px rgba(207, 179, 115, 0.012),
    0 0 0 110px rgba(207, 179, 115, 0.008),
    0 0 0 190px rgba(207, 179, 115, 0.005);
}

.intro-screen::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 64%;
  height: 76%;
  background:
    linear-gradient(155deg, transparent 44%, rgba(116, 109, 91, 0.11) 44.5%, transparent 45.2%),
    linear-gradient(25deg, transparent 58%, rgba(218, 198, 160, 0.06) 58.3%, transparent 59%);
  clip-path: polygon(20% 20%, 100% 0, 100% 100%, 0 100%);
  content: "";
  pointer-events: none;
}

.intro-screen.leaving {
  opacity: 0;
  visibility: hidden;
}

.intro-map-grain {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(104deg, transparent 0 92px, rgba(225, 205, 167, 0.025) 92px 93px),
    repeating-linear-gradient(14deg, transparent 0 128px, rgba(225, 205, 167, 0.018) 128px 129px);
  mix-blend-mode: screen;
}

.intro-map-watermark {
  position: absolute;
  top: 50%;
  right: 1.5%;
  width: min(58vw, 880px);
  height: 78vh;
  opacity: 0.58;
  transform: translateY(-50%);
  pointer-events: none;
}

.intro-province {
  fill: rgba(180, 167, 139, 0.035);
  stroke: rgba(207, 189, 152, 0.17);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.intro-map-watermark {
  animation: introMapBreathe 9s ease-in-out infinite alternate;
}

.intro-content {
  position: relative;
  z-index: 2;
  grid-column: 2;
  align-self: center;
  max-width: 790px;
  padding: 6vh 3vw;
}

.intro-eyebrow {
  margin: 0 0 23px;
  color: #bba679;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.27em;
}

.intro-content h1 {
  display: flex;
  gap: clamp(8px, 1vw, 18px);
  margin: 0 0 18px;
  color: #e6ddca;
  font-family: var(--display);
  font-size: clamp(74px, 10.2vw, 154px);
  font-weight: 500;
  line-height: 0.88;
  letter-spacing: 0.04em;
  text-shadow: 0 18px 60px rgba(0, 0, 0, 0.52);
}

.intro-content h1 span:nth-child(2) {
  color: #c3a363;
  transform: translateY(0.17em);
}

.intro-subtitle {
  margin: 0 0 22px;
  color: #d6c9b0;
  font-family: var(--serif);
  font-size: clamp(18px, 1.8vw, 27px);
  line-height: 1.55;
  letter-spacing: 0.14em;
}

.intro-lead {
  max-width: 580px;
  margin: 0 0 20px;
  color: #a9a090;
  font-size: 14px;
  line-height: 1.9;
  letter-spacing: 0.035em;
}

.intro-warning {
  display: flex;
  gap: 10px;
  max-width: 590px;
  margin-bottom: 26px;
  padding: 10px 12px;
  border: 1px solid rgba(169, 59, 43, 0.25);
  background: rgba(98, 29, 22, 0.08);
}

.intro-warning span {
  color: #b86d55;
}

.intro-warning p {
  margin: 0;
  color: #918879;
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1.75;
}

.intro-actions {
  display: flex;
  align-items: stretch;
  gap: 11px;
}

.enter-button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 210px;
  min-height: 64px;
  padding: 0 25px;
  color: #1a140f;
  border-color: #d6c08f;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 40%),
    #c4a464;
  text-align: left;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.28);
}

.enter-button:hover {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 40%),
    #dec589;
  transform: translateY(-2px);
}

.enter-button span {
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: 0.1em;
}

.enter-button small {
  margin-top: 3px;
  color: rgba(26, 20, 15, 0.64);
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.11em;
}

.intro-help {
  padding: 0 20px;
  border: 1px solid rgba(215, 195, 156, 0.22);
  color: #aa9f8c;
  background: rgba(22, 20, 17, 0.38);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.intro-help:hover {
  color: #e1d4bb;
  border-color: rgba(215, 195, 156, 0.48);
}

.intro-footnote {
  margin: 17px 0 0;
  color: #625d54;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.intro-seal {
  position: absolute;
  top: 8%;
  left: 7%;
  display: grid;
  width: 52px;
  height: 154px;
  place-content: center;
  color: #d4a181;
  border: 1px solid rgba(173, 62, 42, 0.47);
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: 0.20em;
  opacity: 0.7;
  transform: rotate(-3deg);
  box-shadow: inset 0 0 0 4px #11100e, inset 0 0 0 5px rgba(173, 62, 42, 0.34);
}

.intro-vertical {
  position: absolute;
  right: 4.3%;
  bottom: 7%;
  color: rgba(212, 195, 157, 0.42);
  font-family: var(--display);
  font-size: clamp(12px, 1vw, 16px);
  letter-spacing: 0.6em;
  writing-mode: vertical-rl;
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 4, 3, 0.88);
  opacity: 0;
  transition: opacity 260ms ease;
  backdrop-filter: none;
}

.drawer-scrim.visible {
  opacity: 1;
}

.archive-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  width: min(610px, 100vw);
  padding: 28px 28px 20px;
  overflow: hidden;
  border-left: 1px solid rgba(209, 173, 105, 0.24);
  background:
    repeating-linear-gradient(90deg, transparent 0 38px, rgba(217, 195, 154, 0.015) 38px 39px),
    linear-gradient(135deg, rgba(110, 36, 28, 0.1), transparent 35%),
    #171410;
  box-shadow: -30px 0 90px rgba(0, 0, 0, 0.48);
  transform: translateX(102%);
  transition: transform 380ms cubic-bezier(.22, .8, .2, 1);
}

.archive-drawer.visible {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  color: #eee1c5;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.close-button {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid var(--line);
  color: var(--ink-faint);
  background: rgba(20, 17, 14, 0.56);
  font-family: var(--sans);
  font-size: 22px;
  line-height: 1;
}

.close-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.drawer-intro {
  margin: 13px 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.78;
}

.archive-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 10px;
  color: var(--ink-faint);
  border-top: 1px solid rgba(220, 201, 164, 0.08);
  border-bottom: 1px solid rgba(220, 201, 164, 0.08);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.archive-progress-row strong {
  color: #d89c7d;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.archive-list {
  padding: 12px 3px 20px 0;
  overflow-y: auto;
  scrollbar-color: rgba(169, 59, 43, 0.38) transparent;
  scrollbar-width: thin;
}

.archive-entry {
  position: relative;
  margin-bottom: 10px;
  border: 1px solid rgba(220, 201, 164, 0.12);
  background: rgba(223, 205, 166, 0.024);
  transition: border-color 180ms ease, background 180ms ease;
}

.archive-entry[open] {
  border-color: rgba(169, 59, 43, 0.36);
  background: rgba(101, 30, 25, 0.07);
}

.archive-entry summary {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px 14px;
  list-style: none;
}

.archive-entry summary::-webkit-details-marker {
  display: none;
}

.archive-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #d9a087;
  border: 1px solid rgba(179, 68, 48, 0.35);
  font-family: var(--sans);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  transform: rotate(-2deg);
}

.archive-summary-copy h3 {
  margin: 0 0 4px;
  color: #d9cbb1;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.archive-summary-copy p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.55;
}

.archive-state {
  color: #9b7d68;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.09em;
}

.archive-entry.read .archive-state {
  color: #bb9e68;
}

.archive-body {
  padding: 0 15px 15px 75px;
}

.archive-body p {
  margin: 0 0 9px;
  color: #b9ae9b;
  font-size: 11.5px;
  line-height: 1.85;
  text-align: justify;
}

.archive-body strong {
  color: #e0b497;
  font-weight: 500;
}

.archive-source {
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed rgba(220, 201, 164, 0.12);
  color: var(--ink-faint) !important;
  font-family: var(--sans);
  font-size: 9px !important;
  line-height: 1.65 !important;
  text-align: left !important;
}

.drawer-source {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.drawer-source p {
  margin: 0;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 8.5px;
  line-height: 1.65;
}

.modal-screen {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(7, 6, 5, 0.94);
  backdrop-filter: none;
}

.modal-card {
  position: relative;
  width: min(940px, 100%);
  max-height: min(810px, calc(100vh - 56px));
  padding: 28px 30px;
  overflow-y: auto;
  border: 1px solid rgba(218, 194, 151, 0.22);
  background:
    repeating-linear-gradient(90deg, transparent 0 42px, rgba(219, 198, 161, 0.014) 42px 43px),
    linear-gradient(135deg, rgba(177, 133, 70, 0.06), transparent 33%),
    #181612;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin: 0 0 20px;
  color: #ede1c8;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.modal-close {
  position: absolute;
  top: 19px;
  right: 19px;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.help-grid section {
  min-width: 0;
  padding: 15px 13px;
  border: 1px solid rgba(218, 197, 160, 0.12);
  background: rgba(223, 205, 166, 0.024);
}

.help-number {
  color: #8f7755;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.help-grid h3,
.principle-box h3,
.method-columns h3,
.source-list h3 {
  margin: 9px 0 7px;
  color: #d3bd93;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.help-grid p,
.principle-box p,
.method-columns p,
.source-list p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.8;
  text-align: justify;
}

.keyboard-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 14px 0;
  padding: 10px 12px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 9px;
}

kbd {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  margin-right: 4px;
  padding: 0 5px;
  place-items: center;
  border: 1px solid rgba(217, 197, 158, 0.22);
  border-radius: 2px;
  color: #c9bc9e;
  background: rgba(220, 203, 170, 0.05);
  font-family: var(--sans);
  font-size: 8px;
}

.principle-box {
  padding: 15px 17px;
  border-left: 2px solid rgba(169, 59, 43, 0.62);
  background: rgba(97, 30, 23, 0.08);
}

.principle-box h3 {
  margin-top: 0;
}

.principle-box p + p {
  margin-top: 8px;
}

.method-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.method-columns > div {
  padding: 14px;
  border: 1px solid rgba(218, 197, 160, 0.12);
}

.source-list {
  margin-top: 13px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.source-list p {
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 9.5px;
}

.ending-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 31%, rgba(206, 169, 94, 0.22), transparent 34%),
    linear-gradient(180deg, #1a1712, #0c0b09 78%);
}

.ending-rays {
  position: absolute;
  top: -34vw;
  left: 50%;
  width: 92vw;
  height: 92vw;
  border-radius: 50%;
  background: repeating-conic-gradient(from 260deg, rgba(214, 181, 111, 0.045) 0 5deg, transparent 5deg 14deg);
  transform: translateX(-50%);
  mask-image: radial-gradient(circle, black 0, transparent 68%);
}

.ending-screen::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 20vh;
  background: linear-gradient(0deg, rgba(23, 19, 14, 0.9), transparent);
  content: "";
}

.ending-content {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(780px, calc(100vw - 42px));
  max-height: calc(100vh - 26px);
  text-align: center;
}

.ending-overture {
  align-self: end;
}

.ending-eyebrow {
  margin: 0 0 15px;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.28em;
}

.ending-content h2 {
  margin: 0;
  color: #efe5d0;
  font-family: var(--display);
  font-size: clamp(42px, 6vw, 78px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.08em;
  text-shadow: 0 10px 45px rgba(0, 0, 0, 0.5);
}

.ending-rule {
  width: 72px;
  height: 1px;
  margin: 23px auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.ending-lead {
  margin: 0 0 16px;
  color: #bcb19c;
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: 0.07em;
}

.witness-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  width: fit-content;
  margin: 0 auto 14px;
  padding: 12px 17px;
  border: 1px solid rgba(207, 181, 126, 0.2);
  background: rgba(18, 15, 12, 0.52);
  text-align: left;
}

.witness-seal {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #d6a589;
  border: 1px solid rgba(169, 59, 43, 0.54);
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.06em;
  transform: rotate(-3deg);
}

.witness-card p {
  margin: 0 0 4px;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 9px;
}

.witness-card strong {
  color: #cbbd9f;
  font-size: 12px;
  font-weight: 400;
}

.ending-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
}

.ending-actions button {
  min-width: 150px;
}

.ending-note {
  margin: 13px 0 0;
  color: rgba(208, 195, 170, 0.3);
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.monument-scroll {
  position: relative;
  width: min(680px, 100%);
  margin: 8px auto 0;
  padding: 8px 0 7px;
  border-top: 1px solid rgba(203, 180, 139, 0.18);
  border-bottom: 1px solid rgba(203, 180, 139, 0.18);
}

.monument-scroll figcaption {
  margin-bottom: 3px;
  color: #bca77e;
  font-family: var(--inscription);
  font-size: 10px;
  letter-spacing: 0.22em;
}

.monument-window {
  position: relative;
  height: clamp(104px, 17vh, 154px);
  overflow: hidden;
  mask-image: linear-gradient(180deg, transparent, #000 14%, #000 82%, transparent);
}

.monument-track {
  display: grid;
  gap: 22px;
  padding: 0 14px;
  color: #ded1b6;
  font-family: var(--inscription);
  font-size: clamp(15px, 1.45vw, 19px);
  line-height: 2;
  letter-spacing: 0.07em;
  text-align: left;
  transform: translateY(110%);
  animation: monumentRoll 14s linear 1.2s forwards;
}

.monument-track p {
  margin: 0;
}

.monument-source {
  margin: 4px 0 0;
  color: rgba(189, 173, 143, 0.42);
  font-family: var(--sans);
  font-size: 7.5px;
  letter-spacing: 0.12em;
}

.ending-finale {
  display: grid;
  justify-items: center;
  min-height: 156px;
  padding-top: 7px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.1s ease, transform 1.1s ease, visibility 0s linear 1.1s;
}

.ending-screen.is-revealed .ending-finale {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 1.1s ease, transform 1.1s ease, visibility 0s;
}

.ending-final-kicker {
  margin: 0 0 2px;
  color: #bdb093;
  font-family: var(--inscription);
  font-size: 10px;
  letter-spacing: 0.32em;
}

.ending-final-title {
  color: #f1e2c5;
  font-family: var(--display);
  font-size: clamp(55px, 8vw, 104px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.17em;
  text-indent: 0.17em;
  text-shadow: 0 12px 42px rgba(0, 0, 0, 0.58);
}

.toast {
  position: fixed;
  bottom: 216px;
  left: 50%;
  z-index: 140;
  max-width: min(440px, calc(100vw - 32px));
  padding: 9px 14px;
  color: #dfd2b8;
  border: 1px solid rgba(216, 193, 145, 0.24);
  background: rgba(17, 14, 11, 0.95);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1.55;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 200ms ease, transform 200ms ease;
}

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

[hidden] {
  display: none !important;
}

body.trauma .map-frame {
  animation: traumaShake 520ms cubic-bezier(.36, .07, .19, .97);
}

body.trauma .vignette {
  background:
    radial-gradient(ellipse at 55% 50%, transparent 36%, rgba(78, 14, 11, 0.26) 100%),
    linear-gradient(0deg, rgba(8, 7, 6, 0.73), transparent 12%, transparent 91%, rgba(8, 7, 6, 0.52));
}

/* Restrained pure-colour system: black, ivory, cinnabar and crimson. */
.app-shell {
  grid-template-rows: 62px minmax(0, 1fr) 170px;
  padding: 0 18px 12px;
}

.topbar {
  grid-template-columns: minmax(220px, 1fr) auto minmax(260px, 1fr);
  gap: 16px;
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

.brand {
  gap: 10px;
}

.brand-seal {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-left: 3px solid var(--red);
  color: var(--ink);
  background: var(--red-deep);
  box-shadow: none;
  transform: none;
}

.brand-copy strong {
  font-size: 21px;
  letter-spacing: 0.14em;
}

.brand-copy small {
  color: var(--ink-faint);
  font-size: 8px;
  letter-spacing: 0.11em;
}

.era-readout {
  min-width: 132px;
}

.era-kicker {
  color: var(--red-bright);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.era-readout strong {
  color: var(--ink);
  font-size: 26px;
}

.era-phase {
  color: var(--ink-soft);
  font-size: 9px;
}

.top-actions {
  gap: 5px;
}

.tool-button {
  min-height: 31px;
  border-color: rgba(255, 255, 255, 0.12);
  background: #130b0f;
  font-size: 9px;
}

.tool-button:hover {
  border-color: rgba(255, 75, 104, 0.54);
  background: #1d0c13;
}

.archive-trigger {
  border-color: rgba(211, 19, 54, 0.52);
  color: var(--ink);
  background: var(--red-deep);
}

.counter {
  color: #fff;
  background: rgba(0, 0, 0, 0.26);
}

.experience {
  grid-template-columns: minmax(0, 1.82fr) minmax(350px, 0.82fr);
  gap: 10px;
  padding: 10px 0 8px;
}

.map-panel,
.chronicle,
.time-deck {
  border-color: rgba(255, 255, 255, 0.1);
  background: #130b0f;
  box-shadow: none;
}

.map-panel {
  padding: 12px;
}

.map-heading {
  align-items: center;
  padding: 0 2px 9px;
}

.map-heading h1 {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.map-heading p {
  color: var(--ink-soft);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.map-frame {
  border-color: rgba(211, 19, 54, 0.22);
  background: #09070a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  contain: paint;
  isolation: isolate;
  touch-action: none;
}

#mapSvg {
  transform: translateZ(0);
}

#mapWorld {
  will-change: transform;
}

.map-grid path {
  stroke: rgba(255, 237, 233, 0.045);
}

.province {
  fill: #35141f;
  stroke: #09070a;
  stroke-width: 1;
  transition:
    fill 380ms cubic-bezier(.22, .72, .18, 1),
    opacity 300ms ease,
    stroke 300ms ease;
  will-change: fill;
}

.province.tone-1 {
  fill: #2f121a;
}

.province.tone-2 {
  fill: #3a1622;
}

.province:hover {
  fill: #4e1a2a;
  filter: none;
}

.province.affected {
  fill: #a50f2b;
  stroke: rgba(255, 236, 231, 0.12);
  filter: none;
}

.province.affected:hover {
  fill: #bf1736;
}

.province-overlay {
  fill: url(#scorchHatch);
  opacity: 0;
  transition: opacity 420ms ease;
}

.province-overlay.visible {
  opacity: 0.55;
}

.province-label {
  fill: rgba(248, 238, 234, 0.45);
  stroke: rgba(9, 7, 10, 0.76);
  font-size: 8px;
}

.terrain-pattern {
  opacity: 0.72;
}

.terrain-ridge {
  fill: none;
  stroke: rgba(255, 239, 234, 0.24);
  stroke-width: 0.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.terrain-ridge.accent {
  stroke: rgba(255, 103, 125, 0.34);
}

.terrain-peak {
  fill: none;
  stroke: rgba(255, 236, 231, 0.3);
  stroke-width: 0.75;
}

.major-river {
  stroke: rgba(240, 221, 218, 0.43);
  stroke-width: 1.35;
  fill: none;
  filter: none;
}

.major-river.yellow {
  stroke: rgba(255, 228, 217, 0.35);
}

.minor-river {
  fill: none;
  stroke: rgba(223, 206, 208, 0.19);
  stroke-width: 0.85;
}

.lake-shape {
  fill: rgba(225, 214, 217, 0.24);
  stroke: rgba(255, 245, 242, 0.38);
  stroke-width: 0.65;
}

.map-water-label {
  fill: rgba(245, 235, 232, 0.38);
  font-family: var(--sans);
  font-size: 7px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.railway {
  fill: none;
  stroke: rgba(255, 239, 234, 0.2);
  stroke-width: 0.85;
  stroke-dasharray: 5 5;
}

.railway-label {
  fill: rgba(255, 240, 235, 0.35);
  font-family: var(--sans);
  font-size: 6.5px;
  letter-spacing: 0.08em;
  paint-order: stroke;
  stroke: rgba(9, 7, 10, 0.82);
  stroke-width: 2px;
  pointer-events: none;
}

.city-dot {
  fill: #f6e9e5;
  stroke: #5d0f21;
  stroke-width: 1.2;
}

.city-label {
  fill: rgba(255, 243, 238, 0.62);
  font-family: var(--sans);
  font-size: 7px;
  letter-spacing: 0.05em;
  paint-order: stroke;
  stroke: rgba(9, 7, 10, 0.9);
  stroke-width: 2px;
  pointer-events: none;
}

.event-pin .event-core {
  fill: #241018;
  stroke: rgba(255, 244, 239, 0.7);
}

.event-pin.unlocked .event-core {
  fill: #f6e9e3;
  stroke: #ff667b;
}

.event-pin.unlocked .event-center {
  fill: #9e0a28;
}

.event-pin.active .event-core {
  fill: #ff3558;
  stroke: #fff8f4;
}

.pin-label {
  fill: rgba(255, 245, 241, 0.88);
  font-size: 8px;
}

.memory-pin .memory-core {
  fill: #a70d2d;
  stroke: #ff9baa;
}

.memory-pin .memory-mark {
  fill: #fff6f1;
}

.battle-pin {
  cursor: pointer;
  animation: battleReveal 320ms ease both;
}

.battle-pin .battle-hit {
  fill: transparent;
  pointer-events: all;
}

.battle-pin .battle-shape {
  transition: transform 180ms ease, opacity 180ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.battle-pin:hover .battle-shape,
.battle-pin:focus-visible .battle-shape {
  transform: scale(1.35);
}

.battle-pin .battle-mark {
  fill: #fff8f3;
  font-family: var(--sans);
  font-size: 5.5px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.battle-pin .battle-label {
  fill: rgba(255, 243, 238, 0.8);
  font-family: var(--sans);
  font-size: 7.5px;
  opacity: 0;
  paint-order: stroke;
  stroke: rgba(8, 6, 8, 0.9);
  stroke-width: 2px;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.battle-pin:hover .battle-label,
.battle-pin:focus-visible .battle-label,
.battle-pin.active .battle-label {
  opacity: 1;
}

.map-fx-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-compass {
  color: rgba(255, 243, 238, 0.55);
}

.map-compass i {
  background: rgba(255, 238, 232, 0.25);
}

.map-legend {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(10, 7, 9, 0.86);
  color: rgba(255, 244, 239, 0.7);
}

.legend-swatch.territory {
  background: #c61335;
}

.legend-swatch.event {
  background: #f6e9e3;
}

.legend-swatch.memory {
  background: #ff4b68;
}

.legend-swatch.battle {
  border: 1px solid #ff9cab;
  background: #5e0c22;
  box-shadow: none;
}

.legend-swatch.base {
  border: 1px solid rgba(229, 207, 160, 0.62);
  border-radius: 1px;
  background: repeating-linear-gradient(35deg, #5d5b3c 0 2px, #242217 2px 4px);
}

.map-stamp {
  border-color: rgba(255, 235, 230, 0.52);
  border-left: 3px solid #ff4160;
  color: var(--ink);
  background: #650d24;
  box-shadow: inset 0 0 0 2px rgba(10, 7, 9, 0.45);
}

.map-stamp span,
.map-stamp small {
  color: rgba(255, 244, 239, 0.72);
}

.map-footnote {
  padding-top: 7px;
  font-size: 8px;
}

.chronicle {
  padding: 14px 15px 12px;
  background: #140b10;
}

.chronicle-top {
  padding-bottom: 9px;
}

.event-category {
  color: #fff4ef;
  border-color: rgba(255, 79, 106, 0.46);
  background: #6a0d24;
}

.event-index {
  color: var(--ink-faint);
}

.event-copy {
  padding-top: 12px;
}

.event-copy h2 {
  color: #fff9f5;
  font-size: clamp(25px, 2vw, 34px);
}

.event-date {
  color: var(--red-bright);
}

.event-subtitle {
  color: var(--ink-soft);
}

.narration-wrap {
  border-left-color: var(--red);
  background: #190c12;
}

.narration-label {
  color: #d58a9c;
}

.event-narration {
  color: #ded2d0;
}

.lens-card {
  border-color: rgba(255, 255, 255, 0.09);
  background: #180c11;
}

.lens-card.front {
  border-left-color: rgba(255, 245, 240, 0.45);
}

.lens-card.behind {
  border-left-color: rgba(255, 70, 99, 0.75);
}

.lens-symbol {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  background: #2a1019;
}

.behind .lens-symbol {
  color: #fff;
  border-color: rgba(255, 91, 116, 0.48);
  background: #6a0d24;
}

.lens-title h3 {
  color: #e9dcda;
}

.lens-card p {
  color: #cbbfbe;
}

.phase-battle-strip {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 34px;
  margin-top: 9px;
  padding: 0 10px;
  border: 1px solid rgba(255, 70, 99, 0.2);
  color: var(--ink-soft);
  background: #1a0c12;
  font-family: var(--sans);
  font-size: 9px;
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease;
}

.phase-battle-strip:hover {
  border-color: rgba(255, 70, 99, 0.58);
  background: #230d16;
}

.phase-battle-strip strong {
  color: var(--red-bright);
  font-weight: 500;
}

.phase-battle-arrow {
  color: var(--ink-faint);
  font-size: 13px;
}

.evidence-note summary,
.text-link {
  color: #dfa0ad;
}

.chronicle-actions {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.primary-action,
.play-action {
  color: #fff9f5;
  border-color: #ed2147;
  background: var(--red);
}

.primary-action:hover,
.play-action:hover {
  background: #ec2448;
}

.secondary-action,
.icon-action {
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--ink-soft);
  background: #180c11;
}

.secondary-action:hover,
.icon-action:hover {
  border-color: rgba(255, 78, 106, 0.62);
  background: #240d16;
}

.time-deck {
  grid-template-rows: 49px minmax(56px, 1fr) auto;
  padding: 8px 14px 6px;
  background: #120a0e;
}

.year-lockup strong {
  color: #fff9f5;
  font-family: var(--sans);
  font-size: 29px;
  font-weight: 500;
}

.chapter-nav button {
  color: var(--ink-faint);
  font-size: 8.5px;
}

.chapter-nav button:hover,
.chapter-nav button.active {
  color: #fff4ef;
}

.chapter-nav button.active::after {
  background: var(--red);
}

.play-action[aria-pressed="true"] {
  color: var(--ink);
  border-color: rgba(255, 76, 105, 0.42);
  background: #5b0e22;
}

.timeline-wrap {
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
}

.timeline-track {
  border-top-color: rgba(255, 242, 237, 0.18);
}

.timeline-track::before {
  background: rgba(255, 242, 237, 0.05);
}

.timeline-fill {
  height: 4px;
  background: var(--red);
  box-shadow: 0 0 16px rgba(211, 19, 54, 0.32);
}

.timeline-head::before {
  background: rgba(255, 239, 234, 0.3);
}

.timeline-head span {
  border-color: #fff7f2;
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(211, 19, 54, 0.14);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.timeline-wrap.is-scrubbing .timeline-head span {
  transform: translateX(-50%) rotate(45deg) scale(1.15);
  box-shadow: 0 0 0 5px rgba(211, 19, 54, 0.12), 0 0 22px rgba(255, 53, 88, 0.46);
}

.timeline-wrap.is-scrubbing .timeline-fill {
  box-shadow: 0 0 20px rgba(255, 53, 88, 0.48);
}

.timeline-event {
  border-color: rgba(255, 242, 237, 0.5);
  background: #1a0c12;
}

.timeline-event.unlocked {
  background: #f5e8e3;
  box-shadow: 0 0 0 3px rgba(255, 246, 241, 0.05);
}

.timeline-event.active {
  background: #ff3558;
  box-shadow: 0 0 0 4px rgba(255, 53, 88, 0.14), 0 0 16px rgba(255, 53, 88, 0.4);
}

.timeline-event.memory.unlocked {
  background: #870d28;
}

.progress i {
  background: var(--red);
}

.archive-drawer {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: #130a0f;
  border-left-color: rgba(255, 77, 105, 0.24);
}

.drawer-head {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.history-tabs {
  display: flex;
  gap: 2px;
  padding: 12px 0 0;
}

.history-tab {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-faint);
  background: transparent;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.history-tab span {
  margin-left: 5px;
  color: var(--ink-faint);
  font-size: 8px;
}

.history-tab:hover,
.history-tab.active {
  color: #fff7f3;
}

.history-tab.active {
  border-bottom-color: var(--red);
}

.history-panel {
  min-height: 0;
  overflow: hidden;
}

#battlePanel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

#crimePanel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.battle-toolbar {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto;
  gap: 6px;
  padding: 8px 0 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.battle-select {
  width: 100%;
  min-height: 30px;
  padding: 0 24px 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 0;
  color: var(--ink-soft);
  background: #1b0c13;
  font-family: var(--sans);
  font-size: 9.5px;
}

.rare-filter {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 9px;
  white-space: nowrap;
}

.rare-filter input {
  accent-color: var(--red);
}

.battle-result-count {
  grid-column: 1 / -1;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 9px;
  text-align: right;
}

.battle-list {
  overflow-y: auto;
  padding: 10px 3px 18px 0;
  scrollbar-color: rgba(211, 19, 54, 0.45) transparent;
  scrollbar-width: thin;
}

.battle-entry {
  margin-bottom: 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #170b10;
}

.battle-entry[open] {
  border-color: rgba(255, 76, 104, 0.34);
  background: #1c0c13;
}

.battle-entry summary {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 10px;
  list-style: none;
}

.battle-entry summary::-webkit-details-marker {
  display: none;
}

.battle-entry-date {
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 8.5px;
  line-height: 1.45;
}

.battle-entry-title {
  color: #f8ece8;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.03em;
}

.battle-entry-sub {
  margin-top: 3px;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 8.5px;
}

.battle-result-badge {
  min-width: 35px;
  padding: 3px 6px;
  color: #fff7f3;
  background: var(--red-deep);
  font-family: var(--sans);
  font-size: 8.5px;
  text-align: center;
}

.battle-result-badge.victory {
  background: var(--red);
}

.battle-result-badge.defeat,
.battle-result-badge.friction {
  color: var(--ink-soft);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
}

.battle-result-badge.sacrifice,
.battle-result-badge.crime {
  background: #410a18;
}

.battle-entry-body {
  padding: 0 12px 12px 78px;
}

.battle-entry-body p {
  margin: 0 0 8px;
  color: #bfb2b2;
  font-size: 10.5px;
  line-height: 1.75;
}

.battle-entry-body strong {
  color: #efc0c9;
  font-weight: 500;
}

.battle-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.battle-tag {
  padding: 2px 5px;
  color: #caaeb4;
  border: 1px solid rgba(255, 255, 255, 0.11);
  font-family: var(--sans);
  font-size: 7px;
}

.battle-tag.rare {
  color: #fff4ef;
  border-color: rgba(255, 78, 105, 0.4);
  background: #5c0d22;
}

.archive-progress-row {
  margin-top: 10px;
}

.archive-list {
  min-height: 0;
}

.archive-entry {
  background: #170b10;
}

.archive-entry[open] {
  border-color: rgba(255, 76, 104, 0.34);
  background: #1c0c13;
}

.archive-number {
  color: #f1b0bd;
  border-color: rgba(255, 77, 105, 0.34);
}

.archive-summary-copy h3 {
  color: #f8ece8;
}

.archive-state {
  color: #ce8d9b;
}

.drawer-source {
  border-top-color: rgba(255, 255, 255, 0.09);
}

.intro-screen {
  background:
    linear-gradient(90deg, rgba(8, 5, 7, 0.92), rgba(8, 5, 7, 0.34) 46%, rgba(8, 5, 7, 0.9)),
    #0b0709;
}

.intro-content h1 span:nth-child(2) {
  color: #f0e6e1;
}

.intro-content h1 span:first-child {
  color: #ff3356;
}

.intro-seal,
.intro-warning {
  border-color: rgba(255, 63, 94, 0.34);
}

.enter-button {
  color: #fff;
  border-color: #f53a59;
  background: var(--red);
}

.enter-button:hover {
  background: #ef2348;
}

.ending-content h2 {
  color: #fff8f4;
}

.ending-eyebrow,
.ending-content blockquote {
  color: #ff5972;
}

.witness-seal {
  color: #ffd8dc;
  border-color: rgba(255, 77, 105, 0.6);
}

.map-panel {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.map-statline {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr 1.1fr;
  align-items: center;
  gap: 18px;
  margin: 0 0 9px;
  padding: 7px 11px;
  border-top: 1px solid rgba(219, 195, 152, 0.14);
  border-bottom: 1px solid rgba(219, 195, 152, 0.14);
  background: #17120e;
}

.national-casualty,
.verified-casualty {
  display: grid;
  grid-template-columns: auto auto;
  gap: 1px 9px;
  align-items: baseline;
}

.national-casualty > span,
.verified-casualty > span {
  grid-column: 1 / -1;
  color: #948876;
  font-family: var(--sans);
  font-size: 7.5px;
  letter-spacing: 0.08em;
}

.national-casualty > strong,
.verified-casualty > strong {
  color: #ead39f;
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.national-casualty > strong {
  grid-column: 1;
}

.national-casualty > small,
.verified-casualty > small {
  color: #806f5d;
  font-family: var(--sans);
  font-size: 7px;
}

.verified-casualty > strong {
  color: #cf8069;
  font-size: 17px;
}

.verified-casualty > small {
  grid-column: 1 / -1;
}

.national-casualty em {
  color: #b34a36;
  font-size: 12px;
  font-style: normal;
}

.national-casualty .counting {
  animation: casualtyTick 420ms steps(2, end) infinite;
}

.national-casualty .settled {
  animation: casualtySettle 820ms ease-out;
}

.verified-casualty .counting {
  animation: casualtyTick 420ms steps(2, end) infinite;
}

.casualty-method {
  margin: 0;
  color: #756a5c;
  font-family: var(--sans);
  font-size: 7.5px;
  line-height: 1.55;
}

.world-context-land {
  fill: #221a15;
  stroke: rgba(196, 172, 132, 0.2);
  stroke-width: 0.55;
  stroke-linejoin: round;
  pointer-events: none;
}

.world-context-label {
  fill: rgba(212, 195, 164, 0.33);
  font-family: var(--serif);
  font-size: 7px;
  letter-spacing: 0.1em;
  pointer-events: none;
}

#terrainLayer,
#provinceLabelLayer,
#riverLayer,
#routeLayer {
  pointer-events: none;
}

.ocean-context-label {
  fill: rgba(139, 157, 158, 0.32);
  font-family: var(--sans);
  font-size: 6.5px;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.city-marker {
  cursor: pointer;
  outline: none;
}

.city-marker .city-dot {
  transition: r 150ms ease, fill 150ms ease;
}

.city-marker:hover .city-dot,
.city-marker:focus-visible .city-dot {
  r: 2.1;
  fill: #d48262;
}

.city-marker.region-selected .city-dot {
  fill: #f2d79f;
  stroke: #b63f2e;
}

.province {
  cursor: pointer;
}

.province.region-selected {
  stroke: rgba(239, 211, 158, 0.9);
  stroke-width: 1.8;
}

.region-card {
  width: min(930px, 100%);
}

.region-modal-screen {
  backdrop-filter: none;
}

.region-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(218, 195, 153, 0.18);
}

.region-heading p {
  margin: 0 0 3px;
  color: #c16c54;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.region-heading h2 {
  margin: 0;
}

.region-heading > span {
  color: #8b7f6e;
  font-family: var(--sans);
  font-size: 9px;
}

.region-summary {
  margin: 14px 0;
  max-width: 760px;
  color: #c8baa5;
  font-size: 12px;
  line-height: 1.8;
}

.region-crimes {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 3px;
}

.region-crime-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 11px;
  padding: 12px;
  border-left: 2px solid #a43a2b;
  background: rgba(218, 195, 153, 0.035);
}

.region-crime-index {
  color: #a95f4d;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.region-crime-date {
  margin: 0 0 3px !important;
  color: #a78561 !important;
  font-family: var(--sans);
  font-size: 8px !important;
}

.region-crime-entry h3 {
  margin: 0 0 5px;
  color: #ead9b9;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
}

.region-crime-entry p {
  margin: 0 !important;
  color: #bdb09c !important;
  font-size: 11px !important;
  line-height: 1.72 !important;
}

.region-crime-entry small {
  display: block;
  margin-top: 7px;
  color: #776c5e;
  font-family: var(--sans);
  font-size: 7.5px;
}

.region-archive-link {
  align-self: start;
  min-height: 26px;
  padding: 0 7px;
  color: #d6b978;
  border: 1px solid rgba(197, 160, 91, 0.32);
  background: transparent;
  font-family: var(--sans);
  font-size: 7.5px;
  white-space: nowrap;
}

.region-archive-link:hover {
  color: #fff0c8;
  border-color: rgba(221, 188, 115, 0.64);
}

.region-no-record {
  padding: 18px;
  border: 1px dashed rgba(210, 187, 148, 0.16);
  color: #9f9381;
}

.region-no-record strong {
  color: #d5c3a5;
  font-weight: 500;
}

.region-no-record p {
  margin: 7px 0 0;
  font-size: 11px;
  line-height: 1.75;
}

.region-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid rgba(218, 195, 153, 0.13);
}

.region-footer p {
  max-width: 550px;
  margin: 0;
  color: #756b5d;
  font-family: var(--sans);
  font-size: 8px;
  line-height: 1.65;
}

.region-footer > div {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}

@keyframes casualtyTick {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}

@keyframes casualtySettle {
  0% { transform: translateY(0); }
  28% { transform: translateY(-3px); }
  55% { transform: translateY(1px); }
  100% { transform: translateY(0); }
}

/* First-edition palette restored, with richer historical layers. */
:root {
  --ink: #ece1cd;
  --ink-soft: #c7bcaa;
  --ink-faint: #8d8375;
  --coal: #100d0c;
  --coal-2: #181410;
  --coal-3: #211b16;
  --line: rgba(220, 202, 168, 0.17);
  --line-strong: rgba(220, 202, 168, 0.34);
  --gold: #c5aa72;
  --gold-bright: #ead39c;
  --red: #a33128;
  --red-deep: #611b18;
  --red-bright: #d96b51;
  --jade: #748676;
  --jade-bright: #b8c4ab;
  --blue: #7e9aa0;
}

body {
  background:
    radial-gradient(circle at 18% 8%, rgba(160, 118, 67, 0.08), transparent 32%),
    radial-gradient(circle at 82% 82%, rgba(105, 24, 19, 0.12), transparent 36%),
    #100d0c;
}

.topbar {
  border-bottom-color: rgba(220, 202, 168, 0.14);
}

.brand-seal {
  color: #ead39c;
  background: #5d1b18;
  border-color: rgba(197, 170, 114, 0.42);
  border-left-color: #b84232;
}

.brand-copy strong,
.era-readout strong {
  color: #eee2cc;
}

.era-kicker,
.event-date,
.text-link,
.evidence-note summary {
  color: #d7ba81;
}

.tool-button {
  color: #c5b8a5;
  border-color: rgba(214, 194, 158, 0.16);
  background: #1a1511;
}

.tool-button:hover {
  border-color: rgba(210, 177, 112, 0.55);
  background: #241b15;
}

.archive-trigger {
  color: #ead8b7;
  border-color: rgba(166, 52, 40, 0.62);
  background: #561916;
}

.counter {
  color: #ead9bb;
  background: rgba(0, 0, 0, 0.22);
}

.map-panel,
.chronicle,
.time-deck {
  border-color: rgba(220, 202, 168, 0.15);
  background: #181411;
}

.map-frame {
  border-color: rgba(208, 179, 123, 0.2);
  cursor: grab;
}

.map-frame.is-panning {
  cursor: grabbing;
}

.map-frame.is-panning #mapSvg {
  cursor: grabbing;
}

.map-heading h1 {
  color: #e9ddc7;
}

.map-heading p {
  color: #a99d89;
}

.province {
  fill: #3d3327;
  stroke: #15100d;
}

.province.tone-1 {
  fill: #332a21;
}

.province.tone-2 {
  fill: #46382b;
}

.province:hover {
  fill: #5a4937;
}

.province.affected {
  fill: #731d1b;
  stroke: rgba(237, 207, 165, 0.16);
  filter: none;
}

.province.affected.burn-depth-0 {
  fill: #5b1918;
}

.province.affected.burn-depth-1 {
  fill: #6d1c1a;
}

.province.affected.burn-depth-2 {
  fill: #7f211c;
}

.province.affected.burn-depth-3 {
  fill: #91261f;
}

.province.affected.burn-depth-4 {
  fill: #a22c22;
}

.province-burn {
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
  mix-blend-mode: normal;
}

.province-burn.visible {
  opacity: 0.24;
}

.province-burn.burn-depth-0 {
  fill: #ba4934;
}

.province-burn.burn-depth-1 {
  fill: #c94f36;
}

.province-burn.burn-depth-2 {
  fill: #d75a3b;
}

.province-burn.burn-depth-3 {
  fill: #e46845;
}

.province-burn.burn-depth-4 {
  fill: #f07a53;
}

.province.affected:hover {
  fill: #b43a29;
}

.province.burning {
  animation: provinceBurnIn 1.25s cubic-bezier(.22, .72, .18, 1) both;
}

.province-overlay.burning {
  stroke: rgba(255, 172, 102, 0.8);
  stroke-width: 1.5;
  stroke-dasharray: 8 14;
  animation: burnBoundary 1.35s ease-out both;
}

.province-label {
  fill: rgba(238, 225, 201, 0.4);
  stroke: rgba(16, 13, 10, 0.74);
}

.terrain-ridge {
  stroke: rgba(228, 211, 178, 0.22);
}

.terrain-ridge.accent {
  stroke: rgba(196, 116, 78, 0.27);
}

.terrain-peak {
  stroke: rgba(231, 216, 187, 0.24);
}

.major-river {
  stroke: rgba(132, 166, 172, 0.54);
  filter: none;
}

.major-river.yellow {
  stroke: rgba(196, 164, 95, 0.5);
}

.minor-river {
  stroke: rgba(115, 147, 151, 0.26);
}

.lake-shape {
  fill: rgba(102, 146, 154, 0.25);
  stroke: rgba(162, 191, 194, 0.46);
}

.railway {
  stroke: rgba(221, 198, 153, 0.25);
}

.railway-label,
.map-water-label {
  fill: rgba(230, 216, 191, 0.38);
}

.city-dot {
  fill: #e5d5b3;
  stroke: #6f261d;
}

.city-label {
  fill: rgba(239, 226, 202, 0.62);
}

.map-frame:not(.is-zoomed) .railway-label,
.map-frame:not(.is-zoomed) .map-water-label,
.map-frame:not(.is-zoomed) .base-area-label {
  opacity: 0;
}

.base-area-group {
  opacity: 0;
  transition: opacity 780ms ease;
  pointer-events: none;
}

.base-area-group.active {
  opacity: 1;
}

.base-area {
  fill: #59644b;
  fill-opacity: 0.32;
  stroke: rgba(231, 210, 164, 0.62);
  stroke-width: 0.9;
  stroke-dasharray: 3 2;
}

.base-area-hatch {
  fill: url(#baseHatch);
  fill-opacity: 0.7;
  stroke: rgba(231, 210, 164, 0.46);
  stroke-width: 0.7;
  stroke-dasharray: 3 2;
}

.base-area-label {
  fill: #f0dca9;
  font-family: var(--sans);
  font-size: 7px;
  letter-spacing: 0.08em;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(13, 10, 8, 0.9);
  stroke-width: 2.4px;
}

.war-darkness {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.1;
  background:
    radial-gradient(circle at 62% 48%, rgba(104, 11, 17, 0.38), transparent 48%),
    linear-gradient(145deg, rgba(4, 3, 3, 0.36), rgba(42, 6, 10, 0.66));
  mix-blend-mode: normal;
  transition: opacity 900ms ease, background 1200ms ease;
}

.map-frame.is-victory .war-darkness {
  background:
    radial-gradient(circle at 58% 45%, rgba(210, 180, 113, 0.13), transparent 48%),
    rgba(17, 7, 7, 0.2);
  mix-blend-mode: normal;
}

.map-zoom-controls {
  position: absolute;
  top: 52px;
  right: 14px;
  z-index: 4;
  display: grid;
  gap: 4px;
}

.map-zoom-controls button {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  padding: 0;
  color: #d8c7a7;
  border: 1px solid rgba(216, 195, 157, 0.18);
  background: rgba(19, 15, 12, 0.84);
  font-family: var(--sans);
  font-size: 15px;
}

.map-zoom-controls button:hover {
  color: #fff0cc;
  border-color: rgba(213, 181, 116, 0.58);
}

.map-zoom-controls button.reset {
  font-size: 12px;
}

.casualty-hud {
  position: absolute;
  top: 13px;
  left: 14px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto auto;
  gap: 1px 9px;
  min-width: 206px;
  padding: 9px 11px;
  color: #c9bca8;
  border-left: 2px solid #aa3a2b;
  background: rgba(18, 14, 11, 0.84);
  pointer-events: none;
}

.casualty-hud-label,
.casualty-hud-sub {
  font-family: var(--sans);
  font-size: 7.5px;
  letter-spacing: 0.08em;
}

.casualty-hud-label {
  grid-column: 1 / -1;
  color: #9f9380;
}

.casualty-hud-total {
  color: #f0d8aa;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.casualty-hud-total em {
  color: #b84836;
  font-style: normal;
}

.casualty-hud-sub {
  align-self: end;
  justify-self: end;
  color: #928676;
}

.casualty-hud-count {
  grid-column: 2;
  justify-self: end;
  color: #d9866e;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.chronicle {
  background: #191410;
}

.event-category {
  color: #f0dfc1;
  border-color: rgba(174, 64, 47, 0.54);
  background: #62201c;
}

.event-copy h2 {
  color: #f1e4ce;
}

.narration-wrap {
  background: rgba(130, 41, 30, 0.08);
  border-left-color: #ad3d2c;
}

.event-narration {
  color: #d5c8b2;
}

.lens-card {
  background: #1d1712;
}

.lens-card.front {
  border-left-color: rgba(205, 172, 107, 0.54);
}

.lens-card.behind {
  border-left-color: rgba(111, 139, 111, 0.74);
}

.lens-symbol {
  color: #dfc78f;
  background: #2c2118;
}

.behind .lens-symbol {
  color: #d5e0c9;
  border-color: rgba(117, 145, 116, 0.46);
  background: #263427;
}

.lens-title h3 {
  color: #d9c8aa;
}

.phase-battle-strip {
  color: #cfc1a9;
  border-color: rgba(196, 166, 106, 0.22);
  background: #201813;
}

.phase-battle-strip strong {
  color: #e1c181;
}

.primary-action,
.play-action {
  color: #1b140d;
  border-color: #c7ad75;
  background: #c0a366;
}

.primary-action:hover,
.play-action:hover {
  background: #d7bd84;
}

.play-action[aria-pressed="true"] {
  color: #e9dcc5;
  border-color: rgba(186, 75, 53, 0.52);
  background: #581d19;
}

.secondary-action,
.icon-action {
  color: #c7bba8;
  background: #1d1712;
}

.secondary-action:hover,
.icon-action:hover {
  border-color: rgba(198, 164, 97, 0.55);
  background: #2b2118;
}

.timeline-fill {
  background: linear-gradient(90deg, #6c7e66, #b89a5d 64%, #b94b36);
}

.timeline-head span {
  border-color: #efd89f;
  background: #5b201b;
}

.timeline-wrap.is-scrubbing .timeline-head span {
  box-shadow: 0 0 0 5px rgba(185, 76, 54, 0.13), 0 0 22px rgba(183, 122, 70, 0.46);
}

.timeline-event {
  border-color: rgba(226, 204, 159, 0.5);
  background: #1d1712;
}

.timeline-event.unlocked {
  background: #c8ab72;
}

.timeline-event.active {
  background: #e4ca8d;
  box-shadow: 0 0 0 4px rgba(226, 201, 143, 0.13), 0 0 15px rgba(213, 175, 103, 0.35);
}

.timeline-event.memory.unlocked {
  background: #8c2c23;
}

.event-photo-button {
  min-height: 24px;
  padding: 0 7px;
  color: #d8bd84;
  border: 1px solid rgba(198, 164, 99, 0.28);
  background: rgba(198, 164, 99, 0.06);
  font-family: var(--sans);
  font-size: 8px;
}

.event-photo-button:hover {
  color: #f1dfb5;
  border-color: rgba(210, 178, 111, 0.6);
}

.chronicle-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.archive-drawer {
  background: #181310;
  border-left-color: rgba(208, 178, 118, 0.25);
}

.history-tab.active {
  border-bottom-color: #b44a35;
}

.battle-entry,
.archive-entry {
  background: #1b1511;
}

.battle-entry[open],
.archive-entry[open] {
  border-color: rgba(189, 87, 58, 0.4);
  background: #221814;
}

.battle-result-badge {
  background: #65201b;
}

.battle-result-badge.victory {
  background: #a53a2b;
}

.battle-tag.rare {
  background: #5b1d19;
  border-color: rgba(199, 109, 78, 0.42);
}

.event-media-overlay {
  position: fixed;
  inset: 0;
  z-index: 170;
  display: grid;
  place-items: center;
  padding: 30px;
  background: rgba(5, 4, 3, 0.96);
  backdrop-filter: none;
}

.media-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
}

.event-media-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.72fr);
  width: min(1120px, 94vw);
  height: min(680px, 80vh);
  max-height: min(760px, 84vh);
  overflow: hidden;
  border: 1px solid rgba(219, 191, 139, 0.3);
  background: #15110e;
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.62);
  will-change: transform, opacity, filter;
}

.media-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  padding: 15px;
  background: #090807;
}

.event-media-card.has-secondary .media-stage {
  grid-template-rows: minmax(0, 1fr) 150px;
  gap: 8px;
}

.media-main,
.media-secondary {
  position: relative;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: #050505;
}

.media-main img,
.media-secondary img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: sepia(0.22) saturate(0.72) contrast(1.08);
}

.event-media-card.has-secondary .media-main img {
  object-fit: cover;
}

.media-index {
  position: absolute;
  right: 9px;
  bottom: 9px;
  color: rgba(243, 226, 193, 0.64);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.media-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 27px 26px 22px;
  border-left: 1px solid rgba(219, 191, 139, 0.15);
  background: #17120f;
}

.media-type {
  width: fit-content;
  padding: 3px 6px;
  color: #e3c98e;
  border: 1px solid rgba(211, 177, 110, 0.34);
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.media-date {
  margin: 16px 0 6px;
  color: #b75d48;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.media-copy h2 {
  margin: 0;
  color: #f0e2ca;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.03em;
}

.media-caption {
  margin: 15px 0 0;
  color: #cfc2ad;
  font-size: 12px;
  line-height: 1.8;
}

.media-credit {
  margin: 12px 0 0;
  color: #82786a;
  font-family: var(--sans);
  font-size: 8.5px;
  line-height: 1.65;
}

.media-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 13px;
  border-top: 1px solid rgba(219, 191, 139, 0.12);
}

.media-actions > span {
  flex: 1 1 100%;
  max-width: none;
  color: #6f665b;
  font-family: var(--sans);
  font-size: 7.5px;
  line-height: 1.5;
}

.media-auto-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #8d8171;
  font-family: var(--sans);
  font-size: 7.5px;
  white-space: nowrap;
}

.media-auto-toggle input {
  width: 13px;
  height: 13px;
  accent-color: #9c3125;
}

.media-actions .primary-action {
  margin-left: auto;
  white-space: nowrap;
}

.media-close {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 4;
}

.martyr-overlay {
  position: fixed;
  inset: 0;
  z-index: 165;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 18px 22px 14px;
  overflow: hidden;
  color: #e9ddc7;
  background:
    radial-gradient(circle at 50% 44%, rgba(142, 81, 44, 0.14), transparent 45%),
    #080706;
  transition: opacity 480ms ease;
}

.martyr-overlay.leaving {
  opacity: 0;
}

.martyr-header {
  position: relative;
  z-index: 3;
  text-align: center;
}

.martyr-header p:first-child {
  margin: 0 0 5px;
  color: #b96851;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.martyr-header h2 {
  margin: 0;
  color: #efe2ca;
  font-family: var(--display);
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 500;
  letter-spacing: 0.1em;
}

.martyr-header p:last-child {
  max-width: 850px;
  margin: 7px auto 0;
  color: #968b7a;
  font-size: 10px;
  line-height: 1.6;
}

.martyr-field {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 7px;
  width: min(1240px, 100%);
  height: 100%;
  min-height: 0;
  margin: auto;
}

.martyr-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 0;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(214, 190, 148, 0.2);
  background: #15100d;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  opacity: 0;
  transform: translateY(var(--rise-y, 20px)) scale(.94);
  transform-origin: center;
  will-change: transform, opacity;
}

.martyr-card.flying {
  animation: martyrRise 1.55s cubic-bezier(.18, .78, .17, 1) var(--delay, 0s) forwards;
}

.martyr-card img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: center 22%;
  filter: grayscale(1) sepia(0.24) brightness(0.78) contrast(1.1);
}

.martyr-caption {
  display: grid;
  gap: 1px;
  padding: 5px 6px 6px;
  background: #15100d;
}

.martyr-caption strong {
  color: #e6d4b4;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.martyr-caption > span,
.martyr-caption small {
  overflow: hidden;
  color: #968a78;
  font-family: var(--sans);
  font-size: 6.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.martyr-caption small {
  color: #a15f4b;
}

.martyr-card:hover img,
.martyr-card:focus-visible img {
  filter: grayscale(0.35) sepia(0.16) brightness(0.9) contrast(1.08);
}

.martyr-card:hover,
.martyr-card:focus-visible {
  border-color: rgba(223, 191, 126, 0.62);
  outline: none;
}

.martyr-card-hint {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 2px 4px;
  color: #e5cfaa;
  border: 1px solid rgba(224, 198, 148, 0.3);
  background: rgba(13, 10, 8, 0.78);
  font-family: var(--sans);
  font-size: 6px;
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 160ms ease;
}

.martyr-card:hover .martyr-card-hint,
.martyr-card:focus-visible .martyr-card-hint {
  opacity: 1;
}

.martyr-footer {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  min-height: 36px;
}

.martyr-footer p {
  margin: 0;
  color: #928776;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.martyr-footer > div {
  display: flex;
  gap: 7px;
}

.martyr-profile {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 24px;
}

.martyr-profile[hidden] {
  display: none;
}

.martyr-profile-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(5, 4, 3, 0.94);
}

.martyr-profile-folio {
  position: relative;
  display: grid;
  grid-template-columns: minmax(230px, 0.78fr) minmax(340px, 1.22fr);
  width: min(840px, 92vw);
  max-height: min(650px, 88vh);
  overflow: hidden;
  border: 1px solid rgba(214, 190, 148, 0.28);
  background:
    linear-gradient(115deg, rgba(164, 121, 73, 0.06), transparent 48%),
    #15110e;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.72);
}

.martyr-profile-close {
  position: absolute;
  top: 11px;
  right: 11px;
  z-index: 3;
}

.martyr-profile-portrait {
  position: relative;
  min-height: 420px;
  margin: 0;
  overflow: hidden;
  background: #090807;
}

.martyr-profile-portrait::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 58%, rgba(8, 7, 6, 0.78)),
    linear-gradient(90deg, transparent 70%, rgba(21, 17, 14, 0.42));
  content: "";
  pointer-events: none;
}

.martyr-profile-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  filter: grayscale(1) sepia(0.26) contrast(1.08) brightness(0.84);
}

.martyr-profile-portrait figcaption {
  position: absolute;
  bottom: 13px;
  left: 15px;
  z-index: 2;
  color: #cfb98e;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.martyr-profile-copy {
  align-self: center;
  padding: 38px 39px 32px;
}

.martyr-profile-dates {
  margin: 0 0 8px;
  color: #b66b51;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.11em;
}

.martyr-profile-copy h3 {
  margin: 0;
  color: #efe0c4;
  font-family: var(--display);
  font-size: clamp(36px, 4vw, 54px);
  font-weight: 500;
  letter-spacing: 0.12em;
}

.martyr-profile-role {
  margin: 3px 0 0;
  color: #a59882;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.martyr-profile-rule {
  width: 58px;
  height: 1px;
  margin: 18px 0;
  background: linear-gradient(90deg, #9f4a38, transparent);
}

.martyr-profile-intro {
  margin: 0;
  color: #cec1ab;
  font-family: var(--inscription);
  font-size: 14px;
  line-height: 1.95;
  letter-spacing: 0.035em;
}

.martyr-profile-tribute {
  margin: 22px 0 0;
  padding: 14px 0 13px 17px;
  border-left: 2px solid #8f3026;
}

.martyr-profile-tribute span {
  color: #a35b47;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.martyr-profile-tribute p {
  margin: 5px 0 0;
  color: #e4cfa8;
  font-family: var(--display);
  font-size: 22px;
  line-height: 1.55;
  letter-spacing: 0.06em;
}

.martyr-profile-note {
  margin: 18px 0 0;
  color: #71695d;
  font-family: var(--sans);
  font-size: 7.5px;
  line-height: 1.6;
}

.martyr-overlay.is-skipped .martyr-card {
  animation: none !important;
  opacity: 1;
  transform: none;
}

.event-media-overlay[hidden],
.martyr-overlay[hidden] {
  display: none !important;
}

.event-photo-button[hidden] {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

body.modal-open #ashCanvas,
body.modal-open .map-fx-canvas {
  opacity: 0;
  pointer-events: none;
}

body.is-scrubbing .province,
body.is-scrubbing .province-burn,
body.is-scrubbing .war-darkness,
body.is-scrubbing .event-pin,
body.is-scrubbing .memory-pin {
  transition: none !important;
}

.map-frame.is-panning #worldContextLayer,
.map-frame.is-panning #terrainLayer,
.map-frame.is-panning #provinceLabelLayer,
body.is-scrubbing #worldContextLayer,
body.is-scrubbing #terrainLayer,
body.is-scrubbing #provinceLabelLayer {
  visibility: hidden;
}

body.performance-lite .world-grain,
body.performance-lite .world-context-label,
body.performance-lite .terrain-peak,
body.performance-lite .railway-label,
body.performance-lite .map-water-label,
body.performance-lite .shock-flash {
  display: none;
}

body.performance-lite .event-pin.unlocked .event-pulse,
body.performance-lite .memory-pin .memory-ring {
  animation: none !important;
}

@keyframes provinceBurnIn {
  0% { opacity: 0.15; stroke: rgba(255, 230, 192, 0.95); }
  45% { opacity: 0.88; }
  100% { opacity: 1; stroke: rgba(237, 207, 165, 0.16); }
}

@keyframes burnBoundary {
  0% { opacity: 0; stroke-dashoffset: 380; }
  35% { opacity: 0.9; stroke: rgba(255, 172, 102, 0.8); }
  100% { opacity: 0.55; stroke-dashoffset: 0; }
}

@keyframes martyrRise {
  0% {
    opacity: 0;
    transform: translateY(var(--rise-y, 20px)) scale(.94);
    filter: blur(3px);
  }
  55% { opacity: 0.82; }
  82% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes monumentRoll {
  0% { transform: translateY(110%); }
  100% { transform: translateY(-120%); }
}

@keyframes soundBar {
  to { transform: scaleY(0.35); }
}

@keyframes loadingLine {
  0%, 100% { opacity: 0.22; transform: scaleX(0.25); }
  50% { opacity: 1; transform: scaleX(1); }
}

@keyframes mapPulse {
  0% { transform: scale(0.7); opacity: 0.75; }
  70% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

@keyframes memoryPulse {
  0% { transform: scale(0.7); opacity: 0.8; }
  65% { transform: scale(1.75); opacity: 0; }
  100% { transform: scale(1.75); opacity: 0; }
}

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

@keyframes provinceChar {
  0% { stroke: rgba(255, 246, 241, 0.9); }
  100% { stroke: rgba(255, 236, 231, 0.12); }
}

@keyframes traumaFlash {
  0% { opacity: 0; }
  12% { opacity: 0.9; }
  100% { opacity: 0; }
}

@keyframes traumaShake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-4px, 2px); }
  30% { transform: translate(3px, -2px); }
  45% { transform: translate(-2px, -1px); }
  60% { transform: translate(2px, 1px); }
  78% { transform: translate(-1px, 1px); }
}

@keyframes introMapBreathe {
  from { opacity: 0.42; transform: translateY(-50%) scale(0.985); }
  to { opacity: 0.62; transform: translateY(-50%) scale(1.015); }
}

/* Final editorial pass: restrained colour, clearer reading and map lettering. */
:root {
  --ink: #efe4cf;
  --ink-soft: #d0c3ac;
  --ink-faint: #988b77;
  --coal: #0d0f0e;
  --coal-2: #151612;
  --coal-3: #1d1b16;
  --paper: #f0e5cf;
  --gold: #c9a765;
  --gold-bright: #ead29b;
  --red: #a83a2d;
  --red-deep: #5f1b19;
  --red-bright: #d46b54;
  --jade: #708a78;
  --jade-bright: #b3c3ae;
  --blue: #70929a;
  --ochre: #c99b54;
  --plum: #825d70;
}

body {
  background:
    radial-gradient(circle at 7% 7%, rgba(78, 113, 92, 0.11), transparent 30%),
    radial-gradient(circle at 91% 10%, rgba(142, 62, 43, 0.12), transparent 34%),
    radial-gradient(circle at 58% 100%, rgba(185, 142, 73, 0.06), transparent 42%),
    #0d0f0e;
}

.brand-copy small {
  display: none;
}

.topbar {
  border-bottom-color: rgba(205, 185, 145, 0.16);
}

.tool-button {
  color: #cbbda7;
  border-color: rgba(204, 184, 145, 0.14);
  background: rgba(24, 24, 20, 0.72);
}

.archive-trigger {
  color: #f0dfbf;
  border-color: rgba(168, 58, 45, 0.55);
  background: #5f1b19;
}

.map-panel,
.chronicle,
.time-deck {
  border-color: rgba(206, 186, 147, 0.16);
  background: #151511;
  box-shadow: none;
}

.chronicle {
  background: #17140f;
}

.time-deck {
  background: #111311;
}

.map-heading h1 {
  color: #eddfc5;
  font-family: var(--inscription);
  font-size: 18px;
  letter-spacing: 0.12em;
}

.map-heading p {
  color: #a69a85;
  font-family: var(--inscription);
  letter-spacing: 0.08em;
}

.map-statline {
  border-color: rgba(207, 184, 139, 0.13);
  background: #11120f;
}

.national-casualty > span,
.verified-casualty > span {
  color: #b5a58c;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.national-casualty > strong {
  color: #e7cf98;
  font-size: 26px;
  font-family: var(--inscription);
  letter-spacing: 0.02em;
}

.national-casualty > small,
.verified-casualty > small {
  color: #95866f;
  font-size: 8px;
}

.verified-casualty > strong {
  color: #d48369;
  font-family: var(--inscription);
  font-size: 19px;
}

.casualty-method {
  color: #8f816d;
  font-size: 8.5px;
  line-height: 1.65;
}

.map-frame {
  border-color: rgba(194, 170, 126, 0.2);
  background: #090d0c;
}

.province-label {
  fill: #ead8b8;
  font-family: var(--inscription);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  stroke: rgba(5, 8, 7, 0.92);
  stroke-width: 2.4px;
}

.city-label {
  fill: #f0ddbc;
  font-family: var(--inscription);
  font-size: 8.2px;
  letter-spacing: 0.08em;
  stroke: rgba(5, 8, 7, 0.94);
  stroke-width: 2.2px;
}

.railway-label,
.map-water-label {
  fill: rgba(164, 191, 181, 0.54);
  font-family: var(--inscription);
  font-size: 7.5px;
  letter-spacing: 0.1em;
}

.pin-label,
.battle-pin .battle-label,
.base-area-label {
  font-family: var(--inscription);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.city-dot {
  fill: #e5c887;
  stroke: #642820;
}

.event-pin.unlocked .event-core {
  fill: #dfc17f;
  stroke: #f4e3bc;
}

.memory-pin .memory-core {
  fill: #8a2d2a;
  stroke: #d98a70;
}

.base-area {
  fill: #78917d;
  fill-opacity: 0.4;
  stroke: rgba(226, 208, 158, 0.72);
}

.base-area-hatch {
  fill-opacity: 0.82;
}

.major-river {
  stroke: rgba(111, 158, 166, 0.68);
}

.major-river.yellow {
  stroke: rgba(205, 164, 92, 0.58);
}

.lake-shape {
  fill: rgba(92, 139, 151, 0.3);
  stroke: rgba(148, 189, 191, 0.54);
}

.map-legend {
  color: #c8baa2;
  font-family: var(--inscription);
  font-size: 8.5px;
}

.map-footnote {
  color: #8f8371;
  font-size: 9px;
}

.event-category {
  color: #f0dbac;
  border-color: rgba(201, 155, 84, 0.48);
  background: #5b211c;
  font-family: var(--inscription);
  font-size: 9.5px;
}

.event-index,
.event-date {
  font-family: var(--inscription);
  font-size: 10px;
}

.event-copy h2 {
  color: #f2e5ca;
  letter-spacing: 0.075em;
}

.event-subtitle {
  color: #b2a48e;
  font-family: var(--inscription);
  font-size: 13px;
}

.narration-wrap {
  border-left-color: #a63e2f;
  background: linear-gradient(90deg, rgba(126, 43, 31, 0.16), transparent 90%);
}

.narration-label,
.lens-title h3,
.evidence-note summary {
  color: #c89b64;
  font-family: var(--inscription);
  font-size: 10px;
  letter-spacing: 0.13em;
}

.event-narration {
  color: #ded1b9;
  font-family: var(--inscription);
  font-size: 14px;
  line-height: 1.9;
}

.lens-card {
  border-color: rgba(204, 183, 142, 0.14);
  background: rgba(32, 30, 24, 0.72);
}

.lens-card.front {
  border-left-color: rgba(201, 155, 84, 0.72);
}

.lens-card.behind {
  border-left-color: rgba(112, 138, 120, 0.88);
}

.lens-card p {
  color: #cfc1a9;
  font-family: var(--inscription);
  font-size: 12.5px;
  line-height: 1.78;
}

.lens-symbol {
  color: #e2c98e;
  background: #2c2419;
}

.behind .lens-symbol {
  color: #dce7d5;
  border-color: rgba(126, 156, 127, 0.52);
  background: #26362b;
}

.battle-entry {
  border-color: rgba(203, 184, 146, 0.12);
  background: #181511;
}

.battle-entry[open] {
  border-color: rgba(175, 69, 50, 0.38);
  background: #1d1712;
}

.battle-entry-date,
.battle-entry-sub,
.battle-result-count {
  color: #a99b85;
  font-family: var(--inscription);
  font-size: 9.5px;
}

.battle-entry-title {
  color: #f0e0c4;
  font-family: var(--inscription);
  font-size: 16px;
}

.battle-entry-body p,
.archive-body p {
  color: #d0c2aa;
  font-family: var(--inscription);
  font-size: 12px;
  line-height: 1.8;
}

@media (max-width: 1240px) {
  .experience {
    grid-template-columns: minmax(0, 1.52fr) minmax(350px, 0.86fr);
  }

  .map-legend {
    max-width: calc(100% - 112px);
  }

  .chronicle {
    padding-right: 15px;
    padding-left: 15px;
  }

  .event-copy h2 {
    font-size: 28px;
  }

  .chapter-nav button {
    padding-right: 4px;
    padding-left: 4px;
    font-size: 8px;
  }

  .time-deck-head {
    grid-template-columns: 145px 1fr 220px;
  }
}

@media (max-height: 820px) and (min-width: 901px) {
  .app-shell {
    grid-template-rows: 60px minmax(0, 1fr) 168px;
  }

  .experience {
    padding-top: 8px;
  }

  .map-panel {
    padding: 10px;
  }

  .map-heading {
    padding-bottom: 7px;
  }

  .chronicle {
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .event-copy {
    padding-top: 10px;
  }

  .event-copy h2 {
    font-size: 25px;
  }

  .event-subtitle {
    margin-bottom: 9px;
  }

  .narration-wrap {
    margin: 8px 0 9px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .event-narration {
    font-size: 12.8px;
    line-height: 1.76;
  }

  .lens-card {
    padding: 7px 9px;
  }

  .lens-card p {
    font-size: 11.5px;
    line-height: 1.64;
  }

  .lens-title {
    margin-bottom: 4px;
  }

  .lens-symbol {
    width: 17px;
    height: 17px;
  }

  .double-line {
    gap: 6px;
  }

  .evidence-note {
    margin-top: 8px;
  }

  .evidence-note summary {
    padding-top: 7px;
  }

  .time-deck {
    grid-template-rows: 48px minmax(56px, 1fr) auto;
  }

  .year-lockup strong {
    font-size: 28px;
  }

  .toast {
    bottom: 190px;
  }
}

@media (max-width: 900px) {
  body {
    height: auto;
    overflow-y: auto;
  }

  .app-shell {
    grid-template-rows: auto auto auto;
    height: auto;
    min-height: 100vh;
    padding: 0 12px 12px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    min-height: 66px;
  }

  .era-readout {
    display: none;
  }

  .top-actions {
    gap: 4px;
  }

  .tool-button {
    padding: 0 8px;
  }

  .tool-button:nth-child(2) .sound-bars,
  .tool-button:nth-child(2) #muteLabel {
    display: inline;
  }

  .experience {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(430px, 61vh) auto;
    padding-top: 8px;
  }

  .map-panel {
    min-height: 430px;
  }

  .chronicle {
    min-height: 500px;
    max-height: none;
  }

  .event-copy {
    max-height: none;
    overflow: visible;
  }

  .time-deck {
    grid-template-rows: auto auto auto;
    margin-top: 12px;
    padding: 12px 10px 10px;
  }

  .time-deck-head {
    grid-template-columns: auto 1fr;
    row-gap: 8px;
  }

  .chapter-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .timeline-wrap {
    margin: 0;
  }

  .timeline-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
  }

  .progress-summary {
    min-width: 0;
    justify-content: flex-start;
  }

  .intro-screen {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .intro-content {
    grid-column: 1;
    padding: 8vh 3vw;
  }

  .intro-content h1 {
    font-size: clamp(62px, 20vw, 112px);
  }

  .intro-seal {
    display: none;
  }

  .intro-map-watermark {
    top: 38%;
    right: -25%;
    width: 108vw;
    height: 58vh;
    opacity: 0.38;
  }

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

  .archive-drawer {
    width: 100%;
  }

  .toast {
    bottom: 24px;
  }
}

@media (max-width: 620px) {
  .topbar {
    column-gap: 8px;
    min-width: 0;
  }

  .brand {
    min-width: 0;
  }

  .brand-copy small {
    display: none;
  }

  .brand-copy strong {
    font-size: 18px;
    white-space: nowrap;
  }

  .top-actions {
    min-width: 0;
  }

  .tool-button {
    font-size: 9px;
    white-space: nowrap;
  }

  .tool-button:nth-child(2) {
    display: flex;
    padding: 0 8px;
    font-size: 0;
  }

  .tool-button:nth-child(2)::after {
    content: "说明";
    font-size: 9px;
  }

  .archive-trigger .counter {
    display: none;
  }

  .sound-toggle {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .sound-toggle #muteLabel {
    display: none;
  }

  .experience {
    grid-template-rows: auto auto;
    min-width: 0;
  }

  .map-panel {
    min-height: 0;
    padding: 9px;
    min-width: 0;
  }

  .map-statline {
    grid-template-columns: minmax(0, 1fr) minmax(112px, 0.72fr);
    gap: 5px 11px;
    padding: 7px 8px 6px;
  }

  .national-casualty,
  .verified-casualty {
    gap: 0 5px;
    min-width: 0;
  }

  .national-casualty > span,
  .verified-casualty > span {
    overflow: hidden;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .national-casualty > strong {
    font-size: 21px;
  }

  .verified-casualty > strong {
    font-size: 16px;
  }

  .national-casualty > small,
  .verified-casualty > small {
    display: none;
  }

  .casualty-method {
    grid-column: 1 / -1;
    font-size: 6.8px;
    line-height: 1.45;
  }

  .map-frame {
    min-height: 258px;
    aspect-ratio: 1.38;
  }

  .map-heading h1 {
    font-size: 17px;
  }

  .map-heading p {
    display: none;
  }

  .map-legend {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-width: none;
    gap: 2px 8px;
    font-size: 7.5px;
  }

  .map-stamp {
    display: none;
  }

  .map-footnote {
    display: none;
  }

  .chronicle {
    min-height: 0;
    padding: 15px 13px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .event-copy,
  .event-narration,
  .lens-card p,
  .evidence-note p {
    overflow-wrap: anywhere;
  }

  .event-copy h2 {
    font-size: 29px;
  }

  .double-line {
    grid-template-columns: 1fr;
  }

  .year-lockup strong {
    font-size: 28px;
  }

  .playback-controls {
    gap: 4px;
  }

  .play-action {
    min-width: 106px;
    padding: 0 10px;
  }

  .chapter-nav {
    gap: 0;
    width: 100%;
    max-width: 100%;
  }

  .chapter-nav button {
    font-size: 8.5px;
    padding-right: 5px;
    padding-left: 5px;
  }

  .timeline-tick span {
    font-size: 7px;
  }

  .timeline-tick:not(.major) span {
    display: none;
  }

  .intro-screen {
    padding: 20px 15px;
  }

  .intro-content {
    padding: 7vh 0;
  }

  .intro-content h1 {
    gap: 5px;
    letter-spacing: 0;
  }

  .intro-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .intro-help {
    min-height: 44px;
  }

  .intro-vertical {
    display: none;
  }

  .modal-screen {
    padding: 12px;
  }

  .modal-card {
    max-height: calc(100vh - 24px);
    padding: 22px 17px;
  }

  .modal-card h2 {
    max-width: calc(100% - 55px);
    font-size: 27px;
  }

  .help-grid,
  .method-columns {
    grid-template-columns: 1fr;
  }

  .archive-drawer {
    padding: 20px 15px 14px;
  }

  .archive-entry summary {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 9px;
    padding: 9px 10px;
  }

  .archive-number {
    width: 36px;
    height: 36px;
  }

  .archive-state {
    display: none;
  }

  .archive-body {
    padding: 0 11px 12px;
  }

  .ending-actions {
    flex-direction: column;
    align-items: stretch;
    width: min(280px, 100%);
    margin: auto;
  }

  .history-tabs {
    width: 100%;
  }

  .history-tab {
    flex: 1;
    padding: 0 7px;
  }

  .battle-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .rare-filter {
    grid-column: 1 / -1;
    min-height: 30px;
  }

  .battle-entry summary {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 7px;
    padding: 7px 8px;
  }

  .battle-entry-title {
    font-size: 14px;
  }

  .battle-entry-body {
    padding: 0 10px 11px;
  }

  .phase-battle-strip {
    grid-template-columns: auto auto 1fr auto;
    gap: 5px;
    padding: 0 8px;
    font-size: 7.8px;
  }
}

@media (max-width: 900px) {
  .event-media-overlay {
    padding: 12px;
  }

  .event-media-card {
    grid-template-columns: 1fr;
    width: min(680px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
  }

  .media-stage {
    height: 42vh;
    min-height: 240px;
  }

  .event-media-card.has-secondary .media-stage {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
  }

  .media-copy {
    padding: 20px 18px 18px;
    border-top: 1px solid rgba(219, 191, 139, 0.15);
    border-left: 0;
  }

  .media-copy h2 {
    font-size: 28px;
  }

  .martyr-overlay {
    padding: 13px 12px 10px;
  }

  .martyr-field {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: minmax(110px, 1fr);
    overflow-y: auto;
  }

  .martyr-caption strong {
    font-size: 11px;
  }
}

@media (max-width: 620px) {
  .casualty-hud {
    top: 9px;
    left: 9px;
    min-width: 165px;
    padding: 7px 8px;
  }

  .casualty-hud-total {
    font-size: 18px;
  }

  .casualty-hud-sub {
    font-size: 6.5px;
  }

  .map-zoom-controls {
    top: 42px;
    right: 9px;
  }

  .map-zoom-controls button {
    width: 27px;
    height: 27px;
  }

  .media-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .media-actions > span {
    max-width: none;
  }

  .media-actions .primary-action {
    width: 100%;
  }

  .martyr-overlay {
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding: 10px 8px 8px;
  }

  .martyr-header h2 {
    font-size: 25px;
  }

  .martyr-header p:last-child {
    display: none;
  }

  .martyr-field {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 135px;
  }

  .martyr-caption strong {
    font-size: 10px;
  }

  .martyr-caption > span,
  .martyr-caption small {
    font-size: 6px;
  }

  .martyr-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .martyr-profile {
    padding: 10px;
  }

  .martyr-profile-folio {
    grid-template-columns: 1fr;
    width: min(430px, 95vw);
    max-height: 94vh;
    overflow-y: auto;
  }

  .martyr-profile-portrait {
    min-height: 230px;
    height: 250px;
  }

  .martyr-profile-copy {
    padding: 25px 20px 24px;
  }

  .martyr-profile-copy h3 {
    font-size: 36px;
  }

  .ending-content {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 16px);
  }

  .ending-content h2 {
    font-size: clamp(38px, 12vw, 54px);
  }

  .ending-eyebrow {
    margin-bottom: 8px;
  }

  .ending-rule {
    margin: 12px auto;
  }

  .ending-lead {
    margin-bottom: 10px;
    font-size: 13px;
  }

  .witness-card {
    margin-bottom: 8px;
    padding: 8px 10px;
  }

  .witness-seal {
    width: 38px;
    height: 38px;
  }

  .monument-scroll {
    margin-top: 3px;
  }

  .monument-window {
    height: 112px;
  }

  .monument-track {
    gap: 16px;
    font-size: 13.5px;
    line-height: 1.8;
  }

  .ending-finale {
    min-height: 136px;
  }

  .ending-final-title {
    font-size: clamp(50px, 16vw, 70px);
  }
}

@media (max-height: 820px) {
  .ending-content {
    max-height: calc(100vh - 12px);
    padding: 6px 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(204, 180, 135, 0.28) transparent;
  }

  .ending-content h2 {
    font-size: clamp(42px, 5.5vw, 64px);
  }

  .ending-eyebrow {
    margin-bottom: 8px;
  }

  .ending-rule {
    margin: 12px auto;
  }

  .ending-lead {
    margin-bottom: 10px;
    font-size: 14px;
  }

  .witness-card {
    margin-bottom: 8px;
    padding: 8px 12px;
  }

  .monument-scroll {
    margin-top: 3px;
  }

  .monument-window {
    height: 106px;
  }

  .ending-finale {
    min-height: 134px;
  }

  .ending-final-title {
    font-size: clamp(54px, 7vw, 84px);
  }
}

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

  .martyr-card {
    opacity: 1 !important;
    transform: none !important;
    animation-delay: 0s !important;
  }

  .monument-track {
    transform: none !important;
    animation: none !important;
  }

  .ending-finale {
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
