/* Borders (UI adapted from India Hex): editorial UI. Hierarchy through type, whitespace and quiet background shifts;
   hairlines instead of boxes; one ochre accent. Tokens below; dark theme via [data-theme=dark]. */
:root {
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --paper: #f5f3ee;
  --paper-2: #ece8df;
  --paper-3: #e2dccf;
  --ink: #1b1a17;
  --ink-2: #4b473e;
  --ink-3: #857f73;
  --hair: rgba(27, 26, 23, 0.11);
  --hair-2: rgba(27, 26, 23, 0.2);
  --accent: #b7791f;
  --accent-ink: #8a5a12;
  --accent-wash: rgba(183, 121, 31, 0.12);
  --float: rgba(250, 249, 246, 0.93);
  --float-shadow: 0 10px 30px rgba(20, 18, 14, 0.12), 0 1px 2px rgba(20, 18, 14, 0.06);
  --up: #2f7a55;
  --down: #b4442f;
  --side-w: 392px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}
[data-theme="dark"] {
  --paper: #131417;
  --paper-2: #1b1d21;
  --paper-3: #25282d;
  --ink: #ece9e2;
  --ink-2: #bdb7ab;
  --ink-3: #8b867b;
  --hair: rgba(236, 233, 226, 0.1);
  --hair-2: rgba(236, 233, 226, 0.2);
  --accent: #e2aa4f;
  --accent-ink: #f0c47c;
  --accent-wash: rgba(226, 170, 79, 0.14);
  --float: rgba(22, 23, 27, 0.9);
  --float-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --up: #6cc59a;
  --down: #ef8a73;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--body); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "cv11" 1; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
svg { display: block; }

.app { display: grid; grid-template-columns: var(--side-w) 1fr; height: 100vh; height: 100dvh; overflow: hidden; transition: grid-template-columns .28s var(--ease); }

/* ------------------------------------------------------------------ side */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--paper); border-right: 1px solid var(--hair); position: relative; z-index: 5; }
.sheet-handle { display: none; }
.mast { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 6px; }
.wordmark { font-family: var(--display); font-size: 29px; line-height: 1; text-decoration: none; letter-spacing: -0.01em; }
.wordmark em { color: var(--accent); font-style: italic; }
.mast-actions { position: relative; }
.icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.icon:hover { background: var(--paper-2); color: var(--ink); }
.icon svg { width: 18px; height: 18px; fill: currentColor; }
.menu { position: absolute; right: 0; top: 40px; min-width: 220px; background: var(--paper); border: 1px solid var(--hair-2); border-radius: 12px; box-shadow: var(--float-shadow); padding: 6px; z-index: 30; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; text-align: left; text-decoration: none; font-size: 13.5px; }
.menu button:hover, .menu a:hover { background: var(--paper-2); }
.menu hr { border: 0; border-top: 1px solid var(--hair); margin: 6px 4px; }

.search { position: relative; margin: 10px 24px 6px; }
.search input { width: 100%; border: 0; border-bottom: 1px solid var(--hair-2); background: transparent; padding: 10px 28px 10px 26px; outline: none; font-size: 14.5px; }
.search input:focus { border-bottom-color: var(--accent); }
.search input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 0; top: 11px; width: 17px; height: 17px; color: var(--ink-3); }
.search kbd { position: absolute; right: 0; top: 9px; font: 11px var(--body); color: var(--ink-3); border: 1px solid var(--hair-2); border-radius: 4px; padding: 0 5px; }
.search-results { position: absolute; left: -10px; right: -10px; top: calc(100% + 6px); background: var(--paper); border: 1px solid var(--hair-2); border-radius: 12px; box-shadow: var(--float-shadow); max-height: 420px; overflow-y: auto; padding: 6px; z-index: 40; }
.sr { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; }
.sr:hover, .sr.on { background: var(--paper-2); }
.sr .t { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.sr .n { font-weight: 500; }
.sr .m { font-size: 12px; color: var(--ink-3); }
.sr mark { background: var(--accent-wash); color: inherit; border-radius: 2px; }
.sr-head { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px 4px; }
.sr-empty { padding: 18px; color: var(--ink-3); text-align: center; }

.crumbs { padding: 6px 24px 2px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 2px 6px; min-height: 26px; align-items: center; }
.crumbs button { letter-spacing: inherit; text-transform: inherit; color: var(--ink-2); }
.crumbs button:hover { color: var(--accent-ink); }
.crumbs .sep { opacity: .5; }

.panel { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 24px 40px; scroll-behavior: smooth; }
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb { background: var(--hair-2); border-radius: 4px; }

/* hero */
.kicker { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 14px 0 6px; }
.kicker b { color: var(--accent-ink); font-weight: 600; }
.title { font-family: var(--display); font-weight: 400; font-size: 46px; line-height: .98; letter-spacing: -0.015em; margin: 0; }
.title.small { font-size: 34px; }
.title.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 22px; letter-spacing: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.meta button { color: var(--ink); border-bottom: 1px solid var(--hair-2); }
.meta button:hover { border-color: var(--accent); color: var(--accent-ink); }
.meta span { color: var(--ink-3); }
.acts { display: flex; gap: 2px; margin: 14px 0 0 -8px; }
.acts .icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.acts .icon.on { color: var(--accent); }

/* lens block (value of the current variable for this place) */
.lensblock { margin-top: 22px; padding: 16px 0 6px; border-top: 1px solid var(--hair); }
.lensblock .lbl { font-size: 12.5px; color: var(--ink-2); }
.lensblock .big { font-family: var(--display); font-size: 48px; line-height: 1.05; letter-spacing: -0.01em; }
.lensblock .big small { font-family: var(--body); font-size: 13px; color: var(--ink-3); margin-left: 6px; letter-spacing: 0; }
.lensblock .rank { font-size: 12.5px; color: var(--ink-2); }
.hist { margin-top: 10px; }
.hist rect.on { fill: var(--accent); }

/* key figures */
.h2 { font-family: var(--display); font-size: 23px; font-weight: 400; margin: 28px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.h2 small { font-family: var(--body); font-size: 11.5px; color: var(--ink-3); }
.figs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
.fig { text-align: left; padding: 10px 0 12px; border-top: 1px solid var(--hair); position: relative; }
.fig:hover .fv { color: var(--accent-ink); }
.fig.on .fl { color: var(--accent-ink); }
.fig.on::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--accent); }
.fl { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); line-height: 1.3; }
.fv { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.fv small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.fd { font-size: 11.5px; margin-top: 1px; color: var(--ink-3); }
.up { color: var(--up); }
.down { color: var(--down); }
.lc { margin-top: 6px; }
.lc-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--paper-3); }
.lc-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--ink-2); margin-top: 8px; }
.lc-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }

/* hex band: a quiet background shift, full bleed */
.band { margin: 10px -24px 4px; padding: 6px 24px 18px; background: var(--paper-2); }
.band .close { float: right; margin-top: 10px; }

/* lists */
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--hair); margin-bottom: 4px; }
.tabs button { padding: 8px 0; font-size: 13px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs small { color: var(--ink-3); margin-left: 3px; }
.filter { width: 100%; border: 0; border-bottom: 1px solid var(--hair); background: transparent; padding: 9px 0; outline: none; font-size: 13px; margin-bottom: 4px; }
.filter:focus { border-bottom-color: var(--accent); }
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 28px 1fr auto; align-items: baseline; gap: 2px 8px; padding: 8px 6px; margin: 0 -6px; text-align: left; border-radius: 6px; position: relative; }
.row:hover { background: var(--paper-2); }
.row .rk { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .nm small { color: var(--ink-3); margin-left: 5px; font-size: 11.5px; }
.row .vl { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.row .br { grid-column: 2 / -1; height: 3px; border-radius: 2px; background: var(--paper-3); overflow: hidden; }
.row .br i { display: block; height: 100%; border-radius: 2px; }
.more { margin: 8px 0; color: var(--accent-ink); font-size: 13px; }
.jump { width: 100%; appearance: none; -webkit-appearance: none; border: 0; border-bottom: 1px solid var(--hair-2); border-radius: 0; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23857f73' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 2px center / 14px; padding: 10px 22px 10px 0; font-size: 14px; color: var(--ink); cursor: pointer; outline: none; }
.jump:focus { border-bottom-color: var(--accent); }
.jump option { color: #1b1a17; }
.fold { margin-top: 10px; }
.fold summary { cursor: pointer; font-size: 12.5px; color: var(--accent-ink); list-style: none; padding: 6px 0; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: " ▾"; }
.fold[open] summary::after { content: " ▴"; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.split h3 { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin: 6px 0 2px; }
.note { font-size: 12px; color: var(--ink-3); line-height: 1.5; margin: 14px 0 0; }
.lede { font-family: var(--display); font-size: 21px; line-height: 1.3; color: var(--ink-2); margin: 12px 0 0; }
.steps { margin: 18px 0 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; padding: 9px 0 9px 30px; border-top: 1px solid var(--hair); position: relative; font-size: 13.5px; color: var(--ink-2); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 7px; font-family: var(--display); font-size: 20px; color: var(--accent); }

/* comparison table */
.ctable { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.ctable th, .ctable td { padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--hair); font-variant-numeric: tabular-nums; }
.ctable th:first-child, .ctable td:first-child { text-align: left; }
.ctable thead th { font-weight: 500; color: var(--ink-2); vertical-align: bottom; }
.ctable td.best { color: var(--accent-ink); font-weight: 600; }

.pins { border-top: 1px solid var(--hair); padding: 10px 24px 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--paper); }
.pin { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; border: 1px solid var(--hair-2); border-radius: 999px; padding: 4px 6px 4px 10px; }
.pin button { width: 18px; height: 18px; border-radius: 50%; color: var(--ink-3); }
.pin button:hover { background: var(--paper-2); }
.pins .go { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--accent-ink); }

.textbtn { color: var(--accent-ink); font-size: 13px; border-bottom: 1px solid currentColor; }

/* ------------------------------------------------------------------ stage */
.stage { position: relative; min-width: 0; }
.map { position: absolute; inset: 0; background: #0d1117; }
.map-b { pointer-events: none; z-index: 1; }
.swipe { position: absolute; top: 0; bottom: 0; width: 0; z-index: 4; }
.swipe::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.swipe-grip { position: absolute; top: 50%; left: -16px; width: 32px; height: 32px; margin-top: -16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .3); cursor: ew-resize; touch-action: none; }
.swipe-grip::before, .swipe-grip::after { content: ""; position: absolute; top: 11px; border: 5px solid transparent; }
.swipe-grip::before { left: 3px; border-right-color: #333; }
.swipe-grip::after { right: 3px; border-left-color: #333; }

.float { background: var(--float); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--hair); border-radius: 14px; box-shadow: var(--float-shadow); }

.lens { position: absolute; left: 14px; top: 14px; width: 318px; max-height: calc(100% - 150px); display: flex; flex-direction: column; z-index: 5; background: var(--float); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--hair); border-radius: 14px; box-shadow: var(--float-shadow); }
.lens-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.lens-head svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .2s var(--ease); }
.lens.closed .lens-head svg { transform: rotate(-90deg); }
.lens.closed .lens-body { display: none; }
.lens-body { padding: 0 14px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 13px; }
.lab { font-size: 10px; letter-spacing: .11em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; display: flex; justify-content: space-between; gap: 8px; }
.lab span { letter-spacing: 0; text-transform: none; font-size: 11px; }
.seg { display: flex; gap: 2px; background: var(--paper-2); border-radius: 9px; padding: 2px; }
.seg button { flex: 1; padding: 6px 2px; border-radius: 7px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); font-weight: 600; }
[data-theme="dark"] .seg button.on { background: var(--paper-3); }
.seg button:disabled { opacity: .35; cursor: default; }
.seg button { position: relative; }
.seg button.shown::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.seg.sm button { font-size: 11px; padding: 4px 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 11.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--hair-2); color: var(--ink-2); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip:disabled { opacity: .35; cursor: default; }

/* lens bar: what the map is coloured by (top centre) */
.lensbar { position: absolute; top: 14px; left: calc(346px + (100% - 346px - 64px) / 2); transform: translateX(-50%); width: min(560px, calc(100% - 430px)); z-index: 6; background: var(--float); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--hair); border-radius: 14px; box-shadow: var(--float-shadow); }
.lb-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; flex-wrap: wrap; }
.var-btn { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-radius: 10px; flex: 1 1 auto; min-width: 0; text-align: left; }
.var-btn:hover { background: var(--paper-2); }
.var-btn .vk { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.var-btn .vv { font-family: var(--display); font-size: 21px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.var-btn svg { width: 14px; height: 14px; fill: none; stroke: var(--ink-3); stroke-width: 2; flex-shrink: 0; align-self: center; }
.lensbar.empty .vv { color: var(--accent-ink); }
.lensbar.empty { width: auto; }
.lensbar.empty .var-btn { flex: 0 0 auto; }
.lb-row .chips { flex-wrap: nowrap; }
.picker { position: absolute; left: 0; right: 0; top: calc(100% + 6px); border: 1px solid var(--hair-2); border-radius: 12px; background: var(--paper); max-height: min(420px, 60vh); overflow-y: auto; box-shadow: var(--float-shadow); z-index: 30; }
.picker input { position: sticky; top: 0; width: 100%; border: 0; border-bottom: 1px solid var(--hair); background: var(--paper); padding: 11px 14px; outline: none; font-size: 14px; }
.picker .g { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 10px 14px 3px; }
.picker button { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 7px 14px; font-size: 13.5px; }
.picker button:hover, .picker button.on { background: var(--paper-2); }
.picker button small { color: var(--ink-3); font-size: 11px; white-space: nowrap; }

.legend { padding: 2px 14px 8px; }
.legend .ramp { display: flex; height: 8px; border-radius: 3px; overflow: hidden; }
.legend .ramp i { flex: 1; }
.legend .ticks { display: flex; font-size: 10px; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.legend .ticks span { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; }
.legend .ticks span:first-child, .legend .ticks span:last-child { flex: .5; }
.legend .ticks span.end { color: var(--ink-2); font-weight: 600; }
.legend .ticks span:first-child { text-align: left; }
.legend .ticks span:last-child { text-align: right; }
.legend .lnote { font-size: 11px; color: var(--ink-3); margin-top: 3px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }
.legend .lnote.nodata { margin-top: 2px; padding: 7px 10px; border-radius: 8px; background: var(--paper-2); color: var(--ink-2); white-space: normal; cursor: default; }
.row2 { display: flex; align-items: center; gap: 10px; }
.row2 > :first-child { flex: 1; }
input[type=range] { accent-color: var(--accent); width: 100%; }
.slider { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--ink-3); }
.slider input { flex: 1; }

.drawer { border-top: 1px solid var(--hair); padding-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.drawer summary { cursor: pointer; font-size: 10px; letter-spacing: .11em; text-transform: uppercase; color: var(--ink-3); list-style: none; display: flex; justify-content: space-between; }
.drawer summary::-webkit-details-marker { display: none; }
.drawer[open] summary { margin-bottom: 6px; }
.tog { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); cursor: pointer; padding: 3px 0; }
.tog input { display: none; }
.tog i { width: 28px; height: 16px; border-radius: 8px; background: var(--hair-2); position: relative; transition: background .15s; flex-shrink: 0; }
.tog i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .18s var(--ease); }
.tog input:checked + i { background: var(--accent); }
.tog input:checked + i::after { transform: translateX(12px); }

.tools { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 5; }
.tgroup [data-tool="layers"] { display: none; }
.tgroup [data-tool="north"] svg { transition: transform .15s; }
.tgroup { display: flex; flex-direction: column; background: var(--float); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--hair); border-radius: 12px; box-shadow: var(--float-shadow); overflow: hidden; }
.tgroup button { width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink-2); }
.tgroup button + button { border-top: 1px solid var(--hair); }
.tgroup button:hover { background: var(--paper-2); color: var(--ink); }
.tgroup button.on { color: var(--accent); }
.tgroup svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tgroup .txt { font-size: 11px; font-weight: 700; letter-spacing: .02em; }

.bases { position: absolute; left: 14px; bottom: 28px; z-index: 5; display: flex; gap: 6px; align-items: center; }
.tabs-bm { display: flex; padding: 3px; gap: 2px; background: var(--float); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--hair); border-radius: 11px; box-shadow: var(--float-shadow); }
.tabs-bm button { padding: 7px 12px; border-radius: 8px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.tabs-bm button:hover { color: var(--ink); }
.tabs-bm button.on { background: var(--ink); color: var(--paper); }
.ov-wrap { position: relative; }
.ov-btn { padding: 9px 12px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); background: var(--float); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--hair); border-radius: 11px; box-shadow: var(--float-shadow); }
.ov-btn:hover { color: var(--ink); }
.ov-pop { position: absolute; bottom: calc(100% + 6px); left: 0; min-width: 190px; padding: 8px 12px; background: var(--paper); border: 1px solid var(--hair-2); border-radius: 12px; box-shadow: var(--float-shadow); }
.ov-pop .tog.dis { opacity: .4; cursor: default; }

.timeline { display: flex; align-items: center; gap: 8px; padding: 6px 10px 8px; border-top: 1px solid var(--hair); }
.timeline .play { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; flex-shrink: 0; }
.timeline .play svg { width: 13px; height: 13px; fill: currentColor; }
.years { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.years::-webkit-scrollbar { display: none; }
.years button { font-size: 12px; padding: 5px 7px; border-radius: 6px; color: var(--ink-3); font-variant-numeric: tabular-nums; position: relative; }
.years button:hover { color: var(--ink); }
.years button.on { color: var(--ink); font-weight: 700; }
.years button.on::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 1px; height: 2px; background: var(--accent); border-radius: 1px; }
.years button.from { color: var(--ink-2); font-weight: 600; }
.years button.from::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 1px; height: 2px; background: var(--ink-3); border-radius: 1px; }
.years button.span { color: var(--ink-2); }

.compare-bar { position: absolute; top: auto; bottom: 80px; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; background: var(--float); backdrop-filter: blur(12px); border: 1px solid var(--hair); border-radius: 999px; box-shadow: var(--float-shadow); font-size: 12px; }
.compare-bar select { border: 1px solid var(--hair-2); border-radius: 999px; background: var(--paper); padding: 3px 8px; font-size: 12px; max-width: 190px; }
.compare-bar .x { width: 22px; height: 22px; border-radius: 50%; color: var(--ink-3); }
.compare-bar .x:hover { background: var(--paper-2); }
.side-tag { position: absolute; top: 60px; z-index: 4; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; background: var(--float); padding: 4px 9px; border-radius: 999px; border: 1px solid var(--hair); color: var(--ink-2); pointer-events: none; }

.toast { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 8; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 999px; font-size: 12.5px; display: flex; gap: 8px; align-items: center; max-width: 60%; box-shadow: var(--float-shadow); }
.toast .spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }
.tip { position: absolute; z-index: 9; pointer-events: none; background: var(--paper); color: var(--ink); border: 1px solid var(--hair-2); padding: 8px 10px; border-radius: 10px; font-size: 12px; max-width: 340px; line-height: 1.4; box-shadow: var(--float-shadow); }
.tip .t1 { font-weight: 600; }
.tip .t2 { opacity: .7; font-size: 11px; }
.tip .t3 { margin-top: 3px; font-variant-numeric: tabular-nums; }
.tip .t3 b { color: var(--accent); }
.tip .t3 { border-top: 1px solid var(--hair); padding-top: 4px; margin-top: 5px; color: var(--ink-2); }
.tip .t3 b { color: var(--accent-ink); }

.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-bottom-right { right: 8px; }
.maplibregl-ctrl-scale { background: transparent; border-color: rgba(0, 0, 0, .45); font-size: 10px; }

/* ------------------------------------------------------------------ mobile: bottom sheet */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .stage { grid-row: 1; grid-column: 1; }
  .side { grid-row: 1; grid-column: 1; position: fixed; left: 0; right: 0; bottom: 0; height: 48vh; height: 48dvh; border-right: 0; border-top: 1px solid var(--hair); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .18); transition: height .28s var(--ease); z-index: 20; }
  .side.peek { height: 132px; }
  .side.full { height: 90vh; height: 90dvh; }
  .sheet-handle { display: flex; justify-content: center; padding: 8px 0 0; cursor: grab; touch-action: none; }
  .sheet-handle span { width: 40px; height: 4px; border-radius: 2px; background: var(--hair-2); }
  .mast { padding: 6px 18px 0; }
  .wordmark { font-size: 24px; }
  .search, .crumbs { margin-left: 18px; margin-right: 18px; padding-left: 0; padding-right: 0; }
  .panel { padding: 4px 18px 120px; }
  .title { font-size: 38px; }
  .band { margin: 10px -18px 4px; padding: 6px 18px 18px; }
  .lensbar { left: 10px; right: 58px; top: 10px; transform: none; width: auto; }
  .var-btn .vv { font-size: 18px; }
  .lb-row { padding: 4px 6px; }
  .lens { left: 10px; top: auto; bottom: calc(48dvh + 58px); width: calc(100% - 68px); max-width: 360px; max-height: 50%; }
  .app:has(.side.peek) .lens { bottom: 190px; }
  .lens.closed { display: none; }
  .lens-head { display: none; }
  .lens .lens-body { padding-top: 12px; }
  .tools { right: 10px; top: 10px; gap: 6px; }
  .tgroup [data-tool="layers"] { display: grid; }
  .tgroup [data-tool="zin"], .tgroup [data-tool="zout"], .tgroup [data-tool="full"], .tgroup [data-tool="png"] { display: none; }
  .tgroup button { width: 36px; height: 36px; }
  .bases { left: 10px; right: 58px; bottom: calc(48dvh + 10px); }
  .app:has(.side.peek) .bases { bottom: 142px; }
  .tabs-bm button { padding: 7px 9px; font-size: 10.5px; }
  .toast { bottom: calc(48dvh + 64px); max-width: 86%; }
  .app:has(.side.peek) .toast { bottom: 196px; }
  .compare-bar { top: auto; bottom: calc(48dvh + 64px); }
}

/* ------------------------------------------------------------------ Borders */
.vkey { display: inline-block; width: 22px; height: 8px; vertical-align: middle; margin-right: 6px; flex-shrink: 0; }
.lb-row .seg.ver { flex: 3 1 auto; }
.lb-row .seg.lvl { flex: 1.6 1 auto; }
.lb-row .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 0; padding: 7px 6px; }
.vnote { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-3); padding: 0 12px 6px; line-height: 1.35; }
.swipe-note { flex: 3 1 auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); padding: 4px 6px; }
.swipe-note b { color: var(--ink); font-weight: 600; }
.swipe-note .sep { opacity: .4; }
.swipe-note .swipe-x { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; color: var(--ink-3); }
.swipe-note .swipe-x:hover { background: var(--paper-2); }
.side-tag { display: flex; align-items: center; top: 120px; }
.hint { font-size: 11px; color: var(--ink-3); margin-top: 5px; line-height: 1.35; }
.years button sup { font-size: 8px; margin-left: 1px; color: var(--ink-3); }

.tip .trow { display: grid; grid-template-columns: 62px 1fr; gap: 8px; align-items: baseline; padding: 2px 0; }
.tip .trow + .trow { border-top: 1px solid var(--hair); margin-top: 3px; padding-top: 5px; }
.tip .vtag { display: flex; align-items: center; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--ink-2); white-space: nowrap; }
.tip .vtag em { font-style: normal; color: var(--ink-3); margin-left: 3px; }
.tip .tv-ac { display: block; font-weight: 600; }
.tip .tv-pc { display: block; font-size: 11.5px; color: var(--ink-2); }
.tip small { color: var(--ink-3); font-weight: 500; }
.tip .t2 { color: var(--ink-3); font-weight: 400; }

.badge { display: inline-block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--hair-2); border-radius: 999px; padding: 1px 7px; margin-left: 8px; vertical-align: 2px; }
.rtag { font-family: var(--body); font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 6px; padding: 1px 6px; margin-left: 10px; vertical-align: 10px; }
.alt { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.alt b { color: var(--ink-2); font-weight: 500; }
.meta .plain { color: var(--ink); }
.lede-s { font-size: 13px; color: var(--ink-2); margin: -4px 0 6px; }

.vcards { display: flex; flex-direction: column; margin-top: 18px; }
.vcard { padding: 12px 0; border-top: 1px solid var(--hair); }
.vhead { display: flex; align-items: center; }
.vname { font-family: var(--display); font-size: 22px; }
.vlong { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.vfacts { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.vwarn { font-size: 12px; color: var(--ink-2); margin-top: 6px; padding: 6px 9px; background: var(--paper-2); border-radius: 8px; }
.vsrc { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.vsrc summary { cursor: pointer; color: var(--accent-ink); }
.vsrc ul { margin: 6px 0 0; padding-left: 16px; }
.tabs .tabs-gap { flex: 1; }
.tabs button { display: inline-flex; align-items: center; }

.lrows { display: flex; flex-direction: column; }
.lrow { display: grid; grid-template-columns: 34px 1fr auto; gap: 1px 8px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--hair); }
.lrow .rk { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.lrow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .nm small { color: var(--ink-3); margin-left: 4px; }
.lrow .vl { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.lrow .br { grid-column: 2 / -1; height: 3px; border-radius: 2px; background: var(--paper-3); overflow: hidden; }
.lrow .br i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.lrow .sub { grid-column: 2 / -1; font-size: 11px; color: var(--ink-3); }
.nm-btn { color: var(--ink); border-bottom: 1px solid var(--hair-2); text-align: left; }
.nm-btn:hover { color: var(--accent-ink); border-color: var(--accent); }
.note.warn { color: var(--ink-2); background: var(--paper-2); border-radius: 8px; padding: 8px 10px; }
.note.src { margin-top: 22px; }

.hrows { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.hrow { display: grid; grid-template-columns: 104px 1fr; gap: 8px; font-size: 13px; align-items: baseline; }
.hrow .vtag { display: flex; align-items: center; font-size: 11px; color: var(--ink-3); }
.hrow button { border-bottom: 1px solid var(--hair-2); }
.hrow button:hover { color: var(--accent-ink); border-color: var(--accent); }
.figs.pop5 { grid-template-columns: repeat(3, 1fr); column-gap: 14px; }
.figs.pop5 .fv { font-size: 16px; }

@media (max-width: 820px) {
  .lb-row .seg button { padding: 6px 3px; font-size: 11px; }
  .vkey { width: 16px; margin-right: 4px; }
  .side-tag { top: 112px; }
}
.tip small.caution { color: var(--down); font-weight: 600; letter-spacing: .02em; }
.hrow button { display: inline; text-align: left; }

/* collapsible side panel (desktop) */
.app.side-off { grid-template-columns: 0 1fr; }
.app.side-off .side { visibility: hidden; }
.side-open { display: none; position: absolute; left: 14px; bottom: 82px; z-index: 6; align-items: center; gap: 4px; padding: 8px 12px 8px 8px; border-radius: 11px; background: var(--float); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--hair); box-shadow: var(--float-shadow); color: var(--ink-2); font-family: var(--display); font-size: 17px; }
.side-open svg { width: 18px; height: 18px; }
.side-open:hover { color: var(--ink); }
.app.side-off .side-open { display: inline-flex; }
.side-toggle svg { fill: none; }

/* colour pickers */
.ramps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.rampbtn { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 4px; border-radius: 7px; border: 1px solid transparent; font-size: 10px; color: var(--ink-3); text-align: left; }
.rampbtn .sw { display: block; height: 9px; border-radius: 3px; }
.rampbtn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rampbtn:hover { color: var(--ink); background: var(--paper-2); }
.rampbtn.on { border-color: var(--accent); color: var(--ink); }
.chip.mini { font-size: 10.5px; padding: 1px 8px; letter-spacing: 0; text-transform: none; }
.lab .chip.mini { margin-left: auto; }
.spark { margin-top: 6px; }
.lens { max-height: calc(100% - 120px); }

@media (max-width: 820px) {
  .side-toggle, .side-open { display: none !important; }
  .ramps { grid-template-columns: repeat(4, 1fr); }
}
.mast-actions { display: flex; align-items: center; gap: 2px; }
.mast-actions .menu { top: 40px; }

/* status bar (bottom right, as in Google Earth): scale, camera height, pointer coordinates */
.statusbar { position: absolute; right: 38px; bottom: 6px; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 4px 10px; border-radius: 8px; background: rgba(12, 13, 16, .72); color: #f2efe8; font-size: 11.5px; font-variant-numeric: tabular-nums; pointer-events: auto; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); white-space: nowrap; }
.sb-scale { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.sb-scale span { font-size: 10.5px; line-height: 1; }
.sb-scale i { display: block; height: 5px; border: 1.5px solid #f2efe8; border-top: 0; min-width: 20px; transition: width .15s; }
.sb-cam { opacity: .85; }
.sb-coords { color: inherit; font: inherit; letter-spacing: .01em; cursor: pointer; }
.sb-coords:hover { color: #f2c46d; }
.sb-coords.dim { opacity: .65; }
.maplibregl-ctrl-bottom-right { right: 2px; }
.app.side-off .statusbar { right: 38px; }
.coords { font-size: 12px; color: var(--ink-2); margin-top: 4px; font-variant-numeric: tabular-nums; }
.coords small { color: var(--ink-3); margin-left: 4px; }

/* ruler */
.measure-card { position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 14px; border-radius: 12px; background: var(--float); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--hair); box-shadow: var(--float-shadow); width: max-content; max-width: calc(100% - 24px); }
.mc-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.mc-text b { font-family: var(--display); font-size: 21px; font-weight: 400; line-height: 1.1; white-space: nowrap; }
.mc-text span { font-size: 11.5px; color: var(--ink-3); }
.mc-acts { display: flex; gap: 4px; flex-shrink: 0; }
.mc-acts button { font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--hair-2); color: var(--ink-2); }
.mc-acts button:hover:not(:disabled) { color: var(--ink); border-color: var(--ink-3); }
.mc-acts button:disabled { opacity: .35; cursor: default; }
.mc-acts button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

@media (max-width: 820px) {
  .statusbar { right: 10px; bottom: calc(48dvh + 56px); gap: 10px; font-size: 10.5px; padding: 3px 8px; }
  .app:has(.side.peek) .statusbar { bottom: 186px; }
  .sb-cam { display: none; }
  .measure-card { bottom: calc(48dvh + 90px); }
  .app:has(.side.peek) .measure-card { bottom: 220px; }
  .mc-text b { font-size: 18px; }
  .measure-card { flex-wrap: wrap; gap: 6px 12px; }
  .mc-acts button { padding: 6px 9px; }
}

/* state picker (landing panel) */
.statepick { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; font-size: 12px; color: var(--ink-3); }
.statepick span { text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; }
.statepick select { flex: 1; min-width: 0; font: inherit; font-size: 14px; color: var(--ink); background: var(--paper-2, transparent); border: 1px solid var(--hair-2); border-radius: 8px; padding: 7px 10px; cursor: pointer; }
.statepick select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.statepick small { white-space: nowrap; }

/* state button (breadcrumb) and state list */
.crumbs .statechip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px 5px 10px; margin-left: -10px; border-radius: 999px; border: 1px solid var(--hair-2); color: var(--ink); font-size: 11.5px; letter-spacing: .08em; }
.crumbs .statechip svg { width: 15px; height: 15px; }
.crumbs .statechip:hover { border-color: var(--accent); color: var(--accent-ink); }
.statedlg { position: fixed; inset: 0; z-index: 60; background: rgba(8, 9, 12, .55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.statedlg[hidden] { display: none; }
.sd-box { width: min(440px, 100%); max-height: min(640px, 86vh); display: flex; flex-direction: column; background: var(--paper); color: var(--ink); border: 1px solid var(--hair); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); overflow: hidden; }
.sd-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 20px; font-family: var(--display); font-size: 22px; }
.sd-head b { font-weight: 400; }
.sd-filter { margin: 4px 20px 8px; padding: 9px 2px; border: 0; border-bottom: 1px solid var(--hair); background: transparent; color: var(--ink); font-size: 15px; outline: none; }
.sd-filter:focus { border-bottom-color: var(--accent); }
.sd-list { overflow-y: auto; padding: 4px 8px 12px; -webkit-overflow-scrolling: touch; }
.sd-row { display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%; text-align: left; padding: 11px 12px; border-radius: 10px; gap: 2px 10px; }
.sd-row:hover, .sd-row:focus-visible { background: var(--paper-2); }
.sd-row.on { background: var(--paper-2); }
.sd-name { font-size: 15.5px; color: var(--ink); }
.sd-name small { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin-left: 6px; }
.sd-maps { grid-column: 1; font-size: 12px; color: var(--ink-3); }
.sd-here { grid-column: 2; grid-row: 1 / span 2; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-ink); }
.sd-empty { padding: 16px 12px; color: var(--ink-3); font-size: 13px; }

@media (max-width: 820px) {
  /* a bigger handle, swipeable; the header swipes too */
  .sheet-handle { padding: 10px 0 8px; }
  .sheet-handle span { width: 48px; height: 5px; }
  .side .mast, .side .crumbs, .sheet-handle { touch-action: none; }
  /* collapsed sheet: room for the state button */
  .side.peek { height: calc(170px + env(safe-area-inset-bottom, 0px)); }
  .app:has(.side.peek) .lens { bottom: calc(228px + env(safe-area-inset-bottom, 0px)); }
  .app:has(.side.peek) .bases { bottom: calc(180px + env(safe-area-inset-bottom, 0px)); }
  .app:has(.side.peek) .toast { bottom: calc(234px + env(safe-area-inset-bottom, 0px)); }
  .app:has(.side.peek) .statusbar { bottom: calc(224px + env(safe-area-inset-bottom, 0px)); }
  .app:has(.side.peek) .measure-card { bottom: calc(258px + env(safe-area-inset-bottom, 0px)); }
  .statedlg { align-items: flex-end; padding: 0; }
  .sd-box { width: 100%; max-height: 82dvh; border-radius: 18px 18px 0 0; }
  .sd-row { padding: 13px 12px; }
}

/* "Map shows" picker (V1) */
.ms-cur { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; padding: 7px 10px; border: 1px solid var(--hair-2); border-radius: 8px; background: var(--paper); color: var(--ink); cursor: pointer; text-align: left; font: inherit; }
.ms-cur:hover { border-color: var(--ink-3); }
.ms-cur .ms-txt b { font-weight: 600; }
.ms-cur .ms-txt em { font-style: normal; color: var(--ink-3); font-size: 11px; margin-left: 7px; }
.ms-cur .ms-chev { color: var(--ink-3); transition: transform .15s; }
.ms-cur.open .ms-chev { transform: rotate(180deg); }
.ms-list { margin-top: 5px; border: 1px solid var(--hair-2); border-radius: 8px; padding: 4px; max-height: 280px; overflow: auto; }
.ms-filter { width: 100%; box-sizing: border-box; margin: 2px 0 4px; padding: 5px 8px; border: 1px solid var(--hair-2); border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 12px; }
.ms-grp { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 7px 7px 2px; }
.ms-row { display: block; width: 100%; text-align: left; padding: 5px 7px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; font: inherit; }
.ms-row b { display: block; font-weight: 600; font-size: 12.5px; }
.ms-row span { display: block; font-size: 11px; color: var(--ink-3); line-height: 1.3; margin-top: 1px; }
.ms-row:hover { background: var(--paper-2); }
.ms-row.on { background: var(--accent-wash); }
.ms-row.on b::after { content: " ✓"; color: var(--accent-ink); }

/* "Show more" in the side panel (L1) */
.showmore { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin: 16px 0 4px; padding: 8px 11px; border: 1px solid var(--hair-2); border-radius: 8px; background: transparent; color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: left; }
.showmore small { font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.showmore:hover { background: var(--paper-2); }
.showmore.on { border-style: dashed; }
.moreinfo { border-left: 2px solid var(--hair-2); padding-left: 10px; margin-top: 4px; }

/* collapsible panels (P1, P2): a fold button on each panel, a slim titled tab when folded */
.fold-btn { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); cursor: pointer; flex-shrink: 0; }
.fold-btn svg { width: 14px; height: 14px; }
.fold-btn:hover { color: var(--ink); background: var(--paper-2); }
.ftab { display: none; align-items: center; gap: 6px; padding: 6px 9px 6px 11px; border-radius: 10px; border: 1px solid var(--hair); background: var(--float); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--float-shadow); color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; max-width: 100%; }
.ftab span { overflow: hidden; text-overflow: ellipsis; }
.ftab svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--ink-3); }
.ftab:hover { color: var(--ink); }
.folded > *:not(.ftab) { display: none !important; }
.folded > .ftab { display: inline-flex; }
.lensbar > .fold-btn { position: absolute; top: 9px; right: 7px; }
.lensbar .lb-row { padding-right: 32px; }
.lensbar.folded { width: auto; max-width: calc(100% - 430px); background: transparent; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.tools > .fold-btn { width: 36px; height: 20px; margin: 0 auto; background: var(--float); border: 1px solid var(--hair); box-shadow: var(--float-shadow); }
.tools.folded { align-items: flex-end; }
.bases > .fold-btn { background: var(--float); border: 1px solid var(--hair); height: 28px; width: 24px; }
.statusbar > .fold-btn { width: 18px; height: 18px; color: inherit; opacity: .7; margin-left: -6px; }
.statusbar > .fold-btn:hover { background: rgba(255,255,255,.12); opacity: 1; color: inherit; }
.statusbar.folded { padding: 0; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.statusbar .ftab { font-size: 11px; padding: 3px 7px 3px 9px; }
.tgroup [data-tool="clean"].on { color: var(--accent-ink); }

/* clean map: every panel away, one button to bring them back */
.app.clean { grid-template-columns: 0 1fr; }
.app.clean .side { visibility: hidden; }
.app.clean .lensbar, .app.clean .lens, .app.clean .tools, .app.clean .bases, .app.clean .statusbar, .app.clean .side-open, .app.clean .compare-bar, .app.clean .measure-card { display: none !important; }
.clean-exit { position: absolute; left: 14px; bottom: 28px; z-index: 8; display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px 8px 10px; border-radius: 11px; border: 1px solid var(--hair); background: var(--float); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--float-shadow); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.clean-exit[hidden] { display: none; }
.clean-exit svg { width: 17px; height: 17px; }
.clean-exit:hover { color: var(--ink); }

@media (max-width: 820px) {
  .lensbar.folded { right: auto; max-width: calc(100% - 68px); }
  .lensbar.folded .ftab { font-size: 12.5px; padding: 8px 10px 8px 12px; }
  .lensbar > .fold-btn { top: 6px; right: 5px; }
  .app.clean .side { display: none; }
  .clean-exit { left: 50%; transform: translateX(-50%); bottom: calc(22px + env(safe-area-inset-bottom, 0px)); padding: 10px 16px 10px 12px; font-size: 13.5px; }
  .tools > .fold-btn { display: none; }
}

/* election results card (R1) */
.rcard { margin-top: 18px; }
.ryears { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.ryears .rh { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); width: 76px; }
.ryears button { padding: 3px 9px; border-radius: 7px; border: 1px solid var(--hair-2); background: transparent; color: var(--ink-2); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; }
.ryears button:hover { color: var(--ink); border-color: var(--ink-3); }
.ryears button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.rkind { font-size: 12px; color: var(--ink-3); margin: 10px 0 8px; }
.rwin { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 10px; }
.rwin > i { width: 6px; align-self: stretch; border-radius: 3px; flex-shrink: 0; }
.rwin b { font-weight: 600; }
.rwin .rp { font-size: 12px; color: var(--ink-2); margin-left: 4px; font-weight: 600; }
.rwin .rm { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.rrows { display: flex; flex-direction: column; gap: 7px; }
.rrow { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; row-gap: 2px; }
.rrow .rn { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .rn small { color: var(--ink-3); font-size: 11px; margin-left: 3px; }
.rrow .rv { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rrow .br { grid-column: 1 / -1; height: 5px; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.rrow .br i { display: block; height: 100%; border-radius: 3px; }
.rrow .sub { grid-column: 1 / -1; font-size: 11px; color: var(--ink-3); }
.rfacts { display: flex; gap: 18px; margin-top: 12px; font-variant-numeric: tabular-nums; font-size: 13px; }
.rfacts small { display: block; font-size: 10.5px; color: var(--ink-3); letter-spacing: .05em; text-transform: uppercase; }
.rsrc { margin-top: 10px; }

/* side panel width by drag (W1); .side is already position: relative on desktop */
.side-resize { position: absolute; top: 0; right: -5px; width: 10px; height: 100%; cursor: col-resize; z-index: 30; touch-action: none; }
.side-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: transparent; transition: background .15s; }
.side-resize:hover::after, body.resizing .side-resize::after { background: var(--accent); }
body.resizing { cursor: col-resize; user-select: none; }
.app.side-off .side-resize { display: none; }
@media (max-width: 820px) { .side-resize { display: none; } }
body.resizing .app { transition: none; }
.rtag-inc { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 5px; border: 1px solid var(--hair-2); font-size: 10.5px; color: var(--ink-3); vertical-align: 1px; }
.nat-title { display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-size: 13px; }
.nat-title b { font-family: var(--display); font-size: 20px; font-weight: 400; }
.nat-title span { color: var(--ink-3); font-size: 12px; }

/* results: Top 3 | 4 | 5 (U5) */
.rhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rtop { display: inline-flex; gap: 2px; font-family: var(--body); }
.rtop button { padding: 1px 8px; border-radius: 6px; border: 1px solid var(--hair-2); background: transparent; color: var(--ink-3); font: inherit; font-size: 11.5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.rtop button:hover { color: var(--ink); }
.rtop button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* results colouring (Feature 7): the card's button, the legend line, the tooltip block */
.rtools { display: inline-flex; align-items: center; gap: 8px; }
.rcol { display: grid; place-items: center; width: 26px; height: 24px; padding: 0; border-radius: 6px; border: 1px solid var(--hair-2); background: transparent; color: var(--ink-3); cursor: pointer; }
.rcol svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.rcol:hover { color: var(--ink); }
.rcol.on { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.rleg { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 4px 8px 6px; font-size: 12px; }
.rl-name { font-weight: 600; color: var(--ink); white-space: nowrap; }
.rl-by button { padding: 3px 9px; font-size: 11px; }
.rl-chips { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.rl-chip { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); white-space: nowrap; }
.rl-chip i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.rl-chip b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.rl-chip.more { color: var(--ink-3); }
.rl-shade.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.rl-x { margin-left: auto; padding: 2px 6px; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 13px; }
.rl-x:hover { color: var(--ink); }
.rtip .rtl { font-weight: 600; }
.rtip .rtw { margin-top: 2px; }
.rtip .rtw i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.rtip .rtm { color: var(--ink-3); font-variant-numeric: tabular-nums; }
/* Feature 5: an older map's year buttons take its dashed style; the bridge line to the other map's winner */
.ryears.old button { border-style: dashed; }
.lrow .bridge { margin-left: 6px; color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.lrow .bridge i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }

/* the landing's Lok Sabha years (Feature 7, phase 2): a year held on the older maps takes their dashed style */
.ryears button.old { border-style: dashed; }
.ryears.nat { margin: 4px 0 10px; }
