/* ==========================================================
   River Atlas — 十河藍為主、RIVO 橘為強調
   ========================================================== */
:root {
  /* 經濟部水利署 logo: water blue #0090e0 + green #009840. Raw logo colours go on
     fills and lines; text and white-text buttons use darkened inks of the same hues. */
  --logo-blue: #0090e0;
  --logo-green: #009840;
  --blue-900: #00385e;          /* footer */
  --blue-700: #0067a5;          /* brand + link text (5.6:1 on white) */
  --blue-600: #0090e0;          /* fills, toggles, bars */
  --blue-100: #cde9f9;
  --blue-50: #ebf6fd;
  --action: #007a3d;            /* selected / primary controls with white text (5.3:1) */
  --action-ink: #006a35;
  --green: #6f8f00;              /* aquatic vegetation layer, kept apart from the brand green */
  --green-ink: #4a6000;
  --accent-ink: #c23c00;
  --accent: #ff5108;
  --ink: #12202b;
  --ink-2: #44535f;
  --ink-3: #56636f;
  --line: #d9e2e9;
  --bg: #ffffff;
  --bg-alt: #f4f8fb;
  --glass: rgba(255, 255, 255, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --glass-edge: rgba(255, 255, 255, 0.6);
  --shadow-s: 0 1px 2px rgba(4, 49, 77, 0.10);
  --shadow-l: 0 1px 3px rgba(4, 49, 77, 0.12), 0 6px 18px rgba(4, 49, 77, 0.10);
  --r-s: 6px;
  --r-m: 8px;
  --r-l: 10px;
  --sans: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --disp: var(--sans);
  --mono: var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --z-map-ui: 5; --z-panel: 6; --z-sticky: 50; --z-skip: 100;
  --top: 64px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8f0f6; --ink-2: #b4c3cf; --ink-3: #93a3b0; --line: #26394a;
    --bg: #0b1620; --bg-alt: #0f1d29; --blue-50: #102536; --blue-100: #16324a;
    --glass: rgba(14, 28, 40, 0.72); --glass-strong: rgba(14, 28, 40, 0.92); --glass-edge: rgba(255, 255, 255, 0.08);
    --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-l: 0 18px 48px rgba(0, 0, 0, 0.5);
    --blue-600: #33adf0; --blue-700: #7cc8f5; --green-ink: #b6d44f; --accent-ink: #ff9466; --action: #1d8a4c; --blue-900: #04243a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e8f0f6; --ink-2: #b4c3cf; --ink-3: #8798a6; --line: #26394a;
  --bg: #0b1620; --bg-alt: #0f1d29; --blue-50: #102536; --blue-100: #16324a;
  --glass: rgba(14, 28, 40, 0.72); --glass-strong: rgba(14, 28, 40, 0.92); --glass-edge: rgba(255, 255, 255, 0.08);
  --blue-600: #33adf0; --blue-700: #7cc8f5; --green-ink: #b6d44f; --accent-ink: #ff9466; --action: #1d8a4c; --blue-900: #04243a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* body size follows the window: 15px on phones, 17px on wide screens; 字級 scales on top */
html { font-size: calc(clamp(0.9375rem, 0.875rem + 0.25vw, 1.0625rem) * var(--fs, 1)); scroll-behavior: smooth; scroll-padding-top: var(--top); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.75 var(--sans); letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
::selection { background: color-mix(in srgb, var(--blue-600) 26%, transparent); color: var(--ink); }
html { scrollbar-color: color-mix(in srgb, var(--ink) 28%, transparent) transparent; accent-color: var(--action); caret-color: var(--blue-700); }
.panel-body, .detail, .table-wrap { scrollbar-width: thin; }
a { color: var(--blue-700); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: 8px; top: -60px; z-index: var(--z-skip); background: var(--blue-700); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue-600) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(1180px, 100%); margin-inline: auto; padding-inline: var(--gutter); }
.narrow { width: min(820px, 100%); }
.num, .mono { font-variant-numeric: tabular-nums; }

/* ---------------- top bar ----------------
   At rest it is part of the page (no divider). Once content scrolls under it,
   a light material and a hairline fade in: the edge appears only where chrome
   actually overlaps content. */
.scroll-sentinel { position: absolute; top: 0; height: 1px; width: 1px; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky); min-height: var(--top);
  display: flex; align-items: center; gap: 8px 28px; padding-inline: var(--gutter);
  background: var(--bg); box-shadow: 0 1px 0 transparent;
  transition: background-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.topbar.scrolled {
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 90%, transparent), 0 6px 16px -12px rgba(4, 49, 77, 0.35);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand strong { font-size: 1.0625rem; font-weight: 700; letter-spacing: 0.02em; color: var(--blue-700); }
.brand-logo { width: 30px; height: 30px; flex: none; }
.brand-sub { font-size: 0.8125rem; color: var(--ink-2); padding-left: 12px; margin-left: 2px; border-left: 1px solid var(--line); }
.nav { position: relative; display: flex; gap: 22px; margin-left: auto; align-self: stretch; }
.nav a {
  display: flex; align-items: center; color: var(--ink-2); text-decoration: none; white-space: nowrap;
  font-size: 0.9375rem; font-weight: 500; letter-spacing: 0.02em; transition: color 0.15s;
}
.nav a:hover, .nav a[aria-current="true"] { color: var(--ink); }
.nav a:active { opacity: 0.6; transition: none; }
/* one indicator that travels between items instead of a box per item */
.nav-ind {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100px; background: var(--logo-green);
  transform-origin: left; transform: translateX(var(--x, 0)) scaleX(var(--s, 0)); opacity: var(--o, 0);
  transition: transform 0.32s var(--ease-out), opacity 0.2s;
}
.tools { display: flex; align-items: center; gap: 18px; font-size: 0.8125rem; }
.fontsize, .langs { display: flex; align-items: center; gap: 2px; }
.tool-label { color: var(--ink-3); margin-right: 4px; }
.fontsize button, .langs button {
  border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 4px;
  color: var(--ink-3); font-size: 0.8125rem; transition: color 0.15s, background-color 0.15s;
}
.fontsize button:hover, .langs button:hover { color: var(--ink); background: var(--blue-50); }
.fontsize button[aria-checked="true"], .langs button[aria-checked="true"] { color: var(--action); font-weight: 700; }
.langs button + button { position: relative; }
.langs button + button::before { content: ""; position: absolute; left: -2px; top: 25%; bottom: 25%; width: 1px; background: var(--line); }
button:active { transform: scale(0.96); }
@media (max-width: 980px) {
  .topbar { flex-wrap: wrap; padding-top: 10px; }
  .brand-sub { display: none; }
  .tools { margin-left: auto; }
  .nav { order: 3; flex-basis: 100%; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); gap: 20px;
    overflow-x: auto; scrollbar-width: none; min-height: 44px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-ind { left: 0; }
  :root { --top: 108px; }
}
.langs .short { display: none; }
@media (max-width: 520px) {
  .tool-label { display: none; } .tools { gap: 8px; }
  .langs .long { display: none; } .langs .short { display: inline; }
}

/* ---------------- intro ---------------- */
.intro { padding: 40px 0 28px; }
h1 { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; font: 700 clamp(1.5rem, 1.1rem + 1.6vw, 2.125rem)/1.25 var(--sans); color: var(--ink); text-wrap: balance; }
h1 .place { font-size: clamp(1rem, 0.9rem + 0.4vw, 1.125rem); font-weight: 500; color: var(--ink-2); }
.lede { max-width: 42em; margin: 10px 0 0; color: var(--ink-2); }
.facts-row { display: inline-flex; flex-wrap: wrap; max-width: 100%; margin: 20px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts-row div { padding: 10px 24px 10px 0; margin-right: 24px; border-right: 1px solid var(--line); }
.facts-row div:last-child { border-right: 0; margin-right: 0; }
.facts-row dt { font-size: 0.8125rem; color: var(--ink-3); }
.facts-row dd { margin: 0; font-size: 1.125rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.facts-row dd small { font-size: 0.875rem; font-weight: 400; color: var(--ink-2); margin-left: 3px; }
@media (max-width: 600px) {
  .facts-row { display: grid; grid-template-columns: 1fr 1fr; }
  .facts-row div { margin: 0; padding: 10px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .facts-row div:nth-last-child(-n+2) { border-bottom: 0; }
}

/* ---------------- map ---------------- */
.mapsec { padding: 0 var(--gutter) 8px; }
.mapbox {
  position: relative; height: min(78vh, 760px); min-height: 520px; border-radius: var(--r-l); overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-alt); isolation: isolate;
}
.leaflet { position: absolute; inset: 0; z-index: 0; background: #e9eef2; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 11px; padding: 2px 8px !important; }
.leaflet-control-zoom { border: 1px solid var(--line) !important; box-shadow: var(--shadow-s) !important; border-radius: var(--r-m) !important; overflow: hidden; }
.leaflet-control-zoom a { background: var(--glass-strong) !important; color: var(--ink) !important; border-color: var(--line) !important; }

.bar { position: absolute; z-index: var(--z-map-ui); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bar-top { top: 14px; left: 14px; right: 14px; justify-content: space-between; pointer-events: none; }
.bar-top > * { pointer-events: auto; }

.flights { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 3px; border-radius: var(--r-m);
  background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow-s); max-width: 100%; }
.flight {
  border: 0; border-radius: var(--r-s); padding: 6px 12px; white-space: nowrap; cursor: pointer; background: transparent;
  font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); transition: background-color 0.2s, color 0.2s, transform 0.1s;
}
.flight[aria-selected="true"] { background: var(--action); color: #fff; }
.flight[disabled] { cursor: default; color: var(--ink-3); opacity: 0.75; }
.flight .soon { font-size: 0.6875rem; font-weight: 500; margin-left: 4px; }

/* segmented control with sliding thumb */
.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: var(--r-m);
  background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.seg button { position: relative; z-index: 1; border: 0; background: transparent; padding: 6px 14px; border-radius: var(--r-s); cursor: pointer;
  font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: color 0.25s; }
.seg button[aria-checked="true"] { color: #fff; }
.seg-thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; border-radius: var(--r-s); background: var(--action);
  transition: transform 0.25s var(--ease-out); }
.seg-wide { display: grid; width: 100%; background: var(--blue-50); border-color: transparent; box-shadow: none; }
.seg-wide button { padding: 7px 6px; }

/* floating panels */
.panel {
  position: absolute; z-index: var(--z-panel); background: var(--glass-strong); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-l);
}
.layers { left: 14px; top: 66px; width: 288px; max-height: calc(100% - 80px); display: flex; flex-direction: column; }
.panel-grab { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: transparent;
  padding: 14px 16px 6px; cursor: pointer; font-weight: 700; font-size: 0.9375rem; text-align: left; }
.panel-grab .count { font: 400 0.75rem var(--mono); color: var(--ink-3); }
.panel-body { overflow-y: auto; padding: 0 16px 16px; overscroll-behavior: contain; }
.panel-label { margin: 14px 0 6px; font-size: 0.75rem; font-weight: 700; color: var(--ink-3); letter-spacing: 0.04em; }
.layer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.layer { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: var(--r-s); }
.layer:hover { background: color-mix(in srgb, var(--blue-50) 80%, transparent); }
.layer input { width: 18px; height: 18px; margin: 0; accent-color: var(--action); }
.layer label { cursor: pointer; line-height: 1.35; }
.layer label small { display: block; color: var(--ink-3); font-size: 0.75rem; }
.layer .sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: 1px; }
.tag { font-size: 0.75rem; font-weight: 700; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.tag.on { background: color-mix(in srgb, var(--blue-600) 14%, transparent); color: var(--blue-700); }
.tag.pre { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green-ink); }
.tag.plan { background: color-mix(in srgb, var(--ink-3) 14%, transparent); color: var(--ink-3); }
.layer.is-plan label { color: var(--ink-3); }
.legend { margin-top: 14px; font-size: 0.75rem; color: var(--ink-2); }
.legend .ramp { height: 10px; border-radius: 999px; margin: 6px 0 4px; }
.legend .ends { display: flex; justify-content: space-between; font-family: var(--mono); }

.detail { right: 14px; top: 66px; width: 340px; max-height: calc(100% - 80px); overflow-y: auto; padding: 18px; overscroll-behavior: contain;
  transform-origin: top right; animation: materialize 0.22s var(--ease-out); }
@keyframes materialize { from { opacity: 0; transform: translateY(-4px); } }
.detail .close { position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--ink-2); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.detail .close:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 12%, transparent); }
.detail.leaving { animation: dematerialize 0.18s var(--ease-out) forwards; }
@keyframes dematerialize { to { opacity: 0; transform: translateY(-4px); } }
.sheet-grab { display: none; }
.detail h3 { margin: 0 34px 2px 0; font-size: 1.125rem; line-height: 1.35; }
.detail .sub { margin: 0 0 12px; color: var(--ink-3); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.detail img { border-radius: var(--r-s); margin: 6px 0 10px; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; background: var(--bg-alt); }
.detail img.sq { aspect-ratio: 1; width: 160px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin: 0; font-size: 0.8125rem; line-height: 1.6; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.detail .btn { margin-top: 14px; width: 100%; border: 0; border-radius: var(--r-s); padding: 10px; cursor: pointer; font-weight: 700;
  background: var(--action); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips span { font-size: 0.75rem; padding: 2px 8px; border-radius: 4px; background: var(--blue-50); color: var(--blue-700); }

/* object markers */
.leaflet-heatmap-layer { opacity: 0.62; }
.obj-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.drone-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(255, 81, 8, 0.22), 0 2px 6px rgba(0, 0, 0, 0.3); }

@media (max-width: 760px) {
  .mapsec { padding: 0 0 8px; }
  .mapbox { border-radius: 0; height: 82vh; min-height: 560px; }
  .layers { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 52%; }
  .layers, .detail { touch-action: none; will-change: transform; }
  .layers .panel-body { touch-action: pan-y; }
  .detail { touch-action: pan-y; }
  .sheet-grab { display: block; position: absolute; left: 0; right: 48px; top: 0; height: 40px; touch-action: none; cursor: grab; z-index: 1; }
  .sheet-grab::before { content: ""; position: absolute; left: calc(50% + 24px); top: 7px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 22%, transparent); }
  .panel-grab { touch-action: none; }
  .detail.leaving { animation-name: sheet-out; }
  @keyframes sheet-out { to { transform: translateY(110%); } }
  @keyframes materialize { from { transform: translateY(100%); } }
  .panel-grab { padding: 12px 16px; }
  .panel-grab::before { content: ""; position: absolute; left: 50%; top: 6px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 22%, transparent); }
  .detail { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 70%; transform-origin: bottom center; }
  .bar-top { top: 8px; left: 8px; right: 8px; }
}

/* ---------------- blocks ---------------- */
.block { padding: 56px 0 64px; border-top: 1px solid var(--line); }
.block.alt { background: var(--bg-alt); }
.block-head { margin-bottom: 20px; max-width: 48em; }
.block-head h2 { margin: 0 0 6px; font: 700 clamp(1.25rem, 1.05rem + 0.8vw, 1.5rem)/1.3 var(--sans); }
.block-head p { margin: 0; color: var(--ink-2); }
.hint, .note { color: var(--ink-3); font-size: 0.8125rem; }
.note { margin-top: 14px; }

/* ---------------- strip ---------------- */
.strip-tools { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.875rem; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 40px; height: 24px; border-radius: 999px; background: var(--line); position: relative; transition: background-color 0.25s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.35s var(--ease-out); }
.switch input:checked + span { background: var(--blue-600); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--blue-600) 60%, transparent); outline-offset: 2px; }
.switch b { font-weight: 500; }
.strip-pos { margin-left: auto; font-size: 1.25rem; font-weight: 700; color: var(--blue-700); font-variant-numeric: tabular-nums; }
.strip {
  position: relative; height: clamp(220px, 34vw, 420px); overflow: hidden; background: #1c2a33; cursor: grab;
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.strip:active { cursor: grabbing; }
.strip-track { position: absolute; left: 0; top: 0; height: 100%; }
.strip-track .tile, .strip-track .wtile { position: absolute; top: 0; height: 100%; pointer-events: none; }
.strip-track .wtile { transition: opacity 0.3s; }
.strip.hide-water .wtile { opacity: 0; }
.strip.hide-obj .sobj { opacity: 0; transform: scale(0.6); }
.sobj { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 2.5px solid #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25); transition: opacity 0.25s, transform 0.35s var(--ease-out); pointer-events: auto; cursor: pointer; padding: 0; background-clip: padding-box; }
.sobj::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: inherit; }
.strip-center { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5); pointer-events: none; }
.strip-center::before { content: ""; position: absolute; top: 0; left: -6px; border: 7px solid transparent; border-top-color: var(--accent); }
.strip-ruler { position: relative; height: 34px; margin-top: 6px; overflow: hidden; }
.strip-ruler .tick { position: absolute; top: 0; white-space: nowrap; font-size: 0.75rem; font-variant-numeric: tabular-nums; color: var(--ink-3); transform: translateX(-50%); padding-top: 10px; }
.strip-ruler .tick::before { content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 8px; background: var(--ink-3); }
.strip-ruler .sec { position: absolute; top: 0; height: 4px; border-radius: 4px; background: var(--blue-100); }

/* ---------------- sections table ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--bg); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 700; color: var(--ink-2); background: color-mix(in srgb, var(--blue-50) 70%, var(--bg)); font-size: 0.8125rem; position: sticky; top: 0; }
td.num, th.num { text-align: right; }
tbody tr { cursor: pointer; transition: background-color 0.15s; }
tbody tr:hover { background: var(--blue-50); }
tbody tr[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
tbody tr:last-child td { border-bottom: 0; }
td .bar-in { display: inline-block; height: 6px; border-radius: 6px; background: var(--blue-600); margin-right: 8px; vertical-align: middle; opacity: 0.7; }
td.hot { color: var(--accent-ink); font-weight: 700; }
td.pending { color: var(--ink-3); font-size: 0.8125rem; }
table.status tbody tr { cursor: default; }
table.status td { white-space: normal; vertical-align: top; }
table.status td:first-child { white-space: nowrap; font-weight: 700; }

/* ---------------- video ---------------- */
.video-frame { border-radius: var(--r-m); overflow: hidden; border: 1px solid var(--line); background: #000; aspect-ratio: 16 / 9; }
.video-frame video { width: 100%; height: 100%; display: block; }

/* ---------------- method ---------------- */
.steps { list-style: none; margin: 0 0 8px; padding: 0; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 28px; }
.steps li { counter-increment: step; padding: 14px 0 18px; border-top: 2px solid var(--logo-green); }
.steps h3 { margin: 0 0 6px; font-size: 1.0625rem; }
.steps h3::before { content: counter(step) "．"; color: var(--action); }
.steps p { margin: 0; color: var(--ink-2); font-size: 0.9375rem; }
h3.sub { margin: 44px 0 12px; font-size: 1.125rem; }
.defs { margin: 0; border-top: 1px solid var(--line); }
.defs div { display: grid; grid-template-columns: minmax(8em, 12em) 1fr; gap: 4px 24px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.defs dt { font-weight: 700; }
.defs dd { margin: 0; color: var(--ink-2); font-size: 0.9375rem; max-width: 62ch; }
@media (max-width: 600px) { .defs div { grid-template-columns: 1fr; } }
.facts { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 24px; }
.facts li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.facts li span:first-child { color: var(--ink-2); }
.facts li span:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- about ---------------- */
.prose p { margin: 0 0 1.1em; color: var(--ink-2); max-width: 65ch; text-wrap: pretty; }

/* ---------------- footer ---------------- */
.footer { background: var(--blue-900); color: #dcebf5; padding: 48px 0 40px; }
.orgs { display: flex; flex-wrap: wrap; gap: 16px 40px; padding-bottom: 28px; border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
.org { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; }
.org .role { grid-column: 1 / -1; font-size: 0.75rem; color: #9fc3db; margin-bottom: 6px; letter-spacing: 0.06em; }
.org img { width: 40px; height: 40px; }
.org img.rivo { width: auto; height: 20px; padding: 10px 8px; box-sizing: content-box; background: #fff; border-radius: var(--r-s); }
.org span:last-child { font-weight: 700; }
.foot-meta { padding-top: 22px; font-size: 0.875rem; }
.foot-meta p { margin: 0 0 6px; }
.foot-meta a { color: #fff; }
.foot-meta .small { color: #9fc3db; font-size: 0.75rem; }

@media (prefers-reduced-motion: reduce) {
  /* keep colour and opacity feedback; drop movement */
  .seg-thumb, .switch span::after, .nav-ind, .sobj { transition-property: opacity, background-color, color !important; }
  .detail { animation-name: fade-in !important; }
  .detail.leaving { animation-name: fade-out !important; }
  @keyframes fade-in { from { opacity: 0; } }
  @keyframes fade-out { to { opacity: 0; } }
  button:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .panel { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .panel, .flights, .seg { background: var(--bg); border: 1px solid var(--ink); }
}

/* phone: keep the section name pinned, drop GPS so the numbers fit */
@media (max-width: 600px) {
  .sections th:nth-child(2), .sections td:nth-child(2) { display: none; }
  .sections th:first-child, .sections td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg); box-shadow: 1px 0 0 var(--line); }
  .sections th:first-child { background: color-mix(in srgb, var(--blue-50) 70%, var(--bg)); z-index: 2; }
  th, td { padding: 10px 10px; }
  .sections td:first-child .mono { display: block; font-size: 0.75rem; color: var(--ink-3); line-height: 1.3; }
}

/* touch: 44px targets */
@media (pointer: coarse) {
  .fontsize button, .langs button, .flight, .seg button { min-height: 44px; }
  .fontsize button, .langs button { min-width: 34px; }
  .layer { min-height: 44px; }
}

/* ---------------- object lightbox (native dialog) ---------------- */
.lightbox {
  width: min(1120px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 0;
  border-radius: var(--r-l); background: var(--bg); color: var(--ink); overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 24px 64px rgba(0, 0, 0, 0.35);
}
.lightbox::backdrop { background: rgba(4, 20, 30, 0.72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.lb-inner { display: grid; grid-template-columns: minmax(0, 1fr) 320px; max-height: calc(100dvh - 32px); }
.lb-figure { position: relative; margin: 0; background: #0e1a22; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.lb-figure img { width: 100%; height: 100%; max-height: calc(100dvh - 32px); object-fit: contain; }
.lb-figure.is-ctx img { aspect-ratio: 16 / 9; height: auto; }
.lb-side { display: flex; flex-direction: column; gap: 12px; padding: 20px; overflow-y: auto; }
.lb-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.lb-head h2 { margin: 0; font-size: 1.25rem; line-height: 1.35; }
.lb-close { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  color: var(--ink-2); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.lb-close:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 12%, transparent); }
.lb-count { margin: -6px 0 0; font-size: 0.8125rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.lb-actions { display: grid; gap: 8px; margin-top: 4px; }
.lb-btn { border: 1px solid var(--line); background: var(--bg); color: var(--action); font-weight: 700; border-radius: var(--r-s);
  padding: 9px 12px; cursor: pointer; transition: background-color 0.15s; }
.lb-btn:hover { background: var(--blue-50); }
.lb-nav { display: flex; justify-content: space-between; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.lb-nav button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; cursor: pointer;
  color: var(--ink-2); font-size: 0.875rem; padding: 8px 6px; border-radius: var(--r-s); }
.lb-nav button:hover { color: var(--ink); background: var(--blue-50); }
.lb-nav button:disabled { opacity: 0.35; cursor: default; background: transparent; }
.lb-grab { display: none; }
@media (max-width: 760px) {
  .lightbox { width: 100vw; max-height: 100dvh; margin: auto 0 0; border-radius: var(--r-l) var(--r-l) 0 0; }
  .lb-inner { grid-template-columns: 1fr; max-height: 100dvh; overflow-y: auto; }
  .lb-figure img { max-height: 62dvh; }
  .lb-grab { display: block; position: absolute; inset: 0 0 auto 0; height: 44px; touch-action: none; }
  .lb-grab::before { content: ""; position: absolute; left: 50%; top: 8px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: rgba(255, 255, 255, 0.6); }
  .lb-figure { touch-action: pan-y; }
}
/* thumbnails that open the lightbox */
.zoomable { position: relative; display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--r-s); overflow: hidden; }
.zoomable img { margin: 0 !important; transition: transform 0.25s var(--ease-out); }
.zoomable:hover img { transform: scale(1.03); }
.zoomable .hint { position: absolute; right: 6px; bottom: 6px; font-size: 0.6875rem; font-weight: 700; color: #fff; background: rgba(4, 20, 30, 0.62); padding: 2px 6px; border-radius: 4px; }
.obj-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin-top: 10px; }
.obj-strip .zoomable img { aspect-ratio: 1; width: 100%; object-fit: cover; }
.detail .panel-label { margin-top: 14px; }
.sobj:hover { transform: scale(1.15); }
@media (prefers-reduced-motion: reduce) { .zoomable img { transition: none; } .sobj:hover { transform: none; } }
