/* Литературный атлас России — интерактивная карта и хронология */
:root {
  color-scheme: dark;
  --bg: #090e0b;
  --bg-2: #0d1410;
  --panel: rgba(16, 23, 18, 0.92);
  --panel-solid: #111913;
  --panel-soft: rgba(26, 36, 28, 0.72);
  --line: rgba(219, 194, 137, 0.18);
  --line-strong: rgba(219, 194, 137, 0.34);
  --gold: #d7b66e;
  --gold-2: #f0d9a4;
  --cream: #f1e8d3;
  --muted: #a7a797;
  --muted-2: #959b8e;
  --green: #40503e;
  --green-2: #253229;
  --accent: #d88b68;
  --danger: #d98b75;
  --ok: #91b99a;
  --sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  min-height: 100dvh;
  background:
    radial-gradient(1100px 700px at 73% -8%, rgba(83, 102, 62, 0.19), transparent 62%),
    radial-gradient(900px 650px at 2% 105%, rgba(132, 92, 46, 0.11), transparent 66%),
    var(--bg);
  color: var(--cream);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.16;
  background-image:
    repeating-linear-gradient(115deg, rgba(255, 248, 227, 0.035) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(25deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 5px);
  mix-blend-mode: soft-light;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(215, 182, 110, 0.32); color: #fff8e7; }

/* ---------- topbar ---------- */
.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(260px, 560px) auto auto;
  align-items: center;
  gap: 24px;
  height: 68px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(9, 14, 11, 0.96), rgba(9, 14, 11, 0.86));
  backdrop-filter: blur(14px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  text-decoration: none;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--gold);
  background: radial-gradient(circle at 35% 25%, rgba(215, 182, 110, 0.19), transparent 65%);
}
.brand__text { display: grid; gap: 1px; min-width: 0; }
.brand__name { font: 600 16px/1.15 var(--serif); letter-spacing: 0.08em; color: var(--cream); }
.brand__sub { font-size: 10px; letter-spacing: 0.11em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.searchbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(19, 27, 21, 0.75);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.searchbox:focus-within { border-color: var(--line-strong); background: rgba(23, 33, 25, 0.94); box-shadow: 0 0 0 3px rgba(215, 182, 110, 0.07); }
.searchbox__icon { width: 17px; height: 17px; color: var(--muted); flex: 0 0 17px; }
.searchbox input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--cream);
  font-size: 13px;
}
.searchbox input::placeholder { color: #7c8375; }
.searchbox input::-webkit-search-cancel-button { filter: invert(1); opacity: 0.5; }
.searchbox__kbd {
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted-2);
  font: 11px/1.5 var(--sans);
}
.searchbox__results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 9px);
  z-index: 60;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #121b15;
  box-shadow: var(--shadow);
}
.search-result {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid rgba(219, 194, 137, 0.09);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.search-result:last-child { border-bottom: 0; }
.search-result:hover, .search-result.is-active { background: rgba(215, 182, 110, 0.09); }
.search-result__icon { width: 24px; height: 24px; flex: 0 0 24px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--gold); font: 11px/1 var(--serif); }
.search-result__text { min-width: 0; }
.search-result__title { display: block; font-size: 13px; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result__meta { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result__type { margin-left: auto; color: var(--muted-2); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.search-empty { padding: 14px; color: var(--muted); font-size: 12px; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav__link {
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.topnav__link:hover { color: var(--cream); background: rgba(255, 255, 255, 0.04); }
.topnav__link.is-active { color: var(--gold-2); }
.topnav__site { color: var(--muted-2); }
.topbar__random {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}
.topbar__random:hover { color: var(--gold-2); border-color: var(--line-strong); }
.topbar__random svg { width: 16px; height: 16px; }

/* ---------- layout ---------- */
.app { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100dvh; }
.workspace {
  display: grid;
  grid-template-columns: 378px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 18, 14, 0.76), rgba(12, 18, 14, 0.52));
  backdrop-filter: blur(8px);
}
.sidebar__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 22px 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(215, 182, 110, 0.22) transparent;
}
.sidebar__scroll::-webkit-scrollbar { width: 7px; }
.sidebar__scroll::-webkit-scrollbar-thumb { background: rgba(215, 182, 110, 0.2); border-radius: 10px; }
.sidebar__foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 22px 12px;
  border-top: 1px solid rgba(219, 194, 137, 0.1);
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.02em;
}
.linklike { padding: 0; border: 0; background: none; color: var(--gold); font-size: 10px; cursor: pointer; }
.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  gap: 12px;
  padding: 16px 18px 18px;
}
.stage__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; min-height: 48px; }
.stage__titles { min-width: 0; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.stage__head h1 {
  margin: 0;
  color: var(--cream);
  font: 400 clamp(21px, 2.1vw, 31px)/1.12 var(--serif);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage__actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.mode-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(14, 21, 16, 0.6); }
.mode-switch__btn {
  padding: 5px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.mode-switch__btn:hover:not(:disabled) { color: var(--cream); }
.mode-switch__btn.is-active { color: var(--gold-2); background: rgba(215, 182, 110, 0.11); }
.mode-switch__btn:disabled { opacity: 0.4; cursor: default; }
.iconbtn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: 13px/1 var(--serif);
  cursor: pointer;
}
.iconbtn:hover { color: var(--gold-2); border-color: var(--line-strong); }

/* ---------- map ---------- */
.map-area { position: relative; flex: 1; min-height: 0; }
.map-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 330px;
  overflow: hidden;
  border: 1px solid rgba(219, 194, 137, 0.23);
  border-radius: 18px;
  background:
    radial-gradient(90% 85% at 65% 15%, rgba(55, 72, 51, 0.4), transparent 62%),
    radial-gradient(70% 80% at 15% 85%, rgba(71, 55, 32, 0.18), transparent 65%),
    linear-gradient(140deg, #111a14, #0b120e 58%, #0d1510);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.34), 0 20px 50px rgba(0, 0, 0, 0.25);
}
.map-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 247, 226, 0.035), transparent 16%, transparent 84%, rgba(255, 247, 226, 0.035)),
    linear-gradient(0deg, rgba(255, 247, 226, 0.025), transparent 25%);
  z-index: 1;
}
#atlas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
#atlas.is-dragging { cursor: grabbing; }
.map-readout {
  position: absolute;
  left: 18px;
  top: 17px;
  z-index: 4;
  max-width: min(390px, 46%);
  padding: 12px 14px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(13, 20, 15, 0.78);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(12px);
  pointer-events: none;
}
.map-readout__eyebrow { display: block; color: var(--gold); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; }
.map-readout__title { margin: 3px 0 2px; font: 400 21px/1.18 var(--serif); color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-readout__sub { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
body[data-view="author"] .map-readout { display: none; }
.map-tools {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 5;
  display: grid;
  gap: 5px;
  justify-items: end;
}
.maptool {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 20, 15, 0.82);
  color: var(--cream);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.maptool:hover { border-color: var(--line-strong); color: var(--gold-2); }
.maptool--wide { width: auto; height: 25px; padding: 0 8px; font-size: 9px; letter-spacing: 0.04em; color: var(--muted); }
.legend {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  width: min(220px, 48%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 20, 15, 0.84);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.legend__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid rgba(219, 194, 137, 0.1); color: var(--cream); font-size: 10px; }
.legend__toggle { width: 18px; height: 18px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); font-size: 12px; line-height: 1; cursor: pointer; }
.legend__body { padding: 8px 10px 10px; display: grid; gap: 7px; }
.legend.is-collapsed .legend__body { display: none; }
.legend__row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; line-height: 1.25; }
.legend__swatch { width: 13px; height: 9px; flex: 0 0 13px; border-radius: 2px; border: 1px solid rgba(255, 255, 255, 0.12); }
.legend__line { width: 25px; flex: 0 0 25px; height: 0; border-top: 2px solid #df765e; }
.legend__line--dashed { border-top-style: dashed; opacity: 0.55; }
.legend__line--air { border-top-style: dotted; border-top-color: rgba(224, 160, 106, 0.9); }
.legend__line--uncertain { border-top-style: dotted; border-top-color: rgba(184, 173, 150, 0.8); }
.legend__road { width: 25px; flex: 0 0 25px; border-top: 1px solid rgba(210, 194, 151, 0.55); }
.legend__dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px rgba(215, 182, 110, 0.16); }
.legend__dot--key { width: 8px; height: 8px; border-radius: 1px; background: var(--gold-2); transform: rotate(45deg); box-shadow: none; }
.legend__scale { display: flex; gap: 3px; width: 100%; }
.legend__scale i { flex: 1; height: 7px; border-radius: 2px; }
.legend__scale-labels { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 9px; }
.legend__chips { display: flex; flex-wrap: wrap; gap: 5px; }
.layer-chip {
  padding: 3px 7px;
  border: 1px solid rgba(219, 194, 137, 0.16);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}
.layer-chip.is-on { color: var(--gold-2); border-color: rgba(215, 182, 110, 0.4); background: rgba(215, 182, 110, 0.1); }
.map-foot {
  position: absolute;
  left: 17px;
  bottom: 13px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
}
.map-foot__acl { color: rgba(215, 182, 110, 0.6); }
.map-tooltip {
  position: absolute;
  z-index: 12;
  min-width: 140px;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(10, 16, 12, 0.96);
  color: var(--cream);
  box-shadow: var(--shadow);
  pointer-events: none;
  transform: translate(12px, 12px);
}
.map-tooltip__title { font: 13px/1.25 var(--serif); }
.map-tooltip__meta { margin-top: 2px; color: var(--gold); font-size: 10px; }
.map-tooltip__claim { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.map-loading {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #0b120e;
  color: var(--muted);
  font-size: 12px;
  transition: opacity 0.25s;
}
.map-loading.is-hidden { opacity: 0; pointer-events: none; }
.spinner { width: 15px; height: 15px; border: 1.5px solid rgba(215, 182, 110, 0.24); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- svg ---------- */
.region {
  fill: var(--region-fill, #344333);
  stroke: rgba(225, 213, 184, 0.3);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
  transition: fill 0.22s, opacity 0.22s, filter 0.22s;
  cursor: pointer;
  outline: none;
}
.region:hover { fill: #667246; stroke: rgba(240, 217, 164, 0.9); }
.region:focus-visible { stroke: var(--gold-2); stroke-width: 1.6; }
.region.is-selected { fill: #b39a58; stroke: #f0d9a4; }
.region.is-author { fill: #4b5b3c; stroke: rgba(240, 217, 164, 0.78); }
.region.is-muted { opacity: 0.6; fill: #253229; }
.region.is-hover { fill: #5d6947; }
.road-network { vector-effect: non-scaling-stroke;
  shape-rendering: optimizeSpeed; fill: none; stroke: rgba(210, 194, 151, 0.16); stroke-width: 0.65; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.roads-layer { pointer-events: none; }
.graticule { fill: none; stroke: rgba(219, 194, 137, 0.07); stroke-width: 0.65; pointer-events: none; }
.graticule--major { stroke: rgba(219, 194, 137, 0.11); }
.route-base { vector-effect: non-scaling-stroke; fill: none; stroke: rgba(223, 118, 94, 0.25); stroke-width: 0.8; stroke-dasharray: 4 6; stroke-linecap: round; }
.route-glow { display: none; }
.itinerary__play { display: block; margin-top: 8px; }
.itinerary__play[hidden] { display: none; }
.route-guide { vector-effect: non-scaling-stroke; fill: none; stroke-width: 1.2; stroke-dasharray: 4 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.13; }
.border-marker { cursor: pointer; }
.border-gate { fill: #101811; stroke: var(--border-color); stroke-width: 1.6; }
.border-leader { stroke: var(--border-color); stroke-width: .8; opacity: .6; }
.border-label rect { fill: #101811; fill-opacity: .97; stroke: var(--border-color); stroke-width: .65; }
.border-label__title { fill: var(--cream); font: 500 10.5px/1.2 var(--sans); }
.border-label__meta { fill: var(--muted); font: 9px/1.2 var(--sans); }
.border-marker.is-current .border-gate { fill: var(--border-color); }
.route-guide.is-complete { opacity: 0; }
.route-guide.is-dimmed { opacity: 0.035; }
.route-line { vector-effect: non-scaling-stroke; fill: none; stroke: #ff8a6a; stroke-width: 1.7; stroke-dasharray: 4 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.9; transition: opacity 0.16s; }
.route-line.is-current { opacity: 1; stroke-width: 2.2; }
.route-line.is-future { opacity: 0.2; stroke-dasharray: 2 5; }
.route-line.is-dimmed { opacity: 0.1; }
.route-line.route-uncertain { stroke-dasharray: 4 4; }
.route-line.route-uncertain.is-current { opacity: 1; }
.route-line.route-line--air { stroke-dasharray: 9 4 2 4; }
.map-land-detail { fill: rgba(78,90,55,0.6); stroke: #a99965; stroke-width: 0.7; vector-effect: non-scaling-stroke; pointer-events: none; }
.route-glow.route-uncertain { stroke: rgba(184, 173, 150, 0.14); opacity: 0.4; }
.route-glow.is-current { opacity: 1; }
.route-base.is-past { opacity: 0.45; }
.route-air-line.is-current { opacity: 0.9; }
.route-air-base { vector-effect: non-scaling-stroke; fill: none; stroke: rgba(226, 160, 106, 0.3); stroke-width: 0.7; stroke-dasharray: 3 5; stroke-linecap: round; }
.route-air-line { vector-effect: non-scaling-stroke; fill: none; stroke: #e0a06a; stroke-width: 2.1; stroke-dasharray: 3 5; stroke-linecap: round; opacity: 0.72; }
.route-exit { vector-effect: non-scaling-stroke; fill: none; stroke: #d9ad76; stroke-width: 0.9; stroke-dasharray: 2 5; stroke-linecap: round; opacity: 0.75; }
.route-exit--return { stroke: #9fb49a; stroke-dasharray: 1 6; opacity: 0.7; }
.route-exit-label { fill: #f1dec0; font-family: var(--sans); font-size: 11px; font-weight: 500; paint-order: stroke; stroke: rgba(9, 14, 11, 0.92); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.route-head__ring { fill: none; stroke: rgba(240, 217, 164, 0.45); stroke-width: 1; }
.route-head__dot { fill: #f2daa1; stroke: #101811; stroke-width: 1.4; }
.pin { cursor: pointer; outline: none; }
.pin__halo { fill: rgba(215, 182, 110, 0.12); }
.pin__dot { fill: #d7b66e; stroke: #101811; stroke-width: 1.5; }
.pin__core { fill: #101811; opacity: 0.62; }
.pin__label {
  fill: #e8dcc3;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  paint-order: stroke;
  stroke: rgba(9, 14, 11, 0.9);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.pin.pin--label .pin__label,
.pin:hover .pin__label,
.pin:focus-visible .pin__label { opacity: 1; }
.pin--future .pin__label { opacity: 0 !important; }
.pin--current .pin__label { fill: #fff1c9; font-weight: 600; }
.pin--key .pin__dot { fill: #f3d99d; stroke: #1b261b; }
.pin--key .pin__halo { fill: rgba(243, 217, 157, 0.16); }
.pin--current .pin__dot { fill: #fff1c8; }
.pin--current .pin__halo { fill: rgba(240, 207, 136, 0.18); }
.pin--future { opacity: 0.22; }
.pin--region .pin__dot { fill: transparent; stroke: #d7b66e; stroke-width: 1.7; }
.pin--region .pin__halo { fill: rgba(215, 182, 110, 0.08); }
.pin--region .pin__label { fill: var(--gold-2); font-size: 10px; }
.pin--unresolved .pin__dot { stroke-dasharray: 2 2; }
.pin.is-hover .pin__dot { fill: #fff1c8; }
.pin.is-hover .pin__label { opacity: 1; }
@keyframes pinPulse {
  0% { opacity: 0.75; transform: scale(0.65); }
  70% { opacity: 0; transform: scale(2.1); }
  100% { opacity: 0; transform: scale(2.1); }
}
.city-label {
  fill: #d9d0ba;
  font: 500 10px var(--sans);
  paint-order: stroke;
  stroke: rgba(9, 14, 11, 0.82);
  stroke-width: 2.5px;
  pointer-events: none;
}
.map-empty { fill: rgba(241, 232, 211, 0.7); font: 13px var(--serif); }

/* ---------- player ---------- */
.player {
  flex: 0 0 auto;
  padding: 13px 16px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(19, 28, 21, 0.9), rgba(13, 20, 15, 0.92));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}
.player__lead { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: start; gap: 15px; }
.player__yearblock { display: flex; flex-direction: column; align-items: flex-start; }
.player__year { color: var(--gold-2); font: 400 38px/0.92 var(--serif); letter-spacing: -0.03em; }
.player__caption { margin-top: 4px; color: var(--muted-2); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.player__event { min-width: 0; }
.player__eventline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.player__badge { padding: 1px 6px; border: 1px solid rgba(215, 182, 110, 0.26); border-radius: 999px; color: var(--gold); font-size: 11px; letter-spacing: 0.04em; }
.player__badge.is-key { color: var(--gold-2); border-color: rgba(240, 217, 164, 0.5); background: rgba(215, 182, 110, 0.1); }
.player__event h3 { margin: 3px 0 1px; color: var(--cream); font: 400 18px/1.3 var(--serif); white-space: normal; overflow-wrap: anywhere; }
.player__event p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; display: block; overflow-wrap: anywhere; }
.player__controls { display: flex; align-items: center; gap: 7px; }
.playbtn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(240, 217, 164, 0.48);
  border-radius: 50%;
  background: var(--gold);
  color: #172216;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.playbtn:hover { transform: scale(1.04); background: var(--gold-2); }
.playbtn svg { width: 20px; height: 20px; }
.playbtn__pause { display: none; }
.player.is-playing .playbtn__play { display: none; }
.player.is-playing .playbtn__pause { display: block; }
.smallbtn {
  height: 28px;
  min-width: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.smallbtn:hover { color: var(--cream); border-color: var(--line-strong); }
.timeline { position: relative; margin-top: 9px; padding-top: 15px; }
.timeline__ticks { position: absolute; left: 0; right: 0; top: 0; height: 14px; z-index: 3; }
.tick {
  position: absolute;
  z-index: 4;
  top: -3px;
  width: 14px;
  height: 16px;
  border: 0;
  padding: 0;
  background: transparent;
  transform: translateX(-50%);
  pointer-events: auto;
  cursor: pointer;
}
.tick::before { content: ""; position: absolute; left: 6px; top: 4px; width: 1px; height: 5px; background: rgba(219, 194, 137, 0.3); }
.tick.is-key::before { left: 4px; top: 3px; width: 5px; height: 5px; border: 1px solid var(--gold); background: #101811; transform: rotate(45deg); }
.tick:hover::before, .tick:focus-visible::before { background: var(--gold-2); }
.tick:focus-visible { outline: 1px solid var(--gold); outline-offset: 1px; border-radius: 2px; }
.timeline-tooltip { position: fixed; z-index: 80; width: min(300px, calc(100vw - 24px)); padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: #121c15; box-shadow: 0 8px 28px rgba(0,0,0,.35); color: var(--cream); pointer-events: none; }
.timeline-tooltip__year { color: var(--gold-2); font: 400 21px/1.1 var(--serif); }
.timeline-tooltip__event { margin: 7px 0 0; font-size: 11px; line-height: 1.45; }
.timeline-tooltip__event b { font-weight: 500; }
.timeline-tooltip__claim { display: -webkit-box; margin-top: 2px; color: var(--muted); overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.timeline-tooltip__more { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.scrubber {
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
.scrubber::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold) 0 var(--p, 0%), rgba(219, 194, 137, 0.2) var(--p, 0%) 100%);
}
.scrubber::-moz-range-track { height: 4px; border-radius: 99px; background: rgba(219, 194, 137, 0.2); }
.scrubber::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--gold); }
.scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  border: 2px solid #0c120e;
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 0 3px rgba(215, 182, 110, 0.2);
}
.scrubber::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid #0c120e; border-radius: 50%; background: var(--gold-2); }
.scrubber:focus-visible { outline: 1px solid var(--gold); outline-offset: 5px; border-radius: 4px; }
.timeline__meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted-2); font-size: 9px; }
.timeline__hint { color: rgba(167, 167, 151, 0.55); }

/* ---------- sidebar content ---------- */
.sidebar__scroll h2 { margin: 0; color: var(--cream); font: 400 28px/1.1 var(--serif); }
.sidebar__scroll h3 { margin: 0; color: var(--cream); font: 400 20px/1.2 var(--serif); }
.sidebar__scroll p { margin: 0; }
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.back-button:hover { color: var(--gold-2); }
.home__kicker { margin: 14px 0 9px; color: var(--gold); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; }
.home__title { margin: 0 0 10px; color: var(--cream); font: 400 33px/1.06 var(--serif); letter-spacing: -0.02em; }
.home__title em { color: var(--gold-2); font-style: italic; }
.home__lead { max-width: 30ch; color: var(--muted); font-size: 12px; line-height: 1.55; }
.home__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 21px 0 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.home__stat { padding: 12px 7px 11px 0; }
.home__stat + .home__stat { padding-left: 11px; border-left: 1px solid rgba(219, 194, 137, 0.1); }
.home__stat b { display: block; color: var(--gold-2); font: 400 25px/1 var(--serif); }
.home__stat span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.3; }
.home__section { margin-top: 20px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 9px; color: var(--cream); font: 400 18px/1.2 var(--serif); }
.section-title span { color: var(--muted-2); font: 9px/1.2 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--cream);
  font-size: 11px;
  cursor: pointer;
}
.btn:hover { background: rgba(215, 182, 110, 0.09); color: var(--gold-2); }
.btn--gold { border-color: var(--gold); background: var(--gold); color: #172216; }
.btn--gold:hover { background: var(--gold-2); color: #172216; }
.btn--full { width: 100%; }
.region-list { display: grid; gap: 1px; }
.region-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid rgba(219, 194, 137, 0.08);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.region-row:hover { color: var(--gold-2); }
.region-row__name { color: var(--cream); font-size: 12px; }
.region-row__count { color: var(--muted-2); font-size: 10px; white-space: nowrap; }
.region-row:hover .region-row__name { color: var(--gold-2); }
.howto { display: grid; gap: 8px; margin: 3px 0 0; padding: 0; list-style: none; }
.howto li { display: flex; gap: 9px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.howto b { color: var(--gold); font: 400 13px/1.1 var(--serif); flex: 0 0 13px; }
.home__note { margin-top: 18px; color: var(--muted-2); font-size: 10px; line-height: 1.5; }

/* author */
.author-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 14px; }
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 22%, rgba(215, 182, 110, 0.24), rgba(31, 44, 33, 0.75));
  color: var(--gold-2);
  font: 400 20px/1 var(--serif);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.8) contrast(1.04); }
.avatar--reviewed img { filter: none; }
.portrait-credit { margin: 10px 0 0; font-size: 10px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.portrait-attribution summary { width: fit-content; cursor: pointer; }
.portrait-attribution[open] { margin-bottom: 5px; }
.portrait-attribution > .portrait-credit__line { margin-top: 4px; }
.portrait-attribution summary:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
.portrait-credit__line { margin: 0; }
.portrait-view__frame { position: relative; overflow: hidden; width: 100%; margin-top: 6px; }
.portrait-credit a { color: var(--gold-2); text-underline-offset: 2px; }
.portrait-view { margin-top: 4px; }
.portrait-view summary { width: fit-content; color: var(--gold); cursor: pointer; }
.portrait-view summary:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
.portrait-view img { display: block; max-width: 100%; width: auto; height: auto; max-height: 340px; margin-top: 8px; object-fit: contain; border-radius: 3px; }
.portrait-view__frame img { max-height: none; object-fit: fill; border-radius: 0; }
.avatar--sm { flex-basis: 34px; width: 34px; height: 34px; font-size: 13px; }
.avatar--portrait { flex: 0 0 74px; width: 74px; height: 92px; padding: 3px; border-radius: 7px; background: #182019; }
.avatar--portrait img, .avatar--portrait svg { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.avatar--sm.avatar--portrait { flex-basis: 34px; width: 34px; height: 42px; padding: 2px; border-radius: 4px; }
.author-head__main { min-width: 0; padding-top: 2px; }
.author-head h2 { margin: 0; color: var(--cream); font: 400 27px/1.08 var(--serif); letter-spacing: -0.02em; }
.author-years { margin-top: 3px; color: var(--gold); font: 12px/1.3 var(--serif); }
.author-role { margin-top: 2px; color: var(--muted); font-size: 10px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.badge { padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.badge--gold { border-color: rgba(215, 182, 110, 0.4); color: var(--gold-2); }
.badge--74 { border-color: rgba(216, 139, 104, 0.4); color: #e5a17f; }
.author-lead { margin: 13px 0 0; color: #d8cfba; font: 400 14px/1.55 var(--serif); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 16px 0 17px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { padding: 9px 7px 9px 0; }
.stat + .stat { padding-left: 10px; border-left: 1px solid rgba(219, 194, 137, 0.1); }
.stat dt { color: var(--muted-2); font-size: 8px; line-height: 1.25; letter-spacing: 0.06em; text-transform: uppercase; }
.stat dd { margin: 3px 0 0; color: var(--gold-2); font: 400 20px/1 var(--serif); }
.sidebar__scroll .note { margin: 9px 0 0; padding: 9px 10px; border-left: 2px solid rgba(215, 182, 110, 0.45); background: rgba(215, 182, 110, 0.045); color: var(--muted); font-size: 10px; line-height: 1.5; }
.biography { display: grid; gap: 9px; margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.biography p { margin: 0; }
.biography.is-clamped { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.text-toggle { margin-top: 5px; padding: 0; border: 0; background: none; color: var(--gold); font-size: 10px; cursor: pointer; }
.event-list { display: grid; gap: 1px; margin: 4px 0 0; padding: 0; list-style: none; }
.event-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  width: 100%;
  padding: 7px 3px;
  border: 0;
  border-bottom: 1px solid rgba(219, 194, 137, 0.075);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.event-item:hover { background: rgba(215, 182, 110, 0.055); }
.event-item.is-current { background: rgba(215, 182, 110, 0.09); }
.event-year { color: var(--gold); font: 12px/1.3 var(--serif); }
.event-label { color: var(--cream); font-size: 11px; line-height: 1.35; }
.event-loc { display: block; margin-top: 1px; color: var(--muted-2); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-key { color: var(--gold-2); font-size: 10px; }
.event-list--compact .event-item:nth-child(n+9) { display: none; }
.details { margin-top: 10px; }
.details > summary, .portrait-attribution > summary, .portrait-view > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 38px; padding: 8px 10px;
  border: 1px solid rgba(215, 182, 110, 0.28); border-radius: 7px;
  background: rgba(215, 182, 110, 0.055); color: var(--gold-2);
  font-size: 12px; line-height: 1.4; list-style: none; cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.details > summary::marker, .portrait-attribution > summary::marker, .portrait-view > summary::marker { content: ""; }
.details > summary::-webkit-details-marker, .portrait-attribution > summary::-webkit-details-marker, .portrait-view > summary::-webkit-details-marker { display: none; }
.details > summary::after, .portrait-attribution > summary::after, .portrait-view > summary::after {
  content: "+"; display: grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(215, 182, 110, 0.12); color: var(--gold-2); font: 16px/1 var(--sans);
}
.details[open] > summary::after, .portrait-attribution[open] > summary::after, .portrait-view[open] > summary::after { content: "−"; }
.details > summary:hover, .portrait-attribution > summary:hover, .portrait-view > summary:hover { border-color: var(--gold); background: rgba(215, 182, 110, 0.11); }
.details > summary:focus-visible, .portrait-attribution > summary:focus-visible, .portrait-view > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.portrait-attribution > summary, .portrait-view > summary { min-height: 28px; padding: 4px 7px; font-size: 10px; }
.portrait-attribution > summary::after, .portrait-view > summary::after { flex-basis: 16px; width: 16px; height: 16px; font-size: 14px; }
.details[open] > summary { margin-bottom: 8px; }
.place-list { display: grid; gap: 0; margin: 4px 0 0; padding: 0; list-style: none; }
.place-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 2px;
  border: 0;
  border-bottom: 1px solid rgba(219, 194, 137, 0.07);
  background: none;
  text-align: left;
  cursor: pointer;
}
.place-item:hover { color: var(--gold-2); }
.place-item__name { font-size: 11px; color: var(--cream); }
.place-item:hover .place-item__name { color: var(--gold-2); }
.place-item__years { color: var(--muted-2); font-size: 9px; white-space: nowrap; }
.precision { margin-left: 4px; color: var(--muted-2); font-size: 8px; letter-spacing: 0.04em; text-transform: uppercase; }
.offmap-list { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.offmap-list li { color: var(--muted); font-size: 10px; line-height: 1.4; }
.offmap-list b { color: #d8b28e; font-weight: 500; }
.source-list { display: grid; gap: 5px; margin: 4px 0 0; padding: 0; list-style: none; }
.source-list a { color: var(--muted); font-size: 10px; text-decoration: none; overflow-wrap: anywhere; }
.source-list a:hover { color: var(--gold-2); }
.source-list a::before { content: "↗ "; color: var(--gold); }
.author-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 2px; }
.author-actions .btn { flex: 1 1 auto; }
.region-head { margin: 7px 0 2px; }
.region-head h1 { margin: 0; color: var(--cream); font: 400 32px/1.05 var(--serif); }
.region-head p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.region-stat { display: flex; gap: 20px; margin: 15px 0 13px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.region-stat div { display: grid; gap: 2px; }
.region-stat b { color: var(--gold-2); font: 400 22px/1 var(--serif); }
.region-stat span { color: var(--muted-2); font-size: 9px; letter-spacing: 0.04em; text-transform: uppercase; }
.region-authors { display: grid; gap: 1px; }
.region-author {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 8px 3px;
  border: 0;
  border-bottom: 1px solid rgba(219, 194, 137, 0.075);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.region-author:hover { background: rgba(215, 182, 110, 0.05); }
.region-author .avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: 11px; }
.region-author .avatar--portrait { height: 38px; padding: 2px; border-radius: 4px; }
.region-author__body { min-width: 0; }
.region-author__name { display: block; color: var(--cream); font-size: 12px; }
.region-author__years { display: block; color: var(--gold); font: 10px/1.3 var(--serif); }
.region-author__places { display: block; margin-top: 2px; color: var(--muted-2); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.region-author__arrow { color: var(--muted-2); font-size: 14px; }
.list-search { display: grid; gap: 8px; margin-bottom: 12px; }
.input, .select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  background: rgba(10, 16, 12, 0.5);
  color: var(--cream);
  font-size: 11px;
}
.input:focus, .select:focus { border-color: var(--line-strong); }
.authors-list { display: grid; gap: 1px; }
.author-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 8px 3px;
  border: 0;
  border-bottom: 1px solid rgba(219, 194, 137, 0.07);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.author-row:hover { background: rgba(215, 182, 110, 0.05); }
.author-row__name { display: block; color: var(--cream); font-size: 12px; }
.author-row__meta { display: block; color: var(--muted-2); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.author-row__arrow { color: var(--muted-2); font-size: 14px; }
.list-count { margin: 0 0 9px; color: var(--muted-2); font-size: 10px; }
.more-btn { width: 100%; margin-top: 10px; }
.empty { padding: 20px 2px; color: var(--muted); font-size: 11px; line-height: 1.5; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(4, 8, 5, 0.7); backdrop-filter: blur(6px); }
.modal__panel { position: relative; display: flex; flex-direction: column; width: min(560px, 100%); max-height: min(80dvh, 700px); overflow: hidden; border: 1px solid var(--line-strong); border-radius: 16px; background: #121b15; box-shadow: var(--shadow); }
.modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex: 0 0 auto; padding: 22px 20px 12px 30px; border-bottom: 1px solid var(--line); }
.modal__header > div { min-width: 0; }
.modal__body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 30px 25px; scrollbar-gutter: stable; }
.map-help { padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.map-help li + li { margin-top: 10px; }
.map-help strong { color: var(--cream); font-weight: 500; }
.map-help__sources { margin-top: 18px; }
.modal__panel h2 { margin: 6px 0 15px; color: var(--cream); font: 400 27px/1.1 var(--serif); }
.modal__header h2 { margin-bottom: 0; font-size: 24px; }
.modal__panel p { margin: 0 0 11px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.modal__panel .modal__fine { margin-top: 18px; color: var(--muted-2); font-size: 10px; }
.modal__close { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(215, 182, 110, 0.07); color: var(--gold-2); font-size: 26px; line-height: 1; cursor: pointer; }
.modal__close:hover { border-color: var(--gold); background: rgba(215, 182, 110, 0.14); }
.modal__close:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 340px minmax(0, 1fr); }
  .topbar { gap: 15px; grid-template-columns: auto minmax(200px, 1fr) auto auto; }
  .topnav__site { display: none; }
  .topbar__random span { display: none; }
  .topbar__random { width: 34px; padding: 0; justify-content: center; }
}
@media (max-width: 920px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; }
  .topbar { position: sticky; top: 0; grid-template-columns: auto minmax(0, 1fr) auto auto; height: 60px; gap: 10px; padding: 0 13px; }
  .brand__sub { display: none; }
  .brand__name { font-size: 14px; }
  .brand__mark { width: 32px; height: 32px; flex-basis: 32px; }
  .searchbox { height: 36px; padding: 0 9px; }
  .searchbox__kbd { display: none; }
  .topnav { gap: 1px; }
  .topnav__link { padding: 6px 7px; font-size: 11px; }
  .topbar__random { width: 32px; height: 32px; }
  .topbar__random span { display: none; }
  .workspace { display: flex; flex-direction: column; }
  .stage { order: 1; padding: 12px 12px 0; gap: 9px; }
  .sidebar { order: 2; border-right: 0; border-top: 1px solid var(--line); background: rgba(12, 18, 14, 0.72); }
  .stage__head { align-items: center; gap: 8px; min-height: 38px; }
  .stage__head h1 { font-size: clamp(18px, 4.5vw, 24px); white-space: normal; }
  .stage__actions .mode-switch { display: none; }
  .map-area { height: 54dvh; min-height: 330px; flex: none; }
  .map-shell { min-height: 330px; border-radius: 13px; }
  .map-readout { left: 11px; top: 11px; max-width: 68%; padding: 8px 10px; }
  body[data-view="author"] .map-readout { display: block; }
  body[data-view="author"] .map-readout__eyebrow { display: none; }
  .map-readout__title { font-size: 17px; }
  .map-readout__sub { display: none; }
  .map-tools { right: 9px; top: 9px; }
  .maptool { width: 28px; height: 28px; }
  .maptool--wide { display: grid; width: auto; min-width: 76px; padding: 0 8px; white-space: nowrap; font-size: 8px; }
  .legend { right: 9px; bottom: 9px; width: 190px; }
  .map-foot { left: 11px; bottom: 10px; font-size: 8px; }
  .player { border-radius: 12px; padding: 10px 11px 8px; margin-bottom: 12px; }
  .player__lead { grid-template-columns: 66px minmax(0, 1fr) auto; gap: 9px; }
  .player__year { font-size: 30px; }
  .player__event h3 { font-size: 14px; }
  .player__event p { -webkit-line-clamp: 2; font-size: 10px; }
  .player__controls { gap: 4px; }
  .playbtn { width: 34px; height: 34px; }
  .smallbtn { height: 26px; min-width: 26px; padding: 0 6px; font-size: 10px; }
  .timeline__hint { display: none; }
  .sidebar__scroll { padding: 20px 15px 25px; }
  .sidebar__foot { padding: 9px 15px 11px; }
  .home__title { font-size: 29px; }
}
@media (max-width: 520px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .brand { gap: 6px; }
  .brand__name { font-size: 12px; letter-spacing: 0.03em; }
  .searchbox input { font-size: 12px; }
  .topnav { display: none; }
  .stage { padding: 10px 8px 0; }
  .stage__head h1 { font-size: 19px; }
  .stage__actions .iconbtn { width: 27px; height: 27px; }
  .map-area { height: 48dvh; min-height: 290px; }
  .map-readout { max-width: 72%; }
  .map-readout__eyebrow { font-size: 8px; }
  .map-readout__title { font-size: 16px; }
  .legend { width: 164px; }
  .legend__head { font-size: 9px; padding: 7px 8px; }
  .legend__body { padding: 7px 8px 8px; gap: 5px; }
  .legend__row { font-size: 9px; }
  .player__lead { grid-template-columns: 54px minmax(0, 1fr); }
  .player__controls { grid-column: 1 / -1; justify-content: flex-end; margin-top: 4px; }
  .player__year { font-size: 27px; }
  .player__eventline { font-size: 9px; }
  .timeline { margin-top: 5px; }
  .sidebar__scroll { padding: 18px 14px 23px; }
  .home__title { font-size: 27px; }
  .author-head h2 { font-size: 23px; }
  .avatar { width: 48px; height: 48px; flex-basis: 48px; }
  .author-head .avatar--portrait { flex-basis: 60px; width: 60px; height: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}



/* Chronological route index: the same colour and number as the map connection. */
.itinerary { margin: 20px 0 22px; }
.itinerary__detail { margin-top: 5px !important; color: var(--muted); font-size: 10px; line-height: 1.5; }
.itinerary__summary { color: var(--muted); font-size: 11px; }
.itinerary__list { margin: 9px 0 0; padding: 0; list-style: none; max-height: 310px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.journey-step { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 10px 5px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; text-align: left; cursor: pointer; transition: background 0.18s; }
.journey-step:hover, .journey-step.is-selected { background: rgba(215,182,110,0.09); }
.journey-step__number { flex: 0 0 23px; margin-top: 2px; border-top: 2px solid var(--step-color); padding-top: 4px; color: var(--step-color); font-size: 10px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.journey-step--gap .journey-step__number { border-top-style: dotted; color: var(--muted); border-color: var(--muted); }
.journey-step__body { min-width: 0; display: grid; gap: 4px; }
.journey-step__names { color: var(--cream); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.journey-step__meta { color: var(--muted); font-size: 10px; line-height: 1.4; }
.journey-step.is-current .journey-step__names { color: var(--gold-2); }
.journey-step.is-selected { box-shadow: inset 2px 0 var(--step-color); }
.legend__note { margin: 0; font-size: 10px; line-height: 1.45; color: var(--muted); }
.journey-notice { position: absolute; z-index: 4; left: 15px; bottom: 42px; max-width: min(440px, 64%); padding: 8px 11px; border-left: 2px solid var(--gold); background: rgba(10,16,12,0.92); color: var(--cream); font-size: 11px; line-height: 1.45; pointer-events: none; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
select.smallbtn { color-scheme: dark; padding-right: 2px; }
.map-foot { max-width: calc(100% - 260px); flex-wrap: wrap; gap: 3px 9px; }
@media (max-width: 920px) { .map-foot { max-width: calc(100% - 200px); } .journey-notice { max-width: calc(100% - 30px); bottom: 43px; font-size: 10px; } }
@media (max-width: 520px) { .map-foot { max-width: 49%; } .map-foot__acl { display: none; } .map-readout { padding: 7px 9px; max-width: calc(100% - 100px); } .itinerary__list { max-height: none; } }
.pin__count { fill: #172216; font: 600 9px var(--sans); pointer-events: none; } .pin--region .pin__count { fill: var(--gold-2); }

.player__event .player__journey { color: var(--gold-2); font-size: 13px; margin: 3px 0; }
.route-head.is-approximate .route-head__dot { fill: #101811; stroke: var(--gold-2); }

/* Compact map-edge markers: descriptions live below the map, never on its routes. */
.stage { overflow-anchor: none; }
.map-area { display: flex; flex-direction: column; }
.map-shell { flex: 1; height: auto; min-height: 260px; }
.map-context { flex: 0 0 auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: #0f1711; padding: 10px 12px; min-width: 0; }
.map-context .journey-notice { position: static; margin: 0; max-width: none; padding: 0 0 7px; border: 0; background: none; color: var(--muted); font-size: 10px; line-height: 1.5; }
.border-stages { display: flex; align-items: center; gap: 7px; overflow-x: auto; max-height: 68px; padding: 2px 1px 4px; scrollbar-width: thin; }
.border-stage { flex: 0 0 auto; padding: 5px 10px; border: 1px solid var(--border-color); border-radius: 18px; background: transparent; color: var(--cream); font-size: 10px; cursor: pointer; white-space: nowrap; }
.border-stage[aria-expanded="true"] { background: rgba(215,182,110,.1); }
.border-stages__hint { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.border-number__disc { fill: #101811; stroke: var(--border-color); stroke-width: 1; }
.border-number__text { fill: var(--border-color); font: 600 9px var(--sans); pointer-events: none; }
.border-marker:focus { outline: none; }
.border-marker:focus-visible .border-number__disc { stroke: var(--gold-2); stroke-width: 2; }
.border-marker[aria-expanded="true"] .border-number__disc { fill: #2a3422; stroke-width: 2; }
.border-detail { position: relative; display: grid; gap: 5px; padding: 11px 0 1px; margin-top: 7px; border-top: 1px solid var(--line); }
.border-detail__caption { color: var(--cream); font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.border-detail__meta,.border-detail__note { color: var(--muted); font-size: 10px; line-height: 1.5; margin: 0; }
.player__event .player__place { color: var(--gold-2); font-size: 13px; margin: 3px 0; }
@media(max-width:920px) { .map-area { height: auto; min-height: 0; } .map-shell { flex: none; height: 54dvh; min-height: 330px; } .map-context { padding: 9px 11px; } }
@media (max-width: 520px) { .map-shell { height: 48dvh; min-height: 290px; } }
@media (min-width: 921px) and (max-height: 700px) {
  .stage { gap: 10px; padding: 12px 16px; overflow-y: auto; }
  .map-shell { min-height: 190px; }
}


/* Reader panels keep the route, biography and source details within reach. */
.mobile-panels { display: none; }
.stage { overflow-y: auto; }
.map-area { flex: 1 0 auto; }
#atlas { position: absolute; inset: 0; }
.route-status { flex: 0 0 auto; min-width: 0; }
.route-explanation { border-bottom: 1px solid var(--line); padding: 0 2px 8px; font-size: 12px; color: var(--muted); }
.route-explanation summary { color: var(--gold-2); cursor: pointer; padding: 4px 0; }
.route-explanation p { line-height: 1.6; margin: 8px 0; }
.route-explanation__list { max-height: 180px; overflow-y: auto; margin: 0; padding: 0 0 0 18px; }
.route-explanation__list li { margin: 9px 0; }
.route-explanation__list strong,.route-explanation__list span { display: block; font-weight: 400; line-height: 1.5; }
.route-explanation__list strong { color: var(--cream); }
.load-error { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--gold); border-radius: 10px; color: var(--cream); font-size: 13px; }
.load-error .btn { flex: 0 0 auto; }
.event-fact { padding: 5px 10px 14px; border-left: 2px solid var(--gold); font-size: 13px; line-height: 1.6; }
.event-fact p { margin: 4px 0; }
.event-fact__sources { font-size: 12px; }
.portrait-original { display: block; margin: 8px 0; color: var(--gold-2); font-size: 11px; }
.avatar--portrait img { object-fit: contain; }
@media (max-width: 920px) {
  .mobile-panels { display: flex; gap: 4px; order: 0; position: sticky; top: var(--topbar-height, 60px); z-index: 12; padding: 7px 12px; background: #0b110d; border-bottom: 1px solid var(--line); }
  .mobile-panels button { flex: 1; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; }
  .mobile-panels button[aria-selected="true"] { color: var(--gold-2); background: #252a1b; border-color: #827347; }
  body[data-mobile-panel="bio"] .stage,body[data-mobile-panel="map"] .sidebar { display: none; }
  .sidebar { min-height: calc(100dvh - var(--topbar-height, 60px) - 55px); }
  .stage { gap: 10px; }
  .stage__head { margin-bottom: 0; }
  .player { padding: 13px; }
  .player__lead { grid-template-columns: 66px minmax(0,1fr); align-items: start; }
  .player__year { font-size: 31px; }
  .player__event h3 { font-size: 18px; }
  .player__event p { font-size: 14px; line-height: 1.55; -webkit-line-clamp: unset; overflow: visible; }
  .player__event .player__place,.player__event .player__journey { font-size: 13px; line-height: 1.5; }
  .player__eventline { flex-wrap: wrap; font-size: 12px; line-height: 1.5; }
  .player__controls { grid-column: 1/-1; justify-content: flex-end; margin-top: 8px; gap: 6px; }
  .smallbtn { height: 40px; min-width: 40px; font-size: 14px; }
  .playbtn { width: 44px; height: 44px; }
  .timeline__meta { font-size: 11px; }
  .route-explanation { font-size: 13px; }
  .map-context .journey-notice,.border-detail__meta,.border-detail__note { font-size: 12px; }
  .border-stage { min-height: 36px; font-size: 12px; }
  .map-shell { height: 48dvh; min-height: 280px; }
}

/* Adapt to the map column's width, including a narrow desktop sidebar layout. */
.stage { container-name: atlas-stage; container-type: inline-size; }
@container atlas-stage (max-width: 760px) {
  .player__lead { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; }
  .player__controls { grid-column: 1 / -1; justify-content: flex-end; margin-top: 4px; }
}
@container atlas-stage (max-width: 380px) {
  .player__lead { grid-template-columns: 54px minmax(0, 1fr); gap: 10px; }
}
