/* ==================================================================
   main.css — the cell-shaded ink language.
   Bold ink outlines · flat stepped shading · halftone texture ·
   per-circle palettes with riso two-ink spot accents ·
   toybox scatter confined to illuminated marginalia ·
   one bouncy elastic motion, reserved for manuscript panels.
   ================================================================== */

:root {
  --bg: #241f1a;
  --deep: #191512;
  --ink1: #c96f3b;
  --ink2: #6f7d5a;
  --paper: #d8cfc0;
  --paper-dim: rgba(216, 207, 192, 0.72);
  --line: rgba(216, 207, 192, 0.16);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  --ink-radius: 14px 5px 13px 6px / 6px 12px 5px 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html.overlay-open { overflow: hidden; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.62;
  color: var(--paper);
  background: var(--noise), var(--bg);
  transition: background-color 0.9s ease, color 0.9s ease;
}

/* ------- atmosphere layers ------- */
#weather {
  position: fixed; inset: 0; z-index: 3;
  pointer-events: none;
}
#vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0.16;
  background: radial-gradient(ellipse at 50% 42%, transparent 46%, rgba(0, 0, 0, 0.55) 100%);
  transition: opacity 1.4s ease;
}

/* ------- a11y helpers ------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; top: -60px; left: 12px; z-index: 100;
  background: var(--ink1); color: #14100c; padding: 0.5rem 1rem;
  border: 2px solid #14100c; border-radius: var(--ink-radius);
  transition: top 0.2s ease; text-decoration: none; font-weight: bold;
}
.skip:focus { top: 10px; }
:focus-visible {
  outline: 3px dashed var(--ink1);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ==================================================================
   INTRO
   ================================================================== */
#intro {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: var(--noise), var(--deep);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#intro.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-card {
  text-align: center; max-width: 34rem; padding: 2.2rem 2rem;
  border: 3px solid var(--ink1); border-radius: var(--ink-radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.25));
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.4);
  position: relative;
}
.intro-card::after {
  content: ""; position: absolute; inset: 6px; pointer-events: none;
  background-image: radial-gradient(var(--ink2) 0.8px, transparent 1.1px);
  background-size: 9px 9px; opacity: 0.14;
}
.kicker {
  letter-spacing: 0.34em; text-transform: uppercase; font-size: 0.72rem;
  color: var(--ink2); margin: 0 0 0.6rem;
}
.ms-title {
  font-size: clamp(3rem, 10vw, 5.4rem);
  letter-spacing: 0.12em; margin: 0; line-height: 1;
  color: var(--paper);
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
}
.intro-tag { color: var(--paper-dim); margin: 1rem 0 1.4rem; font-size: 0.98rem; }
.intro-load { color: var(--ink1); font-style: italic; }
#intro.ready .intro-load { display: none; }
.intro-note { font-size: 0.85rem; color: var(--paper-dim); margin: 1rem 0 0; }
.intro-resume { color: var(--ink1); font-size: 0.9rem; margin: 0.6rem 0 0; font-style: italic; }
.intro-foot { font-size: 0.72rem; color: rgba(216, 207, 192, 0.45); margin: 1.4rem 0 0; }
.dots { animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } }

/* ==================================================================
   HUD
   ================================================================== */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 12;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.5rem 1rem 0.62rem;
  background: color-mix(in srgb, var(--deep) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--ink1);
}
.hud-brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 9.5rem; }
.brand-top { font-size: 0.58rem; letter-spacing: 0.3em; color: var(--ink2); }
.brand-main { font-weight: bold; letter-spacing: 0.22em; font-size: 1.02rem; color: var(--paper); }
.hud-loc { flex: 1; min-width: 0; line-height: 1.25; }
.hud-meta {
  margin: 0; font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud-name {
  margin: 0; font-size: 1.12rem; font-weight: bold; color: var(--paper);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#hud-name:focus, #hud-name:focus-visible { outline: none; }
.hud-actions { display: flex; gap: 0.45rem; }
.kbd-hint {
  font-size: 0.62rem; border: 1px solid var(--line); border-radius: 4px;
  padding: 0 0.28em; margin-left: 0.3em; opacity: 0.7;
}
.hud-progress {
  position: absolute; left: 0; right: 0; bottom: -2px; height: 4px;
  background: rgba(0, 0, 0, 0.5);
}
#hud-progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--ink2) 0 30%, var(--ink1) 30% 100%);
  transition: width 0.5s ease;
}

/* ==================================================================
   LADDER (station list, left rail)
   ================================================================== */
#ladder {
  position: fixed; left: 0.9rem; top: 50%; transform: translateY(-50%);
  z-index: 11; max-height: 78vh; overflow-y: auto;
}
#ladder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.lad {
  display: flex; align-items: center; gap: 0.4rem;
  background: none; border: none; cursor: pointer;
  color: var(--paper-dim); font-family: inherit; font-size: 0.72rem;
  letter-spacing: 0.04em; padding: 2px 6px; text-align: left;
  border-left: 2px solid var(--line); transition: color 0.25s, border-color 0.25s;
}
.lad-mark { opacity: 0; font-size: 0.6rem; color: var(--ink1); transition: opacity 0.25s; }
.lad:hover { color: var(--paper); }
.lad.on { color: var(--ink1); border-left-color: var(--ink1); font-weight: bold; }
.lad.on .lad-mark { opacity: 1; }
.lad.visited .lad-mark { opacity: 0.55; }

/* ==================================================================
   DEPTH RAIL (scrubbable canto/station track, right edge)
   ================================================================== */
#depth-rail { position: fixed; right: 0.7rem; top: 50%; transform: translateY(-50%); z-index: 11; }
.rail-track {
  position: relative; width: 30px; height: min(62vh, 560px);
  border-right: 2px solid var(--line); cursor: crosshair;
}
.rail-tick {
  position: absolute; right: -8px; transform: translateY(-50%);
  width: 14px; height: 14px; background: none; border: none; cursor: pointer; padding: 0;
}
.tick-dot {
  display: block; width: 7px; height: 7px; margin: 0 auto;
  border: 1.5px solid var(--paper-dim); border-radius: 50%;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.rail-tick:hover .tick-dot { border-color: var(--ink1); transform: scale(1.25); }
.rail-tick.on .tick-dot { background: var(--ink1); border-color: var(--ink1); }
.rail-thumb {
  position: absolute; right: -13px; width: 8px; height: 8px;
  transform: translateY(-50%) rotate(45deg);
  background: var(--ink2); border: 2px solid var(--paper);
  transition: top 0.45s ease;
}

/* ==================================================================
   TOOLTIP & TOAST
   ================================================================== */
#tooltip {
  position: fixed; z-index: 50; max-width: 20rem;
  background: var(--noise), #17130f;
  border: 2px solid var(--ink1); border-radius: var(--ink-radius);
  padding: 0.6rem 0.8rem; font-size: 0.8rem; line-height: 1.5; color: var(--paper);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45); pointer-events: none;
}
#toast {
  position: fixed; left: 50%; bottom: 5.4rem; transform: translateX(-50%) translateY(20px);
  z-index: 27; max-width: min(30rem, 88vw);
  background: var(--noise), #17130f; color: var(--paper);
  border: 2px solid var(--ink2); border-radius: var(--ink-radius);
  padding: 0.55rem 1rem; font-size: 0.85rem; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.35s, transform 0.35s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==================================================================
   STATIONS
   ================================================================== */
#station-view { outline: none; }
.station {
  position: relative; min-height: 100vh;
  padding: 7rem 1.2rem 5.5rem;
  border-bottom: 2px solid var(--line);
  overflow: hidden;
}
.station::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 26%, transparent 78%, rgba(0, 0, 0, 0.38));
}
.station::after { /* halftone edge texture */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 90px; pointer-events: none;
  background-image: radial-gradient(var(--ink2) 1px, transparent 1.35px);
  background-size: 11px 11px; opacity: 0.1;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent);
  mask-image: linear-gradient(180deg, #000, transparent);
}
.st-inner {
  position: relative; max-width: 46rem; margin: 0 auto;
}
.st-head { margin-bottom: 1.6rem; }
.rubric {
  margin: 0 0 0.5rem; color: var(--ink1);
  font-size: 0.74rem; letter-spacing: 0.22em; text-transform: uppercase; font-weight: bold;
}
.st-title {
  margin: 0; font-size: clamp(2rem, 5.4vw, 3.2rem); line-height: 1.05;
  color: var(--paper); text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}
.st-sub { margin: 0.55rem 0 0; font-style: italic; color: var(--paper-dim); font-size: 1.05rem; }

.title-block { text-align: center; margin: 1.5rem 0 3rem; }
.title-block .ms-title { font-size: clamp(3.4rem, 12vw, 6.4rem); }
.title-sub { color: var(--paper-dim); margin-top: 1rem; font-size: 1rem; }
.title-canto { margin-top: 1.1rem; }

.st-body { font-size: 1.02rem; }
.st-body > p { margin: 0 0 1.15rem; }
.st-body em { color: var(--paper); }
.cant {
  color: var(--ink1); font-weight: bold; cursor: help;
  border-bottom: 2px dotted var(--ink1); padding: 0 0.1em;
}

/* quotes as manuscript blocks */
.ms-quote {
  margin: 1.6rem 0; padding: 1rem 1.2rem;
  border-left: 5px solid var(--ink2);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.05));
  border-radius: 0 var(--ink-radius) var(--ink-radius) 0;
}
.ms-quote .it { margin: 0; font-size: 1.08rem; font-style: italic; color: var(--paper); }
.ms-quote .en { margin: 0.5rem 0 0; color: var(--paper-dim); font-size: 0.94rem; }
.ms-quote cite { display: block; margin-top: 0.55rem; font-size: 0.72rem; color: var(--ink1); font-style: normal; letter-spacing: 0.06em; }
.station-quote { max-width: 40rem; }

/* contrapasso callout — stepped flat shading */
.contrapasso {
  margin: 1.8rem 0; padding: 1.1rem 1.25rem;
  border: 3px solid var(--ink1);
  border-radius: var(--ink-radius);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.34) 0 6px, transparent 6px),
    color-mix(in srgb, var(--ink1) 10%, var(--deep));
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.38);
  position: relative;
}
.contrapasso::after {
  content: ""; position: absolute; right: 10px; top: 10px; width: 64px; height: 26px;
  background-image: radial-gradient(var(--ink1) 1px, transparent 1.3px);
  background-size: 7px 7px; opacity: 0.4;
}
.cp-head {
  margin: 0 0 0.5rem; font-size: 0.78rem; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--ink1);
}
.contrapasso p { margin: 0; font-size: 0.95rem; }

.sub-head {
  margin: 2.2rem 0 0.9rem; font-size: 0.85rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink2);
}

/* bolgias / rounds accordions */
.bolgias { display: flex; flex-direction: column; gap: 0.6rem; }
.bolgias.rounds .b-num { background: var(--ink2); color: #14100c; }
.bolgias.rounds .b-num { min-width: 5.6rem; text-align: center; }
.bolgias.rounds .b-num { letter-spacing: 0.05em; }
.bolgia {
  border: 2px solid var(--line); border-radius: var(--ink-radius);
  background: rgba(0, 0, 0, 0.22); overflow: hidden;
}
.bolgia[open] { border-color: var(--ink1); background: rgba(0, 0, 0, 0.3); }
.bolgia summary {
  display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.6rem 0.9rem; cursor: pointer; list-style: none;
  font-weight: bold; color: var(--paper);
}
.bolgia summary::-webkit-details-marker { display: none; }
.bolgia summary::after { content: "＋"; margin-left: auto; color: var(--ink1); font-weight: normal; }
.bolgia[open] summary::after { content: "－"; }
.b-num {
  font-size: 0.68rem; letter-spacing: 0.1em; padding: 0.1rem 0.45rem;
  background: var(--ink1); color: #14100c; border-radius: 4px; white-space: nowrap;
}
.b-name { font-size: 0.95rem; }
.b-cantos { font-size: 0.7rem; color: var(--ink1); font-weight: normal; letter-spacing: 0.06em; }
.b-body { padding: 0.2rem 0.95rem 0.9rem; font-size: 0.92rem; color: var(--paper-dim); }
.b-body p { margin: 0.45rem 0; }

/* facts */
.st-facts {
  margin: 2rem 0 0; padding: 0;
  border-top: 2px solid var(--line);
}
.fact {
  display: grid; grid-template-columns: 10rem 1fr; gap: 0.8rem;
  padding: 0.6rem 0.2rem; border-bottom: 1px dotted var(--line);
  font-size: 0.9rem;
}
.fact dt { color: var(--ink2); font-weight: bold; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; padding-top: 0.15rem; }
.fact dd { margin: 0; color: var(--paper-dim); }

/* figure chips */
.fig-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: 0.7rem; }
.fig {
  text-align: left; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.7rem 0.85rem; color: var(--paper);
  border: 2.5px solid var(--ink2);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.24));
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
}
.fig:hover { transform: translate(-2px, -2px); border-color: var(--ink1); box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45); }
.fig:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4); }
.fig-name { font-weight: bold; font-size: 0.98rem; }
.fig-epi { font-size: 0.78rem; font-style: italic; color: var(--paper-dim); }
.fig-cantos { font-size: 0.66rem; letter-spacing: 0.12em; color: var(--ink1); text-transform: uppercase; }
.fig.read .fig-name::after { content: " ✦"; color: var(--ink1); font-size: 0.7rem; }

/* exit */
.exit-actions { margin-top: 2.4rem; text-align: center; }
.exit-note { color: var(--paper-dim); font-size: 0.9rem; max-width: 30rem; margin: 0.9rem auto 0; }

/* ==================================================================
   MARGINALIA — illuminated accents (toybox scatter lives only here)
   ================================================================== */
.marginalia { position: static; }
.marg-note {
  position: absolute; max-width: 12.5rem;
  display: flex; gap: 0.5rem; align-items: flex-start;
  color: var(--ink2); font-size: 0.74rem; line-height: 1.45;
}
.marg-note p { margin: 0; }
.marg-ico { width: 22px; height: 22px; flex: none; color: var(--ink1); }
.pos0 { left: -15.5rem; top: 3rem; transform: rotate(-2.4deg); }
.pos1 { right: -15.5rem; top: 12rem; transform: rotate(1.8deg); }
@media (min-width: 1500px) {
  .station .st-inner { max-width: 44rem; }
}
@media (max-width: 1499px) {
  .marg-note { position: static; transform: none; max-width: 30rem; margin: 1rem auto 0; }
}

/* ==================================================================
   BUTTONS
   ================================================================== */
.btn {
  font-family: inherit; cursor: pointer;
  color: #14100c; background: var(--ink1);
  border: 2px solid #14100c; border-radius: var(--ink-radius);
  padding: 0.5rem 1.1rem; font-weight: bold; font-size: 0.9rem;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45); }
.btn.ghost {
  background: transparent; color: var(--paper);
  border-color: var(--ink2); box-shadow: none;
}
.btn.ghost:hover { border-color: var(--ink1); color: var(--ink1); }
.btn.small { font-size: 0.74rem; padding: 0.32rem 0.7rem; }
.btn.big { font-size: 1.05rem; padding: 0.7rem 1.6rem; }
.btn:disabled { opacity: 0.5; cursor: wait; }

#page-nav {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%);
  z-index: 12; display: flex; gap: 0.6rem;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-pill span { letter-spacing: 0.06em; }

/* ==================================================================
   OVERLAYS (map / archive / help)
   ================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  background: var(--noise), rgba(10, 8, 6, 0.985);
  display: flex; flex-direction: column;
  padding: 0.8rem clamp(0.8rem, 3vw, 2rem) 1rem;
}
.overlay-bar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  border-bottom: 2px solid var(--ink1); padding-bottom: 0.6rem;
}
.overlay-title { margin: 0; font-size: 1.15rem; letter-spacing: 0.08em; color: var(--paper); }
.overlay-tools { display: flex; gap: 0.5rem; align-items: center; margin-left: auto; flex-wrap: wrap; }
.overlay-hint { margin: 0.5rem 0 0; font-size: 0.78rem; color: var(--ink2); }
.place-line { margin: 0; font-size: 0.78rem; font-style: italic; color: var(--ink2); }

/* map */
#map-stage {
  flex: 1; min-height: 0; margin-top: 0.8rem;
  perspective: 1300px; touch-action: none;
  display: grid; place-items: center;
}
#map-inner {
  width: min(92vw, 640px); height: min(78vh, 780px);
  transform-style: preserve-3d; will-change: transform;
  border: 2px solid var(--line); border-radius: var(--ink-radius);
  background: #14110d;
}
#cone-svg { width: 100%; height: 100%; display: block; }
.map-label { font-family: var(--serif); font-size: 17px; letter-spacing: 0.06em; }
.map-label.big { font-size: 19px; }
.map-label.small { font-size: 14.5px; letter-spacing: 0.04em; }
.map-ref { font-size: 13px; letter-spacing: 0.1em; }
.map-band { cursor: pointer; }
.map-band .band-stroke { transition: stroke-width 0.2s, filter 0.2s; }
.map-band:hover .band-stroke, .map-band:focus-visible .band-stroke { stroke-width: 4.5; filter: brightness(1.25); }
.map-band.here .band-stroke {
  stroke-width: 5;
  animation: bandPulse 2.4s ease-in-out infinite;
}
@keyframes bandPulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: 0.45; } }
.band-dash { animation: dashDrift 26s linear infinite; }
@keyframes dashDrift { to { stroke-dashoffset: -560; } }
.soul-dot { animation: soulDrift 9s ease-in-out infinite alternate; }
.soul-dot:nth-child(2) { animation-delay: -3s; }
.soul-dot:nth-child(3) { animation-delay: -6s; }
@keyframes soulDrift {
  from { transform: translateX(-14px); opacity: 0.5; }
  to { transform: translateX(14px); opacity: 1; }
}
.glyph { animation: glyphBob 5s ease-in-out infinite alternate; }
@keyframes glyphBob { from { transform: translateY(-2px); } to { transform: translateY(2px); } }

/* archive */
#archive-tabs {
  display: flex; gap: 0.4rem; flex-wrap: nowrap; overflow-x: auto;
  padding: 0.7rem 0 0.6rem; border-bottom: 1px solid var(--line);
}
.tab {
  font-family: inherit; cursor: pointer; white-space: nowrap;
  background: none; color: var(--paper-dim);
  border: 2px solid var(--line); border-radius: var(--ink-radius);
  padding: 0.35rem 0.85rem; font-size: 0.84rem;
}
.tab:hover { color: var(--paper); border-color: var(--ink2); }
.tab.on { color: #14100c; background: var(--ink1); border-color: var(--ink1); font-weight: bold; }
#archive-content { flex: 1; min-height: 0; overflow-y: auto; padding: 1.2rem 0.2rem 2rem; max-width: 46rem; }
#archive-content .lede {
  font-size: 1.12rem; font-style: italic; color: var(--ink1);
  border-left: 4px solid var(--ink2); padding-left: 0.9rem;
}
#archive-content p { color: var(--paper-dim); }
#archive-content h3 { color: var(--paper); }
.archive-goto { margin-top: 1.6rem; }
.archive-goto .mini-label { display: block; font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink2); margin-bottom: 0.4rem; }
.mini-label { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink2); }

/* timeline */
.tl-legend-row { display: flex; gap: 1.1rem; flex-wrap: wrap; margin: 1rem 0 1.4rem; }
.tl-legend { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; color: var(--paper-dim); }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 2px solid rgba(0,0,0,0.3); }
.tl-dot.ink1 { background: var(--ink1); }
.tl-dot.ink2 { background: var(--ink2); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 0.2rem; }
.tl-item {
  display: grid; grid-template-columns: 4.4rem 14px 1fr; gap: 0.7rem;
  padding: 0.55rem 0; border-bottom: 1px dotted var(--line);
  align-items: baseline;
}
.tl-year { color: var(--ink1); font-weight: bold; font-size: 0.85rem; text-align: right; }
.tl-item h3 { margin: 0; font-size: 0.98rem; color: var(--paper); }
.tl-item p { margin: 0.15rem 0 0; font-size: 0.84rem; }

/* help */
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding-top: 1rem; overflow-y: auto; }
.key-row { display: grid; grid-template-columns: minmax(8rem, 13rem) 1fr; gap: 0.8rem; padding: 0.4rem 0; border-bottom: 1px dotted var(--line); font-size: 0.86rem; align-items: baseline; }
.key-row span { color: var(--paper-dim); }
kbd, .kbd-wide {
  font-family: inherit; font-size: 0.78rem; color: var(--ink1); font-weight: bold;
  border: 1.5px solid var(--ink2); border-radius: 6px; padding: 0.12rem 0.45rem;
  background: rgba(0, 0, 0, 0.3); white-space: nowrap;
}

/* ==================================================================
   PANELS — illuminated manuscript frames
   ================================================================== */
#panel-root { position: fixed; inset: 0; z-index: 30; }
#panel-root[hidden] { display: none; }
.panel-backdrop {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(8, 6, 4, 0.72);
  background-image: radial-gradient(var(--ink1) 0.9px, transparent 1.2px);
  background-size: 10px 10px;
}
.panel {
  position: absolute; left: 50%; top: 50%;
  width: min(40rem, 92vw); max-height: min(86vh, 60rem);
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column;
  overflow-y: auto;
  background: var(--noise), linear-gradient(180deg, #2a241d, #1c1712);
  border: 3px solid var(--ink1); border-radius: var(--ink-radius);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.5);
}
.panel-head { padding: 1.2rem 1.5rem 0.4rem; }
.ptype {
  font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: #14100c; background: var(--ink2); padding: 0.1rem 0.5rem; border-radius: 4px;
}
.panel-title { margin: 0.5rem 0 0.1rem; font-size: 1.7rem; color: var(--paper); line-height: 1.1; }
.panel-epithet { margin: 0; font-style: italic; color: var(--ink1); font-size: 0.95rem; }
.panel-body { padding: 0.6rem 1.5rem 1rem; }
.panel-body p { color: var(--paper-dim); margin: 0 0 0.9rem; font-size: 0.95rem; }
.panel-body .dropable:first-of-type::first-letter {
  font-size: 3.1em; float: left; line-height: 0.82;
  padding: 0.06em 0.12em 0 0; color: var(--ink1); font-weight: bold;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}
.panel-see { margin-top: 1rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }
.chip {
  font-family: inherit; cursor: pointer; font-size: 0.8rem;
  color: var(--paper); background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid var(--ink2); border-radius: 255px 12px 225px 12px / 12px 225px 12px 255px;
  padding: 0.25rem 0.7rem;
}
.chip:hover { border-color: var(--ink1); color: var(--ink1); }
.panel-foot {
  display: flex; gap: 0.5rem; justify-content: space-between; align-items: center;
  padding: 0.8rem 1.5rem 1.2rem; border-top: 1px solid var(--line);
}

/* the one elastic bounce — panel opening only */
.bounce-in { animation: panelBounce 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes panelBounce {
  0% { transform: translate(-50%, -50%) scale(0.86) translateY(18px); opacity: 0; }
  62% { transform: translate(-50%, -50%) scale(1.025) translateY(0); opacity: 1; }
  82% { transform: translate(-50%, -50%) scale(0.992); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.fade-in { animation: panelFade 0.25s ease both; }
@keyframes panelFade { from { opacity: 0; } to { opacity: 1; } }

/* ==================================================================
   ASCENT state
   ================================================================== */
body.ascent .station { transition: none; }
body.ascent #hud-progress-fill { transition: width 0.28s ease; }

/* ==================================================================
   RESPONSIVE
   ================================================================== */
.desk-only { display: inline; }
@media (max-width: 1080px) {
  #ladder { display: none; }
}
@media (max-width: 900px) {
  #depth-rail { display: none; }
  .help-cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .desk-only { display: none; }
  .hud-brand { display: none; }
  .hud-actions .kbd-hint { display: none; }
  #hud { gap: 0.6rem; padding: 0.45rem 0.7rem 0.55rem; }
  .station { padding: 5.4rem 0.9rem 6.5rem; min-height: auto; }
  .btn.small { font-size: 0.7rem; padding: 0.3rem 0.55rem; }
  .btn.small#help-btn { min-width: 2.2rem; }
  .nav-pill { font-size: 0.8rem; padding: 0.55rem 0.9rem; }
  #toast { bottom: 4.6rem; }
  .fact { grid-template-columns: 1fr; gap: 0.15rem; }
  .panel { width: 96vw; max-height: 88vh; }
  .panel-head, .panel-body, .panel-foot { padding-left: 1rem; padding-right: 1rem; }
  .map-label { font-size: 22px; }
  .map-ref { font-size: 17px; }
  .map-label.big { font-size: 24px; }
  #map-inner { width: 96vw; height: min(72vh, 720px); }
  .overlay { padding: 0.6rem 0.7rem 0.8rem; }
  .overlay-title { font-size: 1rem; }
  .overlay-tools { margin-left: 0; }
  #archive-content { max-width: none; }
}

/* ==================================================================
   REDUCED MOTION
   ================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .bounce-in { animation-name: panelFade; }
}
