* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans KR', 'Segoe UI', sans-serif;
  background: #0a0e1a;
  color: #e0e6f0;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== HEADER ===== */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 64px;
  background: linear-gradient(135deg, #0d1117 0%, #161b2e 100%);
  border-bottom: 1px solid rgba(255, 100, 50, 0.3);
  flex-shrink: 0;
  z-index: 1000;
}

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

.header-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(255, 100, 0, 0.8));
}

.header-text h1 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.header-text p {
  font-size: 11px;
  color: #8899bb;
  margin-top: 1px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 12px;
  color: #8899bb;
  margin-right: 4px;
}

.filter-btn {
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  background: transparent;
  color: #aabbcc;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.filter-btn.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.filter-btn.risk-high { color: #ff4444; border-color: rgba(255, 68, 68, 0.4); }
.filter-btn.risk-high:hover, .filter-btn.risk-high.active { background: rgba(255, 68, 68, 0.15); border-color: #ff4444; }

.filter-btn.risk-medium { color: #ff8c00; border-color: rgba(255, 140, 0, 0.4); }
.filter-btn.risk-medium:hover, .filter-btn.risk-medium.active { background: rgba(255, 140, 0, 0.15); border-color: #ff8c00; }

.filter-btn.risk-low { color: #ffc300; border-color: rgba(255, 195, 0, 0.4); }
.filter-btn.risk-low:hover, .filter-btn.risk-low.active { background: rgba(255, 195, 0, 0.15); border-color: #ffc300; }

/* ===== MAIN LAYOUT ===== */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
#sidebar {
  width: 280px;
  flex-shrink: 0;
  background: #0d1117;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: #8899bb;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

/* Risk Summary Cards */
.risk-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.risk-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
}

.risk-card.risk-high { border-color: rgba(255, 68, 68, 0.2); }
.risk-card.risk-medium { border-color: rgba(255, 140, 0, 0.2); }
.risk-card.risk-low { border-color: rgba(255, 195, 0, 0.2); }

.risk-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.risk-card.risk-high .risk-indicator { background: #ff4444; box-shadow: 0 0 6px rgba(255,68,68,0.6); }
.risk-card.risk-medium .risk-indicator { background: #ff8c00; box-shadow: 0 0 6px rgba(255,140,0,0.6); }
.risk-card.risk-low .risk-indicator { background: #ffc300; box-shadow: 0 0 6px rgba(255,195,0,0.6); }

.risk-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.risk-label {
  font-size: 13px;
  color: #ccd6f0;
}

.risk-count {
  font-size: 18px;
  font-weight: 700;
}

.risk-card.risk-high .risk-count { color: #ff4444; }
.risk-card.risk-medium .risk-count { color: #ff8c00; }
.risk-card.risk-low .risk-count { color: #ffc300; }

.risk-bar-wrap {
  width: 60px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.risk-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.risk-card.risk-high .risk-bar { background: #ff4444; }
.risk-card.risk-medium .risk-bar { background: #ff8c00; }
.risk-card.risk-low .risk-bar { background: #ffc300; }

/* Region Stats */
.region-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
}

.region-row:last-child { border-bottom: none; }

.region-name { color: #ccd6f0; }

.region-badges {
  display: flex;
  gap: 4px;
}

.badge {
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.badge-high { background: rgba(255,68,68,0.2); color: #ff6666; }
.badge-medium { background: rgba(255,140,0,0.2); color: #ffaa33; }
.badge-low { background: rgba(255,195,0,0.2); color: #ffd633; }

/* Route List */
.route-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.06);
  transition: all 0.2s;
}

.route-item:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.12);
}

.route-item.active {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
}

.route-color-bar {
  width: 3px;
  height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
  margin-top: 2px;
}

.route-info { flex: 1; }

.route-name {
  font-size: 12px;
  font-weight: 600;
  color: #e0e6f0;
  margin-bottom: 4px;
}

.route-meta {
  font-size: 11px;
  color: #6677aa;
  display: flex;
  gap: 10px;
}

/* ===== MAP ===== */
#map {
  flex: 1;
  z-index: 1;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
  background: rgba(13, 17, 30, 0.95);
  color: #e0e6f0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.leaflet-popup-tip { background: rgba(13, 17, 30, 0.95); }

.popup-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.popup-region {
  font-size: 11px;
  color: #8899bb;
  margin-bottom: 8px;
}

.popup-risk {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.popup-risk.HIGH { background: rgba(255,68,68,0.2); color: #ff6666; border: 1px solid rgba(255,68,68,0.3); }
.popup-risk.MEDIUM { background: rgba(255,140,0,0.2); color: #ffaa33; border: 1px solid rgba(255,140,0,0.3); }
.popup-risk.LOW { background: rgba(255,195,0,0.2); color: #ffd633; border: 1px solid rgba(255,195,0,0.3); }

.popup-stats {
  margin-top: 8px;
  font-size: 11px;
  color: #8899bb;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Data Source Status */
.data-source-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00cc66;
  flex-shrink: 0;
  animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 204, 102, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(0, 204, 102, 0); }
}

.live-label {
  font-size: 11px;
  font-weight: 600;
  color: #00cc66;
  letter-spacing: 0.4px;
}

.data-status {
  font-size: 11px;
  color: #8899bb;
  line-height: 1.6;
}

.data-status.loading { color: #8899bb; }
.data-status.success { color: #00cc66; }
.data-status.error { color: #ff6666; }
.data-status.empty { color: #aabb88; }

/* Weather Section */
.weather-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.weather-icon { font-size: 20px; }

.weather-title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #70c7ff;
}

.weather-time {
  font-size: 11px;
  color: #8899bb;
  margin-top: 1px;
}

.weather-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 8px 0 6px;
}

.weather-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 6px;
}

.weather-label { font-size: 10px; color: #6677aa; }

.weather-value {
  font-size: 14px;
  font-weight: 700;
  color: #ccd6f0;
}

.fwi-box {
  border: 1px solid;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fwi-label { font-size: 10px; color: #8899bb; }

.fwi-value {
  font-size: 15px;
  font-weight: 700;
}

.fwi-desc { font-size: 11px; color: #8899bb; }

/* Vulnerability Stats */
.vuln-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
  gap: 8px;
}
.vuln-row:last-child { border-bottom: none; }

.vuln-name { color: #ccd6f0; min-width: 80px; }

.vuln-score-wrap {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.vuln-score-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.vuln-count {
  font-size: 11px;
  color: #6677aa;
  min-width: 36px;
  text-align: right;
}

.priority-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
}
.priority-1 { background: rgba(255,51,51,0.2); color: #ff6666; }
.priority-2 { background: rgba(255,140,0,0.2); color: #ffaa33; }
.priority-3 { background: rgba(255,195,0,0.2); color: #ffd633; }

.history-source {
  font-size: 10px;
  color: #445566;
  margin-top: 6px;
  font-style: italic;
}

.vuln-extra {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.vuln-toggle-btn {
  background: none;
  border: none;
  color: #6677aa;
  font-size: 11px;
  cursor: pointer;
  padding: 6px 0;
  width: 100%;
  text-align: center;
  transition: color 0.2s;
}

.vuln-toggle-btn:hover { color: #aabbdd; }

.no-fire-msg {
  text-align: center;
  padding: 16px 8px;
  color: #6677aa;
  font-size: 12px;
  line-height: 1.8;
}

.no-fire-msg .no-fire-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.6;
}

/* Map Legend */
.map-legend {
  background: rgba(13, 17, 30, 0.92);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 11px;
  color: #aabbcc;
  line-height: 1.8;
  backdrop-filter: blur(8px);
}

.map-legend h4 {
  font-size: 11px;
  color: #8899bb;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-line {
  width: 20px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-separator {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 6px 0;
}

/* ===== AI 예측 섹션 ===== */
.ai-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.ai-icon { font-size: 20px; }

.ai-title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #bb88ff;
  letter-spacing: 0.3px;
}

/* 현재 시간대 표시 */
.current-period-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  margin-top: 3px;
  margin-bottom: 2px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: #8899bb;
  background: rgba(255,255,255,0.05);
}
.current-period-label.period-am    { color: #ffcc44; background: rgba(255,200,50,0.12);  border-color: rgba(255,200,50,0.3); }
.current-period-label.period-pm    { color: #ff7755; background: rgba(255,80,40,0.12);   border-color: rgba(255,80,40,0.35); }
.current-period-label.period-night { color: #99aaff; background: rgba(100,120,255,0.12); border-color: rgba(100,120,255,0.3); }

.ai-risk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.ai-risk-row:last-child { border-bottom: none; }

.ai-rank-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.ai-dong-info {
  flex: 1;
  min-width: 0;
}

.ai-dong-name {
  font-size: 12px;
  font-weight: 600;
  color: #ddc8ff;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ai-dong-meta {
  font-size: 10px;
  color: #6655aa;
  margin-top: 2px;
}

.ai-level-badge {
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
}

.ai-level-high   { background: rgba(170,68,255,0.25); color: #cc88ff; }
.ai-level-medium { background: rgba(119,51,221,0.25); color: #aa77ee; }
.ai-level-low    { background: rgba(85,34,170,0.25);  color: #8866cc; }

.ai-prob-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
  width: 52px;
}

.ai-prob-bar-wrap {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
}

.ai-prob-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.ai-prob-value {
  font-size: 11px;
  font-weight: 700;
  color: #bb88ff;
}

.ai-source-note {
  font-size: 10px;
  color: #445566;
  margin-top: 8px;
  font-style: italic;
}

.ai-index-note {
  font-size: 10px;
  color: #6677aa;
  margin-top: 4px;
  font-style: italic;
}

.ai-route-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 600;
  background: rgba(170,68,255,0.15);
  color: #bb88ff;
  margin-left: 5px;
  vertical-align: middle;
}

.popup-risk.ai-risk-badge {
  background: rgba(170,68,255,0.2);
  color: #cc88ff;
  border: 1px solid rgba(170,68,255,0.3);
}

/* ===== 최적 순찰 노선 ===== */
.optimal-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.optimal-section-header .section-title { margin-bottom: 0; }

.toggle-layer-btn {
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: #778899;
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  flex-shrink: 0;
}

.toggle-layer-btn.active {
  background: rgba(100,220,100,0.12);
  border-color: rgba(100,220,100,0.35);
  color: #88dd88;
}

.optimal-guard-card {
  display: flex;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.optimal-guard-bar {
  width: 4px;
  flex-shrink: 0;
}

.optimal-guard-body {
  flex: 1;
  padding: 10px 10px 8px;
  min-width: 0;
}

.optimal-guard-name {
  font-size: 12px;
  font-weight: 600;
  color: #e0e6f0;
  margin-bottom: 5px;
}

.optimal-guard-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
  color: #6677aa;
  margin-bottom: 8px;
}

.optimal-wp-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.optimal-wp-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.optimal-wp-row:hover { background: rgba(255,255,255,0.05); }

.optimal-wp-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.optimal-wp-dong {
  flex: 1;
  font-size: 11px;
  color: #ccd6f0;
}

.optimal-wp-prob {
  font-size: 10px;
  font-weight: 600;
}

/* ===== 격자 위험도 섹션 ===== */
.grid-summary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.grid-badge {
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.grid-badge-high   { background: rgba(255,51,51,0.18);  color: #ff6666; }
.grid-badge-medium { background: rgba(255,140,0,0.18);  color: #ffaa33; }
.grid-badge-low    { background: rgba(255,195,0,0.18);  color: #ffd633; }

/* 범례 격자 아이콘 */
.legend-rect {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* 지도 위 순찰 번호 마커 */
.optimal-stop-marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 0 2px 6px rgba(0,0,0,0.45);
}

/* ===== 최적 노선 메타 배지 ===== */
.optimal-meta-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.period-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid;
}
.period-all   { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.2); color: #ccd; }
.period-am    { background: rgba(255,200,50,0.15);  border-color: rgba(255,200,50,0.4);  color: #ffcc44; }
.period-pm    { background: rgba(255,80,40,0.15);   border-color: rgba(255,80,40,0.45);  color: #ff7755; }
.period-night { background: rgba(100,120,255,0.15); border-color: rgba(100,120,255,0.4); color: #99aaff; }

.balance-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(50,200,100,0.12);
  border: 1px solid rgba(50,200,100,0.3);
  color: #44cc77;
}

.road-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 10px;
  background: rgba(50,150,255,0.12);
  border: 1px solid rgba(50,150,255,0.3);
  color: #66aaff;
}
.road-badge-fallback {
  background: rgba(150,150,150,0.10);
  border-color: rgba(150,150,150,0.25);
  color: #8899aa;
}

/* ===== TIMELINE & SUMMARY BAR ===== */
#timeline-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 20px;
  background: #0b0f1c;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  z-index: 900;
  overflow-x: auto;
}

.stat-cards {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  min-width: 76px;
  transition: border-color 0.2s;
}

.stat-card.danger  { border-color: rgba(255,51,51,0.28);  background: rgba(255,51,51,0.05); }
.stat-card.warning { border-color: rgba(255,140,0,0.28);  background: rgba(255,140,0,0.05); }
.stat-card.success { border-color: rgba(0,180,80,0.28);   background: rgba(0,180,80,0.05);  }

.stat-value {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.stat-card.danger  .stat-value { color: #ff6666; }
.stat-card.warning .stat-value { color: #ffaa33; }
.stat-card.success .stat-value { color: #33cc77; }

.stat-label {
  font-size: 9px;
  color: #6677aa;
  margin-top: 2px;
  white-space: nowrap;
}

/* Timeline controls row */
.timeline-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.time-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.time-tabs-label {
  font-size: 10px;
  color: #667799;
  margin-right: 2px;
  white-space: nowrap;
}

.time-tab {
  padding: 4px 9px;
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 4px;
  background: transparent;
  color: #8899bb;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}

.time-tab:hover { background: rgba(255,255,255,0.07); color: #ccddf0; }

.time-tab.active {
  background: rgba(255,100,50,0.18);
  border-color: rgba(255,100,50,0.45);
  color: #ff7755;
}

/* Year slider */
.year-control {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 160px;
}

.year-control-label {
  font-size: 10px;
  color: #667799;
  white-space: nowrap;
  flex-shrink: 0;
}

.year-reset-btn {
  padding: 3px 7px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 4px;
  background: transparent;
  color: #7788aa;
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: all 0.18s;
}

.year-reset-btn:hover { background: rgba(255,255,255,0.07); color: #ccddf0; }

.year-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.13);
  outline: none;
  cursor: pointer;
  min-width: 60px;
}

.year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ff6644;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: 0 0 4px rgba(255,100,50,0.5);
}

.year-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ff6644;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.25);
}

.year-display {
  font-size: 12px;
  font-weight: 700;
  color: #ff8866;
  min-width: 34px;
  flex-shrink: 0;
}

/* Play / timeline action buttons */
.timeline-btns {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.play-btn {
  padding: 5px 11px;
  border: 1px solid rgba(255,100,50,0.38);
  border-radius: 6px;
  background: rgba(255,100,50,0.13);
  color: #ff7755;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  white-space: nowrap;
}

.play-btn:hover { background: rgba(255,100,50,0.22); }

/* Print button in header */
.print-btn-header {
  padding: 5px 9px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 6px;
  background: transparent;
  color: #8899bb;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
  line-height: 1;
}

.print-btn-header:hover { background: rgba(255,255,255,0.07); color: #e0e6f0; }

/* Mobile hamburger toggle */
.menu-toggle {
  display: none;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 6px;
  background: transparent;
  color: #e0e6f0;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

/* ===== SPINNER ===== */
.spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(255,255,255,0.12);
  border-top-color: #ff7755;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin-right: 5px;
  vertical-align: -2px;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  #header {
    padding: 0 10px;
    height: 50px;
    gap: 6px;
  }

  .menu-toggle { display: block; }

  .header-icon { font-size: 22px; }
  .header-text h1 { font-size: 13px; }
  .header-text p  { display: none; }

  .filter-group  { display: none; }

  #timeline-bar {
    flex-wrap: wrap;
    gap: 7px;
    padding: 7px 10px;
  }

  .stat-cards {
    width: 100%;
    justify-content: space-between;
  }

  .stat-card { flex: 1; min-width: 0; padding: 5px 4px; }
  .stat-value { font-size: 13px; }
  .stat-label { font-size: 9px; }

  .timeline-controls {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  #main { position: relative; overflow: hidden; }

  #sidebar {
    position: fixed;
    top: 0;
    left: -290px;
    width: 280px;
    height: 100%;
    z-index: 2000;
    transition: left 0.28s ease;
    background: #0d1117;
    overflow-y: auto;
    padding-top: 8px;
    box-shadow: none;
  }

  #sidebar.open {
    left: 0;
    box-shadow: 6px 0 24px rgba(0,0,0,0.65);
  }

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

/* ===== PRINT / PDF ===== */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  body {
    background: #fff;
    color: #000;
    overflow: visible;
    height: auto;
  }

  #app { height: auto; }

  #header, #timeline-bar, #sidebar { display: none !important; }

  #main { height: 100vh; }

  #map {
    width: 100%;
    height: 100vh;
    break-inside: avoid;
  }
}
