/* =============================================
   TaihuGuard — 太湖水质智能预警系统 V3
   指挥中心级 · 权威可信 · 移动端适配
   ============================================= */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #060a13;
    --bg-secondary: #0c1221;
    --bg-card: #111827;
    --bg-card-hover: #1a2236;
    --border-color: #1e293b;
    --border-bright: #2a3a52;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #00d4ff;
    --accent-secondary: #38bdf8;
    --accent-dim: rgba(0, 212, 255, 0.1);
    --accent-glow: rgba(0, 212, 255, 0.25);

    --wq-1: #22c55e; --wq-2: #84cc16; --wq-3: #eab308;
    --wq-4: #f97316; --wq-5: #ef4444; --wq-6: #991b1b;
    --alert-none: #22c55e; --alert-low: #eab308;
    --alert-mid: #f97316; --alert-high: #ef4444;

    --glass-bg: rgba(17, 24, 39, 0.75);
    --glass-border: rgba(30, 41, 59, 0.8);
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 4px 20px rgba(0,0,0,0.15);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.08);
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI',
                 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* — 网格背景 — */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.025) 1px, transparent 1px);
    background-size: 80px 80px;
    pointer-events: none;
    z-index: 0;
}

/* — 暗角 — */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 30%, transparent 40%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
    z-index: 0;
}

/* ==================== Header ==================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 60px;
    background: rgba(12, 18, 33, 0.92);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* 渐变底部光带 */
.header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 5%, var(--accent) 30%, var(--accent-secondary) 70%, transparent 95%);
    opacity: 0.5;
}

.header-left { display: flex; align-items: center; }

.logo { display: flex; align-items: center; gap: 12px; }

.logo-icon {
    width: 30px; height: 30px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.subtitle {
    font-size: 12px;
    color: var(--text-muted);
    padding-left: 12px;
    margin-left: 4px;
    border-left: 1px solid var(--border-bright);
    white-space: nowrap;
}

.header-right { display: flex; align-items: center; gap: 16px; }

/* About 按钮 */
.about-btn {
    background: transparent;
    border: 1px solid var(--border-bright);
    color: var(--text-muted);
    width: 34px; height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s;
}
.about-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 12px var(--accent-dim);
}

/* 状态胶囊 */
.status-indicator {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600;
    padding: 5px 14px;
    border-radius: 20px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    letter-spacing: 0.3px;
}

.status-indicator.demo-mode {
    background: rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.2);
}
.status-indicator.demo-mode .status-text { color: var(--alert-mid); }
.status-indicator.demo-mode .status-dot { background: var(--alert-mid); }
.status-indicator.demo-mode .status-dot::before,
.status-indicator.demo-mode .status-dot::after { background: var(--alert-mid); }

.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--alert-none);
    position: relative;
    flex-shrink: 0;
}
.status-dot::before, .status-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--alert-none);
    opacity: 0;
    animation: ripple 2.4s ease-out infinite;
}
.status-dot::after { animation-delay: 1s; }

@keyframes ripple {
    0% { transform: scale(0.5); opacity: 0.5; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* 地图标记脉冲（蓝藻预警站点） */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.15); }
}

.status-text { color: var(--alert-none); }
.update-time { font-size: 11px; color: var(--text-muted); }

/* ==================== Data Notice Banner ==================== */
.data-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    background: rgba(249, 115, 22, 0.08);
    border-bottom: 1px solid rgba(249, 115, 22, 0.2);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    position: relative;
    z-index: 1;
}
.data-notice strong { color: var(--alert-mid); font-weight: 700; }
.data-notice-icon { font-size: 16px; color: var(--alert-mid); flex-shrink: 0; }
.data-notice-close {
    background: none; border: none;
    color: var(--text-muted); font-size: 18px;
    cursor: pointer; padding: 0 4px; margin-left: auto;
    flex-shrink: 0; line-height: 1;
}
.data-notice-close:hover { color: var(--text-primary); }

/* ==================== Stats Bar ==================== */
.stats-bar {
    display: flex; align-items: center; justify-content: center;
    gap: 40px;
    padding: 12px 28px;
    background: rgba(12, 18, 33, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.stat-item {
    display: flex; align-items: baseline; gap: 6px;
    font-size: 13px;
}
.stat-icon { font-size: 14px; opacity: 0.5; margin-right: 2px; }
.stat-label { color: var(--text-muted); font-size: 12px; }
.stat-value {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff, var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== Main Content ==================== */
.main-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ==================== Panel 通用 ==================== */
.panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-card);
    animation: panelFadeIn 0.6s ease-out both;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 10%, var(--accent-glow) 50%, transparent 90%);
    z-index: 1;
}

@keyframes panelFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.top-section .side-panel > :nth-child(1) { animation-delay: 0.05s; }
.top-section .side-panel > :nth-child(2) { animation-delay: 0.1s; }
.middle-section .panel { animation-delay: 0.15s; }
.middle-section .mini-panel:nth-child(1) { animation-delay: 0.2s; }
.middle-section .mini-panel:nth-child(2) { animation-delay: 0.25s; }
.bottom-section .panel:nth-child(1) { animation-delay: 0.3s; }
.bottom-section .panel:nth-child(2) { animation-delay: 0.35s; }
.bottom-section .panel:nth-child(3) { animation-delay: 0.4s; }

.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
}
.panel-header h2 {
    font-size: 13px; font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.badge {
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 11px; font-weight: 700;
    padding: 2px 9px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

/* ==================== Top Section ==================== */
.top-section {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
    height: 500px;
}

/* ---------- Map ---------- */
.map-container {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

.map-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 3px,
        rgba(0, 212, 255, 0.01) 3px, rgba(0, 212, 255, 0.01) 4px
    );
    pointer-events: none;
    z-index: 2;
}
.map-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 48px; height: 48px;
    border-top: 2px solid var(--accent);
    border-left: 2px solid var(--accent);
    pointer-events: none;
    z-index: 3;
    opacity: 0.4;
}

.map-hud-corner-tr, .map-hud-corner-bl, .map-hud-corner-br {
    position: absolute;
    width: 48px; height: 48px;
    pointer-events: none;
    z-index: 3;
    opacity: 0.4;
}
.map-hud-corner-tr { top: 0; right: 0; border-top: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.map-hud-corner-bl { bottom: 0; left: 0; border-bottom: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.map-hud-corner-br { bottom: 0; right: 0; border-bottom: 2px solid var(--accent); border-right: 2px solid var(--accent); }

.map { width: 100%; height: 100%; }

.map-legend {
    position: absolute;
    bottom: 16px; left: 16px;
    background: rgba(6, 10, 19, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px 14px;
    z-index: 4;
}
.legend-title { font-size: 10px; color: var(--text-muted); margin-bottom: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.legend-items { display: flex; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-secondary); }
.legend-color { width: 10px; height: 10px; border-radius: 2px; }

.map-controls { position: absolute; top: 16px; right: 16px; z-index: 4; }

.param-select {
    background: rgba(6, 10, 19, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 7px 12px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.param-select:focus { border-color: var(--accent); }
.param-select option { background: var(--bg-card); color: var(--text-primary); }

/* ---------- Side Panel ---------- */
.side-panel { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Alert Panel ---------- */
.alert-panel { flex: 1; min-height: 0; }
.alert-list { padding: 6px; overflow-y: auto; max-height: 280px; }

.alert-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
}
.alert-item:hover { background: var(--bg-card-hover); }
.alert-item.alert-high { border-left-color: var(--alert-high); }
.alert-item.alert-mid  { border-left-color: var(--alert-mid); }
.alert-item.alert-low  { border-left-color: var(--alert-low); }

.alert-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.alert-info { flex: 1; min-width: 0; }
.alert-station { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-detail { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.alert-level {
    font-size: 11px; font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.alert-level.high { background: rgba(239,68,68,0.12); color: var(--alert-high); }
.alert-level.mid  { background: rgba(249,115,22,0.12); color: var(--alert-mid); }
.alert-level.low  { background: rgba(234,179,8,0.12); color: var(--alert-low); }

.no-alerts { text-align: center; padding: 30px; color: var(--text-muted); font-size: 13px; }

/* ---------- Metric Cards ---------- */
.metrics-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px 10px 10px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.metric-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: inset 0 0 0 1px var(--accent), 0 0 20px var(--accent-dim);
}
.metric-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}
.metric-card:hover::after { opacity: 1; }

.metric-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; letter-spacing: 0.2px; white-space: nowrap; }
.metric-value {
    font-size: 22px; font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
    line-height: 1.1;
    white-space: nowrap;
}
.metric-trend { font-size: 11px; margin-top: 5px; font-weight: 600; }
.metric-trend.up   { color: var(--alert-high); }
.metric-trend.down { color: var(--alert-none); }
.metric-trend.stable { color: var(--text-muted); }

/* ==================== Timeline ==================== */
.timeline-section { margin-bottom: 4px; }

.timeline-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    box-shadow: var(--shadow-card);
}

.timeline-bar { display: flex; align-items: center; gap: 14px; }
.timeline-label { color: var(--text-muted); font-size: 11px; white-space: nowrap; min-width: 36px; font-weight: 600; }
.timeline-track { flex: 1; position: relative; height: 24px; }

.timeline-progress {
    position: absolute; top: 10px; left: 0; height: 4px;
    background: linear-gradient(90deg, var(--accent), #0099cc);
    border-radius: 2px; pointer-events: none; z-index: 1; transition: width 0.1s;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}
.timeline-slider {
    position: absolute; top: 0; left: 0; width: 100%; height: 24px;
    -webkit-appearance: none; appearance: none;
    background: transparent; cursor: pointer; z-index: 2;
}
.timeline-slider::-webkit-slider-runnable-track { height: 4px; background: var(--border-color); border-radius: 2px; }
.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-primary);
    margin-top: -6px;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}
.timeline-slider::-moz-range-track { height: 4px; background: var(--border-color); border-radius: 2px; border: none; }
.timeline-slider::-moz-range-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.timeline-ticks { position: absolute; top: 18px; left: 0; right: 0; height: 6px; pointer-events: none; }
.tick { position: absolute; width: 1px; height: 4px; background: var(--border-color); }
.tick-now { width: 2px; height: 8px; background: var(--accent); top: -2px; }

.timeline-info { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
#timelineDate { color: var(--accent); font-size: 12px; font-weight: 600; }
.timeline-buttons { display: flex; gap: 8px; }
.tl-btn {
    background: transparent;
    border: 1px solid var(--border-bright);
    color: var(--text-muted);
    width: 30px; height: 30px;
    border-radius: 6px;
    cursor: pointer; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.tl-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ==================== Middle Section ==================== */
.middle-section {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    height: 380px;
}
.chart-panel { height: 100%; display: flex; flex-direction: column; }
.chart-controls { display: flex; align-items: center; gap: 10px; }

.param-tabs { display: flex; gap: 3px; }
.param-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px; font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.param-tab:hover { border-color: var(--accent); color: var(--accent); }
.param-tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.chart-container { flex: 1; padding: 8px; min-height: 0; }

/* 分析侧栏 */
.analysis-sidebar { display: flex; flex-direction: column; gap: 16px; }
.mini-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mini-chart-container { flex: 1; min-height: 0; padding: 2px 6px; }

/* ==================== Bottom Section (3 列) ==================== */
.bottom-section {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    height: 310px;
}
.bottom-panel { height: 100%; display: flex; flex-direction: column; }
.chart-container-sm { flex: 1; min-height: 0; padding: 4px 8px; }
.param-select-sm { padding: 3px 8px; font-size: 11px; }

/* 模型性能面板 */
.model-metrics-body { padding: 10px 16px; overflow-y: auto; flex: 1; }

.metric-row-bar { display: flex; flex-direction: column; gap: 5px; padding: 7px 0; border-bottom: 1px solid var(--border-color); }
.metric-row-bar .metric-row-top { display: flex; justify-content: space-between; font-size: 12px; }
.metric-row-bar .metric-row-top span:first-child { color: var(--text-muted); }
.metric-val { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; }

.metric-progress { width: 100%; height: 3px; background: rgba(30,41,59,0.6); border-radius: 2px; overflow: hidden; }
.metric-progress-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent), #0099cc); transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1); }

.model-summary { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-color); }
.model-summary-row { display: flex; justify-content: space-between; font-size: 11px; padding: 3px 0; color: var(--text-muted); }
.model-summary-row span:last-child { color: var(--text-secondary); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ==================== Modal ==================== */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 200;
    justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 720px; max-width: 95vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none; border: none;
    color: var(--text-muted); font-size: 24px;
    cursor: pointer; padding: 0 4px; line-height: 1;
    transition: color 0.2s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-chart { height: 250px; margin-top: 16px; }

.station-info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.station-info-item { background: var(--bg-secondary); border-radius: 8px; padding: 12px; text-align: center; }
.station-info-item .label { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.station-info-item .value { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.station-info-item .unit { font-size: 10px; color: var(--text-muted); }

.popup-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.popup-level { font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 500; }
.popup-params { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12px; }
.popup-param { display: flex; justify-content: space-between; }
.popup-param .name { color: var(--text-muted); }
.popup-param .val { color: var(--text-primary); font-weight: 500; font-variant-numeric: tabular-nums; }
.popup-bloom { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-color); font-size: 12px; }

/* ==================== Mapbox Popup ==================== */
.mapboxgl-popup-content {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 10px !important;
    padding: 14px 18px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
    min-width: 220px;
}
.mapboxgl-popup-tip { border-top-color: var(--bg-card) !important; }
.mapboxgl-popup-close-button { color: var(--text-muted) !important; font-size: 18px !important; right: 8px !important; top: 8px !important; }

/* ==================== Loading / Skeleton ==================== */
.loading-placeholder { text-align: center; padding: 30px; color: var(--text-muted); font-size: 13px; }
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ==================== About Drawer ==================== */
.about-drawer-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 300;
    opacity: 0; visibility: hidden;
    transition: all 0.3s;
}
.about-drawer-overlay.active { opacity: 1; visibility: visible; }

.about-drawer {
    position: fixed; top: 0; right: 0;
    width: 460px; max-width: 100vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 301;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.about-drawer-overlay.active .about-drawer { transform: translateX(0); }

.about-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.about-drawer-header h2 { font-size: 16px; font-weight: 700; }
.about-drawer-close { background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; padding: 4px; line-height: 1; }
.about-drawer-close:hover { color: var(--text-primary); }
.about-drawer-body { flex: 1; overflow-y: auto; padding: 24px; }

.about-section { margin-bottom: 28px; }
.about-section:last-child { margin-bottom: 0; }
.about-section h3 {
    font-size: 11px; font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.about-section h3::before { content: ''; width: 3px; height: 14px; background: var(--accent); border-radius: 2px; flex-shrink: 0; }
.about-section p { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }

.pipeline-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pipeline-node { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 6px; padding: 6px 12px; font-size: 12px; color: var(--text-primary); white-space: nowrap; }
.pipeline-arrow { color: var(--accent); font-size: 14px; flex-shrink: 0; }

.arch-blocks { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.arch-block { background: var(--bg-card); border: 1px solid var(--border-color); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 14px; }
.arch-block .arch-name { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.arch-block .arch-desc { font-size: 11px; color: var(--text-muted); line-height: 1.6; }

.key-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
.key-stat { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 12px; text-align: center; }
.key-stat .ks-value { font-size: 22px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.key-stat .ks-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.tech-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tech-tag { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(0,212,255,0.15); border-radius: 4px; padding: 3px 10px; font-size: 12px; font-weight: 600; }

/* ==================== Intro Button ==================== */
.intro-btn {
    background: transparent;
    border: 1px solid var(--border-bright);
    color: var(--text-muted);
    width: 34px; height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s;
    padding: 0;
}
.intro-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 12px var(--accent-dim);
}
.intro-btn svg { display: block; }

/* ==================== Intro Drawer Content ==================== */
.intro-param-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 8px;
}
.intro-param {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 12px;
}
.intro-param-name { color: var(--text-primary); font-weight: 500; }
.intro-param-unit { color: var(--text-muted); font-size: 11px; }

.intro-sources { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.intro-source {
    display: flex;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
}
.intro-source-icon { font-size: 20px; flex-shrink: 0; opacity: 0.6; line-height: 1.2; }
.intro-source-body { flex: 1; }
.intro-source-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.intro-source-desc { font-size: 12px; color: var(--text-muted); line-height: 1.7; }
.intro-source-desc strong { color: var(--text-secondary); }

.intro-bloom-levels { display: flex; flex-direction: column; gap: 6px; }
.intro-bloom-level {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
}
.intro-bloom-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.intro-bloom-name { font-weight: 600; color: var(--text-primary); min-width: 48px; }
.intro-bloom-cond { color: var(--text-muted); }

.intro-schedule { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.intro-schedule-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
}
.intro-schedule-freq { font-size: 15px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.intro-schedule-desc { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

.intro-features { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.intro-feature {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 10px 14px;
}
.intro-feature-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.intro-feature-desc { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

.intro-wq-table { margin-top: 4px; }
.intro-wq-row {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 1fr;
    gap: 8px;
    padding: 7px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}
.intro-wq-header {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-card);
    border-radius: 4px 4px 0 0;
}

/* ==================== Footer ==================== */
.dashboard-footer {
    padding: 18px 28px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
    background: rgba(12, 18, 33, 0.5);
}
.dashboard-footer a { color: var(--accent); text-decoration: none; }
.footer-sep { margin: 0 10px; opacity: 0.3; }

/* ========================================================================
   RESPONSIVE — 移动端全面优化
   ======================================================================== */

/* ---------- Tablet (<=1200px) ---------- */
@media (max-width: 1200px) {
    .main-content { padding: 16px; gap: 16px; }

    .top-section {
        grid-template-columns: 1fr;
        height: auto;
    }
    .map-container { height: 380px; }

    .middle-section {
        grid-template-columns: 1fr;
        height: auto;
    }
    .chart-panel { min-height: 320px; }
    .analysis-sidebar { flex-direction: row; }
    .analysis-sidebar .mini-panel { min-height: 220px; }

    .bottom-section {
        grid-template-columns: 1fr 1fr;
        height: auto;
    }
    .bottom-panel { min-height: 260px; }
    .bottom-panel:last-child {
        grid-column: 1 / -1;
    }

    .metrics-cards { grid-template-columns: repeat(3, 1fr); }

    .stats-bar { gap: 24px; flex-wrap: wrap; }
    .about-drawer { width: 100%; }
    .station-info-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Mobile (<=768px) ---------- */
@media (max-width: 768px) {
    .header { padding: 0 16px; height: 54px; }
    .logo h1 { font-size: 16px; }
    .subtitle { display: none; }
    .header-right { gap: 10px; }
    .update-time { display: none; }
    .about-btn { width: 30px; height: 30px; font-size: 13px; }
    .status-indicator { padding: 4px 10px; font-size: 11px; }

    .stats-bar {
        gap: 12px 20px;
        padding: 10px 16px;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .stats-bar::-webkit-scrollbar { display: none; }
    .stat-item { flex-shrink: 0; font-size: 12px; }
    .stat-value { font-size: 15px; }

    .main-content { padding: 12px; gap: 12px; }

    .top-section { gap: 12px; }
    .map-container { height: 300px; }
    .map-legend { bottom: 8px; left: 8px; padding: 8px 10px; }
    .legend-items { gap: 6px; flex-wrap: wrap; }
    .legend-item { font-size: 10px; }
    .map-controls { top: 8px; right: 8px; }
    .param-select { font-size: 12px; padding: 5px 10px; }

    .side-panel { gap: 12px; }
    .alert-list { max-height: 200px; }
    .metrics-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .metric-card { padding: 10px 6px 8px; }
    .metric-label { font-size: 9px; }
    .metric-value { font-size: 18px; }
    .metric-trend { font-size: 10px; }

    .timeline-panel { padding: 10px 14px; }
    .tl-btn { width: 28px; height: 28px; }

    .middle-section { gap: 12px; }
    .chart-panel { min-height: 280px; }
    .panel-header { padding: 10px 14px; }
    .panel-header h2 { font-size: 12px; }
    .chart-controls { flex-wrap: wrap; gap: 6px; }
    .param-tabs { flex-wrap: wrap; gap: 2px; }
    .param-tab { padding: 3px 8px; font-size: 10px; }

    .analysis-sidebar { flex-direction: column; }
    .analysis-sidebar .mini-panel { min-height: 200px; }

    .bottom-section {
        grid-template-columns: 1fr;
        height: auto;
    }
    .bottom-panel { min-height: 240px; }
    .bottom-panel:last-child { grid-column: auto; }

    .modal { width: 95vw; max-height: 90vh; border-radius: 12px; }
    .modal-header { padding: 14px 18px; }
    .modal-header h2 { font-size: 14px; }
    .modal-body { padding: 16px 18px; }
    .station-info-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .station-info-item { padding: 10px 8px; }
    .station-info-item .value { font-size: 15px; }

    .dashboard-footer { padding: 14px 16px; font-size: 10px; }
}

/* ---------- Small Mobile (<=480px) ---------- */
@media (max-width: 480px) {
    .header { height: 48px; }
    .logo-icon { width: 24px; height: 24px; }
    .logo h1 { font-size: 14px; letter-spacing: 0.5px; }

    .stats-bar { padding: 8px 12px; gap: 10px 16px; }
    .stat-value { font-size: 14px; }
    .stat-label { font-size: 11px; }

    .main-content { padding: 8px; gap: 10px; }
    .map-container { height: 260px; }

    .metrics-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .metric-card { padding: 8px 4px 6px; }
    .metric-value { font-size: 16px; }
    .metric-label { font-size: 9px; margin-bottom: 4px; }

    .chart-panel { min-height: 240px; }
    .analysis-sidebar .mini-panel { min-height: 180px; }
    .bottom-panel { min-height: 220px; }

    .modal { border-radius: 10px; }
    .station-info-grid { grid-template-columns: repeat(2, 1fr); }

    .about-drawer-body { padding: 18px; }
    .about-section p { font-size: 12px; }
    .key-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .key-stat .ks-value { font-size: 18px; }
}

/* ==================== Reduced Motion ==================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .status-dot::before, .status-dot::after { animation: none; }
    .panel { animation: none; opacity: 1; }
}
