:root {
  /* 統一的「霧面深色玻璃」變數，取代原本偏白、廉價感的 liquid glass */
  --glass-bg: rgba(14, 20, 30, 0.46);
  --glass-bg-hover: rgba(20, 28, 40, 0.62);
  --glass-bg-active: rgba(26, 34, 46, 0.7);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-border-hover: rgba(255, 255, 255, 0.18);
  --glass-blur: 34px;
  --glass-saturate: 140%;
}
@keyframes rotate-waypoint {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
.airport-tooltip {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 2px solid #0066cc !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  padding: 8px 12px !important;
}

.airport-tooltip::before {
  border-top-color: #0066cc !important;
}
.next-waypoint-marker {
  animation: rotate-waypoint 2s linear infinite;
  filter: drop-shadow(0 0 8px rgba(255, 165, 0, 0.8));
}
    /* Photo Map Markers */
.plane-marker {
  font-size: 24px;
  cursor: pointer;
}

.photo-popup {
  max-width: 300px;
}

.photo-popup img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.photo-popup h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.photo-popup .info {
  font-size: 0.85rem;
  color: #666;
  margin: 0.3rem 0;
}

.photo-popup .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.photo-popup .tag {
  background: #667eea;
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
}
/* Aircraft Label Hover Effect */
.leaflet-aircraft-icon .aircraft-tag {
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.leaflet-aircraft-icon:hover .aircraft-tag {
  background: rgba(22, 30, 42, 0.58) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Aircraft Panel Modern Styling */
#aircraftPanel {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-height: 90vh;
  overflow-y: auto;
  z-index: 100001 !important;
  user-select: text;
  -webkit-user-select: text;
}

#aircraftPanel button {
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}
/* Photo Map Toggle */
#photoMapToggle {
  position: fixed;
  left: 10px;
  top: 100px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--glass-border);
  padding: 10px 15px;
  cursor: pointer;
  z-index: 99996;
  border-radius: 10px;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
  position: relative;
}

#photoMapToggle:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

#photoMapToggle.active {
  background: var(--glass-bg-active);
  border-color: var(--glass-border-hover);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}
    /* 側邊照片面板 */
#photoSidebar {
  position: fixed;
  right: -320px;
  top: 0;
  width: 300px;
  height: 100%;
  background: rgba(22, 27, 34, 0.95);
  box-shadow: -2px 0 10px rgba(0,0,0,0.5);
  transition: right 0.3s ease;
  z-index: 99997;
  overflow-y: auto;
  padding: 10px;
}

#photoSidebar.open {
  right: 0;
}

#photoToggle {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--glass-border);
  border-right: none;
  padding: 20px 10px;
  cursor: pointer;
  z-index: 99998;
  border-radius: 10px 0 0 10px;
  font-size: 18px;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
}

#photoToggle:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  box-shadow: -4px 0 26px rgba(0, 0, 0, 0.4);
}

.photo-item {
  margin-bottom: 15px;
  background: #0d1117;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.photo-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s;
}

.photo-item img:hover {
  transform: scale(1.05);
}

.photo-item .caption {
  padding: 8px;
  font-size: 12px;
  color: #e6edf3;
}
/* 新的 Discord 按鈕容器 
.social-buttons {
  position: fixed;
  bottom: 10px;
  left: 10px;
  display: flex;
  gap: 10px;
  z-index: 99997;  z-index 保持不變 
}

/* 按鈕的通用樣式 (未來可擴充) 
.social-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}*/

/* Discord 按鈕的專屬顏色 
.discord-btn {
  background: #5865F2;
  color: white;
}
    .github-ribbon {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 150px;
  height: 150px;
  overflow: hidden;
  z-index: 99998;
  pointer-events: none;
}
.github-ribbon a {
  position: absolute;
  bottom: 35px;
  left: -40px;
  transform: rotate(45deg);
  width: 200px;
  background: #c0392b;
  color: white;
  text-align: center;
  padding: 8px 0;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  pointer-events: auto;
  transition: background 0.3s ease;
}
.github-ribbon a:hover {
  background: #a93226;
}*/
* {
  box-sizing: border-box;
}

html,body { 
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
}

#map { 
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}
    html,body,#map { height:100%; margin:0; padding:0; }
    .label {
      font-family: Inter, "Noto Sans TC", Arial, sans-serif;
      font-size: 10px;
      padding: 3px 7px;
      border-radius: 7px;
      background: rgba(14, 20, 30, 0.46);
      backdrop-filter: blur(var(--label-blur, 30px)) saturate(140%);
      -webkit-backdrop-filter: blur(var(--label-blur, 30px)) saturate(140%);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: rgba(255, 255, 255, 0.92);
      opacity: var(--label-opacity, 1);
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
      white-space: nowrap;
      margin-left: 6px;
      position: relative;
      overflow: hidden;
      transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    }
    .label::after {
      content: '';
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      width: 4px;
      background: linear-gradient(to bottom, var(--alt-color, #ffffff), transparent);
    }
    .label.emergency {
      background: rgba(239, 68, 68, 0.25);
      border-color: rgba(239, 68, 68, 0.45);
      animation: pulse 1s ease-in-out infinite;
    }
    @keyframes pulse {
      0%, 100% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); }
      50% { box-shadow: 0 0 15px rgba(255,0,0,0.8); }
    }
    .legend {
      position: absolute;
      left: 10px;
      top: 10px;
      background: rgba(146, 146, 146, 0.9);
      padding:8px 10px;
      border-radius:6px;
      font-size:12px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    }
    .altitude-legend {
      position: absolute;
      left: 10px;
      bottom: 10px;
      background: rgba(146, 146, 146, 0.9);
      padding:8px 10px;
      border-radius:6px;
      font-size:11px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.25);
      min-width: 140px;
    }
    .altitude-legend-item {
      display: flex;
      align-items: center;
      margin: 2px 0;
    }
    .altitude-color-box {
      width: 12px;
      height: 12px;
      margin-right: 6px;
      border-radius: 2px;
    }
    .waypoint-tooltip {
      font-size: 11px !important;
      padding: 3px 6px !important;
      background: rgba(0, 0, 0, 0.85) !important;
      border: 1px solid #ff6600 !important;
      border-radius: 4px !important;
      box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
      font-weight: bold;
      color: #fff !important;
    }
    .waypoint-tooltip::before {
      border-top-color: rgba(0, 0, 0, 0.85) !important;
    }
    .waypoint-marker {
      background: rgba(255, 102, 0, 0.9);
      border: 3px solid #fff;
      border-radius: 50%;
      box-shadow: 0 2px 8px rgba(0,0,0,0.4);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: bold;
      color: #fff;
      font-size: 10px;
      text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    }
    .waypoint-passed {
      background: rgba(100, 100, 100, 0.7) !important;
      border-color: #666 !important;
    }
    .waypoint-active {
      background: rgba(0, 255, 0, 0.9) !important;
      border-color: #0f0 !important;
      animation: pulse-active 1.5s ease-in-out infinite;
    }
    @keyframes pulse-active {
      0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(0,255,0,0.4); }
      50% { transform: scale(1.2); box-shadow: 0 2px 15px rgba(0,255,0,0.8); }
    }
    .route-arrow {
      font-size: 16px;
      color: #ff6600;
      text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    }
    /* METAR Toggle Button */
#metarToggle {
  position: fixed;
  left: 0;
  top: 80%;
  transform: translateY(-50%);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--glass-border);
  border-left: none;
  padding: 20px 10px;
  cursor: pointer;
  z-index: 99998;
  border-radius: 0 10px 10px 0;
  font-size: 18px;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.35);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transition: all 0.2s ease;
}

#metarToggle:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  box-shadow: 4px 0 26px rgba(0, 0, 0, 0.4);
}

/* METAR Widget 側邊欄樣式 */
.metar-widget {
  position: fixed;
  left: -280px;
  top: 80%;
  transform: translateY(-50%);
  width: 260px;
  background: rgba(0, 0, 0, 0.9);
  box-shadow: 2px 0 10px rgba(0,0,0,0.5);
  transition: left 0.3s ease;
  z-index: 99997;
  padding: 10px;
  border-radius: 0 8px 8px 0;
  color: white;
  font: 12px monospace;
  max-height: 90vh;
  overflow-y: auto;
}

.metar-widget.open {
  left: 60px;
}
/* Flight Progress Bar Styles */
.flight-progress-container {
  margin: 20px 0;
  padding: 15px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  position: relative;
  overflow: visible;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00bcd4, #00e676);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(0, 188, 212, 0.5);
  transition: width 0.5s ease;
}

.progress-plane-icon {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #0066cc;
  font-size: 14px;
  filter: drop-shadow(0 0 3px #fff);
  transition: left 0.5s ease;
}

/* Smooth Panel Animations */
#aircraftPanel {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Enhanced Flight Status */
.flight-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-climbing {
  background: rgba(76, 175, 80, 0.15);
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.status-cruising {
  background: rgba(33, 150, 243, 0.15);
  color: #2196F3;
  border: 1px solid rgba(33, 150, 243, 0.3);
}

.status-descending {
  background: rgba(255, 167, 38, 0.15);
  color: #FFA726;
  border: 1px solid rgba(255, 167, 38, 0.3);
}

.status-ground {
  background: rgba(158, 158, 158, 0.15);
  color: #9E9E9E;
  border: 1px solid rgba(158, 158, 158, 0.3);
}
/* ========== 選單系統樣式 ========== */
/* 開關按鈕樣式 */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #444;
  transition: .3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #667eea;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* 選單連結 hover 效果 */
@media (hover: hover) {
  #sideMenu a:hover {
    background: rgba(255,255,255,0.1) !important;
  }
}

/* 漢堡選單按鈕 */
#menuToggle {
  transition: all 0.2s ease !important;
  touch-action: manipulation;
  border-radius: 8px;
}

@media (hover: hover) {
  #menuToggle:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    transform: scale(1.05);
  }
}

/* ＋ － tileBtn wxBtn — 深色霧面玻璃 */
.map-control-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  color: rgba(255, 255, 255, 0.92);
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

@media (hover: hover) {
  .map-control-btn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    box-shadow: 0 6px 26px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
  }
}
/* ===== ATC Mode Radar Blip ===== */
.atc-radar-blip {
  display: inline-block;
}

/* ATC target label (綠色雷達標籤) */
.leaflet-tooltip.atc-target-label {
  background: rgba(0, 18, 10, 0.92) !important;
  color: #67f3a3 !important;
  border: 1px solid rgba(44, 235, 138, 0.72) !important;
  border-radius: 4px !important;
  padding: 4px 7px !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
  font-family: monospace !important;
  box-shadow: 0 0 12px rgba(44, 235, 138, 0.22) !important;
}
.leaflet-tooltip.atc-target-label::before { display: none !important; }

/* ATC 模式按鈕 — 深色霧面玻璃 */
.atc-mode-btn {
  width: 44px; height: 44px; border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  color: rgba(255, 255, 255, 0.92);
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

@media (hover: hover) {
  .atc-mode-btn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    box-shadow: 0 6px 26px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
  }
}

.atc-mode-btn.active {
  background: rgba(15, 50, 35, 0.35);
  border-color: rgba(53, 245, 155, 0.3);
  color: #35f59b;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(53, 245, 155, 0.18),
    0 1px 0 rgba(53, 245, 155, 0.1) inset;
}

#flightListPanel {
  position: fixed;
  top: 130px;
  left: 76px;
  width: 270px;
  max-height: calc(100vh - 90px);
  background: rgba(13, 20, 32, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  z-index: 8000;
  display: flex; flex-direction: column;
  font-family: "Inter","Segoe UI",sans-serif;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.07);
  transform: translateY(0) scale(1);
  opacity: 1;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), opacity 0.2s ease;
  overflow: hidden;
}
#flightListPanel.collapsed {
  transform: translateY(-12px) scale(0.97);
  opacity: 0;
  pointer-events: none;
}

/* Header */
#flpHeader {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 0; flex-shrink: 0;
}
.flp-brand { font-size: 14px; font-weight: 700; color: #e8edf2; letter-spacing: -0.2px; }
.flp-brand em { color: #ffd500; font-style: normal; }
.flp-collapse { background: none; border: none; color: #5a6a7a; font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: 4px; line-height: 1; }
.flp-collapse:hover { color: #e8edf2; background: rgba(255,255,255,0.08); }

/* Open button — sits next to search box */
#flightListOpenBtn {
  position: fixed; top: 128px; left: 72px; z-index: 9001;
  background: rgba(13,20,32,0.88);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; color: #ffd500; font-size: 16px;
  width: 46px; height: 46px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
#flightListOpenBtn.visible { display: flex; }

/* Tabs */
#flpTabs {
  display: flex; margin: 8px 0 0; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 0 4px;
}
.fl-tab {
  flex: 1; background: none; border: none;
  border-bottom: 2px solid transparent;
  color: #4e6070; font-size: 11px; font-weight: 700;
  letter-spacing: 0.8px; padding: 7px 0;
  cursor: pointer; text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s;
}
.fl-tab:hover { color: #a0b4c4; }
.fl-tab.active { color: #e8edf2; border-bottom-color: #ffd500; }

/* Live badge */
.fl-live-badge {
  display: inline-block; background: #ffd500; color: #000;
  font-size: 9px; font-weight: 800; letter-spacing: 0.5px;
  padding: 1px 5px; border-radius: 4px;
  margin-left: 5px; vertical-align: middle;
  line-height: 14px;
}

/* List body */
#flpBody { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
#flpBody::-webkit-scrollbar { width: 3px; }
#flpBody::-webkit-scrollbar-track { background: transparent; }
#flpBody::-webkit-scrollbar-thumb { background: #ffd500; border-radius: 2px; }
#flpBody::-webkit-scrollbar { width: 3px; }
.fl-row3 { font-size: 11px; color: #4e6070; margin-top: 3px; }

/* Flight item */
.fl-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer; transition: background 0.12s;
  border-left: 3px solid transparent;
}
.fl-item:hover { background: rgba(255,255,255,0.04); border-left-color: rgba(255,213,0,0.3); }
.fl-item.selected { background: rgba(255,213,0,0.07); border-left-color: #ffd500; }

/* Logo box */
.fl-logo {
  width: 38px; height: 38px; border-radius: 8px;
  background: #1c2a38; border: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.fl-logo img { width: 30px; height: 30px; object-fit: contain; }
.fl-logo-fb { font-size: 18px; line-height: 1; }
.fl-logo-svg { display: flex; align-items: center; justify-content: center; }
.fl-item .fl-logo:has(.fl-logo-svg) { background: transparent; border-color: transparent; }

/* Info block */
.fl-info { flex: 1; min-width: 0; }

.fl-row1 { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; flex-wrap: wrap; }
.fl-callsign { font-size: 14px; font-weight: 700; color: #e8edf2; }
.fl-badge {
  font-size: 10px; font-weight: 600; color: #8a9db0;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1);
  padding: 1px 5px; border-radius: 4px; white-space: nowrap;
}
.fl-badge.type { color: #7ec8e3; border-color: rgba(126,200,227,0.25); background: rgba(126,200,227,0.08); }
.fl-diverted { font-size: 9px; font-weight: 800; color: #f59e0b; background: rgba(245,158,11,0.15); padding: 1px 5px; border-radius: 3px; }

.fl-row2 { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #5a7080; }
.fl-airport { color: #8a9db0; }
.fl-iata {
  font-size: 9px; font-weight: 700; color: #5a7080;
  background: rgba(255,255,255,0.06);
  padding: 1px 4px; border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.08);
}
.fl-arrow { color: #3a4a5a; font-size: 10px; }

/* Speed badge */
.fl-spd {
  font-size: 12px; font-weight: 700; color: #e8edf2;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; flex-shrink: 0;
  min-width: 56px; text-align: center;
}
.fl-spd.ground { color: #3a5060; border-color: rgba(255,255,255,0.04); }

/* Empty */
.fl-empty { text-align: center; padding: 48px 20px; color: #2e4050; font-size: 13px; }
.fl-empty-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.4; }
.wx-row, .tile-row {
  display:block;width:100%;background:transparent;border:none;color:#ddd;
  font-size:13px;padding:8px 10px;border-radius:8px;cursor:pointer;text-align:left;
  transition:background 0.15s;
}
.wx-row:hover, .tile-row:hover { background:rgba(255,255,255,0.1); }
.wx-row.on { color:#00cfff;background:rgba(0,207,255,0.12); }
.active-tile { color:#4287f5;background:rgba(66,135,245,0.2); }

.settings-section {
  padding: 8px 10px 4px;
}

.settings-category {
  margin: 6px 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}

.settings-category-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.settings-category-toggle:hover {
  background: rgba(255,255,255,0.04);
}

.settings-category-chevron {
  width: 14px;
  height: 14px;
  color: #7dd3fc;
  transition: transform 0.18s ease;
}

.settings-category.open .settings-category-chevron {
  transform: rotate(180deg);
}

.settings-category-body {
  padding-bottom: 8px;
}

.settings-category-body .settings-divider {
  border-top: 0;
  margin-top: 0;
  padding-top: 8px;
}

.settings-divider {
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: 8px;
  padding-top: 12px;
}

.settings-unit-group {
  display: grid;
  gap: 12px;
}

.settings-unit-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 12px;
}

.settings-unit-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #00cfff;
}

.settings-segmented {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.settings-segmented-btn {
  min-width: 62px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: transparent;
  color: rgba(255,255,255,0.62);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.18s ease;
}

#speedUnitGroup .settings-segmented-btn {
  min-width: 0;
  padding: 10px 10px;
}

#speedUnitGroup {
  width: fit-content;
}

.settings-segmented-btn:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.08);
}

.settings-segmented-btn.active {
  color: #04121a;
  background: linear-gradient(180deg, #23d8ff, #0fb8df);
  box-shadow:
    0 8px 20px rgba(0,207,255,0.24),
    inset 0 1px 0 rgba(255,255,255,0.45);
}

.settings-reset-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.settings-reset-btn:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.26);
}

/* ── Responsive: mobile bottom sheet tweaks ── */
@media (max-width: 639px) {
  /* Bottom sheet drag handle */
  #aircraftPanel::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    background: rgba(0,0,0,0.18);
    border-radius: 2px;
    margin: 10px auto 2px;
  }
  /* Photo hero: cap height on mobile so it doesn't eat the screen */
  .panel-photo-hero {
    aspect-ratio: unset !important;
    height: 160px !important;
    max-height: 160px !important;
  }
  /* Flight list panel: full width, bottom sheet */
  #flightListPanel {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-height: 45vh !important;
    border-radius: 0 !important;
    display: none !important;
  }
  #flightListPanel.mobile-visible {
    display: flex !important;
  }
  /* Settings panel: expand leftward so it doesn't go offscreen */
  #settingsPanel {
    right: 0 !important;
    left: auto !important;
    min-width: 92vw !important;
    max-width: 340px !important;
  }
  /* UTC time box: hide on mobile */
  #utcTime {
    display: none !important;
  }
  /* METAR: stack vertically on mobile instead of left sidebar */
  #metarToggle {
    top: auto !important;
    bottom: 80px !important;
    left: 0 !important;
    transform: none !important;
    writing-mode: horizontal-tb !important;
    padding: 10px 14px !important;
    border-radius: 0 10px 10px 0 !important;
  }
  .metar-widget {
    top: auto !important;
    bottom: 130px !important;
    left: -280px !important;
    transform: none !important;
  }
  .metar-widget.open {
    left: 0 !important;
  }
  /* Search box: full width */
  #searchBox {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
  }
  /* Aircraft panel slide-in from bottom instead of right */
  #aircraftPanel {
    animation: slideUp 0.32s cubic-bezier(.4,0,.2,1) !important;
  }
  @keyframes slideUp {
    from { transform: translateY(100%); opacity: 0.5; }
    to   { transform: translateY(0);    opacity: 1;   }
  }
}
 /* ── What's New Button — 深色霧面玻璃 ── */
  #whatsNewBtn {
    position: relative; /* for badge positioning */
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    color: rgba(255, 255, 255, 0.92);
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    overflow: visible; /* allow badge to overflow */
  }
  #whatsNewBtn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    box-shadow: 0 6px 26px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
  }
  #whatsNewBtn.active {
    background: rgba(0, 40, 55, 0.38);
    border-color: rgba(0, 207, 255, 0.45);
    color: #00cfff;
    box-shadow:
      0 4px 24px rgba(0, 0, 0, 0.28),
      0 0 16px rgba(0, 207, 255, 0.18),
      0 1px 0 rgba(0, 207, 255, 0.12) inset;
  }
  #whatsNewBtn i {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
    pointer-events: none;
  }

  /* Unread badge */
  #whatsNewBadge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    background: #ffd500;
    color: #000;
    font-size: 10px;
    font-weight: 800;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
    display: none;
    border: 1.5px solid rgba(255,255,255,0.55);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    line-height: 1;
  }

  /* ── What's New Panel — matches existing wx/tile/settings panels ── */
  #whatsNewPanel {
    position: fixed;
    top: 128px;
    right: 20px;
    z-index: 10000;
    width: 330px;
    max-height: 500px;
    background: rgba(10, 15, 25, 0.55);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: wnSlideIn 0.2s cubic-bezier(.4,0,.2,1);
  }
  @keyframes wnSlideIn {
    from { opacity:0; transform: translateY(-8px) scale(0.98); }
    to   { opacity:1; transform: translateY(0)    scale(1);    }
  }

  /* Panel header — matches wx/tile section headers */
  #whatsNewPanel .wn-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 14px 10px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
  }
  #whatsNewPanel .wn-title {
    font-weight: 700;
    color: #aaa;
  }
  #whatsNewPanel .wn-count-badge {
    font-size: 11px;
    color: #888;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 2px 9px;
    font-weight: 600;
  }

  /* Scrollable items */
  #whatsNewList {
    overflow-y: auto;
    flex: 1;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
  }
  #whatsNewList::-webkit-scrollbar { width: 4px; }
  #whatsNewList::-webkit-scrollbar-track { background: transparent; }
  #whatsNewList::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

  /* Individual item */
  .wn-item {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative;
  }
  .wn-item:last-child { border-bottom: none; }
  .wn-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: rgba(255,255,255,0.12);
  }

  .wn-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 5px;
  }
  .wn-tag {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 5px;
    text-transform: uppercase;
  }
  .wn-tag.new     { background: rgba(0,207,255,0.15); color: #00cfff; border: 1px solid rgba(0,207,255,0.3); }
  .wn-tag.improve { background: rgba(0,255,133,0.12); color: #00ff85; border: 1px solid rgba(0,255,133,0.25); }
  .wn-tag.fix     { background: rgba(255,213,0,0.12);  color: #ffd500; border: 1px solid rgba(255,213,0,0.25); }

  /* Accent left bar matches tag colour */
  .wn-item:has(.wn-tag.new)::before     { background: rgba(0,207,255,0.45); }
  .wn-item:has(.wn-tag.improve)::before { background: rgba(0,255,133,0.4); }
  .wn-item:has(.wn-tag.fix)::before     { background: rgba(255,213,0,0.4); }

  .wn-date {
    font-size: 11px;
    color: rgba(180,210,230,0.4);
  }
  .wn-item-title {
    font-size: 13px;
    font-weight: 700;
    color: #dde8f0;
    margin-bottom: 4px;
    line-height: 1.3;
  }
  .wn-item-desc {
    font-size: 12px;
    color: rgba(180,210,230,0.55);
    line-height: 1.55;
  }
  *, *::before, *::after {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif !important;
}

/* ═══════════════════════════════════════
   Site Header — Brand bar (logo + title)
   Reuses the same dark glass language as
   #flightListPanel / #whatsNewPanel.
═══════════════════════════════════════ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  z-index: 9500;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: rgba(13, 20, 32, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Logo box — same pattern as .fl-logo / airline logo box:
   white rounded tile so any icon colour reads cleanly. */
.site-header-logo {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}
.site-header-logo img {
  width: 26px; height: 26px;
  object-fit: contain;
}

.site-header-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.site-header-title {
  font-size: 15px;
  font-weight: 700;
  color: #e8edf2;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.site-header-subtitle {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5a7080;
  white-space: nowrap;
}

@media (max-width: 639px) {
  .site-header { height: 52px; padding: 0 12px; gap: 10px; }
  .site-header-logo { width: 32px; height: 32px; }
  .site-header-subtitle { display: none; }
}

/* ═══════════════════════════════════════
   Nav Rail — #customMapBar repurposed
   Desktop: vertical dock, left side, below header.
   Mobile: reverts to its original horizontal
   bottom-right cluster (unchanged behaviour).
═══════════════════════════════════════ */
#customMapBar {
  position: fixed;
  top: 76px;
  left: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 10000;
}

@media (max-width: 639px) {
  #customMapBar {
    top: auto;
    left: auto;
    bottom: 20px;
    right: 20px;
    flex-direction: row;
    align-items: flex-end;
  }
}

/* Dropdowns (wx / tile / settings) anchor relative to their own button.
   Desktop rail: open to the right. Mobile cluster: open upward
   (matches the panel's original behaviour before the rail existed). */
.rail-dropdown {
  position: absolute;
  bottom: 54px;
  right: 0;
}
@media (min-width: 640px) {
  .rail-dropdown {
    bottom: auto;
    top: 0;
    left: 54px;
    right: auto;
  }
}

/* #utcTime shifts left to clear the docked aircraft panel — driven by a
   single state class instead of inline styles set from several places. */
#utcTime {
  transition: right 0.3s cubic-bezier(.4,0,.2,1);
}
@media (min-width: 640px) {
  body.aircraft-panel-open #utcTime {
    right: 396px;
  }
}