:root {
  color-scheme: dark;
  --bg: #07101d;
  --bg-elevated: #0b1727;
  --surface: rgba(15, 31, 51, .78);
  --surface-solid: #102136;
  --surface-soft: rgba(255, 255, 255, .045);
  --border: rgba(164, 196, 224, .15);
  --border-strong: rgba(164, 196, 224, .26);
  --text: #f5f8fc;
  --muted: #91a4b9;
  --muted-strong: #b9c7d6;
  --accent: #66e3d1;
  --accent-2: #77a8ff;
  --accent-soft: rgba(102, 227, 209, .13);
  --danger: #ff7188;
  --warning: #f7c75d;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
  --shadow-soft: 0 12px 38px rgba(0, 0, 0, .18);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --aqi-good: #49dfa1;
  --aqi-moderate: #f4ca59;
  --aqi-sensitive: #ff9e5c;
  --aqi-unhealthy: #ff7188;
  --aqi-very: #bd8dff;
  --aqi-hazard: #e98895;
  --max-width: 1420px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f0f5f8;
  --bg-elevated: #e8f0f3;
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #ffffff;
  --surface-soft: rgba(28, 66, 86, .055);
  --border: rgba(38, 73, 92, .13);
  --border-strong: rgba(38, 73, 92, .24);
  --text: #122331;
  --muted: #5a7181;
  --muted-strong: #405867;
  --accent: #087f73;
  --accent-2: #315fba;
  --accent-soft: rgba(8, 127, 115, .1);
  --danger: #b92949;
  --warning: #9a6500;
  --shadow: 0 24px 70px rgba(27, 65, 84, .14);
  --shadow-soft: 0 10px 30px rgba(27, 65, 84, .1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 15% -8%, rgba(65, 154, 181, .14), transparent 66%),
    radial-gradient(760px 520px at 92% 12%, rgba(102, 227, 209, .09), transparent 65%),
    var(--bg);
  font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--accent); color: #071719; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 74%, white); outline-offset: 3px; }

.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
.skip-link { position: fixed; left: 14px; top: -80px; z-index: 200; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: #061515; font-weight: 800; }
.skip-link:focus { top: 14px; }

.data-alert {
  position: relative; z-index: 90; display: flex; align-items: flex-start; gap: 12px;
  padding: 12px max(18px, calc((100vw - var(--max-width)) / 2));
  color: #2a1700; background: linear-gradient(90deg, #f6c95e, #ffac71); border-bottom: 1px solid rgba(55, 30, 0, .15);
}
.data-alert[data-tone="danger"] { color: #fff; background: linear-gradient(90deg, #b62d4d, #db5b56); }
.data-alert-icon { flex: 0 0 auto; display: grid; place-items: center; width: 24px; height: 24px; margin-top: 1px; border: 2px solid currentColor; border-radius: 50%; font-weight: 900; }
.data-alert strong { display: block; font-size: 13px; }
.data-alert p { margin: 1px 0 0; font-size: 12px; opacity: .86; }

.topbar {
  position: sticky; top: 0; z-index: 50; width: 100%;
  display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr); align-items: center; gap: 20px;
  min-height: 76px; padding: 12px clamp(18px, 4vw, 54px);
  background: color-mix(in srgb, var(--bg) 80%, transparent); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(130%);
}
.brand { justify-self: start; display: inline-flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-mark { position: relative; display: grid; grid-template-columns: repeat(3, 5px); align-items: end; gap: 3px; width: 28px; height: 28px; padding: 5px; border-radius: 9px; background: var(--accent); box-shadow: 0 0 28px rgba(102, 227, 209, .25); }
.brand-mark i { display: block; width: 5px; border-radius: 4px; background: #05221e; }
.brand-mark i:nth-child(1) { height: 8px; }.brand-mark i:nth-child(2) { height: 16px; }.brand-mark i:nth-child(3) { height: 12px; }
.brand > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.brand b { letter-spacing: -.02em; font-size: 17px; }.brand small { color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.topbar-status { justify-self: center; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.live-pill, .mode-badge, .backend-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 27px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted-strong); background: var(--surface-soft); font-size: 11px; font-weight: 750; white-space: nowrap; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted) 14%, transparent); }
.live-pill.online i, .backend-chip.online::before { background: var(--aqi-good); }
.live-pill.online i { box-shadow: 0 0 0 4px color-mix(in srgb, var(--aqi-good) 16%, transparent); }
.live-pill.stale i { background: var(--warning); }
.freshness { color: var(--muted); font-size: 11px; white-space: nowrap; }
.mode-badge { color: #291700; background: #f5bd56; border-color: transparent; }
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.integration-link { display: inline-grid; place-items: center; min-height: 40px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 11px; color: var(--muted-strong); background: var(--surface-soft); font-size: 10px; font-weight: 850; text-decoration: none; }

.icon-button, .ghost-button, .primary-button, .text-button { border: 0; transition: transform .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease; }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); font-size: 18px; }
.icon-button:hover, .ghost-button:hover { border-color: var(--border-strong); background: color-mix(in srgb, var(--surface-solid) 72%, var(--accent-soft)); }
.ghost-button { display: inline-flex; align-items: center; gap: 9px; min-height: 46px; padding: 5px 11px 5px 6px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); text-align: left; }
.profile-avatar { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 11px; color: #061715; background: linear-gradient(135deg, var(--accent), #8be2ff); font-size: 12px; font-weight: 900; }
.profile-button-copy { display: flex; flex-direction: column; min-width: 0; }.profile-button-copy small { color: var(--muted); font-size: 11px; }.profile-button-copy b { max-width: 132px; overflow: hidden; text-overflow: ellipsis; font-size: 13px; white-space: nowrap; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 9px 16px; border-radius: 13px; color: #061715; background: linear-gradient(135deg, var(--accent), #75dbee); box-shadow: 0 10px 24px rgba(52, 187, 171, .15); font-size: 12px; font-weight: 900; }
.primary-button:hover:not(:disabled) { transform: translateY(-2px); }
.primary-button:disabled { cursor: not-allowed; filter: grayscale(.55); opacity: .45; box-shadow: none; }
.text-button { padding: 0; color: var(--accent); background: transparent; font-size: 12px; font-weight: 850; text-decoration: underline; text-underline-offset: 3px; }
.danger-text { color: var(--danger); }

main { width: min(calc(100% - 36px), var(--max-width)); margin: 0 auto; padding: clamp(22px, 4vw, 52px) 0 44px; }
.card { position: relative; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--surface) 86%, transparent)); box-shadow: var(--shadow-soft); overflow: hidden; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 9px; font-weight: 900; letter-spacing: .19em; text-transform: uppercase; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-heading.compact { margin-bottom: 14px; }
.section-heading h2, .section-heading h3 { margin: 0; font-size: clamp(20px, 2vw, 28px); letter-spacing: -.045em; line-height: 1.15; }
.section-heading p:not(.eyebrow) { max-width: 620px; margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.section-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(270px, .72fr); gap: 16px; margin-bottom: 16px; }
.hero-card { min-height: 420px; isolation: isolate; background: radial-gradient(500px 300px at 82% 20%, color-mix(in srgb, var(--aqi-color, var(--accent)) 22%, transparent), transparent 68%), linear-gradient(135deg, color-mix(in srgb, var(--surface-solid) 88%, #102d3b), var(--surface)); }
.hero-card::after { content: ""; position: absolute; right: -90px; bottom: -130px; z-index: -1; width: 390px; height: 390px; border: 1px solid color-mix(in srgb, var(--aqi-color, var(--accent)) 22%, transparent); border-radius: 50%; box-shadow: inset 0 0 90px color-mix(in srgb, var(--aqi-color, var(--accent)) 8%, transparent); }
.hero-copy { display: flex; flex-direction: column; height: 100%; padding: clamp(25px, 4vw, 46px); }
.hero-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.hero-title-row h1 { margin: 0; font-size: clamp(32px, 5vw, 62px); letter-spacing: -.065em; line-height: 1; }
.hero-summary { max-width: 600px; margin: 12px 0 0; color: var(--muted-strong); font-size: 13px; }
.compact-field { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 750; white-space: nowrap; }
select, input, textarea { min-width: 0; width: 100%; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: var(--surface-solid); }
select, input { min-height: 39px; padding: 8px 11px; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }
.compact-field select { width: auto; min-width: 120px; font-size: 12px; font-weight: 800; }
.hero-reading { position: relative; display: flex; align-items: center; min-height: 156px; margin: auto 0 14px; }
.hero-aqi-block { position: relative; z-index: 2; display: grid; grid-template-columns: auto auto; align-items: end; column-gap: 13px; }
.hero-aqi-label { grid-column: 1 / -1; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
#hero-aqi { font-size: clamp(74px, 10vw, 124px); font-weight: 850; letter-spacing: -.09em; line-height: .82; }
.level-chip { align-self: end; margin-bottom: 7px; padding: 5px 10px; border-radius: 999px; color: #071714; background: var(--aqi-color, var(--accent)); font-size: 11px; font-weight: 900; }
.hero-orbit { position: absolute; right: clamp(5px, 9vw, 150px); width: 160px; aspect-ratio: 1; border: 1px solid color-mix(in srgb, var(--aqi-color, var(--accent)) 34%, transparent); border-radius: 50%; animation: slowSpin 20s linear infinite; }
.hero-orbit::before, .hero-orbit::after { content: ""; position: absolute; inset: 23px; border: 1px dashed color-mix(in srgb, var(--aqi-color, var(--accent)) 30%, transparent); border-radius: 50%; }.hero-orbit::after { inset: 50px; border-style: solid; }
.hero-orbit span { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--aqi-color, var(--accent)); box-shadow: 0 0 18px var(--aqi-color, var(--accent)); }.hero-orbit span:nth-child(1){left:15px;top:32px}.hero-orbit span:nth-child(2){right:-3px;top:73px}.hero-orbit span:nth-child(3){left:64px;bottom:-3px}
.action-plan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.action-item { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 11px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.action-icon { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); font-weight: 900; }
.action-item div { min-width: 0; display: flex; flex-direction: column; }.action-item small { color: var(--muted); font-size: 11px; }.action-item strong { overflow: hidden; text-overflow: ellipsis; font-size: 13px; white-space: nowrap; }

.snapshot-stack { display: grid; grid-template-rows: repeat(3, 1fr); gap: 12px; }
.metric-card { display: flex; align-items: center; gap: 16px; padding: 18px; }
.metric-icon { flex: 0 0 auto; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; font-size: 20px; font-weight: 900; }.metric-icon.accent{color:var(--accent);background:var(--accent-soft)}.metric-icon.warn{color:var(--aqi-moderate);background:color-mix(in srgb,var(--aqi-moderate) 13%,transparent)}.metric-icon.good{color:var(--aqi-good);background:color-mix(in srgb,var(--aqi-good) 13%,transparent)}
.metric-card > div { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 6px; }.metric-card small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }.metric-card strong { overflow: hidden; text-overflow: ellipsis; font-size: clamp(21px, 2vw, 29px); letter-spacing: -.045em; white-space: nowrap; }.metric-card span:not(.metric-icon) { min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.agent-section, .explore-section, .analyst-card, .diary-card { margin-bottom: 16px; padding: clamp(22px, 3vw, 34px); }
.backend-chip.online { color: var(--aqi-good); border-color: color-mix(in srgb, var(--aqi-good) 32%, transparent); background: color-mix(in srgb, var(--aqi-good) 9%, transparent); }
.backend-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.agent-flow { display: grid; grid-template-columns: 1fr 34px 1fr 34px 1fr 34px 1fr; align-items: stretch; }
.agent-node { position: relative; min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface-soft); transition: transform .22s ease, border-color .22s ease, background .22s ease; }
.agent-node-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }.agent-index { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .16em; }.agent-state { padding: 3px 7px; border-radius: 999px; color: var(--muted); background: var(--surface-soft); font-size: 10px; font-weight: 900; }
.agent-symbol { display: grid; place-items: center; width: 42px; height: 42px; margin: 22px 0 17px; border-radius: 14px; color: var(--accent); background: var(--accent-soft); font-size: 20px; }
.agent-node h3 { margin: 0; font-size: 15px; }.agent-node p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.agent-node[data-state="running"] { transform: translateY(-4px); border-color: var(--accent); background: linear-gradient(145deg, var(--accent-soft), var(--surface-soft)); box-shadow: 0 0 35px color-mix(in srgb, var(--accent) 14%, transparent); }.agent-node[data-state="running"] .agent-state { color: #061715; background: var(--accent); }.agent-node[data-state="running"] .agent-symbol { animation: pulse 1.25s ease-in-out infinite; }
.agent-node[data-state="done"] { border-color: color-mix(in srgb, var(--aqi-good) 42%, transparent); }.agent-node[data-state="done"] .agent-state { color: #061715; background: var(--aqi-good); }
.agent-node[data-state="error"] { border-color: var(--danger); }.agent-node[data-state="error"] .agent-state { color: #fff; background: var(--danger); }
.agent-node[data-state="skipped"] { border-style: dashed; opacity: .72; }.agent-node[data-state="skipped"] .agent-state { color: var(--muted-strong); background: var(--border); }
.agent-connector { position: relative; align-self: center; height: 1px; overflow: hidden; background: var(--border-strong); }.agent-connector i { position: absolute; top: -1px; left: -35%; width: 35%; height: 3px; border-radius: 3px; background: var(--accent); animation: flow 2s linear infinite; }
.agent-hint { margin: 17px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.agent-log { max-height: 240px; margin-top: 18px; overflow: auto; padding: 14px; border-radius: 14px; background: #06101d; color: #c8d8e7; font: 11px/1.75 ui-monospace, SFMono-Regular, Consolas, monospace; }
:root[data-theme="light"] .agent-log { background: #e8eff3; color: #243d4b; }
.agent-log .ln { display: flex; gap: 9px; }.agent-log .who { flex: 0 0 auto; color: var(--accent); font-weight: 900; }.agent-log .dim { color: var(--muted); }
.agent-result { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }.agent-block { min-width: 0; padding: 17px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); }.agent-block h3 { margin: 0 0 8px; color: var(--accent); font-size: 11px; }.agent-block p { margin: 0; color: var(--muted-strong); font-size: 12px; white-space: pre-wrap; }

.filter-bar { display: grid; grid-template-columns: minmax(210px, 1fr) 160px 160px; gap: 9px; margin-bottom: 16px; }
.search-field { position: relative; }.search-field span { position: absolute; left: 13px; top: 50%; z-index: 1; color: var(--muted); transform: translateY(-50%); }.search-field input { padding-left: 38px; }
.city-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.city-tile { position: relative; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.city-tile:hover { transform: translateY(-3px); border-color: var(--border-strong); }.city-tile.active { border-color: var(--tile-color, var(--accent)); background: color-mix(in srgb, var(--tile-color, var(--accent)) 9%, var(--surface-soft)); }
.city-tile-main { width: 100%; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; }.city-tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }.city-tile-name { min-width: 0; overflow: hidden; font-size: 13px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }.city-tile-aqi { font-size: 22px; font-weight: 900; letter-spacing: -.05em; }.city-tile-meta { display: flex; justify-content: space-between; gap: 6px; margin-top: 9px; color: var(--muted); font-size: 11px; }.compare-toggle { width: 100%; min-height: 40px; margin-top: 10px; padding: 7px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted-strong); background: transparent; font-size: 11px; font-weight: 850; }.compare-toggle[aria-pressed="true"] { color: #061715; border-color: transparent; background: var(--accent); }
.empty-state { grid-column: 1 / -1; padding: 34px; color: var(--muted); text-align: center; }
.compare-panel { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }.compare-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }.compare-head > div:first-child small { color: var(--accent); font-size: 8px; font-weight: 900; letter-spacing: .16em; }.compare-head h3 { margin: 2px 0 0; font-size: 16px; }.compare-chips { display: flex; flex: 1; flex-wrap: wrap; gap: 6px; }.compare-chip { padding: 4px 9px; border: 1px solid var(--border); border-radius: 999px; font-size: 9px; }.compare-chart { height: 310px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(360px, .72fr); gap: 16px; margin-bottom: 16px; }
.city-card, .ranking-card { min-width: 0; padding: clamp(22px, 3vw, 30px); }
.city-detail { display: grid; grid-template-columns: 178px minmax(0, 1fr); align-items: center; gap: 20px; }
.gauge-wrap { position: relative; width: 170px; height: 170px; }.gauge-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }.gauge-track { fill: none; stroke: var(--border); stroke-width: 10; }.gauge-value { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray .5s ease; }.gauge-center { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; }.gauge-num { font-size: 38px; font-weight: 900; letter-spacing: -.06em; }.gauge-lv { margin-top: 4px; padding: 3px 8px; border-radius: 999px; color: #071714; font-size: 11px; font-weight: 900; }
.poll-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }.poll { min-width: 0; padding: 11px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }.poll-name { color: var(--muted); font-size: 11px; }.poll-val { margin-top: 3px; overflow: hidden; font-size: 16px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }.poll-unit { margin-left: 3px; color: var(--muted); font-size: 10px; font-weight: 650; }
.trend-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }.trend-head h3 { margin: 0; font-size: 13px; }.segmented { display: flex; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }.segmented button { min-width: 44px; min-height: 40px; padding: 6px 9px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 850; }.segmented button.active { color: #061715; background: var(--accent); }
.chart { width: 100%; min-height: 230px; }.trend-chart { height: 250px; }.ranking-chart { height: 470px; }
.chart-placeholder { display: grid; place-items: center; height: 100%; min-height: 180px; color: var(--muted); font-size: 11px; }
.analyst-text { margin: 0; color: var(--muted-strong); font-size: 13px; line-height: 1.85; white-space: pre-wrap; }

.diary-grid { display: grid; grid-template-columns: minmax(230px, .58fr) minmax(0, 1.42fr); gap: 30px; }.diary-form { display: flex; flex-direction: column; gap: 8px; }.diary-form label { margin-top: 5px; color: var(--muted-strong); font-size: 10px; }.diary-form input[type="range"] { padding: 0; accent-color: var(--accent); }.diary-form .primary-button { margin-top: 8px; }.diary-msg { min-height: 18px; margin: 0; color: var(--aqi-good); font-size: 10px; }.diary-grid h3 { margin: 0 0 8px; font-size: 12px; }.diary-corr { max-width: 340px; color: var(--muted-strong); font-size: 10px; }.diary-chart { height: 270px; }
.trust-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 20px 0 4px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--border); }.trust-strip div { display: flex; flex-direction: column; padding: 18px 20px; background: var(--bg-elevated); }.trust-strip strong { font-size: 13px; }.trust-strip span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.site-foot { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px 28px; padding: 25px 18px 38px; color: var(--muted); font-size: 9px; }.site-foot strong { color: var(--text); font-size: 11px; }

.sidebar-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(2, 8, 14, .62); backdrop-filter: blur(4px); }
.sidebar { position: fixed; top: 0; right: 0; z-index: 121; display: flex; flex-direction: column; width: min(430px, 94vw); height: 100dvh; border-left: 1px solid var(--border); background: var(--bg-elevated); box-shadow: -24px 0 80px rgba(0, 0, 0, .32); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 24px 18px; border-bottom: 1px solid var(--border); }.sidebar-head h2 { margin: 0; font-size: 22px; letter-spacing: -.045em; }.sidebar-close { font-size: 24px; }
.sidebar-body { display: flex; flex: 1; flex-direction: column; gap: 22px; min-height: 0; overflow-y: auto; padding: 22px 24px; }.side-sec { display: flex; flex-direction: column; gap: 8px; }.side-sec h3 { margin: 0 0 4px; font-size: 12px; }.side-sec label { margin-top: 5px; color: var(--muted-strong); font-size: 10px; }.side-note { margin: 7px 0 0; color: var(--muted); font-size: 9px; }.advanced-sec { margin-top: auto; }.advanced-sec details { padding: 12px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }.advanced-sec summary { font-size: 10px; font-weight: 850; }.advanced-sec input { margin-top: 8px; }.side-status { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; }.side-status.online { color: var(--aqi-good); }.sidebar-actions { position: sticky; bottom: -22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px -24px -22px; padding: 16px 24px 22px; border-top: 1px solid var(--border); background: var(--bg-elevated); }

.fab { position: fixed; right: 24px; bottom: 24px; z-index: 65; display: grid; place-items: center; width: 58px; height: 58px; border: 0; border-radius: 19px; color: #061715; background: linear-gradient(135deg, var(--accent), #80c8ff); box-shadow: 0 18px 45px rgba(42, 168, 158, .32); font-size: 20px; }.fab:hover { transform: translateY(-4px) rotate(4deg); }
.chat-panel { position: fixed; right: 24px; bottom: 94px; z-index: 66; display: flex; flex-direction: column; width: min(390px, calc(100vw - 32px)); height: min(560px, calc(100dvh - 130px)); overflow: hidden; border: 1px solid var(--border-strong); border-radius: 22px; background: var(--bg-elevated); box-shadow: var(--shadow); }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-soft); }.chat-head > div { display: flex; align-items: center; gap: 9px; }.chat-head > div > div { display: flex; flex-direction: column; }.chat-head small { color: var(--muted); font-size: 7px; font-weight: 900; letter-spacing: .16em; }.chat-head strong { font-size: 12px; }.chat-status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--aqi-good); box-shadow: 0 0 0 5px color-mix(in srgb, var(--aqi-good) 12%, transparent); }.chat-close { width: 34px; height: 34px; border: 0; background: transparent; }
.chat-body { display: flex; flex: 1; flex-direction: column; gap: 10px; overflow-y: auto; padding: 16px; }.chat-msg { max-width: 86%; padding: 10px 12px; border-radius: 14px; font-size: 11px; line-height: 1.65; white-space: pre-wrap; }.chat-msg.bot { align-self: flex-start; border: 1px solid var(--border); border-bottom-left-radius: 4px; background: var(--surface-soft); }.chat-msg.user { align-self: flex-end; border-bottom-right-radius: 4px; color: #061715; background: var(--accent); }.chat-msg .refs { margin-top: 7px; color: var(--muted); font-size: 8px; }
.chat-input { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; padding: 11px; border-top: 1px solid var(--border); }.chat-input input { min-width: 0; }.chat-input button { border: 0; border-radius: 11px; color: #061715; background: var(--accent); font-weight: 900; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 120; max-width: min(420px, calc(100vw - 32px)); padding: 11px 16px; border: 1px solid var(--border-strong); border-radius: 13px; color: var(--text); background: var(--surface-solid); box-shadow: var(--shadow); font-size: 11px; transform: translateX(-50%); }

@keyframes slowSpin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 25px color-mix(in srgb, var(--accent) 26%, transparent); } }
@keyframes flow { to { left: 110%; } }

@media (max-width: 1120px) {
  .topbar { grid-template-columns: 1fr auto; }.topbar-status { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: flex-start; padding-top: 7px; border-top: 1px solid var(--border); }.topbar-actions { grid-column: 2; grid-row: 1; }
  .hero-grid { grid-template-columns: 1fr; }.snapshot-stack { grid-template-columns: repeat(3, 1fr); grid-template-rows: none; }.metric-card { padding: 14px; }
  .city-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }.detail-grid { grid-template-columns: 1fr; }.ranking-chart { height: 420px; }
}

@media (max-width: 760px) {
  main { width: min(calc(100% - 24px), var(--max-width)); padding-top: 16px; }
  .topbar { gap: 10px; min-height: 66px; padding: 10px 12px; }.brand small, .profile-button-copy, .freshness { display: none; }.profile-button { width: 42px; padding: 4px; }.profile-avatar { width: 32px; height: 32px; }.topbar-status { gap: 7px; overflow: hidden; padding-top: 8px; }.live-pill, .mode-badge { font-size: 9px; }
  .data-alert { padding: 10px 12px; }
  .hero-card { min-height: auto; }.hero-copy { padding: 24px 20px; }.hero-title-row { flex-direction: column; }.hero-title-row .compact-field { width: 100%; }.compact-field select { width: 100%; }.hero-reading { min-height: 145px; }.hero-orbit { right: -12px; width: 130px; }.action-plan { grid-template-columns: 1fr; }.action-item strong { white-space: normal; }
  .snapshot-stack { grid-template-columns: 1fr; }.metric-card { min-height: 92px; }
  .section-heading { flex-direction: column; gap: 13px; }.section-actions { width: 100%; justify-content: space-between; }
  .agent-flow { grid-template-columns: 1fr; gap: 8px; }.agent-connector { width: 1px; height: 25px; margin: 0 auto; }.agent-connector i { top: -30%; left: -1px; width: 3px; height: 35%; animation-name: flowY; }.agent-node { padding: 16px; }.agent-symbol { margin: 14px 0 10px; }
  .agent-result { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr 1fr; }.search-field { grid-column: 1 / -1; }.city-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }.compare-head { align-items: flex-start; }
  .city-detail { grid-template-columns: 1fr; justify-items: center; }.poll-grid { width: 100%; }.trend-head { align-items: flex-start; flex-direction: column; }.segmented { align-self: stretch; }.segmented button { flex: 1; }
  .diary-grid, .trust-strip { grid-template-columns: 1fr; }.trust-strip { gap: 1px; }
  .site-foot { flex-direction: column; gap: 6px; }
  .fab { right: 16px; bottom: 16px; }.chat-panel { right: 16px; bottom: 82px; }
}

@keyframes flowY { to { top: 110%; } }

@media (max-width: 430px) {
  .city-grid { grid-template-columns: 1fr 1fr; }.filter-bar { grid-template-columns: 1fr; }.search-field { grid-column: auto; }
  .poll-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { width: 100vw; }.chat-panel { right: 8px; width: calc(100vw - 16px); }
  #hero-aqi { font-size: 80px; }.hero-title-row h1 { font-size: 38px; }
}

@media (max-width: 360px) {
  .city-grid { grid-template-columns: 1fr; }
}

:root[data-theme="light"] .primary-button,
:root[data-theme="light"] .compare-toggle[aria-pressed="true"],
:root[data-theme="light"] .segmented button.active,
:root[data-theme="light"] .agent-node[data-state="running"] .agent-state,
:root[data-theme="light"] .agent-node[data-state="done"] .agent-state { color: #fff; background: #087f73; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
