/* Map page. A tinted canvas with raised white cards; the choropleth ramps are built in OKLCH by map.js
   (the hex values below are the fallback). Type scale: 12, 13, 14, 18, 24, 34. One control height (--row),
   one icon size (16px), one link style. No inline styles anywhere (CSP style-src 'self'). */
body.map-page {
  --row: 36px;
  --canvas: #DDE5F1; --stage: #E9EFF8; --card: #FFFFFF; --card-2: #F4F7FC;
  --ink: #16202F; --ink-2: #4D5A70; --hair: #E3E9F3; --hair-2: #CBD5E4;
  --accent: #3E4BC2; --accent-ink: #FFFFFF; --accent-soft: #E7EAFB;
  --shadow: 0 12px 32px rgba(36, 56, 110, 0.14), 0 2px 6px rgba(36, 56, 110, 0.08);
  --shadow-s: 0 4px 12px rgba(36, 56, 110, 0.12), 0 1px 3px rgba(36, 56, 110, 0.08);
  --land-shadow: rgba(40, 62, 120, 0.38);
  --edge: #FFFFFF; --ring: #CBD7EA; --halo: #F1F5FC;
  --nd: #F6F8FC; --idle: #DCE5F4;
  --good: #1E7F4F; --bad: #B3321F;
  --c0: #ECF1FD; --c1: #C7D3F5; --c2: #94A8EA; --c3: #5D74D4; --c4: #2D3FA0;
  --b0: #FFF1C9; --b1: #FDD27D; --b2: #F2A24A; --b3: #D2622A; --b4: #8E2D1B;
  --fs-xs: 0.75rem; --fs-sm: 0.8125rem; --fs-md: 0.875rem; --fs-lg: 1.125rem; --fs-xl: 1.5rem; --fs-fig: 2.125rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  background: var(--canvas); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
@media (prefers-color-scheme: dark) {
  body.map-page {
    --canvas: #0F131C; --stage: #151A26; --card: #1D2433; --card-2: #232B3C;
    --ink: #E8ECF4; --ink-2: #A2ADC2; --hair: #2A3347; --hair-2: #3A4560;
    --accent: #9DAAFF; --accent-ink: #10152E; --accent-soft: #2A3158;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-s: 0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --land-shadow: rgba(0, 0, 0, 0.6);
    --edge: #0F131C; --ring: #232C42; --halo: #1A2132;
    --nd: #222A3C; --idle: #2B3550;
    --good: #5CD197; --bad: #FF8F7A;
  }
}
html, body.map-page { height: 100%; }
body.map-page { display: flex; flex-direction: column; overflow: hidden; }
body.map-page .appbar { background: var(--canvas); border-bottom: 0; }
body.map-page .appbar-label { color: var(--ink-2); }
body.map-page .stage a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }
kbd { font: inherit; font-size: var(--fs-xs); min-width: 20px; height: 20px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); background: var(--card-2); border: 1px solid var(--hair-2); border-radius: 5px; margin-inline: 1px; }
.ico { display: inline-flex; width: 16px; height: 16px; flex: none; }
.ico svg, .ibtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; display: block; }
.card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); }
.eyebrow { margin: 0; font-size: var(--fs-xs); color: var(--ink-2); max-width: none; }

/* ---------- buttons and fields ---------- */
.btn, select, .ibtn, .seg button {
  font: inherit; font-size: var(--fs-md); color: var(--ink); background: var(--card);
  border: 1px solid var(--hair-2); border-radius: 9px; min-height: var(--row); cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; }
.btn.ghost { border-color: transparent; background: transparent; padding: 0 8px; color: var(--accent); min-height: 28px; }
.btn.solid { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
select { padding: 0 28px 0 10px; max-width: 100%; }
.ibtn { width: var(--row); padding: 0; display: inline-grid; place-items: center; }
.btn:hover, .ibtn:hover:not(:disabled), select:hover, .seg button:hover { background: var(--card-2); }
.btn.solid:hover { background: var(--accent); filter: brightness(1.08); }
.btn.ghost:hover { background: var(--accent-soft); }
.ibtn:disabled { opacity: 0.4; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- control bar ---------- */
.bar { position: relative; z-index: 20; display: flex; align-items: center; gap: 12px; margin: 0 12px 12px; padding: 8px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-s); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.seg { display: inline-flex; padding: 3px; background: var(--card-2); border-radius: 11px; gap: 2px; }
.seg button { border: 0; background: transparent; min-height: 30px; padding: 0 14px; border-radius: 8px; font-weight: 500; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg.small button { min-height: 26px; padding: 0 10px; font-size: var(--fs-xs); }
.seg button[aria-pressed="true"]:hover { background: var(--accent); }
.search, .pick { position: relative; }
.search { width: 260px; }
.search > .ico { position: absolute; left: 10px; top: 10px; color: var(--ink-2); pointer-events: none; }
input[type="text"] { font: inherit; font-size: var(--fs-md); color: var(--ink); background: var(--card-2); border: 1px solid var(--hair-2); border-radius: 9px; min-height: var(--row); width: 100%; padding: 0 10px 0 32px; }
input[type="text"]::placeholder { color: var(--ink-2); opacity: 0.85; }
.pickbtn { min-width: 190px; justify-content: space-between; font-weight: 600; }
.pickbtn[aria-expanded="true"] { border-color: var(--accent); }
.pickbtn kbd { margin-left: 2px; }
.pickbtn #ds-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.pop, .list.float { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; width: min(420px, calc(100vw - 24px)); background: var(--card); border: 1px solid var(--hair-2); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; }
.search .list { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(340px, calc(100vw - 24px)); background: var(--card); border: 1px solid var(--hair-2); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.pop-q { position: relative; margin-bottom: 6px; }
.pop-q .ico { position: absolute; left: 10px; top: 10px; color: var(--ink-2); }
.pop-empty { margin: 8px; font-size: var(--fs-md); color: var(--ink-2); }
.list { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow: auto; }
.list li[role="presentation"] { padding: 10px 10px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.list li[role="option"] { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: var(--fs-md); }
.list li[role="option"] small { font-size: var(--fs-xs); color: var(--ink-2); }
.list li[role="option"]:hover, .list li[role="option"].on { background: var(--accent-soft); }
.list li[aria-selected="true"] > span::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-radius: 50%; background: var(--accent); vertical-align: middle; }

/* ---------- stage layout ---------- */
.stage { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; padding: 0 12px 12px; outline: none; max-width: none; margin: 0; }
body.map-page .stage { max-width: none; margin: 0; }
.mapcol { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; }
.mapwrap { position: relative; flex: 1; min-height: 0; border-radius: 18px; background: var(--stage); overflow: hidden; box-shadow: inset 0 0 0 1px var(--hair); }
.mapview { position: absolute; inset: 0; }
.rings { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.rings circle { fill: none; stroke: var(--ring); stroke-width: 1.2; opacity: 0.8; }
.rings circle.halo { fill: var(--halo); stroke: none; opacity: 1; }
.map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.map .land { filter: drop-shadow(0 7px 7px var(--land-shadow)); }
.map path[data-i] { stroke: var(--edge); stroke-width: 0.9px; vector-effect: non-scaling-stroke; fill-rule: evenodd; cursor: pointer; transition: fill 320ms var(--ease); fill: var(--idle); }
.map path.c0 { fill: var(--c0); } .map path.c1 { fill: var(--c1); } .map path.c2 { fill: var(--c2); }
.map path.c3 { fill: var(--c3); } .map path.c4 { fill: var(--c4); }
.map path.b0 { fill: var(--b0); } .map path.b1 { fill: var(--b1); } .map path.b2 { fill: var(--b2); }
.map path.b3 { fill: var(--b3); } .map path.b4 { fill: var(--b4); }
.map path.nd { fill: var(--nd); } .map path.idle { fill: var(--idle); }
.map path.ol { fill: none; pointer-events: none; vector-effect: non-scaling-stroke; transition: none; }
.map path.ol.hover { stroke: var(--ink); stroke-width: 1.8px; }
.map path.ol.selected { stroke: var(--accent); stroke-width: 2.6px; }
.map path:focus { outline: none; }
.map path[data-i]:focus-visible { stroke: var(--accent); stroke-width: 3px; }
.stage.loading .map path[data-i] { animation: pulse 0.9s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.62; } }
.skeleton { position: absolute; inset: 22% 14%; border-radius: 22px; background: var(--hair); overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, var(--card) 50%, transparent 80%); opacity: 0.55; transform: translateX(-100%); animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lab { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; padding: 2px 7px 3px; border-radius: 8px; background: var(--card); box-shadow: var(--shadow-s); font-size: 11px; line-height: 1.25; color: var(--ink); white-space: nowrap; opacity: 0.94; }
.lab b { font-weight: 600; font-size: 11px; color: var(--accent); }
.lab.plain { background: transparent; box-shadow: none; color: var(--ink); font-weight: 500; text-shadow: 0 0 3px var(--card), 0 0 3px var(--card); }

/* ---------- cards over the map ---------- */
.headline { padding: 14px 16px; flex: none; }
.headline .crumbs { display: flex; align-items: center; gap: 6px; min-height: 22px; margin-bottom: 6px; font-size: var(--fs-xs); color: var(--ink-2); }
.headline .where { font-weight: 600; }
.headline .eyebrow { font-weight: 600; color: var(--ink); font-size: var(--fs-md); }
.fig { margin: 2px 0 0; font-size: var(--fig, var(--fs-fig)); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; max-width: none; }
.sub { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--ink-2); max-width: none; }
.status { margin: 6px 0 0; font-size: var(--fs-xs); color: var(--ink-2); max-width: none; }
.status:empty { display: none; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; flex: none; }
.kpi { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 9px 12px 10px; min-width: 0; }
.kpi p { margin: 0; max-width: none; }
.kpi .k { font-size: var(--fs-xs); color: var(--ink-2); }
.kpi .v { font-size: var(--fs-md); font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .s { font-size: var(--fs-xs); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi svg.spark { display: block; width: 100%; height: 22px; margin-top: 4px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.up { color: var(--good); } .down { color: var(--bad); }
.chrome { position: absolute; z-index: 4; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow-s); }
.chrome .ibtn { border-color: transparent; background: transparent; min-height: 32px; width: 32px; border-radius: 9px; }
.chrome .ibtn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.chrome .vr { width: 1px; height: 18px; background: var(--hair-2); margin: 0 3px; }
.dlwrap { position: relative; display: inline-flex; }
.menu { position: absolute; right: 0; bottom: calc(100% + 8px); display: flex; flex-direction: column; min-width: 140px; padding: 4px; background: var(--card); border: 1px solid var(--hair-2); border-radius: 10px; box-shadow: var(--shadow); }
.menu button { font: inherit; font-size: var(--fs-md); color: var(--ink); background: none; border: 0; text-align: left; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.menu button:hover { background: var(--accent-soft); }
.toast { position: absolute; z-index: 6; left: 50%; bottom: 60px; transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 10px; background: var(--ink); color: var(--card); font-size: var(--fs-sm); max-width: none; }
.gesture-hint { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; pointer-events: none; background: rgba(15, 22, 40, 0.38); color: #fff; font-size: var(--fs-md); text-align: center; padding: 0 24px; }
.state { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 24px; max-width: min(340px, 90%); text-align: center; }
.state p { margin: 0; font-size: var(--fs-md); max-width: none; }

.tip { position: absolute; left: 0; top: 0; z-index: 8; pointer-events: none; background: var(--card); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 14px 11px; min-width: 150px; max-width: 260px; }
.tip::after { content: ""; position: absolute; left: 14px; bottom: -5px; width: 10px; height: 10px; background: var(--card); transform: rotate(45deg); border-radius: 2px; }
.tip.below::after { bottom: auto; top: -5px; }
.tip .n { display: block; font-size: var(--fs-sm); font-weight: 600; }
.tip .v { display: block; font-size: var(--fs-lg); font-weight: 600; margin-top: 2px; }
.tip .m { display: block; font-size: var(--fs-xs); color: var(--ink-2); margin-top: 2px; }
@media (hover: none) { .tip { display: none; } }

/* ---------- dock: period, legend, notes ---------- */
.dock { padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.timeline { display: flex; align-items: center; gap: 10px; }
.timeline .ibtn { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); flex: none; border-radius: 50%; width: var(--row); }
.timeline .ibtn:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }
.t-end { font-size: var(--fs-sm); color: var(--ink-2); flex: none; }
#slider { flex: 1; min-width: 80px; accent-color: var(--accent); height: 28px; margin: 0; }
.keys { margin: 0; font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; max-width: none; }
@media (hover: none) { .keys { display: none; } }
.legend-row { display: flex; align-items: flex-start; gap: 18px; }
.nodata { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--ink-2); flex: none; padding-right: 8px; height: 38px; }
.nodata i, .ramp i { display: block; height: 10px; border-radius: 3px; }
.nodata i { width: 22px; height: 12px; background: var(--nd); border: 1px solid var(--hair-2); }
.ramp { list-style: none; margin: 0; padding: 0; display: flex; gap: 3px; flex: 1; min-width: 0; }
.ramp li { flex: 1; position: relative; padding-bottom: 20px; min-width: 0; }
.ramp i.c0 { background: var(--c0); } .ramp i.c1 { background: var(--c1); } .ramp i.c2 { background: var(--c2); } .ramp i.c3 { background: var(--c3); } .ramp i.c4 { background: var(--c4); }
.ramp i.b0 { background: var(--b0); } .ramp i.b1 { background: var(--b1); } .ramp i.b2 { background: var(--b2); } .ramp i.b3 { background: var(--b3); } .ramp i.b4 { background: var(--b4); }
.ramp .lb { position: absolute; left: 0; bottom: 0; font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; }
.ramp .lb.end { left: auto; right: 0; }
.legend-box summary { cursor: pointer; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); min-height: 22px; display: list-item; }
.legend-note { margin: 4px 0 0; max-width: none; font-size: var(--fs-xs); line-height: 1.5; color: var(--ink-2); }
@media (min-width: 900px) { .legend-box > summary { display: none; } .legend-note { margin: 0; } }

/* ---------- right column: ranking and region detail ---------- */
.side { min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding-bottom: 2px; }
.rank { padding: 14px 16px 10px; display: flex; flex-direction: column; min-height: 0; }
.rank-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rank h2, .sheet h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.rank-list { list-style: none; margin: 0; padding: 0; overflow: auto; }
.rank-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; column-gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid var(--hair); font-size: var(--fs-sm); }
.rank-list li.empty { display: block; }
.rank-list li:first-child { border-top: 0; }
.rank-list .no { width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 600; display: grid; place-items: center; }
.rank-list button { all: unset; cursor: pointer; display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list button:hover { text-decoration: underline; text-underline-offset: 3px; }
.rank-list button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.rank-list .val { font-weight: 600; text-align: right; }
.rank-list .bar-t { grid-column: 2 / -1; height: 6px; border-radius: 3px; background: var(--card-2); margin-top: 5px; overflow: hidden; }
.rank-list .bar-t i { display: block; height: 100%; border-radius: 3px; background: var(--accent); box-shadow: inset 0 0 0 1px rgba(20, 30, 70, 0.14); }
.rank-list .bar-t i.c0 { background: var(--c0); } .rank-list .bar-t i.c1 { background: var(--c1); } .rank-list .bar-t i.c2 { background: var(--c2); } .rank-list .bar-t i.c3 { background: var(--c3); } .rank-list .bar-t i.c4 { background: var(--c4); }
.rank-list .bar-t i.b0 { background: var(--b0); } .rank-list .bar-t i.b1 { background: var(--b1); } .rank-list .bar-t i.b2 { background: var(--b2); } .rank-list .bar-t i.b3 { background: var(--b3); } .rank-list .bar-t i.b4 { background: var(--b4); }
.rank-empty { margin: 4px 0 8px; font-size: var(--fs-sm); color: var(--ink-2); max-width: none; }

.sheet { padding: 16px; overflow: auto; min-height: 0; }
.grab { display: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.sheet h2 { font-size: var(--fs-lg); line-height: 1.25; margin-top: 2px; }
.sheet-actions { display: flex; gap: 4px; flex: none; align-items: center; }
.sheet .ibtn { border-color: transparent; background: transparent; }
.sheet .grp { padding: 10px 0; border-top: 1px solid var(--hair); }
.sheet .grp:first-child { border-top: 0; padding-top: 0; }
.sheet .lab2 { margin: 0 0 3px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); max-width: none; }
.sheet .val { margin: 0; font-size: var(--fs-fig); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; max-width: none; }
.sheet .unit { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--ink-2); max-width: none; }
.sheet .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet .num { margin: 0; font-size: var(--fs-md); font-weight: 600; max-width: none; }
.sheet .txt { margin: 0; font-size: var(--fs-sm); color: var(--ink); overflow-wrap: anywhere; max-width: none; }
.sheet .txt.dim { color: var(--ink-2); }
.sheet .go { width: 100%; justify-content: center; margin-top: 4px; }
body.sheet-open .rank, body.sheet-open .kpis { display: none; }
@media (min-width: 900px) { #sheet-more { display: none; } }

/* ---------- table ---------- */
.table-wrap { position: absolute; inset: 0; overflow: auto; padding: 12px 16px 24px; background: var(--card); z-index: 3; border-radius: 18px; }
.table-wrap table { max-width: 820px; }
.table-wrap th button { font: inherit; font-weight: 600; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; }
.table-wrap td.num, .table-wrap th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap td.none { color: var(--ink-2); }
.table-wrap td.nowrap { white-space: nowrap; }
.table-wrap .linklike { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.table-wrap caption { text-align: left; padding: 8px 0; font-size: var(--fs-md); }

body.view-table [data-map] { display: none; }
@media (max-width: 767px) {
  .table-wrap thead { display: table-header-group; }
  .table-wrap table { display: table; width: 100%; font-size: var(--fs-md); }
  .table-wrap tbody { display: table-row-group; }
  .table-wrap tr { display: table-row; padding: 0; border-bottom: 0; }
  .table-wrap td, .table-wrap th { display: table-cell; width: auto; padding: 8px 6px; border-bottom: 1px solid var(--hair); }
  .table-wrap tbody th { font-weight: 500; }
  .table-wrap td::before { content: none; }
}

@media (prefers-reduced-motion: reduce) {
  .map path[data-i], .btn, .ibtn, select { transition: none; }
  .stage.loading .map path[data-i], .skeleton::after { animation: none; }
}

/* ---------- narrower than a laptop: the right column becomes a row below ---------- */
@media (max-width: 1099px) and (min-width: 900px) {
  .stage { grid-template-columns: minmax(0, 1fr) 280px; }
}

/* ---------- phone: headline, map, period and legend, figures, ranking; the detail is a bottom sheet ---------- */
@media (max-width: 899px) {
  body.map-page { overflow: hidden; }
  .bar { flex-wrap: wrap; gap: 8px; margin: 0 12px 8px; }
  .bar-right { display: contents; }
  .seg { order: 1; }
  .pick { order: 2; flex: 1; min-width: 0; }
  .pickbtn { width: 100%; min-width: 0; }
  .search { order: 3; width: 100%; flex: 1 0 100%; }
  #f-commodity { order: 4; flex: 1 0 100%; } #f-commodity select { width: 100%; }
  .search .list { width: 100%; }
  .pop { left: 0; right: 0; width: auto; }
  .stage { display: flex; flex-direction: column; overflow-y: auto; gap: 12px; padding: 0 12px 28px; }
  .mapcol, .mapwrap { display: contents; }
  .headline { order: 0; padding: 12px 14px; }
  .fig { font-size: 1.75rem; }
  .mapview { position: relative; inset: auto; order: 1; height: 55vh; min-height: 320px; flex: none; border-radius: 18px; background: var(--stage); overflow: hidden; box-shadow: inset 0 0 0 1px var(--hair); }
  body.view-table .mapview { height: auto; min-height: 60vh; }
  .table-wrap { position: static; border-radius: 18px; }
  .dock { order: 2; }
  .kpis { order: 3; gap: 8px; }
  .side { display: contents; }
  .rank { order: 4; }
  body.sheet-open .rank { display: flex; }
  .sheet { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-height: 46vh; border-radius: 18px 18px 0 0; padding: 8px 16px 16px; box-shadow: 0 -12px 32px rgba(20, 30, 70, 0.22); }
  .sheet.expanded { max-height: 82vh; }
  .grab { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--hair-2); margin: 0 auto 8px; }
  .sheet .more { display: none; }
  .sheet.expanded .more { display: block; }
  .sheet .ibtn { width: 44px; min-height: 44px; }
  .chrome .ibtn { width: 40px; min-height: 40px; }
  .chrome { right: 8px; bottom: 8px; }
  .timeline { flex-wrap: wrap; row-gap: 6px; }
  #slider { flex: 1 1 100px; }
  .t-end { font-size: var(--fs-xs); }
  .legend-row { flex-direction: column; gap: 8px; }
  .nodata { padding-right: 0; height: auto; }
  .ramp { width: 100%; flex: none; }
  .ramp li { padding-bottom: 18px; }
  .ramp .lb { font-size: 11px; }
  .ramp .lb.end { display: none; }
  .state { max-width: 86%; }
  body.sheet-open .stage { padding-bottom: 46vh; }
}
.stage:fullscreen { background: var(--canvas); padding: 12px; overflow: auto; }
