:root {
  --paper: #ece8de;
  --paper-bright: #f5f2ea;
  --paper-deep: #ded8cb;
  --ink: #1f1e1b;
  --ink-soft: #5c5851;
  --ink-faint: #8b857b;
  --rule: #bdb6a9;
  --rule-dark: #7a756d;
  --imported: #2f7380;
  --transformed: #b3463d;
  --fictional: #94763a;
  --imagined: #6e628d;
  --keith: #bd493f;
  --lianne: #2f727a;
  --hammad: #85703d;
  --topbar-h: 64px;
  --timeline-h: 112px;
  --left-w: 304px;
  --right-w: 352px;
  --sans: Inter, "Segoe UI", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Songti SC", STSong, "Noto Serif CJK SC", "Source Han Serif SC", serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--transformed);
  outline-offset: 2px;
}

.app-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--timeline-h);
  background: var(--paper);
}

.topbar {
  min-width: 0;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--ink);
  background: var(--paper-bright);
  z-index: 30;
}

.brand-block {
  min-width: 390px;
  display: grid;
  grid-template-columns: 94px max-content 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
}

.brand-index,
.section-index,
.section-label,
.story-index,
.story-scope,
.detail-kicker,
.chapter-readout span {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand-title {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-subtitle {
  align-self: center;
  padding-left: 16px;
  border-left: 1px solid var(--rule);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 13px;
  white-space: nowrap;
}

.topbar-metrics {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  padding: 0 20px;
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

.topbar-metrics strong {
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.network-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--imported);
}

.network-status.is-offline .status-dot {
  background: var(--fictional);
}

.topbar-actions {
  display: flex;
  align-items: stretch;
  border-left: 1px solid var(--rule);
}

.icon-button,
.map-button,
.play-button,
.text-icon-button,
.clear-search,
.mobile-details-close {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.icon-button {
  width: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--rule);
}

.icon-button:hover,
.text-icon-button:hover,
.play-button:hover {
  background: var(--paper-deep);
}

.icon-button svg,
.text-icon-button svg,
.play-button svg,
.clear-search svg,
.mobile-details-close svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.7;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w);
  overflow: hidden;
}

.explorer-panel,
.detail-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-dark) transparent;
  background: var(--paper-bright);
  z-index: 20;
}

.explorer-panel {
  border-right: 1px solid var(--ink);
}

.detail-panel {
  border-left: 1px solid var(--ink);
}

.panel-heading {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--rule);
}

.panel-heading h1,
.detail-panel h2,
.story-caption h2,
.dialog-header h2 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-weight: 700;
}

.panel-heading h1 {
  font-size: 21px;
}

.explorer-section {
  padding: 15px 20px;
  border-bottom: 1px solid var(--rule);
}

.thesis-block p {
  margin: 0;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.8;
}

.active-summary {
  margin-top: 11px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.6;
}

.section-label {
  display: block;
  margin-bottom: 10px;
}

.segmented-control {
  width: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid var(--rule-dark);
}

.segment {
  min-width: 0;
  min-height: 31px;
  padding: 5px 8px;
  border: 0;
  border-right: 1px solid var(--rule-dark);
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  cursor: pointer;
  white-space: normal;
}

.segment:last-child {
  border-right: 0;
}

.segment.is-active {
  background: var(--ink);
  color: var(--paper-bright);
}

.type-filter-list,
.relation-filter-list {
  display: grid;
  gap: 5px;
}

.filter-check {
  min-height: 30px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 12px;
}

.filter-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-swatch {
  width: 10px;
  height: 10px;
  border: 1px solid var(--ink);
}

.filter-check input:not(:checked) + .filter-swatch {
  background: transparent !important;
}

.filter-count {
  color: var(--ink-faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.character-filter-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.character-button {
  min-height: 33px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.character-button.is-active {
  border-color: var(--ink);
  background: var(--paper-deep);
}

.character-line {
  width: 15px;
  height: 3px;
  background: var(--ink);
}

.relation-filter-list .filter-check {
  grid-template-columns: 20px minmax(0, 1fr) auto;
}

.relation-line {
  width: 18px;
  height: 2px;
  background: var(--ink-soft);
}

.relation-line.memory {
  background: repeating-linear-gradient(90deg, var(--ink-soft) 0 5px, transparent 5px 8px);
}

.relation-line.projected {
  background: repeating-linear-gradient(90deg, var(--ink-soft) 0 2px, transparent 2px 5px);
}

.switch-row {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 11px;
  cursor: pointer;
}

.switch-row input,
.scope-toggle input {
  position: absolute;
  opacity: 0;
}

.switch-track {
  position: relative;
  width: 34px;
  height: 18px;
  flex: 0 0 auto;
  border: 1px solid var(--rule-dark);
  background: var(--paper);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  background: var(--ink-soft);
  transition: transform 180ms ease;
}

input:checked + .switch-track::after {
  transform: translateX(16px);
  background: var(--transformed);
}

.search-section {
  padding-bottom: 24px;
}

.search-box {
  height: 36px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 26px;
  align-items: center;
  border-bottom: 1px solid var(--ink);
}

.search-box > svg {
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
}

.search-box input {
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.clear-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.search-box:focus-within .clear-search,
.clear-search.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.search-results {
  display: grid;
  margin-top: 8px;
}

.search-result {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-result-id {
  color: var(--ink-faint);
  font-size: 9px;
}

.search-result strong,
.search-result small {
  display: block;
  overflow-wrap: anywhere;
}

.search-result strong {
  font-family: var(--serif);
  font-size: 12px;
}

.search-result small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #d8d5cb;
}

.map-canvas {
  position: absolute;
  inset: 0;
}

.map-frame {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(31, 30, 27, 0.32);
  pointer-events: none;
  z-index: 4;
}

.map-frame::before,
.map-frame::after {
  content: "";
  position: absolute;
  width: 44px;
  height: 1px;
  background: var(--transformed);
}

.map-frame::before {
  top: 23%;
  left: -12px;
}

.map-frame::after {
  right: -12px;
  bottom: 29%;
}

.map-tools {
  position: absolute;
  top: 24px;
  right: 24px;
  display: grid;
  border: 1px solid var(--ink);
  background: var(--paper-bright);
  z-index: 8;
}

.map-button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--rule);
}

.map-button:last-child {
  border-bottom: 0;
}

.story-caption {
  position: absolute;
  left: 28px;
  bottom: 26px;
  width: min(390px, calc(100% - 100px));
  padding: 17px 18px 15px;
  border-top: 2px solid var(--transformed);
  background: rgba(245, 242, 234, 0.94);
  box-shadow: 0 8px 28px rgba(31, 30, 27, 0.14);
  z-index: 8;
}

.story-caption-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.story-caption h2 {
  font-size: 23px;
}

.story-caption p {
  margin: 8px 0 12px;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.65;
}

.story-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 15px;
  padding-top: 9px;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 10px;
}

.story-stats strong {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.map-legend {
  position: absolute;
  top: 24px;
  left: 24px;
  display: grid;
  gap: 6px;
  padding: 10px 11px;
  border-left: 1px solid var(--ink);
  background: rgba(245, 242, 234, 0.9);
  color: var(--ink-soft);
  font-size: 10px;
  z-index: 8;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-density {
  display: grid;
  grid-template-columns: auto 92px auto;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11px;
}

.legend-density-ramp {
  width: 92px;
  height: 8px;
  border: 1px solid rgba(31, 30, 27, 0.18);
  background: linear-gradient(90deg, rgba(47, 115, 128, 0.25), #2f7380 38%, #9d7a2f 62%, #b94137 82%, #1f1e1b);
}

.legend-mark {
  width: 9px;
  height: 9px;
  border: 1px solid var(--ink);
}

.map-toast {
  position: absolute;
  top: 24px;
  left: 50%;
  max-width: min(360px, 70%);
  padding: 9px 13px;
  transform: translate(-50%, -14px);
  background: var(--ink);
  color: var(--paper-bright);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 12;
}

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

.node-marker {
  --marker-size: 22px;
  position: relative;
  width: var(--marker-size);
  height: var(--marker-size);
  padding: 0;
  border: 2px solid var(--paper-bright);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(31, 30, 27, 0.75), 0 3px 10px rgba(31, 30, 27, 0.24);
  cursor: pointer;
  transition: width 180ms ease, height 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.node-marker::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--paper-bright);
}

.node-marker:hover,
.node-marker:focus-visible,
.node-marker.is-selected {
  z-index: 20;
  transform: scale(1.18);
}

.node-marker.is-approximate {
  border-style: dashed;
}

.node-marker.is-hidden {
  display: none;
}

.marker-tooltip {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  min-width: 130px;
  max-width: 220px;
  padding: 8px 10px;
  transform: translateX(-50%);
  border: 1px solid var(--ink);
  background: var(--paper-bright);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1.45;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.marker-tooltip strong {
  display: block;
  font-family: var(--serif);
  font-size: 12px;
}

.node-marker:hover .marker-tooltip,
.node-marker:focus-visible .marker-tooltip {
  opacity: 1;
}

.detail-empty,
.detail-content {
  min-width: 0;
  padding: 24px 22px 36px;
}

.detail-empty h2,
.detail-content h2 {
  margin-top: 6px;
  font-size: 25px;
  overflow-wrap: anywhere;
}

.detail-empty p {
  margin: 18px 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.8;
}

.empty-rule {
  width: 58px;
  height: 2px;
  margin-top: 16px;
  background: var(--transformed);
}

.global-composition,
.detail-composition {
  margin-top: 24px;
}

.composition-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 11px;
}

.composition-label {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.composition-bar {
  grid-column: 1 / -1;
  height: 3px;
  background: var(--paper-deep);
}

.composition-fill {
  height: 100%;
}

.detail-kicker {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 13px;
  margin-top: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 10px;
}

.detail-composition .type-strip {
  display: flex;
  width: 100%;
  height: 8px;
  border: 1px solid var(--ink);
}

.type-strip span {
  min-width: 2px;
}

.type-strip-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 13px;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 10px;
}

.detail-navigation {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.text-icon-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  font-size: 11px;
}

.detail-position,
#detailPosition {
  color: var(--ink-faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.evidence-list {
  display: grid;
}

.evidence-item {
  padding: 17px 0 18px;
  border-bottom: 1px solid var(--rule);
}

.evidence-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.evidence-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 10px;
}

.evidence-type::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--type-color);
}

.evidence-source {
  color: var(--ink-faint);
  font-size: 9px;
  text-align: right;
}

.evidence-actors {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 10px;
}

.evidence-function {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.6;
}

.evidence-quote {
  margin: 12px 0 0;
  padding-left: 13px;
  border-left: 2px solid var(--type-color);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.75;
}

.timeline-panel {
  min-width: 0;
  display: grid;
  grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w);
  border-top: 1px solid var(--ink);
  background: var(--paper-bright);
  z-index: 28;
}

.timeline-primary {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  border-right: 1px solid var(--ink);
}

.play-button {
  width: 56px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--rule);
}

.chapter-readout {
  min-width: 0;
  padding: 0 14px;
}

.chapter-readout strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-toggle {
  min-width: 64px;
  display: grid;
  justify-items: center;
  gap: 7px;
  padding-right: 12px;
  color: var(--ink-soft);
  font-size: 10px;
  cursor: pointer;
}

.timeline-track-wrap {
  position: relative;
  min-width: 0;
  padding: 7px 18px 19px;
}

.timeline-chart {
  width: 100%;
  height: 76px;
}

.timeline-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chapter-slider {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 10px;
  width: calc(100% - 36px);
  height: 10px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.chapter-slider::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--rule-dark);
}

.chapter-slider::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -5px;
  appearance: none;
  border: 2px solid var(--paper-bright);
  border-radius: 50%;
  background: var(--transformed);
  box-shadow: 0 0 0 1px var(--ink);
}

.chapter-slider::-moz-range-track {
  height: 1px;
  background: var(--rule-dark);
}

.chapter-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid var(--paper-bright);
  border-radius: 50%;
  background: var(--transformed);
  box-shadow: 0 0 0 1px var(--ink);
}

.timeline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-left: 1px solid var(--ink);
}

.timeline-actions .icon-button {
  width: 100%;
  border-left: 0;
  border-right: 1px solid var(--rule);
}

.timeline-actions .icon-button:last-child {
  border-right: 0;
}

.archive-dialog {
  width: min(860px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper-bright);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(31, 30, 27, 0.24);
}

.archive-dialog::backdrop {
  background: rgba(31, 30, 27, 0.55);
}

.dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: inherit;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding-left: 22px;
  border-bottom: 1px solid var(--ink);
}

.dialog-header h2 {
  font-size: 22px;
}

.dialog-header .icon-button {
  align-self: stretch;
  height: auto;
}

.dialog-body {
  overflow-y: auto;
  padding: 22px;
}

.method-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
}

.method-grid section {
  min-height: 180px;
  padding: 24px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.method-grid section:nth-child(2n) {
  border-right: 0;
}

.method-grid h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 17px;
}

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

.dialog-footer,
.table-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 22px;
  border-top: 1px solid var(--ink);
  color: var(--ink-soft);
  font-size: 10px;
}

.data-dialog {
  width: min(1120px, calc(100vw - 32px));
}

.data-dialog .dialog-shell {
  grid-template-rows: auto auto minmax(0, 1fr);
  height: min(760px, calc(100vh - 32px));
}

.table-toolbar {
  justify-content: space-between;
  border-top: 0;
  border-bottom: 1px solid var(--rule);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

th,
td {
  padding: 10px 12px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: var(--ink);
  color: var(--paper-bright);
  font-size: 10px;
  z-index: 1;
}

td {
  max-width: 260px;
  overflow-wrap: anywhere;
}

.mobile-only,
.mobile-details-close {
  display: none;
}

.maplibregl-ctrl-attrib {
  background: rgba(245, 242, 234, 0.82) !important;
  color: var(--ink-soft) !important;
  font-family: var(--sans) !important;
  font-size: 9px !important;
}

.maplibregl-ctrl-attrib a {
  color: var(--ink) !important;
}

.maplibregl-canvas {
  outline: 0;
}

@media (max-width: 1180px) {
  :root {
    --left-w: 280px;
    --right-w: 320px;
  }

  .brand-block {
    min-width: 330px;
    grid-template-columns: 72px max-content;
  }

  .brand-subtitle,
  .topbar-metrics span:nth-child(2) {
    display: none;
  }
}

@media (max-width: 920px) {
  :root {
    --topbar-h: 56px;
    --timeline-h: 128px;
  }

  .mobile-only {
    display: inline-flex;
  }

  .app-shell {
    grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--timeline-h);
  }

  .topbar > .mobile-only {
    width: 48px;
    border-left: 0;
    border-right: 1px solid var(--rule);
  }

  .brand-block {
    min-width: 0;
    flex: 1;
    display: flex;
    gap: 10px;
    padding: 0 12px;
  }

  .brand-index,
  .topbar-metrics,
  .topbar-actions .icon-button:nth-child(1),
  .topbar-actions .icon-button:nth-child(2) {
    display: none;
  }

  .brand-title {
    font-size: 20px;
  }

  .topbar-actions .icon-button {
    width: 44px;
    min-width: 44px;
  }

  .workspace {
    display: block;
    position: relative;
  }

  .map-stage {
    width: 100%;
    height: 100%;
  }

  .explorer-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(330px, 88vw);
    transform: translateX(-101%);
    border-right: 1px solid var(--ink);
    box-shadow: 12px 0 30px rgba(31, 30, 27, 0.18);
    transition: transform 180ms ease;
  }

  .explorer-panel.is-open {
    transform: translateX(0);
  }

  .detail-panel {
    position: absolute;
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-height: 64%;
    transform: translateY(calc(100% + 20px));
    border: 1px solid var(--ink);
    box-shadow: 0 -12px 32px rgba(31, 30, 27, 0.2);
    transition: transform 180ms ease;
    z-index: 22;
  }

  .detail-panel.is-open {
    transform: translateY(0);
  }

  .mobile-details-close {
    position: absolute;
    right: 20px;
    bottom: calc(64% - 4px);
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ink);
    background: var(--paper-bright);
    opacity: 0;
    pointer-events: none;
    z-index: 25;
  }

  .detail-panel.is-open ~ .map-stage .mobile-details-close,
  .map-stage:has(+ .detail-panel.is-open) .mobile-details-close {
    opacity: 1;
    pointer-events: auto;
  }

  .story-caption {
    left: 16px;
    bottom: 16px;
    width: min(360px, calc(100% - 82px));
    padding: 13px 14px;
  }

  .story-caption h2 {
    font-size: 19px;
  }

  .story-caption p {
    font-size: 12px;
    line-height: 1.55;
  }

  .map-legend {
    top: 16px;
    left: 16px;
  }

  .map-tools {
    top: 16px;
    right: 16px;
  }

  .timeline-panel {
    grid-template-columns: 156px minmax(0, 1fr) 92px;
  }

  .timeline-primary {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .play-button {
    width: 46px;
  }

  .scope-toggle {
    display: none;
  }
}

@media (max-width: 620px) {
  :root {
    --timeline-h: 138px;
  }

  .brand-title {
    font-size: 18px;
  }

  .topbar-actions .icon-button:nth-child(3) {
    display: none;
  }

  .map-legend {
    display: none;
  }

  .story-caption {
    right: 58px;
    left: 12px;
    bottom: 12px;
    width: auto;
    max-height: 176px;
    overflow-y: auto;
  }

  .story-caption p {
    margin-bottom: 8px;
  }

  .story-stats {
    gap: 5px 10px;
  }

  .timeline-panel {
    grid-template-columns: 116px minmax(0, 1fr) 74px;
  }

  .timeline-primary {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .play-button {
    width: 40px;
  }

  .chapter-readout {
    padding: 0 8px;
  }

  .chapter-readout strong {
    font-size: 13px;
    white-space: normal;
  }

  .timeline-track-wrap {
    padding-right: 10px;
    padding-left: 10px;
  }

  .chapter-slider {
    right: 10px;
    left: 10px;
    width: calc(100% - 20px);
  }

  .timeline-actions .icon-button {
    min-width: 37px;
  }

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

  .method-grid section {
    min-height: auto;
    border-right: 0;
  }

  .archive-dialog,
  .data-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }
}

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