:root {
  --ink: #142b33;
  --ink-2: #3d5660;
  --muted: #6b8089;
  --line: #dde4e3;
  --line-2: #c9d4d3;
  --paper: #fbfaf7;
  --panel: rgba(251, 250, 247, 0.96);
  --sea: #1f5f7a;
  --teal: #1f6f6b;
  --teal-soft: #e3efec;
  --amber: #c97b2a;
  --focus: #e8590c;
  --shadow: 0 1px 2px rgba(20, 43, 51, .08), 0 8px 28px rgba(20, 43, 51, .12);
  --radius: 14px;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --top: 58px;
  --left-w: 340px;
  --right-w: 410px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #dfe9ee; color: var(--ink); font: 14px/1.45 var(--sans); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--sea); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }

/* ---------- top bar ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 30;
  display: flex; align-items: center; gap: 18px; padding: 0 16px;
  background: #102a33; color: #eef5f4;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; color: #7fd1c3; }
.brand span { font-family: var(--serif); font-size: 19px; }
.brand b { font-weight: 600; }
.modes { display: flex; gap: 4px; margin-left: 12px; }
.modes button {
  background: none; border: 0; color: #b9cdcc; padding: 8px 14px; border-radius: 999px; font-weight: 500;
}
.modes button:hover { color: #fff; background: rgba(255,255,255,.08); }
.modes button[aria-pressed="true"] { background: #e9f4f1; color: #102a33; }
.modes .short { display: none; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.top .btn.ghost { color: #dce9e8; border-color: rgba(255,255,255,.25); }
.top .btn.ghost:hover { background: rgba(255,255,255,.1); }

/* ---------- map ---------- */
#map { position: fixed; inset: var(--top) 0 0 0; }
.maplibregl-ctrl-group { border-radius: 10px !important; box-shadow: var(--shadow) !important; }
body[data-mode="explore"] .maplibregl-ctrl-top-right,
body[data-mode="cases"] .maplibregl-ctrl-top-right,
body[data-mode="systems"] .maplibregl-ctrl-top-right { margin-right: calc(var(--right-w) + 16px); }
body[data-mode="explore"] .maplibregl-ctrl-bottom-right,
body[data-mode="cases"] .maplibregl-ctrl-bottom-right,
body[data-mode="systems"] .maplibregl-ctrl-bottom-right { margin-right: calc(var(--right-w) + 16px); }
body[data-mode="explore"] .maplibregl-ctrl-bottom-left,
body[data-mode="cases"] .maplibregl-ctrl-bottom-left,
body[data-mode="systems"] .maplibregl-ctrl-bottom-left { margin-left: calc(var(--left-w) + 16px); }
.maplibregl-popup-content { border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; font: 13px/1.4 var(--sans); }

/* ---------- panels ---------- */
.panel {
  position: fixed; top: calc(var(--top) + 12px); bottom: 12px; z-index: 20;
  background: var(--panel); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.7); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.panel.left { left: 12px; width: var(--left-w); padding: 16px; }
.panel.right { right: 12px; width: var(--right-w); display: flex; flex-direction: column; overflow: hidden; }
.panel.right.wide { width: min(720px, calc(100vw - var(--left-w) - 48px)); }
body[data-mode="about"] .panel { display: none; }
.sheet-toggle { display: none; }
.sheet-close { display: none !important; }

.section { padding: 14px 0; border-top: 1px solid var(--line); }
.section:first-child, .sheet-close + .section { border-top: 0; padding-top: 0; }
.label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px;
  border: 1px solid var(--line-2); background: #fff; font-weight: 500; font-size: 13px; white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { border-color: var(--teal); }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.primary:hover { background: #185b58; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--sea); text-decoration: underline; text-underline-offset: 2px; font-size: 12.5px; }

/* search */
.search { position: relative; }
.search input {
  width: 100%; padding: 10px 12px 10px 36px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff;
}
.search input:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px rgba(31,111,107,.15); }
.search svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: var(--muted); }
.search kbd { position: absolute; right: 10px; top: 9px; font: 11px var(--sans); color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; background: var(--paper); }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); z-index: 5; overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; }
.suggest button:hover, .suggest button.active { background: var(--teal-soft); }
.suggest small { color: var(--muted); display: block; font-size: 12px; }

.counter { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 2px; }
.counter b { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; }
.counter span { color: var(--muted); font-size: 13px; }
.bar-total { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar-total i { display: block; height: 100%; background: var(--teal); border-radius: 3px; transition: width .35s ease; }

/* segmented + chips */
.seg { display: inline-flex; background: #eef2f1; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 7px; font-size: 13px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: #fff; font-size: 12.5px; color: var(--ink-2);
}
.chip:hover { border-color: var(--teal); }
.chip[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip .n { font-size: 11px; opacity: .7; }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; }
.check { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--teal); width: 15px; height: 15px; }
select.sel { width: 100%; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row2 label span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* legend */
.legend { display: grid; gap: 2px; margin-top: 10px; }
.legend button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 6px; border: 0; background: none; border-radius: 7px; text-align: left; font-size: 13px;
}
.legend button:hover { background: #eef2f1; }
.legend button.off { opacity: .38; text-decoration: line-through; }
.legend .sw { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.legend .sq { border-radius: 3px; }
.legend .n { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.size-legend { display: flex; align-items: flex-end; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 11.5px; }
.size-legend div { display: grid; justify-items: center; gap: 4px; }
.size-legend i { display: block; border-radius: 50%; border: 1.5px solid var(--ink-2); }

/* ---------- right panel tabs ---------- */
.tabs { display: flex; gap: 2px; padding: 10px 10px 0; border-bottom: 1px solid var(--line); flex: none; }
.tabs button { border: 0; background: none; padding: 9px 9px; border-radius: 9px 9px 0 0; color: var(--muted); font-weight: 600; font-size: 13px; position: relative; }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--teal); border-radius: 2px; }
.tabs .spacer { flex: 1; }
.tabs .icon { padding: 6px 8px; color: var(--muted); }
.tabbody { flex: 1; overflow-y: auto; padding: 16px; scrollbar-width: thin; }

/* entry card */
.kicker { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); }
.entry-title { font-size: 26px; line-height: 1.15; margin: 6px 0 4px; }
.entry-sub { color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #eef2f1; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.tag .sw { width: 8px; height: 8px; border-radius: 50%; }
.tag.warn { background: #fdf0dc; color: #8a5300; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 4px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }
.ranks { display: grid; gap: 4px; }
.rankrow { display: grid; grid-template-columns: 112px 1fr 56px; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; border: 0; background: none; text-align: left; width: 100%; font-size: 12.5px; }
.rankrow:hover { background: #eef2f1; }
.rankrow .track { position: relative; height: 8px; background: linear-gradient(90deg, #1f6f6b0a, #1f6f6b45); border-radius: 4px; }
.rankrow .track i { position: absolute; top: -3px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--teal); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--teal); }
.rankrow .r { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.rankrow .r b { color: var(--ink); }
dl.facts { display: grid; grid-template-columns: 112px 1fr; gap: 6px 12px; margin: 8px 0 0; font-size: 13px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.similar { display: grid; gap: 4px; }
.similar button, .listrow {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; width: 100%; text-align: left;
  border: 0; background: none; padding: 7px 8px; border-radius: 8px;
}
.similar button:hover, .listrow:hover, .listrow.hl { background: #eef2f1; }
.similar small, .listrow small { color: var(--muted); font-size: 12px; grid-column: 1; }

/* rankings */
.axisgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.axisgrid button { border: 1px solid var(--line-2); background: #fff; border-radius: 10px; padding: 7px 8px; text-align: left; font-size: 12.5px; line-height: 1.25; }
.axisgrid button b { display: block; font-size: 11px; color: var(--muted); }
.axisgrid button[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); box-shadow: inset 0 0 0 1px var(--teal); }
.weights { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.weights label { display: grid; grid-template-columns: 1fr 120px 28px; gap: 8px; align-items: center; font-size: 12.5px; padding: 3px 0; }
.weights input[type=range] { accent-color: var(--teal); width: 100%; }
.weights output { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #fdf0dc; color: #8a5300; }
.ranklist { position: relative; margin-top: 10px; }
.rk {
  display: grid; grid-template-columns: 38px 1fr 92px; gap: 8px; align-items: center; width: 100%;
  border: 0; background: none; padding: 6px 6px; border-radius: 8px; text-align: left; font-size: 13px;
}
.rk:hover, .rk.hl { background: #eef2f1; }
.rk.sel { background: var(--teal-soft); box-shadow: inset 3px 0 0 var(--teal); }
.rk .no { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); text-align: right; }
.rk .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk .nm small { display: block; color: var(--muted); font-size: 11.5px; }
.rk .val { display: grid; gap: 3px; justify-items: end; font-size: 12px; font-variant-numeric: tabular-nums; }
.rk .val i { display: block; height: 5px; border-radius: 3px; background: var(--teal); justify-self: stretch; transform-origin: left; }
.rk .delta { font-size: 11px; font-weight: 600; }
.rk .delta.up { color: #1f7a3a; }
.rk .delta.down { color: #b42318; }
.bandhead { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 6px 4px; display: flex; align-items: center; gap: 8px; }
.bandhead .sw { width: 10px; height: 10px; border-radius: 3px; }

/* chart */
.chart-wrap { position: relative; margin-top: 10px; user-select: none; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: none; }
.chart-wrap .axis text { font-size: 11px; fill: var(--muted); }
.chart-wrap .axis line { stroke: var(--line); }
.chart-wrap .axis-title { font-size: 12px; fill: var(--ink-2); font-weight: 500; }
.chart-wrap circle.dot { stroke: #fff; stroke-width: .8; cursor: pointer; transition: r .15s; }
.chart-wrap circle.dot.dim { opacity: .14; }
.chart-wrap circle.dot.hl { stroke: var(--ink); stroke-width: 2; }
.chart-wrap circle.dot.sel { stroke: var(--focus); stroke-width: 2.5; }
.chart-wrap rect.brush { fill: rgba(31,111,107,.12); stroke: var(--teal); stroke-dasharray: 4 3; }
.chart-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.question-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* list */
.listhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.listrow .pop { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12.5px; }
.listrow .nomap { font-size: 11px; color: #8a5300; }

/* ---------- cases ---------- */
.casegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.casecard { border: 1px solid var(--line-2); background: #fff; border-radius: 12px; padding: 10px 11px; text-align: left; }
.casecard b { display: block; font-family: var(--serif); font-size: 16px; font-weight: 600; }
.casecard span { font-size: 11.5px; color: var(--muted); line-height: 1.25; display: block; margin-top: 2px; }
.casecard:hover { border-color: var(--teal); }
.casecard[aria-pressed="true"] { background: #102a33; border-color: #102a33; color: #fff; }
.casecard[aria-pressed="true"] span { color: #a9c4c2; }
.case-title { font-size: 30px; line-height: 1.1; margin: 6px 0; }
.case-q { font-family: var(--serif); font-size: 17px; color: var(--ink-2); margin: 0 0 12px; }
.factgrid { display: grid; gap: 8px; }
.fact { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fact b { font-family: var(--serif); font-size: 22px; font-weight: 600; display: block; line-height: 1.15; }
.fact .l { font-weight: 600; font-size: 13px; }
.fact .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lens-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.lens-title { font-family: var(--serif); font-size: 19px; line-height: 1.25; margin: 0 0 6px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 10px 0; }
.flow span { background: var(--teal-soft); color: var(--teal); padding: 4px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; animation: pop .4s both; }
.flow i { color: var(--muted); font-style: normal; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } }
.src { font-size: 12px; color: var(--muted); }
.src a { color: var(--sea); }
.minichart { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 8px; }
.minichart h3 { font-size: 15px; margin-bottom: 4px; }
.hbar { display: grid; grid-template-columns: 76px 1fr 64px; gap: 8px; align-items: center; font-size: 12.5px; padding: 3px 0; }
.hbar .t { height: 14px; background: #eef2f1; border-radius: 4px; position: relative; overflow: hidden; }
.hbar .t i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.hbar .v { text-align: right; font-variant-numeric: tabular-nums; }
.pattern { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 8px; transition: border-color .2s, box-shadow .2s; }
.pattern.on { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-soft); }
.pattern h3 { font-size: 16px; line-height: 1.25; margin-bottom: 6px; }
.pattern p { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); }
.pattern-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pbars .hbar { grid-template-columns: 118px 1fr 58px; }
.pbars button.hbar { width: 100%; border: 0; background: none; text-align: left; border-radius: 6px; }
.pbars button.hbar:hover { background: var(--teal-soft); }
.pbars .hbar > span:first-child, .stack > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack { display: grid; grid-template-columns: 118px 1fr; gap: 8px; align-items: center; font-size: 12.5px; padding: 3px 0; }
.stack .t { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: #eef2f1; }
.stack .t i { display: block; height: 100%; }
.legend-mini { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.legend-mini i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.evid { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.evid b { font-family: var(--serif); font-size: 18px; display: block; }
.evid .t { font-weight: 600; font-size: 13px; }
.evid p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); }
.evid .lim { color: var(--muted); }

.inspector { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.inspector h3 { font-size: 18px; }
.sharebar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; margin: 8px 0 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.sharebar i { display: block; height: 100%; transition: width .5s; }
.layer-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.stepnote { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); }
.stepnote .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; margin-top: 2px; }

/* ---------- about ---------- */
.about { position: fixed; inset: var(--top) 0 0 0; z-index: 25; overflow-y: auto; background: rgba(16,42,51,.55); backdrop-filter: blur(4px); padding: 32px 16px; }
.about article { max-width: 760px; margin: 0 auto; background: var(--paper); border-radius: 18px; padding: 32px 36px; box-shadow: var(--shadow); }
.about h1 { font-size: 34px; margin-bottom: 8px; }
.about h2 { font-size: 20px; margin: 26px 0 8px; }
.about p, .about li { color: var(--ink-2); }
.about ul { padding-left: 18px; }
.about .bignums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.about .bignums div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.about .bignums b { font-family: var(--serif); font-size: 26px; display: block; }
.about .bignums span { font-size: 12px; color: var(--muted); }

/* ---------- overlays ---------- */
.tooltip {
  position: fixed; z-index: 40; pointer-events: none; max-width: 280px;
  background: #102a33; color: #eef5f4; padding: 8px 11px; border-radius: 10px; font-size: 12.5px; box-shadow: var(--shadow);
}
.tooltip b { display: block; font-size: 13.5px; }
.tooltip span { color: #a9c4c2; }
.tour {
  position: fixed; z-index: 35; left: 50%; bottom: 28px; transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px)); background: #102a33; color: #eef5f4; border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow);
  animation: rise .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 16px); } }
.tour h2 { font-size: 22px; margin: 4px 0 6px; color: #fff; }
.tour p { margin: 0; color: #c6d9d7; }
.tour .k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #7fd1c3; font-weight: 600; }
.tour .nav { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.tour .dots { display: flex; gap: 5px; margin-right: auto; }
.tour .dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.25); }
.tour .dots i.on { background: #7fd1c3; }
.tour .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.tour .btn.primary { background: #7fd1c3; color: #102a33; border-color: #7fd1c3; }
.tour .progress { height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; margin-top: 12px; overflow: hidden; }
.tour .progress i { display: block; height: 100%; background: #7fd1c3; width: 0; }
.toast { position: fixed; z-index: 45; left: 50%; top: calc(var(--top) + 16px); transform: translateX(-50%); background: #102a33; color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); }
.loading { position: fixed; inset: var(--top) 0 0 0; z-index: 50; display: grid; place-items: center; background: #dfe9ee; font-family: var(--serif); font-size: 20px; color: var(--ink-2); transition: opacity .4s; }
.loading.done { opacity: 0; pointer-events: none; }
.loading.failed { font-family: inherit; font-size: 16px; padding: 24px 16px; }
.loading.failed > div { max-width: 34rem; display: grid; gap: 10px; line-height: 1.5; }
.loading.failed b { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.loading.failed .ua { font-size: 13px; color: var(--ink-2); }
.loading.failed code { display: block; margin-top: 4px; padding: 6px 8px; background: #fff; border-radius: 4px; word-break: break-all; user-select: all; }

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  :root { --top: 52px; }
  .brand span { font-size: 16px; }
  .modes { margin-left: 0; }
  .modes button { padding: 6px 9px; font-size: 13px; }
  .top-actions { display: none; }
  .modes .long { display: none; }
  .modes .short { display: inline; }
  [data-wide] { display: none; }
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: 60px; }
  .top { gap: 8px; padding: 0 10px; }
  .panel.left, .panel.right, .panel.right.wide {
    left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; max-height: 58vh;
    transform: translateY(calc(100% + 20px)); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  }
  .panel.open { transform: none; }
  .panel .sheet-close { display: inline-flex !important; }
  .panel.left .sheet-close { float: right; margin: -4px -4px 8px 8px; }
  .sheet-toggle {
    display: block; position: fixed; bottom: 16px; z-index: 21; border: 0; border-radius: 999px; padding: 10px 16px;
    background: #102a33; color: #fff; font-weight: 600; box-shadow: var(--shadow);
  }
  .left-toggle { left: 16px; }
  .right-toggle { right: 16px; }
  body.sheet-open .sheet-toggle { display: none; }
  body[data-mode="about"] .sheet-toggle { display: none; }
  body[data-mode] .maplibregl-ctrl-top-right,
  body[data-mode] .maplibregl-ctrl-bottom-right { margin-right: 0; }
  body[data-mode] .maplibregl-ctrl-bottom-left { margin-left: 0; }
  .about article { padding: 22px 18px; }
  .about .bignums { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 480px) {
  .brand span { display: none; }
}
