:root {
  --bg: #0c1019;
  --bg-elev: #151927;
  --bg-soft: #181e2c;
  --line: #252d3a;
  --ink: #efece5;
  --muted: #8b93a3;
  --gold: #dcb832;
  --gold-dim: #544725;
  --paper: #efece5;
  --paper-ink: #1b140c;
  --danger: #bd2e2e;
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --serif: "Cormorant Garamond", "Palatino", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); }
body { background:
  radial-gradient(1200px 500px at 10% -10%, rgba(220,184,50,0.08), transparent 50%),
  radial-gradient(900px 400px at 100% 0%, rgba(70,90,140,0.16), transparent 45%),
  var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

#app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #dcb832, #a36b16);
  box-shadow: 0 0 24px rgba(220,184,50,0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: 0.01em; }
.brand-text em { font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.nav { display: flex; gap: 6px; }
.nav a {
  padding: 8px 12px; border-radius: 999px; color: var(--muted);
  font-size: 13px; font-weight: 500;
}
.nav a:hover, .nav a.active { color: var(--gold); background: rgba(220,184,50,0.08); }

.view { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 140px; flex: 1; }
.hero { max-width: 720px; }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin: 0 0 12px; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(40px, 7vw, 72px); line-height: 0.95; margin: 0 0 16px; }
.lede { font-size: 18px; color: var(--muted); max-width: 38rem; line-height: 1.5; }

.votd {
  margin-top: 36px; padding: 28px; border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(180deg, rgba(220,184,50,0.06), transparent 40%), var(--bg-elev);
}
.votd q { display: block; font-family: var(--serif); font-size: clamp(24px, 4vw, 34px); line-height: 1.25; quotes: none; }
.votd cite { display: block; margin-top: 14px; font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--gold); letter-spacing: 0.08em; }

.search-row { display: flex; gap: 10px; margin: 28px 0 10px; }
.search-row input, .toolbar input, .toolbar select {
  flex: 1; background: var(--bg-elev); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; outline: none;
}
.search-row input:focus, .toolbar input:focus, .toolbar select:focus { border-color: var(--gold); }
.search-row button, .primary {
  background: var(--gold); color: #1b140c; border: 0; border-radius: 12px;
  padding: 14px 18px; font-weight: 600; cursor: pointer;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chips button {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 12px; cursor: pointer; font-size: 13px;
}
.chips button:hover { color: var(--gold); border-color: var(--gold-dim); }

.results { display: grid; gap: 10px; margin-top: 22px; }
.card {
  display: block; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px;
}
.card:hover { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.ref { font-family: var(--mono); font-size: 12px; color: var(--gold); letter-spacing: 0.04em; }
.card p, .verse p { margin: 8px 0 0; line-height: 1.55; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.toolbar select { min-width: 180px; }
.pager { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pager button {
  background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; cursor: pointer;
}
.pager button:disabled { opacity: 0.35; cursor: default; }
.listen-btn { min-height: 44px; }
#player {
  display: block; width: 100%; margin-top: 10px; height: 40px;
}
.lyrics-bar #player { margin: 0; max-width: 280px; }
.play-v {
  width: 36px; height: 36px; min-width: 36px;
}

.chapter {
  background: var(--paper); color: var(--paper-ink); border-radius: 22px;
  padding: 36px 32px 48px; box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}
.chapter h2 { font-family: var(--serif); font-size: 42px; margin: 0 0 8px; }
.chapter .meta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: #8a7e6e; margin-bottom: 24px; }
.verse { display: grid; grid-template-columns: 36px 1fr; gap: 8px; margin: 0 0 10px; }
.verse .num {
  font-family: var(--mono); font-size: 11px; color: #9a8b76; padding-top: 8px;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.verse p { font-family: var(--serif); font-size: 22px; line-height: 1.45; margin: 0; }

.status { color: var(--muted); font-size: 14px; }
.error { color: #f0b4b4; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 36px; }
.split h3 { font-family: var(--serif); font-size: 28px; margin: 0 0 12px; }
.chip, .chips .chip {
  display: inline-block; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.chip.on { color: var(--gold); border-color: var(--gold-dim); background: rgba(220,184,50,0.08); }
.verse {
  display: grid; grid-template-columns: 36px 1fr; gap: 8px; width: 100%;
  background: none; border: 0; padding: 6px 0; text-align: left; cursor: pointer; color: inherit;
}
.verse.reading { background: rgba(220,184,50,0.12); border-radius: 10px; }
.verse.reading .txt { box-shadow: inset 0 -0.45em 0 rgba(220,184,50,0.45); }
.w.lyric { background: rgba(220,184,50,0.35); }
.chapter .txt i { font-style: italic; font-weight: 400; color: #5c5348; }
.lyrics-bar[hidden] { display: none !important; }
.lyrics-bar.dock:not([hidden]) {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; gap: 8px;
  background: rgba(12,16,25,0.96); border-top: 1px solid var(--gold-dim);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); z-index: 40;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.45);
}
.lyrics-bar p { margin: 0; }
.dock-copy [data-lyric-text] { font-family: var(--serif); font-size: 16px; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.dock-seek { display: grid; grid-template-columns: 48px 1fr 48px; gap: 10px; align-items: center; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.dock-seek input[type="range"] { width: 100%; accent-color: var(--gold); }
.lyrics-transport { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; align-items: center; }
.lyrics-transport button {
  background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 14px; cursor: pointer; min-height: 44px; min-width: 44px;
}
.lyrics-transport button.primary, .dock-play { background: var(--gold); color: #1b140c; border-color: var(--gold); min-width: 88px; font-weight: 600; }
.lyrics-transport button:disabled { opacity: 0.35; cursor: default; }
.lyrics-bar #player { display: none; }
.media-rail { margin: 0 0 18px; }
.media-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.media-card {
  display: flex; gap: 10px; align-items: center; min-width: 240px; max-width: 320px;
  text-align: left; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px; color: inherit; cursor: pointer;
}
.media-card em { display: block; color: var(--muted); font-size: 12px; }
.media-play { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: #1b140c; display: grid; place-items: center; flex-shrink: 0; }
.media-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.72); z-index: 50; display: grid; place-items: center; padding: 24px; }
.media-sheet { width: min(860px, 100%); background: var(--bg-elev); border-radius: 16px; padding: 16px; display: grid; gap: 12px; }
.media-sheet header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.media-frame { aspect-ratio: 16/9; background: #000; border-radius: 10px; overflow: hidden; }
.media-frame iframe { width: 100%; height: 100%; border: 0; }
button.card, .linkish { cursor: pointer; font: inherit; color: inherit; text-align: left; }
.linkish { background: none; border: 0; color: var(--gold); text-decoration: underline; padding: 0; min-height: auto; }
.verse.marked .txt { box-shadow: inset 0 -0.4em 0 rgba(220,184,50,0.35); }
.verse.picked { background: rgba(220,184,50,0.12); border-radius: 10px; }
.compare-line {
  grid-column: 2; margin: 4px 0 8px; font-size: 15px; line-height: 1.4;
  color: #6b5a45; font-style: italic;
}
.now-verse { margin: 10px 0 8px; color: var(--muted); font-size: 14px; }
.now-verse a { color: var(--gold); }
.feat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0;
}
.feat-grid a {
  display: grid; gap: 2px; padding: 14px 14px; min-height: 72px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
}
.feat-grid strong { font-family: var(--serif); font-size: 20px; }
.feat-grid em { font-style: normal; font-size: 12px; color: var(--muted); }
.verse-bar {
  position: fixed; left: 10px; right: 10px; z-index: 29;
  bottom: calc(4.75rem + env(safe-area-inset-bottom));
  background: #16110a; border: 1px solid #6a5a32; border-radius: 16px;
  padding: 10px 12px 12px; box-shadow: 0 -12px 32px rgba(0,0,0,0.35);
}
.verse-bar .ref { margin: 0 0 8px; }
.verse-bar-acts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.verse-bar-acts button, .verse-bar-acts .chip {
  min-height: 40px; border-radius: 10px; border: 1px solid #6a5a32;
  background: #1a160f; color: #f3ead6; font-size: 12px;
  display: grid; place-items: center;
}
body:has(.lyrics-bar.dock:not([hidden])) .verse-bar {
  bottom: calc(12.5rem + env(safe-area-inset-bottom));
}
.setting { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); }
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex;
  align-items: flex-end; justify-content: center; z-index: 20;
}
.sheet {
  width: min(560px, 100%); background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 22px; display: grid; gap: 12px;
}
.sheet-actions, .sheet button { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-refs { margin-top: 10px; }
.verse-panel { max-height: 82dvh; overflow: auto; }
.ask-log { max-height: 28vh; overflow: auto; margin-bottom: 10px; }
.ask-log p { margin: 0 0 8px; }
.sheet .kicker { display: block; margin: 10px 0 6px; }
.sheet textarea, .sheet button:not(.primary),
.studio-grid textarea, .studio-grid button:not(.primary) {
  background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.studio-grid textarea { width: 100%; min-height: 84px; resize: vertical; }
.studio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.studio-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.feature-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 8px; }
blockquote.votd { margin: 12px 0 20px; }
.quiet-links { display: flex; gap: 18px; margin: 14px 0 0; font-size: 14px; }
.quiet-links a { color: var(--gold); border-bottom: 1px solid var(--gold-dim); }
.az { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.dict-shell { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 22px; margin-top: 18px; align-items: start; }
.dict-rail { display: grid; gap: 2px; max-height: 70vh; overflow: auto; }
.rail { display: block; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.rail.on, .rail:hover { background: var(--bg-elev); color: var(--ink); }
.entry { background: var(--paper); color: var(--paper-ink); border-radius: 18px; padding: 28px 26px 36px; }
.entry h2 { font-family: var(--serif); font-size: clamp(32px, 5vw, 48px); margin: 0 0 16px; line-height: 1.05; }
.entry p { font-size: 17px; line-height: 1.6; margin: 0 0 14px; }
.entry .status a { color: #6b4f1d; }
.w {
  display: inline; padding: 0; margin: 0 2px 0 0; border: 0; background: none;
  color: inherit; font: inherit; border-bottom: 1px dotted #b9a27a; cursor: pointer;
}
.w:hover, .w.on { color: #7a5416; border-bottom-color: #7a5416; background: rgba(220,184,50,0.16); }
.drawer {
  position: sticky; bottom: 12px; margin-top: 28px;
  background: var(--paper); color: var(--paper-ink);
  border: 1px solid #d8cbb3; border-radius: 16px;
  padding: 18px 20px 20px; box-shadow: 0 -16px 40px rgba(0,0,0,0.18);
}
.drawer[hidden] { display: none !important; }
.drawer header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer h3 { font-family: var(--serif); font-size: 28px; margin: 0; }
.drawer .lemma { font-size: 18px; margin: 8px 0 10px; }
.drawer .lemma i { font-style: italic; color: #6b5a45; }
.chapter { padding-bottom: 28px; }

.mini-map { width: 100%; height: 180px; border: 0; border-radius: 10px; margin: 8px 0 12px; }
.plan-card { margin-top: 22px; }
.card.on { border-color: var(--gold-dim); }
.audio-src { font-family: var(--mono); font-size: 11px; color: var(--muted); align-self: center; }
.view.bte-page { width: 100%; max-width: none; padding: 0; }
.bte-head {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  margin: 0; padding: 6px 12px 0;
}
.bte-head h1 { font-family: var(--serif); font-size: 20px; margin: 0; font-weight: 600; }
.bh-read {
  min-height: 36px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--gold); font-size: 13px;
}
.bh-find { margin: 6px 12px 8px; }
.bh-find input {
  width: 100%; min-height: 40px; padding: 10px 14px;
  background: var(--bg-elev); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px;
}
body.timeline-app .topbar { display: none; }
body.timeline-app .chips {
  padding: 8px 12px 4px;
  position: relative;
  z-index: 6;
}
.bh-stage { min-height: 0; }
.bh-shell {
  display: flex; flex-direction: column;
  height: calc(100dvh - 3.65rem - env(safe-area-inset-bottom, 0px));
}
.bh-main { min-width: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.bh-ages { display: none; }
.bh-find {
  display: none; position: absolute; z-index: 10;
  top: max(8px, env(safe-area-inset-top, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  margin: 0;
}
.bh-shell.searching .bh-find { display: block; }
.bh-hud {
  display: flex; align-items: center; gap: 8px;
  flex: 0 0 auto; z-index: 10; min-width: 0;
  overflow: hidden;
  padding: 8px 10px 8px 12px;
  background: rgba(12,9,6,0.96);
  border-bottom: 1px solid rgba(220,184,50,0.2);
}
.bh-hud .bh-periods {
  position: static; flex: 1 1 auto; min-width: 0;
  overflow-x: auto; overflow-y: hidden;
  padding: 0; background: none; backdrop-filter: none;
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent);
}
.bh-hud .bh-zoom {
  flex: 0 0 auto; position: relative; z-index: 3;
  background: #120e08;
  box-shadow: -18px 0 16px 8px #120e08;
}
.bh-hud .bh-search-btn { flex: 0 0 auto; z-index: 3; }
.bh-periods {
  display: flex; gap: 8px; overflow-x: auto;
  position: absolute; z-index: 9; left: 0; right: 0; top: 0;
  padding: 10px 12px 28px;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  background: linear-gradient(180deg, rgba(12,9,6,0.88) 35%, transparent);
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.bh-periods::-webkit-scrollbar { display: none; }
.bh-period {
  flex: 0 0 auto; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(220,184,50,0.28); color: #f3ead6;
  background: rgba(18,14,8,0.72); backdrop-filter: blur(14px);
  font-size: 14px; white-space: nowrap; display: grid; place-items: center;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.bh-period.on { background: #dcb832; color: #1a1408; border-color: #dcb832; }
.bh-lane-pills {
  display: flex; gap: 8px; overflow-x: auto;
  position: absolute; z-index: 9; left: 0; right: 0; top: 54px;
  padding: 0 12px; scrollbar-width: none;
}
.bh-lane-pill {
  flex: 0 0 auto; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid rgba(220,184,50,0.28); color: #d8cba8;
  background: rgba(18,14,8,0.72); font-size: 14px; display: grid; place-items: center;
  touch-action: manipulation;
}
.bh-lane-pill.on { background: #dcb832; color: #1a1408; border-color: #dcb832; }
.bh-wrap { margin: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.bh-toolbar {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  position: absolute; z-index: 8; left: 12px; right: 12px; top: 54px;
  padding: 0; pointer-events: none;
}
.bh-toolbar > * { pointer-events: auto; }
.bh-viewing { display: none; }
.bh-search-btn {
  width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid rgba(220,184,50,0.28);
  background: rgba(18,14,8,0.78); color: #f3ead6; cursor: pointer;
  display: grid; place-items: center; backdrop-filter: blur(14px);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.bh-now {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center;
  position: absolute; z-index: 8; left: 12px; right: 12px; bottom: 10px;
  padding: 8px 14px; min-height: 44px; border-radius: 999px;
  background: rgba(18,14,8,0.86); border: 1px solid rgba(220,184,50,0.28);
  backdrop-filter: blur(16px);
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: #dcb832;
  font-variant-numeric: tabular-nums;
}
.bh-now input[type="range"] { width: 100%; accent-color: #dcb832; min-height: 28px; }
.bh-zoom {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 3px; padding: 3px;
  background: rgba(18,14,8,0.78); border: 1px solid rgba(220,184,50,0.25);
  border-radius: 12px; backdrop-filter: blur(14px);
}
.bh-zoom button:nth-child(n+4) { display: none; }
.bh-zoom button {
  min-height: 40px; border-radius: 9px; border: 0;
  background: transparent; color: #f3ead6; cursor: pointer; font-weight: 600;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.bh-zoom button.on { background: #dcb832; color: #1a1408; }
.bh-scroll {
  overflow: auto;
  background: #120e08;
  flex: 1; min-height: 0; height: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior: contain;
}
.bh-canvas { position: relative; min-height: 100%; min-width: 100%; }
.bh-wrap[data-phone="1"] .bh-eras { top: 104px; }
.bh-wrap[data-phone="1"] .bh-ruler.am { height: 104px; }
.bh-wrap[data-phone="1"] .bh-lens { top: 104px; }
.bh-sticky-labs { position: sticky; left: 0; width: 0; z-index: 5; pointer-events: none; }
.bh-lane-lab {
  position: absolute; left: 0; width: 18px; display: flex; align-items: center;
  justify-content: center;
  writing-mode: vertical-rl; transform: rotate(180deg);
  background: linear-gradient(0deg, rgba(18,14,8,0.75) 30%, transparent);
  color: #dcb832; font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em;
  text-transform: uppercase; padding: 10px 0;
}
.bh-period:active, .bh-lane-pill:active, .bh-search-btn:active,
.bh-zoom button:active, .bh-life:active { filter: brightness(1.12); }
.bh-period:focus-visible, .bh-lane-pill:focus-visible, .bh-search-btn:focus-visible,
.bh-zoom button:focus-visible, .bh-life:focus-visible, .bh-mark:focus-visible {
  outline: 2px solid #dcb832; outline-offset: 2px;
}
@media (hover: hover) {
  .bh-period:hover, .bh-lane-pill:hover, .bh-search-btn:hover { border-color: #dcb832; }
}
@media (prefers-reduced-motion: reduce) {
  .bh-life, .bh-mark, .bh-period, .bh-zoom button, .bh-drawer, .bh-scroll {
    transition: none;
  }
}
.bh-lane-band { position: absolute; left: 0; right: 0; pointer-events: none; }
.bh-lane-band.alt { background: rgba(255,255,255,0.025); }
.bh-lens { position: absolute; top: 28px; bottom: 36px; width: 0; z-index: 6; pointer-events: none; }
.bh-lens i {
  position: absolute; top: 0; bottom: 0; width: 1px; background: #f3e2a8;
  box-shadow: 0 0 10px rgba(220,184,50,0.8);
}
.bh-lens-card {
  pointer-events: auto; position: absolute; top: 10px; left: 10px;
  min-width: 220px; max-width: min(280px, 70vw);
  background: rgba(16,12,8,0.94); border: 1px solid #dcb832; border-radius: 12px; padding: 10px 12px;
  color: #f3ead6; font-size: 13px;
  backdrop-filter: blur(12px);
}
.bh-lens-card strong { display: block; color: #dcb832; margin-bottom: 8px; font-family: var(--mono); font-size: 13px; }
.bh-lens-card button {
  display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: center;
  width: 100%; text-align: left; background: none; border: 0;
  color: inherit; padding: 6px 0; cursor: pointer; font: inherit;
}
.bh-lens-card button img {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
}
.bh-lens-card button span { min-width: 0; }
.bh-lens-card button b { display: block; font-size: 13px; font-weight: 600; }
.bh-lens-card button:hover { color: #dcb832; }
.bh-lens-card i { display: block; font-style: normal; color: #dcb832; font-size: 10px; margin-top: 2px; }
.bh-mark.cluster span { border-radius: 2px; width: 14px; height: 14px; background: #e8c35a; }
.bh-eras { position: absolute; inset: 28px 0 34px 0; }
.bh-era {
  position: absolute; top: 0; bottom: 0;
  border-right: 1px solid rgba(220,184,50,0.22);
  background-size: cover; background-position: center 18%;
  background-color: color-mix(in srgb, var(--era) 55%, #4a3414);
  background-blend-mode: soft-light, normal;
}
.bh-era span {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; font-family: var(--serif);
  font-size: 14px; letter-spacing: 0.03em;
  color: #f7edd4; text-shadow: 0 1px 10px #000, 0 0 18px #000;
}
.bh-era small {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: #dcb832;
}
.bh-life {
  position: absolute; height: 36px; display: block;
  padding: 0; border: 0; background: none; color: #1a1408;
  cursor: pointer; text-align: left; overflow: visible; font: inherit; z-index: 2;
}
.bh-life-line {
  position: absolute; left: 0; right: 0; top: 50%; height: 3px;
  transform: translateY(-50%); border-radius: 99px;
  background: linear-gradient(90deg, #ead07a, rgba(184,136,40,0.45));
  pointer-events: none;
}
.bh-life-pill {
  position: sticky; left: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px 0 4px; border-radius: 999px;
  background: linear-gradient(180deg, #ead07a, #b88828);
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
.bh-life-pic {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  flex: 0 0 auto; background: #1a1408; border: 1px solid #1a1408;
}
.bh-life strong {
  font-size: 13px; font-weight: 700; white-space: nowrap; overflow: visible;
}
.bh-life.on .bh-life-pill, .bh-life:hover .bh-life-pill { filter: brightness(1.08); box-shadow: 0 0 0 1px #f3e2a8; }
.bh-event-rail {
  position: absolute; left: 0; right: 0; height: 42px;
  border-top: 1px dashed rgba(220,184,50,0.18);
}
.bh-stack {
  position: absolute; z-index: 3;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.bh-stack .bh-mark {
  position: relative; left: auto; top: auto; transform: none;
  min-width: 0; min-height: 0; width: auto; padding: 0;
  display: flex; align-items: center; gap: 8px; text-align: left;
}
.bh-stack .bh-mark span { margin: 0; width: 9px; height: 9px; flex: 0 0 auto; }
.bh-stack .bh-mark em { margin: 0; max-width: 200px; }
.bh-mark {
  position: absolute; transform: translateX(-50%);
  background: none; border: 0; color: #f3ead6; cursor: pointer;
  padding: 4px 0 0; width: auto; min-width: 88px; min-height: 52px; text-align: center; font: inherit;
  z-index: 3;
}
.bh-mark.labeled {
  transform: none; text-align: left; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  min-height: 0; padding: 0;
}
.bh-mark.labeled span { margin: 0 0 6px; }
.bh-mark-pic {
  width: 80px; height: 52px; object-fit: cover; border-radius: 7px;
  display: block; border: 1px solid rgba(220,184,50,0.35);
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}
.bh-mark span {
  display: block; width: 13px; height: 13px; margin: 0 auto 6px;
  background: #dcb832; transform: rotate(45deg);
  box-shadow: 0 0 0 2px #120e08, 0 0 10px rgba(220,184,50,0.45);
}
.bh-mark em {
  display: block; font-style: normal; font-size: 11px; line-height: 1.2; font-weight: 600;
  color: #f7edd4; white-space: nowrap; max-width: 148px; margin: 0 auto;
  overflow: hidden; text-overflow: ellipsis;
  background: rgba(12,9,6,0.9); border: 1px solid rgba(220,184,50,0.28);
  border-radius: 6px; padding: 3px 7px;
}
.bh-mark.on span, .bh-mark:hover span { background: #fff3c4; }
.bh-ruler {
  position: absolute; left: 0; right: 0; height: 28px;
}
.bh-ruler.am { top: 0; border-bottom: 1px solid #6a5a32; background: rgba(18,14,8,0.7); }
.bh-ruler.bc { bottom: 0; height: 34px; border-top: 1px solid #6a5a32; background: rgba(18,14,8,0.85); }
.bh-tick {
  position: absolute; top: 8px; transform: translateX(-50%);
  font-family: var(--mono); font-size: 10px; color: #cbb98a; white-space: nowrap;
}
.bh-tick.am { top: 6px; color: #dcb832; }
.bh-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 24;
}
.bh-drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  max-height: 72dvh; overflow: auto;
  background: #16110a; border: 1px solid #6a5a32;
  border-radius: 18px 18px 0 0;
  padding: 6px 16px calc(5.75rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -16px 40px rgba(0,0,0,0.45);
  overscroll-behavior: contain;
}
.bh-sheet-grip {
  width: 42px; height: 4px; border-radius: 99px; background: #6a5a32;
  margin: 8px auto 10px;
}
.bh-sheet-close {
  position: absolute; top: 10px; right: 12px;
  min-height: 36px; min-width: 64px; padding: 0 12px;
  border: 0; background: #dcb832; color: #1a1408; border-radius: 999px;
  font-weight: 600; font-size: 13px;
}
.bh-drawer .dossier { padding-top: 28px; }
.bh-drawer .dossier-scene { margin: 0 -16px 12px; }
.bh-drawer .dossier-scene img { width: 100%; height: 140px; object-fit: cover; border-radius: 0; }
.bh-drawer .dossier h2 { font-size: 22px; line-height: 1.15; margin: 0 0 6px; }
.bte-tabs { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 4px; margin: 10px 0 12px; }
.bte-tabs button { min-height: 40px; font-size: 12px; padding: 0 4px; }
.bte-tabs { display: flex; gap: 6px; margin: 10px 0 12px; }
.bte-tabs button {
  flex: 1; height: 34px; border: 1px solid #6a5a32; background: #1a160f; color: #d8cba8;
  border-radius: 4px; cursor: pointer;
}
.bte-tabs button.on { background: #dcb832; color: #1a1408; border-color: #dcb832; }
.bh-lens-card { top: auto; bottom: 8px; left: 8px; max-width: min(240px, 78vw); }
.bh-shell.has-drawer .bh-scroll { height: auto; }

body.timeline-app:has(.bh-phone) .bte-head { display: none; }
body.timeline-app:has(.bh-phone) { background: #100c08; }
.bh-phone {
  min-height: 100dvh;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 280px at 50% -8%, rgba(220,184,50,0.1), transparent 55%),
    #100c08;
}
.bh-appbar {
  position: sticky; top: 0; z-index: 12;
  display: grid; grid-template-columns: 1fr 44px;
  align-items: center; gap: 8px;
  padding: calc(6px + env(safe-area-inset-top)) 12px 8px;
  background: rgba(16,12,8,0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid #2a2318;
}
.bh-appbar h1 {
  margin: 0; text-align: left;
  font-family: var(--serif); font-size: 22px; font-weight: 600;
  letter-spacing: 0.01em; color: #f6ecd4;
}
.bh-back {
  min-height: 44px; display: inline-flex; align-items: center;
  color: #dcb832; font-size: 14px; font-weight: 500;
}
.bh-app-actions { display: flex; align-items: center; gap: 4px; }
#bh-search-toggle {
  width: 44px; height: 44px; border: 0; background: none; color: #f3ead6;
  display: grid; place-items: center; cursor: pointer;
}
.bh-phone .bh-read {
  min-height: 32px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid #6a5a32; color: #dcb832; font-size: 13px;
}
.bh-phone .bh-find { display: none; margin: 8px 12px 0; }
.bh-phone.searching .bh-find { display: block; }
.bh-phone .bh-find input {
  min-height: 44px; border-radius: 14px; background: #1a140c;
  border-color: #6a5a32;
}
.bh-phone .bh-ages { padding: 12px 12px 4px; gap: 8px; }
.bh-phone .bh-age {
  min-height: 44px; border-radius: 999px; background: #1a140c;
  border-color: #3a3120;
}
.bh-phone .bh-age.on { background: #dcb832; color: #1a1408; }

.bh-hero-rail {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 10px 16px 6px;
  scroll-padding-inline: 16px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.bh-hero-rail::-webkit-scrollbar { display: none; }
.bh-hero {
  flex: 0 0 min(86vw, 340px);
  scroll-snap-align: start;
  position: relative; isolation: isolate;
  height: 228px; border-radius: 20px; overflow: hidden;
  color: #f6ecd4;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}
.bh-hero img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scale(1.04);
}
.bh-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(16,12,8,0.08) 15%, rgba(16,12,8,0.92) 100%);
}
.bh-hero div {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 18px 16px 16px;
}
.bh-hero em {
  display: block; font-style: normal; font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.08em; color: #dcb832; margin-bottom: 4px;
}
.bh-hero strong {
  display: block; font-family: var(--serif); font-size: 30px;
  font-weight: 600; line-height: 1.05; letter-spacing: -0.02em;
}
.bh-hero p {
  margin: 6px 0 0; font-size: 13px; line-height: 1.35; color: #e6d8b4;
  max-width: 28ch;
}
.bh-hero.on { outline: 2px solid #dcb832; outline-offset: 2px; }

.bh-people-sec { padding: 8px 0 4px; }
.bh-people {
  display: flex; gap: 14px;
  overflow-x: auto; padding: 4px 16px 8px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.bh-people::-webkit-scrollbar { display: none; }
.bh-person {
  flex: 0 0 76px; padding: 0; border: 0; background: none;
  color: #f3ead6; text-align: center; cursor: pointer;
  scroll-snap-align: start;
}
.bh-person img {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover; display: block; margin: 0 auto 6px;
  border: 2px solid #3a3120; background: #1a140c;
}
.bh-person span {
  display: block; font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bh-person em {
  display: block; font-style: normal; font-family: var(--mono);
  font-size: 10px; color: #cbb98a; margin-top: 2px;
}
.bh-person.on img { border-color: #dcb832; box-shadow: 0 0 0 3px rgba(220,184,50,0.25); }
.bh-person.on span { color: #dcb832; }

.bh-story { padding: 4px 0 8px; }
.bh-beat {
  display: grid; gap: 6px;
  width: 100%; padding: 12px 16px;
  background: none; border: 0; border-bottom: 1px solid #241c12;
  color: inherit; text-align: left;
}
.bh-beat img {
  width: 56px; height: 56px; border-radius: 12px;
  object-fit: cover; background: #1a140c;
}
.bh-beat span { min-width: 0; display: grid; gap: 2px; }
.bh-beat em {
  font-style: normal; font-family: var(--mono); font-size: 11px; color: #dcb832;
}
.bh-beat strong {
  font-family: var(--serif); font-size: 18px; font-weight: 600;
  line-height: 1.15; color: #f6ecd4;
}
.bh-beat b {
  font-weight: 500; font-size: 12px; color: #cbb98a;
}
.bh-beat.on { background: rgba(220,184,50,0.08); }
.bh-beat > button {
  display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center;
  width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
}
.bh-beat-refs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 0 68px; }
.bh-beat-refs .chip { font-size: 12px; }
.bh-empty { margin: 24px 16px; color: #cbb98a; }

.bh-phone .bh-zoom {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
  padding: 8px 12px 4px;
}
.bh-phone .bh-zoom button {
  min-height: 40px; border-radius: 12px;
}
.bh-phone .bh-now {
  display: grid; grid-template-columns: 3.6rem 1fr; gap: 10px;
  align-items: center; padding: 4px 12px 8px;
}
.bh-phone .bh-now[hidden] { display: none; }

.bh-lane-pills {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 6px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.bh-lane-pills::-webkit-scrollbar { display: none; }
.bh-lane-pill {
  flex: 0 0 auto; min-height: 34px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid #3a3120; background: #1a140c; color: #d8cba8; font-size: 12px;
}
.bh-lane-pill.on { background: #dcb832; color: #1a1408; border-color: #dcb832; }

.bh-phone.year .bh-scroll {
  height: calc(100dvh - 15.5rem);
  border-block: 0; background: #120e08;
}
.bh-mark.labeled em {
  display: -webkit-box; font-style: normal; overflow: hidden;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  white-space: normal; max-width: 148px; line-height: 1.2;
}
.bh-phone.year .bh-life { height: 32px; border-radius: 8px; }
.bh-phone.year .bh-life strong { font-size: 12px; }

/* Desktop chrome only for a real pointer - a 1180px iPad is not a desktop. */
@media (min-width: 901px) and (pointer: fine) {
  .bh-phone {
    min-height: auto;
    max-width: 1120px;
    margin: 0 auto;
    padding: 8px 8px 48px;
  }
  .bh-appbar { position: static; background: none; border: 0; padding: 8px 4px; }
  .bh-hero { flex-basis: 280px; height: 188px; }
  .bh-story { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 4px 24px; }
  .now-verse { margin: 8px 0 14px; color: var(--muted); font-size: 14px; }
  body.timeline-app .topbar { display: flex; padding: 12px 22px; }
  .view.bte-page { width: 100%; max-width: none; padding: 0; }
  .bte-head { padding: 0 0 8px; }
  .bte-head h1 { font-size: clamp(28px, 4vw, 42px); }
  .bh-read { display: none; }
  .bh-shell {
    display: flex; flex-direction: column;
    height: calc(100dvh - 64px); max-height: calc(100dvh - 64px);
  }
  .bh-shell.has-drawer { display: grid; grid-template-columns: minmax(0, 1fr) min(380px, 34vw); height: calc(100dvh - 64px); }
  .bh-main {
    display: grid; grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    flex: 1; min-height: 0; position: relative;
  }
  .bh-era-hero {
    grid-column: 1; grid-row: 2;
    min-height: 148px; max-height: 180px;
    background-size: cover; background-position: center 22%;
    position: relative; display: flex; align-items: flex-end;
    padding: 18px 28px 16px 24px;
    border-bottom: 1px solid rgba(220,184,50,0.22);
  }
  .bh-era-hero::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(12,9,6,0.72) 0%, rgba(12,9,6,0.18) 48%, rgba(12,9,6,0.4) 100%);
  }
  .bh-era-hero-copy { position: relative; z-index: 1; color: #f7edd4; max-width: 36rem; }
  .bh-era-hero-copy p {
    margin: 0 0 4px; font-family: var(--mono); font-size: 11px;
    letter-spacing: 0.12em; text-transform: uppercase; color: #dcb832;
  }
  .bh-era-hero-copy h2 {
    margin: 0; font-family: var(--serif); font-size: clamp(32px, 4vw, 48px);
    font-weight: 600; line-height: 1; color: #f7edd4;
  }
  .bh-era-hero-copy em { display: block; margin-top: 6px; font-style: normal; font-size: 15px; color: #e6dcc0; }
  .bh-wrap { display: contents; }
  .bh-hud {
    grid-column: 1; grid-row: 1;
    display: flex; align-items: center; gap: 10px;
    min-width: 0; overflow: hidden;
    padding: 10px 18px; min-height: 56px;
    background: rgba(12,9,6,0.97);
    border-bottom: 1px solid rgba(220,184,50,0.22);
  }
  .bh-hud .bh-periods { padding: 0; min-width: 0; overflow-x: auto; }
  .bh-life-pill { left: 92px; }
  .bh-search-btn { display: grid; }
  .bh-find {
    display: none; position: absolute; z-index: 12; top: 12px; left: 20px; right: 20px; margin: 0;
  }
  .bh-shell.searching .bh-find { display: block; }
  .bh-find { grid-column: 1; grid-row: 1; }
  .bh-shell.searching .bh-hud { visibility: hidden; }
  .bh-periods {
    position: static; background: none; padding: 0;
    backdrop-filter: none; min-width: 0;
  }
  .bh-lane-pills { position: static; padding: 0 0 8px; }
  .bh-lane-lab {
    width: 70px; writing-mode: horizontal-tb; transform: none;
    justify-content: flex-start; padding-left: 8px; font-size: 10px;
    background: linear-gradient(90deg, #120e08 55%, transparent);
  }
  .bh-scrim { display: none; }
  .bh-shell.has-drawer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(400px, 36vw);
    align-items: stretch; gap: 0;
  }
  .bh-ages { display: none; }
  .bh-life { height: 36px; }
  .bh-life-pic { width: 28px; height: 28px; }
  .bh-life strong { font-size: 13px; }
  .bh-age {
    display: grid; min-height: 56px; border-radius: 8px; padding: 10px 14px;
    place-items: center start; text-align: left;
    border: 1px solid #3a3120; background: #16110a; color: #f6ecd4;
  }
  .bh-age strong { font-size: 18px; font-family: var(--serif); }
  .bh-age em { display: none; }
  .bh-age.on { background: #dcb832; color: #1a1408; }
  .bh-toolbar {
    display: none;
  }
  .bh-scroll {
    grid-column: 1; grid-row: 3;
    min-height: 0; height: auto; border: 0; border-radius: 0;
    background: #16110a;
  }
  .bh-viewing { display: none; }
  .bh-zoom { display: flex; grid-template-columns: none; padding: 3px; gap: 3px; }
  .bh-zoom button:nth-child(n+4) { display: none; }
  .bh-zoom button { min-height: 36px; min-width: 72px; }
  .bh-now {
    grid-column: 1; grid-row: 4;
    position: static; left: auto; right: auto; bottom: auto; z-index: 8;
    width: auto; justify-self: stretch; align-self: stretch;
    padding: 8px 18px; min-height: 48px; border-radius: 0;
    background: rgba(18,14,8,0.96); border: 0;
    border-top: 1px solid rgba(220,184,50,0.28);
    backdrop-filter: none;
  }
  .bh-shell.has-drawer .bh-scroll { height: auto; }
  .bh-lane-lab { width: 70px; font-size: 10px; padding-left: 8px; }
  .bh-drawer {
    position: relative; top: auto; left: auto; right: auto; bottom: auto;
    max-height: none; height: 100%; border-radius: 0;
    border: 0; border-left: 1px solid rgba(220,184,50,0.28);
    box-shadow: none; padding: 0 0 16px;
    overflow: auto;
  }
  .bh-sheet-grip, .bh-sheet-close { display: none; }
  .bh-drawer .dossier { padding: 16px 18px 24px; }
  .bh-drawer .dossier-scene { margin: 0 0 14px; }
  .bh-drawer .dossier-scene img { height: 180px; border-radius: 0; width: 100%; object-fit: cover; }
  .bh-drawer .dossier h2 { font-size: 28px; font-family: var(--serif); }
  .bh-mark em {
    display: -webkit-box; font-style: normal; font-size: 12px; color: #f7edd4;
    white-space: normal; max-width: 148px; overflow: hidden;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    line-height: 1.2; transform: none;
  }
  .bh-lens-card { top: 10px; bottom: auto; }
  .bh-era span {
    display: flex; flex-direction: column; padding: 10px 14px;
    font-family: var(--serif); font-size: 18px; letter-spacing: 0.03em; color: #f7edd4;
  }
}
.tl-eras {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px; margin: 18px 0 28px;
}
.tl-era {
  min-height: 110px; border-radius: 14px; padding: 14px;
  background-size: cover; background-position: center;
  display: flex; flex-direction: column; justify-content: flex-end;
  box-shadow: inset 0 -60px 50px rgba(8,10,16,0.72);
  border: 1px solid var(--line);
}
.tl-era strong { font-family: var(--serif); font-size: 20px; line-height: 1.1; }
.tl-era em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--gold); }
.tl-era.on { outline: 2px solid var(--gold); }
.tl-band { margin: 28px 0 40px; }
.tl-band-head {
  border-radius: 16px; min-height: 160px; padding: 22px;
  background-size: cover; background-position: center;
  box-shadow: inset 0 -80px 70px rgba(8,10,16,0.78);
  margin-bottom: 8px;
}
.tl-band-head h3 { font-family: var(--serif); font-size: 34px; margin: 0 0 6px; }
.tl-spine { display: grid; gap: 0; border-left: 1px solid var(--line); margin-left: 10px; }
.tl-card {
  display: grid; grid-template-columns: 16px 1fr auto; gap: 12px; align-items: start;
  padding: 12px 8px 12px 0; margin-left: -5px;
}
.tl-card:hover { background: rgba(220,184,50,0.04); }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 8px; box-shadow: 0 0 0 4px var(--bg); }
.tl-hero {
  border-radius: 18px; min-height: 240px; padding: 28px;
  background-size: cover; background-position: center;
  box-shadow: inset 0 -90px 80px rgba(8,10,16,0.8);
  margin: 12px 0 16px;
}
.tl-hero h2 { font-family: var(--serif); font-size: clamp(28px, 5vw, 44px); margin: 0 0 8px; }
.tl-mini { margin: 8px 0; }
.scale-wrap { margin: 18px 0 28px; }
.scale-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: #0a0d14; }
.scale-inner { position: relative; height: 88px; }
.scale-eras { position: absolute; inset: 0 0 70px 0; }
.scale-era { position: absolute; top: 0; bottom: 0; border-right: 1px solid rgba(255,255,255,0.06); }
.scale-era span {
  position: absolute; left: 8px; top: 8px; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold);
}
.scale-ticks { position: absolute; left: 0; right: 0; bottom: 48px; height: 18px; }
.scale-ticks span {
  position: absolute; transform: translateX(-50%); font-family: var(--mono);
  font-size: 10px; color: var(--muted); white-space: nowrap;
}
.scale-inner { position: relative; height: 88px; }
.scale-film {
  display: flex; gap: 10px; overflow-x: auto; padding: 14px 4px 8px;
  scroll-snap-type: x mandatory;
}
.scale-tile {
  flex: 0 0 112px; scroll-snap-align: start;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
  color: var(--ink); cursor: pointer; padding: 8px 8px 10px; text-align: left;
}
.scale-tile:hover, .scale-tile:focus { border-color: var(--gold); }
.tl-pic {
  width: 96px; height: 128px; border-radius: 18px; display: block; margin: 0 auto 8px;
  object-fit: cover; background: #efece5;
}
.scale-tile em { display: block; font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--gold); }
.scale-tile strong { display: block; font-size: 12px; font-weight: 500; line-height: 1.25; margin-top: 4px; }
.dossier .tl-pic { width: 72px; height: 72px; margin: 0; }
.dossier-scene { margin: 0 0 18px; }
.dossier-scene img {
  width: min(100%, 420px); max-height: 560px; object-fit: contain; border-radius: 22px;
  display: block; margin: 0 auto; background: #efece5;
}
.dossier-scene figcaption {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin-top: 8px; letter-spacing: 0.04em;
}
.dossier h2 { display: flex; gap: 10px; align-items: center; font-size: clamp(28px, 4vw, 40px); }
.tl-also {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.tl-also em { font-style: normal; color: var(--muted); font-size: 12px; }
@media (max-width: 720px) {
  .tl-eras { grid-template-columns: repeat(2, 1fr); }
  .tl-hero, .tl-band-head { min-height: 140px; padding: 16px; }
  .scale-inner { height: 320px; }
}

.tabbar { display: none; }
.more-sheet { display: none; }

/* Touch chrome: narrow windows, plus any coarse-pointer device up to iPad Pro. */
@media (max-width: 900px), (pointer: coarse) and (max-width: 1366px) {
  .topbar { display: none; }
  body.timeline-app .topbar { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
    background: rgba(12, 16, 25, 0.96);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    display: grid; justify-items: center; gap: 3px;
    background: none; border: 0; color: var(--muted);
    font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
    min-height: 48px; padding: 6px 0 2px; cursor: pointer;
  }
  .tabbar svg {
    width: 22px; height: 22px; fill: none; stroke: currentColor;
    stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round;
  }
  .tabbar .on { color: var(--gold); }
  .more-sheet:not([hidden]) { display: block; }
  .more-scrim {
    position: fixed; inset: 0; z-index: 31;
    background: rgba(0,0,0,0.45); border: 0;
  }
  .more-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 32;
    display: grid; gap: 2px;
    padding: 14px 16px calc(5.5rem + env(safe-area-inset-bottom));
    background: #161b27;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
  }
  .more-panel a {
    min-height: 48px; display: flex; align-items: center;
    padding: 0 12px; border-radius: 12px; font-size: 16px;
  }
  .more-panel a:active { background: var(--bg-elev); }

  .view {
    width: 100%; max-width: none;
    padding: 12px 16px calc(6.5rem + env(safe-area-inset-bottom));
  }
  .view.bte-page { padding: 0; }
  body.timeline-app .view.bte-page { padding: 0; }
  h1 { font-size: 28px; line-height: 1.1; }
  .hero { display: none; }
  .home-search { margin: 0 0 14px; }
  .page-title { font-size: 26px; margin: 4px 0 12px; line-height: 1.15; }
  .kicker { display: none; }
  .sheet .kicker, .drawer .kicker, .sheet-refs .kicker { display: block; }
  .lede { font-size: 15px; margin: 0 0 14px; }
  .empty-hint { color: var(--muted); line-height: 1.5; }
  .empty-hint .chip { margin-top: 12px; }
  .az {
    flex-wrap: nowrap; overflow-x: auto; gap: 6px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding-bottom: 4px;
  }
  .az .chip { flex: 0 0 36px; min-height: 36px; display: grid; place-items: center; padding: 0; }
  .dict-rail { display: flex; gap: 8px; overflow-x: auto; max-height: none; padding-bottom: 8px; }
  .dict-rail .rail { flex: 0 0 auto; white-space: nowrap; }
  .setting { flex-wrap: wrap; }
  .setting select, .setting input[type="range"] { width: 100%; accent-color: var(--gold); }
  .sheet-actions button { min-height: 44px; padding: 10px 14px; border-radius: 12px; }
  body { overflow-x: hidden; }
  .votd { margin-top: 0; padding: 22px 18px; }
  .votd q { font-size: 24px; }
  .split, .studio-grid, .dict-shell { grid-template-columns: 1fr; }
  .dict-rail { max-height: 180px; }

  .read-bar {
    display: grid; grid-template-columns: minmax(0, 1.4fr) 4.4rem minmax(0, 0.9fr);
    gap: 8px; margin: 0 0 10px;
  }
  .read-bar select { min-width: 0; width: 100%; padding: 12px 10px; }
  .read-pager {
    display: grid; grid-template-columns: 1fr 1fr 1fr auto auto auto;
    gap: 6px; margin: 0 0 14px;
  }
  .read-pager button { min-height: 44px; }
  .read-pager .primary { background: var(--gold); color: #1b140c; border-color: var(--gold); }
  .audio-src { display: none; }
  .chapter {
    margin: 0 -16px; border-radius: 0;
    padding: 22px 18px 40px;
  }
  .chapter h2 { font-size: 32px; }
  .verse { grid-template-columns: 28px 1fr; gap: 10px; }
  .verse p, .verse .txt { font-size: 20px; line-height: 1.45; }
  .media-rail { margin: 18px 0 0; }
  .drawer {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 28;
    margin: 0; border-radius: 18px 18px 0 0;
    max-height: 70dvh; overflow: auto;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .lyrics-bar.dock:not([hidden]) {
    bottom: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: 10px;
  }
  .bh-phone { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .bh-phone.year .bh-scroll { height: calc(100dvh - 18rem); }
  .bh-drawer {
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom));
  }
}

/* ============================================================
   Vertical timeline (phones / narrow screens)
   Linear year scale: 1px is the same number of years everywhere
   inside the current window.
   ============================================================ */
.tlv {
  /* Fluid gutter: every width between a 320px phone and a 1366px tablet gets a
     sensible rail rather than snapping at a breakpoint. */
  --rail: clamp(52px, 13vw, 92px);
  --band: clamp(16px, 2.8vw, 26px);
  --lives: clamp(48px, 13vw, 92px);
  --lead: clamp(12px, 2.4vw, 20px);
  --gutter: calc(var(--rail) + var(--band) + var(--lives) + var(--lead));
  display: flex; flex-direction: column;
  height: calc(100dvh - 3.65rem - env(safe-area-inset-bottom, 0px));
  background: #100c08;
}
body.lay-tablet .tlv-chapter {
  max-width: 720px; margin-left: auto; margin-right: auto;
}
@media (orientation: landscape) and (max-height: 520px) {
  .tlv-bar-top h1 { font-size: 16px; }
  .tlv-status { display: none; }
  .tlv-chapter-hero, .tlv-chapter-hero > div { min-height: 112px; }
  .tlv-chapter-hero > div { padding-top: 28px; }
  .bh-now { min-height: 36px; padding: 4px 12px; }
}
.tlv-bar {
  flex: 0 0 auto; z-index: 12;
  padding: max(6px, env(safe-area-inset-top, 0px)) 10px 6px;
  background: linear-gradient(180deg, #16110a 70%, rgba(22,17,10,0.92));
  border-bottom: 1px solid rgba(220,184,50,0.22);
}
.tlv-bar-top { display: grid; grid-template-columns: 40px 1fr 44px; align-items: center; gap: 6px; }
.tlv-bar-top h1 {
  margin: 0; text-align: center; font-family: var(--serif);
  font-size: 19px; font-weight: 600; color: #f3ead6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tlv-up, .tlv-search-btn {
  min-width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  border: 1px solid rgba(220,184,50,0.28); background: rgba(18,14,8,0.8);
  color: #f3ead6; cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.tlv-search-btn { justify-self: end; width: 44px; }
.tlv-up-spacer { display: block; }
.tlv-find { display: none; margin: 8px 0 2px; }
.tlv.searching .tlv-find { display: block; }
.tlv-find input {
  width: 100%; min-height: 42px; padding: 10px 14px; font-size: 16px;
  background: #0d0a06; color: var(--ink);
  border: 1px solid rgba(220,184,50,0.32); border-radius: 12px;
}
.tlv-chips {
  display: flex; gap: 7px; overflow-x: auto; margin: 8px -10px 0; padding: 0 10px 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tlv-chips::-webkit-scrollbar { display: none; }
.tlv-chip {
  flex: 0 0 auto; min-height: 44px; padding: 0 15px; border-radius: 999px;
  display: grid; place-items: center; white-space: nowrap;
  border: 1px solid rgba(220,184,50,0.26); background: rgba(255,255,255,0.04);
  color: #e6dcc2; font-size: 13.5px; text-decoration: none;
  box-shadow: inset 3px 0 0 var(--era, #dcb832);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.tlv-chip.on, .tlv-chip[aria-current] { background: #dcb832; color: #1a1408; border-color: #dcb832; box-shadow: none; font-weight: 600; }
.tlv-status {
  display: flex; align-items: center; gap: 8px; margin: 6px 2px 1px;
  min-height: 30px;
  font-family: var(--mono); font-size: 11px; color: #9a8c6d;
}
.tlv-now {
  color: #1a1408; background: #dcb832; border-radius: 6px; padding: 2px 8px;
  font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; flex: 0 0 auto;
}
.tlv-scope { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tlv-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  background:
    linear-gradient(180deg, rgba(220,184,50,0.05), transparent 240px), #120e08;
}
.tlv-track { position: relative; width: 100%; }
.tlv-murals { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.tlv-mural {
  position: absolute; left: 0; right: 0;
  background-size: cover; background-position: center top;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000);
  mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000);
}
.tlv-mural::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(16,12,8,0.55), rgba(16,12,8,0.28) 40%, rgba(16,12,8,0.62));
}

/* --- left rail: the scale itself --- */
.tlv-rail { position: absolute; top: 0; bottom: 0; left: 0; width: var(--rail); z-index: 2; }
.tlv-rail::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 1px;
  background: linear-gradient(180deg, transparent, rgba(220,184,50,0.35) 4%, rgba(220,184,50,0.35) 96%, transparent);
}
.tlv-tick { position: absolute; left: 0; right: 4px; transform: translateY(-50%); text-align: right; }
.tlv-tick::after {
  content: ""; position: absolute; right: -4px; top: 50%; width: 7px; height: 1px;
  background: rgba(220,184,50,0.55);
}
.tlv-tick b {
  display: block; font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  color: #dcb832; letter-spacing: 0.02em; font-variant-numeric: tabular-nums;
}
.tlv-tick i {
  display: block; font-style: normal; font-family: var(--mono);
  font-size: 9px; color: #948868;
}

/* --- era bands --- */
.tlv-bands { position: absolute; top: 0; bottom: 0; left: var(--rail); width: var(--band); z-index: 2; }
.tlv-band {
  position: absolute; left: 3px; right: 2px; border-radius: 4px;
  background: color-mix(in srgb, var(--era) 55%, transparent);
  display: block; overflow: hidden; pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--era) 85%, transparent);
}
.tlv-band span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl; text-orientation: mixed;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 700;
  /* Its own plate: era colours run from gold to slate, and no single text
     colour clears 4.5:1 against all of them. */
  color: #f6efdd; background: rgba(8, 6, 4, 0.82);
  white-space: nowrap; padding: 6px 1px;
}
.tlv-band.on { outline: 2px solid #f3e2a8; outline-offset: -1px; }

/* --- lifespan bars --- */
.tlv-lives { position: absolute; top: 0; bottom: 0; left: calc(var(--rail) + var(--band)); width: var(--lives); z-index: 2; }
.tlv-life {
  position: absolute; padding: 3px 0 8px; border: 0; pointer-events: none;
  width: calc((100% - 2px) / var(--cols, 1) - 2px);
  left: calc(var(--col) * ((100% - 2px) / var(--cols, 1)) + 1px);
  border-radius: 999px;
  background: linear-gradient(180deg, #ead07a, #b88828);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  overflow: hidden;
}
.tlv-life img {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
  flex: 0 0 auto; border: 1px solid #1a1408; position: sticky; top: 6px; z-index: 1;
}
.tlv-life span {
  position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center;
  writing-mode: vertical-rl; text-orientation: mixed;
  font-size: 9.5px; font-weight: 700; color: #1a1408; letter-spacing: 0.04em;
  padding: 8px 0; white-space: nowrap;
}
.tlv-life.on { background: linear-gradient(180deg, #fff3c4, #dcb832); box-shadow: 0 0 0 2px #f3e2a8; }

/* --- leader lines back to the true year --- */
.tlv-leaders {
  position: absolute; top: 0; bottom: 0;
  left: calc(var(--rail) + var(--band) + var(--lives)); width: var(--lead);
  pointer-events: none;
}
.tlv-leader {
  position: absolute; left: 4px; width: 1px;
  background: linear-gradient(180deg, rgba(220,184,50,0.65), rgba(220,184,50,0.18));
}
.tlv-leader::before {
  content: ""; position: absolute; top: -2px; left: -2px;
  width: 5px; height: 5px; border-radius: 50%; background: #dcb832;
}
.tlv-leader.dot { height: 1px; }

/* --- the cards --- */
.tlv-cards { position: absolute; top: 0; left: var(--gutter); right: 10px; bottom: 0; z-index: 3; }
.tlv-slot { position: absolute; left: 0; right: 0; }
.tlv-card, .tlv-cluster {
  width: 100%; text-align: left;
  border: 1px solid rgba(220,184,50,0.55); border-radius: 14px;
  background: linear-gradient(180deg, #1e1810, #14100a);
  color: #f3ead6; min-height: 44px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0,0,0,0.28);
}
.tlv-card { display: grid; }
.tlv-card-hit {
  display: grid; grid-template-columns: 88px 1fr; gap: 12px; align-items: stretch;
  width: 100%; text-align: left; background: none; border: 0; color: inherit;
  padding: 0; cursor: pointer; min-height: 88px;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.tlv-card-art {
  width: 88px; height: 110px; object-fit: cover;
  background: #241c10; border-right: 1px solid rgba(220,184,50,0.18);
}
.tlv-card-body { min-width: 0; display: grid; gap: 4px; align-content: start; padding: 10px 12px 8px 0; }
.tlv-card-when {
  font-family: var(--mono); font-size: 11px; font-style: normal;
  color: #dcb832; letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
}
.tlv-card strong {
  font-family: var(--serif); font-size: 18px; line-height: 1.2; font-weight: 600;
  text-wrap: pretty;
}
.tlv-card-place {
  font-style: normal; font-size: 12px; color: #c9bd9e; display: block;
}
.tlv-card-refs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 12px 10px 88px;
}
.tlv-ref {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px;
  border-radius: 999px; border: 1px solid rgba(220,184,50,0.4);
  font-family: var(--mono); font-size: 11px; color: #dcb832; text-decoration: none;
  touch-action: manipulation;
}
.tlv-ref:active { background: rgba(220,184,50,0.16); }
.tlv-card.on, .tlv-cluster.on { border-color: #dcb832; box-shadow: 0 0 0 1px #dcb832; }

.tlv-cluster {
  display: grid; grid-template-columns: 88px 1fr; gap: 0; align-items: stretch;
  border-style: dashed; background: rgba(220,184,50,0.05); cursor: pointer;
  touch-action: manipulation;
}
.tlv-cluster-art { width: 88px; height: 100%; min-height: 88px; object-fit: cover; }
.tlv-cluster-copy { display: grid; gap: 6px; padding: 10px 12px; min-width: 0; }
.tlv-cluster-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tlv-cluster-head em {
  font-family: var(--mono); font-style: normal; font-size: 10.5px; color: #dcb832;
  font-variant-numeric: tabular-nums;
}
.tlv-cluster-head strong { font-size: 13px; color: #f3ead6; }
.tlv-cluster-list { display: grid; gap: 1px; }
.tlv-cluster-list i {
  font-style: normal; font-size: 12px; color: #c9bd9e; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tlv-cluster-list i.more { color: #9a8c6d; }
.tlv-cluster-cta {
  display: inline-flex; align-items: center; gap: 4px; justify-self: start;
  font-family: var(--mono); font-size: 11px; color: #dcb832; margin-top: 2px;
}
.tlv-empty { color: #9a8c6d; font-size: 14px; padding: 16px 4px; margin: 0; }

.tlv-card:focus-visible, .tlv-cluster:focus-visible, .tlv-life:focus-visible,
.tlv-chip:focus-visible, .tlv-up:focus-visible, .tlv-search-btn:focus-visible {
  outline: 2px solid #dcb832; outline-offset: 2px;
}
@media (hover: hover) {
  .tlv-card:hover, .tlv-cluster:hover { border-color: rgba(220,184,50,0.55); }
  .tlv-chip:hover { border-color: #dcb832; }
}
.tlv-card:active, .tlv-cluster:active { filter: brightness(1.14); }

/* Roomier gutter and cards once there is width to spend. */
@media (min-width: 520px) {
  .tlv-card strong { font-size: 15.5px; }
  .tlv-cards { right: 16px; }
  .tlv-bar { padding-left: 16px; padding-right: 16px; }
  .tlv-chips { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
}
@media (min-width: 760px) {
  .tlv-cards { right: max(16px, calc(50% - 340px)); }
  .tlv-tick b { font-size: 12px; }
}
body.timeline-app .bh-shell:has(.tlv) { height: auto; }

/* same-year stacks: listed in place, since zooming cannot separate them */
.tlv-group {
  border: 1px solid rgba(220,184,50,0.55); border-radius: 13px;
  background: linear-gradient(180deg, #1b150d, #15100a); overflow: hidden;
}
.tlv-group.on { border-color: #dcb832; }
.tlv-group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 0; padding: 9px 11px; background: rgba(220,184,50,0.09);
  border-bottom: 1px solid rgba(220,184,50,0.18);
}
.tlv-group-head em {
  font-family: var(--mono); font-style: normal; font-size: 10.5px; color: #dcb832;
  font-variant-numeric: tabular-nums; letter-spacing: 0.03em;
}
.tlv-group-head b { font-size: 11px; color: #9a8c6d; font-weight: 600; }
.tlv-group ul { list-style: none; margin: 0; padding: 0; }
.tlv-group li + li { border-top: 1px solid rgba(255,255,255,0.05); }
.tlv-row {
  width: 100%; text-align: left; background: transparent; border: 0;
  color: #f3ead6; padding: 9px 11px; min-height: 44px; cursor: pointer;
  display: grid; gap: 1px; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.tlv-row i {
  font-style: normal; font-family: var(--mono); font-size: 9.5px;
  color: #dcb832; text-transform: uppercase; letter-spacing: 0.09em;
}
.tlv-row strong { font-size: 13.5px; line-height: 1.3; font-weight: 500; }
.tlv-row em { font-style: normal; font-family: var(--mono); font-size: 10.5px; color: #8fa3b5; }
.tlv-row.on { background: rgba(220,184,50,0.12); }
.tlv-row:active { background: rgba(220,184,50,0.16); }
.tlv-row:focus-visible { outline: 2px solid #dcb832; outline-offset: -2px; }

.tlv-grid { position: absolute; inset: 0; pointer-events: none; }
.tlv-grid span {
  position: absolute; left: var(--rail); right: 0; height: 1px;
  background: rgba(220,184,50,0.16);
}
/* Era names and life names ride along with the scroll instead of sitting at
   the midpoint of a band that is taller than the screen. */
.tlv-band { display: block; }
.tlv-band span {
  position: sticky; top: 10px; inset: auto; height: auto;
  display: block; margin: 0 auto; width: max-content; max-height: calc(100dvh - 260px);
  overflow: hidden;
}
.tlv-life span {
  position: sticky; top: 10px; inset: auto; height: auto;
  display: block; margin: 0 auto; width: max-content;
  max-height: calc(100dvh - 280px); overflow: hidden; padding: 0;
}
.tlv-track { padding-top: 10px; }
.tlv[data-scope="all"] .tlv-track { height: auto !important; padding: 4px 0 28px; }
.tlv-chapter { margin: 0 0 22px; }
.tlv-chapter-hero {
  position: relative; display: block; min-height: 168px; margin: 8px 12px 10px;
  border-radius: 16px; overflow: hidden; color: #f7edd4;
  border: 1px solid rgba(220,184,50,0.28);
}
.tlv-chapter-hero img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.tlv-chapter-hero > div {
  position: relative; z-index: 1;
  background: linear-gradient(180deg, transparent 10%, rgba(8,6,4,0.9));
  padding: 56px 16px 14px; min-height: 168px; display: flex; flex-direction: column; justify-content: flex-end;
}
.tlv-chapter-hero em {
  font-family: var(--mono); font-style: normal; font-size: 11px; color: #dcb832;
  letter-spacing: 0.06em;
}
.tlv-chapter-hero strong {
  font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.1;
}
.tlv-chapter-hero p { margin: 4px 0 0; font-size: 14px; color: #e6dcc2; }
.tlv-faces {
  display: flex; gap: 8px; overflow-x: auto; padding: 0 12px 12px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tlv-face {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 4px 12px 4px 4px; border-radius: 999px;
  border: 1px solid rgba(220,184,50,0.35); background: rgba(18,14,8,0.72);
  color: #f3ead6; cursor: pointer; touch-action: manipulation;
}
.tlv-face img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.tlv-face span { font-size: 14px; font-weight: 600; }
.tlv-face.on { background: #dcb832; color: #1a1408; }
.tlv-chapter-beats { display: grid; gap: 10px; padding: 0 12px; }
.tlv-chapter-more {
  display: flex; align-items: center; justify-content: center;
  margin: 10px 12px 0; min-height: 44px; border-radius: 12px;
  border: 1px solid rgba(220,184,50,0.4); color: #dcb832;
  font-family: var(--mono); font-size: 13px;
}
@media (min-width: 700px) {
  /* Centre the whole track - rail, bands, bars and cards move together, so the
     scale stays glued to the content it measures. */
  .tlv-track { max-width: 940px; margin-inline: auto; }
  .tlv-cards { left: var(--gutter); right: 20px; width: auto; }
}

/* ============================================================
   Layout tiers. JS sets lay-phone / lay-tablet / lay-desktop on <body>
   from width AND pointer type, so an iPad in landscape (1024-1366px,
   coarse pointer) gets touch chrome instead of the desktop atlas.
   ============================================================ */
body.lay-phone .topbar,
body.lay-tablet .topbar,
body.lay-phone.timeline-app .topbar,
body.lay-tablet.timeline-app .topbar { display: none; }
body.lay-phone .tabbar,
body.lay-tablet .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); }
body.lay-phone .more-sheet,
body.lay-tablet .more-sheet { display: block; }
body.lay-phone .more-sheet[hidden],
body.lay-tablet .more-sheet[hidden] { display: none; }

/* Re-assert the touch shell where the >=901px desktop rules would otherwise
   flatten it (iPad landscape sits above that breakpoint). */
body.lay-tablet .view.bte-page { width: 100%; max-width: none; padding: 0; }
body.lay-tablet .bh-shell {
  display: flex; flex-direction: column;
  height: calc(100dvh - 3.65rem - env(safe-area-inset-bottom, 0px));
}
body.lay-tablet .bh-main { display: flex; position: relative; }
body.lay-tablet .bh-read { display: none; }
body.lay-tablet .bte-head { display: none; }

/* iPad-class widths: one comfortable measure for the cards, centred, with the
   rail and the bars scaled up to match. */
@media (min-width: 700px) {
  .tlv-bar-top h1 { font-size: 22px; }
  .tlv-chip { font-size: 15px; }
  .tlv-card strong { font-size: 20px; }
  .tlv-row strong { font-size: 15px; }
  .tlv-card-hit { grid-template-columns: 120px 1fr; min-height: 120px; }
  .tlv-card-art { width: 120px; height: 140px; }
  .tlv-card-refs { padding-left: 120px; }
  .tlv-card-when, .tlv-group-head em { font-size: 11.5px; }
  .tlv-tick b { font-size: 12.5px; }
  .tlv-tick i { font-size: 10px; }
  .tlv-band span { font-size: 10px; letter-spacing: 0.18em; }
}
@media (min-width: 1000px) {
  .tlv-bar { padding-left: 24px; padding-right: 24px; }
  .tlv-chips { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
}

/* Landscape tablet: the dossier becomes a side panel instead of covering the
   timeline with a bottom sheet. */
@media (min-width: 820px) and (min-height: 620px) {
  body.lay-tablet .bh-shell.has-drawer { flex-direction: row; gap: 0; }
  body.lay-tablet .bh-shell.has-drawer .bh-main { flex: 1 1 auto; min-width: 0; min-height: 0; }
  body.lay-tablet .bh-shell.has-drawer .bh-scrim { display: none; }
  body.lay-tablet .bh-shell.has-drawer .bh-drawer {
    position: relative; inset: auto; z-index: 1;
    flex: 0 0 clamp(320px, 34vw, 440px);
    max-height: none; height: auto; min-height: 0; align-self: stretch;
    border-radius: 0; border-width: 0 0 0 1px;
    padding: 8px 18px calc(1.5rem + env(safe-area-inset-bottom, 0px));
    box-shadow: none;
  }
  body.lay-tablet .bh-shell.has-drawer .bh-sheet-grip { display: none; }
  body.lay-tablet .bh-shell.has-drawer .bh-sheet-close { top: 8px; right: 18px; }
  body.lay-tablet .bh-shell.has-drawer .bh-drawer .dossier { padding-top: 52px; }
  body.lay-tablet .bh-shell.has-drawer .bh-drawer .dossier-scene { margin: 0 0 14px; }
  body.lay-tablet .bh-shell.has-drawer .bh-drawer .dossier-scene img { height: 180px; border-radius: 10px; }
  body.lay-tablet .bh-shell.has-drawer .tlv { height: 100%; }
}

/* Short landscape phones: give the scale back the vertical room. */
@media (max-height: 480px) and (orientation: landscape) {
  .tlv-bar { padding-top: max(4px, env(safe-area-inset-top, 0px)); padding-bottom: 4px; }
  .tlv-bar-top h1 { font-size: 16px; }
  .tlv-up, .tlv-search-btn { height: 34px; min-width: 34px; }
  .tlv-chips { margin-top: 5px; }
  .tlv-chip { min-height: 34px; font-size: 13px; }
  .tlv-status { margin-top: 4px; }
}

/* Very narrow phones (iPhone SE and friends) still need a legible card. */
@media (max-width: 360px) {
  .tlv { --rail: 46px; --lives: 40px; --lead: 10px; }
  .tlv-card-hit { grid-template-columns: 64px 1fr; gap: 8px; min-height: 72px; }
  .tlv-card-art { width: 64px; height: 80px; }
  .tlv-card strong { font-size: 16px; }
  .tlv-card-refs { padding-left: 64px; }
  .tlv-cards { right: 8px; }
}
@media (max-width: 360px) {
  .tlv-tick b { font-size: 9.5px; white-space: nowrap; }
  .tlv-tick i { font-size: 8.5px; }
}

/* The timeline owns the viewport on touch layouts: only its own panes scroll,
   so the sticky header never rides away with the document. */
@media (max-width: 900px), (pointer: coarse) and (max-width: 1366px) {
  body.timeline-app { overflow: hidden; height: 100dvh; }
  body.timeline-app #app { height: 100%; overflow: hidden; }
}
body.lay-tablet .bh-shell { overflow: hidden; }
body.lay-tablet .bh-drawer { min-height: 0; }

/* Skip past the era rail: without it, keyboard and switch users tab through
   sixteen era chips before they reach the first beat. */
.tlv-skip {
  position: absolute; left: -9999px; top: 0; z-index: 20;
  border: 0; cursor: pointer;
  background: #dcb832; color: #1a1408; font-weight: 700; font-size: 14px;
  padding: 14px 18px; min-height: 44px; border-radius: 0 0 12px 0;
}
.tlv-skip:focus { left: 0; }
.tlv { position: relative; }
.tlv-scroll:focus { outline: none; }
.tlv-scroll:focus-visible { outline: 2px solid #dcb832; outline-offset: -2px; }

/* Whoever is alive at the year you have scrolled to, as real buttons. The
   lifespan bars themselves are 8px wide - far too small to be a touch target. */
.tlv-alive {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tlv-alive::-webkit-scrollbar { display: none; }
.tlv-alive[hidden] { display: none; }
.tlv-alive b {
  flex: 0 0 auto; font-weight: 600; color: #9a8c6d; letter-spacing: 0.04em;
}
.tlv-who {
  flex: 0 0 auto; min-height: 32px; padding: 3px 10px 3px 4px; border-radius: 999px;
  border: 1px solid rgba(220,184,50,0.55);
  background: rgba(220,184,50,0.1); color: #f3ead6;
  font-family: var(--mono); font-size: 11.5px; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  position: relative; display: inline-flex; align-items: center; gap: 6px;
}
.tlv-who img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
/* 44px touch target without a 44px-tall chip in an already tall header. */
.tlv-who::after { content: ""; position: absolute; inset: -7px -2px; }
.tlv-who:active { background: rgba(220,184,50,0.22); }
.tlv-who:focus-visible { outline: 2px solid #dcb832; outline-offset: 2px; }
