/* Foundry look: Palantir Blueprint-style light workspace (default) with a matching dark mode (html.dark).
   Loaded after the page's own styles, so these rules win. */
:root {
  --fy-bg: #f6f7f9;        /* app background, section headers */
  --fy-panel: #ffffff;     /* panels and cards */
  --fy-head: #f6f7f9;      /* panel headers, collapsible section bars */
  --fy-line: #e5e8eb;      /* row dividers */
  --fy-border: #d3d8de;    /* card borders */
  --fy-input: #c5cbd3;     /* input borders */
  --fy-text: #1c2127;
  --fy-muted: #5f6b7c;
  --fy-accent: #2d72d2;
  --fy-accent-hover: #215db0;
  --fy-sel: #d3e2f7;       /* selected tab / chip fill */
  --fy-sel-text: #184a90;
  --fy-shadow: 0 0 0 1px rgba(17,20,24,.1), 0 2px 4px rgba(17,20,24,.2), 0 8px 24px rgba(17,20,24,.2);
  --fy-shadow-sm: 0 0 0 1px rgba(17,20,24,.1), 0 1px 1px rgba(17,20,24,.2);
  --fy-r: 4px;
  --f-ui: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-text: "Source Sans 3", "Segoe UI", system-ui, -apple-system, "Noto Naskh Arabic", sans-serif;
  --text: var(--fy-text); --muted: var(--fy-muted); --accent: var(--fy-accent); --link: var(--fy-accent);
  --line: var(--fy-line); --edge: var(--fy-border); --panel: var(--fy-panel); --panel-2: #f6f7f9; --panel-3: #edeff2;
  --bg: #ffffff; --ink: #1c2127; --ring: #2d72d2; --focus: #2d72d2;
  color-scheme: light;
}
html.dark {
  --fy-bg: #1c2127; --fy-panel: #252a31; --fy-head: #2f343c; --fy-line: #383e47; --fy-border: #404854; --fy-input: #5f6b7c;
  --fy-text: #f6f7f9; --fy-muted: #abb3bf; --fy-accent: #4c90f0; --fy-accent-hover: #8abbff; --fy-sel: rgba(76,144,240,.25); --fy-sel-text: #c4dcff;
  --fy-shadow: 0 0 0 1px rgba(17,20,24,.4), 0 2px 4px rgba(17,20,24,.4), 0 8px 24px rgba(17,20,24,.4);
  --fy-shadow-sm: 0 0 0 1px rgba(17,20,24,.4), 0 1px 1px rgba(17,20,24,.4);
  --panel-2: #2f343c; --panel-3: #383e47; --bg: #1c2127; --ink: #111418;
  color-scheme: dark;
}
html, body { background: var(--fy-bg); color: var(--fy-text); font-family: var(--f-text); line-height: 1.5; }
:focus-visible { outline: 2px solid var(--fy-accent); outline-offset: 2px; }

/* ---------- surfaces: flat, white, crisp borders, no glass ---------- */
html .bar, html .panel, html .chat, html #timeline, html .hud, html .status, html .tip, html .modal-box,
html .leaflet-bar, html .leaflet-control-attribution, html .leaflet-control-scale-line {
  background: var(--fy-panel); -webkit-backdrop-filter: none; backdrop-filter: none;
  border: 1px solid var(--fy-border); box-shadow: var(--fy-shadow-sm); color: var(--fy-text);
}
html .panel, html .chat, html .modal-box { border-radius: var(--fy-r); box-shadow: var(--fy-shadow); }
html #timeline, html .tip { border-radius: var(--fy-r); box-shadow: var(--fy-shadow); }
html .hud, html .status { border-radius: var(--fy-r); }
html .bar { border-width: 0 0 1px; border-radius: 0; box-shadow: 0 1px 0 rgba(17,20,24,.06); }
html .modal { background: rgba(17,20,24,.35); -webkit-backdrop-filter: none; backdrop-filter: none; }
#map, html .leaflet-container { background: #e9ebee; }
html.dark #map, html.dark .leaflet-container { background: #14171c; }

/* top bar */
.brand b { font-family: var(--f-ui); font-weight: 700; font-size: 1.18em; letter-spacing: 0; }
.brand small { color: var(--fy-muted); font-size: .74em; }
.bar-actions .btn { display: inline-flex; align-items: center; gap: 7px; }
.bar-actions .btn svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.bar-actions .btn[aria-expanded="true"] { background: var(--fy-sel); color: var(--fy-sel-text); box-shadow: none; border-color: transparent; }
@media (max-width: 560px) { .bar-actions .btn .lbl { display: none; } .bar-actions .btn { padding: 0 11px; } }

/* buttons */
html .btn, html .chips button, html .seg button, html .act {
  border-radius: 3px; background: var(--fy-bg); color: var(--fy-text); border: 1px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(17,20,24,.2), 0 1px 2px rgba(17,20,24,.1); font-family: var(--f-ui); font-weight: 600;
}
html.dark .btn, html.dark .chips button, html.dark .seg button, html.dark .act { background: #2f343c; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 1px 2px rgba(17,20,24,.2); }
html .btn:hover, html .act:hover, html .chips button:hover, html .seg button:hover { background: #edeff2; }
html.dark .btn:hover, html.dark .act:hover, html.dark .chips button:hover, html.dark .seg button:hover { background: #383e47; }
html .btn.primary { background: var(--fy-accent); color: #fff; box-shadow: inset 0 0 0 1px rgba(17,20,24,.2), 0 1px 2px rgba(17,20,24,.1); }
html .btn.primary:hover { background: var(--fy-accent-hover); }
html .btn.ghost { background: transparent; box-shadow: none; }
html .chips button[aria-pressed="true"], html .seg button[aria-pressed="true"] { background: var(--fy-sel); color: var(--fy-sel-text); box-shadow: inset 0 0 0 1px var(--fy-accent); }

/* inputs */
html .ai textarea, html .field input, html .chat-form input, html .msg.req input, html .msg.req textarea, html .fy-form input, html .fy-form textarea, html .fy-form select, html #term-q {
  background: var(--fy-panel); color: var(--fy-text); border: 1px solid var(--fy-input); border-radius: 3px; box-shadow: inset 0 1px 1px rgba(17,20,24,.12); font-family: var(--f-ui);
}
html .ai textarea:focus, html .field input:focus, html .chat-form input:focus, html .fy-form :is(input, textarea, select):focus { border-color: var(--fy-accent); box-shadow: 0 0 0 2px rgba(45,114,210,.3); outline: none; }

/* ---------- panels: header bar, tabs, collapsible section cards ---------- */
html .panel-head { background: var(--fy-panel); border-bottom: 1px solid var(--fy-border); padding: 8px 10px 8px 14px; border-radius: var(--fy-r) var(--fy-r) 0 0; }
.panel-head h2 { font-family: var(--f-ui); font-weight: 600; font-size: 1.05em; }
.panel-body { gap: 12px; padding: 12px; }
.fy-tabs { display: flex; gap: 2px; align-items: center; }
.fy-tabs button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 0; border-radius: 3px; background: none; color: var(--fy-muted); font: 600 .92em var(--f-ui); }
.fy-tabs button svg { width: 16px; height: 16px; fill: currentColor; }
.fy-tabs button[aria-selected="true"] { background: var(--fy-sel); color: var(--fy-sel-text); }
.fy-tabs button:hover { color: var(--fy-text); }

/* section cards like the Foundry style panel: grey header bar, caps label, white body */
#drawer .sec, #drawer details.more { border: 1px solid var(--fy-border); border-radius: var(--fy-r); background: var(--fy-panel); padding: 0; overflow: hidden; }
#drawer .sec h3, #drawer details.more > summary {
  margin: 0; padding: 0 12px; min-height: 40px; display: flex; align-items: center; border: 0; background: var(--fy-head);
  font: 600 .78em var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--fy-text);
}
#drawer .sec > :not(h3), #drawer details.more > :not(summary) { margin: 10px 12px; }
#drawer details.more > summary::after { content: none; }
#drawer details.more > summary::before { content: ''; width: 0; height: 0; border-left: 5px solid var(--fy-muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; margin-right: 10px; transition: transform .12s; }
#drawer details.more[open] > summary::before { transform: rotate(90deg); }
#drawer details.more[open] > summary { border-bottom: 1px solid var(--fy-border); }

/* grouped layer chooser in Foundry dress */
.grp { border-bottom: 1px solid var(--fy-line); padding: 6px 0 8px; }
.grp:last-child { border-bottom: 0; }
.grp-head .box { width: 18px; height: 18px; border-radius: 3px; border: 0; box-shadow: inset 0 0 0 1px rgba(17,20,24,.3); background: var(--fy-panel); color: #fff; font-size: 12px; }
html.dark .grp-head .box { box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); background: #1c2127; }
.grp-head[data-state="all"] .box, .grp-head[data-state="some"] .box { background: var(--fy-accent); box-shadow: none; }
.grp-head .gt { font-weight: 600; }
.grp-parts { margin-left: 28px; gap: 4px; }
.grp-parts button { min-height: 28px; padding: 0 8px; border-radius: 3px; border: 0; background: #edeff2; color: var(--fy-text); font-weight: 600; box-shadow: none; }
html.dark .grp-parts button { background: #383e47; }
.grp-parts button[aria-pressed="true"] { background: var(--fy-sel); color: var(--fy-sel-text); box-shadow: inset 0 0 0 1px rgba(45,114,210,.6); }
.grp-parts .tm.then, .k-then { background: #fce8ef; color: #9b1e4b; }
.grp-parts .tm.now, .k-now { background: #e1f0fa; color: #1f5d85; }
html.dark .grp-parts .tm.then, html.dark .k-then { background: rgba(245,73,139,.25); color: #ffc4da; }
html.dark .grp-parts .tm.now, html.dark .k-now { background: rgba(104,193,238,.22); color: #c4ecff; }
.grp-help { color: var(--fy-muted); }

/* toggles, lists */
.toggle { min-height: 40px; border-bottom-color: var(--fy-line); }
.toggle input { width: 18px; height: 18px; }
.toggle span.t { font-weight: 600; }
.places button, .links button { font-family: var(--f-ui); border-bottom-color: var(--fy-line); min-height: 40px; }
html .places button:hover, html .links button:hover, html .qchip:hover { background: var(--fy-bg); }
.basemaps { gap: 8px; }
.basemaps .thumb, html .basemaps .thumb { height: 54px; border-radius: 3px; border: 1px solid var(--fy-border); box-shadow: none; }
html .basemaps button[aria-pressed="true"] .thumb { outline: 2px solid var(--fy-accent); outline-offset: 1px; }
.basemaps .nm { font-family: var(--f-ui); font-weight: 600; font-size: .9em; }
.basemaps button[aria-pressed="true"] .nm { color: var(--fy-accent); }

/* ---------- selection panel (details) ---------- */
.selhead { display: flex; gap: 12px; align-items: center; }
.selhead .ic { width: 52px; height: 52px; flex: none; border-radius: var(--fy-r); display: grid; place-items: center; background: var(--c, var(--fy-accent)); color: #fff; font: 700 20px var(--f-ui); box-shadow: inset 0 0 0 1px rgba(17,20,24,.15); }
.selhead .ic svg { width: 26px; height: 26px; fill: #fff; }
.selhead .tt { min-width: 0; flex: 1; }
.selhead .sub { color: var(--fy-muted); font: 400 .9em var(--f-ui); margin-top: 2px; }
.d-title { font-family: var(--f-ui); font-weight: 700; font-size: 1.3em; line-height: 1.2; letter-spacing: 0; }
.d-ar { font-size: 1em; color: var(--fy-muted); }
html .tag { border-radius: 3px; border-left: 0; padding: 1px 8px; background: #edeff2; color: var(--fy-text); font: 600 .78em var(--f-ui); display: inline-flex; align-items: center; gap: 6px; }
html .tag::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--fy-muted)); }
html.dark .tag { background: #383e47; }
.idrow { font-family: var(--f-ui); }
dl.meta, .meta { display: grid; grid-template-columns: 38% 1fr; gap: 0; padding: 0; border: 1px solid var(--fy-line); border-radius: 3px; font-size: .9em; }
.meta dt, .meta dd { padding: 7px 10px; border-bottom: 1px solid var(--fy-line); margin: 0; }
.meta dt { color: var(--fy-muted); background: var(--fy-bg); }
.meta dt:nth-last-child(2), .meta dd:last-child { border-bottom: 0; }
table.kv td { padding: 7px 8px; border-top-color: var(--fy-line); }
table.kv td:first-child { color: var(--fy-muted); }
.brief { border-left: 3px solid var(--fy-accent); font-size: 1.02em; }
.d-text { max-width: none; }
#sheet .sec { border: 1px solid var(--fy-border); border-radius: var(--fy-r); overflow: hidden; }
#sheet .sec h3 { margin: 0; padding: 0 12px; min-height: 36px; display: flex; align-items: center; background: var(--fy-head); border: 0; border-bottom: 1px solid var(--fy-border);
  font: 600 .78em var(--f-ui); letter-spacing: .06em; text-transform: uppercase; }
#sheet .sec > :not(h3) { margin: 8px 12px; }
.ai { border-top: 1px solid var(--fy-border); }
.ai-h { font: 600 1em var(--f-ui); }
.qchip { font-family: var(--f-ui); color: var(--fy-accent); border-bottom-color: var(--fy-line); }

/* ---------- map markers: Foundry pins ---------- */
.mk { width: 30px; height: 30px; border-radius: 0 !important; border: 3px solid #111418; background: var(--c); color: #fff; box-shadow: 3px 3px 0 #111418; font: 900 13px var(--f-ui); position: relative; transform: none !important; }
.mk::after { display: none; }
.mk b { transform: none !important; color: #fff; text-shadow: none; }
.mk.v-suspected { background: #fff; color: var(--c); border-color: var(--c); box-shadow: 3px 3px 0 var(--c); }
.mk.v-suspected b { color: var(--c); text-shadow: none; }
.mk.v-suspected::after { border-top-color: var(--c); }
.mk.v-testimony { box-shadow: 3px 3px 0 #111418, 0 0 0 3px rgba(255,255,255,.8); }
.mk.sel { box-shadow: 0 0 0 3px #fff, 6px 6px 0 3px #111418; transform: scale(1.18) !important; }
.mk.diamond { border-radius: 6px !important; }
.osm-ic { background: var(--c); border: 2px solid #111418; border-radius: 0; box-shadow: 2px 2px 0 #111418; }
.osm-ic svg { fill: #fff; }
.glyph .osm-ic { border-width: 1px; }
.glyph { border: 2px solid #111418; color: #fff; border-radius: 0; }
.glyph.circle, .glyph.square { border-radius: 0; }
.glyph.diamond { transform: none; }
.glyph.diamond span { transform: none; }
.glyph span { color: #fff; }

/* Foundry "card" labels */
html .leaflet-tooltip.site-label { background: var(--fy-panel); color: var(--fy-text); border: 0; border-radius: 3px; box-shadow: var(--fy-shadow-sm), 0 2px 6px rgba(17,20,24,.18); font: 600 12.5px var(--f-ui); padding: 3px 7px; }
.fy-card { min-width: 190px; max-width: 280px; font-family: var(--f-ui); }
.fy-card .ch { display: flex; align-items: center; gap: 7px; padding: 6px 9px; font-weight: 700; font-size: 13.5px; border-bottom: 1px solid var(--fy-line); white-space: normal; }
.fy-card .ch i { width: 18px; height: 18px; flex: none; border-radius: 4px; background: var(--c); color: #fff; display: grid; place-items: center; font: 700 10px var(--f-ui); font-style: normal; }
.fy-card .cr { display: flex; justify-content: space-between; gap: 14px; padding: 4px 9px; font-size: 12.5px; font-weight: 400; }
.fy-card .cr + .cr { border-top: 1px solid var(--fy-line); }
.fy-card .cr span:last-child { font-weight: 600; text-align: right; }
html .leaflet-tooltip.fy-tip { padding: 0; background: var(--fy-panel); color: var(--fy-text); border: 0; border-radius: 3px; box-shadow: var(--fy-shadow); }
html .leaflet-tooltip.fy-tip::before { display: none; }
.district { color: #404854; text-shadow: 0 0 2px #fff, 0 0 4px #fff, 0 0 8px #fff; font: 600 13px var(--f-ui); font-style: normal; letter-spacing: .02em; }
.district span { font: 500 11.5px var(--f-ui); }
html.dark .district { color: rgba(255,255,255,.9); text-shadow: 0 0 3px #000, 0 0 6px #000; }
.spot { background: var(--fy-accent); border-color: #fff; box-shadow: 0 0 0 2px var(--fy-accent); }
.spot .ping { border-color: var(--fy-accent); }

/* leaflet chrome */
html .leaflet-bar { border-radius: 3px !important; overflow: hidden; }
html .leaflet-bar a { background: var(--fy-panel) !important; color: var(--fy-text) !important; border-color: var(--fy-line) !important; width: 36px !important; height: 36px !important; line-height: 36px !important; font-size: 18px !important; }
html .leaflet-bar a:hover { background: var(--fy-bg) !important; }
html .leaflet-control-attribution, html .leaflet-control-scale-line { background: rgba(255,255,255,.85) !important; color: var(--fy-muted) !important; border-radius: 2px; }
html.dark .leaflet-control-attribution, html.dark .leaflet-control-scale-line { background: rgba(37,42,49,.85) !important; }
.hud { font-family: var(--f-ui); color: var(--fy-muted); }
.hud b { color: var(--fy-text); }

/* timeline: a histogram-style card */
#timeline .tl-title { color: var(--fy-text); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
#timeline .tl-lab, #timeline .tl-tick, #timeline .tl-hint { color: var(--fy-muted); }
#timeline .tl-tick:hover { color: var(--fy-accent); }
#timeline .tl-lane { background: var(--fy-line); }
#timeline .tl-axis { background: var(--fy-border); }
#timeline .tl-band { background: rgba(45,114,210,.06); border-color: rgba(45,114,210,.35); }
#timeline .tl-dot { border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(17,20,24,.25); }
#timeline .tl-span { opacity: .55; }
#timeline .tl-cursor { position: absolute; width: 2px; background: var(--fy-accent); pointer-events: none; z-index: 3; }
#timeline .tl-cursor b { position: absolute; top: -2px; left: 50%; transform: translate(-50%, -100%); background: var(--fy-accent); color: #fff; font: 700 11px var(--f-ui); padding: 1px 6px; border-radius: 3px; white-space: nowrap; }
#timeline .tl-ctrl { position: absolute; right: 10px; top: 3px; display: flex; gap: 6px; z-index: 4; }
#timeline .tl-ctrl button { min-height: 22px; padding: 0 8px; border: 0; border-radius: 3px; background: #edeff2; color: var(--fy-text); font: 600 11px var(--f-ui); box-shadow: inset 0 0 0 1px rgba(17,20,24,.15); }
html.dark #timeline .tl-ctrl button { background: #383e47; }
#timeline .tl-ctrl button[aria-pressed="true"] { background: var(--fy-sel); color: var(--fy-sel-text); }
#timeline .tl-hit { position: absolute; cursor: col-resize; z-index: 1; }

/* chat */
.msg.me { border-right-color: var(--fy-accent); }
.msg.bot { border-left-color: var(--fy-border); }
.did { color: #238551; }
.credit { -webkit-backdrop-filter: none; backdrop-filter: none; background: #fbb360; color: #1c2127; }
.credit.out { background: #fa999c; }

/* legend tab */
.legend { display: flex; flex-direction: column; }
.legend .lg { display: flex; align-items: center; gap: 10px; min-height: 34px; border-bottom: 1px solid var(--fy-line); font: 600 .92em var(--f-ui); }
.legend .lg:last-child { border-bottom: 0; }
.legend .lg small { margin-left: auto; color: var(--fy-muted); font-weight: 400; }
.legend .lg .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(17,20,24,.2); }
.legend h4 { margin: 10px 0 2px; font: 600 .74em var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--fy-muted); }
.legend p { margin: 4px 0; color: var(--fy-muted); font-size: .88em; }

/* report form */
.fy-form { display: flex; flex-direction: column; gap: 12px; font-family: var(--f-ui); }
.fy-form label { display: block; font-weight: 600; font-size: .9em; margin-bottom: 4px; }
.fy-form input, .fy-form textarea, .fy-form select { width: 100%; min-height: 38px; padding: 6px 10px; font-size: 1em; }
.fy-form textarea { min-height: 90px; resize: vertical; }
.fy-form small { display: block; color: var(--fy-muted); font-size: .82em; margin-top: 4px; line-height: 1.35; }
.fy-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fy-cats button { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 8px; text-align: left; border: 0; border-radius: 3px; background: var(--fy-bg); box-shadow: inset 0 0 0 1px var(--fy-border); font: 600 .86em var(--f-ui); color: var(--fy-text); }
.fy-cats button i { width: 16px; height: 16px; border-radius: 3px; flex: none; background: var(--c); }
.fy-cats button[aria-pressed="true"] { background: var(--fy-sel); box-shadow: inset 0 0 0 2px var(--fy-accent); color: var(--fy-sel-text); }
.fy-note { background: #fff7e6; border: 1px solid #f0c674; border-radius: 3px; padding: 8px 10px; font-size: .85em; color: #6b4a00; }
html.dark .fy-note { background: rgba(251,179,96,.12); border-color: rgba(251,179,96,.5); color: #fbd6a8; }
.rep-pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(17,20,24,.45); display: grid; place-items: center; }
.rep-pin svg { width: 13px; height: 13px; fill: #fff; transform: rotate(45deg); }
.fam-notes { display: flex; flex-direction: column; gap: 8px; }
.fam-note { border-left: 3px solid #d1980b; padding: 2px 0 2px 10px; font-size: .95em; }
.fam-note b { font-family: var(--f-ui); }
.fam-note small { display: block; color: var(--fy-muted); font-family: var(--f-ui); font-size: .82em; }
.picking-banner { position: fixed; z-index: 1250; top: calc(var(--map-top) + 10px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; background: var(--fy-panel); border: 1px solid var(--fy-border); border-radius: var(--fy-r); box-shadow: var(--fy-shadow); font: 600 .95em var(--f-ui); max-width: calc(100% - 24px); }

@media (max-width: 899px) {
  html .panel { border-radius: 10px 10px 0 0; border-width: 1px 0 0; }
  html .chat { border-radius: 0; border-width: 1px 0 0; }
  body.chat-open .chat { border-radius: 10px 10px 0 0; }
}
#drawer .panel-body > *, #sheet .panel-body > * { flex: none; }
#timeline .tl-hint { right: 190px; }
.osm-ic.prof { width: 22px; height: 22px; border-radius: 0; }
.osm-ic.prof svg { width: 12px; height: 12px; }
/* compact map styles: three across, short thumbnails */
.basemaps { grid-template-columns: repeat(3, 1fr); gap: 6px; }
html .basemaps .thumb { height: 40px; }
.basemaps small { display: none; }
.basemaps .nm { font-size: .82em; padding-top: 3px; }
.basemaps button[data-key="historical"] .thumb { height: 84px !important; }
.basemaps button[data-key="historical"] small { display: block; }
/* eras strip on the timeline */
#timeline .tl-era { position: absolute; top: 20px; height: 17px; padding: 0 4px; border: 0; border-radius: 2px; background: #e5e8eb; color: #404854; font: 600 10.5px var(--f-ui); white-space: nowrap; overflow: hidden; text-overflow: clip; cursor: pointer; z-index: 2; }
#timeline .tl-era.alt { background: #d3d8de; }
#timeline .tl-era:hover { background: var(--fy-sel); color: var(--fy-sel-text); }
#timeline .tl-era.sel { background: var(--fy-accent); color: #fff; }
html.dark #timeline .tl-era { background: #383e47; color: #c5cbd3; }
html.dark #timeline .tl-era.alt { background: #404854; }
#timeline .tl-grid { position: absolute; width: 1px; background: rgba(17,20,24,.08); pointer-events: none; }
html.dark #timeline .tl-grid { background: rgba(255,255,255,.08); }
#timeline .tl-hint { top: 3px; }
/* Encyclopedia (search) in Foundry dress */
html .term { background: rgba(17,20,24,.35); -webkit-backdrop-filter: none; backdrop-filter: none; padding-top: calc(var(--map-top) + 8px); }
html .term-box { background: var(--fy-panel); color: var(--fy-text); border: 1px solid var(--fy-border); border-radius: var(--fy-r); box-shadow: var(--fy-shadow); -webkit-backdrop-filter: none; backdrop-filter: none; padding: 0; gap: 0; overflow: hidden; }
.term-top { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--fy-border); }
.term-top > div:nth-child(2) { flex: 1; min-width: 0; }
.term-top h2 { margin: 0; font: 700 1.15em var(--f-ui); }
.term-top small { color: var(--fy-muted); font: .82em var(--f-ui); }
.term-ic { width: 40px; height: 40px; border-radius: var(--fy-r); background: var(--fy-accent); display: grid; place-items: center; flex: none; }
.term-ic svg { width: 22px; height: 22px; fill: #fff; }
html .term-head { padding: 12px 14px 8px; }
html .term-head input { min-height: 42px; border-radius: 3px; background: var(--fy-panel); border: 1px solid var(--fy-input); box-shadow: inset 0 1px 1px rgba(17,20,24,.12); font: 1em var(--f-ui); padding: 0 12px; }
html #term-kinds { padding: 0 14px 8px; gap: 2px; border-bottom: 1px solid var(--fy-border); }
html #term-kinds button { min-height: 32px; padding: 0 12px; border-radius: 3px; background: none; box-shadow: none; color: var(--fy-muted); font: 600 .9em var(--f-ui); }
html #term-kinds button[aria-pressed="true"] { background: var(--fy-sel); color: var(--fy-sel-text); box-shadow: none; }
html .term-meta { padding: 8px 14px; background: var(--fy-head); border-bottom: 1px solid var(--fy-border); color: var(--fy-muted); }
html .term-list { padding: 0 6px 6px; }
html .trow { border-bottom: 1px solid var(--fy-line); padding: 9px 8px; color: var(--fy-text); }
html .trow:hover, html .trow:focus-visible { background: var(--fy-bg); }
html .trow .tk { border-radius: 3px; font-size: .66em; background: #d3e2f7; color: #184a90; }
html .trow.k-area .tk { background: #d1f2df; color: #1c6e42; }
html .trow.k-doc .tk { background: #fbe9cf; color: #77450d; }
html .trow.k-event .tk { background: #fbdce8; color: #9b1e4b; }
html.dark .trow .tk { background: rgba(76,144,240,.25); color: #cfe0ff; }
html.dark .trow.k-area .tk { background: rgba(114,202,155,.22); color: #c6f0d8; }
html.dark .trow.k-doc .tk { background: rgba(251,179,96,.2); color: #ffe0b8; }
html.dark .trow.k-event .tk { background: rgba(245,73,139,.22); color: #ffc6dc; }
html .trow .tt b { font-family: var(--f-ui); font-weight: 600; }
html .trow .td, html .trow .tt small { color: var(--fy-muted); }
.lbl-hide { visibility: hidden !important; }
#timeline .tl-era { font-size: 10px; }
/* time period chips = the timeline's historical periods */
#periods { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
html #periods button { min-height: 40px; padding: 4px 8px; text-align: left; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; line-height: 1.2; font-size: .85em; }
#periods button small { font-weight: 400; color: var(--fy-muted); font-size: .85em; }
#periods button[aria-pressed="true"] small { color: var(--fy-sel-text); }
#periods button[data-era="all"] { grid-column: 1 / -1; min-height: 34px; }
html #term-src { padding: 8px 14px; gap: 4px; border-bottom: 1px solid var(--fy-border); background: var(--fy-panel); }
html #term-src button { min-height: 28px; padding: 0 10px; border-radius: 3px; font-size: .8em; background: #edeff2; box-shadow: none; color: var(--fy-text); }
html.dark #term-src button { background: #383e47; }
html #term-src button[aria-pressed="true"] { background: var(--fy-sel); color: var(--fy-sel-text); box-shadow: inset 0 0 0 1px rgba(45,114,210,.6); }
/* layer icons (layer-icons.js) on the map markers and colour tiles */
.mk b .lic { width: 21px; height: 21px; display: block; color: #fff; }
.mk.v-suspected b .lic { color: var(--c); }
.glyph .lic { width: 14px; height: 14px; display: block; color: #fff; }
.fy-card .ch i .lic { width: 12px; height: 12px; color: #fff; }
.selhead .ic .lic { width: 30px; height: 30px; color: #fff; }
/* street-level 3D view */
.street { position: fixed; inset: 0; z-index: 1400; background: #0e1116; display: flex; flex-direction: column; }
.street-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: calc(var(--top) + 8px) 12px 8px; background: var(--fy-panel); border-bottom: 1px solid var(--fy-border); }
.street-t { flex: 1; min-width: 160px; line-height: 1.2; font-family: var(--f-ui); }
.street-t b { display: block; font-size: 1.05em; }
.street-t small { color: var(--fy-muted); }
.street-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.street-btns .btn { min-height: 36px; padding: 0 12px; display: inline-flex; align-items: center; text-decoration: none; }
.street-btns .btn[aria-pressed="true"] { background: var(--fy-sel); color: var(--fy-sel-text); }
#street-map { flex: 1; min-height: 0; }
.street-help { position: absolute; left: 50%; bottom: calc(14px + var(--bot)); transform: translateX(-50%); margin: 0; padding: 6px 12px; border-radius: 3px; background: rgba(17,20,24,.72); color: #fff; font: .8em var(--f-ui); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.st-pin { display: flex; align-items: center; gap: 6px; transform: translateY(-6px); cursor: pointer; }
.st-pin i { width: 24px; height: 24px; border-radius: 6px; border: 2px solid #fff; background: var(--c); color: #fff; display: grid; place-items: center; font: 700 11px var(--f-ui); font-style: normal; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.st-pin i .lic { width: 16px; height: 16px; color: #fff; }
.st-pin span { background: rgba(255,255,255,.94); color: #1c2127; font: 600 12px var(--f-ui); padding: 2px 7px; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.35); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.st-pin.here i { width: 30px; height: 30px; background: #2d72d2; }
@media (max-width: 600px) { .street-btns .btn { padding: 0 9px; font-size: .85em; } .street-help { font-size: .72em; } }
/* connections */
.conn { display: flex; flex-direction: column; }
.conn-row { border-left: 3px solid var(--c); padding: 6px 0 8px 10px; border-bottom: 1px solid var(--fy-line); }
.conn-row:last-child { border-bottom: 0; }
.conn-go { display: block; width: 100%; text-align: left; padding: 0; border: 0; background: none; color: var(--fy-accent); font-family: var(--f-ui); cursor: pointer; }
.conn-go b { font-weight: 600; }
.conn-go small { display: block; color: var(--fy-muted); font-size: .8em; }
.conn-row p { margin: 3px 0; font-size: .92em; }
.conn-row a { font: .78em var(--f-ui); color: var(--fy-muted); }
.conn-same { margin: 8px 0 0; font: .85em var(--f-ui); color: var(--fy-muted); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--fy-accent); font: inherit; cursor: pointer; text-decoration: underline; }
/* In memory */
:root { --mem: #8a2846; --mem-band: rgba(138,40,70,.18); }
html.dark { --mem: #d9668c; --mem-band: rgba(217,102,140,.22); }
.mem-ic { background: #3a3f47; }
.mem-box { max-width: 820px; }
.mem-body { overflow-y: auto; padding: 16px 18px 22px; display: flex; flex-direction: column; gap: 18px; font-family: var(--f-ui); }
.mem-intro { margin: 0; font-size: 1.02em; line-height: 1.55; max-width: 68ch; }
.mem-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.mem-kpi { border: 1px solid var(--fy-border); border-radius: var(--fy-r); padding: 12px 14px; background: var(--fy-panel); }
.mk-n { font-size: 2.1em; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--fy-text); }
.mk-l { margin-top: 4px; font-weight: 600; font-size: .9em; }
.mem-kpi small { color: var(--fy-muted); }
.mem-fig { margin: 0; border: 1px solid var(--fy-border); border-radius: var(--fy-r); overflow: hidden; }
.mem-fig figcaption { padding: 0 12px; min-height: 36px; display: flex; align-items: center; background: var(--fy-head); border-bottom: 1px solid var(--fy-border); font: 600 .78em var(--f-ui); letter-spacing: .06em; text-transform: uppercase; }
.mb { padding: 6px 12px; }
.mb-row { display: grid; grid-template-columns: minmax(150px, 34%) 1fr auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--fy-line); }
.mb-row:last-child { border-bottom: 0; }
.mb-row:hover, .mb-row:focus-visible { background: var(--fy-bg); }
.mb-lab b { display: block; font-weight: 600; font-size: .92em; line-height: 1.25; }
.mb-lab small { color: var(--fy-muted); font-size: .78em; }
.mb-track { position: relative; height: 14px; }
.mb-bar { position: absolute; left: 0; top: 2px; height: 10px; min-width: 3px; background: var(--mem); border-radius: 0 4px 4px 0; }
.mb-range { position: absolute; top: 0; height: 14px; background: var(--mem-band); border-radius: 3px; }
.mb-val { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .92em; text-align: right; min-width: 5.5em; }
.mem-note { margin: 0; padding: 0 12px 10px; color: var(--fy-muted); font-size: .8em; }
.mem-body > .mem-note { padding: 0; }
.mem-h { margin: 4px 0 0; font: 600 .78em var(--f-ui); letter-spacing: .06em; text-transform: uppercase; }
.mem-names { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.mem-names li { padding: 8px 0; border-bottom: 1px solid var(--fy-line); font-size: .95em; }
.mem-names li b { font-weight: 700; }
.mem-names .linkbtn { margin-left: 8px; font-size: .85em; }
.mem-src summary { cursor: pointer; font-weight: 600; font-size: .9em; }
.mem-src ol { font-size: .82em; padding-left: 20px; }
@media (max-width: 600px) { .mb-row { grid-template-columns: 1fr auto; } .mb-track { grid-column: 1 / -1; grid-row: 2; } }
.mem-dedication { margin: 6px 0 4px; font: 400 1.25em/1.5 "Newsreader", Georgia, serif; max-width: 52ch; }
.mem-lines { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--fy-line); }
.mem-lines li { display: grid; grid-template-columns: 8.5em 1fr; gap: 14px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--fy-line); }
.ml-n { font: 600 1.15em "Newsreader", Georgia, serif; color: var(--mem); text-align: right; }
.ml-t { font-size: .98em; line-height: 1.45; }
.mem-rest { margin: 4px 0 0; font: italic 400 1.05em "Newsreader", Georgia, serif; color: var(--fy-muted); }
@media (max-width: 600px) { .mem-lines li { grid-template-columns: 1fr; gap: 2px; } .ml-n { text-align: left; } }
/* memorial: near full screen, dot field */
#memorial { padding: 2vh 2vw; align-items: center; }
html .mem-box { max-width: none; width: 96vw; height: 94vh; max-height: 94vh; }
.mem-body { flex: 1; min-height: 0; padding: 20px clamp(16px, 4vw, 56px) 32px; }
.mem-dotfig { margin: 6px 0 0; }
.mem-dotwrap { position: relative; }
.mem-dots { display: block; cursor: crosshair; }
.mem-dot-tip { position: absolute; z-index: 2; max-width: 260px; padding: 6px 9px; background: var(--fy-panel); color: var(--fy-text); border-radius: 3px; box-shadow: var(--fy-shadow); font: 600 .85em var(--f-ui); pointer-events: none; }
.mem-dotfig figcaption { margin-top: 8px; color: var(--fy-muted); font-size: .85em; max-width: 70ch; }

/* panel fact tables: key on the left, value on the right */
.meta.facts { grid-template-columns: 36% 1fr; margin: 4px 0 10px; }
.meta.facts dt { font-weight: 600; font-size: .86em; color: var(--fy-muted); display: flex; align-items: center; }
.meta.facts dd { font-variant-numeric: tabular-nums; line-height: 1.35; overflow-wrap: anywhere; }
.meta.facts dt:nth-last-child(2), .meta.facts dd:last-child { border-bottom: 0; }
#sheet .sec .brief, #sheet .sec .d-text { margin: 8px 12px 10px; }
.grp-parts .glyph, .legend .lg .glyph { width: 20px; height: 20px; flex: none; }
.grp-parts .glyph svg, .legend .lg .glyph svg { width: 13px; height: 13px; }
.grp-parts button { gap: 8px; }

/* timeline dots carry the layer icon */
#timeline .tl-dot { width: 17px; height: 17px; border: 2px solid #111418; border-radius: 0 !important; transform: translateX(-50%) !important; box-shadow: 1px 1px 0 #111418; display: grid; place-items: center; color: #fff; }
#timeline .tl-dot svg { width: 11px; height: 11px; display: block; }
#timeline .tl-dot.sel { outline: 2px solid var(--fy-accent); outline-offset: 1px; }
#timeline { height: var(--tl-h, 172px) !important; }
@media (min-width: 900px) { body:not(.no-timeline) .tip { bottom: 250px; } body:not(.no-timeline) .chat { bottom: 192px; } }

/* ================= The Unknown: a separate black plane ================= */
#unknown { position: fixed; z-index: 1020; top: var(--map-top); left: 0; right: 0; bottom: 0; background: #000; color: #e6e0d2; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#unknown[hidden] { display: none; }
body.unknown-on #timeline, body.unknown-on .chat, body.unknown-on .hud, body.unknown-on .yearbadge, body.unknown-on .tip, body.unknown-on .leaflet-control-container { display: none !important; }
#unknown .un-svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
#unknown.dragging .un-svg { cursor: grabbing; }
#unknown .un-grain { position: absolute; inset: 0; pointer-events: none; opacity: .09; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E"); }
/* links in the background */
#unknown .un-e { stroke: rgba(217, 210, 195, .17); fill: none; stroke-linecap: square; transition: stroke .2s, opacity .2s; }
#unknown.intro .un-e { stroke-dasharray: 1; stroke-dashoffset: 1; animation: un-draw 1.3s cubic-bezier(.2, .7, .2, 1) forwards; }
@keyframes un-draw { to { stroke-dashoffset: 0; } }
#unknown.dim .un-e { opacity: .25; }
#unknown .un-e.hot { stroke: #b0405c; opacity: 1; }
/* the mystery pictures */
#unknown .un-n { cursor: pointer; transition: opacity .2s; outline: none; }
#unknown.dim .un-n { opacity: .2; }
#unknown .un-n.hot { opacity: 1; }
#unknown .un-n .shadow { fill: #000; stroke: #2a2a2f; stroke-width: 1; }
#unknown .un-n .frame { fill: none; stroke: #3d3d43; stroke-width: 2; }
#unknown .un-n.f-mapped .frame { stroke: #38787a; }
#unknown .un-n:hover .frame, #unknown .un-n:focus-visible .frame, #unknown .un-n.hot .frame { stroke: #d9d2c3; }
#unknown .un-n.sel .frame { stroke: #b0405c; stroke-width: 4; }
#unknown .un-n text { font-family: var(--f-ui); pointer-events: none; }
#unknown .un-n .cn { fill: #6d6a64; font-size: 9px; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
#unknown .un-n .nm { fill: #cfc8b8; font-size: 11.5px; font-weight: 650; display: none; paint-order: stroke; stroke: #000; stroke-width: 3px; }
#unknown .un-n.big .nm, #unknown.near .un-n .nm, #unknown .un-n.hot .nm, #unknown .un-n:hover .nm { display: inline; }
#unknown.far .un-n:not(.hot):not(:hover) .nm, #unknown.far .un-n:not(.hot) .cn { display: none; }
#unknown.dim .un-n:not(.hot) .nm { display: none; }
/* picture tones (shared by the plane, legend and panel) */
.un-pic .bg { fill: #111113; }
.un-pic .s1 { fill: #34343a; } .un-pic .s2 { fill: #48474e; } .un-pic .s3 { fill: #1d1d21; }
.un-pic .lt { fill: #77736a; } .un-pic .lt-s { fill: none; stroke: #77736a; stroke-width: 2.4; }
.un-pic .s3-s { fill: none; stroke: #2b2b30; stroke-width: 2; } .un-pic .map-s { stroke: #26332f; stroke-width: 2; fill: none; }
.un-pic .mp { fill: #38787a; }
.un-pic .redact { fill: #000; }
/* header, legend, note */
#unknown .un-head { position: absolute; top: 0; left: 0; right: 0; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; justify-content: space-between; padding: 16px 16px 40px;
  background: linear-gradient(#000 0%, rgba(0, 0, 0, .85) 55%, rgba(0, 0, 0, 0)); pointer-events: none; }
#unknown .un-head > * { pointer-events: auto; }
#unknown .un-title h2 { margin: 0; font: 800 26px/1.05 var(--f-ui); letter-spacing: -.01em; color: #efe8d8; }
#unknown .un-title p { margin: 6px 0 0; max-width: 54ch; font-size: 13.5px; line-height: 1.45; color: #9a948a; }
#unknown .un-tools { display: flex; gap: 8px; flex-wrap: wrap; }
#unknown .un-tools input { height: 38px; min-width: 200px; padding: 0 12px; background: #0e0e10; color: #e6e0d2; border: 2px solid #3a3a40; border-radius: 0; font: 15px var(--f-ui); }
#unknown .un-tools input:focus { outline: none; border-color: #d9d2c3; }
#unknown .btn { border-radius: 0; background: #141416; color: #e6e0d2; border: 2px solid #3a3a40; box-shadow: none; }
#unknown .btn:hover { background: #1f1f23; }
#unknown .btn.primary { background: #d9d2c3; color: #000; border-color: #d9d2c3; }
#unknown .btn.primary:hover { background: #fff; }
#unknown .un-legend { position: absolute; left: 12px; bottom: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 6px; max-width: 760px; }
#unknown .un-legend button { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; background: rgba(14, 14, 16, .92); color: #cfc8b8; border: 1.5px solid #2e2e33; border-radius: 0; font: 600 12px var(--f-ui); cursor: pointer; }
#unknown .un-legend button small { color: #6d6a64; font-weight: 500; font-variant-numeric: tabular-nums; }
#unknown .un-legend button[aria-pressed="true"] { border-color: #b0405c; color: #fff; }
#unknown .un-legend .lg-pic svg { display: block; }
#unknown .un-note { position: absolute; right: 16px; bottom: 14px; max-width: 34ch; margin: 0; font-size: 11.5px; line-height: 1.4; color: #6d6a64; text-align: right; }
@media (max-width: 899px) {
  #unknown .un-note { display: none; }
  #unknown .un-title p { font-size: 12.5px; }
  #unknown .un-tools input { min-width: 0; flex: 1; }
  #unknown .un-tools { width: 100%; }
  #unknown .un-legend { bottom: 8px; left: 8px; right: 8px; max-height: 64px; overflow: auto; }
}
@media (prefers-reduced-motion: reduce) { #unknown.intro .un-e { animation: none; stroke-dasharray: none; } }
/* the basemap tile */
#basemaps .un-thumb { background: #000; display: grid; place-items: center; }
#basemaps .un-thumb svg { width: 90%; height: 90%; }
/* Unknown entries in the Foundry panel */
.un-portrait { position: relative; display: inline-block; margin: 2px 0 10px; }
.un-portrait svg { display: block; border: 3px solid #111418; box-shadow: 4px 4px 0 #111418; }
.un-portrait .un-case { position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; background: #000; color: #d9d2c3; font: 600 11px var(--f-ui); font-variant-numeric: tabular-nums; }
.un-links .un-mini svg { display: block; border: 1.5px solid #111418; }
.un-docs li { margin-bottom: 6px; }
.un-docs small { color: var(--fy-muted); }
.linkish { margin-left: 8px; padding: 0; border: 0; background: none; color: var(--fy-accent); font: 600 .86em var(--f-ui); cursor: pointer; text-decoration: underline; }
.selhead .ic svg.un-pic { width: 100%; height: 100%; display: block; }
.un-pic.real .ph { filter: grayscale(1) contrast(1.12) brightness(.92); }
#unknown .un-n.hot .un-pic.real .ph, #unknown .un-n:hover .un-pic.real .ph { filter: grayscale(.2) contrast(1.05); }
.un-credit { margin: -4px 0 10px; font-size: .8em; color: var(--fy-muted); }
@media (max-width: 899px) { #unknown .un-tools input { flex: 1 1 100%; } #unknown .un-tools .btn { flex: 1; } }
#unknown .un-n .cn { display: none; }
#unknown.near .un-n .cn, #unknown .un-n.hot .cn, #unknown .un-n:hover .cn { display: inline; }

/* ---- connection notes ---- */
#unknown .un-hit { stroke: transparent; stroke-width: 18; fill: none; cursor: pointer; pointer-events: stroke; }
#unknown .un-e.on { stroke: #d9d2c3; opacity: 1; stroke-width: 3; }
.un-lrow { display: flex; align-items: stretch; border-bottom: 1px solid var(--fy-line); }
.un-lrow > button:first-child { flex: 1; border-bottom: 0 !important; min-width: 0; }
.un-lrow .un-why { flex: none; align-self: center; margin: 0 0 0 6px; padding: 5px 9px; min-height: 0 !important; border: 1px solid var(--fy-line) !important; background: none; color: var(--fy-accent); font: 600 .8em var(--f-ui); cursor: pointer; }
.un-lrow .un-why:hover { background: var(--fy-bg); }
.conn-why { display: inline-block; margin-top: 4px; padding: 0; font: 600 .8em var(--f-ui); color: var(--fy-accent); text-decoration: underline; cursor: pointer; background: none; border: 0; }
.cn-pair { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.cn-pair svg { display: block; border: 2px solid #111418; box-shadow: 3px 3px 0 #111418; }
.cn-pair i { font-style: normal; font: 700 20px var(--f-ui); color: var(--fy-muted); }
.cn-wait { color: var(--fy-muted); }
.cn-flag { margin: 8px 0; padding: 8px 10px; border-left: 3px solid #b08a2e; background: rgba(176, 138, 46, .12); font: 600 .88em var(--f-ui); }
.cn-strength { display: flex; flex-direction: column; margin: 2px 0 10px; padding: 6px 10px; border-left: 4px solid var(--fy-line); font-family: var(--f-ui); }
.cn-strength b { font-size: .9em; }
.cn-strength small { color: var(--fy-muted); font-size: .8em; }
.cn-strength.s-direct { border-color: #4f8a68; } .cn-strength.s-reported { border-color: #4a73a0; } .cn-strength.s-inferred { border-color: #7b6a99; }
.cn-strength.s-weak { border-color: #b08a2e; } .cn-strength.s-doubtful { border-color: #a8505f; }
.cn-list { margin: 4px 0; padding-left: 18px; } .cn-list li { margin-bottom: 4px; line-height: 1.45; }
.cn-tl { list-style: none; margin: 4px 0; padding: 0; } .cn-tl li { padding: 4px 0 4px 10px; border-left: 2px solid var(--fy-line); } .cn-tl b { font-family: var(--f-ui); }
.cn-quote { margin: 6px 0; padding: 4px 0 4px 12px; border-left: 3px solid var(--fy-accent); }
.cn-quote p { margin: 0 0 2px; font-style: italic; } .cn-quote small { color: var(--fy-muted); font-family: var(--f-ui); }
.cn-aside { display: block; margin: 8px 0 0; color: var(--fy-muted); font: .78em var(--f-ui); }
.cn-slot .brief { margin-bottom: 10px; } .cn-slot .cn-strength { margin-bottom: 12px; }

/* ---- The Unknown: detailed drawn pictures ---- */
.un-pic .sk { fill: #7a7468; } .un-pic .sk2 { fill: #5c574d; } .un-pic .sh { fill: #000; opacity: .34; }
.un-pic .ln { fill: none; stroke: #1b1b1e; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; } .un-pic .ln2 { fill: none; stroke: #2e2e34; stroke-width: 1; }
.un-pic .hr { fill: #232225; } .un-pic .hi { fill: #a9a395; } .un-pic .hi-l { fill: none; stroke: #8d877a; stroke-width: 1.2; stroke-linecap: round; }
.un-pic .lap { fill: #26262b; stroke: #0b0b0c; stroke-width: .6; } .un-pic .shirt { fill: #a8a294; }
.un-pic .ac { fill: #8a2f43; } .un-pic .ac-l { stroke: #b0405c; stroke-width: 1.6; }
.un-pic .gl { fill: none; stroke: #d3ccbc; stroke-width: 1.5; stroke-linecap: round; }
.un-pic .hatch { fill: url(#un-hatch); } .un-pic .lt-b { fill: #5f5b53; }
.un-pic .ch { fill: #77736a; font: 700 6.4px var(--f-ui); letter-spacing: .08em; }
.un-pic .tick { fill: none; stroke: #d9d2c3; stroke-width: 1.2; opacity: .5; }
.un-pic .cl { fill: #15181a; stroke: #33403f; stroke-width: .8; } .un-pic .cl2 { fill: #1a1f20; stroke: #33403f; stroke-width: .8; }
.un-pic .pin { fill: #b0405c; } .un-pic .water { fill: #17323a; } .un-pic .road { fill: none; stroke: #3c3c43; stroke-width: 2.4; }
.un-pic .ring { fill: none; stroke: #38787a; stroke-width: 1.6; } .un-pic .on-map .mp, .un-pic .mp { fill: #38787a; }
.un-pic .t1 .sk { fill: #8a7d69; } .un-pic .t1 .sk2 { fill: #66594a; }
.un-pic .t2 .sk { fill: #5f594e; } .un-pic .t2 .sk2 { fill: #48443c; }
.un-pic .t3 .sk { fill: #9c9688; } .un-pic .t3 .sk2 { fill: #7b766a; }
.un-pic .h1 .hr { fill: #8a877f; } .un-pic .h2 .hr { fill: #4b4034; } .un-pic .h3 .hr { fill: #0d0d0e; }
.un-pic .a1 .ac { fill: #2d5a73; } .un-pic .a2 .ac { fill: #6b5a28; }
/* agents: higher contrast so the figure separates from the background */
.un-pic .ag-bg { fill: #0a0a0c; } .un-pic .ag-blind { fill: #e8dfc6; opacity: .17; } .un-pic .ag-sky { fill: #1c1c21; } .un-pic .ag-win { fill: #e3c77a; opacity: .85; }
.un-pic .ag-coat { fill: #8a8a96; } .un-pic .ag-coat2 { fill: #6c6c78; } .un-pic .ag-lap { fill: #565662; }
.un-pic .ag-edge { fill: none; stroke: #e2dccd; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.un-pic .ag-shirt { fill: #efe9da; } .un-pic .ag-tie { fill: #c24a63; } .un-pic .ag-btn { fill: #d9d2c3; }
.un-pic .ag-hat { fill: #b2aa94; } .un-pic .ag-hat2 { fill: #8f8873; } .un-pic .ag-band { fill: #5b1d2c; } .un-pic .ag-rim { fill: none; stroke: #efe9da; stroke-width: 1.4; stroke-linecap: round; opacity: .55; }
.un-pic .ag .sk { fill: #b3a68e; } .un-pic .ag .sk2 { fill: #7f7461; } .un-pic .ag .hr { fill: #2a2420; } .un-pic .ag .ln { stroke: #14110f; }
.un-pic .ag .t1 { } 

.d-note { margin: 8px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-2, #6b6a5e); border-left: 2px solid #55603a; padding-left: 9px; }

/* ---- formatted AI text (chat + place "Ask") ---- */
html .msg.me { font-style: normal; text-align: left; border-right: 0; padding: 9px 14px; border-radius: 14px 14px 4px 14px; background: color-mix(in srgb, var(--fy-accent) 14%, transparent); }
html .msg.me p { white-space: pre-wrap; }
html .msg.bot.md { border-left: 0; padding: 12px 15px; border-radius: 14px 14px 14px 4px; background: color-mix(in srgb, var(--fy-border) 35%, transparent); line-height: 1.55; gap: 0; }
html .md p { margin: 0 0 .65em; white-space: normal; max-width: 62ch; }
html .md > :last-child { margin-bottom: 0; }
html .md strong { font-weight: 700; }
html .md em { font-style: italic; }
html .md .md-h { font-weight: 700; margin-top: .4em; }
html .md ul, html .md ol { margin: 0 0 .7em; padding-left: 1.3em; max-width: 62ch; }
html .md li { margin: 0 0 .35em; padding-left: .15em; }
html .md li::marker { color: var(--fy-accent); }
html .md blockquote { margin: 0 0 .7em; padding: 2px 0 2px 12px; border-left: 3px solid var(--fy-accent); opacity: .85; }
html .md code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--fy-border) 60%, transparent); }
html .md a { color: var(--fy-accent); text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
html .ai-out.md { white-space: normal; }
html .md h4.md-h { margin: 1.1em 0 .4em; padding-bottom: 3px; font-size: 1.02em; font-weight: 700; border-bottom: 1px solid var(--fy-border); max-width: 62ch; }
html .md > h4.md-h:first-child { margin-top: 0; }
html .md ul { list-style: none; padding-left: 0; }
html .md ul li { position: relative; padding-left: 1.1em; }
html .md ul li::before { content: ''; position: absolute; left: .1em; top: .62em; width: 5px; height: 5px; background: var(--fy-accent); border-radius: 50%; }

/* ---- Phase 1 polish ---- */
/* phone header: a word under every icon */
@media (max-width: 560px) {
  .bar-actions .btn { flex-direction: column; justify-content: center; gap: 1px; min-width: 52px; padding: 2px 6px !important; min-height: 50px; }
  .bar-actions .btn svg { width: 18px; height: 18px; }
  .bar-actions .btn[data-s]::after { content: attr(data-s); font-size: 10.5px; font-weight: 700; line-height: 1.1; letter-spacing: 0; }
  html .bar-actions .btn { display: inline-flex; }
}
/* place panel */
html .dated { display: flex; flex-direction: column; gap: 10px; }
html .dated .dl-row { display: grid; grid-template-columns: 3.2em 1fr; gap: 10px; align-items: baseline; }
html .dated .dl-row b { font-variant-numeric: tabular-nums; color: var(--fy-accent); font-weight: 700; }
html .dated .dl-row b:empty::before { content: '•'; }
html .src-jump { align-self: flex-start; background: none; border: 0; padding: 4px 0; color: var(--fy-accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .92em; }
html details.more-facts { border-top: 1px solid var(--fy-border); padding-top: 10px; }
html details.more-facts summary { cursor: pointer; font-weight: 700; font-size: .9em; opacity: .8; padding: 6px 0; }
html details.more-facts[open] summary { margin-bottom: 8px; }
/* legend groups */
html .legend h5.lg-grp { margin: 12px 0 2px; font-size: .78em; font-weight: 700; opacity: .7; }
/* bigger timeline marks when text is enlarged */
html.big #timeline .tl-dot { width: 20px; height: 20px; }
html.huge #timeline .tl-dot { width: 22px; height: 22px; }
#timeline { overflow: hidden; }
/* tip sits above the chat bar, never on it */
@media (max-width: 899px) { html.has-chat .tip { bottom: calc(var(--chat-h) + 16px); } }
@media (max-width: 560px) {
  html .brand small { display: none; }
  html .brand b { white-space: normal; font-size: 1.05em; line-height: 1.15; overflow: visible; }
}
html .trow .tk { letter-spacing: 0; padding: 3px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Phase 2: front door ---- */
html .modal.door { background: rgba(20,24,30,.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); z-index: 1400; }
html .door-box { max-width: 640px; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; padding: 26px 26px 20px; background: var(--fy-panel); color: var(--fy-text); }
html .door-head h2 { margin: 0 0 6px; font-size: 1.45em; line-height: 1.2; font-weight: 700; }
html .door-head p { margin: 0 0 20px; color: var(--fy-muted); max-width: 46ch; }
html .door-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
html .door-grid.one { grid-template-columns: 1fr; }
html .door-choice { display: flex; gap: 14px; align-items: flex-start; text-align: left; padding: 16px; min-height: 92px; border: 1.5px solid var(--fy-border); background: var(--fy-panel); color: var(--fy-text); border-radius: 10px; cursor: pointer; font: inherit; }
html .door-choice:hover, html .door-choice:focus-visible { border-color: var(--fy-accent); background: var(--fy-sel); outline: none; }
html .door-choice b { display: block; font-size: 1.08em; margin-bottom: 3px; }
html .door-choice small { display: block; color: var(--fy-muted); font-size: .9em; line-height: 1.35; font-weight: 400; }
html .dc-ic { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--fy-sel); color: var(--fy-accent); }
html .dc-ic svg { width: 22px; height: 22px; fill: currentColor; }
html .door-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
html .door-off { display: inline-flex; align-items: center; gap: 8px; font-size: .95em; cursor: pointer; }
html .door-off input { width: 20px; height: 20px; accent-color: var(--fy-accent); }
@media (max-width: 560px) { html .door-grid { grid-template-columns: 1fr; } html .door-choice { min-height: 0; padding: 13px 14px; } html .door-box { padding: 20px 16px 16px; } }

/* ---- story and year cards ---- */
html .story-card { position: fixed; z-index: 1150; left: 50%; transform: translateX(-50%); bottom: 200px; width: min(560px, calc(100vw - 24px)); background: var(--fy-panel); color: var(--fy-text); border: 1.5px solid var(--fy-border); border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.25); padding: 14px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
html .story-card[hidden] { display: none; }
html body.no-timeline .story-card { bottom: 96px; }
@media (max-width: 899px) { html .story-card { bottom: calc(var(--chat-h, 66px) + 10px); max-height: 52vh; overflow-y: auto; } }
html .sc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
html .sc-head b { display: block; font-size: 1.05em; }
html .sc-head small { color: var(--fy-muted); font-size: .85em; }
html .sc-head .btn { min-height: 36px; padding: 0 12px; }
html .sc-place { display: flex; gap: 10px; align-items: center; }
html .sc-place b { display: block; font-size: 1.12em; line-height: 1.25; }
html .sc-place small { color: var(--fy-muted); }
html .sc-lead { margin: 0; line-height: 1.5; max-width: 60ch; }
html .sc-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
html .sc-btns .btn { min-height: 44px; }
html body.story-open .chat-form { opacity: .5; }
html .yc-year { font-size: 1.9em; line-height: 1; font-variant-numeric: tabular-nums; }
html .yc-slide { display: flex; gap: 8px; align-items: center; }
html .yc-slide input { flex: 1; accent-color: var(--fy-accent); height: 28px; }
html .yc-slide .btn { min-height: 40px; width: 44px; padding: 0; font-size: 1.3em; }
html .yc-list { display: flex; flex-direction: column; gap: 4px; max-height: 30vh; overflow-y: auto; }
html .yc-list h4 { margin: 4px 0; font-size: .85em; color: var(--fy-muted); }
html .yc-list button { display: flex; gap: 8px; align-items: center; text-align: left; background: none; border: 0; padding: 6px 2px; color: var(--fy-text); font: inherit; cursor: pointer; border-bottom: 1px solid var(--fy-line); }
html .yc-list button:hover span { text-decoration: underline; }
html .yc-open { margin: 6px 0 0; font-size: .88em; color: var(--fy-muted); }
html.dark .door-box, html.dark .story-card, html.dark .door-choice { background: #1c2127; color: #f6f7f9; border-color: #404854; }
html.dark .door-choice:hover { background: #22324a; }
html.dark .door-head p, html.dark .door-choice small, html.dark .sc-head small, html.dark .sc-place small { color: #abb3bf; }

/* ---- Phase 2A: neighbourhood badges ---- */
html .hood { display: flex; flex-direction: column; align-items: stretch; padding: 0; background: var(--fy-panel); color: var(--fy-text); border: 0; border-radius: 2px; box-shadow: var(--fy-shadow); cursor: pointer; white-space: nowrap; width: max-content; transform: translateX(calc(60px - 50%)); font-family: var(--f-ui); }
html .hood:hover { box-shadow: 0 0 0 1px var(--fy-accent), 0 2px 4px rgba(17,20,24,.2), 0 8px 24px rgba(17,20,24,.2); }
html .hood > span { display: flex; flex-direction: column; font-weight: 600; font-size: 13px; line-height: 16px; letter-spacing: 0; }
html .hood small { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; margin: 7px -10px 0; padding: 7px 10px 0; border-top: 1px solid var(--fy-line); font-weight: 400; }
html .hood small i.hk { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px 0 2px; font-style: normal; background: var(--fy-bg); border-radius: 2px; box-shadow: inset 0 0 0 1px var(--fy-line); }
html .hood small i.hk .glyph { flex: none; width: 16px !important; height: 16px !important; border-radius: 2px !important; box-shadow: none !important; border-width: 0 !important; }
html .hood small .hk-osm { display: grid; place-items: center; width: 16px; height: 16px; flex: none; border-radius: 2px; }
html .hood small .hk-osm svg { width: 11px; height: 11px; fill: #fff; }
html .hood small i.hk em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--fy-text); font-variant-numeric: tabular-nums; }
html.dark .hood { background: var(--fy-panel); color: var(--fy-text); }
html .hood > span { padding: 7px 10px 8px; }
html .hood-hide { opacity: 0 !important; pointer-events: none !important; }
html body.hoods .site-label, html body.hoods .district { display: none !important; }
/* ---- filters ---- */
html .filters h3 { margin-bottom: 8px; }
html .filters h3 ~ h3 { margin-top: 14px; }
html .filters .chips { display: flex; flex-wrap: wrap; gap: 6px; }
html .filters .chips button { min-height: 38px; padding: 0 12px; border: 1.5px solid var(--fy-border); background: var(--fy-panel); color: var(--fy-text); border-radius: 999px; font-weight: 600; font-size: .9em; cursor: pointer; }
html .filters .chips button[aria-pressed="true"] { background: var(--fy-sel); color: var(--fy-sel-text); border-color: var(--fy-accent); }
html .f-when-lab { font-size: 1.3em; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
html .f-when { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; font-size: .88em; color: var(--fy-muted); margin-bottom: 8px; }
html .f-when input { width: 100%; accent-color: var(--fy-accent); height: 28px; }
html .seg { display: flex; border: 1.5px solid var(--fy-border); border-radius: 10px; overflow: hidden; }
html .seg button { flex: 1; min-height: 42px; border: 0; background: var(--fy-panel); color: var(--fy-text); font-weight: 600; font-size: .86em; cursor: pointer; padding: 0 6px; }
html .seg button + button { border-left: 1.5px solid var(--fy-border); }
html .seg button[aria-checked="true"] { background: var(--fy-accent); color: #fff; }
html.dark .filters .chips button, html.dark .seg button { background: #1c2127; color: #f6f7f9; border-color: #404854; }
html.dark .filters .chips button[aria-pressed="true"] { background: #22324a; color: #cfe0ff; }
html.dark .seg button[aria-checked="true"] { background: var(--fy-accent); color: #fff; }
/* ---- timeline height follows its lanes ---- */
@media (min-width: 900px) {
  html body:not(.no-timeline) .chat { bottom: calc(var(--tl-h, 146px) + 20px); }
  html body:not(.no-timeline) .tip { bottom: calc(var(--tl-h, 146px) + 96px); }
  html body:not(.no-timeline) .story-card { bottom: calc(var(--tl-h, 146px) + 96px); }
  html body.no-timeline .story-card { bottom: 96px; }
}
html .hood > span > em { font-style: normal; font-weight: 400; font-size: 12px; line-height: 15px; color: var(--fy-muted); }
html .hood-ar { display: block; }

/* ---- Arabic interface ---- */
html.ar body { font-family: "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", Tahoma, var(--f-text); }
html.ar .d-ar { display: none; }
html.ar .door-choice, html.ar .yc-list button, html.ar .hood { text-align: right; }
html.ar .msg.bot.md { border-radius: 14px 14px 4px 14px; }
html.ar .msg.me { border-radius: 14px 14px 14px 4px; }
html.ar .dated .dl-row b { text-align: left; }
html.ar .hood { transform: translateX(calc(50% - 60px)); }
html.ar #timeline { direction: ltr; }
html.ar .leaflet-container { direction: ltr; }
html.ar .site-label { font-family: "Noto Naskh Arabic", Tahoma, sans-serif; }
html.ar .md ul li { padding-left: 0; padding-right: 1.1em; }
html.ar .md ul li::before { left: auto; right: .1em; }
#btn-lang .lbl { font-weight: 700; }
html.ar [dir="auto"] { text-align: start; }
html.ar .f-when input, html.ar .yc-slide { direction: ltr; }
/* ---- source reader ---- */
html .srcs li { margin-bottom: 8px; }
html .qr-btn { display: inline-block; margin: 4px 0 0; padding: 2px 0; background: none; border: 0; color: var(--fy-accent); font: inherit; font-size: .88em; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
html .qr-btn::before { content: '❝ '; text-decoration: none; }
html blockquote.qr { margin: 8px 0 4px; padding: 10px 12px; border-left: 3px solid var(--fy-accent); background: color-mix(in srgb, var(--fy-border) 25%, transparent); border-radius: 0 8px 8px 0; }
html.ar blockquote.qr[dir="rtl"] { border-left: 0; border-right: 3px solid var(--fy-accent); border-radius: 8px 0 0 8px; }
html blockquote.qr p { margin: 0 0 6px; line-height: 1.5; font-size: .93em; }
html blockquote.qr mark { background: rgba(255, 214, 102, .55); color: inherit; padding: 0 2px; border-radius: 2px; }
html.dark blockquote.qr mark { background: rgba(255, 196, 0, .3); }
html blockquote.qr small { color: var(--fy-muted); font-size: .8em; }

/* ---- Phase 3A: memory recorder, elder questions, home pin, on this day ---- */
html .remember-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px; text-align: left; border-radius: 12px; margin: 6px 0 10px; }
html .remember-btn b { display: block; font-size: 1.05em; }
html .remember-btn small { display: block; font-weight: 400; opacity: .9; }
html .rb-ic { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; flex: none; }
html .rb-ic svg { width: 22px; height: 22px; }
html.ar .remember-btn { text-align: right; }
html .rep-media { margin-top: 10px; }
html .rep-media label.btn { cursor: pointer; display: inline-flex; align-items: center; }
html .rep-media-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
html .rm { display: flex; align-items: center; gap: 10px; }
html .rm img { width: 88px; height: 66px; object-fit: cover; border-radius: 6px; }
html .rm audio, html .mv audio { width: 100%; max-width: 320px; }
html .rec-on { background: #c23030 !important; color: #fff !important; border-color: #c23030 !important; }
html .media-view { display: flex; flex-direction: column; gap: 10px; }
html .mv img { max-width: 100%; border-radius: 8px; }
html .elder-q { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 10px; }
html.ar .elder-q { padding-left: 0; padding-right: 1.3em; }
html .elder-q li span { display: block; line-height: 1.45; }
html .home-pin { width: 34px; height: 34px; border-radius: 50%; background: #8f6bd6; color: #fff; display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.35); }
html .home-pin svg { width: 18px; height: 18px; }
html .otd { position: fixed; z-index: 1160; top: calc(var(--map-top, 60px) + 12px); left: 50%; transform: translateX(-50%); width: min(460px, calc(100vw - 24px)); background: var(--fy-panel); color: var(--fy-text); border: 1.5px solid var(--fy-border); border-left: 4px solid var(--fy-accent); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.2); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
html .otd small { color: var(--fy-muted); font-weight: 600; }
html .otd b { line-height: 1.35; }
html.dark .otd { background: #1c2127; color: #f6f7f9; border-color: #404854; }
html .door-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
html body.picking .hood, html body.picking .leaflet-marker-icon { pointer-events: none !important; }

/* ---- Phase 3B: archive overview, booklet ---- */
html .ov { padding: 12px 14px 20px; display: flex; flex-direction: column; gap: 8px; }
html .ov h4 { margin: 10px 0 0; font-size: 1em; }
html .ov-chart svg { width: 100%; height: auto; color: var(--fy-muted); }
html .ov-places { display: flex; flex-direction: column; gap: 2px; }
html .ov-places button { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 3.2em; gap: 10px; align-items: center; background: none; border: 0; padding: 6px 2px; color: var(--fy-text); font: inherit; text-align: left; cursor: pointer; border-bottom: 1px solid var(--fy-line); }
html .ov-places button:hover .ov-n { text-decoration: underline; }
html .ov-bar { height: 10px; background: var(--fy-line); border-radius: 5px; overflow: hidden; }
html .ov-bar i { display: block; height: 100%; background: var(--fy-accent); }
html .ov-places b { text-align: right; font-variant-numeric: tabular-nums; }
html.ar .ov-places button { text-align: right; }
html .booklet { position: fixed; inset: 0; z-index: 2000; overflow-y: auto; background: #e9ecef; }
html .bk-bar { position: sticky; top: 0; display: flex; gap: 8px; justify-content: center; padding: 10px; background: rgba(233,236,239,.95); z-index: 1; }
html .bk-page { max-width: 760px; margin: 0 auto 40px; background: #fff; color: #1c2127; padding: 36px 44px; font-family: Georgia, "Noto Naskh Arabic", serif; line-height: 1.55; box-shadow: 0 4px 20px rgba(0,0,0,.12); }
html .bk-page h1 { font-size: 1.9em; margin: 0 0 4px; }
html .bk-page h2 { font-size: 1.2em; margin: 22px 0 2px; }
html .bk-ar { margin: 0; color: #404854; font-size: 1.1em; }
html .bk-sub, html .bk-meta, html .bk-foot, html .bk-stories { color: #5f6b7c; font-size: .88em; margin: 4px 0 12px; }
html .bk-why { font-weight: 600; }
html .bk-map { width: 100%; height: auto; margin: 8px 0 4px; }
html .bk-src { font-size: .78em; color: #404854; word-break: break-all; padding-left: 1.2em; }
html .bk-place { break-inside: avoid; border-top: 1px solid #d3d8de; }
@media print {
  html body.printing > *:not(#booklet) { display: none !important; }
  html body.printing { background: #fff; }
  html .booklet { position: static; overflow: visible; background: #fff; }
  html .bk-bar { display: none; }
  html .bk-page { box-shadow: none; margin: 0; padding: 0; max-width: none; }
}

/* ---------- place panels: one shape for every kind (see openSite / openArea / openRecord in app.js) ---------- */
:root { --pp-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --pp-amber: #8a5a14; --pp-amber-soft: #f3e9d8; --pp-blue: #3f5d75; --pp-blue-soft: #e3eaf0;
  --pp-red: #9b3b2a; --pp-red-soft: #f6e3de; --pp-green: #4b5d4a; --pp-green-soft: #e6ece4; }
html.dark { --pp-amber: #d9a55a; --pp-amber-soft: #2e261a; --pp-blue: #9cc0dc; --pp-blue-soft: #1c2a35;
  --pp-red: #e79a85; --pp-red-soft: #3a221c; --pp-green: #b5c9b2; --pp-green-soft: #1f2a1e; }
#sheet-body .pp-head { display: flex; gap: 12px; align-items: flex-start; }
#sheet-body .pp-head > .glyph { flex: none; margin-top: 4px; }
#sheet-body .pp-tt { min-width: 0; }
#sheet-body .pp-title { font-family: var(--f-text); font-size: 1.4em; font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
#sheet-body .pp-ar { font-family: "Noto Naskh Arabic", var(--f-text); color: var(--muted); margin-top: 2px; text-align: left; }
#sheet-body .pp-type { display: block; font-family: var(--pp-mono); font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-top: 5px; }
#sheet-body .pp-status { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--fy-line); }
#sheet-body .pp-status > div { min-width: 0; }
#sheet-body .pp-status .wide { grid-column: 1 / -1; }
#sheet-body .pp-status dt { font-family: var(--pp-mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; font-weight: 400; }
#sheet-body .pp-status dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#sheet-body .pp-status dd.nr { font-weight: 400; font-style: italic; color: var(--muted); }
#sheet-body .pp-pill { display: inline-block; border-radius: 4px; padding: 0 7px; font-weight: 600; background: var(--pp-amber-soft); color: var(--pp-amber); }
#sheet-body .pp-pill.rep { background: var(--pp-blue-soft); color: var(--pp-blue); }
#sheet-body .pp-pill.unc { background: var(--pp-red-soft); color: var(--pp-red); }
#sheet-body .pp-pill.ctx { background: var(--panel-3); color: var(--muted); }
#sheet-body .pp-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
#sheet-body .pp-acts .btn { margin: 0; text-decoration: none; }
#sheet-body .pp-sec { border-top: 1px solid var(--fy-line); padding-top: 12px; margin-top: 18px; }
#sheet-body .pp-sec > h3 { font-family: var(--pp-mono); font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; padding: 0; border: 0; font-weight: 500; }
#sheet-body .pp-sec .sec { margin: 14px 0 0; padding: 0; border: 0; }
#sheet-body .pp-sec .sec h3, #sheet-body .pp-sec .ai-h, #sheet-body .pp-sub { font-family: var(--pp-mono); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; padding: 0; border: 0; font-weight: 500; }
#sheet-body .pp-fr .ai { margin-top: 0; }
#sheet-body .pp-bl { font-weight: 600; line-height: 1.5; margin: 0 0 12px; }
#sheet-body .pp-chron { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#sheet-body .pp-chron li { display: grid; grid-template-columns: 3.4em minmax(0, 1fr); gap: 10px; line-height: 1.45; }
#sheet-body .pp-chron.seq li, #sheet-body .pp-chron.per li { grid-template-columns: 6.8em minmax(0, 1fr); }
#sheet-body .pp-chron .y { font-family: var(--pp-mono); font-size: .78em; color: var(--pp-amber); font-variant-numeric: tabular-nums; padding-top: .2em; }
#sheet-body .pp-chron .y.g { color: var(--pp-red); }
#sheet-body .pp-chron .d { color: var(--muted); }
#sheet-body .pp-fn { font-family: var(--pp-mono); font-size: .66em; vertical-align: super; line-height: 0; color: var(--pp-blue); background: none; border: 0; padding: 0 2px; margin: 0; min-height: 0; min-width: 0; cursor: pointer; box-shadow: none; }
#sheet-body .pp-fn:hover { text-decoration: underline; }
#sheet-body .pp-un { font-family: var(--pp-mono); font-size: .6em; vertical-align: super; line-height: 0; color: var(--muted); border: 1px dashed var(--muted); border-radius: 3px; padding: 0 3px; margin-left: 3px; }
#sheet-body .pp-conflict { background: var(--pp-red-soft); color: var(--pp-red); border-radius: 6px; padding: 9px 12px; margin-top: 14px; font-size: .93em; }
#sheet-body .pp-conflict b { display: block; font-family: var(--pp-mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 500; }
#sheet-body .pp-conflict p { margin: 5px 0 0; line-height: 1.45; }
#sheet-body .pp-conflict .pp-fn { color: inherit; }
#sheet-body .pp-rep { display: grid; gap: 8px; }
#sheet-body .pp-acct { border-left: 3px solid var(--pp-green); background: var(--pp-green-soft); padding: 7px 11px; border-radius: 0 6px 6px 0; }
#sheet-body .pp-acct .who { font-family: var(--pp-mono); font-size: .6rem; letter-spacing: .07em; text-transform: uppercase; color: var(--pp-green); margin-bottom: 2px; }
#sheet-body .pp-acct p { margin: 0; line-height: 1.45; }
#sheet-body .pp-more { background: none; border: 0; color: var(--link); padding: 0; font: inherit; font-size: .9em; cursor: pointer; text-align: left; min-height: 0; box-shadow: none; }
#sheet-body .pp-empty { color: var(--muted); font-style: italic; margin: 0; }
#sheet-body .pp-note { color: var(--muted); font-size: .86em; margin: 8px 0 0; line-height: 1.45; }
#sheet-body .pp-full { margin-top: 12px; }
#sheet-body .pp-full > summary { cursor: pointer; color: var(--link); font-size: .9em; }
#sheet-body .pp-full[open] > summary { margin-bottom: 8px; }
#sheet-body .pp-kw { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; margin: 0; padding: 0; }
#sheet-body .pp-kw li { font-size: .86em; border: 1px solid var(--fy-line); border-radius: 4px; padding: 1px 8px; background: var(--panel-2); }
#sheet-body .pp-slot:empty { display: none; }
#sheet-body .pp-ref { font-family: var(--pp-mono); font-size: .66rem; color: var(--muted); margin: 18px 0 0; }
#sheet-body .srcs li.pp-hit { background: var(--pp-amber-soft); border-radius: 4px; transition: background 1.2s; }
#sheet-body .pp-acts a.btn { display: inline-flex; align-items: center; }
#sheet-body .pp-sec .sec h3, #sheet-body .pp-sec .ai-h, #sheet-body .pp-sub { background: none; box-shadow: none; margin-top: 4px; }
#sheet-body .pp-nodate li { grid-template-columns: minmax(0, 1fr); }
#sheet-body .pp-undated { margin-top: 14px; }
#sheet-body .pp-text p { margin: 0 0 10px; }
