/* EarthDepth v2: dark, data-dense explorer (light theme on toggle). */
@font-face { font-family: "Inter"; src: url("vendor/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root, :root[data-theme="dark"] {
  --bg: #060a14; --map-bg: #060a14;
  --glass: rgba(13, 19, 36, 0.72); --glass-solid: #0d1324; --glass-hi: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09); --line-strong: rgba(255, 255, 255, 0.18);
  --text: #e8ebf4; --muted: #8e98b3; --faint: #5d6782;
  --accent: #ffb86b; --accent-ink: #1a1206; --accent2: #7cc3ef;
  --hover: #ffffff; --cell-line: rgba(255, 255, 255, 0.035); --border: #cdd6ee;
  --obs: #5fd39a; --map: #82b1ff; --pred: #d39bff; --interp: #f2c76b;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
:root[data-theme="light"] {
  --bg: #eef1f6; --map-bg: #e6eaf2;
  --glass: rgba(255, 255, 255, 0.8); --glass-solid: #ffffff; --glass-hi: rgba(0, 0, 0, 0.04);
  --line: rgba(10, 20, 40, 0.1); --line-strong: rgba(10, 20, 40, 0.2);
  --text: #121726; --muted: #59637a; --faint: #8a93a8;
  --accent: #c25414; --accent-ink: #ffffff; --accent2: #1f6fb2;
  --hover: #0b1020; --cell-line: rgba(0, 0, 0, 0.05); --border: #2a3247;
  --obs: #137a4b; --map: #2856a8; --pred: #8a3fb0; --interp: #8a6200;
  --shadow: 0 10px 34px rgba(20, 30, 60, 0.16);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--accent2); text-decoration: none; } a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- stage ---------- */
#stage { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; }
.maplibregl-ctrl-group { background: var(--glass) !important; border: 1px solid var(--line); backdrop-filter: blur(12px); border-radius: 10px !important; }
.maplibregl-ctrl-group button { width: 32px; height: 32px; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
:root[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(1) opacity(.8); }
.maplibregl-ctrl-bottom-right { bottom: 124px; right: 6px; }

/* ---------- top bar ---------- */
#topbar { position: fixed; top: 12px; left: 12px; right: 12px; height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 10px 0 14px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand b { display: block; font-weight: 700; letter-spacing: -.01em; font-size: 15px; }
.brand span { display: block; font-size: 11px; color: var(--muted); margin-top: -2px; }
.logo { width: 22px; height: 24px; background: conic-gradient(from 210deg, var(--accent), #ff6b9a, var(--accent2), var(--accent));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); filter: drop-shadow(0 0 8px rgba(255,184,107,.5)); }
.searchbox { flex: 0 1 360px; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; padding: 0 8px 0 12px;
  background: var(--glass-hi); border: 1px solid var(--line); border-radius: 9px; color: var(--muted); cursor: text; }
.searchbox:hover { border-color: var(--line-strong); }
kbd { font: 11px/1 Inter, system-ui; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); }
.latest { display: flex; gap: 12px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.latest b { color: var(--text); font-weight: 600; }
.tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.btn { height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--glass-hi); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn:disabled, .icon:disabled { opacity: .4; cursor: not-allowed; }
.icon { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--glass-hi); cursor: pointer; font-size: 13px; font-weight: 600; }
.icon:hover { border-color: var(--line-strong); }
.icon.on, .btn.on { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.menu { position: absolute; top: 58px; right: 120px; width: 280px; padding: 6px; display: grid; gap: 2px; }
.menu button { text-align: left; padding: 10px 12px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; }
.menu button:hover { background: var(--glass-hi); }
.menu small { display: block; color: var(--muted); }
#preview-banner { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); background: #b3261e; color: #fff; padding: 6px 14px; border-radius: 8px; z-index: 30; font-weight: 600; font-size: 12px; }

/* ---------- lens rail ---------- */
#rail { position: fixed; top: 76px; left: 12px; width: 272px; bottom: 128px; z-index: 15; display: flex; flex-direction: column; overflow: hidden; }
.rail-head { display: flex; align-items: baseline; gap: 8px; padding: 12px 14px 8px; border: 0; background: transparent; text-align: left; cursor: default; }
.rail-head b { font-weight: 600; }
.rail-head .chev { display: none; margin-left: auto; }
#rail-list { overflow-y: auto; padding: 0 6px 10px; scrollbar-width: thin; }
.rg { margin-top: 8px; }
.rg-t { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 6px 8px 4px; }
.lens { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 1px solid transparent; background: transparent; border-radius: 9px; cursor: pointer; }
.lens .ln { display: block; font-weight: 500; }
.lens .ld { display: none; font-size: 12px; color: var(--muted); margin-top: 2px; }
.lens:hover { background: var(--glass-hi); }
.lens.on { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.lens.on .ln { color: var(--accent); }
.lens.on .ld, .lens:hover .ld { display: block; }

/* ---------- legend ---------- */
#legend { position: fixed; left: 296px; bottom: 128px; width: 300px; padding: 12px 14px; z-index: 14; font-size: 12px; max-height: 42vh; overflow: auto; }
.lg-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.lg-head span { color: var(--muted); font-variant-numeric: tabular-nums; }
.lg-tags { margin: 6px 0 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--muted); }
.lg-tags a { font-size: 11px; }
#legend .bar { height: 10px; border-radius: 5px; }
#legend .bar.sm { height: 7px; margin-top: 6px; }
#legend .ends { display: flex; justify-content: space-between; color: var(--muted); margin-top: 3px; }
#legend .cats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
#legend .cats span { display: flex; align-items: center; gap: 6px; }
#legend .cats i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
#legend .note { color: var(--muted); margin: 8px 0 0; }
#legend details summary { cursor: pointer; color: var(--accent2); }

/* ---------- tags ---------- */
.tag { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; padding: 1px 6px; border-radius: 5px; border: 1px solid currentColor; vertical-align: 1px; white-space: nowrap; }
.tag.OBSERVED { color: var(--obs); } .tag.MAPPED { color: var(--map); } .tag.PREDICTED { color: var(--pred); } .tag.interp { color: var(--interp); }
.conf { color: var(--pred); font-style: normal; font-size: 12px; }

/* ---------- city labels and tooltip ---------- */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.city { position: absolute; left: 0; top: 0; pointer-events: auto; border: 0; background: transparent; padding: 0; display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; color: var(--text); cursor: pointer; white-space: nowrap;
  text-shadow: 0 0 3px var(--map-bg), 0 0 6px var(--map-bg), 0 0 10px var(--map-bg); }
.city i { width: 5px; height: 5px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 2px color-mix(in srgb, var(--map-bg) 70%, transparent); }
.city.mid { font-size: 12.5px; font-weight: 600; } .city.big { font-size: 13.5px; font-weight: 700; letter-spacing: .01em; }
.city:hover { color: var(--accent); }
.glow-cities .city.big i, .glow-cities .city.mid i { background: var(--accent); box-shadow: 0 0 10px 4px color-mix(in srgb, var(--accent) 70%, transparent); }
.glow-cities .city.big, .glow-cities .city.mid { color: var(--accent); }
#tip { position: absolute; left: 0; top: 0; z-index: 12; pointer-events: none; min-width: 180px; max-width: 300px; padding: 9px 11px;
  background: var(--glass-solid); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); font-size: 12.5px; }
.tt-place { font-weight: 700; } .tt-place span { color: var(--muted); font-weight: 400; }
.tt-val { margin: 2px 0 5px; font-size: 13.5px; }
.tt-meta { color: var(--muted); font-size: 11px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- card ---------- */
#card { position: fixed; top: 76px; right: 12px; width: 392px; bottom: 128px; z-index: 16; overflow-y: auto; padding: 16px 16px 12px; scrollbar-width: thin; }
.card-head { display: flex; justify-content: space-between; gap: 10px; }
.card-head h2 { margin: 0; font-size: 22px; letter-spacing: -.015em; line-height: 1.15; }
.card-head h2 small { font-size: 12px; color: var(--muted); font-weight: 400; }
.where { color: var(--muted); font-size: 12px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.card-btns { display: flex; gap: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 2px; }
.chip { font-size: 11.5px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--muted); }
.chip.change { color: var(--text); font-weight: 600; }
.chip.change.c2 { border-color: #c25b86; } .chip.change.c3 { border-color: var(--accent); color: var(--accent); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.metric { background: var(--glass-hi); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px 8px; min-width: 0; }
.m-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.m-top .tag { font-size: 8px; padding: 0 4px; }
.m-val { font-size: 19px; font-weight: 650; letter-spacing: -.01em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.m-sub { font-size: 10.5px; color: var(--faint); } .m-sub a { color: var(--faint); text-decoration: underline; }
.spark { width: 100%; height: 30px; display: block; } .spark .nd { font-size: 9px; fill: var(--faint); } .spark .zero { stroke: var(--line-strong); stroke-dasharray: 2 2; }
.stack { display: flex; height: 7px; border-radius: 4px; overflow: hidden; margin: 6px 0 4px; }
#card h3, .dos-side h2, .dos-main h2 { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; font-weight: 600; }
ol.bio { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 1px solid var(--line-strong); }
ol.bio li { position: relative; margin: 0 0 9px; padding-left: 4px; font-size: 13px; }
ol.bio li::before { content: ""; position: absolute; left: -16.5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--glass-solid); }
ol.bio time { display: block; font-weight: 650; font-size: 12px; color: var(--accent); }
ul.conn { margin: 0; padding-left: 18px; } ul.conn li { margin: 0 0 6px; font-size: 13px; }
.none { color: var(--muted); font-style: italic; margin: 4px 0; font-size: 13px; }
.how { color: var(--muted); font-size: 12px; }
.link { border: 0; background: none; color: var(--accent2); cursor: pointer; padding: 0; font-size: 12.5px; }
.card-foot { position: sticky; bottom: -12px; display: flex; gap: 6px; padding: 12px 0 2px; margin-top: 12px; background: linear-gradient(transparent, var(--glass-solid) 30%); }

/* ---------- timeline ---------- */
#timeline { position: fixed; left: 12px; right: 12px; bottom: 12px; height: 104px; z-index: 18; padding: 10px 18px 12px; }
.tl-row { display: flex; align-items: center; gap: 12px; }
.play { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); cursor: pointer; display: grid; place-items: center; flex: none;
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 50%, transparent); }
.play span { width: 0; height: 0; border-left: 12px solid var(--accent-ink); border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 3px; }
.play.on span { width: 11px; height: 13px; border: 0; margin: 0; background: linear-gradient(90deg, var(--accent-ink) 0 35%, transparent 35% 65%, var(--accent-ink) 65%); }
.play:disabled { opacity: .35; box-shadow: none; cursor: not-allowed; }
.tl-modes { display: flex; gap: 2px; background: var(--glass-hi); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tl-mode { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.tl-mode.on { background: var(--glass-solid); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.tl-read { flex: 1; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-read b { color: var(--text); font-size: 18px; font-variant-numeric: tabular-nums; margin-right: 2px; }
.btn.now { border-color: var(--accent); color: var(--accent); }
.tl-axis { position: relative; margin: 12px 10px 0; height: 34px; }
#tl-ticks { position: absolute; inset: 0 0 auto 0; height: 34px; pointer-events: none; }
.tk { position: absolute; top: 4px; width: 1px; height: 6px; background: var(--line-strong); }
.tk.d { background: var(--accent); height: 10px; top: 2px; opacity: .85; }
.tk b { position: absolute; top: 16px; transform: translateX(-50%); font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }
#tl-range { position: absolute; left: -8px; right: -8px; top: -2px; width: calc(100% + 16px); margin: 0; appearance: none; background: transparent; height: 18px; cursor: pointer; }
#tl-range::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); border-radius: 2px; }
#tl-range::-moz-range-track { height: 2px; background: var(--line-strong); }
#tl-range::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; margin-top: -8px; border-radius: 50%; background: var(--text); border: 3px solid var(--accent); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent); }
#tl-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 3px solid var(--accent); }

/* ---------- globe / fade / story ---------- */
#globe, #fade { position: fixed; top: 76px; left: 296px; width: 300px; padding: 10px 12px; z-index: 14; }
#globe svg { width: 100%; display: block; border-radius: 8px; }
#globe .ocean { fill: #10203a; } #globe .grat line { stroke: rgba(255,255,255,.12); stroke-width: .5; }
#globe .eq { stroke: #7cc3ef; stroke-width: .7; stroke-dasharray: 3 2; } #globe .eqt { font-size: 6px; fill: #7cc3ef; }
#globe .dot { fill: var(--accent); stroke: #fff; stroke-width: 1.4; }
#globe p, #fade p { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
#fade label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; } #fade input { flex: 1; accent-color: var(--accent); }
#story { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 24px)); z-index: 25; padding: 14px 16px; border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
#story p { margin: 6px 0 10px; font-size: 14.5px; }
.story-nav { display: flex; gap: 6px; }

/* ---------- dossier ---------- */
#dossier { position: fixed; inset: 0; z-index: 40; overflow-y: auto; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 28px 32px 60px; }
.dos-head { max-width: 1240px; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-start; }
.dos-head h1 { margin: 2px 0 0; font-size: 40px; letter-spacing: -.025em; line-height: 1.05; }
.dos-grid { max-width: 1240px; margin: 18px auto 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; }
.dos-main, .dos-side { min-width: 0; }
.lede { color: var(--muted); max-width: 60ch; margin-top: 0; }
svg.aligned { width: 100%; height: auto; display: block; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
svg.aligned .g { stroke: var(--line); } svg.aligned .gx { fill: var(--faint); font-size: 10px; text-anchor: middle; }
svg.aligned .now { stroke: var(--accent); stroke-dasharray: 3 3; fill: var(--accent); }
svg.aligned .rn { fill: var(--text); font-size: 12px; font-weight: 600; } svg.aligned .rs { fill: var(--faint); font-size: 9.5px; }
svg.aligned .rv { fill: var(--text); font-size: 11px; font-weight: 600; } svg.aligned .ry { fill: var(--faint); font-weight: 400; font-size: 9.5px; } svg.aligned .z { stroke: var(--line-strong); stroke-dasharray: 2 3; }
table.mini { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.mini th, table.mini td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.mini small { color: var(--muted); display: block; }
ul.list { margin: 0; padding-left: 18px; }
.dossier-open #card, .dossier-open #timeline, .dossier-open #rail, .dossier-open #legend { visibility: hidden; }

/* ---------- palette ---------- */
#palette { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); display: flex; justify-content: center; align-items: flex-start; padding-top: 14vh; }
.pal-box { width: min(640px, calc(100% - 24px)); background: var(--glass-solid); overflow: hidden; }
#pal-input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font-size: 17px; padding: 16px 18px; outline: none; }
#pal-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow: auto; }
#pal-list li { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
#pal-list li.on { background: color-mix(in srgb, var(--accent) 16%, transparent); }
#pal-list li small { color: var(--muted); margin-left: auto; text-align: right; }
#pal-list .k { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); width: 40px; flex: none; }
#pal-list .k.lens { color: var(--accent); }
.pal-foot { padding: 8px 14px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--line); }
.fatal { position: fixed; top: 40%; left: 50%; transform: translateX(-50%); width: min(440px, calc(100vw - 32px)); box-sizing: border-box; background: var(--glass-solid); padding: 14px 18px; border-radius: 12px; z-index: 99; }

/* ---------- tablet / phone ---------- */
@media (max-width: 1640px) { .latest { display: none; } }
@media (max-width: 1100px) { #legend { width: 260px; } }
@media (max-width: 860px) {
  #topbar { height: 48px; gap: 8px; top: 8px; left: 8px; right: 8px; padding: 0 6px 0 10px; }
  .brand > div, .searchbox span, .tools .btn.ghost { display: none; }
  .searchbox kbd { display: none; }
  #legend .note, #legend details, #legend .lg-tags a { display: none; }
  #legend .lg-tags { margin: 4px 0 6px; }
  body.card-open #legend, body.card-open #rail { display: none; }
  .searchbox { flex: 1; } .searchbox::before { content: "Search…"; }
  #rail { top: auto; bottom: 112px; left: 8px; right: 8px; width: auto; max-height: 52px; transition: max-height .25s ease; }
  .rail-head { cursor: pointer; } .rail-head .chev { display: block; }
  body.rail-open #rail { max-height: 60vh; }
  #legend { left: 8px; right: auto; top: 64px; bottom: auto; width: min(240px, 60vw); max-height: 30vh; padding: 9px 10px; }
  #globe, #fade { left: 8px; right: 8px; top: 64px; width: auto; }
  #card { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 64vh; border-radius: 18px 18px 0 0; z-index: 30; }
  #timeline { left: 8px; right: 8px; bottom: 8px; height: 98px; padding: 8px 12px 10px; }
  .tl-modes .tl-mode { padding: 5px 7px; font-size: 11.5px; }
  .tl-read { display: none; } .btn.now { display: none; }
  .maplibregl-ctrl-bottom-right { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  #dossier { padding: 16px; } .dos-grid { grid-template-columns: 1fr; } .dos-head h1 { font-size: 30px; }
  .menu { right: 8px; }
}
@media (max-width: 420px) { .tl-modes .tl-mode { padding: 5px 5px; font-size: 11px; } .tkb[data-v="1980"] { display: none; } }   /* all four modes, old maps included, stay reachable */
@media (max-width: 380px) { .tl-row { gap: 6px; } .tl-modes { min-width: 0; overflow-x: auto; scrollbar-width: none; } .tl-modes .tl-mode { padding: 5px 4px; font-size: 10.5px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* best-use advisor */
.adv { background: var(--glass-hi); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; margin: 6px 0; }
.adv.unreliable { opacity: .75; border-style: dashed; }
.adv-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adv-top .conf { margin-left: auto; font-size: 12px; color: var(--muted); }
.adv-bar { position: relative; height: 18px; border-radius: 9px; background: var(--line); margin: 7px 0 5px; overflow: hidden; }
.adv-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #1f6a38, #86c95a); border-radius: 9px; }
.adv-bar span { position: relative; padding-left: 8px; font-size: 12px; font-weight: 600; line-height: 18px; color: #fff; text-shadow: 0 1px 2px #0008; }
.adv-test, .adv-w { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

/* grouped lens rail: pick a group, see only its lenses (no long scroll) */
.rg-tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 4px 8px; }
.rg-tabs button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.rg-tabs button:hover { color: var(--text); border-color: var(--line-strong); }
.rg-tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
#rail { bottom: auto; max-height: calc(100vh - 204px); }
.lens.on .ld, .lens:hover .ld, .lens:focus-visible .ld { display: block; }

/* card: fun fact + tabs */
.fact { margin: 10px 0 2px; padding: 9px 11px; border-radius: 11px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent); }
.fact-top { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.fact-top .link { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.fact p { margin: 5px 0 2px; font-size: 14px; line-height: 1.4; }
.tabs { display: flex; gap: 4px; margin: 12px 0 2px; padding: 3px; border-radius: 10px; background: var(--glass-hi); border: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 6px 4px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.tabs button.on { background: var(--glass-solid); color: var(--text); font-weight: 600; box-shadow: 0 1px 4px #0003; }
.tab-body { min-height: 120px; }
.tab-body .how { font-size: 12px; color: var(--muted); }

/* city explorer */
#cities { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4); display: flex; justify-content: center; align-items: flex-start; padding: 9vh 12px 0; }
.cx { width: min(720px, 100%); max-height: 80vh; display: flex; flex-direction: column; background: var(--glass-solid); padding: 14px 16px 10px; }
.cx header { display: flex; justify-content: space-between; align-items: center; }
.cx header b { font-size: 18px; } .cx header span { margin-left: 10px; color: var(--muted); font-size: 12px; }
#cx-q { width: 100%; margin: 10px 0 8px; flex: 0 0 38px; box-sizing: border-box; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--glass-hi); color: var(--text); font: inherit; }
.cx-sorts { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-sorts button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; }
.cx-sorts button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
#cx-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; font-size: 12px; color: var(--muted); }
#cx-meta .link { margin-left: auto; }
#cx-list { list-style: none; margin: 4px 0 0; padding: 0; overflow-y: auto; scrollbar-width: thin; }
#cx-list li { display: grid; grid-template-columns: 34px minmax(0, 1.3fr) minmax(40px, 1fr) auto; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 8px; cursor: pointer; }
#cx-list li:hover { background: var(--glass-hi); }
#cx-list .rk { color: var(--faint); font-variant-numeric: tabular-nums; text-align: right; font-size: 12px; }
#cx-list .nm small { display: block; color: var(--muted); font-size: 11px; }
#cx-list .br { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
#cx-list .br i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
#cx-list .vl { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
#cx-list li.none { display: block; cursor: default; color: var(--muted); font-style: italic; }
@media (max-width: 760px) {
  #surprise-btn span { display: none; } #surprise-btn { padding: 0 9px; }
  .cx-sorts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; } .cx-sorts button { white-space: nowrap; }
  #cities { padding-top: 0; align-items: flex-end; } .cx { max-height: 86vh; border-radius: 18px 18px 0 0; }
  #cx-list li { grid-template-columns: 26px minmax(0, 1fr) auto; } #cx-list .br { display: none; }
  #rail { max-height: 52px; } body.rail-open #rail { max-height: 60vh; }
}

/* at-a-glance badges on the card */
.traits { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.trait { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--glass-hi); color: var(--text);
  border-radius: 999px; padding: 4px 10px 4px 7px; font-size: 12px; cursor: pointer; }
.trait:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.trait:disabled { cursor: default; }
.trait span { font-size: 14px; }
.tabs button:hover { color: var(--text); }

.grav-big { margin: 6px 0 2px; font-size: 14px; } .grav-big b { color: var(--accent); }
.adv-bar span { white-space: nowrap; }

/* card follows the lens */
.lens-here { margin: 10px 0 0; padding: 9px 11px; border-radius: 11px; background: var(--glass-hi); border: 1px solid var(--line-strong); }
.lh-top { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.lens-here p { margin: 4px 0 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
/* next five years */
.near { margin: 10px 0 8px; padding: 9px 10px; border-radius: 11px; background: var(--glass-hi); border: 1px solid var(--line); }
.near-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.near table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.near th { font-weight: 600; color: var(--muted); text-align: right; padding: 3px 4px; }
.near td { text-align: right; padding: 3px 4px; border-top: 1px solid var(--line); white-space: nowrap; }
.near td:first-child { text-align: left; color: var(--muted); white-space: normal; }
.near .on { color: var(--accent); font-weight: 700; }
.near p { margin: 6px 0 0; font-size: 11px; color: var(--faint); }
.near table { table-layout: fixed; } .near th:first-child, .near td:first-child { width: 34%; } .near td { font-size: 11.5px; }

.cx-foot { display: flex; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 6px; }
.cx-foot .link { margin-left: auto; }
.cx header span { display: inline-block; }
#cx-meta .warn b { color: var(--accent); }
.adv .top { color: var(--accent); font-weight: 700; }
@media (max-width: 760px) { #sites-btn { padding: 0 9px; font-size: 12px; } }
.adv-bar.min i { background: linear-gradient(90deg, #7d3c7a, #ef8a5b); }

/* risk in 2050 and land like this */
.risk { margin: 4px 0 10px; padding: 9px 10px; border-radius: 11px; background: var(--glass-hi); border: 1px solid var(--line); }
.risk-row { margin-top: 8px; }
.risk-top { display: flex; align-items: center; gap: 8px; font-size: 13px; } .risk-top span { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.risk-bar { height: 6px; border-radius: 3px; background: var(--line); margin: 5px 0 3px; overflow: hidden; }
.risk-bar i { display: block; height: 100%; border-radius: 3px; background: #5fb3c9; } .risk-bar i.mid { background: #f0b35e; } .risk-bar i.hi { background: #e0614a; }
.risk-row p, .risk-note { margin: 0; font-size: 12px; color: var(--muted); } .risk-note { margin-top: 8px; color: var(--faint); font-size: 11px; }
.like { list-style: none; margin: 6px 0; padding: 0; }
.like-row { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; text-align: left; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.like-row:hover { background: var(--glass-hi); } .like-row small { display: block; color: var(--muted); font-size: 11px; } .like-row .vl { font-weight: 600; white-space: nowrap; }
.tabs button { font-size: 12.5px; padding: 6px 2px; }

/* ---------- usability pass ---------- */
#hint-tip { position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; max-width: 260px; padding: 8px 11px; border-radius: 10px; font-size: 12.5px; line-height: 1.4;
  background: var(--glass-solid); color: var(--text); border: 1px solid var(--line-strong); box-shadow: 0 8px 28px #0006; }
#hint-tip b { display: block; font-size: 12px; color: var(--accent); margin-bottom: 2px; }
#tour { position: fixed; left: 0; top: 0; z-index: 70; width: min(320px, calc(100vw - 16px)); padding: 13px 15px 12px; background: var(--glass-solid);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 14px 44px #0008; transition: transform .25s ease; }
#tour b { font-size: 16px; } #tour p { margin: 5px 0 11px; font-size: 13.5px; line-height: 1.45; color: var(--text); }
.tour-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.tour-nav { display: flex; gap: 8px; justify-content: flex-end; }
#tour-ring { position: fixed; z-index: 69; pointer-events: none; border: 2px solid var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent), 0 0 30px color-mix(in srgb, var(--accent) 50%, transparent);
  transition: all .25s ease; animation: ringpulse 1.6s ease-in-out infinite; }
@keyframes ringpulse { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 12%, transparent), 0 0 34px color-mix(in srgb, var(--accent) 55%, transparent); } }
#click-hint { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 13; padding: 7px 14px; border-radius: 999px; font-size: 13px; pointer-events: none;
  background: color-mix(in srgb, var(--accent) 92%, transparent); color: var(--accent-ink); font-weight: 600; box-shadow: 0 6px 22px #0005; animation: hintin .5s ease 1.2s both; }
@keyframes hintin { from { opacity: 0; transform: translate(-50%, -8px); } }
body.card-open #click-hint, body.dossier-open #click-hint { display: none; }
/* timeline year labels are buttons */
#tl-ticks { pointer-events: none; }
.tkb { position: absolute; top: 16px; z-index: 2; transform: translateX(-50%); font: inherit; font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; pointer-events: auto;
  background: transparent; border: 0; padding: 3px 5px; border-radius: 6px; cursor: pointer; }
.tkb:hover { color: var(--text); background: var(--glass-hi); }
.tk.cur .tkb { color: var(--accent); font-weight: 700; }
/* loading: only when a lens takes a moment */
body.loading #legend::after { content: "Loading…"; position: absolute; right: 12px; top: 10px; font-size: 11px; color: var(--accent); }
body.loading #map { cursor: progress; }
#legend { position: fixed; }
/* clearer focus and press feedback everywhere */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.btn, .icon, .lens, .trait, .tabs button, .rg-tabs button, .cx-sorts button, .tl-mode { transition: background .15s ease, border-color .15s ease, color .15s ease, transform .08s ease; }
.btn:active, .icon:active, .trait:active, .tabs button:active, .rg-tabs button:active, .cx-sorts button:active { transform: scale(.96); }
.btn:hover, .icon:hover { border-color: var(--accent); }
.metric, .adv, .near, .risk, .fact, .lens-here { transition: border-color .15s ease; }
.metric:hover, .adv:hover { border-color: var(--line-strong); }
#card { scroll-behavior: auto; }
.tab-body { animation: tabin .18s ease; } @keyframes tabin { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* phone: the top bar scrolls sideways instead of overflowing */
@media (max-width: 760px) {
  .tools { overflow-x: auto; scrollbar-width: none; flex: 1; justify-content: flex-end; }
  .tools::-webkit-scrollbar { display: none; }
  #click-hint { top: 64px; font-size: 12px; }
}
@media (max-width: 760px) {
  #rail { top: auto; bottom: 112px; max-height: 52px; } body.rail-open #rail { max-height: 60vh; }
  .tools { justify-content: flex-start; }
  .searchbox { flex: 0 0 44px; min-width: 0; padding: 0 8px; } .searchbox kbd { display: none; }
  .searchbox::before { content: "⌕"; font-size: 18px; }
  #click-hint { top: auto; bottom: 178px; }
}

/* ---------- landing page ---------- */
#landing { position: fixed; inset: 0; z-index: 60; overflow-y: auto; scroll-behavior: smooth; color: var(--text);
  background: radial-gradient(1200px 700px at 78% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
              radial-gradient(900px 600px at 0% 100%, color-mix(in srgb, var(--accent2) 16%, transparent), transparent 60%),
              color-mix(in srgb, var(--map-bg) 74%, transparent);
  backdrop-filter: blur(5px) saturate(1.15); -webkit-backdrop-filter: blur(5px) saturate(1.15); }
#landing[hidden] { display: none; }
/* phones (and browsers without backdrop blur): the map must not show through the text */
@media (max-width: 860px) { #landing { background: radial-gradient(900px 600px at 78% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), color-mix(in srgb, var(--map-bg) 96%, transparent); } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { #landing { background-color: color-mix(in srgb, var(--map-bg) 96%, transparent); } }
/* letter-spacing splits Devanagari, Tamil and Bengali letters apart */
html:not([lang=en]) #landing .ld-h, html:not([lang=en]) #landing .ld-path small, html:not([lang=en]) #landing .ld-bharat { letter-spacing: 0; }
body.landing-open #click-hint, body.landing-open #tip { display: none; }
.ld-wrap { max-width: 1120px; margin: 0 auto; padding: 44px 24px 56px; }
.ld-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; margin-bottom: 30px; }
.ld-hero h1 { font-size: clamp(38px, 6.4vw, 78px); line-height: 1.02; letter-spacing: -.035em; margin: 0; font-weight: 700; }
.ld-hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), #ff6b9a 55%, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ld-sub { max-width: 720px; font-size: clamp(16px, 1.6vw, 19px); line-height: 1.55; color: var(--muted); margin: 20px 0 26px; }
.ld-sub b { color: var(--text); font-weight: 600; }
.ld-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.big { height: 46px; padding: 0 20px; font-size: 15.5px; border-radius: 12px; }
.ld-stats { display: flex; flex-wrap: wrap; gap: 12px 34px; margin: 38px 0 6px; padding-top: 22px; border-top: 1px solid var(--line); }
.ld-stats b { display: block; font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ld-stats span { font-size: 12.5px; color: var(--muted); }
.ld-h { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 46px 0 14px; }
.ld-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 12px; }
.ld-card { text-align: left; padding: 18px 18px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--glass-hi); color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; gap: 6px; font: inherit; transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.ld-card:hover, .ld-card:focus-visible { transform: translateY(-3px); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--glass-hi)); box-shadow: 0 12px 30px #0004; }
.ld-card .ic { font-size: 26px; line-height: 1; }
.ld-card b { font-size: 16.5px; letter-spacing: -.01em; }
.ld-card p { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); flex: 1; }
.ld-card i { font-style: normal; font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 6px; }
.ld-trust, .ld-who { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 10px 22px; }
.ld-trust > div { display: flex; gap: 10px; align-items: flex-start; }
.ld-trust p, .ld-who p { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.ld-trust .tag { margin-top: 2px; } .ld-trust .tick { color: var(--accent); font-size: 15px; width: 18px; }
.ld-who b { display: block; margin-bottom: 3px; }
.ld-about { max-width: 760px; }
.ld-about p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.ld-about .ld-about-lead { font-size: clamp(16px, 1.6vw, 18px); color: var(--text); }
.ld-maker { margin-top: 22px; padding: 16px 18px 6px; border-left: 3px solid var(--accent); background: var(--glass-hi); border-radius: 0 14px 14px 0; }
.ld-maker span { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.ld-maker p { color: var(--text); font-style: italic; }
html:not([lang=en]) .ld-maker span { letter-spacing: 0; } html:not([lang=en]) .ld-maker p { font-style: normal; }
.ld-foot { margin-top: 48px; padding-top: 26px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.ld-foot p { margin: 0; font-size: 13px; color: var(--muted); } .ld-foot a { color: var(--accent2); }
#brand { cursor: pointer; border-radius: 10px; }
@media (max-width: 760px) { .ld-wrap { padding: 26px 16px 40px; } .ld-brand { margin-bottom: 20px; } .ld-stats { gap: 10px 22px; margin-top: 28px; } .ld-stats b { font-size: 21px; }
  .btn.big { height: 44px; padding: 0 16px; font-size: 14.5px; } .ld-h { margin-top: 34px; } }
.ld-auto { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
/* Bharat-first opening: the name, a lead line, three ways in, and the languages */
.ld-bharat { margin: 0 0 12px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--accent); }
.ld-bharat span { letter-spacing: .04em; font-size: 15px; }
.ld-lead { max-width: 760px; font-size: clamp(19px, 2vw, 24px); line-height: 1.4; color: var(--text); font-weight: 500; margin: 22px 0 0; letter-spacing: -.01em; }
.ld-lead + .ld-sub { margin-top: 12px; }
.ld-paths { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.ld-path { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 18px 11px; min-width: 190px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--glass-hi); color: var(--text); cursor: pointer; font: inherit; transition: transform .08s ease, border-color .15s ease, background .15s ease; }
.ld-path small { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--accent); }
.ld-path b { font-size: 16px; font-weight: 600; }
.ld-path:hover, .ld-path:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.ld-path.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .ld-path.primary small { color: #fff; opacity: .85; }
.ld-dice { align-self: center; }
.ld-langs { margin: 16px 0 0; font-size: 14px; color: var(--muted); }
.ld-langs .link { font-size: 15px; padding: 2px 3px; } .ld-langs span { margin-right: 2px; }
html[lang=hi] .ld-langs [data-lang=hi], html[lang=ta] .ld-langs [data-lang=ta], html[lang=bn] .ld-langs [data-lang=bn], html[lang=en] .ld-langs [data-lang=en] { color: var(--text); font-weight: 700; text-decoration: none; }
@media (max-width: 760px) { .ld-path { flex: 1 1 100%; min-width: 0; } .ld-dice { align-self: flex-start; } }

/* ---------- shorter card: one-line rows that open on click, tabs that stay in view ---------- */
#card .tabs { position: sticky; top: -16px; z-index: 3; background: var(--glass-solid); margin-top: 10px; }
.uses { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; margin: 6px 0; }
.use { border-bottom: 1px solid var(--line); background: var(--glass-hi); }
.use:last-child { border-bottom: 0; }
.use > summary, .use.none-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(40px, 1fr) 26px auto; gap: 8px; align-items: center; padding: 8px 10px; cursor: pointer; list-style: none; font-size: 13px; }
.use > summary::-webkit-details-marker { display: none; }
.use > summary:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.use[open] > summary { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.use.none-row { cursor: default; color: var(--muted); grid-template-columns: 1fr auto; }
.u-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.u-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #1f6a38, #86c95a); }
.u-bar.min i { background: linear-gradient(90deg, #7d3c7a, #ef8a5b); }
.u-bar.rk i { background: #5fb3c9; } .u-bar.rk i.mid { background: #f0b35e; } .u-bar.rk i.hi { background: #e0614a; }
.u-val { font-variant-numeric: tabular-nums; text-align: right; }
.u-conf { font-size: 11px; color: var(--muted); white-space: nowrap; text-align: right; min-width: 52px; }
.u-conf.c-high, .u-conf.c-medium { color: var(--obs); } .use.unreliable .u-name { font-weight: 500; color: var(--muted); }
.use.risk-row > summary { grid-template-columns: minmax(0, 1.1fr) minmax(40px, 1fr) auto; }
.use.grav > summary { grid-template-columns: auto 1fr; } .u-grav { font-size: 12.5px; color: var(--muted); text-align: right; } .u-grav b { color: var(--accent); }
.use.grav { border: 1px solid var(--line); border-radius: 11px; margin: 6px 0; }
.u-more { padding: 2px 10px 10px; font-size: 12px; color: var(--muted); line-height: 1.45; } .u-more p { margin: 5px 0 0; }
.risk { padding: 9px 10px 6px; } .risk .uses { margin-top: 4px; } .risk-note { margin-top: 6px; }
.near p { display: none; } .near:hover p, .near:focus-within p { display: block; }
.lens-here { margin-top: 8px; padding: 8px 11px; } .lens-here p { font-size: 14px; }
.metric { padding: 8px 9px 7px; } .metrics { gap: 6px; }

/* City AI Score block */
.aib { margin: 4px 0 10px; padding: 10px 11px 8px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent2) 10%, transparent)); }
.aib .near-top { margin-bottom: 6px; } .aib-conf { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.aib-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aib-n { display: block; font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.aib-n small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.aib-l { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.aib-read { margin: 8px 0 6px; font-size: 13.5px; font-weight: 600; }
.aib-more { border: 1px solid var(--line); border-radius: 9px; background: transparent; } .aib-more > summary { grid-template-columns: 1fr; font-size: 12px; padding: 6px 9px; }
.ld-card.hot { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--glass-hi)), color-mix(in srgb, var(--accent2) 12%, var(--glass-hi))); }

/* daily mystery place */
#daily { position: fixed; top: 76px; right: 12px; width: 372px; max-height: calc(100vh - 216px); z-index: 17; overflow-y: auto; padding: 14px 15px 12px; scrollbar-width: thin; }
#daily[hidden] { display: none; }
#daily header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
#daily header b { font-size: 17px; } #daily header span { margin-left: 8px; color: var(--muted); font-size: 12px; }
.dy-how { margin: 4px 0 8px; font-size: 13.5px; color: var(--muted); } .dy-how b { color: var(--accent); }
.dy-clues { list-style: none; margin: 0; padding: 0; counter-reset: c; }
.dy-clues li { counter-increment: c; padding: 8px 10px; margin: 6px 0; border-radius: 10px; background: var(--glass-hi); border: 1px solid var(--line); font-size: 13.5px; line-height: 1.4; animation: tabin .25s ease; }
.dy-ct { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dy-ct b::before { content: counter(c) ". "; }
.dy-clues .spark { display: block; width: 100%; height: 30px; margin-top: 4px; }
.dy-guesses { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); font-size: 13px; }
.dy-guesses li { padding: 2px 0; } .dy-guesses b { font-variant-numeric: tabular-nums; }
.dy-end { padding: 10px 11px; border-radius: 11px; margin: 4px 0 8px; font-size: 14px; border: 1px solid var(--line-strong); background: var(--glass-hi); }
.dy-end.won { border-color: color-mix(in srgb, var(--obs) 60%, transparent); }
.dy-end > b:first-child { display: block; font-size: 16px; margin-bottom: 2px; }
.dy-share { display: flex; align-items: center; gap: 10px; margin: 8px 0 6px; font-size: 20px; } .dy-end small { color: var(--muted); }
body.daily-open #card { display: none; }
body.daily-open .city { pointer-events: auto; }
@media (max-width: 760px) { #daily { left: 8px; right: 8px; top: 64px; width: auto; max-height: 46vh; } #daily-btn span { display: none; } }
body.daily-open #click-hint { display: none; }
#dy-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0 0 6px; }
#dy-in { flex: 1; min-width: 120px; height: 32px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--glass-hi); color: var(--text); font: inherit; }
#dy-msg { flex-basis: 100%; font-size: 12px; color: var(--accent); }

/* city against city */
.cmp-pick { display: flex; align-items: center; gap: 10px; margin: 10px 0 8px; } .cmp-pick span { color: var(--muted); font-size: 13px; }
.cmp-pick input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--glass-hi); color: var(--text); font: inherit; font-weight: 600; }
#cmp-out { overflow-y: auto; scrollbar-width: thin; }
.cmp-head, .cmp-row { display: grid; grid-template-columns: minmax(70px, 1fr) minmax(0, 2.2fr) minmax(70px, 1fr); gap: 10px; align-items: center; }
.cmp-head { font-size: 16px; padding: 2px 4px 8px; border-bottom: 1px solid var(--line); } .cmp-head b:first-child { text-align: right; color: var(--accent); } .cmp-head b:last-child { color: var(--accent2); }
.cmp-row { padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.cmp-row .va { text-align: right; } .cmp-row .hi { font-weight: 700; }
.cmp-row .mid { text-align: center; } .cmp-row .nm { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.cmp-row .bars { display: flex; height: 6px; background: var(--line); border-radius: 3px; position: relative; }
.cmp-row .bars i { position: absolute; top: 0; height: 100%; } .cmp-row .bars .l { right: 50%; background: var(--accent); border-radius: 3px 0 0 3px; } .cmp-row .bars .r { left: 50%; background: var(--accent2); border-radius: 0 3px 3px 0; }
.card-foot .btn { padding: 0 10px; }

/* language picker */
#lang { padding: 0 8px; font: inherit; font-size: 13px; color: var(--text); appearance: auto; max-width: 104px; }
body:not(.translated) #ld-lang-note { display: none; }
html:not([lang=en]) body { font-family: Inter, "Noto Sans Devanagari", "Noto Sans Tamil", "Noto Sans Bengali", system-ui, sans-serif; }
html:not([lang=en]) .ld-hero h1 { line-height: 1.18; letter-spacing: 0; }
@media (max-width: 760px) { #lang { max-width: 78px; } }
.zoomhint { color: var(--accent) !important; font-weight: 600; }

.uses-now { border-bottom: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.uses-now > span { display: block; padding: 6px 10px 0; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.uses-now .use { border-bottom: 0; background: transparent; }

/* After AI block and States view */
.aa-block { margin: 4px 0 10px; padding: 10px 11px 8px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--glass-hi); }
.aa-block h4 { margin: 10px 0 2px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.aa-lead { margin: 4px 0 0; font-size: 13px; line-height: 1.4; }
.use.aa > summary { grid-template-columns: minmax(0, 2.4fr) minmax(40px, 1fr); }
.use.aa .u-name i, .aa-chip i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: 1px; }
.u-more .tag { font-size: 8px; padding: 0 4px; }
.cx-tabs { display: flex; gap: 4px; margin: 10px 0 0; padding: 3px; border-radius: 10px; background: var(--glass-hi); border: 1px solid var(--line); width: max-content; }
.cx-tabs button { border: 0; background: transparent; color: var(--muted); padding: 5px 16px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; }
.cx-tabs button.on { background: var(--glass-solid); color: var(--text); font-weight: 600; }
#cx-states { overflow-y: auto; scrollbar-width: thin; margin-top: 6px; } #cx-states[hidden] { display: none; }
.st-list { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.use.st > summary { grid-template-columns: minmax(0, 1fr) auto; }
.aa-chip { display: inline-block; margin: 2px 8px 2px 0; font-size: 12px; color: var(--text); } .aa-chip small { color: var(--muted); }
.st-towns { margin: 8px 0 0; padding-left: 22px; columns: 2; column-gap: 18px; font-size: 12.5px; } .st-towns li { break-inside: avoid; padding: 2px 0; }
.st-towns span { display: block; color: var(--muted); font-size: 11px; }
@media (max-width: 760px) { .st-towns { columns: 1; } }
#cx-dir { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--glass-solid); color: var(--text); margin: 0 8px 6px 0; max-width: 100%; }
@media (max-width: 760px) { .use.st > summary { grid-template-columns: 1fr; gap: 2px; } .use.st .u-conf { text-align: left; white-space: normal; } }

/* ---------- soft error note (safety net) ---------- */
.soft-error { position: fixed; left: 50%; top: 78px; transform: translateX(-50%); z-index: 98; width: min(420px, calc(100vw - 32px)); box-sizing: border-box;
  display: flex; gap: 10px; align-items: center; background: var(--glass-solid); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.soft-error .icon { flex: none; }

/* ---------- solid panels when see-through glass would hurt reading ---------- */
/* Without background blur (some browsers, low-power modes) or when the reader asked for less transparency,
   map labels and tooltips would show sharply through the card and dossier. Use solid panels then. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, #card { background: var(--glass-solid); }
  #dossier { background: var(--bg); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, #card { background: var(--glass-solid); }
  #dossier { background: var(--bg); }
}
@media (max-width: 860px) {           /* phones: panels sit right over busy map labels, so no see-through */
  .glass { background: var(--glass-solid); }
  #card { background: var(--glass-solid); }
  #dossier { background: var(--bg); }
}

/* ---------- one-page place report: the dossier, printed ---------- */
.dos-btns { display: flex; gap: 8px; align-items: center; }
.dos-foot { max-width: 1240px; margin: 28px auto 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; border-top: 1px solid var(--line); padding-top: 10px; }
@media print {
  @page { margin: 12mm; }
  :root, :root[data-theme="dark"], :root[data-theme="light"] {     /* paper is white: always print in the light palette */
    color-scheme: light;
    --bg: #ffffff; --glass: #ffffff; --glass-solid: #ffffff; --glass-hi: rgba(0, 0, 0, 0.04);
    --line: rgba(10, 20, 40, 0.15); --line-strong: rgba(10, 20, 40, 0.3);
    --text: #121726; --muted: #4a5368; --faint: #7a8398;
    --accent: #c25414; --accent2: #1f6fb2; --border: #2a3247;
    --obs: #137a4b; --map: #2856a8; --pred: #8a3fb0; --interp: #8a6200; --shadow: none;
  }
  html, body { background: #fff !important; color: #111 !important; height: auto !important; overflow: visible !important; }
  body > *:not(#dossier) { display: none !important; }
  #dossier { position: static !important; inset: auto; overflow: visible !important; background: #fff !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; padding: 0 !important; }
  .dos-btns { display: none !important; }
  .dos-head h1 { font-size: 26px; }
  .dos-grid { display: block !important; margin-top: 8px; }
  .dos-side { margin-top: 12px; }
  .dos-main h2, .dos-side h2 { break-after: avoid; }
  svg, table, li, .use { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- place finder ("Fits you" tab) ---------- */
#cx-fit { overflow-y: auto; min-height: 0; flex: 1; }
.pf-size { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pf-size button, .pf-w button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.pf-size button.on, .pf-w button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.pf-factors { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin-bottom: 10px; }
.pf-f { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.pf-w { display: flex; gap: 3px; flex: none; }
.pf-w button { padding: 3px 8px; min-width: 28px; }
.pf-list { list-style: none; margin: 0; padding: 0; }
.pf-list > li { border-top: 1px solid var(--line); }
.pf-list summary { display: flex; align-items: center; gap: 10px; padding: 8px 2px; cursor: pointer; list-style: none; }
.pf-list summary::-webkit-details-marker { display: none; }
.pf-list .rk { width: 24px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pf-list .nm { flex: 1; min-width: 0; } .pf-list .nm small { display: block; color: var(--muted); font-size: 12px; }
.pf-score { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; } .pf-score small { font-size: 11px; color: var(--muted); font-weight: 400; }
.pf-why { margin: 0 0 6px 34px; padding: 0; list-style: none; font-size: 12.5px; line-height: 1.55; }
.pf-why li span { font-weight: 600; }
.pf-go { margin: 0 0 10px 34px; }
@media (max-width: 860px) { .pf-factors { grid-template-columns: 1fr; } }
.clip-note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
