/* أطلس الزمان — parchment manuscript theme (light) / night manuscript (dark) */
:root {
  --paper: #f3ead6; --paper-2: #ebdfc5; --paper-3: #e0d0ae; --card: #f8f2e4;
  --ink: #2a2118; --ink-2: #5b4a37; --ink-3: #8b785e; --meta: #6e5d45; --line: #cdb88f; --line-2: #dccba7;
  --gold: #a5761f; --gold-2: #c99a3d; --accent: #1f5d58; --accent-2: #2f7d72; --red: #9b2f2f;
  --sea: #cfd9d1; --land: #f1e7d0; --land-edge: #b6a07a; --river: #8fb0b8;
  --rule: #3e8a63; --rule-edge: #2d6b4b; --shadow: 0 6px 24px rgba(60, 40, 10, .18);
  --f-ui: "IBM Plex Sans Arabic", "Amiri", "Segoe UI", Tahoma, sans-serif;
  --f-text: "Amiri", "Traditional Arabic", serif;
  --f-title: "Amiri", "Traditional Arabic", serif;
  --f-label: "IBM Plex Sans Arabic", "Amiri", "Segoe UI", Tahoma, sans-serif;
  --f-brand: "Reem Kufi", "IBM Plex Sans Arabic", sans-serif;
  --top-h: 60px;
  --ts: 1;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #14161b; --paper-2: #1b1e25; --paper-3: #252a33; --card: #1d2028;
  --ink: #ece2cc; --ink-2: #bfb197; --ink-3: #8a7f6b; --meta: #a39680; --line: #3b404b; --line-2: #2c313a;
  --gold: #d6a84c; --gold-2: #e8c06a; --accent: #4fb3a5; --accent-2: #63c4b5; --red: #d0605a;
  --sea: #0f171c; --land: #262a2f; --land-edge: #4a4f57; --river: #2d5560;
  --rule: #3fa070; --rule-edge: #5cc08e; --shadow: 0 8px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14161b; --paper-2: #1b1e25; --paper-3: #252a33; --card: #1d2028;
    --ink: #ece2cc; --ink-2: #bfb197; --ink-3: #8a7f6b; --meta: #a39680; --line: #3b404b; --line-2: #2c313a;
    --gold: #d6a84c; --gold-2: #e8c06a; --accent: #4fb3a5; --accent-2: #63c4b5; --red: #d0605a;
    --sea: #0f171c; --land: #262a2f; --land-edge: #4a4f57; --river: #2d5560;
    --rule: #3fa070; --rule-edge: #5cc08e; --shadow: 0 8px 28px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--f-ui); font-size: 15px;
  overflow: hidden;
  background-image: radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.35), transparent 60%),
                    radial-gradient(ellipse at 100% 100%, rgba(120,90,40,.08), transparent 55%);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { overflow: visible; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top {
  height: var(--top-h); display: flex; align-items: center; gap: 18px; padding: 0 16px;
  border-bottom: 1px solid var(--line); background: linear-gradient(var(--paper-2), var(--paper));
  position: relative; z-index: 20;
}
.top::after { content: ""; position: absolute; inset: auto 0 -4px 0; height: 3px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 10px, transparent 10px 14px); opacity: .35; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; flex-shrink: 0; }
.emblem { width: 34px; height: 34px; fill: var(--gold); stroke: var(--ink); stroke-width: .6; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; gap: 3px; }
.brand-text b { font-family: var(--f-brand); font-size: 21px; font-weight: 600; line-height: 1.25; }
.brand-text small { color: var(--ink-2); font-family: var(--f-label); font-size: 12.5px; line-height: 1.3; white-space: nowrap; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs button {
  border: 0; background: none; padding: 7px 12px; border-radius: 8px; white-space: nowrap;
  font-family: var(--f-label); font-weight: 500; font-size: 15px; line-height: 1.4; color: var(--ink-2);
}
.tabs button:hover { background: var(--paper-3); }
.tabs button.on { background: var(--ink); color: var(--paper); }
.tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chip-btn { border: 1px solid var(--line); background: var(--card); border-radius: 999px; min-width: 34px; height: 32px; padding: 0 9px; font-weight: 600; }
.chip-btn:hover { border-color: var(--gold); }
.search { position: relative; }
.search input { width: 230px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; outline: none; }
.search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(165,118,31,.15); }
.top:has(#search-results:not([hidden])) { z-index: 40; }
.search-results {
  position: absolute; top: 40px; inset-inline-end: 0; width: 360px; max-height: 70vh; overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 50;
}
.sr-group { font-size: 12.5px; color: var(--meta); padding: 6px 8px 2px; }
.sr-item { display: flex; justify-content: space-between; gap: 10px; padding: 7px 9px; border-radius: 8px; cursor: pointer; }
.sr-item:hover, .sr-item.on { background: var(--paper-3); }
.sr-item small { color: var(--meta); white-space: nowrap; }
/* a line from the text, under the name, two lines at most */
.sr-item.sr-text { flex-direction: column; gap: 2px; }
.sr-item.sr-text small { white-space: normal; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- views ---------- */
main { height: calc(100% - var(--top-h)); position: relative; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; }
.booting { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; color: var(--meta); font-size: 15px; }
.view.on { display: flex; }
.toolbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.toolbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.lede { margin: 0; color: var(--ink-2); font-family: var(--f-text); font-size: 17px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 13px; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.round { width: 40px; height: 40px; justify-content: center; padding: 0; font-size: 15px; }
.btn:disabled { opacity: .4; cursor: default; }
.zoom-btns { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.zoom-btns button { border: 0; background: var(--card); width: 32px; height: 30px; font-size: 16px; }
.zoom-btns button + button { border-inline-start: 1px solid var(--line); }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { accent-color: var(--accent); }

.filters { display: flex; gap: 6px 14px; flex-wrap: wrap; padding: 6px 14px; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.filters .fgroup { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.filters .fgroup > span { color: var(--meta); margin-inline-end: 2px; }
.fchip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 2px 8px 2px 9px; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.fchip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.fchip.off { opacity: .4; text-decoration: line-through; }

/* ---------- chronicle ---------- */
.chron { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; cursor: grab; user-select: none; }
.chron:active { cursor: grabbing; }
.chron-top { flex: 0 1 auto; min-height: 0; width: 100%; display: block; }
/* a finger scrolls the rows natively; sideways drags and pinches are left to the script */
.chron-lives { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; border-top: 1px solid var(--line-2); touch-action: pan-y; }
.chron-lives svg { width: 100%; display: block; }
.chron-axis { flex: 0 0 46px; width: 100%; height: 46px; display: block; border-top: 1px solid var(--line); background: var(--paper-2); }
.era-band text { font-family: var(--f-label); font-weight: 600; font-size: 13.5px; fill: #fff; pointer-events: none; }
.ev { cursor: pointer; }
.ev .ic { fill: var(--card); stroke-width: 1.6; }
.ev use { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* a landmark's name is large and dark; a lesser event's, which shows only close in, is smaller and quieter */
.ev text { font-size: calc(13.5px * var(--ts)); fill: var(--ink-2); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
.ev.imp1 text { font-size: calc(16px * var(--ts)); font-weight: 600; fill: var(--ink); }
.ev:hover text, .ev.sel text { fill: var(--accent); }
.ev.dim { opacity: .18; }
/* how long an event lasted: a thin bracket from its mark, with a tick at its end */
.ev .span, .ev .span-end { stroke-width: 1.6; stroke-linecap: round; opacity: .75; }
/* the three tracks: a bar with the track's own name on a line at its top and, under that line, as beads, every event in view with no room for its name */
.track { fill: var(--paper-2); pointer-events: none; }
/* the bar takes a click or a touch, a little past its edges, and gives it to the nearest bead */
.track-hit { fill: transparent; }
.track-head { pointer-events: none; }
.track-head text { font-family: var(--f-label); font-weight: 600; font-size: calc(11.5px * var(--ts)); fill: var(--meta); }
/* a bead: a small disc of its type's colour, a little larger for a landmark; named on pointing and as the reader comes closer */
.ev.dot .ic { stroke: var(--paper-2); stroke-width: 1; }
.ev.dot.imp1 .ic { stroke: var(--card); stroke-width: 1.4; }
.ev.dot:hover .ic, .ev.dot.sel .ic { stroke: var(--ink); stroke-width: 1.8; }
/* the beads of a life that is pointed at are ringed: the wider stroke the named marks get would only make a bead smaller */
.ev.dot.rel .ic, .ev.dot.imp1.rel .ic { stroke: var(--ink); stroke-width: 2; }
/* names laid out for a closer view, while the chart flies far out: unseen until they have their new rows */
.events.far .ev:not(.dot) { opacity: 0; }
.world-ev { fill: var(--ink-3); opacity: .7; cursor: pointer; }
.world-dyn rect { opacity: .8; }
.world-dyn text { font-size: 10.5px; fill: #fff; pointer-events: none; }
.band-label { font-size: 12.5px; fill: var(--meta); font-family: var(--f-label); font-weight: 600; }
.life { cursor: pointer; }
.life rect.bar, .life rect.cap { rx: 4px; }
.life rect.cap { fill-opacity: .24; }
.life text { font-size: calc(13px * var(--ts)); pointer-events: none; }
.life text.on-bar { fill: #fff; }
.life text.on-cap { fill: var(--ink); }
.life .approx { opacity: .45; }
.life.dim { opacity: .15; }
.life.hi rect.bar, .life.hi rect.cap { stroke: var(--ink); stroke-width: 1.5; }
.life .age { font-size: 12px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }
.group-head rect { fill: var(--paper-2); }
.group-head text { font-family: var(--f-label); font-weight: 600; font-size: calc(13.5px * var(--ts)); fill: var(--ink-2); }
.group-head .more { font-family: var(--f-ui); font-size: 12.5px; fill: var(--meta); }
.link-arc { fill: none; stroke-width: 1.6; opacity: .75; pointer-events: none; }
/* from a chosen event to what prepared it and what followed it: solid where it brought it about, dashed where it prepared the ground, gold where it answered */
.cause-halo { fill: none; stroke: var(--paper); stroke-width: 6; opacity: .85; pointer-events: none; }
.cause-arc { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .9; pointer-events: none; }
.cause-arc.paved { stroke-dasharray: 6 4; }
.cause-arc.answered { stroke: var(--gold); }
.cause-arc.to-edge { stroke-width: 1.6; opacity: .7; }
.cause-mk path { fill: var(--accent); }
.cause-mk.answered path { fill: var(--gold); }
.cause-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; pointer-events: stroke; }
.cause-ghost { fill: var(--card); stroke: var(--accent); stroke-width: 2; cursor: pointer; }
.cause-pill { cursor: pointer; }
.cause-pill rect { fill: var(--card); stroke: var(--accent); stroke-width: 1.4; }
.cause-pill.answered rect { stroke: var(--gold); }
.cause-pill text { fill: var(--accent); }
.cause-pill.answered text { fill: var(--gold); }
.cause-pill .cp-arrow { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cause-pill.answered .cp-arrow { stroke: var(--gold); }
.cause-pill:hover rect { fill: var(--paper-3); }
.cursor-line { stroke: var(--gold); stroke-width: 1.3; stroke-dasharray: 3 3; pointer-events: none; }
.cursor-pin { stroke: var(--red); stroke-width: 1.6; pointer-events: none; }
.cursor-label rect { fill: var(--ink); }
.cursor-label text { fill: var(--paper); font-size: 13px; font-weight: 600; }
.axis text { font-size: 13px; fill: var(--ink-2); }
.axis .ah text { fill: var(--accent); }
.axis line, .axis path { stroke: var(--line); }
.gridline { stroke: var(--line-2); stroke-width: 1; }
.alive-card {
  position: absolute; inset-inline-start: 14px; bottom: 58px; width: 250px; max-height: 46%; overflow: hidden;
  background: color-mix(in srgb, var(--card) 94%, transparent); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 10px 12px; pointer-events: none; font-size: 13.5px;
}
.alive-card h4 { margin: 0 0 6px; font-family: var(--f-label); font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; }
.alive-card h4 small { color: var(--meta); font-family: var(--f-ui); font-weight: 400; }
.alive-row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.alive-row i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-inline-end: 5px; }
.alive-row b { font-weight: 500; }
.alive-row span { color: var(--meta); white-space: nowrap; }

/* story */
.story {
  position: absolute; bottom: 86px; left: 50%; transform: translateX(-50%); width: min(620px, calc(100% - 32px));
  background: color-mix(in srgb, var(--card) 97%, transparent); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: 14px 18px 12px; z-index: 15; display: grid; grid-template-columns: 1fr; gap: 8px; max-height: calc(100% - 110px); overflow: auto;
}
.story-era { font-family: var(--f-label); font-weight: 600; font-size: 13px; color: #fff; padding: 2px 9px; border-radius: 6px; display: inline-block; }
.story h3 { font-family: var(--f-title); font-weight: 700; font-size: 26px; line-height: 1.45; margin: 6px 0 2px; }
.story .date { color: var(--meta); font-size: 14px; line-height: 1.6; }
.story p { font-family: var(--f-text); font-size: 18px; line-height: 1.75; margin: 8px 0; }
.story .who { font-size: 13px; color: var(--ink-2); }
.story .who .me b { color: var(--accent); }
.story-nav { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.story-nav .count { color: var(--meta); font-size: 13px; margin-inline-start: auto; }
.story-map { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); height: 150px; }
.story-close { position: absolute; top: 8px; inset-inline-start: 10px; border: 0; background: none; font-size: 20px; color: var(--meta); }

/* ---------- panel ---------- */
.panel {
  position: fixed; top: calc(var(--top-h) + 8px); bottom: 8px; inset-inline-start: 8px; width: min(440px, calc(100% - 16px));
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); z-index: 30;
  display: flex; flex-direction: column; animation: slidein .22s ease-out;
}
@keyframes slidein { from { transform: translateX(-24px); opacity: 0; } }
.panel-close { position: absolute; top: 8px; inset-inline-start: 10px; border: 0; background: none; font-size: 24px; color: var(--meta); z-index: 2; width: 32px; height: 32px; line-height: 1; border-radius: 8px; }
.panel-close:hover, .panel-back:hover { background: var(--paper-3); color: var(--ink); }
.panel-back { position: absolute; top: 8px; inset-inline-start: 44px; border: 0; background: none; font-size: 14px; color: var(--accent); z-index: 2; height: 32px; padding: 0 8px; border-radius: 8px; }
.panel-body { overflow-y: auto; padding: 18px 20px 24px; }
.p-kicker { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; padding-inline-start: 28px; }
.panel-body.has-back .p-kicker { padding-inline-start: 104px; }
.tag { font-size: 13px; padding: 2px 8px; border-radius: 999px; background: var(--paper-3); color: var(--ink-2); white-space: nowrap; }
.tag.era { color: #fff; }
.p-title { font-family: var(--f-title); font-weight: 700; font-size: 28px; line-height: 1.45; margin: 4px 0 2px; }
.p-sub { color: var(--ink-2); font-family: var(--f-text); font-size: 17px; line-height: 1.6; margin: 0 0 6px; }
.p-date { color: var(--ink-2); font-size: 14px; line-height: 1.7; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.p-date b { color: var(--accent); font-weight: 600; }
.story-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
/* a chapter's two moments, at its height and at its end, and its events as numbered dots that take the map to each */
.tour-moments { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; }
.tour-moments button { border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 999px; padding: 2px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.tour-moments button b { font-weight: 600; }
.tour-moments button.on { background: var(--ink-2); border-color: var(--ink-2); color: var(--paper); }
.tour-beats { display: flex; gap: 6px; margin: 2px 0 4px; }
.tour-beats button { width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--c); font: 600 12px/24px var(--f-ui); padding: 0; cursor: pointer; opacity: .85; }
.tour-beats button.on, .tour-beats button:hover { opacity: 1; box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--c); }
.story .who i { font-style: normal; color: var(--meta); }
/* the tour's ending: the whole tide with the chapters under it, and three ways on */
.tour-end { padding-top: 26px; }
.tour-end h3 { margin: 6px 0 4px; }
.tour-tide { display: block; width: 100%; height: auto; margin: 8px 0 6px; }
.tour-tide .tide-area { fill: var(--accent); opacity: .2; }
.tour-tide .tide-line { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .9; }
.tour-tide .tide-peak { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 3 3; }
.tour-end-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 12px; }
.tour-end-chips button { border: 0; border-radius: 999px; background: var(--c); font: 600 12px/1.6 var(--f-ui); padding: 2px 10px; cursor: pointer; }
.tour-end-chips button:hover { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--c); }
/* the tour's card among the journeys: the eleven eras for its face */
.jr-eras { display: flex; }
.jr-eras i { flex: 1; }
.tour-end-doors { display: flex; flex-wrap: wrap; gap: 8px; }
/* the eleven eras as a ribbon, each a door to its chapter of the tour */
.tour-ribbon { display: flex; gap: 3px; margin: 2px 0 8px; direction: inherit; }
.tour-ribbon button { flex: 1; min-width: 0; height: 22px; border: 0; border-radius: 6px; background: var(--c); color: #fff; opacity: .45; font: 600 12px/22px var(--f-ui); cursor: pointer; padding: 0; }
.tour-ribbon button:hover, .tour-ribbon button:focus-visible { opacity: .8; }
.tour-ribbon button.on { opacity: 1; box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--c); }
/* an era as a chapter: its span with the marks of how it began, turned and ended, then the sentences */
.chapter { margin: 6px 0 14px; }
.ch-bar { position: relative; height: 22px; margin: 4px 12px 10px; border-radius: 11px; background: color-mix(in srgb, var(--c) 28%, var(--paper-2)); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); }
.ch-bar i { position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px -11px 0; border-radius: 50%; background: var(--c); color: #fff; font: 600 12px/22px var(--f-ui); font-style: normal; text-align: center; cursor: pointer; box-shadow: 0 0 0 2px var(--paper); }
.ch-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ch-steps li { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 6px 8px; border-radius: 10px; font-family: var(--f-text); font-size: 17.5px; line-height: 1.7; }
.ch-steps li:hover { background: var(--paper-3); }
.ch-steps li small { display: block; font-family: var(--f-ui); font-size: 12.5px; color: var(--meta); line-height: 1.5; }
.ch-n { flex: none; width: 22px; height: 22px; margin-top: 4px; border-radius: 50%; background: var(--ink-3); color: var(--paper); font: 600 12px/22px var(--f-ui); text-align: center; }
.ch-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }
.ch-note { margin: 6px 0 0; font-size: 12.5px; color: var(--meta); }
/* a Hijri year as a page: the door to it from a date and from the map's year box, and the states of the day */
.year-door { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; padding: 0 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.year-states { display: flex; flex-wrap: wrap; gap: 5px; }
#atlas-year { cursor: pointer; }
/* every view that can show the record, under its title */
.p-views { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
.p-views > span { font-size: 12.5px; color: var(--meta); margin-inline-end: 2px; }
.pv-chip { border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 13px; line-height: 1.5; cursor: pointer; }
.pv-chip:hover { border-color: var(--gold); color: var(--ink); }
.pv-chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
/* what prepared an event and what followed it: under its summary, each a door to the other event with the sentence that joins them */
.causes { display: grid; gap: 8px; margin: 4px 0 14px; }
.cause-card { border: 1px solid var(--line-2); border-inline-start: 3px solid var(--accent); background: var(--paper-2); border-radius: 10px; padding: 6px 6px 4px; }
.cause-card h4 { margin: 0 4px 2px; font: 600 13px/1.6 var(--f-ui); color: var(--meta); }
.cause-door { display: block; width: 100%; text-align: start; background: none; border: 0; border-radius: 8px; padding: 5px 6px; cursor: pointer; color: inherit; font: inherit; }
.cause-door:hover { background: var(--paper-3); }
.cd-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cd-head b { font-weight: 600; font-size: 15px; line-height: 1.5; color: var(--accent); }
.cd-head small { flex: none; font-size: 13px; color: var(--meta); }
.cd-text { display: block; font-family: var(--f-text); font-size: 17px; line-height: 1.7; color: var(--ink); }
.cause-more summary { cursor: pointer; font-size: 12.5px; color: var(--meta); padding: 2px 6px; }
.cd-src { display: block; margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--meta); }
.p-wait { color: var(--meta); font-size: 13.5px; margin: -4px 0 8px; }
.p-names { font-family: var(--f-text); font-size: 16.5px; color: var(--ink-2); margin: -2px 0 8px; line-height: 1.6; }
.p-names small { display: block; font-family: var(--f-ui); font-size: 12.5px; color: var(--meta); }
.p-lead { font-family: var(--f-text); font-size: 19.5px; line-height: 1.75; margin: 10px 0; }
.p-text { font-family: var(--f-text); font-size: 18px; line-height: 1.85; color: var(--ink); margin: 8px 0; }
.p-sec { margin-top: 18px; }
.p-sec h4 { font-family: var(--f-label); font-weight: 600; font-size: 14.5px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.p-sec h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.en-note { font-size: 12.5px; color: var(--meta); background: var(--paper-2); border-radius: 6px; padding: 4px 8px; margin: 6px 0; }
.ltr { direction: ltr; text-align: left; font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.65; }
.nums { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.nums div { background: var(--paper-2); border-radius: 8px; padding: 6px 9px; }
.nums small { display: block; color: var(--meta); font-size: 12.5px; }
.nums b { font-size: 15px; }
.plist { display: flex; flex-direction: column; gap: 2px; }
.prow { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; cursor: pointer; }
.prow:hover { background: var(--paper-2); }
.prow .dot { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-family: var(--f-title); font-size: 13px; }
.prow .nm { flex: 1; min-width: 0; }
.prow .nm b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .nm small { color: var(--meta); font-size: 13px; }
.prow .age { color: var(--accent); font-size: 13px; white-space: nowrap; font-weight: 600; }
.lifebar { position: relative; height: 34px; margin: 10px 0 4px; }
.lifebar .track { position: absolute; top: 14px; height: 6px; inset-inline: 0; background: var(--paper-3); border-radius: 3px; }
/* no birth on record: the start of the life is not known, so the track fades in */
.lifebar.nobirth .track { background: linear-gradient(to right, transparent, var(--paper-3) 45%); }
[dir="rtl"] .lifebar.nobirth .track { background: linear-gradient(to left, transparent, var(--paper-3) 45%); }
.lifebar .pt { position: absolute; top: 10px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--card); transform: translateX(50%); cursor: pointer; }
.lifebar .lbl { position: absolute; top: 0; font-size: 12px; color: var(--meta); }
.qref { display: inline-block; background: var(--paper-2); border-radius: 6px; padding: 1px 7px; margin: 2px; font-size: 13.5px; }
.srcs { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.src { padding: 6px 9px; border-inline-start: 3px solid var(--gold); background: var(--paper-2); border-radius: 0 8px 8px 0; }
:root[dir="rtl"] .src, [dir="rtl"] .src { border-radius: 8px 0 0 8px; }
.src small { color: var(--meta); display: block; }
.minimap { position: relative; height: 190px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); }

/* arena (disputes) */
.arena { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: linear-gradient(var(--paper-2), var(--card)); }
.arena .topic { font-family: var(--f-title); font-weight: 700; font-size: 16.5px; line-height: 1.55; margin-bottom: 6px; }
.arena .view-row { display: flex; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--line-2); font-size: 14.5px; }
.arena .view-row:first-of-type { border-top: 0; }
.arena .view-row .v { flex: 1; }
.arena .view-row .by { color: var(--meta); font-size: 13px; max-width: 48%; }
.arena .verdict { margin-top: 8px; background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 8px; padding: 7px 9px; font-size: 14.5px; line-height: 1.6; }
.arena .verdict b { color: var(--accent); }
.conf { display: inline-flex; gap: 3px; vertical-align: middle; margin-inline-start: 6px; }
.conf i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.conf.c3 i, .conf.c2 i:nth-child(-n+2), .conf.c1 i:first-child { background: var(--accent); }

/* ---------- atlas ---------- */
.atlas-wrap { flex: 1; display: flex; min-height: 0; }
.atlas-map { flex: 1; position: relative; background: var(--sea); overflow: hidden; }
.atlas-map > svg:not(.map-compass) { position: relative; width: 100%; height: 100%; display: block; cursor: grab; }
#atlas-base { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#atlas-base[hidden] { display: none; }
/* every map style sets its own ink, so labels stay readable in either theme */
:root { --map-ink: var(--ink); --map-ink-2: var(--ink-2); --map-halo: var(--land); --map-sea-ink: var(--ink-3); }
.ms-natural { --map-ink: #2a1f12; --map-ink-2: #5a4326; --map-halo: rgba(252, 246, 230, .86); --map-sea-ink: #d9edf0; --river: #2f7ea3; }
.ms-ink { --map-ink: #1f160d; --map-ink-2: #4c3621; --map-halo: rgba(246, 239, 222, .88); --map-sea-ink: #f0e7cc; --river: #3f7f7a; }
.ms-ink.atlas-map::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}
.ms-ink.atlas-map::after {
  content: ""; position: absolute; inset: 7px; z-index: 1; pointer-events: none; border: 1px solid rgba(58, 41, 24, .65); outline: 3px double rgba(58, 41, 24, .5); outline-offset: 3px;
  box-shadow: inset 0 0 70px rgba(72, 46, 16, .32);
}
.geo-sea { font-family: var(--f-title); font-style: italic; fill: var(--map-sea-ink); pointer-events: none; opacity: .9; stroke: none; }
.geo-region { font-family: var(--f-title); font-weight: 700; fill: var(--map-ink-2); opacity: .8; pointer-events: none; paint-order: stroke; stroke: var(--map-halo); stroke-linejoin: round; }
.map-styles {
  position: absolute; top: 12px; inset-inline-end: 14px; z-index: 2; display: flex; gap: 4px; padding: 4px; border-radius: 12px;
  background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.map-styles button { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 4px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); }
.map-styles button span { width: 48px; height: 32px; border-radius: 5px; background-size: cover; background-position: center; border: 1px solid var(--line); }
.map-styles button:hover { background: var(--paper-2); }
.map-styles button:focus-visible { outline: 2px solid var(--accent); }
.map-styles button.on { background: var(--ink); color: var(--paper); }
.map-furniture { position: absolute; bottom: 12px; inset-inline-end: 16px; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.map-compass { width: 46px; height: 46px; display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }
.c-star { fill: color-mix(in srgb, var(--card) 88%, transparent); stroke: var(--gold); stroke-width: 1; }
.c-needle { fill: var(--red); }
.c-hub { fill: var(--gold); }
.map-scale { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; color: var(--ink); background: color-mix(in srgb, var(--card) 86%, transparent); padding: 3px 8px; border-radius: 7px; }
.map-scale i { display: block; height: 5px; border: 1.5px solid var(--ink); border-top: 0; }
.land { fill: var(--land); stroke: var(--land-edge); stroke-width: .6; vector-effect: non-scaling-stroke; }
.rule { fill: var(--rule); opacity: .5; }
.rule-edge { fill: none; stroke: var(--rule-edge); stroke-width: 1.2; opacity: .6; vector-effect: non-scaling-stroke; }
.river { fill: none; stroke: var(--river); stroke-width: 1.4; vector-effect: non-scaling-stroke; pointer-events: none; }
.hit { fill: transparent; stroke: none; cursor: pointer; pointer-events: all; }
.hit:hover, .hit.hi { fill: rgba(255, 255, 255, .16); stroke: var(--map-ink); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.grat { fill: none; stroke: var(--ink-3); stroke-width: .4; opacity: .25; vector-effect: non-scaling-stroke; }
.city circle { fill: var(--map-ink); }
.city text, .dyn-label text, .map-label { fill: var(--map-ink); paint-order: stroke; stroke: var(--map-halo); stroke-width: 2.4px; stroke-linejoin: round; pointer-events: none; }
.city text { font-family: var(--f-label); font-weight: 500; }
.dyn-label text { font-family: var(--f-title); font-weight: 700; fill: var(--map-ink); }
.pin { cursor: pointer; }
.pin circle.halo { opacity: .25; }
.pin.sel circle.core { stroke: var(--ink); stroke-width: 2px; }
.route { fill: none; stroke-width: 2.4; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; opacity: .9; cursor: pointer; }
.route.hi { stroke-width: 4.4; opacity: 1; }
@keyframes dash { to { stroke-dashoffset: -22; } }
.atlas-year {
  position: absolute; top: 12px; inset-inline-start: 14px; z-index: 2; background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 124px;
}
.atlas-year .y-ah { font-family: var(--f-label); font-weight: 600; font-size: 25px; line-height: 1.25; }
.atlas-year .y-ce { font-family: var(--f-label); font-size: 14.5px; line-height: 1.4; color: var(--ink-2); }
.atlas-year .e { font-family: var(--f-label); font-size: 13px; line-height: 1.5; color: #fff; padding: 1px 9px; border-radius: 5px; margin-top: 5px; }
.atlas-legend {
  position: absolute; bottom: 12px; inset-inline-start: 14px; background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; font-size: 13px; display: flex; flex-direction: column; gap: 3px;
}
.atlas-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }
.atlas-side { width: 330px; border-inline-start: 1px solid var(--line); overflow-y: auto; padding: 12px 14px; background: var(--paper); }
.atlas-side h3 { font-family: var(--f-label); font-weight: 600; font-size: 15px; margin: 4px 0 8px; }
.atlas-side .ev-item { display: flex; gap: 9px; padding: 7px 6px; border-radius: 9px; cursor: pointer; align-items: flex-start; }
.atlas-side .ev-item:hover { background: var(--paper-2); }
.atlas-side .ev-item svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke-width: 2; margin-top: 2px; }
.atlas-side .ev-item b { font-weight: 500; display: block; }
.atlas-side .ev-item small { color: var(--meta); }
.world-chips { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); }
.world-chips summary { cursor: pointer; padding: 3px 0; }
.land-row { display: flex; flex-direction: column; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.land-row b { font-weight: 600; font-size: 14px; }
.land-row small { color: var(--meta); font-size: 13px; }
.land-row small.note { color: var(--ink-2); }
.atlas-side .dyn-chip { display: inline-block; font-size: 13px; padding: 2px 8px; border-radius: 6px; margin: 2px; color: #fff; cursor: pointer; }
.atlas-controls { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--paper-2); }
.slider-wrap { flex: 1; position: relative; height: 34px; }
.slider-eras { position: absolute; inset: 9px 0 auto; height: 16px; border-radius: 8px; overflow: hidden; display: flex; }
.slider-eras div { height: 100%; }
#atlas-slider { position: absolute; inset: 0; width: 100%; margin: 0; height: 34px; background: transparent; -webkit-appearance: none; appearance: none; direction: rtl; }
#atlas-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 8px; height: 30px; border-radius: 4px; background: var(--ink); border: 2px solid var(--paper); cursor: pointer; }
#atlas-slider::-moz-range-thumb { width: 8px; height: 30px; border-radius: 4px; background: var(--ink); border: 2px solid var(--paper); cursor: pointer; }
#atlas-speed { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 4px 6px; }

/* ---------- streams ---------- */
.streams { flex: 1; overflow: auto; position: relative; }
.streams svg { display: block; }
.st-col-head { font-family: var(--f-label); font-size: 13.5px; fill: var(--ink); }
.st-col-bg { fill: var(--paper-2); }
.st-col-bg.alt { fill: var(--paper); }
.st-block { cursor: pointer; }
.st-block rect { stroke: rgba(40,25,10,.28); stroke-width: .5; }
.st-span { font-family: var(--f-title); font-weight: 700; pointer-events: none; }
.st-block text { font-family: var(--f-title); font-weight: 700; fill: #fff; pointer-events: none; }
.st-block.nonmuslim rect { opacity: .4; }
/* a faint block of the wider world takes the theme's ink, which reads on it in light and dark */
.st-block.nonmuslim text:not(.st-more) { fill: var(--ink); }
.st-block:hover rect { stroke: var(--ink); stroke-width: 2; }
.st-tick text { font-size: 12.5px; fill: var(--meta); }
.st-tick line { stroke: var(--line-2); }
.st-era text { font-family: var(--f-label); font-size: 13px; opacity: .8; }

/* ---------- scholars & lineage ---------- */
.scholars, .lineage { flex: 1; position: relative; overflow: hidden; }
.scholars svg, .lineage svg { width: 100%; height: 100%; display: block; cursor: grab; }
.lane-bg { fill: var(--paper-2); }
.lane-bg.alt { fill: var(--paper); }
.lane-label { font-family: var(--f-label); font-weight: 600; font-size: 14px; fill: var(--ink-2); }
.sch { cursor: pointer; }
.sch rect.bar, .sch rect.cap { rx: 4px; }
.sch rect.cap { fill-opacity: .24; }
.sch text { font-size: calc(13px * var(--ts)); pointer-events: none; }
.sch text.on-bar { fill: #fff; }
.sch text.on-cap { fill: var(--ink); }
.sch.dim { opacity: .12; }
.tlink { fill: none; stroke: var(--ink-3); stroke-width: 1.1; }
.tlink.hi { stroke: var(--accent); }
.tlink.dim { opacity: .05; }
.chain-box {
  position: absolute; top: 10px; inset-inline-start: 12px; max-width: 520px; background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; box-shadow: var(--shadow); font-size: 14.5px; line-height: 1.9; pointer-events: none;
}
.chain-box b { font-family: var(--f-title); font-size: 15px; }
.lin-node { cursor: pointer; }
.lin-node circle { stroke: var(--card); stroke-width: 2; }
.lin-node text { font-size: calc(14px * var(--ts)); fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 3.5px; }
.lin-node.prophet text { font-family: var(--f-title); font-size: calc(17px * var(--ts)); font-weight: 700; }
.lin-link { fill: none; stroke: var(--ink-3); stroke-width: 1.3; opacity: .6; }
.lin-link.uncertain { stroke-dasharray: 4 4; opacity: .45; }

/* ---------- library ---------- */
.library { flex: 1; overflow-y: auto; padding: 20px clamp(16px, 4vw, 48px) 60px; }
.lib-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; max-width: 1300px; margin: 0 auto; }
.library h2 { font-family: var(--f-title); font-weight: 700; font-size: 26px; line-height: 1.45; margin: 6px 0 10px; }
.library h3 { font-family: var(--f-label); font-weight: 600; font-size: 15px; margin: 18px 0 8px; color: var(--ink-2); }
.library p { font-family: var(--f-text); font-size: 18px; line-height: 1.85; }
.tier { display: grid; grid-template-columns: 34px 1fr; gap: 10px; margin: 10px 0; }
.tier .n { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #fff; display: grid; place-items: center; font-family: var(--f-label); font-weight: 600; }
.maker { margin-top: 30px; padding-top: 4px; border-top: 1px solid var(--line); }
.maker h3 { margin-top: 16px; }
.maker p { font-family: var(--f-text); font-size: 16.5px; line-height: 1.85; margin: 6px 0; color: var(--ink-2); }
.maker .maker-basmala { text-align: center; font-family: var(--f-text); font-size: 21px; color: var(--ink); margin: 4px 0 10px; }
.maker .maker-sign { margin: 16px 0 0; text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; color: var(--ink); }
.maker .maker-sign b { font-family: var(--f-title); font-size: 19px; font-weight: 700; }
.maker .maker-en { font-family: var(--f-label); font-size: 14px; color: var(--meta); }
.maker .maker-sign small { font-family: var(--f-label); font-size: 13px; color: var(--meta); }
.src-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px; margin-bottom: 8px; background: var(--card); }
.src-card b { font-family: var(--f-title); font-size: 17px; }
.src-card .au { color: var(--meta); font-size: 13.5px; }
.src-card p { font-size: 15px; margin: 4px 0 0; line-height: 1.7; }
.src-card .uses { font-size: 13px; color: var(--accent); }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; min-width: 96px; }
.stat b { font-family: var(--f-label); font-weight: 600; font-size: 22px; display: block; }
.stat small { color: var(--meta); }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed; z-index: 60; pointer-events: none; max-width: 300px; background: var(--ink); color: var(--paper);
  padding: 7px 10px; border-radius: 9px; font-size: 13.5px; line-height: 1.5; box-shadow: var(--shadow);
}
.tooltip b { font-family: var(--f-title); font-weight: 700; font-size: 15px; line-height: 1.5; display: block; margin-bottom: 1px; }
.tooltip small { opacity: .75; }
.tooltip small.tip-src { display: block; margin-top: 3px; font-size: 11.5px; opacity: .6; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .search input { width: 160px; }
  .brand-text small { display: none; }
  .atlas-side { width: 260px; }
}
@media (max-width: 760px) {
  :root { --top-h: 104px; }
  .top { flex-wrap: wrap; height: auto; min-height: var(--top-h); padding: 6px 12px; gap: 6px 10px; }
  .tabs { order: 3; flex-basis: 100%; }
  .tools { margin-inline-start: auto; }
  .search input { width: 130px; }
  .atlas-year { padding: 7px 12px 9px; min-width: 96px; }
  .atlas-year .y-ah { font-size: 19px; }
  .atlas-year .y-ce { font-size: 13px; }
  .atlas-year .e { font-size: 12px; margin-top: 3px; }
  .toolbar.tight .btn { padding: 5px 10px; font-size: 13.5px; }
  .cmp-pickers { grid-template-columns: 1fr; }
  .cmp-table td:not(:first-child), .cmp-table th:not(:first-child) { width: 68px; }
  .jr-card, .cmp-card { padding: 16px 14px 20px; }
  .arena-filters .fgroup { flex-direction: column; gap: 3px; }
  .arena-filters .fgroup > span:first-child { flex: none; }
  .chain-box { max-width: calc(100% - 24px); }
  #share-btn { display: none; }
  .map-styles { top: 12px; bottom: auto; inset-inline-end: 8px; flex-direction: row; }
  .map-styles button { font-size: 0; gap: 0; }
  .map-styles button span { width: 34px; height: 26px; }
  .alive-card { inset-inline: 8px; width: auto; bottom: 52px; max-height: 34%; }
  .story { bottom: 114px; width: calc(100% - 16px); padding: 10px 12px; max-height: 48%; }
  .story .tour-ribbon { margin-inline-start: 30px; }
  /* the buttons stay at the foot of the card as it scrolls, and the tour's events, pinned on the map, leave the room to its sentence */
  .story .story-nav { position: sticky; bottom: -10px; background: var(--card); padding-block: 4px; }
  .story.tour .who { display: none; }
  .story h3 { font-size: 21px; }
  .story p { font-size: 16px; line-height: 1.6; }
  .story-banner { display: none; }
  .lib-grid { grid-template-columns: 1fr; }
  .panel { top: auto; height: 72%; inset-inline: 0; bottom: 0; width: 100%; border-radius: 16px 16px 0 0; }
  /* while a chosen event has links, the sheet starts below the rows that hold them and their markers, and still leaves at least three tenths of the screen to read */
  body.cause-peek[data-view="chronicle"] .panel { top: min(max(var(--chart-foot, 28%), 28%), 70%); height: auto; }
}

/* ---------- timeline controls ---------- */
.toolbar.tight { padding: 6px 14px; gap: 8px; }
.btn.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chron-overview { flex: 0 0 22px; width: 100%; height: 22px; display: block; cursor: pointer; touch-action: none; border-bottom: 1px solid var(--line-2); }
.ov-name { font-family: var(--f-label); font-size: 10.5px; font-weight: 500; fill: #fff; pointer-events: none; }
.ov-shade { fill: var(--paper); opacity: .55; pointer-events: none; }
.ov-win { fill: none; stroke: var(--ink); stroke-width: 1.6; pointer-events: none; }
.fchip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.fchip small { opacity: .7; font-size: 12.5px; }
.fchip:disabled { opacity: .35; cursor: default; }

/* ---------- the arena ---------- */
.arena-view { flex: 1; overflow-y: auto; }
.arena-page { max-width: 960px; margin: 0 auto; padding: 20px clamp(16px, 4vw, 32px) 60px; display: flex; flex-direction: column; gap: 14px; }
.arena-head { display: flex; flex-direction: column; gap: 8px; }
.arena-head h2 { font-family: var(--f-title); font-weight: 700; font-size: 28px; line-height: 1.4; margin: 0; }
.arena-head p { font-family: var(--f-text); font-size: 17px; line-height: 1.7; color: var(--ink-2); margin: 0; }
.arena-search { width: 100%; height: 42px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); padding: 0 18px; font-size: 15px; outline: none; }
.arena-search:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(165,118,31,.15); }
.arena-filters { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--paper-2); font-size: 13.5px; }
.arena-filters .fgroup { display: flex; gap: 8px; align-items: baseline; }
.arena-filters .fgroup > span:first-child { flex: 0 0 62px; color: var(--meta); }
.arena-filters .fgroup > div { display: flex; flex-wrap: wrap; gap: 4px; }
.arena-sort { justify-content: space-between; align-items: center !important; border-top: 1px solid var(--line-2); padding-top: 8px; }
.arena-sort .arena-count { flex: 0 0 auto !important; color: var(--ink) !important; font-weight: 600; }
.arena-sort label { display: flex; align-items: center; gap: 6px; color: var(--meta); }
.arena-sort select { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 3px 6px; }
.arena-list { display: flex; flex-direction: column; gap: 4px; }
.arena-list .btn { align-self: center; margin-top: 8px; }
.arena-none { font-family: var(--f-text); font-size: 17px; color: var(--meta); text-align: center; padding: 30px 0; }
.dispute-item { cursor: default; }
.dispute-item.focus .arena { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(165,118,31,.18); }
.dispute-item .ctx { display: flex; align-items: baseline; gap: 6px; font-size: 13.5px; line-height: 1.6; margin-bottom: 4px; }
.dispute-item .ctx [data-kind] { color: var(--accent); cursor: pointer; font-weight: 500; }
.dispute-item .ctx [data-kind]:hover { text-decoration: underline; }
.dispute-item .ctx .link-btn { margin-inline-start: auto; }
.link-btn { border: 0; background: none; color: var(--accent); font-size: 13.5px; padding: 3px 6px; border-radius: 6px; line-height: 1.4; }
.link-btn:hover { background: var(--paper-3); }

/* ---------- drawer's foot, toast ---------- */
.panel-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 2px 4px; padding: 6px 12px; border-top: 1px solid var(--line-2); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 10px; font-size: 14px; line-height: 1.5; box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); }
.toast input { display: block; width: min(420px, 70vw); margin-top: 4px; background: var(--paper); color: var(--ink); border: 0; border-radius: 6px; padding: 3px 6px; font-size: 13px; }
.toast .link-btn { color: var(--paper); font-size: 18px; }

/* ---------- chains: pin ---------- */
.tlink { opacity: .24; stroke-width: 1.2; }
.tlink.hi { opacity: .8; stroke-width: 1.8; }
.tlink.path { stroke: var(--gold); stroke-width: 3.4; opacity: 1; }
.tlink.weak { stroke-dasharray: 1 5; stroke-linecap: round; }
.sch.pin rect.bar { stroke: var(--ink); stroke-width: 1.6; }
.scholars .chain-box { pointer-events: auto; }
.chain-name { all: unset; cursor: pointer; font-family: var(--f-title); font-weight: 700; font-size: 15px; line-height: 1.7; }
.chain-name:hover, .chain-name:focus-visible { color: var(--accent); text-decoration: underline; }
.chain-actions { display: flex; gap: 4px; margin-inline-start: -6px; }

/* ---------- lineage: set apart ---------- */
.lin-apart rect { fill: color-mix(in srgb, var(--paper-2) 80%, transparent); stroke: var(--ink-3); stroke-dasharray: 5 4; }
.lin-apart-title { font-family: var(--f-label); font-size: 13px; fill: var(--ink-2); }

/* ---------- journeys and comparison ---------- */
.journeys, .compare { position: fixed; inset: 0; z-index: 70; background: rgba(30, 22, 12, .5); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(2px); }
.jr-card, .cmp-card { position: relative; width: min(980px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 22px 24px 26px; }
.jr-card h2, .cmp-card h2 { font-family: var(--f-title); font-weight: 700; font-size: 26px; line-height: 1.4; margin: 0 0 14px; padding-inline-start: 30px; }
.jr-card .panel-close, .cmp-card .panel-close { top: 14px; inset-inline-start: 14px; }
.jr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.jr { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--paper); padding-bottom: 10px; }
.jr:hover, .jr:focus-visible { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(165,118,31,.18); }
.jr-img { display: block; height: 104px; background-size: cover; background-position: center; margin-bottom: 6px; }
.jr b { font-family: var(--f-title); font-size: 18px; line-height: 1.45; padding-inline: 12px; }
.jr small { font-family: var(--f-text); font-size: 15px; line-height: 1.6; color: var(--ink-2); padding-inline: 12px; }
.jr em { font-style: normal; font-size: 13px; color: var(--accent); padding-inline: 12px; }
.cmp-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cmp-pick { position: relative; display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--meta); }
.cmp-pick input { height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); padding: 0 12px; font-size: 15px; color: var(--ink); outline: none; }
.cmp-pick input:focus { border-color: var(--gold); }
.cmp-pick .search-results { top: 58px; width: 100%; inset-inline: 0; }
.cmp-hint { font-family: var(--f-text); font-size: 17px; line-height: 1.7; color: var(--ink-2); margin: 18px 0 0; }
.cmp-axis { position: relative; margin: 18px 0 6px; padding: 6px 0 22px; border-bottom: 1px solid var(--line-2); overflow: hidden; }
.cmp-row { position: relative; height: 22px; margin-bottom: 5px; }
.cmp-bar { position: absolute; top: 0; bottom: 0; border-radius: 5px; min-width: max-content; padding: 0 9px; color: #fff; font-size: 13px; line-height: 22px; white-space: nowrap; }
.cmp-bar.a { background: var(--accent); }
.cmp-bar.b { background: var(--gold); }
.cmp-overlap { position: absolute; top: 0; bottom: 18px; background: color-mix(in srgb, var(--gold) 22%, transparent); }
.cmp-ends { position: absolute; bottom: 2px; inset-inline: 0; display: flex; justify-content: space-between; font-size: 13px; color: var(--meta); }
.cmp-facts { font-family: var(--f-text); font-size: 17px; line-height: 1.75; margin: 12px 0; padding-inline-start: 20px; }
.cmp-card h4 { font-family: var(--f-label); font-weight: 600; font-size: 15px; margin: 18px 0 6px; color: var(--ink-2); }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.cmp-table th { font-family: var(--f-label); font-weight: 600; text-align: start; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.cmp-table td { padding: 5px 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.cmp-table td:not(:first-child), .cmp-table th:not(:first-child) { width: 104px; }
.cmp-table td b { font-weight: 500; display: block; }
.cmp-table td small { color: var(--meta); }
.cmp-table tr[data-event] { cursor: pointer; }
.cmp-table tr[data-event]:hover { background: var(--paper-2); }
.cmp-table tr.both { background: color-mix(in srgb, var(--gold) 12%, transparent); }
.cmp-actions { margin-top: 14px; }

/* ---------- reading comfort: what the reader's text size scales ---------- */
.panel-body, .panel-actions, .atlas-side, .arena-page, .ib-page, .lib-grid, .jr-card, .cmp-card, .story, .map-caption, .tooltip, .hint-card { zoom: var(--ts); }

/* ---------- the map: its story on it, and its own controls ---------- */
.atlas-wrap { position: relative; }
.atlas-side { position: absolute; top: 12px; bottom: 12px; inset-inline-end: 12px; width: 320px; z-index: 4; display: none; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.atlas-wrap.side-open .atlas-side { display: block; }
.side-close { display: none; position: absolute; top: 20px; inset-inline-end: 22px; z-index: 26; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); font-size: 18px; line-height: 1; place-items: center; cursor: pointer; }
.atlas-wrap.side-open .side-close { display: grid; }
.atlas-wrap.side-open .map-styles { inset-inline-end: 344px; }
.atlas-wrap.side-open .map-furniture, .atlas-wrap.side-open .map-zoom { inset-inline-end: 344px; }
.map-zoom { position: absolute; bottom: 104px; inset-inline-end: 22px; z-index: 2; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
.map-zoom button { border: 0; background: var(--card); width: 36px; height: 34px; font-size: 18px; line-height: 1; color: var(--ink); }
.map-zoom button + button { border-top: 1px solid var(--line-2); }
.map-zoom button:hover { background: var(--paper-3); }
.map-caption { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 620px)); min-width: 340px; z-index: 3; display: flex; align-items: stretch; background: color-mix(in srgb, var(--card) 96%, transparent); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.cap-nav { flex: 0 0 38px; border: 0; background: none; font-size: 21px; color: var(--accent); line-height: 1; }
.cap-nav:hover { background: var(--paper-3); }
.cap-nav:disabled { opacity: .3; }
.cap-body { all: unset; flex: 1; min-width: 0; padding: 8px 6px 9px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; animation: capin .35s ease-out; }
.cap-body:hover b { color: var(--accent); }
.cap-body small { font-size: 13px; line-height: 1.5; color: var(--meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap-body b { font-family: var(--f-title); font-size: 19px; font-weight: 700; line-height: 1.45; }
.cap-body p { margin: 0; font-family: var(--f-text); font-size: 16.5px; line-height: 1.55; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes capin { from { opacity: 0; transform: translateY(4px); } }
.pin circle.halo { opacity: .22; }
.pin.focus circle.halo { opacity: .5; animation: ping 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.pin.hi circle.core { stroke: var(--ink); stroke-width: 2.5px; }
@keyframes ping { from { transform: scale(.7); opacity: .6; } to { transform: scale(1.7); opacity: 0; } }
.route-label { font-family: var(--f-label); font-weight: 600; paint-order: stroke; stroke: var(--map-halo); stroke-linejoin: round; cursor: pointer; }
.route-dot { stroke: #fff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }

/* the time strip: where you are, in eras and centuries */
.atlas-controls { align-items: center; gap: 10px; padding: 8px 16px 6px; }
.slider-wrap { height: 60px; }
.slider-eras { inset: 3px 0 auto; height: 22px; border-radius: 7px; }
.slider-eras div { position: relative; overflow: hidden; display: grid; place-items: center; }
.slider-eras div > span { color: #fff; font-family: var(--f-label); font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
#atlas-slider { height: 28px; inset: 0 0 auto; z-index: 2; cursor: pointer; }
#atlas-slider::-webkit-slider-thumb { width: 10px; height: 28px; border-radius: 5px; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
#atlas-slider::-moz-range-thumb { width: 10px; height: 28px; border-radius: 5px; }
.slider-ticks { position: absolute; inset: 42px 0 0; pointer-events: none; }
/* the tide of Muslim rule: a thin row of its own under the strip, where nothing on the map covers it */
.slider-tide { position: absolute; inset: 27px 0 auto; height: 13px; }
.slider-tide svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tide-area { fill: var(--accent); opacity: .22; }
.tide-line { fill: none; stroke: var(--accent); stroke-width: 1.3; opacity: .6; }
.tide-label { position: absolute; inset-inline-start: 3px; top: 0; font-size: 10.5px; line-height: 13px; color: var(--meta); white-space: nowrap; }
.tide-mark { position: absolute; top: 0; width: 7px; height: 13px; margin-inline-start: -3px; cursor: help; }
.tide-mark::after { content: ""; position: absolute; inset: 2px 3px; background: var(--ink-3); border-radius: 1px; }
.rule-record { margin: 2px 0 8px; font-size: 13.5px; color: var(--ink-2); }
.y-tide { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.legend-key { display: contents; }
.arrival-key { display: flex; flex-wrap: wrap; gap: 4px 10px; max-width: 330px; }
.arrival-key span { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.arrival-key i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.slider-ticks i { position: absolute; top: 0; width: 1px; height: 4px; background: var(--ink-3); }
.slider-ticks span { position: absolute; top: 3px; transform: translateX(50%); font-size: 12px; line-height: 1.3; color: var(--ink-2); white-space: nowrap; }
:root[dir="ltr"] .slider-ticks span { transform: translateX(-50%); }
.slider-marks { position: absolute; inset: 3px 0 auto; height: 22px; pointer-events: none; z-index: 1; }
.slider-marks i { position: absolute; top: 15px; width: 2px; height: 7px; background: #fff; opacity: .85; }
.slider-bubble { position: absolute; bottom: 62px; transform: translateX(50%); background: var(--ink); color: var(--paper); font-size: 14px; line-height: 1.4; padding: 3px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none; z-index: 5; box-shadow: var(--shadow); }
:root[dir="ltr"] .slider-bubble { transform: translateX(-50%); }

/* first-time guidance */
/* a light note, not a slab over the chart: shown once per view, gone at the reader's first click, tap, drag, key or wheel */
.hint-card { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 16; max-width: min(540px, calc(100% - 24px)); width: max-content; display: flex; align-items: flex-start; gap: 8px; background: color-mix(in srgb, var(--card) 94%, transparent); color: var(--ink-2); border: 1px solid var(--line); padding: 7px 8px 7px 12px; border-radius: 12px; box-shadow: 0 4px 14px rgba(42,33,24,.12); font-size: 13.5px; line-height: 1.6; animation: capin .3s ease-out; }
.hint-card button { flex-shrink: 0; width: 24px; height: 24px; border: 0; background: none; color: var(--meta); border-radius: 50%; padding: 0; font-size: 17px; line-height: 1; cursor: pointer; }
.hint-card button:hover { background: var(--paper-3); color: var(--ink); }

/* connections */
.st-block { transition: opacity .12s; }
.st-block.dim { opacity: .16; }
.st-span { transition: opacity .12s; }
.st-span.dim { opacity: .1; }
.st-block.hi rect { stroke: var(--ink); stroke-width: 1.6; }
.st-cursor line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 3; pointer-events: none; }
.st-cursor rect { fill: var(--ink); }
.st-cursor text { fill: var(--paper); font-size: 13px; pointer-events: none; }
.st-ruler { cursor: pointer; fill: transparent; }
.st-col-head { font-size: 14px; }
.ev.rel .ic { stroke-width: 3; fill: color-mix(in srgb, var(--gold-2) 30%, var(--card)); }
.ev.rel text { font-weight: 600; fill: var(--accent); }
.life.rel rect.bar, .life.rel rect.cap { stroke: var(--gold); stroke-width: 2; }
.lin-link.onpath { stroke: var(--gold); stroke-width: 3; opacity: 1; stroke-dasharray: none; }
.lin-node.onpath circle { stroke: var(--gold); stroke-width: 3; }
.nasab { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 3px; font-size: 14px; line-height: 1.7; }
.nasab button { all: unset; cursor: pointer; color: var(--ink); border-bottom: 1px dotted var(--ink-3); }
.nasab button:hover { color: var(--accent); }
.nasab i { font-style: normal; color: var(--meta); font-size: 13px; }

/* chains: start from a name, read the chain as a chain */
.quick-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 13.5px; color: var(--meta); }
.quick-chips button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 11px; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.quick-chips button:hover { border-color: var(--gold); }
.quick-chips button.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
#view-scholars .toolbar { flex-wrap: nowrap; }
#sch-start { flex-wrap: nowrap; overflow-x: auto; min-width: 0; scrollbar-width: none; }
#sch-start > * { flex: none; }
.scholars .chain-box { max-width: min(640px, calc(100% - 24px)); max-height: 42%; overflow: auto; font-size: 14px; line-height: 1.75; }
.chain-word { color: var(--meta); font-size: 13px; margin-inline: 3px; }
.chain-word.weak { color: var(--accent); font-weight: 700; }
.chain-note { color: var(--meta); font-size: 12.5px; }

/* panel: read on */
.panel-actions { justify-content: space-between; align-items: center; }
.panel-actions > div { display: flex; flex-wrap: wrap; gap: 2px 4px; }
details.fold > summary { cursor: pointer; font-family: var(--f-label); font-weight: 600; font-size: 14.5px; color: var(--ink-2); padding: 3px 0; list-style-position: inside; }
details.fold > summary:hover { color: var(--accent); }
details.fold[open] > summary { margin-bottom: 8px; }
.meanwhile { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 7px; }
.mw-card { border: 1px solid var(--line-2); background: var(--paper-2); border-radius: 10px; padding: 7px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mw-card:hover { border-color: var(--gold); }
.mw-card small { color: var(--meta); font-size: 12.5px; line-height: 1.4; }
.mw-card b { font-weight: 500; font-size: 14px; line-height: 1.45; }
.extent svg { display: block; width: 100%; height: 76px; cursor: pointer; }
.extent .area { opacity: .55; }
.extent .top { fill: none; stroke-width: 1.6; }
.extent text { font-size: 12.5px; fill: var(--meta); }
.extent .peak { stroke: var(--ink-2); stroke-dasharray: 3 3; }
.extent-note { font-size: 13px; color: var(--meta); margin-top: 2px; }
.stop-label { font-size: 12.5px; fill: var(--map-ink); paint-order: stroke; stroke: var(--map-halo); stroke-width: 2.4px; stroke-linejoin: round; pointer-events: none; }
.stop-num { font-size: 10.5px; font-weight: 700; fill: #fff; pointer-events: none; }

/* ---------- names on the map: three kinds of place, told apart at a glance ---------- */
.city circle { fill: var(--map-ink); stroke: var(--map-halo); stroke-width: 1.4px; vector-effect: non-scaling-stroke; }
.city.t1 circle { stroke-width: 2px; }
.city.t3 circle { fill: var(--map-halo); stroke: var(--map-ink-2); stroke-width: 1.4px; }
.city text, .dyn-label text { pointer-events: auto; cursor: pointer; }
.leader { stroke: var(--map-ink-2); stroke-width: 1px; opacity: .65; vector-effect: non-scaling-stroke; pointer-events: none; }
.pin-count { font-family: var(--f-label); font-weight: 700; fill: var(--map-ink); paint-order: stroke; stroke: var(--map-halo); stroke-linejoin: round; pointer-events: none; }
.city.t1 text { font-weight: 600; }
.city.t2 text { font-weight: 500; }
.city.t3 text { font-weight: 400; }
.city:hover text { fill: var(--red); }
.city:hover circle { fill: var(--red); stroke: var(--map-halo); }

/* a close button that can be seen on any picture */
.story-close { top: 8px; inset-inline-start: 8px; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border-radius: 50%; background: color-mix(in srgb, var(--card) 94%, transparent); color: var(--ink); font-size: 21px; line-height: 1; box-shadow: 0 1px 5px rgba(0, 0, 0, .4); }
.story-close:hover { background: var(--ink); color: var(--paper); }
.panel-close { background: color-mix(in srgb, var(--card) 88%, transparent); color: var(--ink-2); }

/* ---------- the Sira map ---------- */
.slider-eras.sira div { position: relative; background: var(--accent); border-inline-end: 1px solid var(--paper-2); }
.slider-eras.sira div:nth-child(even) { background: var(--gold); }
.slider-eras.sira span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 10.5px; font-family: var(--f-label); pointer-events: none; }
.side-empty { color: var(--meta); font-size: 14px; }
.side-note { font-size: 13px; line-height: 1.6; color: var(--meta); margin-top: 16px; }
.pin-label { font-family: var(--f-title); font-weight: 700; fill: var(--map-ink); paint-order: stroke; stroke: var(--map-halo); stroke-linejoin: round; pointer-events: none; }

/* ---------- the wall chart ---------- */
.poster-mode { overflow: visible; background: #fbf6e9; }
.poster-mode > *:not(.poster) { display: none !important; }
.poster { width: 4494px; height: 3179px; padding: 56px; display: flex; flex-direction: column; background: #fbf6e9; color: #2a2118; overflow: hidden; }
.poster-head { flex: 0 0 186px; display: flex; justify-content: space-between; align-items: center; gap: 60px; border-bottom: 4px double #8b785e; }
.poster-title h1 { font-family: var(--f-brand); font-size: 96px; line-height: 1.25; margin: 0; }
.poster-title p { font-family: var(--f-text); font-size: 34px; line-height: 1.4; margin: 0; color: #5b4a37; }
.poster-key { max-width: 1500px; font-family: var(--f-text); font-size: 25px; line-height: 1.5; }
.poster-key p { margin: 0 0 6px; }
.poster-body { flex: 1; display: flex; min-height: 0; margin-top: 8px; }
.poster-chart { flex: 0 0 auto; }
.poster-rail { flex: 0 0 auto; display: block; }
.poster-rail-title { font-family: var(--f-title); font-weight: 700; font-size: 26px; fill: #2a2118; }
.poster-event { font-family: var(--f-label); font-size: 16px; fill: #2a2118; }
.poster-leader { fill: none; stroke: #8b785e; stroke-width: 1; opacity: .7; }
.poster-foot { flex: 0 0 64px; display: flex; align-items: center; font-family: var(--f-text); font-size: 22px; color: #5b4a37; border-top: 2px solid #8b785e; }
.poster .st-tick text { font-size: 15px; }
.poster .st-col-head { font-size: 22px; }
@page { size: 1189mm 841mm; margin: 0; }

/* ---------- intro & era imagery ---------- */
.era-hero { height: 150px; margin: -18px -20px 14px; background-size: cover; background-position: center; border-radius: 16px 16px 0 0; position: relative; }
.era-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, var(--card)); border-radius: inherit; }
.story-banner { grid-column: 1 / -1; height: 72px; margin: -14px -18px 0; background-size: cover; background-position: center 40%; border-radius: 16px 16px 0 0; position: relative; }
.story-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, var(--card)); border-radius: inherit; }
.scholars .chain-box { top: auto; bottom: 14px; inset-inline-start: auto; inset-inline-end: 12px; }

/* ---------- accessibility ---------- */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* A click leaves focus on what was clicked, and in a drawing the browser then rings it unasked. On the map that ring is in the map's own units, and so grows with the zoom until it
   covers the screen: there, what has the keyboard's focus says so in its own marks, which keep their size. */
svg [tabindex]:focus:not(:focus-visible), #atlas-svg [tabindex]:focus-visible { outline: none; }
.city:focus-visible circle, .pin:focus-visible circle.core { stroke: var(--gold); stroke-width: 3px; }
.city:focus-visible text, .dyn-label:focus-visible text { fill: var(--red); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- what opens over the map leaves the map's subject in view ---------- */
.tabs button { padding: 7px 10px; font-size: 14.5px; }
.search input { width: 200px; }
.sch.dim { opacity: .28; }
@media (max-width: 1500px) { .brand-text small { display: none; } .search input { width: 140px; } .tabs button { padding: 6px 7px; font-size: 14px; } }
@media (max-width: 1240px) { .tabs button { padding: 5px 6px; font-size: 13.5px; } .search input { width: 110px; } }
@media (min-width: 761px) and (max-width: 999.98px) {
  body[data-view="atlas"] .panel { bottom: 76px; }
  body.panel-open .atlas-year { inset-inline-start: 456px; }
  body.panel-open .map-caption { left: calc((100% - 448px) / 2); width: min(480px, calc(100% - 800px)); }
  :root[dir="ltr"] body.panel-open .map-caption { left: calc(448px + (100% - 448px) / 2); }
}
/* on a wide screen the drawer takes its own share of the page, and the view keeps the rest (js: A.panelWidth) */
@media (min-width: 1000px) {
  body.panel-open main { margin-inline-start: 440px; }
  .panel { top: var(--top-h); bottom: 0; inset-inline-start: 0; width: 440px; border-radius: 0; border-width: 0; border-inline-end-width: 1px; box-shadow: none; }
}
/* what is left for the map is then narrow: the time strip takes a row of its own, and the legend steps aside */
@media (min-width: 1000px) and (max-width: 1300px) {
  body.panel-open .atlas-controls { flex-wrap: wrap; gap: 6px 8px; padding: 6px 10px; }
  body.panel-open .slider-wrap { flex-basis: 100%; order: -1; }
  body.panel-open .atlas-legend { display: none; }
}
@media (min-width: 761px) {
  body.story-open .atlas-year { inset-inline-start: 456px; }
  .story { top: 12px; bottom: auto; left: auto; transform: none; inset-inline-start: 12px; width: min(424px, calc(100% - 24px)); max-height: calc(100% - 96px); }
}

/* ---------- phones: the parts added for reading comfort ---------- */
@media (max-width: 760px) {
  .atlas-controls { flex-wrap: wrap; gap: 6px 8px; padding: 6px 10px; }
  .slider-wrap { flex-basis: 100%; order: -1; }
  /* the list of states and events is a sheet over the lower map, above the year strip and ▶, which stay in reach */
  .atlas-wrap.side-open .atlas-side { position: absolute; inset: auto 0 0 0; width: auto; height: 64%; z-index: 25; border-radius: 16px 16px 0 0; }
  .atlas-wrap.side-open .side-close { top: calc(36% + 8px); inset-inline-end: 10px; }
  /* search results across the screen under the top bar, each row a finger's height */
  #search-results { position: fixed; top: calc(var(--top-h) + 4px); inset-inline: 8px; width: auto; max-height: calc(100% - var(--top-h) - 16px); }
  .top .sr-item { min-height: 44px; align-items: center; }
  .cmp-pickers { grid-template-columns: 1fr; }
  /* the ending's three ways on stay in reach at the foot of its card */
  .story .tour-end-doors { position: sticky; bottom: -10px; background: var(--card); padding-block: 6px; }
  .atlas-wrap.side-open .map-styles, .atlas-wrap.side-open .map-zoom { inset-inline-end: 8px; }
  .map-caption { width: calc(100% - 16px); min-width: 0; bottom: 8px; }
  .cap-body b { font-size: 16.5px; }
  .cap-body p { display: none; }
  .cap-nav { flex-basis: 34px; }
  .atlas-legend, .map-furniture { display: none; }
  .map-zoom { bottom: auto; top: 96px; inset-inline-end: 8px; }
  .map-zoom button { width: 32px; height: 30px; }
  .hint-card { font-size: 13.5px; }
  .quick-chips > span { display: none; }
  .slider-ticks span { font-size: 11px; }
  .btn { padding: 5px 10px; font-size: 13.5px; }
  .brand-text { display: none; }
  .tools { gap: 4px; }
  .chip-btn { min-width: 30px; height: 30px; padding: 0 6px; }
  .search input { width: 100%; min-width: 80px; padding: 0 10px; }
  .search { flex: 1; min-width: 0; }
  .tools { flex: 1; min-width: 0; }
  #atlas-speed { display: none; }
  .atlas-controls .btn { padding: 4px 9px; font-size: 13px; }
  .btn.round { width: 34px; height: 34px; }
  .quick-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
  .quick-chips button { flex-shrink: 0; }
  #view-scholars .toolbar { flex-wrap: nowrap; }
  .scholars .chain-box { max-height: 34%; overflow: auto; }
  .story { max-height: 42%; }
  .cap-body small { font-size: 12px; }
}

/* ---------- al-ʿIbar: the two chart colours were run through the palette validator against --card, in both themes ---------- */
:root { --ib-1: #008a7a; --ib-2: #a5761f; }
:root[data-theme="dark"] { --ib-1: #22a593; --ib-2: #b5872c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ib-1: #22a593; --ib-2: #b5872c; } }
.ibar-view { flex: 1; overflow-y: auto; }
.ib-page { max-width: 1120px; margin: 0 auto; padding: 20px clamp(16px, 4vw, 32px) 60px; display: flex; flex-direction: column; gap: 14px; }
.ib-head h2 { font-family: var(--f-title); font-weight: 700; font-size: 28px; line-height: 1.4; margin: 0; }
.ib-head .ib-line { font-family: var(--f-title); font-size: 18px; color: var(--gold); margin: 0 0 6px; }
.ib-head p { font-family: var(--f-text); font-size: 17px; line-height: 1.7; color: var(--ink-2); margin: 0; max-width: 80ch; }
.ib-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 10px; }
.ib-card { text-align: start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; display: flex; flex-direction: column; gap: 5px; }
.ib-card:hover { border-color: var(--gold); }
.ib-card.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ib-card h3 { margin: 0; font-family: var(--f-title); font-size: 19px; font-weight: 700; line-height: 1.35; }
.ib-card p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.ib-vs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 2px; }
.ib-verdict { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 9px; border: 1px solid currentColor; width: fit-content; }
.ib-verdict::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.v-holds { color: var(--accent); } .v-weak, .v-open { color: var(--gold); } .v-failed { color: var(--red); } .v-tool { color: var(--ink-2); }
.ib-panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; scroll-margin-top: 10px; }
.ib-phead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 14px; }
.ib-phead h3 { margin: 0; font-family: var(--f-title); font-size: 25px; font-weight: 700; line-height: 1.35; }
.ib-pmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ib-say { font-family: var(--f-text); font-size: 17px; line-height: 1.7; color: var(--ink-2); margin: 6px 0 10px; max-width: 80ch; }
.ib-controls { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 8px 0 10px; }
.ib-controls select, .ib-controls input[type="text"] { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 5px 9px; max-width: 100%; min-width: min(230px, 100%); }
.ib-controls input[type="range"] { accent-color: var(--ib-1); width: min(300px, 100%); vertical-align: middle; }
.ib-hero { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 6px 0 10px; }
.ib-stat { flex: 1 1 170px; max-width: 280px; }
.ib-stat b { font-family: var(--f-brand); font-weight: 600; font-size: 30px; display: block; line-height: 1.25; }
.ib-stat span { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; display: block; }
.ib-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; margin-bottom: 8px; }
.ib-fig { min-width: 0; }
.ib-fig h4 { margin: 8px 0 2px; font-size: 14px; font-weight: 600; font-family: var(--f-label); }
.ib-sub { font-size: 12.5px; color: var(--meta); margin-bottom: 2px; }
.ib-page svg { display: block; width: 100%; height: auto; }
.ib-page svg text { font-family: var(--f-ui); fill: var(--ink-2); font-size: 12px; }
.ib-page svg text.ib-small { font-size: 11px; }
.ib-page svg text.ib-tiny { font-size: 10px; fill: var(--meta); }
.ib-page svg text.ib-chance { font-size: 11.5px; fill: var(--red); paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; }
.ib-grid { stroke: var(--line-2); stroke-width: 1; }
.ib-axis { stroke: var(--line); stroke-width: 1; }
.ib-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); margin: 3px 0; }
.ib-legend i { display: inline-block; width: 10px; height: 10px; margin-inline-end: 5px; vertical-align: -1px; }
.ib-map svg { overflow: hidden; border-radius: 8px; }
.ib-sea { fill: var(--sea); }
.ib-ground { fill: var(--land); stroke: var(--land-edge); stroke-width: .6; }
.ib-land { stroke: var(--card); stroke-width: 1; }
.ib-land.hi { stroke: var(--ink); stroke-width: 2.5; }
.ib-ring { fill: none; stroke: var(--ink-3); stroke-width: .7; stroke-dasharray: 2 4; pointer-events: none; }
.ib-dot { stroke-width: 1.5; }
.ib-dot.hi { stroke: var(--ink) !important; stroke-width: 3; }
.ib-page svg text.ib-star { font-size: 18px; fill: var(--ink); pointer-events: none; }
.ib-page svg text.ib-capital { font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--land); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.ib-pick { font-size: 14.5px; line-height: 1.7; margin-top: 8px; background: var(--paper); border-radius: 10px; padding: 9px 12px; border: 1px solid var(--line-2); }
.ib-door { color: var(--accent); cursor: pointer; }
.ib-door:hover { text-decoration: underline; }
.ib-chain { display: flex; flex-wrap: wrap; gap: 3px 6px; align-items: center; margin: 3px 0; font-family: var(--f-text); font-size: 16px; }
.ib-sep { color: var(--meta); }
.ib-weak { border-bottom: 1px dotted var(--ink-3); }
.ib-door.ib-meet { font-weight: 700; color: var(--gold); }
.ib-more { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 8px; }
.ib-more ul { margin: 6px 0; padding-inline-start: 20px; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.ib-scroll { overflow-x: auto; }
.ib-table { border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.ib-table th, .ib-table td { border-bottom: 1px solid var(--line-2); padding: 3px 9px; text-align: start; font-weight: 400; }
.ib-table th { color: var(--meta); }
.ib-heat-t th, .ib-heat-t td { padding: 3px 6px; text-align: center; border: 1px solid var(--card); white-space: nowrap; }
.ib-heat-t tr th:first-child { text-align: start; color: var(--ink-2); }
.ib-none { color: var(--meta); }
.ib-fails { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 7px; }
.ib-fails li { border-inline-start: 3px solid var(--line); padding-inline-start: 10px; font-family: var(--f-text); font-size: 16.5px; line-height: 1.5; }
.ib-fails small { display: block; font-family: var(--f-ui); font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.ib-foot { font-size: 13px; color: var(--meta); margin: 0; }
@media (max-width: 760px) {
  #sch-meet { display: none; }
  /* the questions become a strip, so that the open one is not eight cards away */
  .ib-cards { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(220px, 72%); overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
  .ib-card { scroll-snap-align: start; }
  .ib-panel { padding: 12px; }
  .ib-stat b { font-size: 25px; }
}

/* first-time guidance sits clear of the controls it explains */
.hint-card { top: auto; bottom: 14px; animation-name: hintin; }
@keyframes hintin { from { opacity: 0; } }
body[data-view="chronicle"] .hint-card { bottom: 62px; }
body[data-view="atlas"] .hint-card { top: 10px; bottom: auto; }
body[data-view="scholars"] .hint-card, body[data-view="lineage"] .hint-card { left: auto; transform: none; inset-inline-start: 14px; }
@media (max-width: 760px) { body[data-view="atlas"] .hint-card { top: auto; bottom: 190px; } }

/* the chips of the chains chart fade where more lie beyond */
#sch-start { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 44px), transparent); }
:root[dir="rtl"] #sch-start { -webkit-mask-image: linear-gradient(to right, transparent, #000 44px); mask-image: linear-gradient(to right, transparent, #000 44px); }
#sch-start.at-end { -webkit-mask-image: none; mask-image: none; }

/* a place through time */
.holders { position: relative; height: 20px; border-radius: 5px; background: var(--paper-2); overflow: hidden; border: 1px solid var(--line-2); }
.holders i { position: absolute; top: 0; bottom: 0; cursor: pointer; box-shadow: inset -1px 0 0 rgba(255,255,255,.45); }
.holders i:hover { filter: brightness(1.18); }
.holders-axis { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--meta); margin: 2px 0 6px; }
.prow .dot.sq { width: 14px; height: 14px; border-radius: 4px; margin-inline: 6px; }
.place-tag { cursor: pointer; }
.place-tag:hover { color: var(--accent); }
.p-empty { font-family: var(--f-text); color: var(--meta); font-size: 17px; line-height: 1.7; margin: 14px 0 0; }

/* who sat on the throne */
.reign-strip { position: relative; height: 16px; border-radius: 4px; overflow: hidden; background: var(--paper-2); margin-bottom: 6px; }
.reign-strip i { position: absolute; top: 0; bottom: 0; }
.reign-strip i.alt { opacity: .6; }
.reign-strip i[data-kind] { cursor: pointer; }
.reign-strip i:hover { filter: brightness(1.2); }
.reigns { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.reign { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; padding: 3px 6px; border-radius: 6px; align-items: baseline; }
.reign.can-open { cursor: pointer; }
.reign.can-open:hover { background: var(--paper-2); }
.reign b { font-weight: 500; font-size: 14.5px; }
.reign.can-open b { color: var(--accent); }
.reign small { color: var(--meta); font-size: 12.5px; white-space: nowrap; }
.reign small.note { grid-column: 1 / -1; white-space: normal; color: var(--ink-2); line-height: 1.5; }
.reign-house { font-family: var(--f-label); font-weight: 600; font-size: 13.5px; color: var(--ink-2); margin-top: 8px; padding-inline: 6px; border-bottom: 1px solid var(--line-2); }
.reign-gap { font-size: 12.5px; color: var(--meta); padding: 2px 6px; border-inline-start: 2px dotted var(--line); margin: 2px 6px; }

/* the arena: weigh it yourself */
.arena-sub { font-family: var(--f-title); font-weight: 700; font-size: 22px; margin: 14px 0 0; }
.weigh { border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(170deg, var(--card), var(--paper-2)); padding: 16px clamp(14px, 3vw, 24px) 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.w-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; font-size: 13.5px; color: var(--meta); }
.w-top b { font-family: var(--f-label); font-weight: 600; color: var(--accent); font-size: 14.5px; }
.w-ctx { font-size: 14px; color: var(--meta); }
.w-ctx [data-kind] { color: var(--accent); cursor: pointer; font-weight: 500; }
.w-ctx [data-kind]:hover { text-decoration: underline; }
.w-q { font-family: var(--f-title); font-weight: 700; font-size: clamp(21px, 2.6vw, 28px); line-height: 1.45; margin: 0; text-wrap: balance; }
.w-ask { font-family: var(--f-text); font-size: 16px; color: var(--ink-2); margin: 0; }
.w-views { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.w-view { position: relative; display: flex; flex-direction: column; gap: 5px; text-align: start; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); padding: 11px 13px; cursor: pointer; font: inherit; line-height: 1.6; transition: border-color .15s, background .15s, transform .15s; }
.w-view:not(:disabled):hover { border-color: var(--gold); transform: translateY(-1px); }
.w-view:disabled { cursor: default; opacity: .72; }
.w-view .v { font-size: 15.5px; }
.w-view .by { font-size: 13px; color: var(--meta); }
.w-view.picked { opacity: 1; border-color: var(--ink-2); }
.w-view.won { opacity: 1; border-color: var(--gold); background: color-mix(in srgb, var(--gold) 13%, var(--paper)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 30%, transparent); }
.w-mark { align-self: flex-start; font-family: var(--f-label); font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 0 9px; line-height: 1.7; background: var(--gold); color: #fff; }
.w-mark.you { background: var(--ink-2); color: var(--paper); }
.w-marks { display: flex; gap: 4px; flex-wrap: wrap; }
.w-result { border-radius: 12px; padding: 11px 14px; background: color-mix(in srgb, var(--accent) 10%, transparent); font-size: 15.5px; line-height: 1.7; animation: hintin .3s ease-out; }
.w-result h4 { font-family: var(--f-label); font-weight: 600; font-size: 15px; margin: 0 0 3px; color: var(--accent); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.w-result .conf { margin-inline-start: 0; }
.w-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.w-nav > div { display: flex; gap: 8px; }

/* the dynasties chart: what can be named stands forward, the rest waits */
.st-block rect.st-quiet { fill-opacity: .4; stroke: none; }
.st-block rect.st-fold { fill: color-mix(in srgb, var(--ink-3) 26%, var(--paper-2)); stroke: none; cursor: zoom-in; }
.st-block text.st-more { font-family: var(--f-label); font-weight: 600; font-size: 12px; fill: var(--ink-2); pointer-events: none; }
.holders-axis { position: relative; height: 18px; display: block; }
.holders-axis span { position: absolute; top: 0; white-space: nowrap; }

/* lineage: the golden line, the stretches it runs through, the lands */
.lin-bands rect { fill: var(--paper-2); opacity: .55; }
.lin-bands rect.alt { fill: transparent; }
.lin-band-name { font-family: var(--f-title); font-size: calc(17px * var(--ts)); fill: var(--meta); }
.lin-link.spine { stroke: var(--gold); stroke-width: 3; opacity: .85; }
.lin-link.spine.uncertain { stroke-dasharray: 7 6; opacity: .7; }
.lin-node.bead text { font-size: calc(13px * var(--ts)); fill: var(--ink-2); }
.lin-node.bead.on-spine text { fill: var(--ink); }
.lin-node.prophet circle { stroke: var(--card); stroke-width: 3; }
.lin-node:hover circle { stroke: var(--gold); }
/* a prophet's frame, after the heading of a surah */
:root { --on-gold: #fff8e8; }
:root[data-theme="dark"] { --on-gold: #1a1408; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --on-gold: #1a1408; } }
.lin-frame { fill: var(--card); stroke: var(--gold); stroke-width: 1.4; }
.lin-frame-in { fill: color-mix(in srgb, var(--gold) 12%, var(--card)); stroke: var(--gold-2); stroke-width: .9; pointer-events: none; }
.lin-tip { fill: var(--gold); stroke: none; pointer-events: none; }
.lin-node.prophet text { stroke: none; pointer-events: none; }
.lin-node.prophet .lin-name { font-family: var(--f-title); font-weight: 700; fill: var(--ink); }
.lin-node.prophet .lin-hon { font-weight: 400; fill: var(--ink-2); }
.lin-node.prophet .lin-count { font-family: var(--f-label); font-weight: 500; fill: var(--accent); }
.lin-node.r2 .lin-frame { stroke-width: 2.2; }
.lin-node.r3 .lin-frame { fill: var(--gold); stroke-width: 2.2; }
.lin-node.r3 .lin-frame-in { fill: none; stroke: var(--on-gold); }
.lin-node.r3 .lin-name, .lin-node.r3 .lin-hon, .lin-node.r3 .lin-count { fill: var(--on-gold); }
.lin-node.prophet:hover .lin-frame { stroke: var(--gold-2); stroke-width: 3; }
.lin-node.prophet.onpath .lin-frame { stroke-width: 3.4; }
.lin-lands { position: absolute; bottom: 12px; inset-inline-end: 12px; width: min(340px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); overflow: hidden; z-index: 3; zoom: var(--ts); }
.lin-lands-head { all: unset; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 6px 12px; cursor: pointer; font-family: var(--f-label); font-size: 14.5px; }
.lin-lands-head b { font-weight: 600; }
.lin-lands .minimap { height: 210px; margin: 0; border-radius: 0; border-inline: 0; }
.lin-lands-key { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); margin: 0; padding: 5px 12px 7px; }
.lin-lands-key i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1.6px solid var(--red); }
.lin-lands-key i.firm { background: var(--red); }
.mm-outline { fill: var(--red); fill-opacity: 0.08; stroke: var(--red); stroke-width: 2; stroke-linejoin: round; }
.mm-mark circle { fill: #fff; stroke: var(--red); stroke-width: 1.8; }
.mm-mark.firm circle { fill: var(--red); stroke: #fff; stroke-width: 1.3; }
.mm-mark.on circle { stroke-width: 2.4; }
.lands { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.land b { font-weight: 600; font-size: 15px; margin-inline-end: 8px; }
.land p { margin: 3px 0 0; font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.land-basis { font-size: 12.5px; color: var(--meta); }
.land-basis.firm { color: var(--accent); font-weight: 600; }
.jr-month { border-color: var(--gold) !important; }

/* the moment shared with the map, named on the timeline's axis */
.cursor-mark rect { fill: var(--red); }
.cursor-mark text { fill: #fff; font-size: 13px; font-weight: 600; }

/* phones held sideways: search across the screen, the story's buttons in reach */
@media (hover: none) and (max-height: 500px) {
  #search-results { position: fixed; top: calc(var(--top-h) + 4px); inset-inline: 8px; width: auto; max-height: calc(100% - var(--top-h) - 16px); }
  .top .sr-item { min-height: 44px; align-items: center; }
  .story .story-nav { position: sticky; bottom: -12px; background: var(--card); padding-block: 4px; }
  .map-styles { top: 12px; bottom: auto; inset-inline-end: 8px; flex-direction: row; }
  .map-styles button { font-size: 0; gap: 0; }
  .map-styles button span { width: 34px; height: 26px; }
  .map-zoom { bottom: auto; top: 60px; inset-inline-end: 8px; }
  .map-zoom button { width: 32px; height: 30px; }
  /* the timeline there is the eras, the three tracks and the dates: the lives have no room and are not shown, and without this the dates lay off the screen */
  .chron-overview, .chron-lives { display: none; }
  .chron-axis { margin-top: auto; }
}

/* ---------- the phone frame: a slim bar with a switcher of views, search behind its icon, the small buttons behind «العرض», and the drawer as a sheet ---------- */
.view-switch, .view-menu, .phone-only, .sheet-grip { display: none; }
.ev-hit { fill: transparent; }
@media (max-width: 760px), (hover: none) and (max-height: 500px) {
  :root { --top-h: 52px; }
  .top { flex-wrap: nowrap; height: var(--top-h); min-height: 0; padding: 6px 10px; gap: 8px; }
  .brand-text { display: none; }
  .tabs { display: none; }
  .view-switch { display: block; flex: 1; min-width: 0; text-align: start; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: 600 15px/1.3 var(--f-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .view-menu:not([hidden]) { display: grid; position: fixed; top: calc(var(--top-h) + 4px); inset-inline: 8px; z-index: 45; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; gap: 2px; max-height: calc(100% - var(--top-h) - 16px); overflow: auto; }
  .view-menu > b { font: 600 12.5px var(--f-ui); color: var(--meta); padding: 4px 10px; }
  .view-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: start; border: 0; background: none; color: var(--ink); border-radius: 10px; padding: 9px 10px; font: inherit; min-height: 44px; cursor: pointer; }
  .view-menu button span { font-weight: 600; font-size: 15.5px; }
  .view-menu button small { font-size: 12.5px; color: var(--meta); line-height: 1.5; }
  .view-menu button.on { background: var(--paper-3); }
  .phone-only { display: inline-grid; place-items: center; }
  #display-btn { padding: 0 12px; width: auto; font-size: 14px; }
  .tools { gap: 6px; position: static; }
  .tools > .chip-btn:not(.phone-only) { display: none; }
  body.tools-open .tools > .chip-btn:not(.phone-only) { display: inline-grid; }
  body.tools-open .tools { position: fixed; top: calc(var(--top-h) + 4px); inset-inline-end: 8px; z-index: 45; flex-wrap: wrap; justify-content: flex-end; max-width: 230px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; }
  body.tools-open .tools > .phone-only, body.tools-open .tools > .search { display: none; }
  .search { display: none; }
  body.search-on .search { display: block; position: fixed; top: 6px; inset-inline: 8px; z-index: 46; }
  body.search-on .search input { width: 100%; height: 40px; }
  body.search-on .top { z-index: 46; }
  /* 8: in «العرض» each small button says what it does, from its own title, since a finger never sees a tooltip */
  body.tools-open .tools { flex-direction: column; align-items: stretch; max-width: 250px; gap: 2px; }
  body.tools-open .tools > .chip-btn:not(.phone-only) { display: flex; align-items: center; gap: 10px; justify-content: flex-start; width: 100%; height: 42px; border: 0; border-radius: 10px; padding: 0 10px; }
  body.tools-open .tools > .chip-btn:not(.phone-only)::after { content: attr(title); font-weight: 400; font-size: 14.5px; color: var(--ink-2); }
  /* 9: room for a finger */
  .top .phone-only { height: 38px; min-width: 38px; }
}
@media (max-width: 760px) {
  .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .toolbar > * { flex-shrink: 0; }
  /* 4: a view's sentence of explanation on a row of its own, above its buttons, never cut off */
  .toolbar:has(> .lede) { flex-wrap: wrap; overflow-x: visible; }
  .toolbar > .lede { flex: 1 1 100%; white-space: normal; font-size: 13.5px; line-height: 1.55; margin: 0; }
  /* 7: a life's or a journey's card clears its close button */
  .story:not(.tour) .story-era { margin-inline-start: 34px; }
  /* 9: room for a finger */
  .panel-actions .link-btn { min-height: 38px; padding-inline: 10px; }
  .tour-beats button { width: 32px; height: 32px; font-size: 13px; line-height: 32px; }
  .tour-moments button { min-height: 32px; }
  /* the drawer as a sheet: at a peek when it opens, at full height when pulled up, closed when pulled down */
  .sheet-grip { display: flex; flex: 0 0 30px; justify-content: center; align-items: center; margin: 0 0 -8px; cursor: grab; touch-action: none; }
  .sheet-grip i { width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
  .panel { transition: top .2s ease-out, height .2s ease-out; }
  body:not(.sheet-full):not(.cause-peek) .panel { height: 46%; }
  body.sheet-full .panel { top: calc(var(--top-h) + 6px) !important; height: auto; }
}

/* ---------- the annals: the years read down the page ---------- */
.annals { flex: 1; overflow-y: auto; }
.an-page { max-width: 740px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-left, 0px)) 80px; font-family: var(--f-text); }
.an-page h2 { font-family: var(--f-title); font-size: 30px; margin: 4px 0 6px; }
.an-lede { color: var(--ink-2); font-size: 17.5px; line-height: 1.8; margin: 0 0 18px; }
.an-era { position: sticky; top: 0; z-index: 2; background: var(--paper); border-bottom: 3px solid var(--c); padding: 8px 0 6px; margin: 22px 0 6px; }
.an-era button { border: 0; background: var(--c); color: #fff; font: 600 14px/1.6 var(--f-ui); border-radius: 999px; padding: 2px 12px; cursor: pointer; }
.an-overture { margin: 0 0 8px; color: var(--ink-2); font-size: 16.5px; line-height: 1.7; }
.an-year { padding: 12px 0 14px; border-bottom: 1px dashed var(--line-2); }
.an-year h3 { margin: 0 0 2px; font: 700 23px/1.5 var(--f-title); }
.an-year h3 button { border: 0; background: none; padding: 0; font: inherit; color: var(--ink); cursor: pointer; }
.an-year h3 button:hover, .an-year h3 button:focus-visible { color: var(--accent); }
.an-year h3 small { font: 400 13.5px/1 var(--f-ui); color: var(--meta); margin-inline-start: 6px; }
.an-ev { margin: 3px 0; font-size: 18px; line-height: 1.9; cursor: pointer; border-radius: 6px; }
.an-ev:hover { background: var(--paper-2); }
.an-ev b { font-weight: 700; }
.an-died { margin: 6px 0 0; font-size: 17px; line-height: 1.9; color: var(--ink-2); }
.an-died span { font-family: var(--f-ui); font-weight: 600; font-size: 13.5px; color: var(--meta); }
.an-died button { border: 0; background: none; padding: 0; font: inherit; color: var(--ink); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.an-died small { color: var(--meta); font-size: 13px; }
.an-gap { margin: 6px 0; font-size: 13.5px; color: var(--meta); font-family: var(--f-ui); }

/* ---------- the menu: the home page, and one menu for each group of views ---------- */
.tabs { overflow: visible; align-items: center; gap: 4px; }
.tabs > button[data-view], .tabs .tab-group-btn { border: 0; background: none; padding: 8px 14px; border-radius: 9px; white-space: nowrap; font: 500 15.5px/1.4 var(--f-label); color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.tabs > button[data-view]:hover, .tabs .tab-group-btn:hover, .tabs .tab-group.open .tab-group-btn { background: var(--paper-3); }
.tabs > button[data-view].on, .tabs .tab-group.on .tab-group-btn { background: var(--ink); color: var(--paper); }
.tab-group { position: relative; }
.tab-caret { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .75; flex-shrink: 0; }
.tab-now { font-weight: 600; }
.tab-now:not(:empty)::before { content: "· "; font-weight: 400; opacity: .7; }
.tab-menu { display: none; position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 45; min-width: 290px; padding: 6px; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
/* the gap between a group's button and its menu still belongs to the group, so the pointer can cross it */
.tab-menu::before { content: ""; position: absolute; inset: -8px 0 auto 0; height: 8px; }
.tab-group.open .tab-menu { display: grid; }
@media (hover: hover) { .tab-group:hover:not(.shut) .tab-menu { display: grid; } }
.tabs .tab-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: start; border: 0; background: none; color: var(--ink); border-radius: 9px; padding: 8px 11px; white-space: nowrap; cursor: pointer; }
.tabs .tab-menu button span { font: 600 15px/1.45 var(--f-label); }
.tabs .tab-menu button small { font: 400 12.5px/1.5 var(--f-ui); color: var(--meta); }
.tabs .tab-menu button:hover, .tabs .tab-menu button:focus-visible { background: var(--paper-3); }
.tabs .tab-menu button.on { background: var(--paper-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--gold); }
.top:has(.tab-group.open), .top:has(.tab-group:hover) { z-index: 40; }
@media (min-width: 1241px) { .search input { width: 240px; } }

/* ---------- the home page ---------- */
.home { flex: 1; overflow-y: auto; }
.home-page { zoom: var(--ts); max-width: 1180px; margin: 0 auto; padding-block: 22px 56px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 30px; }
.home-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.home-head { padding: 34px 36px; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.home-head h1 { font-family: var(--f-brand); font-size: 46px; line-height: 1.3; margin: 0; }
.home-tag { color: var(--gold); font-weight: 600; font-size: 16px; margin: 0; }
.home-lede { font-family: var(--f-text); font-size: 19px; line-height: 1.85; margin: 8px 0 0; color: var(--ink-2); max-width: 34em; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }
.btn.home-begin { font-size: 17px; font-weight: 600; padding: 10px 24px; }
.btn.home-begin svg { width: 19px; height: 19px; }
.home-search { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--meta); border-radius: 999px; padding: 10px 18px; font-size: 15px; min-width: 250px; cursor: text; }
.home-search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; flex-shrink: 0; }
.home-search:hover, .home-search:focus-visible { border-color: var(--gold); color: var(--ink-2); }
.home-pic { min-height: 300px; background-size: cover; background-position: center; }
.home-sec h2 { font-family: var(--f-title); font-weight: 700; font-size: 27px; line-height: 1.4; margin: 0 0 2px; }
.home-sub { font-family: var(--f-text); font-size: 17.5px; line-height: 1.7; color: var(--ink-2); margin: 0 0 12px; }
.home-sec .jr-grid { margin-top: 10px; }
/* the eleven chapters, each with its era's picture and colour, then the way in */
.home-chapters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.home-ch { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.home-ch:hover, .home-ch:focus-visible { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent); }
.home-ch-img { display: block; height: 92px; background-size: cover; background-position: center; position: relative; border-bottom: 3px solid var(--c); }
.home-ch-img i { position: absolute; inset-block-start: 8px; inset-inline-start: 8px; min-width: 26px; height: 26px; padding: 0 4px; box-sizing: border-box; border-radius: 13px; display: grid; place-items: center; font: 700 14px/1 var(--f-ui); font-style: normal; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.home-ch b { font-family: var(--f-title); font-size: 16.5px; line-height: 1.45; padding: 7px 10px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.home-ch small { font-size: 12.5px; color: var(--meta); padding: 2px 10px 9px; margin-top: auto; }
.home-ch.home-ch-go { --c: var(--accent); background: var(--accent); border-color: var(--accent); color: #fff; align-items: center; justify-content: center; gap: 8px; text-align: center; min-height: 120px; font: 600 17px/1.5 var(--f-ui); }
.home-ch-go svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; }
/* today's event and the place the reader left */
.home-now { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.home-card { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-inline-start: 4px solid var(--gold); border-radius: 14px; background: var(--card); }
.home-card small { font-size: 13px; color: var(--meta); }
.home-card b { font-family: var(--f-title); font-size: 21px; line-height: 1.5; }
.home-card em { font-style: normal; font-size: 13.5px; color: var(--accent); }
.home-card:hover, .home-card:focus-visible, .home-door:hover, .home-door:focus-visible { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(165, 118, 31, .18); }
/* every view by name, in the menu's three groups */
.home-doors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; margin-top: 10px; }
.home-group { display: flex; flex-direction: column; gap: 8px; }
.home-group h3 { font: 600 13.5px/1.5 var(--f-ui); color: var(--meta); margin: 0 4px; }
.home-door { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 1px; padding: 11px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.home-door b { font: 600 16.5px/1.45 var(--f-label); }
.home-door small { font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
@media (min-width: 761px) and (max-width: 1100px) { .home-chapters { grid-template-columns: repeat(4, minmax(0, 1fr)); } .home-head h1 { font-size: 38px; } .home-head { padding: 26px 26px; } }
@media (max-width: 760px) {
  .home-page { padding-block: 12px 36px; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); gap: 24px; }
  .home-hero { grid-template-columns: minmax(0, 1fr); }
  .home-pic { min-height: 150px; order: -1; }
  .home-head { padding: 16px 18px 20px; }
  .home-head h1 { font-size: 34px; }
  .home-lede { font-size: 17px; }
  .home-actions { margin-top: 12px; }
  .home-search { min-width: 0; flex: 1 1 200px; }
  .home-sec h2 { font-size: 23px; }
  /* the chapters as a strip to swipe along */
  .home-chapters { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 148px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; margin-inline: -14px; padding-inline: 14px; padding-bottom: 4px; }
  .home-ch { scroll-snap-align: start; }
  .home-doors { grid-template-columns: minmax(0, 1fr); }
  .home-now { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- the phone's bottom bar: the home page, the map, the annals, and every other view behind «المزيد» ---------- */
.bottom-nav { display: none; }
@media (max-width: 760px) and (min-height: 501px) {
  :root { --nav-h: calc(56px + env(safe-area-inset-bottom, 0px)); }
  main { height: calc(100% - var(--top-h) - var(--nav-h)); }
  /* a journey's card has its own way on and its own ×: the bar steps aside and the map takes its room */
  body.story-open .bottom-nav { display: none; }
  body.story-open main { height: calc(100% - var(--top-h)); }
  #search-results { max-height: calc(100% - var(--top-h) - var(--nav-h) - 16px); }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; inset: auto 0 0 0; height: var(--nav-h); padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box; background: var(--card); border-top: 1px solid var(--line); z-index: 19; }
  .bottom-nav button { border: 0; background: none; color: var(--meta); display: grid; justify-items: center; align-content: center; gap: 2px; font: 500 12px/1.3 var(--f-ui); min-height: 44px; padding: 0; }
  .bottom-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .bottom-nav button.on { color: var(--accent); font-weight: 600; }
  .view-menu:not([hidden]) { max-height: calc(100% - var(--top-h) - var(--nav-h) - 12px); }
  .toast { bottom: calc(var(--nav-h) + 14px); }
}

/* ---------- small repairs ---------- */
/* the tour's card in the journeys chooser shows its eleven colours */
.jr-img.jr-eras { display: flex; }
/* a view's first-time note sits in a corner, clear of the middle of the page; on the map it stays at the top */
.hint-card { left: auto; transform: none; inset-inline-end: 14px; max-width: min(380px, calc(100% - 28px)); font-size: 13.5px; }
body[data-view="atlas"] .hint-card { inset-inline: auto; left: 50%; right: auto; transform: translateX(-50%); max-width: min(540px, calc(100% - 24px)); }
body[data-view="scholars"] .hint-card, body[data-view="lineage"] .hint-card { inset-inline-end: auto; }
@media (max-width: 760px) {
  .hint-card { inset-inline: 12px; max-width: none; width: auto; }
  body[data-view="atlas"] .hint-card { left: 12px; transform: none; inset-inline: 12px; max-width: none; }
  /* above the chain's card, which opens at the foot of the page */
  body[data-view="scholars"] .hint-card { top: 62px; bottom: auto; inset-inline: 12px; }
}
/* the place the drawer is open on */
.place-sel { pointer-events: none; }
.place-sel .ring { fill: none; stroke: var(--red); stroke-width: 2.6px; }
.place-sel .dot { fill: var(--red); stroke: #fff; stroke-width: 1.2px; vector-effect: non-scaling-stroke; }
.toast .toast-back { font-size: 14px; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
/* a note with a way back keeps its words on full lines, and on a phone puts the way back under them */
.toast { width: max-content; }
@media (max-width: 760px) { .toast:has(.toast-back) { flex-direction: column; align-items: flex-start; gap: 4px; } }
/* the way into the story reads on its green in either theme */
.btn.primary.home-begin, .home-ch.home-ch-go { color: var(--card); }

/* ---------- what the reviewers of r26 found ---------- */
/* a journey's card on a phone stands on the map's controls, however many rows they take (js: --ctl-h) */
@media (max-width: 760px) { .story { bottom: calc(var(--ctl-h, 108px) + 6px); } }
/* on a short phone the year box is one line while a journey's card is open, so that the map keeps a band between them */
@media (max-width: 760px) and (max-height: 700px) {
  body.story-open .atlas-year { flex-direction: row; align-items: baseline; gap: 8px; padding: 6px 12px; min-width: 0; }
  body.story-open .atlas-year .e, body.story-open .atlas-year .y-tide { display: none; }
}
/* while the list of views or «العرض» is open: a veil over the page takes the tap that closes it, and the bar holding the list stands above the drawer */
.menu-backdrop { position: fixed; inset: 0; z-index: 44; background: rgba(30, 22, 12, .16); }
/* (search results left unhidden give the bar a lower place by a stronger rule, so this one insists) */
body.menu-open .top { z-index: 46 !important; }
/* the wall chart is printed from a wide screen: on a phone its button made the Dynasties toolbar wider than the page */
@media (max-width: 760px) { #poster-open { display: none; } }
/* the menu gives way before the header overflows: the open view's name is cut short first */
.tabs { min-width: 0; }
.tab-group { min-width: 0; }
.tabs > button[data-view] { flex-shrink: 0; }
.tabs .tab-group-btn { max-width: 100%; }
.tab-group-btn > span { flex-shrink: 0; }
.tab-now { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* between a phone and a wide screen the six small buttons go behind «العرض», as on a phone, and search keeps its field */
@media (min-width: 761px) and (max-width: 1040px) {
  .brand-text { display: none; }
  #display-btn { display: inline-grid; place-items: center; padding: 0 12px; width: auto; height: 34px; font-size: 14px; }
  .tools { gap: 6px; position: static; }
  .search { min-width: 80px; }
  .tools > .chip-btn:not(.phone-only) { display: none; }
  body.tools-open .tools > .chip-btn:not(.phone-only) { display: flex; align-items: center; gap: 10px; justify-content: flex-start; width: 100%; height: 42px; border: 0; border-radius: 10px; padding: 0 10px; }
  body.tools-open .tools > .chip-btn:not(.phone-only)::after { content: attr(title); font-weight: 400; font-size: 14.5px; color: var(--ink-2); }
  body.tools-open .tools { position: fixed; top: calc(var(--top-h) + 4px); inset-inline-end: 8px; z-index: 45; flex-direction: column; align-items: stretch; width: 250px; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; }
  body.tools-open .tools > .phone-only, body.tools-open .tools > .search { display: none; }
}
/* the home page on a phone */
@media (max-width: 760px) {
  /* the first chapter keeps the page's gutter, as the rest of the page does */
  .home-chapters { scroll-padding-inline: 14px; }
  /* a shorter picture, so that the place the reader left is in sight on a small phone */
  .home-pic { min-height: 110px; }
  .toast .toast-back { min-height: 36px; display: inline-flex; align-items: center; }
  body[data-view="lineage"] .hint-card { inset-inline: 12px; }
}
/* a journey's card is never wider than the page, at any text size */
.jr-grid { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
/* the note that the map moved stands above the map's controls on a wide screen */
@media (min-width: 761px) { .toast:has(.toast-back) { bottom: calc(var(--ctl-h, 76px) + 14px); } }
/* between a phone and a wide screen the last group's menu opens toward the middle of the page, not off its edge */
@media (min-width: 761px) and (max-width: 1040px) { .tab-group:last-child .tab-menu { inset-inline-start: auto; inset-inline-end: 0; } }
/* «؟» has nothing to say on the home page */
body[data-view="home"] #help-btn { display: none; }
/* the two rows of chapters are of one height */
@media (min-width: 761px) { .home-chapters { grid-auto-rows: 1fr; } }
/* on a small phone the home page's picture gives way, so that the place the reader left is in sight */
@media (max-width: 760px) and (max-height: 700px) { .home-pic { min-height: 64px; } }
@media (max-width: 760px) and (max-height: 600px) { .home-pic { display: none; } }
/* On a wide screen the header gives way in this order: the search field narrows first, then the open view's name is cut short; the buttons
   are never pushed off the page. */
@media (min-width: 761px) {
  .tabs { flex: 0 1 auto; }
  .tools { flex: 1 1000 auto; min-width: min-content; justify-content: flex-end; }
  .search { flex: 0 1 240px; min-width: 110px; }
  .search input { width: 100%; min-width: 0; }
  body.tools-open .tools { flex: none; min-width: 0; }
}

/* ---------- r28: a design pass ---------- */
/* The page's ground has a soft light in one corner. On the dark theme the same light was a grey haze across the page: the rows of the timeline looked
   lighter than its bars, and the dark halo round every name showed as an outline. It is a faint glow there now, and the halo meets its ground. */
:root[data-theme="dark"] body { background-image: radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, .035), transparent 60%), radial-gradient(ellipse at 100% 100%, rgba(0, 0, 0, .22), transparent 55%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body { background-image: radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, .035), transparent 60%), radial-gradient(ellipse at 100% 100%, rgba(0, 0, 0, .22), transparent 55%); } }
/* The open view in the menu: a tint of gold with a fine edge, not a block of ink. It was the darkest thing on the page and drew the eye from the page itself. */
.tabs > button[data-view].on, .tabs .tab-group.on .tab-group-btn { background: color-mix(in srgb, var(--gold) 15%, var(--card)); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 55%, transparent); font-weight: 600; }
.tabs > button[data-view].on:hover, .tabs .tab-group.on .tab-group-btn:hover { background: color-mix(in srgb, var(--gold) 24%, var(--card)); }
/* names on the timeline: a halo a little finer, so that the letters keep their own weight */
.ev text { stroke-width: 2.6px; }
/* The home page. A card with no companion is a strip across the page, its three parts on one line, not half a row beside an empty half. */
.home-now:has(> .home-card:only-child) { grid-template-columns: minmax(0, 1fr); }
.home-now > .home-card:only-child { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; padding: 12px 20px; }
.home-now > .home-card:only-child b { font-size: 22px; }
/* a chapter's picture takes whatever height its tile has left: a one-line name no longer leaves a blank band under it */
@media (min-width: 761px) { .home-ch-img { flex: 1 0 92px; height: auto; } .home-ch small { margin-top: 0; } }

/* The daily reminder on the home page (js/daily.js): a strip under today's card, its button on the end side */
.home-daily { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-top: 12px; padding: 14px 18px; border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: 14px; background: var(--card); }
.home-daily[hidden] { display: none; }
.home-daily-text { flex: 1 1 320px; display: flex; flex-direction: column; gap: 2px; }
.home-daily-text b { font-family: var(--f-title); font-size: 19px; line-height: 1.5; }
.home-daily-text small { font-size: 14px; color: var(--meta); line-height: 1.7; }
.home-daily-note:not(:empty) { margin-top: 4px; font-size: 14px; color: var(--accent); line-height: 1.7; }
.home-daily-acts { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.home-daily-btn { font: inherit; font-size: 15px; cursor: pointer; padding: 8px 20px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: var(--card); }
.home-daily-btn[data-state="on"] { background: transparent; color: var(--accent); }
.home-daily-btn:disabled { opacity: .6; cursor: progress; }
.home-daily-btn[hidden] { display: none; }
.home-daily-tg { font-size: 13.5px; color: var(--accent); }

/* ---------- the Prophet ﷺ in history (js/witness.js): the page of al-ʿIbar, with a chart of witnesses and their cards; tokens only, so both themes follow ---------- */
.wt-verdict { border-inline-start: 4px solid var(--gold); }
.wt-verdict h3, .wt-page .ib-panel > h3 { margin: 0 0 4px; font-family: var(--f-title); font-size: 23px; font-weight: 700; line-height: 1.35; }
.wt-verdict .ib-say { margin: 4px 0; color: var(--ink); }
.wt-chips .btn.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.wt-chips .wt-only { margin-inline-start: auto; }
.wt-key { width: 11px !important; height: 11px !important; border-radius: 50%; border: 1.5px solid var(--ink-2); background: var(--card); }
.wt-bar { width: 22px !important; height: 5px !important; border-radius: 3px; background: var(--ib-1); opacity: .45; vertical-align: 2px !important; }
.wt-scroll { overflow-x: auto; margin: 6px 0 2px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--paper); }
.wt-page .wt-scroll svg { width: 100%; }
.wt-lane { fill: var(--card); }
.wt-page svg text.wt-lane-name { font-family: var(--f-label); font-size: 12px; font-weight: 600; fill: var(--meta); }
.wt-page svg text.wt-tick { font-size: 12px; font-weight: 600; fill: var(--ink-2); }
.wt-page svg text.wt-label { font-size: 12px; fill: var(--ink); }
.wt-death { stroke: var(--gold); stroke-width: 1.6; }
.wt-hijra { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 4; }
.wt-mark { cursor: pointer; outline: none; }
.wt-dot { stroke-width: 2; }
.wt-mark:hover .wt-dot, .wt-mark:focus-visible .wt-dot { stroke-width: 3.2; }
.wt-mark:focus-visible text.wt-label, .wt-mark:hover text.wt-label { text-decoration: underline; }
.wt-mark.on .wt-dot { stroke: var(--ink); stroke-width: 3; }
.wt-page svg .wt-mark.on text.wt-label { font-weight: 700; }
.wt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.wt-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 13px 16px 10px; display: flex; flex-direction: column; gap: 6px; scroll-margin-top: 12px; outline: none; }
.wt-card.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.wt-card header { display: flex; flex-direction: column; gap: 3px; }
.wt-card h3 { margin: 0; font-family: var(--f-title); font-size: 20px; font-weight: 700; line-height: 1.35; }
.wt-kind { font-size: 12px; font-weight: 600; color: var(--ib-1); }
.wt-kind.k-tradition { color: var(--ib-2); }
.wt-when { font-size: 13.5px; color: var(--ink-2); }
.wt-when b { font-weight: 600; color: var(--ink); }
.wt-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.wt-tags span { font-size: 11.5px; border-radius: 999px; padding: 0 8px; border: 1px solid var(--line); color: var(--ink-2); }
.wt-sure.s-firm { border-color: var(--accent); color: var(--accent); }
.wt-sure.s-debated { border-color: var(--red); color: var(--red); }
.wt-named.yes { border-color: var(--ink-2); color: var(--ink); }
.wt-says { margin: 0; font-family: var(--f-text); font-size: 16.5px; line-height: 1.7; color: var(--ink); }
.wt-quote { margin: 2px 0; padding: 6px 12px; border-inline-start: 3px solid var(--gold); background: var(--paper); border-radius: 0 8px 8px 0; display: flex; flex-direction: column; gap: 3px; font-family: var(--f-text); font-size: 15.5px; line-height: 1.65; color: var(--ink-2); }
:root[dir="rtl"] .wt-quote { border-radius: 8px 0 0 8px; }
.wt-orig { font-size: 14px; color: var(--meta); font-style: italic; }
.wt-quote cite { font-style: normal; font-family: var(--f-ui); font-size: 12px; color: var(--meta); }
.wt-dated, .wt-cannot, .wt-links { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.wt-dated b, .wt-cannot b { color: var(--ink); font-weight: 600; }
.wt-cannot { border-top: 1px dashed var(--line-2); padding-top: 5px; }
.wt-refs { margin: 6px 0; padding-inline-start: 18px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.wt-refs a { color: var(--accent); overflow-wrap: anywhere; }
.wt-via { font-size: 12px; color: var(--meta); }
.wt-copy { align-self: flex-end; font-size: 12.5px; }
.wt-views { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 10px; margin-top: 6px; }
.wt-view { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 13px; background: var(--paper); }
.wt-view h4 { margin: 0 0 4px; font-family: var(--f-label); font-size: 15px; font-weight: 600; color: var(--ink); }
.wt-view p { margin: 0 0 5px; font-size: 14px; line-height: 1.65; color: var(--ink-2); }
.wt-view b { color: var(--ink); font-weight: 600; }
.wt-table td { vertical-align: top; line-height: 1.6; font-size: 14px; }
.wt-table td:first-child { min-width: 190px; color: var(--ink); }
.wt-limits { margin: 4px 0 8px; padding-inline-start: 20px; font-size: 14.5px; line-height: 1.75; color: var(--ink-2); max-width: 85ch; }
@media (max-width: 640px) {
  .wt-chips .wt-only { margin-inline-start: 0; }
  .wt-card { padding: 11px 12px 8px; }
  .wt-table td:first-child { min-width: 140px; }
}
