:root {
  --bg: #edf3f7;
  --card: #fff;
  --ink: #1c2d3a;
  --muted: #5b7388;
  --blue: #1e4d8c;
  --teal: #2a7b7a;
  --ochre: #c45c26;
  --flood: #3b6ea8;
  --safe: #3d8f6b;
  --line: #dbe4ee;
  --radius: 18px;
  --navy: #092f4c;
  --cyan: #24a6a8;
  --city: #3478b8;
  --field: #2f8f72;
  --reservoir: #17639a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 118px; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 5% 0%, rgba(36, 166, 168, 0.10), transparent 28rem),
    radial-gradient(circle at 95% 20%, rgba(52, 120, 184, 0.10), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 18px; margin-bottom: 6px; }
h3 { font-size: 15px; margin: 18px 0 6px; }
button, input, select { font: inherit; }
b, #kpi-n, #kpi-in, #kpi-out, #kpi-ds, #kpi-gap, #kpi-bad, table, #day-label, dd {
  font-variant-numeric: tabular-nums;
}

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(8, 43, 70, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.12);
  color: #fff;
}
.top-inner {
  max-width: none;
  margin: 0;
  padding: 14px 20px 10px;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  margin-right: 5px;
  color: #07344f;
  background: linear-gradient(135deg, #8be0dc, #fff);
  font-size: 16px;
}
.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 10px;
}
.brand-row h1 { display: flex; align-items: center; }
.race-chip {
  display: inline-flex;
  align-items: center;
  max-width: min(640px, 100%);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 196, 120, .45);
  background: linear-gradient(90deg, rgba(180, 90, 30, .35), rgba(30, 90, 120, .35));
  color: #ffe4c2;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.3;
}
.race-chip:hover { border-color: #ffd39a; color: #fff; }
.case { margin: 4px 0 10px 42px; color: #a9c8d8; font-size: 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  text-decoration: none;
  color: #c8dce7;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
}
.tabs a.on, .tabs a:hover { background: #fff; color: var(--navy); border-color: #fff; }

.wrap { max-width: none; margin: 0; padding: 12px 12px 40px; display: grid; gap: 16px; }
body.view-home {
  background: #073247;
  overflow: hidden;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
body.view-home .top {
  display: none !important;
}
body.view-home .wrap {
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: block;
}
body.view-home .home-panel,
body.view-home .scene-map {
  height: 100%;
  min-height: 100%;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  box-shadow: 0 12px 32px rgba(14, 49, 72, 0.07);
  scroll-margin-top: 118px;
}
.lead { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.hint { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.subh { font-size: 13px; color: var(--muted); margin: 16px 0 8px; }
.eyebrow { color: #8de1dc; font-weight: 700; font-size: 11px; letter-spacing: .16em; }
.pulse { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #68e2a4; margin-right: 6px; box-shadow: 0 0 0 4px rgba(104,226,164,.12); }

/* 面板切换 */
.panel[hidden] { display: none !important; }
/* ========== 全幅场景示意图 ========== */
.home-panel {
  padding: 0;
  height: 100%;
  min-height: 0;
}
.scene-map {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  color: #fff;
}
.scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.scene-wave { animation: waveMove 4s ease-in-out infinite; }
.scene-wave.w2 { animation-delay: 1.2s; }
@keyframes waveMove {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(10px); }
}

.scene-hud {
  position: absolute;
  z-index: 8;
  top: 10px;
  left: 20px;
  right: 20px;
  pointer-events: none;
}
.scene-hud-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px 14px;
  align-items: center;
}
.scene-title {
  pointer-events: none;
  min-width: 0;
  max-width: min(420px, 36vw);
}
.scene-title .eyebrow {
  display: block;
  margin-bottom: 2px;
}
.scene-title h2 {
  margin: 0;
  font-size: clamp(14px, 1.35vw, 18px);
  line-height: 1.3;
  letter-spacing: .01em;
  text-shadow: 0 2px 16px rgba(0,0,0,.45);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.scene-hud-right {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  pointer-events: auto;
}
.four-pre {
  display: flex;
  gap: 6px;
  justify-content: center;
  pointer-events: auto;
}
.four-pre button {
  border: 1px solid rgba(120, 220, 255, .45);
  background: linear-gradient(180deg, rgba(30, 110, 150, .55), rgba(8, 40, 60, .7));
  color: #e8f7ff;
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 700;
  letter-spacing: .1em;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(60, 180, 220, .16);
}
.four-pre.five-loop button {
  padding: 6px 11px;
  letter-spacing: .08em;
  font-size: 12px;
}
.score-ring.compact {
  grid-template-columns: 48px auto;
  padding: 4px 8px 4px 4px;
  gap: 6px;
  border-radius: 12px;
}
.score-ring.compact svg { width: 48px; height: 48px; }
.score-ring.compact strong { font-size: 18px; }
.schematic-meta span { font-size: 10px; padding: 4px 8px; }

.glass-panel {
  position: absolute;
  z-index: 7;
  top: 86px;
  width: min(318px, 24vw);
  max-height: calc(100% - 168px);
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 11px 9px;
  border-radius: 14px;
  color: #eaf6fb;
  background: linear-gradient(165deg, rgba(8, 36, 56, .92), rgba(6, 28, 44, .84));
  border: 1px solid rgba(120, 210, 240, .28);
  box-shadow: 0 14px 36px rgba(0,0,0,.28);
  backdrop-filter: blur(14px);
}
.glass-left { left: 16px; }
.glass-right { right: 16px; }
.glass-panel.city-focus {
  border-color: rgba(255, 180, 100, .42);
  box-shadow: 0 14px 36px rgba(0,0,0,.28), 0 0 0 1px rgba(255, 170, 80, .12);
}
.gp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.gp-kicker {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .12em;
  color: #7fd8e8;
  font-weight: 800;
}
.city-focus .gp-kicker { color: #ffc98a; }
.glass-panel h3 { margin: 2px 0 0; font-size: 15px; }
.gp-sub {
  margin: 3px 0 0;
  font-size: 10px;
  color: #8aa8b5;
  line-height: 1.3;
}
.gp-meta {
  color: #9bb8c6;
  font-size: 10px;
  text-align: right;
  max-width: 46%;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
}
.gp-foot {
  margin: 6px 0 0;
  font-size: 10px;
  color: #9fbfcb;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wx-sum {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 8px;
}
.wx-sum div, .stock-row div, .live-grid div, .risk-cell {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: baseline;
  padding: 5px 7px;
  border-radius: 7px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}
.wx-sum span, .stock-row span, .live-grid span, .risk-cell span {
  color: #9bb8c6;
  font-size: 10px;
}
.wx-sum b, .stock-row b, .live-grid b {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.warn-text { color: #ffb080 !important; }

.wx-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 8px;
}
.wx-day {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 5px 2px;
  border-radius: 7px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  text-align: center;
  font-size: 10px;
}
.wx-day.today {
  border-color: rgba(141, 225, 220, .55);
  background: rgba(30, 120, 130, .32);
  box-shadow: inset 0 0 0 1px rgba(141, 225, 220, .25);
}
.wx-day .wx-date { color: #9fd5e4; font-weight: 700; font-size: 9px; }
.wx-day .wx-temp { color: #d7ebf2; font-size: 9px; line-height: 1.1; }
.wx-day .wx-rain { font-weight: 800; color: #8de1dc; font-size: 10px; }
.wx-day.wet .wx-rain { color: #7ec8ff; }
.wx-day.storm .wx-rain { color: #ffb080; }
.wx-day.wet { border-color: rgba(126, 200, 255, .35); background: rgba(40, 110, 160, .22); }
.wx-day.storm { border-color: rgba(255, 176, 128, .4); background: rgba(140, 70, 40, .22); }
.wx-day .wx-risk {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.1;
}
.wx-day.rk-none .wx-risk { color: #9bb8c4; }
.wx-day.rk-low .wx-risk { color: #8de1c0; }
.wx-day.rk-mid .wx-risk { color: #ffd978; }
.wx-day.rk-high .wx-risk { color: #ff9a8a; }
.wx-day.rk-mid {
  border-color: rgba(240, 200, 80, .35);
  background: rgba(120, 90, 20, .2);
}
.wx-day.rk-high {
  border-color: rgba(255, 120, 100, .45);
  background: rgba(120, 40, 40, .25);
}

.risk-week {
  margin: 0 0 6px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(0, 20, 40, .22);
}
.risk-week-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 5px;
  font-size: 10px;
  color: #9fd5e4;
  font-weight: 700;
}
.risk-week-head small {
  font-size: 8px;
  font-weight: 500;
  color: #7a9bab;
  max-width: 55%;
  text-align: right;
  line-height: 1.2;
}
.risk-week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}
.risk-day-chip {
  border-radius: 6px;
  padding: 3px 2px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  min-height: 34px;
}
.risk-day-chip .d { display: block; font-size: 8px; color: #9bb8c4; }
.risk-day-chip .lv { display: block; font-size: 9px; font-weight: 800; margin-top: 2px; }
.risk-day-chip.none .lv { color: #9bb8c4; }
.risk-day-chip.low { background: rgba(60, 160, 120, .2); border-color: rgba(110, 220, 180, .35); }
.risk-day-chip.low .lv { color: #b8ffe8; }
.risk-day-chip.mid { background: rgba(200, 160, 40, .22); border-color: rgba(240, 200, 80, .4); }
.risk-day-chip.mid .lv { color: #ffe9a0; }
.risk-day-chip.high { background: rgba(200, 50, 50, .28); border-color: rgba(255, 120, 110, .5); }
.risk-day-chip.high .lv { color: #ffb0b8; }
.risk-day-chip.today { outline: 1px solid rgba(127, 216, 232, .55); }

.risk-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.risk-cell {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}
.risk-cell > span { width: 100%; }
.risk-days {
  font-style: normal;
  font-size: 9px;
  line-height: 1.3;
  color: #9bb8c4;
  font-weight: 500;
  white-space: normal;
  word-break: break-all;
  max-width: 100%;
}
.risk-badge {
  min-width: 44px;
  text-align: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: #e8f7ff;
}
.risk-badge.none { background: rgba(120, 140, 160, .22); border-color: rgba(160, 180, 200, .35); color: #c5d4de; }
.risk-badge.low { background: rgba(60, 160, 120, .28); border-color: rgba(110, 220, 180, .5); color: #b8ffe8; }
.risk-badge.mid { background: rgba(200, 160, 40, .28); border-color: rgba(240, 200, 80, .5); color: #ffe9a0; }
.risk-badge.high { background: rgba(200, 50, 50, .38); border-color: rgba(255, 120, 110, .6); color: #ffb0b8; }

.live-grid div {
  padding: 4px 6px;
}
.live-block { margin-bottom: 6px; }
.live-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #9fd5e4;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7fd8e8;
  box-shadow: 0 0 8px rgba(127, 216, 232, .7);
}
.live-block:nth-of-type(1) .live-title::before { background: #ffc98a; box-shadow: 0 0 8px rgba(255, 201, 138, .7); }
.live-block:nth-of-type(2) .live-title::before { background: #8de1a8; box-shadow: 0 0 8px rgba(141, 225, 168, .7); }
.live-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}
.stock-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(120, 210, 240, .18);
}

.scene-footer {
  position: absolute;
  z-index: 5;
  left: 18px;
  right: 18px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.schematic-kpis.dense.foot-cap {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.schematic-kpis.dense {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.schematic-kpis.dense div { padding: 7px 10px; }
.schematic-kpis.dense b { font-size: 12px; line-height: 1.25; }
.schematic-kpis.dense span { font-size: 10px; letter-spacing: 0; }

.hs-city { min-width: 150px; padding: 12px 14px; }
.hotspot { min-width: 150px; padding: 12px 14px; }
.hotspot strong { font-size: 15px; }
.hotspot small { font-size: 11px; }
.hotspot em { font-size: 12px; }

.schematic-meta { display: flex; flex-direction: column; gap: 6px; align-items: end; }
.schematic-meta span {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(4, 28, 42, .45);
  backdrop-filter: blur(8px);
  font-size: 11px;
}
.score-ring {
  display: grid;
  grid-template-columns: 64px auto;
  gap: 8px;
  align-items: center;
  padding: 6px 10px 6px 6px;
  border-radius: 14px;
  background: rgba(4, 28, 42, .42);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(10px);
}
.score-ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.15); stroke-width: 8; }
.ring-fg {
  fill: none;
  stroke: #6fe0c8;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 251;
  stroke-dashoffset: 251;
  transition: stroke-dashoffset .6s ease;
}
.score-ring strong { display: block; font-size: 24px; line-height: 1; }
.score-ring small { color: #b7d5df; font-size: 11px; }

/* 热点标签 */
.hotspot {
  position: absolute;
  z-index: 6;
  appearance: none;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(6, 28, 42, .55);
  backdrop-filter: blur(12px);
  color: #fff;
  text-align: left;
  border-radius: 18px;
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(0,0,0,.28);
  transition: transform .2s, background .2s, border-color .2s, box-shadow .2s;
  display: grid;
  gap: 2px;
  min-width: 180px;
}
.hotspot:hover, .hotspot:focus-visible {
  transform: translateY(-4px) scale(1.02);
  background: rgba(8, 40, 58, .78);
  border-color: rgba(143, 232, 220, .7);
  box-shadow: 0 20px 48px rgba(0,0,0,.35);
  outline: none;
}
.hs-tag {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 4px;
}
.hs-reservoir .hs-tag { background: linear-gradient(135deg, #4eb4d8, #1a6f9a); }
.hs-field .hs-tag { background: linear-gradient(135deg, #6fc87a, #2f8a48); }
.hs-city .hs-tag { background: linear-gradient(135deg, #f0b35a, #c45c26); }
.hotspot strong { font-size: 18px; }
.hotspot small { color: #b7d5df; font-size: 12px; }
.hotspot em { font-style: normal; color: #8de1dc; font-size: 13px; font-weight: 700; margin-top: 4px; }
.hs-cta {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  color: #ffe0b5;
}

/* 热点位置：城市主场景偏右放大 */
.hs-reservoir { top: 28%; left: 26%; }
.hs-field { bottom: 24%; left: 28%; }
.hs-city {
  top: 30%;
  right: 24%;
  min-width: 210px;
  padding: 16px 18px;
  border-color: rgba(255, 190, 110, .55);
  background: rgba(48, 28, 12, .62);
  box-shadow: 0 18px 44px rgba(0,0,0,.32), 0 0 0 1px rgba(255, 170, 80, .18);
}
.hs-city.featured:hover, .hs-city.featured:focus-visible {
  border-color: #ffd08a;
  background: rgba(70, 36, 12, .78);
}
.hs-city em { color: #ffd08a; }
.hs-joint { top: 52%; left: 48%; }
.hs-joint {
  transform: translate(-50%, -50%);
  min-width: 140px;
  text-align: center;
  justify-items: center;
  border-radius: 999px;
  padding: 16px 22px;
  background: rgba(12, 70, 82, .72);
  border-color: rgba(111, 224, 200, .55);
}
.hs-joint:hover, .hs-joint:focus-visible { transform: translate(-50%, -50%) scale(1.05); }
.hs-orb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #5fe0d0, #0d6a78);
  font-size: 16px;
  margin-bottom: 2px;
  animation: pulseOrb 2.4s ease-in-out infinite;
}
@keyframes pulseOrb {
  0%, 100% { box-shadow: 0 0 0 0 rgba(95, 224, 208, .35); }
  50% { box-shadow: 0 0 0 12px rgba(95, 224, 208, 0); }
}

.schematic-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.schematic-kpis div {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(4, 28, 42, .62);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(10px);
}
.schematic-kpis span { display: block; color: #a9c8d4; font-size: 11px; }
.schematic-kpis b { font-size: 18px; }

.detail-section { border-top: 4px solid transparent; }
.city-detail { border-top-color: transparent; }

body.view-city {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(36, 166, 168, 0.14), transparent 58%),
    radial-gradient(780px 380px at 92% 0%, rgba(30, 77, 140, 0.08), transparent 52%),
    linear-gradient(180deg, #e8f2f6 0%, #edf3f7 48%, #e6eef3 100%);
}
body.view-city .wrap {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 14px 14px;
  overflow: hidden;
  display: flex;
}
body.view-city #sec-city {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  padding: 14px 18px 16px;
  border: 1px solid rgba(30, 77, 140, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 36px rgba(14, 49, 72, 0.08);
  color: var(--ink);
}
body.view-city #sec-city .section-title { margin-bottom: 4px; align-items: center; }
body.view-city #sec-city .section-index { color: var(--cyan); }
body.view-city #sec-city .section-title h2 {
  font-size: 22px;
  color: var(--navy);
  text-shadow: none;
}
body.view-city #sec-city .section-badge {
  background: #edf7f7;
  color: var(--teal);
  border: 1px solid rgba(42, 123, 122, 0.18);
}
body.view-city #sec-city .lead {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}
body.view-city #sec-city .city-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  min-height: 0;
  flex: 0 0 auto;
  margin-bottom: 12px;
}
body.view-city #sec-city .city-kpis article {
  min-height: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f7fafc;
  box-shadow: none;
}
body.view-city #sec-city .city-kpis i { color: var(--muted); }
body.view-city #sec-city .city-kpis b { font-size: 19px; color: var(--navy); }
body.view-city #sec-city .city-kpis s { color: var(--muted); }
body.view-city #sec-city .city-kpis .warn {
  background: #fff6f1;
  border-color: rgba(196, 92, 38, 0.22);
}
body.view-city #sec-city .city-kpis .warn b { color: var(--ochre); }
body.view-city #sec-city .city-board {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 0;
}
body.view-city #sec-city .city-pane {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(160px, 1fr) auto;
  gap: 10px;
  padding: 12px 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f8fbfd;
}
body.view-city #sec-city .city-pane h3 {
  margin: 0;
  color: var(--navy);
  font-size: 14px;
  letter-spacing: 0.02em;
}
body.view-city #sec-city .city-pane .chart-box {
  height: 100%;
  min-height: 0;
  border-radius: 10px;
  background: #fff;
}
body.view-city #sec-city .city-pane .supply-ladder {
  margin: 0;
  gap: 8px;
  align-content: start;
}
body.view-city #sec-city .city-pane .supply-ladder li {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
body.view-city #sec-city .city-pane .supply-ladder b { color: var(--ink); }
body.view-city #sec-city .city-pane .supply-ladder i { color: var(--teal); }
body.view-city #sec-city .city-pane .supply-ladder span { color: var(--muted); }
body.view-city #sec-city .city-flood-foot .hint {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.45;
}
body.view-city #sec-city .storage-kpis {
  min-height: 0;
  gap: 8px;
}
body.view-city #sec-city .storage-kpis article {
  padding: 8px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
body.view-city #sec-city .storage-kpis i { color: var(--muted); }
body.view-city #sec-city .storage-kpis b { color: var(--navy); font-size: 16px; }
body.view-city #sec-city .storage-kpis s { color: var(--muted); }
.glance-bar,
.water-chain,
.supply-ladder,
.day-flow {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.glance-bar { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.glance-bar div,
.water-chain li,
.supply-ladder li,
.day-flow li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #f7f9fb;
}
.glance-bar span,
.water-chain em,
.water-chain span,
.supply-ladder i,
.supply-ladder span,
.day-flow span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}
.glance-bar b,
.water-chain b,
.supply-ladder b,
.day-flow b { display: block; margin: 2px 0; }
.glance-bar b { font-size: 13px; font-weight: 650; }
.water-chain { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.water-chain em { color: var(--teal); font-weight: 700; }
.water-chain b { font-size: 16px; }
.supply-ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.supply-ladder li { border-left-width: 3px; }
.supply-ladder .use-live { border-left-color: #4ea1d9; }
.supply-ladder .use-ind { border-left-color: #e08a4a; }
.supply-ladder .use-eco { border-left-color: #3db8a8; }
.supply-ladder .use-muni { border-left-color: #8b7cc9; }
.day-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.glance-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.supply-ladder i { color: var(--teal); font-weight: 700; margin-top: 2px; }
.day-flow b { font-size: 13px; }
.field-detail { border-top-color: var(--field); }
.reservoir-detail { border-top-color: var(--reservoir); }
.joint-detail { border-top-color: var(--cyan); }

.brain-risk-bar {
  display: grid;
  grid-template-columns: 1.2fr 1.6fr 0.9fr;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(30, 77, 140, 0.06), rgba(42, 123, 122, 0.08));
}
.brain-risk-bar .gp-kicker { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.brain-risk-bar strong { font-size: 18px; margin-right: 8px; }
.brain-risk-bar p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.brain-rec span { display: block; font-size: 11px; color: var(--muted); }
.brain-rec b { font-size: 18px; color: var(--teal, #2a7b7a); }

.brain-scheme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.brain-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  min-height: 220px;
}
.brain-card.rec {
  border-color: rgba(42, 123, 122, 0.55);
  box-shadow: 0 0 0 1px rgba(42, 123, 122, 0.2);
}
.brain-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.brain-card header strong { font-size: 16px; }
.brain-card .rec-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(42, 123, 122, 0.15);
  color: #1f6a68;
}
.brain-card .tagline { color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.brain-card ul { margin: 0 0 10px; padding-left: 18px; color: #345; font-size: 12px; line-height: 1.45; }
.brain-card .scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.brain-card .scores div {
  border-radius: 8px;
  background: #f5f8fb;
  padding: 6px;
  text-align: center;
}
.brain-card .scores span { display: block; font-size: 10px; color: var(--muted); }
.brain-card .scores b { font-size: 14px; }

.brain-card .benefit-line {
  margin: 8px 0 0;
  padding: 8px;
  border-radius: 8px;
  background: rgba(42, 123, 122, 0.08);
  font-size: 12px;
  line-height: 1.4;
  color: #1f4a48;
}
.brain-card .hazard-pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
  background: rgba(200, 120, 40, 0.15);
  color: #8a4b12;
}
.brain-card .hazard-pill.flood {
  background: rgba(30, 100, 180, 0.15);
  color: #1e4d8c;
}
.brain-card .dispatch-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 8px;
  font-size: 11px;
  color: #456;
}
.brain-card .dispatch-mini b { color: #123; }

.brain-impl-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.brain-impl-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fafcfd;
}
.brain-impl-card h4 { margin: 0 0 8px; font-size: 14px; }
.brain-impl-card ol { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.5; color: #345; }
.brain-impl-card li { margin-bottom: 6px; }
.brain-impl-card .qty { color: #1e4d8c; font-weight: 600; }

.brain-compare { margin-bottom: 18px; }

@media (max-width: 960px) {
  .brain-risk-bar { grid-template-columns: 1fr; }
  .brain-scheme-grid { grid-template-columns: 1fr; }
  .brain-impl-panel { grid-template-columns: 1fr; }
}
.race-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background:
    linear-gradient(120deg, rgba(196, 92, 38, 0.12), rgba(30, 77, 140, 0.10)),
    #f7fafc;
  border: 1px solid #e4d2c2;
}
.race-banner-kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--ochre);
  margin-bottom: 4px;
}
.race-banner strong { display: block; font-size: 16px; color: var(--navy); }
.race-banner p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.race-banner a {
  flex: 0 0 auto;
  text-decoration: none;
  color: #fff;
  background: var(--navy);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
}
.race-banner a:hover { background: var(--ochre); }
.city-mission {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}
.city-mission article {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8fbfd;
}
.city-mission h4 { margin: 0 0 6px; font-size: 14px; color: var(--navy); }
.city-mission p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }

.section-title { display: flex; justify-content: space-between; gap: 20px; align-items: start; margin-bottom: 14px; }
.section-title .lead { margin: 4px 0 0; }
.section-index { display: block; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .14em; margin-bottom: 3px; }
.section-title h2 { font-size: 24px; }
.section-badge { flex: 0 0 auto; padding: 5px 11px; border-radius: 999px; background: #edf7f7; color: var(--teal); font-size: 11px; font-weight: 700; }
.model-note { margin: 8px 0 0; padding: 10px 12px; border-left: 3px solid var(--ochre); background: #fff8f2; color: var(--muted); font-size: 12px; }

.event {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.event.flood { border-left: 4px solid var(--flood); }
.event.drought { border-left: 4px solid var(--ochre); }
.event.done { background: #f3faf6; border-left-color: var(--safe); }
.event .row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  margin-right: 6px;
}
.tag.flood { background: #e4eef8; color: var(--flood); }
.tag.drought { background: #f8eadf; color: var(--ochre); }
.tag.ok { background: #e5f4ec; color: var(--safe); }
.event p { margin: 8px 0; font-size: 13px; }
.event .acts { display: flex; gap: 8px; }
.event button, .btn, .io-tabs button, .scene-row button, .gate {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
.event .acts button:first-child, .io-tabs button.on, .scene-row button.on, .gate.on {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.scene-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.gate b { margin-left: 6px; }
.search { display: flex; align-items: center; gap: 6px; background: #f6f8fb; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.search input { border: 0; background: transparent; outline: none; min-width: 140px; }
.param-book {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.param-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #f7fafc;
}
.param-group h4 { margin: 0 0 8px; font-size: 13px; color: var(--blue); }
.param-group dl { margin: 0; display: grid; gap: 6px; }
.param-group div { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; }
.param-group dt { font-size: 12px; color: var(--muted); }
.param-group dd { margin: 0; font-size: 13px; text-align: right; }
.param-group small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.src {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e5f4ec;
  color: var(--safe);
  margin-left: 6px;
}
.src.assume { background: #f8eadf; color: var(--ochre); }
.src.agree { background: #e4eef8; color: var(--flood); }
.plain-box {
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.plain-box p { margin: 0 0 8px; font-size: 13px; color: var(--ink); }
.plain-box p:last-child { margin-bottom: 0; }
.cell.compound { background: #e08b8b; }
.param-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.param-grid.live { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.param-grid label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.param-grid span { color: var(--muted); font-size: 11px; }
.param-grid input { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 8px;
  min-height: 92px;
}
.kpis article {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  min-height: 92px;
}
.kpis i { font-style: normal; color: var(--muted); font-size: 12px; }
.kpis b { display: block; font-size: 20px; margin: 4px 0 2px; }
.kpis s { text-decoration: none; color: var(--muted); font-size: 11px; }
.kpis .warn { background: #fff6f1; }
.kpis .warn b { color: var(--ochre); }
.kpis.storage-kpis,
.kpis.outlook-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis.storage-kpis article,
.kpis.outlook-kpis article { min-height: 0; padding: 10px 8px; }
.kpis.storage-kpis b,
.kpis.outlook-kpis b { font-size: 18px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chart-box { min-height: 280px; height: 300px; }
.chart-box.short { height: 260px; min-height: 260px; }
.chart-box.mid { height: 260px; min-height: 260px; }
.map-box {
  background:
    linear-gradient(rgba(30, 77, 140, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 77, 140, 0.05) 1px, transparent 1px),
    #f4f7fa;
  background-size: 24px 24px;
  border-radius: 10px;
}
.leaflet-container { background: transparent; font-family: inherit; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 2px 0 8px; background: var(--teal); }
.dot.medium { background: #5a9a86; }
.dot.small { background: #8c6a3d; }
.dot.warn { background: var(--ochre); }

.cal { display: grid; gap: 4px; overflow-x: auto; }
.cal-row { display: grid; grid-template-columns: 36px repeat(31, 18px); gap: 3px; align-items: center; }
.cal-row span { font-size: 11px; color: var(--muted); }
.cell { width: 18px; height: 18px; border-radius: 3px; background: #d9efe4; cursor: pointer; }
.cell.empty { background: #eef2f6; cursor: default; }
.cell.drought { background: #f0c49a; }
.cell.flood { background: #9bb8dc; }
.cell.both { background: #e08b8b; }
.cell.on { outline: 2px solid var(--blue); outline-offset: -1px; }
.legend-cal { font-size: 12px; color: var(--muted); margin-top: 6px; }

.city-day-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 10px;
}
.city-day-picker label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.city-day-picker input[type="range"] { flex: 1; }
#city-tbody tr[data-city-date] { cursor: pointer; }
#city-tbody tr.on-row { background: #e8f0fa; }
.pill.both { background: #e08b8b; color: #fff; }

.terrace-wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; min-height: 200px; }
.terraces {
  display: grid;
  grid-template-columns: 1fr 16px 1fr 16px 1fr 16px 1fr;
  align-items: end;
  min-height: 170px;
}
.terrace, .pond {
  position: relative;
  height: 160px;
  background: #e8eef3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.water {
  position: absolute; left: 0; right: 0; bottom: 0; height: 20%;
  background: linear-gradient(#7eb8b3, var(--teal));
  transition: height 0.3s;
}
.flood-on .water { background: linear-gradient(#8eadd4, var(--flood)); }
.drought-on .water { background: linear-gradient(#e0a36a, var(--ochre)); }
.terrace span, .pond span { position: absolute; left: 8px; bottom: 8px; z-index: 1; font-size: 12px; }
.flow-arrow {
  height: 18px; align-self: center; background: var(--teal); opacity: 0.25;
  clip-path: polygon(0 30%, 55% 30%, 55% 0, 100% 50%, 55% 100%, 55% 70%, 0 70%);
}
.flow-arrow.on { opacity: 1; }
.flow-arrow.up { transform: rotate(180deg); background: var(--ochre); }
.flow-arrow.down { background: var(--flood); }
.day-side { display: grid; gap: 8px; align-content: start; }
.day-side input { width: 100%; }
.pill { justify-self: start; font-size: 12px; padding: 2px 8px; background: #e8eef3; border-radius: 999px; }
.pill.flood { background: #e4eef8; color: var(--flood); }
.pill.drought { background: #f8eadf; color: var(--ochre); }
.day-side dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; }
.day-side dl div { background: #f6f8fb; padding: 6px; border-radius: 8px; }
dt { font-size: 11px; color: var(--muted); }
dd { margin: 2px 0 0; }

.table-scroll { overflow: auto; min-height: 180px; max-height: 360px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: #fff; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f3f7fb; }
tr.warn-row { box-shadow: inset 3px 0 0 var(--ochre); }
tr.focus-row { background: #eef6f5; }
tr.focus-row.warn-row { background: #fff6f1; }
.io-tabs { display: flex; gap: 8px; margin-bottom: 8px; }

.foot { color: var(--muted); font-size: 12px; padding: 4px 4px 24px; }
.foot p { margin: 0 0 8px; }

.drawer {
  position: fixed; inset: 0; background: rgba(28, 45, 58, 0.35);
  display: grid; place-items: center; z-index: 40; padding: 16px;
}
.drawer[hidden] { display: none; }
.drawer-card {
  background: #fff; width: min(640px, 100%); max-height: 86vh; overflow: auto;
  border-radius: 16px; padding: 14px 16px 18px;
}
.dh { display: flex; justify-content: space-between; align-items: center; }

@media (max-width: 1200px) {
  .glass-panel { width: min(280px, 24vw); top: 100px; font-size: 12px; }
  .gp-ring { width: 72px; height: 72px; }
  .gp-ring b { font-size: 16px; }
  .gp-hero { grid-template-columns: 72px 1fr; }
}
@media (max-width: 1100px) {
  body.view-city { height: auto; overflow: auto; display: block; }
  body.view-city .wrap { display: grid; height: auto; overflow: visible; }
  body.view-city #sec-city { display: block; overflow: visible; }
  body.view-city #sec-city .city-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.view-city #sec-city .city-board { display: block; }
  body.view-city #sec-city .city-pane { display: block; margin-bottom: 12px; }
  body.view-city #sec-city .city-pane .chart-box { height: 260px; min-height: 260px; margin: 8px 0; }
}
@media (max-width: 980px) {
  body.view-home { overflow: auto; height: auto; }
  .scene-map, .home-panel { height: auto; min-height: 100dvh; }
  .scene-hud {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 14px 0;
  }
  .scene-hud-main { flex-direction: column; }
  .scene-title { max-width: none; }
  .scene-hud-right { justify-content: space-between; width: 100%; }
  .four-pre { justify-content: flex-start; flex-wrap: wrap; }
  .glass-panel {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: auto;
    max-height: none;
    height: auto;
    margin: 10px 14px 0;
  }
  .glass-left, .glass-right { left: auto; right: auto; }
  .hs-reservoir { top: 42%; left: 8%; min-width: 150px; }
  .hs-field { bottom: 18%; left: 8%; }
  .hs-city { top: 48%; right: 8%; left: auto; }
  .hs-joint { top: 62%; }
  .scene-footer { position: relative; left: 0; right: 0; bottom: 0; padding: 12px 14px 16px; }
  .schematic-kpis { grid-template-columns: 1fr 1fr; }
  .schematic-kpis.dense,
  .schematic-kpis.dense.foot-cap { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis.outlook-kpis { grid-template-columns: 1fr 1fr; }
  .glance-bar, .water-chain, .supply-ladder { grid-template-columns: 1fr 1fr; }
  .day-flow { grid-template-columns: 1fr; }
  .city-mission { grid-template-columns: 1fr; }
  .city-day-picker { flex-wrap: wrap; }
  .race-banner { flex-direction: column; align-items: flex-start; }
  .param-grid, .param-grid.live, .param-book { grid-template-columns: 1fr; }
  .split, .terrace-wrap { grid-template-columns: 1fr; }
  .day-side dl { grid-template-columns: 1fr 1fr; }
  .terraces { min-width: 520px; }
  .card { overflow-x: auto; }
}
@media (max-width: 560px) {
  .top-inner { padding-inline: 14px; }
  .case { margin-left: 0; }
  body:not(.view-home) .wrap { padding-inline: 10px; }
  .schematic-kpis, .kpis, .glance-bar, .water-chain, .supply-ladder, .day-flow { grid-template-columns: 1fr; }
  .kpis.storage-kpis,
  .kpis.outlook-kpis { grid-template-columns: 1fr 1fr; }
  .hotspot { min-width: 140px; padding: 10px 12px; }
  .hotspot strong { font-size: 15px; }
  .section-title { display: block; }
  .section-badge { display: inline-block; margin-top: 8px; }
  .four-pre button { padding: 6px 12px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-wave, .hs-orb { animation: none; }
  .water, .flow-arrow { transition: none; }
  html { scroll-behavior: auto; }
}
