/* แม่น้ำสาย 3 มิติ — Project Jurassic "Operations terminal" template in Clean Warm Daylight
   Default (:root) = โทนสว่างอุ่นสะอาดตา (#F6F7F3 / #FFFFFF / ส้มอิฐ-ทองแดง #C4581C / เขียวป่า #2E6F34)
   :root[data-theme="dark"] = โหมดมืดยามค่ำ (#0B0C29 / อำพัน #F29A3F) สลับได้ด้วยปุ่มมุมขวาบน */
:root {
  --bg: #f6f7f3;
  --bg2: #eceee6;
  --surface: #ffffff;
  --surface2: #f9faf6;
  --panel: rgba(250, 251, 247, 0.95);
  --line: rgba(52, 42, 30, 0.22);
  --line-strong: rgba(52, 42, 30, 0.38);
  --line2: rgba(52, 42, 30, 0.11);
  --ink: #221e19;
  --ink2: #352f27;
  --muted: #524a3f;
  --dim: #685f52;
  --faint: #685f52;
  --cyan: #b34812;
  --cyan-2: #963b0d;
  --cyan-hi: #963b0d;
  --cyan-soft: rgba(179, 72, 18, 0.10);
  --on-cyan: #fff8f1;
  --go: #b34812;
  --go-ink: #fff8f1;
  --go-hover: #963b0d;
  --yellow: #2e6f34;
  --amber: #8f470e;
  --red: #b92d22;
  --good: #256f3a;
  --tint: 52, 42, 30;
  --overlay: 250, 251, 247;
  --map-bg: #e5e8de;
  --scroll: #8a8274;
  --topbar: rgba(246, 247, 243, 0.95);
  --indicator: linear-gradient(90deg, rgba(246, 247, 243, 0.45), rgba(246, 247, 243, 0.94));
  --ctrl-icon: none;
  --chart-wet: rgba(14, 116, 144, 0.13);
  --chart-std: #b45309;
  --chart-border-km: #a5461a;
  --bar-conf: #0369a1;
  --bar-sev: #c4581c;
  --bar-prio: #2e6f34;
  --top: 68px;
  --side: 140px;
  --gauge-w: 175px;
  --content-w: 1180px;
  --gutter: 24px;
  --f-th: "IBM Plex Sans Thai", "Thonburi", system-ui, sans-serif;
  --f-head: "Kanit", "IBM Plex Sans Thai", system-ui, sans-serif;
  --f-en: "Oswald", "Arial Narrow", sans-serif;
  --f-tech: "Rajdhani", "Oswald", sans-serif;
  --display: var(--f-head);
  --body: var(--f-th);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0c29;
  --bg2: #12143a;
  --surface: #101238;
  --surface2: #151845;
  --panel: rgba(12, 13, 42, 0.94);
  --line: rgba(220, 214, 255, 0.18);
  --line-strong: rgba(220, 214, 255, 0.34);
  --line2: rgba(220, 214, 255, 0.09);
  --ink: #f4eee3;
  --ink2: #dcd6ea;
  --muted: #b5b1ce;
  --dim: #9490b5;
  --faint: #9490b5;
  --cyan: #f29a3f;
  --cyan-2: #d97a2b;
  --cyan-hi: #ffb469;
  --cyan-soft: rgba(242, 154, 63, 0.15);
  --on-cyan: #1d0e02;
  --go: #f29a3f;
  --go-ink: #1d0e02;
  --go-hover: #ffb469;
  --yellow: #ffd86b;
  --amber: #f7dba8;
  --red: #ff6b57;
  --good: #8fd694;
  --tint: 220, 214, 255;
  --overlay: 11, 12, 41;
  --map-bg: #0b0c29;
  --scroll: #6e6b92;
  --topbar: linear-gradient(#090a22, rgba(9, 10, 34, 0.90));
  --indicator: linear-gradient(90deg, rgba(9, 10, 34, 0.25), rgba(9, 10, 34, 0.72));
  --ctrl-icon: invert(1);
  --chart-wet: rgba(29, 79, 115, 0.55);
  --chart-std: #fde68a;
  --chart-border-km: #fef3c7;
  --bar-conf: #38bdf8;
  --bar-sev: #fb7185;
  --bar-prio: #fbbf24;
  color-scheme: dark;
}

/* View Transitions: พระอาทิตย์ขึ้น / พระอาทิตย์ตก ตามเว็บต้นแบบ */
@property --sun { syntax: "<length>"; inherits: false; initial-value: 0px; }
:root.vt-sunrise::view-transition-old(root), :root.vt-sunrise::view-transition-new(root),
:root.vt-sunset::view-transition-old(root), :root.vt-sunset::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root.vt-sunrise::view-transition-new(root), :root.vt-sunset::view-transition-old(root) {
  -webkit-mask-image: radial-gradient(circle at 50% 118%, #000 calc(var(--sun) - 14vmax), transparent var(--sun));
  mask-image: radial-gradient(circle at 50% 118%, #000 calc(var(--sun) - 14vmax), transparent var(--sun));
}
:root.vt-sunrise::view-transition-new(root) { animation: vt-sunrise 0.9s ease-in-out both; }
:root.vt-sunset::view-transition-old(root) { z-index: 2; animation: vt-sunset 0.9s ease-in-out both; }
@keyframes vt-sunrise {
  0% { --sun: 6vmax; filter: sepia(0.85) saturate(1.9) hue-rotate(-18deg) brightness(0.75); }
  45% { filter: sepia(0.4) saturate(1.4) hue-rotate(-8deg) brightness(0.92); }
  100% { --sun: 140vmax; filter: none; }
}
@keyframes vt-sunset {
  0% { --sun: 140vmax; filter: none; }
  55% { filter: sepia(0.5) saturate(1.5) hue-rotate(-10deg) brightness(0.85); }
  100% { --sun: 6vmax; filter: sepia(0.85) saturate(1.9) hue-rotate(-18deg) brightness(0.65); }
}
:root.theme-fade, :root.theme-fade * {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, fill 0.4s ease, box-shadow 0.4s ease !important;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 18px); }
body {
  margin: 0;
  padding-top: var(--top);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 46% 3%, rgba(255, 180, 95, 0.30) 0, rgba(245, 160, 90, 0.11) 14%, transparent 34%),
    linear-gradient(180deg, #f7f8f4 0%, #f4f6f0 55%, #eef1e8 100%);
  background-attachment: fixed;
  color: var(--ink);
  font: 400 15px/1.6 var(--f-th);
  accent-color: var(--cyan);
  scrollbar-color: var(--scroll) transparent;
}
:root[data-theme="dark"] body {
  background-image:
    radial-gradient(1.4px 1.4px at 23px 41px, rgba(255, 246, 220, 0.8), transparent 2px),
    radial-gradient(1px 1px at 87px 113px, rgba(200, 210, 255, 0.65), transparent 2px),
    radial-gradient(ellipse 45% 35% at 22% 18%, rgba(98, 66, 160, 0.20), transparent 70%),
    linear-gradient(180deg, #070821 0%, #0b0c29 55%, #141440 100%);
  background-size: 290px 230px, 230px 190px, auto, auto;
}

::selection { background: rgba(196, 88, 28, 0.22); color: var(--ink); }
b { font-weight: 600; }
em { font-style: normal; font-family: var(--f-tech); font-weight: 700; letter-spacing: 0.12em; color: var(--dim); font-size: 12px; margin-left: 6px; }
a { color: var(--cyan); text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Disable MapLibre decorative infinite pulse dot */
.maplibregl-user-location-dot::before { animation: none !important; display: none !important; }

/* Surface / panel helper replacing old liquid glass */
.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px -12px rgba(34, 30, 25, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--top);
  z-index: 50;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding-left: var(--gauge-w);
  padding-right: var(--side);
  box-sizing: border-box;
  transition: padding 0.25s ease;
}

.topbar-inner {
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  padding: 0 var(--gutter);
  box-sizing: border-box;
}

.wordmark { display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--ink); flex: none; }
.wm-logo { width: 44px; height: 44px; flex: none; border-radius: 50%; background: #fff; padding: 2px; object-fit: contain; }
.wm-mark { width: 22px; height: 22px; border: 2px solid var(--cyan); transform: rotate(45deg); position: relative; flex: none; }
.wm-mark::after { content: ""; position: absolute; inset: 4px; background: var(--cyan); }
.wm-text { display: flex; flex-direction: column; line-height: 1.12; }
.wm-text b { font-family: var(--f-en); font-weight: 700; font-size: 19px; letter-spacing: 0.04em; color: var(--ink); }
.wm-text small { font-family: var(--f-head); font-size: 12px; color: var(--muted); }

.chip-draft {
  font-family: var(--f-head);
  font-size: 12px;
  font-weight: 600;
  color: var(--amber);
  background: var(--cyan-soft);
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  padding: 4px 10px;
  white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  flex: none;
}

/* Simplified Top Navbar: clean borderless typography */
.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
  margin-right: 14px;
}
.top-nav-link {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-decoration: none;
  color: var(--ink);
  line-height: 1.15;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.15s ease, opacity 0.15s ease;
  cursor: pointer;
}
.top-nav-link b {
  font-family: var(--f-en);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink);
  transition: color 0.15s ease;
}
.top-nav-link small {
  font-family: var(--f-head);
  font-size: 11px;
  color: var(--muted);
  transition: color 0.15s ease;
}
.top-nav-link:hover b,
.top-nav-link:hover small {
  color: var(--cyan);
}
.top-nav-link.on b {
  color: var(--cyan);
}
.top-nav-link.on small {
  color: var(--cyan);
  font-weight: 600;
}

.prefs { display: flex; gap: 10px; align-items: center; flex: none; }
.pref {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.pref:hover { transform: scale(1.06); border-color: var(--cyan); box-shadow: 0 0 0 2px var(--cyan); }
.pref svg { width: 18px; height: 18px; display: block; }
#theme-btn { background: #161845; color: #ffd86b; border-color: transparent; box-shadow: 0 2px 8px rgba(22, 24, 69, 0.18); }
:root[data-theme="dark"] #theme-btn { background: #f1edd5; color: #1b1c45; box-shadow: 0 0 16px rgba(241, 237, 213, 0.3); }

/* ==========================================================================
   Left Sidebar: Gauge Rail & Step Scroll Timeline (inspired by ข้อมูลเก่า/index.php)
   ========================================================================== */
.gauge-rail {
  position: fixed;
  left: 0;
  top: var(--top);
  bottom: 0;
  width: var(--gauge-w);
  z-index: 45;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 14px 0 14px 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease, border-color 0.3s ease;
  user-select: none;
}
.gauge-rail[hidden] {
  display: none !important;
}

.gauge-plate {
  position: relative;
  height: 100%;
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

/* Precision ruler marks background on the gauge plate (river depth gauge style) */
.gauge-plate::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 6px;
  width: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='40'%3E%3Cg fill='%23a5461a' opacity='0.22'%3E%3Crect x='0' y='0' width='3' height='40'/%3E%3Crect x='0' y='0' width='14' height='3'/%3E%3Crect x='0' y='10' width='8' height='2'/%3E%3Crect x='0' y='20' width='14' height='3'/%3E%3Crect x='0' y='30' width='8' height='2'/%3E%3C/g%3E%3C/svg%3E") left top / 18px 40px repeat-y;
  z-index: 1;
  pointer-events: none;
}

:root[data-theme="dark"] .gauge-plate::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='40'%3E%3Cg fill='%234fb3ff' opacity='0.25'%3E%3Crect x='0' y='0' width='3' height='40'/%3E%3Crect x='0' y='0' width='14' height='3'/%3E%3Crect x='0' y='10' width='8' height='2'/%3E%3Crect x='0' y='20' width='14' height='3'/%3E%3Crect x='0' y='30' width='8' height='2'/%3E%3C/g%3E%3C/svg%3E") left top / 18px 40px repeat-y;
}

/* Water fill progress tracker (flows along the left ruler track) */
.gauge-water {
  position: absolute;
  left: 0;
  width: 42px;
  top: 0;
  height: calc(var(--gauge-level, 0.08) * 100%);
  background: linear-gradient(180deg, rgba(165, 70, 26, 0.18) 0%, rgba(14, 116, 144, 0.35) 100%);
  border-right: 1px solid var(--line2);
  border-bottom: 2.5px solid var(--cyan);
  box-shadow: 0 3px 10px rgba(14, 116, 144, 0.30);
  transition: height 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 2;
  pointer-events: none;
}

:root[data-theme="dark"] .gauge-water {
  background: linear-gradient(180deg, rgba(227, 136, 51, 0.22) 0%, rgba(56, 189, 248, 0.38) 100%);
  border-right: 1px solid var(--line2);
  border-bottom: 2.5px solid var(--cyan);
  box-shadow: 0 3px 12px rgba(79, 179, 255, 0.45);
}

.gauge-marks {
  position: relative;
  z-index: 3;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gauge-marks li {
  flex: 1;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line2);
  min-height: 0;
}
.gauge-marks li:last-child {
  border-bottom: 0;
}

.gauge-marks a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 0 10px 0 14px;
  box-sizing: border-box;
  text-decoration: none;
  color: var(--muted);
  outline: none;
  transition: color 0.2s, background 0.2s;
  overflow: hidden;
}

.gauge-marks a:hover,
.gauge-marks a:focus-visible {
  background: rgba(165, 70, 26, 0.08);
}
:root[data-theme="dark"] .gauge-marks a:hover,
:root[data-theme="dark"] .gauge-marks a:focus-visible {
  background: rgba(242, 154, 63, 0.12);
}

.mark-num {
  font-family: var(--f-en);
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.25s ease;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="dark"] .mark-num {
  background: rgba(255, 255, 255, 0.07);
}

.mark-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
}

.mark-th {
  font-family: var(--f-head);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
  transition: color 0.2s;
}

.mark-en {
  font-family: var(--f-en);
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.gauge-marks a.is-under .mark-num {
  color: var(--ink);
  font-weight: 600;
  background: rgba(165, 70, 26, 0.12);
}

.gauge-marks a.is-active {
  background: rgba(165, 70, 26, 0.10);
  border-left: 3px solid var(--cyan);
}
:root[data-theme="dark"] .gauge-marks a.is-active {
  background: rgba(242, 154, 63, 0.15);
  border-left: 3px solid var(--cyan);
}

.gauge-marks a.is-active .mark-num {
  background: var(--cyan);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(165, 70, 26, 0.35);
  transform: scale(1.05);
}

:root[data-theme="dark"] .gauge-marks a.is-active .mark-num {
  background: var(--cyan);
  color: #0b0c24;
  box-shadow: 0 0 10px rgba(242, 154, 63, 0.5);
}

.gauge-marks a.is-active .mark-th {
  color: var(--cyan);
  font-weight: 700;
}

.gauge-marks a.is-active .mark-en {
  color: var(--cyan);
  font-weight: 700;
  opacity: 0.95;
}

/* Floating tooltip card on hover / active */
.mark-label {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  padding: 8px 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
}

.mark-label b {
  font-size: 13px;
  font-family: var(--f-head);
  color: var(--ink);
  font-weight: 600;
}

.mark-label small {
  font-size: 11px;
  font-family: var(--f-en);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gauge-marks a:hover .mark-label,
.gauge-marks a:focus-visible .mark-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Tooltip caret */
.mark-label::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: var(--line);
}
.mark-label::after {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--surface);
}

/* ---------------------------------------------------------------- section indicator (right column) */
.indicator {
  position: fixed;
  right: 0;
  top: var(--top);
  bottom: 0;
  width: var(--side);
  z-index: 40;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding-right: 22px;
  pointer-events: none;
  background: var(--indicator);
  box-sizing: border-box;
  transition: opacity 0.25s ease;
}
.indicator[hidden] {
  display: none !important;
}

.ind-num {
  font-family: var(--f-en);
  font-weight: 700;
  font-size: 68px;
  line-height: 0.85;
  color: var(--cyan);
  letter-spacing: -0.02em;
}

.ind-frac {
  font-family: var(--f-tech);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  margin-top: 8px;
  letter-spacing: 0.04em;
}

.ind-name {
  font-family: var(--f-en);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 3px;
  text-align: right;
  max-width: 110px;
  line-height: 1.15;
}

.nx.player {
  display: none !important;
}

/* ---------------------------------------------------------------- main layout & desktop alignment */
@media (min-width: 1025px) {
  body {
    padding-left: var(--gauge-w);
    padding-right: var(--side);
    box-sizing: border-box;
  }
  .view, main, .nx-brand {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .nx .wrap,
  .brand .wrap,
  main,
  .foot {
    max-width: var(--content-w) !important;
    margin: 0 auto !important;
    padding-left: var(--gutter) !important;
    padding-right: var(--gutter) !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 1024px) {
  :root {
    --side: 0px;
    --gauge-w: 0px;
    --gutter: 18px;
  }
  .gauge-rail {
    display: none !important;
  }
  .indicator {
    display: none !important;
  }
  .topbar {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .nx .wrap,
  .brand .wrap,
  main,
  .foot {
    padding-left: var(--gutter) !important;
    padding-right: var(--gutter) !important;
  }
}

main {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 var(--gutter) 36px var(--gutter);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page {
  position: relative;
  padding: 46px 0 24px;
  overflow: hidden;
}
.page + .page { border-top: 1px solid var(--line); }

.bigword {
  position: absolute;
  right: 8px;
  top: 16px;
  font-family: var(--f-en);
  font-weight: 700;
  font-size: clamp(76px, 9vw, 136px);
  text-transform: uppercase;
  line-height: 0.82;
  pointer-events: none;
  color: rgba(var(--tint), 0.045);
  white-space: nowrap;
  letter-spacing: -0.01em;
  user-select: none;
  z-index: 0;
}
.page > *:not(.bigword) { position: relative; z-index: 1; }

.kicker { font-family: var(--f-tech); font-weight: 700; font-size: 13px; letter-spacing: 0.16em; color: var(--cyan); }
.kicker span { color: var(--dim); margin: 0 4px; }

.eyebrow {
  margin: 0 0 10px;
  font-family: var(--f-tech);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--muted);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.eyebrow span { color: var(--dim); }
.eyebrow .num {
  font-family: var(--f-en);
  font-weight: 600;
  color: var(--on-cyan);
  background: var(--cyan);
  padding: 2px 10px;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
}

.page h2 {
  margin: 0 0 8px;
  font: 600 clamp(22px, 2.4vw, 28px)/1.28 var(--f-head);
  color: var(--ink);
  letter-spacing: -0.01em;
}
.lead { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; max-width: 920px; }
.note {
  margin: 12px 0 0;
  padding: 9px 13px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 960px;
  border: 1px solid var(--line2);
  border-top: 2px solid var(--cyan);
  background: rgba(var(--tint), 0.025);
}

/* ---------------------------------------------------------------- 01 Hero / Summary */
.hero { padding-top: 38px; }
.hero h1 {
  margin: 0;
  font: 700 clamp(26px, 3.2vw, 42px)/1.2 var(--f-head);
  max-width: 1020px;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.hero-en {
  font-family: var(--f-en);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.24em;
  color: var(--dim);
  margin-top: 6px;
}
.hero .why {
  margin: 16px 0 0;
  color: var(--ink2);
  font-size: 15.5px;
  max-width: 960px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  padding: 10px 14px;
  background: var(--cyan-soft);
}
.hero .why b { color: var(--ink); }
.hero .miss { color: var(--amber); font-size: 14px; font-weight: 500; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 26px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  padding: 16px 18px;
  box-shadow: 0 6px 18px -10px rgba(34, 30, 25, 0.10);
}
.kpi p { margin: 0; }
.k-t { font-family: var(--f-head); font-size: 13.5px; font-weight: 500; color: var(--muted); }
.k-v { font: 700 38px/1.08 var(--f-en); color: var(--ink); margin: 8px 0 6px !important; letter-spacing: -0.01em; }
.k-v small { font: 500 15px var(--f-head); color: var(--muted); margin-left: 3px; }
.k-s { font-size: 13px; color: var(--ink2); }
.k-src { font-size: 12px; color: var(--amber); margin-top: 8px !important; font-weight: 500; }
.kpi-calc { border-top-color: var(--yellow); background: linear-gradient(180deg, rgba(46, 111, 52, 0.05), var(--surface) 45%); }
.kpi-calc .k-src { color: var(--yellow); }

/* ---------------------------------------------------------------- tables & ranking */
.table-wrap {
  overflow-x: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  box-shadow: 0 6px 18px -10px rgba(34, 30, 25, 0.08);
}
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; vertical-align: top; padding: 11px 12px; border-bottom: 1px solid var(--line2); }
th {
  font: 600 13px var(--f-head);
  color: var(--muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.4; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--f-tech); font-size: 15px; font-weight: 700; }
td.b { font-weight: 700; color: var(--ink); }
.rank { min-width: 980px; }
.rank tbody tr:hover { background: rgba(var(--tint), 0.025); }
.rank tr.go { background: rgba(196, 88, 28, 0.07); }
.rank td.prop { max-width: 240px; font-size: 13.5px; color: var(--ink2); }
.gdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 0; border: 1px solid rgba(0, 0, 0, 0.25); }
.sc { display: grid; grid-template-columns: auto 90px 30px; gap: 4px 8px; align-items: center; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sc b { color: var(--ink); text-align: right; font-family: var(--f-tech); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: rgba(var(--tint), 0.12); overflow: hidden; }
.bar i { display: block; height: 100%; }
.evb { white-space: nowrap; }
.st { display: inline-grid; place-items: center; font: 600 15px/1 var(--f-head); }
button.st {
  width: 62px;
  min-height: 50px;
  margin: 0 2px;
  border: 1px solid var(--line);
  background: var(--surface2);
  cursor: pointer;
  padding: 6px 3px;
  gap: 3px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
  transition: border-color 0.15s, background 0.15s;
}
button.st small { font: 500 12px var(--f-th); color: var(--muted); margin: 0; }
button.st:hover { border-color: var(--cyan); background: var(--cyan-soft); }
.st-y { color: var(--good); }
.st-p { color: #b45309; }
:root[data-theme="dark"] .st-p { color: #fbbf24; }
.st-n, .st-w { color: var(--dim); }
span.st { padding: 0 2px; }

/* ---------------------------------------------------------------- charts & tabs */
.chart-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  padding: 14px 12px 10px;
  box-shadow: 0 6px 18px -10px rgba(34, 30, 25, 0.08);
}
.chart { display: block; width: 100%; height: auto; font-family: var(--f-th); }
.chart .grid { stroke: var(--line2); }
.chart .zero { stroke: var(--line-strong); }
.chart .tick { fill: var(--muted); font-size: 12px; }
.chart .tick.dim { fill: var(--dim); font-size: 12px; }
.chart .tick.hot, .daybox b.hot { fill: var(--red); color: var(--red); font-weight: 700; }
.chart .wet { fill: var(--chart-wet); }
.chart .std { stroke: var(--chart-std); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .border-km { stroke: var(--chart-border-km); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .thr { stroke-dasharray: 5 4; stroke-width: 1.6; opacity: 0.9; }
.chart .na { fill: var(--dim); font-size: 12px; }
.chart .tick-ok { fill: var(--good); font-size: 15px; font-weight: 700; }
.chart .tick-wet { fill: #0369a1; font-size: 15px; font-weight: 700; }
:root[data-theme="dark"] .chart .tick-wet { fill: #7dd3fc; }
.chart .col { cursor: pointer; }
.chart .col.on > rect:first-child { fill: var(--cyan-soft); stroke: var(--cyan); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .km-prev { fill: none; stroke: var(--dim); stroke-width: 1.6; opacity: 0.45; }
.chart .km-cur { fill: none; stroke: var(--ink); stroke-width: 2.2; }
.chart .jumpband { fill: rgba(185, 45, 34, 0.14); stroke: var(--red); stroke-dasharray: 3 3; }
.chart .goq { fill: rgba(196, 88, 28, 0.09); stroke: var(--cyan); stroke-dasharray: 4 4; }
.chart .bub-t { fill: var(--ink); font: 700 12px var(--f-head); pointer-events: none; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }

.wait {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  margin: 0;
  max-width: 82%;
  text-align: center;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px dashed var(--cyan);
  border-top: 2px solid var(--cyan);
  color: var(--amber);
  font: 500 14px/1.5 var(--f-head);
  box-shadow: 0 8px 24px rgba(34, 30, 25, 0.12);
}
.stats { margin: 12px 0 0; font-size: 14.5px; color: var(--muted); }
.stats b { color: var(--ink); font-family: var(--f-tech); font-size: 17px; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font: 500 13.5px var(--f-head);
  color: var(--muted);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tabs button:hover { border-color: var(--cyan); color: var(--ink); }
.tabs button i { width: 10px; height: 10px; border-radius: 50%; background: var(--gc); border: 1px solid rgba(0, 0, 0, 0.25); }
.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-color: var(--cyan);
  background: var(--cyan-soft);
  box-shadow: inset 0 0 0 1px var(--cyan);
  font-weight: 600;
}

/* ---------------------------------------------------------------- segmented & icon buttons */
.seg { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); background: var(--surface2); }
.seg button {
  white-space: nowrap;
  border: 0;
  background: transparent;
  min-height: 34px;
  padding: 0 14px;
  font: 500 13.5px var(--f-head);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--cyan); }
.seg button[aria-pressed="true"] { background: var(--cyan); color: var(--on-cyan); font-weight: 600; }
.seg button[aria-pressed="true"]:hover { color: var(--on-cyan); background: var(--cyan-hi); }
.seg-wide { width: 100%; }
.seg-wide button { flex: 1; }

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
  flex: none;
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------------------------------------------------------------- 05 Map & Controls Panel */
.page-map { padding-bottom: 24px; }
.mapwrap {
  position: relative;
  height: min(84vh, 840px);
  height: min(84dvh, 840px);
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  margin-top: 12px;
  background: var(--map-bg);
  box-shadow: 0 12px 32px -14px rgba(34, 30, 25, 0.18);
}
#map { position: absolute; inset: 0; }

.map-tools {
  position: absolute;
  z-index: 5;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  transition: left 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.panel {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  bottom: 0;
  width: 340px;
  display: flex;
  flex-direction: column;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 10px 0 28px -12px rgba(34, 30, 25, 0.22);
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, height 0.26s cubic-bezier(0.22, 1, 0.36, 1), max-height 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.panel[data-open="false"] { opacity: 0; transform: translateX(-100%); pointer-events: none; }

/* Google Maps-style protruding side collapse tab on Desktop & Tablet */
.panel-tab {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 340px;
  transform: translateY(-50%);
  width: 24px;
  height: 60px;
  padding: 0;
  border: 1px solid var(--line);
  border-left: 0;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 5px 2px 14px rgba(34, 30, 25, 0.16);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
  transition: left 0.28s cubic-bezier(0.22, 1, 0.36, 1), background 0.15s, color 0.15s, border-color 0.15s;
}
.panel-tab:hover { color: var(--cyan); background: var(--surface2); border-color: var(--cyan); }
.panel-tab svg { width: 16px; height: 16px; transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1); }
.panel[data-open="false"] ~ .panel-tab { left: 0; }
.panel[data-open="false"] ~ .panel-tab svg { transform: rotate(180deg); }

.sheet-grab { display: none; }
.sheet-trigger {
  display: none;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  background: var(--surface);
  color: var(--ink);
  font: 600 13.5px var(--f-head);
  cursor: pointer;
  white-space: nowrap;
}
.sheet-trigger svg { width: 17px; height: 17px; color: var(--cyan); flex: none; }
.sheet-trigger:hover { border-color: var(--cyan); color: var(--cyan); }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.panel-head h2 { margin: 2px 0 0; font: 600 18px/1.2 var(--f-head); }
.panel-head .spacer { flex: 1; }
.panel-body { overflow-y: auto; padding: 4px 0 16px; scrollbar-color: var(--scroll) transparent; }
.sec { padding: 12px 18px 8px; }
.sec + .sec { border-top: 1px solid var(--line2); }
.sec-title { margin: 0 0 8px; font: 600 13px var(--f-head); color: var(--muted); }
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 5px 8px;
  margin: 0 -8px;
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  border-bottom: 1px solid transparent;
}
.row:hover { background: rgba(var(--tint), 0.04); }
.row .glyph { width: 22px; flex: none; display: grid; place-items: center; }
.row .txt { flex: 1; min-width: 0; line-height: 1.35; }
.row .txt small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.row input[type="radio"], .row input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--cyan); flex: none; }

.fly { display: flex; flex-wrap: wrap; gap: 6px; }
.fly button {
  border: 1px solid var(--line);
  background: var(--surface);
  min-height: 34px;
  padding: 4px 11px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}
.fly button:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-soft); }

.range { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.range span { white-space: nowrap; }
.range input { flex: 1; accent-color: var(--cyan); }
.range output { font: 700 14px var(--f-tech); color: var(--cyan); min-width: 36px; text-align: right; }

.g-line { width: 22px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #313695, #e0f3f8, #fdae61, #a50026); box-shadow: 0 0 0 1.5px #2b2118; }
.g-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #221e19; background: #d6a86a; }
.g-sq { width: 16px; height: 12px; border: 1px solid rgba(0, 0, 0, 0.35); background: linear-gradient(135deg, #2d4a2b, #7d8a5a); }
.g-jump { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #ef4444; background: rgba(239, 68, 68, 0.15); }
.g-servir { width: 18px; height: 13px; border: 1.5px solid #592039; background: linear-gradient(90deg, #FFF0D4 0 25%, #F0BE91 25% 50%, #DB7F68 50% 75%, #A94159 75%); }
.g-ev { width: 18px; height: 12px; background: linear-gradient(90deg, #a3e635 0 50%, #f97316 50%); border: 1px solid rgba(0, 0, 0, 0.3); }
.g-zone { width: 18px; height: 14px; border-radius: 50%; border: 2px dashed #7c3aed; }
.g-stim { width: 10px; height: 10px; background: #4fb3ff; transform: rotate(45deg); border: 1.5px solid #0b1620; }
.g-path { width: 22px; height: 0; border-top: 2.5px dashed #0284c7; }

.panel-open {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 12px;
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  font: 600 13.5px var(--f-head);
  color: var(--ink);
  border-top: 2px solid var(--cyan);
}
.panel[data-open="false"] ~ .panel-open { display: flex; }

/* ---------------------------------------------------------------- timeline (bottom centre) */
.timeline {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(600px, calc(100% - 32px));
  padding: 12px 18px;
  border-top: 2px solid var(--cyan);
  transition: left 0.28s cubic-bezier(0.22, 1, 0.36, 1), width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
/* padding keeps the centred head clear of the absolutely placed .tl-toggle when the timeline narrows beside the open panel */
.tl-head { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 38px; }
.tl-step {
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink);
}
.tl-step:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); }
.tl-step:disabled { opacity: 0.38; cursor: default; }
.tl-date { text-align: center; min-width: 210px; }
.tl-date b { display: block; font: 600 16px/1.25 var(--f-head); color: var(--ink); }
.tl-date small { color: var(--muted); font-size: 12px; }
.tl-track { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.tl-play {
  width: 40px;
  height: 40px;
  border: 0;
  background: var(--cyan);
  color: var(--on-cyan);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}
.tl-play:hover { background: var(--cyan-hi); }
.tl-rail { position: relative; flex: 1; height: 32px; }
.tl-rail::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--line-strong); }
.tl-rail button { position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 0; padding: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.tl-rail button::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); transition: transform 0.2s, background 0.2s; }
.tl-rail button:hover::after { background: var(--ink); transform: scale(1.3); }
.tl-rail button[aria-current="true"]::after { width: 13px; height: 13px; background: var(--cyan); box-shadow: 0 0 0 4px var(--cyan-soft); }
.tl-rail .tl-event::before { content: ""; position: absolute; top: -8px; width: 2px; height: 6px; background: var(--amber); }
.tl-months { position: relative; height: 16px; font-size: 12px; color: var(--muted); margin-left: 52px; font-family: var(--f-tech); font-weight: 600; }
.tl-months span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.tl-stats b { color: var(--ink); font-weight: 600; }
.tl-toggle { position: absolute; top: 12px; right: 12px; }
.timeline[data-collapsed="true"] { width: max-content; max-width: calc(100% - 32px); padding: 6px 10px; }
.timeline[data-collapsed="true"] .tl-date b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.timeline[data-collapsed="true"] #tl-body, .timeline[data-collapsed="true"] #tl-sensor, .timeline[data-collapsed="true"] .tl-jump { display: none; }
.timeline[data-collapsed="true"] .tl-date { min-width: 0; padding: 0 6px; }
.timeline[data-collapsed="true"] .tl-toggle { position: static; }
.timeline[data-collapsed="true"] .tl-head { padding: 0; }
.timeline[data-collapsed="true"] .tl-toggle svg { transform: rotate(180deg); }

.tl-rain { position: relative; height: 26px; margin: 8px 0 0 52px; border-bottom: 1px solid var(--line); }
.tl-rain i { position: absolute; bottom: 0; width: 3px; margin-left: -1.5px; background: #0284c7; opacity: 0.85; }
.tl-rain span { position: absolute; left: 0; top: -2px; font-size: 12px; color: var(--muted); pointer-events: none; }
.tl-jump { text-align: center; margin-top: 4px; font-size: 12.5px; color: var(--red); }
.tl-jump b { color: var(--red); font-weight: 700; }

/* ---------------------------------------------------------------- legend & readout */
.mapwrap .legend {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: 14px;
  width: 248px;
  padding: 10px 14px;
  border-top: 2px solid var(--cyan);
}
.legend-t { font: 600 13px var(--f-head); color: var(--ink); margin: 0 0 6px; }
.legend-ramp { height: 10px; background: linear-gradient(90deg, #f1e4c8, #d6a86a, #9a5b2a, #4a2a14); border: 1px solid rgba(0, 0, 0, 0.25); }
.legend-l { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--muted); font-family: var(--f-tech); font-weight: 600; }
.legend-x { display: flex; gap: 6px 12px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line2); font-size: 12px; color: var(--muted); }
.legend-x span { display: inline-flex; align-items: center; gap: 5px; }
.legend-x i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }

.readout {
  position: absolute;
  z-index: 3;
  left: 12px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font: 600 12.5px var(--f-tech);
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: left 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* On desktop (> 1024px), shift map tools, timeline, and readout when the Google Maps left sidebar is open */
@media (min-width: 1025px) {
  .mapwrap[data-panel-open="true"] .map-tools {
    left: calc(340px + (100% - 340px) / 2);
  }
  .mapwrap[data-panel-open="true"] .timeline {
    left: calc(340px + (100% - 340px - 260px) / 2);
    width: min(520px, calc(100% - 340px - 284px));
  }
  .mapwrap[data-panel-open="true"] .readout {
    left: 354px;
  }
}
.readout span { color: var(--ink); }

/* MapLibre controls styled after reference template */
.maplibregl-ctrl-top-right { top: 12px !important; right: 12px !important; }
.maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 0 !important; }
.maplibregl-ctrl-group { background: var(--surface) !important; border: 1px solid var(--line) !important; border-radius: 0 !important; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 38px !important; height: 38px !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: var(--ctrl-icon); }
.maplibregl-ctrl-bottom-left { bottom: 52px !important; left: 12px !important; }
.maplibregl-ctrl-scale { background: rgba(var(--overlay), 0.85) !important; color: var(--ink) !important; border-color: var(--muted) !important; font-size: 12px !important; margin: 0 !important; }
.maplibregl-popup-content {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  border-radius: 0;
  padding: 12px 15px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  font-family: var(--f-th);
}
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 18px; width: 30px; height: 30px; }
.pop-kind { font: 700 12px var(--f-tech); letter-spacing: 0.08em; color: var(--cyan); text-transform: uppercase; }
.pop h3 { margin: 4px 0 6px; font: 600 16px/1.3 var(--f-head); color: var(--ink); }
.pop p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
.pop p b { color: var(--ink); font-weight: 600; }

/* Gold mine & zone markers on map */
.mine-mk {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  font: 700 12px/1 var(--f-tech);
  color: #ffffff;
  background: #c81e1e;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.mine-mk[data-status="waiting"] { background: #1e293b; border-color: #f59e0b; color: #fde68a; }
.mine-mk:hover { transform: scale(1.15); }
.mine-glyph { width: 20px; height: 20px; font-size: 12px; cursor: default; box-shadow: none; }

.zone-mk {
  border: 1px solid rgba(0, 0, 0, 0.35);
  padding: 3px 9px;
  cursor: pointer;
  font: 600 12px var(--f-head);
  color: #ffffff;
  background: var(--gc);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
}
.zone-mk b { font-weight: 700; }

/* Day summary box under map */
.hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.daybox { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.db-cell, .db-msg {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 11px 14px;
}
.db-cell span, .db-msg span { display: block; font: 500 12.5px var(--f-head); color: var(--muted); }
.db-cell b { display: block; font: 700 22px/1.25 var(--f-en); color: var(--ink); margin-top: 2px; }
.db-cell small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.db-msg { grid-column: span 4; border-top: 2px solid var(--cyan); background: var(--cyan-soft); }
.db-msg p { margin: 4px 0 0; font: 500 15.5px/1.5 var(--f-head); color: var(--ink); }

.ev3-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; font: 600 14px var(--f-head); color: var(--red); }

/* ---------------------------------------------------------------- Evidence 4 & 5 */
.ev4-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.facts {
  margin: 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 9px 16px;
  font-size: 14px;
}
.facts dt { color: var(--muted); font-family: var(--f-head); font-weight: 500; }
.facts dd { margin: 0; color: var(--ink); }
.facts dd small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.facts-wide { margin: 12px 0 22px; padding: 18px 22px; gap: 10px 22px; }
.crop {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  padding: 10px;
}
.crop img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); background: var(--bg2); }
.crop figcaption { font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.45; }

.ev5-grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 18px; align-items: start; margin-bottom: 18px; }
.rules-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--cyan);
  padding: 16px 18px;
}
.rules-card .table-wrap { border: 0; box-shadow: none; }
.h3 { margin: 0 0 10px; font: 600 16px var(--f-head); color: var(--ink); }
.rules td { padding: 7px 8px; }
.rules tr.rh th { padding-top: 12px; color: var(--cyan); background: transparent; font: 700 13px var(--f-head); }
.rules input {
  width: 86px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface2);
  color: var(--ink);
  font: 700 14px var(--f-tech);
  text-align: right;
}
.rules .u { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.btn-ghost {
  margin-top: 12px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  background: var(--surface2);
  color: var(--ink);
  font: 500 13.5px var(--f-head);
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-soft); }

.evtable { min-width: 1100px; font-size: 13.5px; }
.evtable caption { text-align: left; font: 600 15px var(--f-head); padding: 10px 12px; color: var(--ink); background: var(--surface2); border-bottom: 1px solid var(--line); }

/* ---------------------------------------------------------------- footer, dialog & loading */
.foot {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px calc(var(--side) + var(--gutter)) 32px var(--gutter);
  color: var(--muted);
  font-size: 12.5px;
  border-top: 1px solid var(--line);
}
.foot p { margin: 0; flex: 1; line-height: 1.6; }
.foot button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--cyan);
  cursor: pointer;
  font: 600 13px var(--f-head);
  padding: 7px 14px;
  white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}
.foot button:hover { border-color: var(--cyan); background: var(--cyan-soft); }

dialog {
  max-width: 680px;
  width: calc(100% - 32px);
  border-radius: 0;
  padding: 26px 30px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--cyan);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.32);
}
dialog::backdrop { background: rgba(15, 14, 12, 0.62); backdrop-filter: blur(3px); }
dialog h2 { margin: 4px 0 14px; font: 600 24px var(--f-head); color: var(--ink); }
dialog p { margin: 0 0 10px; font-size: 14px; line-height: 1.7; color: var(--ink2); }
dialog p b { color: var(--ink); }
dialog form button {
  margin-top: 10px;
  min-height: 42px;
  padding: 0 22px;
  border: 0;
  background: var(--cyan);
  color: var(--on-cyan);
  font: 600 14.5px var(--f-head);
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}
dialog form button:hover { background: var(--cyan-hi); }

#loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(var(--overlay), 0.90);
}
.loading-box { text-align: center; padding: 24px 30px; max-width: 420px; border-top: 2px solid var(--cyan); }
.loading-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  border-top-color: var(--cyan);
  animation: spin 0.9s linear infinite;
}
.loading-box b { display: block; font: 600 16px var(--f-head); color: var(--ink); }
.loading-box small { color: var(--muted); font-size: 12.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Progressive enhancement fallback when accent-color is unsupported */
@supports not (accent-color: #c4581c) {
  input[type="checkbox"], input[type="radio"] { border: 2px solid var(--cyan); }
  input[type="range"] { -webkit-appearance: none; appearance: none; background: var(--line); height: 6px; }
  input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--cyan); cursor: pointer; }
  input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--cyan); cursor: pointer; }
}

/* Forced Colors Mode support */
@media (forced-colors: active) {
  .kpi, .table-wrap, .chart-card, .panel, .timeline, .legend, .db-cell, .db-msg, .tabs button, button.st {
    border: 1px solid CanvasText;
  }
  .seg button[aria-pressed="true"], .tabs button[aria-selected="true"] {
    outline: 2px solid Highlight;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0s !important; }
}

/* ---------------------------------------------------------------- Responsive breakpoints (Tablet & Mobile) + Coarse Pointer */
.phone-only { display: none !important; }
.tl-legend { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.tl-legend .legend-ramp { flex: 1; height: 8px; }
.phone-ctrl button { font: 600 13px var(--f-head) !important; color: var(--ink) !important; }
.phone-ctrl svg { width: 18px; height: 18px; }

/* evidence 4 Google Earth pair + per-source findings (brief 10 Nov 2569) */
.ge-pair { display: block; margin-top: 10px; }
.ge-split-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  margin-top: 10px;
}
.ge-compare-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 755;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0b1320;
  user-select: none;
  touch-action: pan-y;
  cursor: ew-resize;
}
.ge-comp-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.ge-comp-before-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  clip-path: inset(0 calc(100% - var(--slider-pos, 50%)) 0 0);
  -webkit-clip-path: inset(0 calc(100% - var(--slider-pos, 50%)) 0 0);
  pointer-events: none;
}
.ge-badge {
  position: absolute;
  top: 14px;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-family: var(--f-head);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.ge-badge-before { left: 14px; }
.ge-badge-after { right: 14px; }

.ge-divider {
  position: absolute;
  top: 0;
  bottom: 115px;
  left: var(--slider-pos, 50%);
  width: 0;
  pointer-events: none;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ge-divider-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
}
.ge-drag-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c4581c;
  cursor: ew-resize;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ge-compare-wrap:hover .ge-drag-handle,
.ge-compare-wrap:active .ge-drag-handle {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.ge-range-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 115px);
  opacity: 0;
  cursor: ew-resize;
  z-index: 10;
  margin: 0;
  padding: 0;
}

/* Timeline Overlay directly on top of comparison map */
.ge-timeline-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(11, 19, 32, 0) 0%, rgba(11, 19, 32, 0.72) 20%, rgba(11, 19, 32, 0.94) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 18px 10px;
  pointer-events: auto;
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}
.ge-timeline-overlay .ge-tl {
  margin: 0;
  padding: 0;
}
.ge-timeline-overlay .tl-head {
  padding: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.ge-timeline-overlay .tl-step {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ge-timeline-overlay .tl-step:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}
.ge-timeline-overlay .tl-step:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.ge-timeline-overlay .tl-date {
  min-width: 0;
  flex: 1;
  text-align: center;
}
.ge-timeline-overlay .tl-date b {
  font-family: var(--f-head);
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  display: block;
}
.ge-timeline-overlay .tl-date small {
  display: block;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  margin-top: 1px;
}
.ge-timeline-overlay .tl-track {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 5px;
}
.ge-timeline-overlay .tl-play {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f97316;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4);
}
.ge-timeline-overlay .tl-play:hover {
  background: #ea580c;
  transform: scale(1.06);
}
.ge-timeline-overlay .tl-rail {
  position: relative;
  flex: 1;
  height: 26px;
}
.ge-timeline-overlay .tl-rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}
.ge-timeline-overlay .tl-rail button {
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ge-timeline-overlay .tl-rail button::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  transition: transform 0.2s, background 0.2s;
  border: 1.5px solid rgba(15, 23, 42, 0.8);
}
.ge-timeline-overlay .tl-rail button:hover::after {
  background: #ffffff;
  transform: scale(1.35);
}
.ge-timeline-overlay .tl-rail button[aria-current="true"]::after {
  width: 13px;
  height: 13px;
  background: #f97316;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.5);
}
.ge-timeline-overlay .tl-rail .tl-event::before {
  content: "";
  position: absolute;
  top: -6px;
  width: 2px;
  height: 6px;
  background: #fbbf24;
}
.ge-timeline-overlay .ge-years {
  position: relative;
  height: 15px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  margin: 1px 0 0 44px;
  font-family: var(--f-tech, monospace);
  font-weight: 500;
}
.ge-timeline-overlay .ge-years span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}
.ge-timeline-overlay .ge-years span[data-active="true"] {
  color: #fbbf24;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.5);
}
.ge-timeline-overlay .ge-credit {
  margin-top: 3px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.58);
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.ge-hint-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--f-th);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 12px 0 14px;
}
.ge-timeline-box {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 6px;
}
.ge-after-info {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.ge-after-info b {
  color: var(--ink);
  font-family: var(--f-head);
  font-size: 13.5px;
}
.concl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.concl-card { border: 1px solid var(--line); border-top: 4px solid var(--gc); background: var(--surface); padding: 14px 16px; box-shadow: 0 6px 18px -10px rgba(34, 30, 25, 0.08); }
.concl-card header b { font-size: 16px; }
.concl-card header small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.concl-rank { font-weight: 700; margin-right: 8px; color: var(--gc); font-family: var(--f-en); font-size: 18px; }
.concl-verdict { margin: 10px 0 6px; font-weight: 600; }
.concl-ev { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.concl-ev li { position: relative; padding: 5px 0 5px 24px; border-top: 1px solid var(--line2); }
.concl-ev .st { position: absolute; left: 0; top: 5px; width: 18px; }
.concl-score, .concl-prop { margin: 8px 0 0; font-size: 13px; }
.ge-pick { margin-left: 8px; display: inline-flex; align-items: center; gap: 4px; }
.ge-pick select { font: inherit; padding: 3px 8px; border: 1px solid var(--line-strong); background: var(--surface2); color: inherit; }
.ge-tl { margin-top: 6px; padding-top: 4px; }
.ge-tl .tl-head { padding: 0; justify-content: space-between; gap: 10px; }
.ge-tl .tl-date { min-width: 0; flex: 1; }
.ge-tl .tl-date b { font-size: 14.5px; }
.ge-tl .tl-track { margin: 8px 12px 0 0; }
.ge-tl .ge-years { margin: 2px 12px 0 52px; font-size: 11px; }
.ge-tl .ge-years span[data-active="true"] { color: var(--cyan); font-weight: 700; }
.ge-credit { margin-top: 6px; font-size: 12px; color: var(--muted); text-align: center; }
.ge-after-cap { margin-top: 6px; padding-top: 4px; text-align: center; }
.ge-after-cap b { display: block; font: 600 14.5px/1.3 var(--f-head); color: var(--ink); }
.ge-after-cap small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .ge-tl .ge-years span:nth-child(even):not([data-active="true"]):not(:last-child) { display: none; }
  .ge-compare-wrap { min-height: 360px; }
  .ge-timeline-overlay { padding: 10px 12px 8px; }
  .ge-timeline-overlay .ge-years span:nth-child(even):not([data-active="true"]):not(:last-child) { display: none; }
}

/* Touch-first ergonomics for tablets & mobile phones (WCAG 2.5.5 / 2.5.8 target size) */
@media (pointer: coarse) {
  .pref, .icon-btn, .tl-step, .tl-play { min-width: 44px; min-height: 44px; }
  .seg button, .tabs button, .fly button, .btn-ghost, .foot button { min-height: 44px; }
  .row { min-height: 44px; padding: 6px 8px; }
  .row input[type="radio"], .row input[type="checkbox"] { width: 20px; height: 20px; }
  .rules input, .ge-pick select { min-height: 44px; font-size: 16px; }
  .maplibregl-ctrl-group button { width: 44px !important; height: 44px !important; }
  .tl-rail button { width: 32px; height: 32px; margin: -16px 0 0 -16px; }
}

/* Tablet Landscape & Compact Desktop (<= 1100px) */
@media (max-width: 1100px) {
  :root { --side: 0px; }
  .indicator { display: none; }
  .top-nav { margin-right: 12px; gap: 8px; }
  .top-nav-link { padding: 3px 6px; }
}

/* Tablet (<= 1024px): Prevent map panel, timeline, and legend from colliding; sticky group column in wide evidence table */
@media (max-width: 1024px) {
  :root { --gutter: 22px; }
  .mapwrap {
    height: min(78vh, 720px);
    height: min(78dvh, 720px);
    min-height: 500px;
  }
  .legend.desk-only, .readout { display: none !important; }
  .tl-legend.phone-only { display: flex !important; }
  .panel {
    z-index: 6;
    width: min(340px, 86vw);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.20);
  }
  .panel-tab {
    left: min(340px, 86vw);
  }
  .timeline {
    width: min(560px, calc(100% - 28px));
  }
  .evtable th:nth-child(2), .evtable td:nth-child(2) {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
    box-shadow: 2px 0 0 var(--line);
  }
  .evtable th:nth-child(2) {
    background: var(--surface2);
    z-index: 3;
  }
  .table-wrap, .chart-card {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
}

/* Tablet Portrait (<= 960px): 2-column KPIs & daybox, stacked Evidence 5 matrix */
@media (max-width: 960px) {
  .chip-draft { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .daybox { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-msg { grid-column: span 2; }
  .ev4-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .facts { grid-column: span 2; }
  .ev5-grid { grid-template-columns: 1fr; }
  #bubble { max-width: 440px; margin: 0 auto; }
  .concl-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
}

/* Tablet Portrait & Mobile (<= 860px): Transform wide ranking table into structured cards */
@media (max-width: 860px) {
  #rank .table-wrap { padding: 0; background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .rank { min-width: 0; }
  .rank thead { display: none; }
  .rank, .rank tbody, .rank tr, .rank td { display: block; }
  .rank tbody { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .rank tr {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 2px solid var(--cyan);
    padding: 14px 16px 14px 46px;
    box-shadow: 0 6px 18px -10px rgba(34, 30, 25, 0.08);
  }
  .rank tr.go {
    background: linear-gradient(180deg, rgba(179, 72, 18, 0.08), var(--surface) 45%);
    border-top-width: 3px;
  }
  .rank td { border: 0; padding: 4px 0; }
  .rank td.n {
    position: absolute;
    left: 14px;
    top: 13px;
    font: 700 22px/1 var(--f-en);
    color: var(--cyan);
    text-align: left;
  }
  .rank td.prop { max-width: none; color: var(--amber); margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line2); }
  .rank td.sc { display: grid; grid-template-columns: 52px 1fr 34px; gap: 5px 10px; margin: 6px 0; }
  .rank .evb { display: flex; gap: 6px; white-space: normal; margin-top: 6px; }
  .rank button.st { flex: 1; width: auto; min-height: 52px; margin: 0; }
}

/* Mobile (<= 760px): Compact two-row topbar, Google Maps draggable bottom-sheet layer drawer, touch-scrollable tabs & charts */
@media (max-width: 760px) {
  :root { --top: 102px; --gutter: 16px; }
  .desk-only { display: none !important; }
  .icon-btn.phone-only { display: grid !important; }
  .sheet-trigger.phone-only { display: inline-flex !important; }
  .sheet-grab.phone-only {
    display: flex !important;
    justify-content: center;
    align-items: center;
    padding: 10px 0 4px;
    background: var(--surface);
    cursor: grab;
    touch-action: none;
    user-select: none;
  }
  .sheet-pill {
    width: 42px;
    height: 5px;
    border-radius: 99px;
    background: var(--line-strong);
  }
  .tl-legend.phone-only { display: flex !important; }
  .maplibregl-ctrl-group.phone-only { display: block !important; }
  .topbar {
    padding: 6px max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    gap: 4px 10px;
  }
  .wm-logo { width: 36px; height: 36px; }
  .wm-text b { font-size: 15.5px; }
  .wm-text small { font-size: 12px; }
  .nav {
    flex: 0 0 calc(100% + 28px);
    margin: 2px -14px 0;
    padding: 5px 14px 6px;
    gap: 15px;
  }
  .nav a b { font-size: 14px; }
  .nav a small { font-size: 12px; margin-top: 1px; }
  .page { padding: 28px 0 20px; }
  .hero { padding-top: 22px; }
  .hero-en { font-size: 14px; letter-spacing: 0.16em; }
  .k-v { font-size: 30px; }
  .kpi { padding: 12px 14px; }
  .mapwrap {
    height: min(76vh, 640px);
    height: min(76dvh, 640px);
    min-height: 480px;
  }
  .map-tools { left: 12px; transform: none; padding: 0; background: transparent; border: 0; box-shadow: none; }
  .map-tools .seg, .map-tools #view-all, .readout, .maplibregl-ctrl-scale { display: none; }
  .maplibregl-ctrl-top-right { top: 12px !important; right: 12px !important; display: flex; flex-direction: column; gap: 8px; }
  .panel {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 54%;
    max-height: 54%;
    border-right: 0;
    border-top: 2px solid var(--cyan);
    z-index: 8;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -14px 36px rgba(0, 0, 0, 0.26);
  }
  .panel[data-sheet="full"] {
    height: 88%;
    max-height: 88%;
  }
  .panel[data-sheet="peek"] {
    height: 78px;
    max-height: 78px;
  }
  .panel[data-sheet="full"] #sheet-expand svg {
    transform: rotate(180deg);
  }
  .panel[data-open="false"] {
    transform: translateY(105%);
    opacity: 0;
  }
  .panel-head {
    padding: 6px 12px 10px 16px;
    touch-action: none;
  }
  .timeline { bottom: 10px; width: calc(100% - 20px); padding: 10px 12px; }
  .tl-date { min-width: 0; flex: 1; }
  .tl-date b { font-size: 15px; }
  .tl-toggle { position: static; }
  .tl-head { gap: 6px; padding: 0; }
  .tl-rain { height: 20px; margin-left: 48px; }
  .tl-months { margin-left: 48px; }
  .tl-rain span { display: none; }
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    margin: 12px -4px;
    padding-left: 4px;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; }
  .facts { grid-template-columns: 1fr; gap: 3px; padding: 14px; }
  .facts dd { margin-bottom: 8px; }
  .ge-pair { grid-template-columns: 1fr; }
  .concl-grid { grid-template-columns: 1fr; }
  .chart-card { overflow-x: auto; padding: 12px 10px 8px; }
  .chart-card .chart:not(#bubble) { min-width: 620px; }
  .wait { width: 88%; max-width: 340px; font-size: 13px; padding: 10px 14px; }
  .foot {
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }
  .foot button { width: 100%; text-align: center; }
}

/* Small Mobile Phones (<= 480px): Single-column KPIs & Evidence 4 crops, compact daybox */
@media (max-width: 480px) {
  :root { --gutter: 12px; }
  .wordmark { gap: 9px; }
  .wm-logo { width: 32px; height: 32px; }
  .wm-text b { font-size: 14.5px; }
  .wm-text small { max-width: 195px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kpis { grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
  .daybox { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .db-cell { padding: 9px 11px; }
  .db-cell b { font-size: 19px; }
  .db-msg { padding: 10px 12px; }
  .db-msg p { font-size: 14.5px; }
  .ev4-grid { grid-template-columns: 1fr; }
  .facts { grid-column: span 1; }
  .rank tr { padding: 12px 12px 12px 38px; }
  .rank td.n { left: 11px; font-size: 20px; }
  .rank .evb { flex-wrap: wrap; }
  .rank button.st { min-width: calc(33.33% - 4px); }
  .rules-card { padding: 12px; }
  .rules td { padding: 6px 5px; font-size: 13px; }
  .rules input { width: 74px; }
  dialog { padding: 18px 16px; width: calc(100% - 20px); }
}
.crop img.ge { aspect-ratio: auto; object-fit: contain; }   /* Google Earth frames: show whole frame so the on-image attribution is not cropped */

/* full-screen map (button #map-full) */
.mapwrap.map-full { position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100vh !important; height: 100dvh !important; max-height: none !important; margin: 0 !important; border-radius: 0 !important; z-index: 2000; }
body.map-full-open { overflow: hidden; }
#map-full[aria-pressed="true"] { background: var(--accent, #b34a17); color: #fff; }

/* ==========================================================================
   Section 06: Hybrid View (Priority Tiered Cards + Full Table)
   ========================================================================== */
.ranking-mode-switch {
  display: inline-flex !important;
  align-items: center !important;
  background: var(--surface2) !important;
  border: 1px solid var(--line-strong) !important;
  padding: 4px !important;
  border-radius: 12px !important;
  gap: 6px !important;
  margin-bottom: 22px !important;
}

.ranking-mode-switch .mode-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-family: var(--f-head) !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  padding: 8px 18px !important;
  border-radius: 8px !important;
  border: none !important;
  background: transparent !important;
  color: var(--muted) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}
.ranking-mode-switch .mode-btn:hover {
  color: var(--navy) !important;
  background: rgba(15, 41, 66, 0.05) !important;
}
.ranking-mode-switch .mode-btn.on {
  background: var(--navy) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(15, 41, 66, 0.25) !important;
}

/* Priority Tiered Cards List */
.rank-cards-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  margin-bottom: 24px !important;
}

#rank-cards-view[hidden],
.rank-cards-list[hidden],
#rank-table-view[hidden] {
  display: none !important;
}

.priority-rank-card {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  padding: 22px 24px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
  transition: transform 0.2s, box-shadow 0.2s !important;
}
.priority-rank-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
}

/* Tier Variants */
.priority-rank-card.tier-critical {
  border-left: 6px solid #dc2626 !important;
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.4) 0%, var(--surface) 100%) !important;
}
.priority-rank-card.tier-high {
  border-left: 6px solid #ea580c !important;
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.4) 0%, var(--surface) 100%) !important;
}
.priority-rank-card.tier-medium {
  border-left: 6px solid #0284c7 !important;
}
.priority-rank-card.tier-low {
  border-left: 6px solid #94a3b8 !important;
  opacity: 0.95 !important;
}

/* Card Header */
.prc-top {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  margin-bottom: 16px !important;
  border-bottom: 1px solid var(--line) !important;
  padding-bottom: 14px !important;
}

.prc-identity {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
}

.prc-rank-badge {
  font-family: var(--f-head) !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  color: var(--navy) !important;
  background: var(--surface2) !important;
  width: 44px !important;
  height: 44px !important;
  border-radius: 10px !important;
  border: 1px solid var(--line) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}
.tier-critical .prc-rank-badge {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border-color: #fecaca !important;
}
.tier-high .prc-rank-badge {
  background: #fffbeb !important;
  color: #d97706 !important;
  border-color: #fde68a !important;
}

.prc-zone {
  font-family: var(--f-head) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--navy) !important;
}
.prc-zone small {
  font-family: var(--f-th) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  color: var(--muted) !important;
  display: block !important;
  margin-top: 3px !important;
}

.prc-badges {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.tier-badge {
  font-family: var(--f-head) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  padding: 4px 12px !important;
  border-radius: 9999px !important;
}
.tier-badge.tag-critical {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
}
.tier-badge.tag-high {
  background: #fffbeb !important;
  color: #d97706 !important;
  border: 1px solid #fde68a !important;
}
.tier-badge.tag-medium {
  background: #f0f9ff !important;
  color: #0284c7 !important;
  border: 1px solid #bae6fd !important;
}
.tier-badge.tag-low {
  background: var(--surface2) !important;
  color: var(--muted) !important;
  border: 1px solid var(--line) !important;
}

.prc-level b {
  font-family: var(--f-head) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  background: #fee2e2 !important;
  color: #991b1b !important;
  display: inline-block !important;
}

/* 3 Core Decision Gauges */
.prc-metrics-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 16px !important;
  margin-bottom: 14px !important;
}
@media (max-width: 860px) {
  .prc-metrics-grid { grid-template-columns: 1fr !important; }
}

.prc-stat {
  background: var(--surface2) !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  padding: 12px 16px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}
.prc-stat-head {
  display: flex !important;
  align-items: baseline !important;
  justify-content: space-between !important;
  gap: 8px !important;
}
.prc-stat-head .lbl {
  font-family: var(--f-head) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
}
.prc-stat-head .val {
  font-family: var(--f-head) !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}
.val-conf { color: #0284c7 !important; }
.val-sev { color: #ea580c !important; }
.val-prob { color: #7c3aed !important; }
.prc-stat-head .val small {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
}

.prc-bar-bg {
  height: 6px !important;
  background: var(--line) !important;
  border-radius: 9999px !important;
  overflow: hidden !important;
  margin: 4px 0 !important;
}
.prc-bar {
  height: 100% !important;
  border-radius: 9999px !important;
}
.bar-conf { background: #0284c7 !important; }
.bar-sev { background: #ea580c !important; }
.bar-prob { background: #7c3aed !important; }

.prc-stat-foot {
  font-size: 11.5px !important;
  color: var(--dim) !important;
}

/* Expandable Drawer for Sub-criteria */
.prc-breakdown-drawer {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  margin-top: 10px !important;
}
.prc-breakdown-drawer summary {
  font-family: var(--f-head) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--cyan) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  user-select: none !important;
}
.prc-breakdown-drawer .sum-conf {
  font-size: 12px !important;
  color: var(--muted) !important;
}

.prc-sub-list {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 8px !important;
  margin-top: 10px !important;
  padding-top: 10px !important;
  border-top: 1px solid var(--line) !important;
}
@media (max-width: 900px) {
  .prc-sub-list { grid-template-columns: repeat(2, 1fr) !important; }
}

.sub-col {
  background: var(--surface2) !important;
  border: 1px solid var(--line) !important;
  padding: 8px 10px !important;
  border-radius: 6px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}
.sub-label {
  font-size: 11px !important;
  color: var(--muted) !important;
  line-height: 1.3 !important;
}
.sub-val {
  font-family: var(--f-head) !important;
  font-size: 13px !important;
  color: var(--navy) !important;
}
.sub-val b {
  font-weight: 700 !important;
  color: var(--navy) !important;
}

/* ==========================================================================
   Compact Strip Layout (ย่อความสูง จบในจอเดียว ไม่ต้องเลื่อนเยอะ)
   ========================================================================== */
.priority-rank-card.compact-card {
  padding: 10px 16px !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
  margin-bottom: 0 !important;
}

.prc-row-main {
  display: grid !important;
  grid-template-columns: 38px minmax(170px, 220px) 1fr auto !important;
  align-items: center !important;
  gap: 14px !important;
}

.compact-card .prc-rank-badge {
  font-family: var(--f-head) !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 8px !important;
}

.compact-card .prc-zone {
  font-family: var(--f-head) !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  color: var(--navy) !important;
  line-height: 1.25 !important;
}
.compact-card .prc-zone small {
  font-family: var(--f-th) !important;
  font-size: 11.5px !important;
  font-weight: 400 !important;
  color: var(--muted) !important;
  display: block !important;
  margin-top: 2px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* 3 Compact Gauges Inline */
.prc-metrics-inline {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 10px !important;
  align-items: center !important;
}

.mini-stat {
  background: var(--surface2) !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  padding: 5px 8px !important;
}

.mini-lbl {
  display: flex !important;
  align-items: baseline !important;
  justify-content: space-between !important;
  gap: 4px !important;
  font-family: var(--f-head) !important;
}
.mini-lbl .m-name {
  color: var(--muted) !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
}
.mini-lbl .m-num {
  font-weight: 800 !important;
  font-size: 13px !important;
}
.mini-lbl .m-num small {
  font-size: 10px !important;
  font-weight: 500 !important;
  color: var(--muted) !important;
}

.mini-bar-bg {
  height: 4px !important;
  background: var(--line) !important;
  border-radius: 9999px !important;
  overflow: hidden !important;
  margin-top: 3px !important;
}
.mini-bar {
  height: 100% !important;
  border-radius: 9999px !important;
}

.prc-right-col {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  gap: 4px !important;
  flex-shrink: 0 !important;
}

.compact-card .prc-breakdown-drawer {
  background: var(--surface2) !important;
  border: 1px dashed var(--line-strong) !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  margin-top: 8px !important;
}
.compact-card .prc-breakdown-drawer summary {
  font-family: var(--f-head) !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  color: var(--cyan) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

@media (max-width: 900px) {
  .prc-row-main {
    grid-template-columns: 36px 1fr auto !important;
    gap: 10px !important;
  }
  .prc-metrics-inline {
    grid-column: span 3 !important;
    order: 3 !important;
    margin-top: 6px !important;
  }
  .prc-right-col {
    order: 2 !important;
  }
}

/* ==========================================================================
   Research Team Table Layout (Aligned Columns without dashes)
   ========================================================================== */
.team-table-wrap {
  margin: 8px 0 16px;
  overflow-x: auto;
}
.team-table {
  width: 100%;
  max-width: 960px;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.6;
  text-align: left;
}
.team-table td {
  padding: 6px 18px 6px 0;
  vertical-align: top;
  border-bottom: 1px solid var(--line2);
}
.team-table tr:last-child td {
  border-bottom: none;
}
.team-table .team-name {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  width: 1%;
  padding-right: 28px;
}
.team-table .team-role {
  color: var(--ink2);
}
@media (max-width: 720px) {
  .team-table .team-name {
    white-space: normal;
    width: auto;
  }
}

/* ==========================================================================
   Section 04: Top Horizontal Legend Bar & Single-Row Stats Cards
   ========================================================================== */
#km-legend,
.km-legend-top {
  position: static !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px 18px !important;
  margin: 10px 0 14px !important;
  padding: 8px 14px !important;
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  color: var(--ink2) !important;
  line-height: 1.4 !important;
  z-index: 1 !important;
}
#km-legend span,
.km-legend-top span {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}
#km-legend i,
.km-legend-top i {
  display: inline-block !important;
  flex-shrink: 0 !important;
  vertical-align: middle !important;
}

/* Day stats: 6 cards in a single balanced row */
#day-stats {
  display: grid !important;
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 8px !important;
  margin-top: 12px !important;
}
#as-near {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 8px !important;
  margin-top: 12px !important;
}

@media (max-width: 768px) {
  #day-stats {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  #as-near {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 520px) {
  #day-stats,
  #as-near {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

.nx .stat {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  padding: 8px 10px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  min-width: 0 !important;
}
.nx .stat span {
  display: block !important;
  font-size: 11.5px !important;
  color: var(--muted) !important;
  line-height: 1.3 !important;
  margin-bottom: 4px !important;
}
.nx .stat b {
  font: 600 16px var(--f-head) !important;
  color: var(--ink) !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
