:root {
  color-scheme: light;
  --history-page: #f4f5f3;
  --history-surface: #ffffff;
  --history-surface-soft: #f8f8f6;
  --history-ink: #20221f;
  --history-muted: #666a63;
  --history-faint: #858982;
  --history-line: #dcddd8;
  --history-accent: #9a4b3d;
  --history-accent-strong: #79382e;
  --history-accent-soft: #f1e3df;
  --history-on-accent: #fffaf8;
  --history-ruler: #c7897b;
  --history-ruler-ink: #2d1713;
  --history-guide: #b6a489;
  --history-focus: #6d4035;
  --history-shadow: 0 10px 25px rgb(35 29 27 / 0.06);
  --history-radius: 10px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --history-page: #191918;
  --history-surface: #232220;
  --history-surface-soft: #2a2826;
  --history-ink: #f1eee9;
  --history-muted: #bbb5ad;
  --history-faint: #918c85;
  --history-line: #45413c;
  --history-accent: #dfa394;
  --history-accent-strong: #f0b9ad;
  --history-accent-soft: #4a302c;
  --history-on-accent: #2a1b18;
  --history-ruler: #e2aa9e;
  --history-ruler-ink: #321b17;
  --history-guide: #baa780;
  --history-focus: #f0b9ad;
  --history-shadow: 0 10px 25px rgb(0 0 0 / 0.2);
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body.history-page {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--history-page);
  color: var(--history-ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

button,
input { font: inherit; }

button,
a,
input { touch-action: manipulation; }

.history-shell { min-height: 100dvh; }

.history-page .site-header {
  border-bottom: 1px solid var(--history-line);
}

.history-main {
  width: min(1680px, calc(100% - 64px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.history-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 29px;
}

.history-intro h1,
.history-intro p,
.timeline-heading h2,
.timeline-heading p,
.history-detail-section h2,
.history-detail-section p,
.history-notes h2,
.history-notes p { margin-top: 0; }

.history-intro h1 {
  margin-bottom: 8px;
  color: var(--history-ink);
  font-size: clamp(2.15rem, 4.5vw, 3.6rem);
  font-weight: 690;
  letter-spacing: -0.055em;
  line-height: 1.1;
}

.history-intro > div > p {
  max-width: 37rem;
  margin-bottom: 0;
  color: var(--history-muted);
  font-size: 1rem;
}

.history-coverage {
  max-width: 20rem;
  margin: 0;
  color: var(--history-muted);
  font-size: 0.83rem;
  text-align: right;
}

.history-controls {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 20px 28px;
  padding: 20px 22px;
  border: 1px solid var(--history-line);
  border-radius: var(--history-radius);
  background: var(--history-surface);
  box-shadow: var(--history-shadow);
}

.control-search,
.control-periods,
.control-zoom,
.control-jump { min-width: 0; }

.control-search label,
.control-label,
.control-jump > label {
  display: block;
  margin-bottom: 7px;
  color: var(--history-muted);
  font-size: 0.77rem;
  font-weight: 700;
}

.control-search input,
.control-jump input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--history-line);
  border-radius: 7px;
  background: var(--history-surface-soft);
  color: var(--history-ink);
  outline: 0;
}

.control-search input { padding: 0 12px; }

.control-search input::placeholder,
.control-jump input::placeholder { color: var(--history-faint); }

.control-search input:focus,
.control-jump input:focus {
  border-color: var(--history-accent);
  box-shadow: 0 0 0 3px var(--history-accent-soft);
}

.control-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.control-button-row button,
.control-jump button,
.timeline-error button,
.timeline-empty button {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--history-line);
  border-radius: 7px;
  background: var(--history-surface);
  color: var(--history-ink);
  cursor: pointer;
  font-size: 0.82rem;
  white-space: nowrap;
}

.control-button-row button:hover,
.control-jump button:hover,
.timeline-error button:hover,
.timeline-empty button:hover {
  border-color: var(--history-accent);
  color: var(--history-accent-strong);
}

.control-button-row button[aria-pressed="true"] {
  border-color: var(--history-accent);
  background: var(--history-accent-soft);
  color: var(--history-accent-strong);
  font-weight: 700;
}

.control-button-row button:active,
.control-jump button:active,
.timeline-error button:active,
.timeline-empty button:active { transform: translateY(1px); }

.control-bottom-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 26px;
  padding-top: 3px;
}

.control-jump { width: min(100%, 290px); }

.control-jump > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }

.control-jump input { padding: 0 10px; }

.control-jump button {
  border-color: var(--history-accent);
  background: var(--history-accent);
  color: var(--history-on-accent);
  font-weight: 700;
}

.control-jump button:hover { background: var(--history-accent-strong); color: var(--history-on-accent); }

.control-jump p {
  margin: 5px 0 0;
  color: var(--history-faint);
  font-size: 0.72rem;
}

.timeline-section { margin-top: 48px; }

.timeline-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: 14px;
}

.timeline-heading h2,
.history-detail-section h2,
.history-notes h2 {
  margin-bottom: 5px;
  color: var(--history-ink);
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
  font-weight: 690;
  letter-spacing: -0.04em;
  line-height: 1.25;
}

.timeline-heading p,
.history-detail-section header p,
.history-notes p {
  margin-bottom: 0;
  color: var(--history-muted);
  font-size: 0.86rem;
}

.timeline-year-readout {
  display: grid;
  gap: 2px;
  min-width: 135px;
  color: var(--history-muted);
  font-size: 0.7rem;
  text-align: right;
}

.timeline-year-readout strong {
  color: var(--history-accent-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 13px 18px;
  margin-bottom: 12px;
  color: var(--history-muted);
  font-size: 0.75rem;
}

.timeline-legend span { display: inline-flex; align-items: center; gap: 6px; }

.timeline-legend i { display: inline-block; flex: 0 0 auto; }

.legend-dynasty { width: 24px; height: 9px; border-radius: 2px; background: linear-gradient(90deg, #a75b4b 0 25%, #608467 25% 50%, #5c78a5 50% 75%, #b48746 75%); }
.legend-ruler { width: 18px; height: 7px; border: 1px solid var(--history-accent-strong); background: var(--history-ruler); }
.legend-guide { width: 18px; border-top: 1px dashed var(--history-guide); }

.timeline-loading,
.timeline-error,
.timeline-empty {
  min-height: 160px;
  padding: 23px;
  border: 1px solid var(--history-line);
  border-radius: var(--history-radius);
  background: var(--history-surface);
}

.timeline-loading { display: grid; align-content: start; gap: 14px; }

.skeleton { display: block; height: 12px; border-radius: 5px; background: var(--history-surface-soft); }
.skeleton-heading { width: 23%; height: 18px; }
.skeleton-long { width: 88%; }
.skeleton-short { width: 46%; }

@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: history-skeleton 1.45s ease-in-out infinite alternate; }
  @keyframes history-skeleton { from { opacity: 0.55; } to { opacity: 1; } }
}

.timeline-error,
.timeline-empty { display: grid; align-content: center; justify-items: start; gap: 12px; }
.timeline-error p,
.timeline-empty p { margin: 0; color: var(--history-muted); }

.timeline-stage { min-width: 0; }

.timeline-help {
  margin: 0 0 10px;
  color: var(--history-muted);
  font-size: 0.78rem;
}

.timeline-viewport {
  max-width: 100%;
  height: clamp(360px, 68dvh, 760px);
  overflow: auto;
  cursor: grab;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y pinch-zoom;
  scrollbar-gutter: stable;
  border: 1px solid var(--history-line);
  border-radius: var(--history-radius);
  background: var(--history-surface);
  scrollbar-color: var(--history-faint) var(--history-surface-soft);
}

.timeline-viewport.is-dragging,
.timeline-viewport.is-dragging * { cursor: grabbing !important; user-select: none; }

.timeline-viewport:focus-visible { outline: 3px solid var(--history-accent); outline-offset: 4px; }

.timeline-canvas {
  --axis-width: 70px;
  --lane-width: 160px;
  position: relative;
  display: grid;
  grid-template-columns: var(--axis-width) auto;
  min-width: 100%;
  min-height: 100%;
  background: var(--history-surface);
}

.timeline-axis {
  position: sticky;
  z-index: 5;
  left: 0;
  grid-column: 1;
  min-width: var(--axis-width);
  min-height: 100%;
  border-right: 1px solid var(--history-line);
  background: var(--history-surface);
}

.timeline-axis-label {
  position: absolute;
  top: 8px;
  right: 11px;
  color: var(--history-faint);
  font-size: 0.66rem;
}

.timeline-tick-label {
  position: absolute;
  right: 10px;
  width: calc(var(--axis-width) - 12px);
  transform: translateY(-50%);
  color: var(--history-muted);
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: right;
}

/* Keep boundary labels inside the plot and clear of the axis heading. */
.timeline-axis-label { display: none; }
.timeline-axis > .timeline-tick-label:nth-child(2) { transform: none; }
.timeline-axis > .timeline-tick-label:last-child:not(:nth-child(2)) { transform: translateY(-100%); }

.timeline-grid-lines {
  position: absolute;
  z-index: 1;
  inset: 0 0 0 var(--axis-width);
  pointer-events: none;
}

.timeline-tick-line {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px solid var(--history-line);
  opacity: 0.7;
}

.timeline-guide {
  position: absolute;
  z-index: 4;
  right: 0;
  left: var(--axis-width);
  border-top: 1px dashed var(--history-guide);
  pointer-events: none;
}

.timeline-lanes {
  position: relative;
  z-index: 2;
  display: grid;
  grid-column: 2;
  grid-template-columns: repeat(var(--lane-count), var(--lane-width));
  gap: 6px;
  min-height: inherit;
  padding: 0 6px;
}

.timeline-lane {
  position: relative;
  min-width: var(--lane-width);
  min-height: inherit;
  background: linear-gradient(90deg, transparent 0, transparent 9px, var(--history-surface-soft) 9px, var(--history-surface-soft) 10px, transparent 10px);
}

.dynasty-card {
  position: absolute;
  right: 0;
  left: 0;
  min-height: 1px;
}

.dynasty-card,
.timeline-current-cell {
  --dynasty-color: hsl(var(--dynasty-hue, 10) 58% 28%);
  --dynasty-soft: hsl(var(--dynasty-hue, 10) 55% 95%);
  --dynasty-ruler: hsl(var(--dynasty-hue, 10) 58% 87%);
  --dynasty-ink: hsl(var(--dynasty-hue, 10) 65% 19%);
}

[data-theme="dark"] .dynasty-card,
[data-theme="dark"] .timeline-current-cell {
  --dynasty-color: hsl(var(--dynasty-hue, 10) 65% 72%);
  --dynasty-soft: hsl(var(--dynasty-hue, 10) 25% 16%);
  --dynasty-ruler: hsl(var(--dynasty-hue, 10) 32% 24%);
  --dynasty-ink: hsl(var(--dynasty-hue, 10) 60% 88%);
}

.dynasty-band {
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in srgb, var(--dynasty-color) 45%, var(--history-line));
  border-top: 4px solid var(--dynasty-color);
  border-radius: 5px;
  background: var(--dynasty-soft);
}

.dynasty-select {
  position: absolute;
  z-index: 3;
  top: 5px;
  right: 4px;
  left: 4px;
  width: calc(100% - 8px);
  height: 40px;
  padding: 2px 5px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--dynasty-color);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.3;
  text-align: left;
}

.dynasty-select:hover,
.dynasty-select:focus-visible { background: var(--dynasty-ruler); text-decoration: underline; text-underline-offset: 2px; }
.dynasty-name, .dynasty-years { display: block; }
.dynasty-years { margin-top: 2px; color: var(--dynasty-ink); font-size: 0.63rem; font-weight: 500; }
.dynasty-card.is-selected .dynasty-band { box-shadow: inset 0 0 0 2px var(--dynasty-color); }
.dynasty-card.is-selected .dynasty-select { background: var(--dynasty-color); color: var(--history-surface); }
.dynasty-card.is-selected .dynasty-years { color: inherit; }

.ruler-duration {
  position: absolute;
  z-index: 1;
  width: 2px;
  min-height: 1px;
  background: var(--dynasty-color);
  opacity: 0.55;
  pointer-events: none;
}

.ruler-bar {
  position: absolute;
  z-index: 2;
  left: 6px;
  width: calc(100% - 10px);
  height: 64px;
  padding: 4px 5px;
  overflow: hidden;
  border: 0;
  border-bottom: 2px solid var(--dynasty-soft);
  border-left: 3px solid var(--dynasty-color);
  border-radius: 2px;
  background: var(--dynasty-ruler);
  color: var(--dynasty-ink);
  cursor: pointer;
  text-align: left;
}

.ruler-bar:hover,
.ruler-bar:focus-visible { z-index: 4; outline: 2px solid var(--dynasty-color); outline-offset: -2px; filter: brightness(0.97); }
.ruler-bar span { display: block; }
.ruler-polity { font-size: 0.58rem; line-height: 11px; opacity: 0.85; }
.ruler-label { font-size: 0.74rem; font-weight: 720; line-height: 14px; overflow-wrap: anywhere; }
.ruler-years { margin-top: 2px; font-size: 0.65rem; line-height: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.timeline-current {
  position: relative;
  height: 112px;
  overflow: hidden;
  border: 1px solid var(--history-line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--history-surface-soft);
}
.timeline-current + .timeline-viewport { border-radius: 0 0 var(--history-radius) var(--history-radius); }
.timeline-current-year {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 0;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 5px;
  border-right: 1px solid var(--history-line);
  background: var(--history-surface);
  color: var(--history-muted);
  font-size: 0.65rem;
  text-align: center;
}
.timeline-current-year strong { color: var(--history-ink); }
.timeline-current-track { position: relative; height: 100%; }
.timeline-current-cell {
  position: absolute;
  top: 5px;
  bottom: 5px;
  padding: 5px 6px;
  overflow-y: auto;
  overflow-wrap: anywhere;
  border-top: 3px solid var(--dynasty-color);
  border-radius: 3px;
  background: var(--dynasty-soft);
  color: var(--dynasty-ink);
  scrollbar-width: thin;
  font-size: 0.7rem;
  line-height: 1.3;
}
.timeline-current-cell h3 { margin: 0 0 3px; color: var(--dynasty-color); font-size: 0.74rem; }
.timeline-current-cell p { margin: 0; }
.timeline-current-cell p + p { margin-top: 5px; }
.timeline-current-cell small { display: block; margin-top: 1px; font-size: 0.63rem; font-variant-numeric: tabular-nums; }

.timeline-navigator {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto minmax(105px, auto);
  align-items: center;
  gap: 12px;
  margin: 14px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--history-line);
  border-radius: 8px;
  background: var(--history-surface);
}
.timeline-navigator button {
  padding: 5px 10px;
  border: 1px solid var(--history-line);
  border-radius: 5px;
  background: var(--history-surface-soft);
  color: var(--history-ink);
  cursor: pointer;
  font-size: 0.75rem;
}
.timeline-navigator input { min-width: 0; width: 100%; margin: 0; accent-color: var(--history-accent); cursor: pointer; }
.timeline-navigator output { color: var(--history-muted); font-size: 0.74rem; text-align: right; font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.history-detail-section {
  display: grid;
  grid-template-columns: minmax(190px, 0.42fr) minmax(0, 1.58fr);
  gap: 32px;
  margin-top: 47px;
  padding: 25px 0 0;
  border-top: 1px solid var(--history-line);
}

.history-detail { min-width: 0; }

.detail-placeholder { margin: 0; color: var(--history-muted); }

.detail-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 18px;
  margin-bottom: 19px;
  padding: 18px;
  border: 1px solid var(--history-line);
  border-radius: var(--history-radius);
  background: var(--history-surface);
}

.detail-summary h3,
.detail-summary p,
.detail-ruler h4,
.detail-ruler p,
.detail-unknown h3,
.detail-unknown p { margin-top: 0; }

.detail-summary h3 {
  margin-bottom: 4px;
  color: var(--history-ink);
  font-size: 1.2rem;
  letter-spacing: -0.025em;
}

.detail-summary p { margin-bottom: 0; color: var(--history-muted); font-size: 0.84rem; }

.detail-link,
.history-notes a,
.history-sources a {
  color: var(--history-accent-strong);
  text-underline-offset: 3px;
}

.detail-link { align-self: start; font-size: 0.8rem; font-weight: 700; }

.detail-actions { display: grid; justify-items: end; gap: 9px; }

.detail-return {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--history-line);
  border-radius: 7px;
  background: var(--history-surface-soft);
  color: var(--history-accent-strong);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.detail-return:hover { border-color: var(--history-accent); }
.detail-return:active { transform: translateY(1px); }

.detail-handoffs {
  margin: 0 0 19px;
  padding: 11px 13px;
  border-left: 3px solid var(--history-accent);
  background: var(--history-accent-soft);
  color: var(--history-muted);
  font-size: 0.8rem;
}

.detail-handoffs strong { color: var(--history-accent-strong); }

.detail-rulers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.detail-ruler {
  padding: 14px;
  border: 1px solid var(--history-line);
  border-radius: var(--history-radius);
  background: var(--history-surface);
}

.detail-ruler h4 { margin-bottom: 4px; color: var(--history-ink); font-size: 0.95rem; }
.detail-ruler p { margin-bottom: 7px; color: var(--history-muted); font-size: 0.78rem; }
.detail-ruler ul { margin: 0; padding-left: 18px; color: var(--history-muted); font-size: 0.76rem; }
.detail-ruler li + li { margin-top: 3px; }

.detail-ruler a { color: var(--history-accent-strong); font-size: 0.76rem; text-underline-offset: 3px; }

.detail-unknown {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--history-line);
  border-radius: var(--history-radius);
  background: var(--history-surface-soft);
}

.detail-unknown h3 { margin-bottom: 5px; color: var(--history-ink); font-size: 0.92rem; }
.detail-unknown p { margin-bottom: 0; color: var(--history-muted); font-size: 0.78rem; }
.detail-unknown ul { margin: 10px 0 0; padding-left: 18px; color: var(--history-muted); font-size: 0.78rem; }

.history-notes {
  margin-top: 46px;
  padding-top: 24px;
  border-top: 1px solid var(--history-line);
}

.history-notes h2 { margin-bottom: 10px; }
.history-notes p { max-width: 800px; margin-bottom: 9px; }

.history-sources { margin: 14px 0 0; padding-left: 19px; color: var(--history-muted); font-size: 0.79rem; }
.history-sources li + li { margin-top: 4px; }
.history-data-notes { margin: 14px 0 0; padding-left: 19px; color: var(--history-muted); font-size: 0.79rem; }
.history-data-notes li + li { margin-top: 4px; }

.history-footer {
  display: flex;
  justify-content: space-between;
  width: min(1680px, calc(100% - 64px));
  margin: 0 auto;
  padding: 22px 0 30px;
  border-top: 1px solid var(--history-line);
  color: var(--history-faint);
  font-size: 0.77rem;
}

.history-footer a { color: var(--history-muted); text-underline-offset: 3px; }

.history-noscript {
  width: min(1680px, calc(100% - 64px));
  margin: 0 auto 32px;
  color: var(--history-muted);
}

.history-page :is(a, button, input):focus-visible { outline: 3px solid var(--history-accent); outline-offset: 3px; }

[hidden] { display: none !important; }

@media (max-width: 840px) {
  .history-main,
  .history-footer,
  .history-noscript { width: min(100% - 40px, 1680px); }

  .history-controls { grid-template-columns: 1fr; }
  .control-bottom-row { grid-column: auto; }
  .control-periods { grid-row: 2; }
}

@media (max-width: 700px) {
  .history-main { padding: 31px 0 46px; }
  .history-intro { display: block; padding-bottom: 23px; }
  .history-intro h1 { font-size: 2.25rem; }
  .history-coverage { max-width: none; margin-top: 11px; text-align: left; }
  .history-controls { gap: 11px; padding: 14px; }
  .control-search label { margin-bottom: 4px; }
  .control-search input { min-height: 38px; }
  .control-periods,
  .control-zoom,
  .control-jump {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
  }
  .control-periods { position: relative; }
  .control-periods .control-label,
  .control-zoom .control-label,
  .control-jump > label { margin: 0; }
  .control-periods .control-button-row {
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-color: var(--history-faint) var(--history-surface-soft);
    scrollbar-width: thin;
  }
  .control-periods .control-button-row::after { content: ""; flex: 0 0 4px; }
  .control-periods .control-button-row::-webkit-scrollbar { height: 4px; }
  .control-periods .control-button-row::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--history-faint); }
  .control-periods .control-button-row button,
  .control-zoom .control-button-row button { flex: 0 0 auto; min-height: 32px; padding: 6px 9px; }
  .control-periods::after {
    position: absolute;
    right: 1px;
    bottom: 0;
    padding-left: 8px;
    background: linear-gradient(90deg, transparent, var(--history-surface) 35%);
    color: var(--history-faint);
    content: "横滑";
    font-size: 0.62rem;
    pointer-events: none;
  }
  .control-bottom-row { display: grid; align-items: start; gap: 10px; }
  .control-jump { width: 100%; }
  .control-jump > div { min-width: 0; }
  .control-jump input { min-height: 32px; }
  .control-jump button { min-height: 32px; padding: 6px 10px; }
  .control-jump p {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .control-jump p.has-feedback {
    position: static;
    grid-column: 2;
    width: auto;
    height: auto;
    margin: -4px 0 0;
    overflow: visible;
    clip: auto;
    color: var(--history-accent-strong);
    white-space: normal;
  }
  .timeline-section { margin-top: 36px; }
  .timeline-heading { display: block; }
  .timeline-year-readout { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin-top: 10px; text-align: left; }
  .timeline-canvas { --axis-width: 62px; --lane-width: 128px; }
  .timeline-axis-label { right: 7px; }
  .timeline-tick-label { right: 5px; width: 52px; font-size: 0.63rem; }
  .timeline-navigator { grid-template-columns: auto minmax(60px, 1fr) auto; gap: 8px; }
  .timeline-navigator output { grid-column: 1 / -1; text-align: center; }
  .history-detail-section { grid-template-columns: 1fr; gap: 17px; margin-top: 35px; }
  .detail-summary { grid-template-columns: 1fr; }
  .detail-actions { justify-items: start; grid-template-columns: repeat(2, max-content); align-items: center; }
  .history-notes { margin-top: 36px; }
  .history-footer { padding-bottom: 24px; }
}

@media (max-width: 430px) {
  .history-main,
  .history-footer,
  .history-noscript { width: min(100% - 32px, 1680px); }
  .control-button-row { gap: 6px; }
  .control-button-row button { padding-right: 9px; padding-left: 9px; }
  .timeline-legend { gap: 8px 12px; }
  .detail-rulers { grid-template-columns: 1fr; }
  .history-footer { display: grid; gap: 6px; }
}

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