/* SKYBUDDY // 3D Flight Tracker — Terminal Dev Style */

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

:root {
  --bg: #0c0c0c;
  --panel: rgba(12, 12, 12, 0.95);
  --border: rgba(0, 255, 136, 0.12);
  --accent: #00ff88;
  --accent-dim: rgba(0, 255, 136, 0.3);
  --warn: #ff4444;
  --info: #00b4d8;
  --gold: #00ff88;
  --text: #b0b0b0;
  --text-dim: #555;
  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ─── Cesium Container ─── */
#cesiumContainer {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
  touch-action: none; /* prevent browser gestures over 3D globe */
}

.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-bottom,
.cesium-viewer-fullscreenContainer,
.cesium-viewer-geocoderContainer,
.cesium-viewer-infoBoxContainer,
.cesium-credit-logoContainer,
.cesium-credit-expand-link,
.cesium-widget-credits { display: none !important; }
.cesium-viewer .cesium-widget-credits { display: none !important; }

/* ─── HUD Overlay ─── */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 100;
}
#hud > * { pointer-events: auto; }

/* ─── Top Bar — terminal header ─── */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 200;
  font-size: 13px;
}

.logo {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.logo::before {
  content: '>';
  color: var(--accent);
  font-weight: 400;
  animation: blink 1.2s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.logo .sep { color: var(--text-dim); font-weight: 300; }
.logo .sub { color: var(--text-dim); font-weight: 500; font-size: 13px; letter-spacing: 1.1px; }

.top-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}
.top-center .ctrl-btn,
.top-center .user-btn {
  padding: 4px 14px;
  font-size: 10px;
  letter-spacing: 1.2px;
  height: 28px;
  box-sizing: border-box;
}

.top-center {
  position: absolute;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}
.top-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}
.status-cluster {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10px;
}

.settings-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  transition: color 0.2s, border-color 0.2s;
}
.settings-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.compass-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 700;
  cursor: pointer;
  padding: 4px 14px;
  height: 28px;
  box-sizing: border-box;
  line-height: 1;
  transition: color 0.2s, border-color 0.2s;
}
/* Mobile-compass hidden on desktop */
.mobile-compass { display: none; }
/* Mobile clock hidden on desktop */
.mobile-clock { display: none; }
.compass-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.stat { display: flex; align-items: center; gap: 4px; }
.stat-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 8px;
}
.stat-label::after { content: ':'; }
.stat-value { color: var(--accent); font-weight: 600; font-size: 11px; }

.pulse-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--accent); }
  50% { opacity: 0.3; box-shadow: 0 0 8px var(--accent); }
}

/* ─── Setup Panel ─── */
.setup-panel {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 32px;
  width: 440px;
  z-index: 200;
}
.setup-panel h2 {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 3px;
  font-family: var(--mono);
}
.setup-panel h2::before { content: '$ '; color: var(--text-dim); font-weight: 400; }
.setup-panel p {
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.8;
  margin-bottom: 20px;
}
.setup-panel p a { color: var(--accent); text-decoration: none; }
.setup-panel p a:hover { text-decoration: underline; }

.input-group { margin-bottom: 12px; }
.input-group label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.input-group label::before { content: '# '; color: var(--accent); opacity: 0.4; }
.input-group input {
  width: 100%;
  padding: 8px 10px;
  background: rgba(0, 255, 136, 0.03);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}
.input-group input:focus { border-color: var(--accent); }
.input-group input::placeholder { color: var(--text-dim); }

.btn-launch {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s;
}
.btn-launch:hover {
  background: var(--accent);
  color: var(--bg);
}

.setup-note {
  margin-top: 14px;
  padding: 8px 10px;
  border-left: 2px solid var(--accent);
  font-size: 9px;
  color: var(--text-dim);
  line-height: 1.6;
  background: rgba(0, 255, 136, 0.02);
}

.setup-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

/* ─── Side Panel (Aircraft List) ─── */
.side-panel {
  position: absolute;
  top: 46px;
  right: 0;
  bottom: 0;
  width: 300px;
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease;
}
.side-panel.hidden { transform: translateX(320px); }

.panel-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 255, 136, 0.02);
}
.panel-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.panel-title::before { content: '// '; color: var(--accent); opacity: 0.4; }

.panel-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--mono);
}
.panel-close-btn:hover { color: var(--warn); }

.search-box {
  padding: 6px 10px;
  margin: 6px 8px;
  width: calc(100% - 16px);
  background: rgba(0, 255, 136, 0.03);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  outline: none;
}
.search-box:focus { border-color: var(--accent); }

.airline-filters {
  display: flex;
  gap: 4px;
  padding: 2px 8px 6px;
}
/* ─── Fleet Airline Cards ─── */
.fleet-airlines {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}
.fleet-airlines::-webkit-scrollbar { width: 3px; }
.fleet-airlines::-webkit-scrollbar-track { background: transparent; }
.fleet-airlines::-webkit-scrollbar-thumb { background: var(--border); }

.fleet-airline-card {
  margin-bottom: 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.fleet-airline-card.active { border-color: var(--accent); }
.fleet-airline-card.inactive { opacity: 0.5; }
.fleet-airline-card.inactive:hover { opacity: 0.8; }

.fleet-airline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.fleet-airline-header:hover { background: rgba(0, 255, 136, 0.04); }

.fleet-airline-toggle {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--dim);
  transition: all 0.2s;
  flex-shrink: 0;
}
.fleet-airline-toggle.on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.fleet-airline-name {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.fleet-airline-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
  min-width: 20px;
  text-align: right;
}
.fleet-expand-btn {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 10px;
  cursor: pointer;
  padding: 0 2px;
  font-family: var(--mono);
}

.fleet-flight-list {
  border-top: 1px solid var(--border);
  max-height: 300px;
  overflow-y: auto;
}
.fleet-flight-list::-webkit-scrollbar { width: 3px; }
.fleet-flight-list::-webkit-scrollbar-thumb { background: var(--border); }

.fleet-flight-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.1s;
  border-left: 2px solid transparent;
  font-size: 10px;
}
.fleet-flight-item:hover { background: rgba(0, 255, 136, 0.04); border-left-color: var(--accent); }
.fleet-flight-item.selected { background: rgba(0, 255, 136, 0.08); border-left-color: var(--accent); }

.fleet-flight-cs { font-weight: 600; color: var(--accent); font-size: 10px; min-width: 60px; display: inline-flex; align-items: center; gap: 4px; }
.fleet-tracker-link { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border: 1px solid var(--border); border-radius: 3px; }
.fleet-tracker-link img { width: 10px; height: 10px; }
.fleet-flight-route { color: var(--dim); font-size: 9px; flex: 1; }
.fleet-flight-alt { color: var(--info); font-size: 10px; text-align: right; }

.fleet-no-flights { padding: 10px; text-align: center; color: var(--dim); font-size: 9px; }

/* ─── Detail Panel ─── */
.detail-panel {
  position: fixed;
  top: 48px;
  left: 0;
  width: 320px;
  bottom: 190px;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 10px;
  display: none;
  z-index: 1100;
  box-sizing: border-box;
}
.detail-panel.visible { display: block; }
.detail-panel::-webkit-scrollbar { width: 3px; }
.detail-panel::-webkit-scrollbar-track { background: transparent; }
.detail-panel::-webkit-scrollbar-thumb { background: var(--border); }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -10px -10px 8px -10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  cursor: default;
}
.detail-panel-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.detail-header-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.detail-close {
  background: none; border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}
.detail-close:hover { color: var(--warn); }
.detail-minimize {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
}
.detail-minimize:hover { color: var(--accent); }
.detail-minimize-mobile { display: none; }

.detail-callsign {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1px;
  letter-spacing: 2px;
}
.detail-country {
  font-size: 8px;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Tags: reg, type, icao as inline badges */
.detail-tags {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.det-tag {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
  font-family: var(--mono);
}
.det-fa-link {
  text-decoration: none;
  color: #1a8fff;
  cursor: pointer;
  transition: border-color 0.2s;
}
.det-fa-link:hover {
  border-color: #1a8fff;
  background: rgba(26, 143, 255, 0.1);
}

/* Status badge */
.detail-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 6px;
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent);
  border: 1px solid rgba(0, 255, 136, 0.3);
}
.detail-status.on-ground {
  background: rgba(255, 159, 28, 0.15);
  color: var(--gold);
  border-color: rgba(255, 159, 28, 0.3);
}

/* Route Card */
.detail-route-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 6px;
}
.route-section { margin-bottom: 4px; }
.route-section:last-of-type { margin-bottom: 0; margin-top: 4px; }
.route-label {
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.route-code {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
}
.route-code.accent { color: var(--accent); }
.route-name {
  font-size: 9px;
  color: var(--text-dim);
}

/* Progress bar */
.route-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.route-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.route-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
  width: 0%;
}
.route-progress-icon {
  color: var(--accent);
  font-size: 8px;
}
.route-progress-pct {
  font-size: 9px;
  color: var(--text-dim);
  min-width: 32px;
  text-align: right;
}

/* Flight data grid */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 6px;
}
.detail-field {
  border-left: 2px solid var(--border);
  padding-left: 6px;
}
.detail-field label {
  display: block;
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 0;
}
.detail-field .val { font-size: 13px; font-weight: 600; color: var(--text); }
.detail-field .val.accent { color: var(--accent); }
.detail-field .unit { font-size: 8px; color: var(--text-dim); margin-left: 2px; }
.detail-wide { grid-column: 1 / -1; }

/* Times: ETA + Distance side by side */
.detail-times {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.time-box {
  flex: 1;
  background: rgba(0, 255, 136, 0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  text-align: center;
}
.time-label {
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 1px;
}
.time-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.time-value.accent { color: var(--accent); }

/* Owner section */
.detail-owner {
  margin-bottom: 4px;
}
.detail-owner .detail-field {
  margin-bottom: 2px;
}

/* Action buttons */
.btn-track {
  width: 100%;
  padding: 6px;
  margin-top: 6px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-track:hover { background: rgba(0, 255, 136, 0.1); }
.btn-track.tracking { background: var(--accent); color: var(--bg); }

.detail-actions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  padding: 6px 0;
  position: sticky;
  bottom: 0;
  background: var(--panel);
  z-index: 1;
}
.detail-actions .btn-track {
  flex: 1;
  margin-top: 0;
}

/* ─── Bottom Controls ─── */
.bottom-bar {
  display: none;
}
.ctrl-btn {
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}
.ctrl-btn:hover { border-color: var(--accent); color: var(--accent); }
.ctrl-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(0, 255, 136, 0.05); }
.btn-icon { display: none; }
.btn-label { display: inline; }

/* ─── More Dropdown ─── */
.more-dropdown {
  position: relative;
  display: inline-block;
}
.more-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  min-width: 140px;
  z-index: 200;
}
.more-menu.visible { display: block; }
.more-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  text-align: left;
}
.more-menu-item:last-child { border-bottom: none; }
.more-menu-item:hover { background: rgba(0, 255, 136, 0.05); color: var(--accent); }
.more-status {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 2px;
  background: rgba(0, 255, 136, 0.1);
  color: var(--accent);
}
.more-menu-item .more-status.off {
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
}

/* ─── Altitude Legend ─── */
.alt-legend { display: none; }
.alt-legend-title { display: none; }
.alt-row { display: none; }
.alt-dot { display: none; }

/* ─── Loading Overlay ─── */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 500;
  transition: opacity 0.5s;
}
.loading-overlay.fade-out { opacity: 0; pointer-events: none; }

.loading-spinner {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.loading-text::before { content: '[ '; color: var(--accent); }
.loading-text::after { content: ' ]'; color: var(--accent); }

/* ─── Toggle Button ─── */
/* toggle-panel-btn removed */

/* ─── Notifications ─── */
.notification {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 1px;
  z-index: 100;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.notification.hide {
  transform: translateX(-50%) translateY(20px);
}
.notification.error { border-left-color: var(--warn); color: var(--warn); }

/* ─── Settings Panel ─── */
.settings-panel {
  position: absolute;
  top: 46px;
  right: 8px;
  width: 320px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0;
  display: none;
  z-index: 70;
  overflow: hidden;
}
.settings-panel .panel-header {
  cursor: grab;
  user-select: none;
}
.settings-panel .panel-header:active { cursor: grabbing;
}
.settings-panel.visible { display: block; }
.settings-panel .input-group { padding: 6px 12px; }
.settings-panel .input-group label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.settings-panel .input-group input {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  box-sizing: border-box;
}
.settings-panel .setup-note {
  font-size: 9px;
  color: var(--text-dim);
  padding: 0 12px;
}
.settings-panel .setup-footer {
  text-align: center;
  font-size: 9px;
  color: var(--text-dim);
  padding: 8px;
  opacity: 0.5;
}

/* ─── Watchlist Panel ─── */
.wl-section {
  border-top: 1px solid var(--border);
}
.wl-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
  background: rgba(0, 255, 136, 0.02);
  cursor: grab;
  user-select: none;
}
.wl-header:active { cursor: grabbing; }
.wl-title {
  font-size: 9px; text-transform: uppercase; letter-spacing: 2px;
  color: var(--text-dim); flex: 1;
}
.wl-title::before { content: '// '; color: var(--accent); opacity: 0.4; }
.wl-status {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
}
.wl-add-row {
  display: flex; gap: 4px; padding: 8px 10px 0;
}
.wl-input {
  flex: 1; padding: 6px 8px;
  background: rgba(0, 255, 136, 0.03);
  border: 1px solid var(--border);
  color: var(--accent); font-family: var(--mono); font-size: 11px; outline: none;
}
.wl-input:focus { border-color: var(--accent); }
.wl-input::placeholder { color: var(--text-dim); }
.wl-add-btn {
  padding: 6px 12px; background: transparent; color: var(--accent);
  border: 1px solid var(--accent); font-family: var(--mono);
  font-weight: 700; font-size: 14px; cursor: pointer;
}
.wl-add-btn:hover { background: var(--accent); color: var(--bg); }
.wl-hint {
  padding: 3px 10px 6px; font-size: 8px; color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.wl-items {
  max-height: 180px; overflow-y: auto; padding: 4px;
}
.wl-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 8px;
  font-size: 12px; font-weight: 600; color: var(--accent);
  letter-spacing: 1px;
  border-left: 2px solid var(--accent);
  margin-bottom: 2px;
}
.wl-item:hover { background: rgba(0, 255, 136, 0.04); }
.wl-remove {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 11px; font-family: var(--mono);
}
.wl-remove:hover { color: var(--warn); }
.wl-empty {
  padding: 10px; font-size: 9px; color: var(--text-dim); text-align: center;
}
.wl-toggle-btn {
  width: calc(100% - 8px); margin: 4px; padding: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--accent); font-family: var(--mono);
  font-weight: 600; font-size: 9px; letter-spacing: 1px; cursor: pointer;
  text-transform: uppercase;
  position: sticky; bottom: 0;
  background: var(--panel);
}
.wl-toggle-btn:hover { border-color: var(--accent); background: rgba(0, 255, 136, 0.05); }

/* ─── Schedule Panel ─── */
.schedule-panel {
  position: fixed;
  top: 48px;
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 0;
  display: none;
  z-index: 60;
  overflow-y: auto;
}
.schedule-panel.visible { display: flex; flex-direction: column; }
.sched-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
  background: rgba(218, 165, 32, 0.04);
  cursor: grab;
  user-select: none;
}
.sched-header:active { cursor: grabbing; }
.sched-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 2px;
  color: var(--text-dim); flex: 1;
}
.sched-title::before { content: '// '; color: var(--accent); opacity: 0.4; }
.sched-add-row {
  display: flex; gap: 4px; padding: 6px 10px 0;
  align-items: center;
}
.sched-input {
  flex: 1; padding: 5px 6px;
  background: rgba(218, 165, 32, 0.04);
  border: 1px solid var(--border);
  color: var(--gold); font-family: var(--mono); font-size: 10px; outline: none;
}
.sched-input:focus { border-color: var(--gold); }
.sched-input::placeholder { color: var(--text-dim); }
.sched-input-sm { max-width: 50px; text-transform: uppercase; }
.sched-input-dt { font-size: 9px; color: var(--text); }
.sched-onboard-label {
  font-size: 8px; color: var(--text-dim); white-space: nowrap;
  display: flex; align-items: center; gap: 3px;
}
.sched-onboard-label input[type="checkbox"] { accent-color: var(--gold); }
.sched-items {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 4px;
}
.sched-items::-webkit-scrollbar { width: 3px; }
.sched-items::-webkit-scrollbar-track { background: transparent; }
.sched-items::-webkit-scrollbar-thumb { background: var(--border); }
.sched-item {
  padding: 8px 90px 8px 8px;
  border-left: 3px solid var(--border);
  margin-bottom: 4px;
  background: rgba(255,255,255,0.01);
  position: relative;
}
.sched-item.active {
  border-left-color: var(--accent);
  background: rgba(0, 255, 136, 0.04);
}
.sched-item.onboard.route-shown {
  border-left-color: var(--gold);
}
.sched-item.onboard.route-shown.overlap {
  border-left-color: var(--accent);
}
.sched-item.onboard.active.route-shown {
  border-left-color: var(--gold);
}
.sched-item.onboard.active.route-shown.overlap {
  border-left-color: var(--accent);
}
.sched-flight {
  font-size: 9px; font-weight: 500; color: var(--text-dim); letter-spacing: 1.5px; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.sched-tracker-link {
  display: inline-flex; align-items: center; gap: 3px;
  border: 1px solid rgba(255,255,255,0.12); border-radius: 4px;
  padding: 0 4px; height: 16px;
  font-size: 8px; color: var(--text-dim);
  text-decoration: none; opacity: 0.75;
}
.sched-tracker-link img { width: 9px; height: 9px; }
.sched-tracker-link span { letter-spacing: 0.3px; }
.sched-tracker-link:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }
.sched-item.active .sched-flight { color: var(--accent); }
.sched-item.route-shown { border-left-color: var(--gold); }
.sched-item.route-shown.overlap { border-left-color: var(--accent); }
.sched-item.overlap .sched-flight::after { content: ' ★'; color: var(--accent); font-size: 10px; }
.sched-item.onboard.route-shown .sched-flight { color: var(--gold); }
.sched-item.onboard.route-shown.overlap .sched-flight { color: var(--accent); }
.sched-route {
  font-size: 16px; font-weight: 700; color: var(--text); margin-top: 2px; letter-spacing: 2px;
}
.sched-route .sched-arrow { color: var(--accent); margin: 0 6px; }
.sched-route-names {
  font-size: 15px; font-weight: 700; color: #e0e8f0; margin-top: 2px; letter-spacing: 0.5px;
}
.sched-route-names .sched-arrow { color: var(--accent); margin: 0 4px; font-size: 10px; }
.sched-time {
  font-size: 11px; color: #e0e8f0; margin-top: 5px; font-weight: 600; letter-spacing: 0.5px;
}
.sched-status {
  position: absolute; top: 8px; right: 8px;
  font-size: 8px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
}
.sched-status.scheduled { color: var(--text-dim); }
.sched-status.enroute { color: var(--accent); }
.sched-status.onboard-live { color: var(--gold); }
.sched-countdown {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--accent); letter-spacing: 1px; margin-top: 4px;
}
.sched-remove {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  background: rgba(255, 50, 50, 0.08); border: 1px solid rgba(255, 50, 50, 0.3); color: var(--warn);
  cursor: pointer; font-size: 16px; font-family: var(--mono);
  padding: 6px 10px; border-radius: 4px; font-weight: 700;
}
.sched-remove:hover { background: rgba(255, 50, 50, 0.2); border-color: var(--warn); }
.sched-empty {
  padding: 14px; font-size: 9px; color: var(--text-dim); text-align: center;
}
.sched-import-row {
  padding: 4px 10px 6px; display: flex; gap: 6px;
}
.sched-import-btn {
  flex: 1; font-size: 12px !important; padding: 10px 12px !important;
  letter-spacing: 0.5px;
}
.sched-actions {
  display: flex; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--border);
}
.sched-action-btn {
  flex: 1; padding: 10px 12px; font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  font-family: var(--mono); cursor: pointer; transition: all 0.2s;
}
.sched-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.sched-clear-btn:hover { border-color: var(--warn); color: var(--warn); }
.sched-import-status {
  padding: 4px 10px; font-size: 8px; color: var(--accent);
  text-align: center; font-family: var(--mono);
}
.sched-manual-form {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.sched-input {
  width: 100%; padding: 8px 10px; font-size: 12px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  font-family: var(--mono); text-transform: uppercase; box-sizing: border-box;
}
.sched-input:focus { border-color: var(--accent); outline: none; }
.msg-input { text-transform: none !important; letter-spacing: normal !important; }
.sched-input-half { width: 48%; }
.sched-form-row { display: flex; gap: 6px; align-items: center; }
.sched-onboard-label { font-size: 11px; color: var(--text-dim); font-family: var(--mono); white-space: nowrap; }
.sched-add-manual-btn { margin-left: 6px; }
.sched-edit-btn {
  position: absolute; top: 50%; right: 48px; transform: translateY(-50%);
  background: rgba(0, 255, 136, 0.05); border: 1px solid var(--border); color: var(--text-dim);
  cursor: pointer; font-size: 16px; font-family: var(--mono);
  padding: 6px 10px; border-radius: 4px; font-weight: 700;
}
.sched-edit-btn:hover { color: var(--accent); border-color: var(--accent); }
.sched-avatar { margin-right: 6px; vertical-align: middle; }
.sched-avatar-img {
  width: 22px; height: 22px; border-radius: 50%; vertical-align: middle;
  border: 1px solid var(--gold); object-fit: cover;
}
.sched-locate {
  background: none; border: 1px solid var(--accent); color: var(--accent);
  font-family: var(--mono); font-size: 11px; padding: 4px 10px;
  cursor: pointer; margin-left: 6px; letter-spacing: 0.5px;
}
.sched-locate:hover { background: rgba(0,255,136,0.1); }

/* ─── Flight Banner (ETA Tab) ─── */
.flight-banner {
  position: fixed;
  left: 0;
  bottom: 190px;
  width: 320px;
  max-height: calc(100vh - 238px);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0;
  z-index: 50;
  box-sizing: border-box;
  flex-direction: column;
  overflow-y: auto;
  display: none;
}
.flight-banner.visible { display: flex; }
.flight-banner::-webkit-scrollbar { width: 3px; }
.flight-banner::-webkit-scrollbar-track { background: transparent; }
.flight-banner::-webkit-scrollbar-thumb { background: var(--border); }
/* Flight panel header */
.fb-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  flex-shrink: 0;
  background: rgba(216, 195, 165, 0.10);
  min-height: 32px;
}
.fb-panel-title {
  font-size: 8px; font-weight: 700; color: var(--text-dim);
  letter-spacing: 1.6px; text-transform: uppercase;
}
.fb-header-controls { display: inline-flex; align-items: center; gap: 2px; }
.fb-minimize-btn,
.fb-panel-header .close-btn {
  font-size: 16px;
  line-height: 1;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 10px;
}
.fb-minimize-btn:hover,
.fb-panel-header .close-btn:hover { color: var(--accent); }
.flight-banner.minimized { max-height: 42px !important; overflow: hidden; }
.flight-banner.minimized .fb-route-section,
.flight-banner.minimized .fb-stats-grid,
.flight-banner.minimized #fbDist,
.flight-banner.minimized .fb-arrival { display: none !important; }
/* Route section */
.fb-route-section {
  margin-bottom: 10px;
  flex-shrink: 0;
  padding: 0 10px;
}
.fb-route {
  font-size: 13px; font-weight: 700; color: var(--gold); letter-spacing: 2px;
  margin-bottom: 4px;
}
.fb-dest {
  font-size: 10px; color: var(--text-dim); letter-spacing: 1px;
  margin-bottom: 10px;
}
.fb-progress {
  width: 100%; height: 4px;
  background: rgba(218, 165, 32, 0.12);
  border-radius: 2px;
}
.fb-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold), #e6c040);
  transition: width 1s ease;
  border-radius: 2px;
}
/* Stats grid — 2x2 cards */
.fb-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
  padding: 0 10px;
}
.fb-stat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fb-stat-label {
  font-size: 8px; color: var(--text-dim); letter-spacing: 1.5px; text-transform: uppercase;
}
.fb-stat-val {
  font-size: 18px; font-weight: 700; color: var(--gold); letter-spacing: 1px;
}
.fb-stat-unit { font-size: 9px; color: var(--text-dim); }
.fb-arrival {
  font-size: 10px; color: var(--text); letter-spacing: 1px;
  padding: 8px 10px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─── Altitude Filter ─── */
.alt-filter {
  position: absolute;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 14px;
  width: 260px;
  display: none;
  z-index: 20;
}
.alt-filter.visible { display: block; }
.alt-filter-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.alt-filter-title {
  font-size: 8px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim);
}
.alt-filter-value {
  font-size: 10px; color: var(--accent); font-weight: 600;
}
.alt-filter-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.alt-filter-row input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 2px; background: var(--border); outline: none;
}
.alt-filter-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 10px;
  background: var(--accent); cursor: pointer;
}
.alt-filter-row input[type="range"]::-moz-range-thumb {
  width: 10px; height: 10px; background: var(--accent);
  cursor: pointer; border: none;
}
.alt-filter-label {
  font-size: 9px; color: var(--text-dim); min-width: 45px; text-align: right;
}
.alt-filter-reset {
  width: 100%; padding: 5px; margin-top: 4px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); font-family: var(--mono);
  font-size: 8px; letter-spacing: 1px; cursor: pointer; text-transform: uppercase;
}
.alt-filter-reset:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Prediction Legend ─── */
.prediction-legend {
  position: absolute;
  bottom: 110px;
  right: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 8px;
}
.pred-legend-title {
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 1.5px;
  margin-bottom: 3px; font-size: 7px;
}

/* ─── Conflict Legend ─── */
.conflict-legend {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: var(--panel);
  border: 1px solid rgba(255, 50, 50, 0.3);
  padding: 6px 10px;
  font-size: 8px;
}
.conflict-legend-title {
  color: rgba(255, 80, 80, 0.9); text-transform: uppercase; letter-spacing: 1.5px;
  margin-bottom: 3px; font-size: 7px;
}

#btnConflicts.active, #btnConflictFilter.active {
  background: rgba(255, 50, 50, 0.2);
  border-color: rgba(255, 50, 50, 0.5);
  color: #ff5050;
}

/* ─── Airport Labels ─── */
.source-indicator {
  font-size: 8px; margin-left: 4px; opacity: 0.6;
}

/* ─── Minimap ─── */
.minimap-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 320px;
  height: 190px;
  background: var(--panel);
  border: 1px solid var(--border);
  overflow: hidden;
  z-index: 20;
  cursor: crosshair;
  transition: transform 0.3s ease;
  transform: translateY(0);
}
.minimap-container.collapsed {
  transform: translateY(calc(100% - 38px));
}
.minimap-header {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--text-dim);
  padding: 7px 10px;
  background: rgba(216, 195, 165, 0.10);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: default;
  min-height: 32px;
  box-sizing: border-box;
}
.minimap-header::before { content: '// '; color: var(--accent); opacity: 0.4; }
.minimap-resize-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1;
  padding: 0 4px;
  margin: 0 1px;
  cursor: pointer;
}
.minimap-resize-btn:hover { color: var(--accent); border-color: transparent; }
.minimap-header .minimap-count { color: var(--accent); }

/* Observer message icon pulse (GPU-friendly) */
@keyframes observerMsgPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255,213,74,0.0)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 6px rgba(255,213,74,0.55)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255,213,74,0.0)); }
}
.observer-msg-unseen {
  color: #ffd54a !important;
  animation: observerMsgPulse 1.8s ease-in-out infinite;
  will-change: transform, filter;
}
.observer-msg-seen {
  color: #ffffff !important;
  animation: none !important;
  transform: scale(1) !important;
  filter: none !important;
}

.minimap-canvas {
  width: 100%;
  height: calc(100% - 20px);
  display: block;
}

.minimap-collapse-btn {
  font-size: 16px !important;
  padding: 2px 10px !important;
  margin-left: 4px !important;
  font-weight: 700;
  border: none !important;
  background: transparent !important;
}

/* ─── Webcam PiP ─── */
.webcam-pip {
  position: absolute;
  bottom: 50px;
  left: 320px;
  width: 420px;
  height: 280px;
  background: var(--panel);
  border: 1px solid var(--gold);
  z-index: 90;
  display: none;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.6);
  resize: both;
}
.webcam-pip.visible { display: block; }
.webcam-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(218, 165, 32, 0.08);
  border-bottom: 1px solid var(--border);
  cursor: move;
  min-height: 26px;
}
.webcam-badge {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 6px;
  background: var(--gold);
  color: var(--bg);
  text-transform: uppercase;
}
.webcam-title {
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 1px;
  flex: 1;
  text-transform: uppercase;
}
.webcam-controls {
  display: flex;
  gap: 4px;
}
.webcam-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 6px;
  cursor: pointer;
}
.webcam-btn:hover { border-color: var(--gold); color: var(--gold); }
.webcam-iframe {
  width: 100%;
  height: calc(100% - 26px);
  border: none;
  display: block;
}

/* ─── Scanline overlay effect (subtle) ─── */
#hud::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 136, 0.008) 2px,
    rgba(0, 255, 136, 0.008) 4px
  );
  pointer-events: none;
  z-index: 999;
}

/* ─── Responsive: iPad ─── */
@media (max-width: 1024px) {
  .logo .sep, .logo .sub { display: none; }
  .top-bar { padding: 0 20px; }
}

/* ─── Responsive: Tablet ─── */
@media (max-width: 768px) {
  .top-bar { padding: 0 10px; height: 44px; }
  .status-cluster { gap: 6px; }
  .stat-label { display: none; }
  .side-panel { width: 260px; top: 42px; bottom: 52px; }
  .setup-panel { width: calc(100% - 24px); padding: 20px; }
  .detail-panel { width: 320px; }
  .alt-legend { display: none; }
  .minimap-container {
    width: 200px; height: 120px;
    bottom: 52px;
  }
  .flight-banner { width: 320px; }
  .fb-data-row { gap: 8px; flex-wrap: wrap; }
  .fb-stat-val { font-size: 10px; }
  .bottom-bar { gap: 2px; }
  .ctrl-btn { padding: 8px 12px; font-size: 10px; }
  .webcam-pip { width: 320px; height: 200px; left: 8px; }
  .settings-btn { font-size: 14px; padding: 4px 8px; }
  .compass-btn { font-size: 10px; padding: 4px 6px; }
}

/* ─── Responsive: Mobile ─── */
@media (max-width: 480px) {
  /* PREVENT page scroll — everything is fixed/absolute */
  body, html { overflow: hidden; height: 100%; }

  /* ── Top bar: 28px fixed ── */
  .top-bar { position: fixed; top: 0; left: 0; right: 0; height: 48px; padding: 0 10px; z-index: 200; }
  .logo { font-size: 14px; letter-spacing: 2px; gap: 4px; white-space: nowrap; }
  .logo .sub, .logo .sep { display: none; }

  /* Mobile top bar: logo + N↑ left, time center, ☰ right */
  .status-cluster {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    display: flex; gap: 4px; align-items: center;
  }
  .status-cluster .stat-label { font-size: 7px; }
  .status-cluster .stat-value { font-size: 13px; font-weight: 700; }
  .status-cluster .stat:first-of-type { display: none; } /* hide LOCAL, show ZULU only */
  .status-cluster .stat:last-of-type { display: none; } /* hide pulse dot on mobile */
  .status-cluster .compass-btn { display: none; } /* hide original N↑, use mobile-compass instead */

  /* Mobile Zulu clock — centered in top bar */
  .mobile-clock {
    display: block !important;
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--mono);
    font-size: 12px; font-weight: 600;
    color: var(--accent);
    letter-spacing: 1px;
  }

  /* Mobile N↑ button — left side next to logo, matched size with hamburger */
  .mobile-compass {
    display: inline-flex !important;
    font-size: 14px; padding: 8px 10px;
    min-width: 40px; min-height: 40px;
    align-items: center; justify-content: center;
  }

  .toggle-panel-btn { display: none !important; }
  .bottom-bar { display: none; }

  /* Mobile: move center controls to right, only show hamburger */
  .top-center {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    left: auto;
    gap: 3px; flex-shrink: 0; overflow: visible;
  }
  .top-center .stat { display: none; }
  .top-center .compass-btn:not(.mobile-compass) { display: none; }
  .top-center .top-divider { display: none; }
  .top-controls {
    gap: 3px; flex-shrink: 0; overflow: visible;
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
  }
  .top-controls .ctrl-btn { padding: 6px 8px; font-size: 10px; min-height: 32px; white-space: nowrap; }
  .top-controls .user-btn { display: none; }
  .top-controls #btnSchedule { display: none; }
  .top-controls #btnLog { display: none; }
  .top-controls #btnFriends { display: none; }
  .top-center .ctrl-btn { padding: 6px 8px; font-size: 10px; min-height: 32px; white-space: nowrap; }
  .top-center .user-btn { display: none; }
  .top-center #btnSchedule { display: none; }
  .top-center #btnLog { display: none; }
  .top-center #btnFriends { display: none; }

  /* MORE button as hamburger on mobile — bigger, matched with N↑ */
  .top-controls #btnMore, .top-center #btnMore {
    min-width: 40px; min-height: 40px;
    padding: 8px 10px; font-size: 14px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .top-controls #btnMore .btn-label, .top-center #btnMore .btn-label { font-size: 0; }
  .top-controls #btnMore .btn-label::before, .top-center #btnMore .btn-label::before { content: '☰'; font-size: 18px; }
  /* More menu opens right-aligned on mobile */
  .more-menu { left: auto; right: 0; }

  /* ── Minimap: fixed bottom band, above bottom nav, slides down when collapsed ── */
  .minimap-container {
    display: block;
    position: fixed !important;
    width: 100%; height: 220px;
    bottom: 96px; left: 0;
    z-index: 50;
    opacity: 0.95;
    border-top: 1px solid var(--border);
    transition: transform 0.3s ease;
    transform: translateY(0);
    margin: 0; padding: 0;
  }
  .minimap-container.collapsed {
    transform: translateY(calc(100% - 38px));
  }
  .minimap-header { font-size: 8px; padding: 6px 8px; min-height: 32px; }
  .minimap-collapse-btn { font-size: 18px !important; padding: 2px 12px !important; }

  /* ── Schedule: hidden on mobile unless opened from bottom nav ── */
  .schedule-panel {
    display: none !important;
  }
  .schedule-panel.mobile-fullscreen {
    display: block !important;
    position: fixed !important;
    width: 100%; right: 0; left: 0;
    top: 48px !important; bottom: 96px !important;
    max-height: none;
    overflow-y: auto;
    border: none; border-top: 1px solid var(--accent);
    z-index: 1200;
    -webkit-overflow-scrolling: touch;
    cursor: default;
  }
  .schedule-panel .sched-header { cursor: default; position: sticky; top: 0; z-index: 1; background: var(--panel); }
  .schedule-panel .sched-add-row { display: none !important; }
  .sched-items { max-height: none; overflow-y: auto; flex: 1; }
  .sched-import-btn { min-height: 44px !important; font-size: 11px !important; }
  .sched-item { padding: 10px; }
  .sched-flight { font-size: 10px; }
  .sched-route { font-size: 14px; }
  .sched-time { font-size: 10px; }
  .sched-remove { font-size: 12px; padding: 4px 8px; min-width: 32px; }
  .sched-locate { font-size: 11px; padding: 6px 12px; min-height: 36px; }

  /* ── Side panel: left drawer, toggle with OTHERS ── */
  .side-panel {
    position: fixed;
    width: 60%; left: 0;
    top: 40px; bottom: 240px;
    z-index: 70;
    border: none;
    border-right: 1px solid var(--border);
    transition: transform 0.2s ease;
    overflow-y: auto;
  }
  .side-panel.hidden { transform: translateX(-100%); }
  .search-box { font-size: 14px; padding: 10px; -webkit-text-size-adjust: 100%; }
  .ac-item { padding: 8px; font-size: 11px; min-height: 40px; }
  .ac-callsign { font-size: 13px; }
  .ac-alt { font-size: 11px; }
  .ac-origin, .ac-speed { font-size: 9px; }

  /* ── Watchlist panel: left drawer, toggle with WATCHLIST ── */
  .watchlist-panel {
    position: fixed;
    width: 60%; right: auto; left: 0;
    top: 40px;
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: none;
    border-right: 1px solid var(--border);
    z-index: 75;
  }
  .wl-input { font-size: 14px; padding: 10px; -webkit-text-size-adjust: 100%; }
  .wl-add-btn { min-width: 44px; min-height: 44px; font-size: 18px; }
  .wl-item { min-height: 40px; font-size: 13px; padding: 6px 10px; }
  .wl-remove { font-size: 13px; min-width: 28px; min-height: 28px; padding: 4px; }
  .wl-toggle-btn { min-height: 40px; font-size: 11px; padding: 8px; }
  .wl-hint { font-size: 9px; padding: 4px 10px 8px; }

  /* ── Detail panel: bottom sheet, compact ── */
  .detail-panel {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(96px + 38px);  /* above bottom nav + collapsed minimap header */
    top: auto;
    width: 100%;
    max-height: calc(100vh - 182px);
    overflow-y: auto;
    overflow-x: hidden;
    white-space: normal;
    border: none;
    border-top: 2px solid var(--accent);
    border-radius: 12px 12px 0 0;
    z-index: 1200;
    padding: 8px 10px 10px;
    font-size: 11px;
    display: none;
    flex-direction: column;
    box-sizing: border-box;
  }
  /* Auto-collapse minimap when flight info is open — show only header */
  .minimap-container.flight-info-hidden {
    transform: translateY(calc(100% - 38px)) !important;
  }
  .detail-panel .detail-header {
    position: sticky;
    top: 0;
    margin: -8px -10px 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    z-index: 3;
  }
  .detail-panel .detail-minimize-mobile { display: none; }
  .detail-panel .detail-callsign {
    font-size: 13px; font-weight: 700; margin-bottom: 0;
  }
  .detail-panel .detail-tags { margin-bottom: 1px; gap: 2px; }
  .detail-panel .det-tag { font-size: 7px; padding: 1px 3px; }
  .detail-panel .detail-status { font-size: 6px; padding: 1px 4px; margin-bottom: 1px; }
  .detail-panel .detail-route-card { padding: 3px 6px; margin-bottom: 1px; }
  .detail-panel .route-label { font-size: 5px; margin-bottom: 0; }
  .detail-panel .route-code { font-size: 12px; }
  .detail-panel .route-name { display: none; }
  .detail-panel .route-progress { padding: 1px 0; }
  .detail-panel .route-progress-bar { height: 2px; }
  .detail-panel .detail-grid { gap: 1px; margin: 1px 0; }
  .detail-panel .detail-field { padding: 2px 4px; }
  .detail-panel .detail-field label { font-size: 5px; margin-bottom: 0; }
  .detail-panel .detail-field .val { font-size: 10px; font-weight: 600; }
  .detail-panel .detail-field .unit { font-size: 6px; }
  .detail-panel .detail-country { display: none; }
  .detail-panel .detail-times {
    display: inline-flex; gap: 2px; white-space: nowrap; flex-shrink: 0;
  }
  .detail-panel .detail-times .time-box { padding: 2px 4px; }
  .detail-panel .detail-times .time-label { font-size: 5px; }
  .detail-panel .detail-times .time-value { font-size: 9px; font-weight: 600; }
  .detail-panel .detail-owner { display: none; }
  .detail-panel .detail-actions {
    display: flex; gap: 4px; width: 100%;
    position: sticky; bottom: 0; background: var(--panel);
    padding: 6px 0 2px; z-index: 1; margin-top: 2px;
  }
  .detail-panel .detail-actions .btn-track { flex: 1; padding: 10px 6px; font-size: 10px; min-height: 38px; }
  .detail-panel::before { display: none; }
  .detail-panel.visible { display: flex !important; }
  .detail-panel.minimized {
    padding: 6px 10px;
    max-height: 32px; overflow: hidden;
    align-items: center;
  }
  .detail-panel.minimized .detail-minimize-mobile { transform: translateX(-50%) rotate(180deg); }
  .detail-panel.minimized .detail-country,
  .detail-panel.minimized .detail-tags,
  .detail-panel.minimized .detail-status,
  .detail-panel.minimized .detail-grid,
  .detail-panel.minimized .detail-times,
  .detail-panel.minimized .detail-owner,
  .detail-panel.minimized .detail-actions { display: none; }
  .detail-panel.minimized .detail-callsign { font-size: 12px; margin-bottom: 0; }
  .detail-panel.minimized .detail-route-card {
    display: inline-flex !important; padding: 0; gap: 4px; border: none; background: none;
  }
  .detail-panel.minimized .route-code { font-size: 12px; }
  .detail-panel.minimized .route-label { display: none; }
  .detail-panel.minimized .route-progress { display: none !important; width: 0; }
  .detail-panel.minimized .route-name { display: none; }
  .detail-panel.minimized .route-section:first-of-type .route-code::after {
    content: ' → '; color: var(--text-dim); font-size: 10px;
  }
  .detail-minimize { font-size: 16px; padding: 2px 6px; min-width: 28px; min-height: 28px; }
  .detail-callsign { font-size: 16px; }
  .detail-grid { gap: 8px; }
  .detail-field .val { font-size: 13px; }
  .detail-field label { font-size: 7px; }
  .detail-actions { flex-wrap: wrap; gap: 6px; }
  .detail-actions .btn-track { min-height: 40px; font-size: 10px; flex: 1 1 30%; padding: 6px 4px; }
  .detail-close { top: 10px; right: 10px; font-size: 18px; padding: 6px 10px; min-width: 36px; min-height: 36px; }

  /* ── Alt filter ── */
  .alt-filter { width: calc(100% - 8px); left: 4px; transform: none; bottom: 248px; }
  .alt-filter-row input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; }
  .alt-filter-row input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; }
  .alt-filter-row input[type="range"] { height: 4px; }
  .alt-filter-reset { min-height: 40px; font-size: 10px; }

  /* Notifications: wider on mobile */
  .notification {
    width: calc(100% - 16px);
    max-width: none;
    top: 56px;
    font-size: 12px;
    padding: 12px 14px;
  }

  /* Settings panel: full-screen mobile */
  .settings-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 100;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: none;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .settings-panel .input-group input {
    font-size: 16px; padding: 12px 10px;
    min-height: 44px;
    -webkit-text-size-adjust: 100%;
  }
  .settings-panel .input-group label { font-size: 10px; margin-bottom: 6px; }
  .settings-panel .wl-toggle-btn { min-height: 48px; font-size: 12px; }
  .settings-panel .setup-note { display: none; }
  .settings-panel .setup-footer { padding: 16px 8px; }

  /* Setup panel: full-screen mobile */
  .setup-panel {
    width: 100%; height: 100%;
    top: 0; left: 0;
    transform: none;
    padding: 24px 16px;
    overflow-y: auto;
    border: none;
  }
  .setup-panel h2 { font-size: 16px; }
  .setup-panel p { font-size: 11px; }
  .input-group input { font-size: 16px; padding: 12px; }
  .btn-launch { font-size: 13px; padding: 14px; min-height: 48px; }
  .setup-note { display: none; }

  /* Webcam PiP: full-width bottom on mobile */
  .webcam-pip {
    top: auto;
    bottom: 0;
    right: 0; left: 0;
    width: 100%;
    height: 200px;
    resize: none;
    border-left: none; border-right: none;
  }
  .webcam-header { min-height: 36px; }
  .webcam-badge { font-size: 9px; padding: 4px 8px; }
  .webcam-title { font-size: 11px; }
  .webcam-btn { min-height: 32px; min-width: 32px; font-size: 12px; padding: 4px 8px; }

  /* (schedule panel rules already defined above) */
  /* Flight banner: full-width above collapsed minimap on mobile */
  .flight-banner {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(96px + 38px);  /* above bottom nav + collapsed minimap header */
    top: auto;
    width: 100%;
    max-width: none;
    max-height: calc(100vh - 182px);
    padding: 8px 12px;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--accent);
    overflow-y: auto;
    box-sizing: border-box;
    z-index: 50;
  }
  .flight-banner::-webkit-scrollbar { width: 3px; }
  .flight-banner::-webkit-scrollbar-track { background: transparent; }
  .flight-banner::-webkit-scrollbar-thumb { background: var(--border); }
  .fb-top-row { gap: 6px; }
  .fb-route { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fb-dest { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fb-stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .fb-stat-val { font-size: 14px; }
  .fb-arrival { font-size: 10px; white-space: nowrap; }

  /* Legends: hide on mobile to save space */
  .prediction-legend { display: none !important; }
  .conflict-legend { display: none !important; }
  .alt-legend { display: none !important; }

  /* Scanline: disable on mobile for performance */
  #hud::before { display: none; }
}

/* ─── Touch-friendly global overrides ─── */
@media (pointer: coarse) {
  .ctrl-btn { min-height: 44px; padding: 8px 14px; }
  .panel-close-btn { font-size: 18px; padding: 6px 10px; min-width: 36px; min-height: 36px; }
  .detail-close { font-size: 18px; padding: 6px 10px; min-width: 36px; min-height: 36px; }
  .ac-item { min-height: 48px; padding: 10px 12px; }
  .wl-remove { min-width: 36px; min-height: 36px; }
  .sched-remove { min-width: 36px; min-height: 36px; }
  .alt-filter-reset { min-height: 44px; }
  .webcam-btn { min-height: 36px; min-width: 36px; }
}

/* ═══════════════════════════════════════════════════
   AUTH OVERLAY
   ═══════════════════════════════════════════════════ */

.auth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  width: 360px;
  max-width: 90vw;
}

.auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  letter-spacing: 4px;
}

.auth-sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.auth-form input:focus {
  border-color: var(--accent);
}

.auth-submit {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 4px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.auth-submit:hover { opacity: 0.85; }

.auth-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: var(--text-dim);
  font-size: 11px;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

.auth-divider span { padding: 0 12px; }

.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-google-btn:hover { background: rgba(255,255,255,0.1); }

.auth-error {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(255, 68, 68, 0.15);
  border: 1px solid rgba(255, 68, 68, 0.3);
  border-radius: 4px;
  color: var(--warn);
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════
   PROFILE PANEL
   ═══════════════════════════════════════════════════ */

.profile-panel {
  position: fixed;
  top: 48px;
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.profile-panel::-webkit-scrollbar { width: 3px; }
.profile-panel::-webkit-scrollbar-track { background: transparent; }
.profile-panel::-webkit-scrollbar-thumb { background: var(--border); }

.profile-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 255, 136, 0.02);
}

.profile-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.profile-title::before { content: '// '; color: var(--accent); opacity: 0.4; }

.profile-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid #9f0000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-placeholder {
  font-size: 28px;
  color: var(--accent);
  font-weight: 700;
}

.profile-avatar-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.profile-avatar-btn:hover { border-color: var(--accent); color: var(--accent); }

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-field label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.profile-field input,
.profile-field select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}

.profile-field input:focus,
.profile-field select:focus {
  border-color: var(--accent);
}

.profile-field select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.profile-hint {
  font-size: 10px;
  color: var(--text-dim);
  font-style: italic;
}

.profile-save-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 4px;
  padding: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

.profile-save-btn:hover { opacity: 0.85; }

.profile-status {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  text-align: center;
}

.profile-status.success {
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
}

.profile-status.error {
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid rgba(255, 68, 68, 0.3);
  color: var(--warn);
}

.profile-logout-btn {
  background: transparent;
  border: 1px solid rgba(255, 68, 68, 0.3);
  color: var(--warn);
  font-family: var(--mono);
  font-size: 11px;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 8px;
}

.profile-logout-btn:hover { background: rgba(255, 68, 68, 0.1); }

/* ═══════════════════════════════════════════════════
   FRIENDS PANEL
   ═══════════════════════════════════════════════════ */

.friends-panel {
  position: fixed;
  top: 48px;
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.friends-panel::-webkit-scrollbar { width: 3px; }
.friends-panel::-webkit-scrollbar-track { background: transparent; }
.friends-panel::-webkit-scrollbar-thumb { background: var(--border); }

/* Global thin scrollbar for all panels */
.schedule-panel::-webkit-scrollbar,
.detail-panel::-webkit-scrollbar,
.side-panel::-webkit-scrollbar { width: 3px; }
.schedule-panel::-webkit-scrollbar-track,
.detail-panel::-webkit-scrollbar-track,
.side-panel::-webkit-scrollbar-track { background: transparent; }
.schedule-panel::-webkit-scrollbar-thumb,
.detail-panel::-webkit-scrollbar-thumb,
.side-panel::-webkit-scrollbar-thumb { background: var(--border); }

.friends-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 255, 136, 0.02);
}

.friends-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.friends-title::before { content: '// '; color: var(--accent); opacity: 0.4; }
.friends-header-btns {
  display: flex; align-items: center; gap: 6px;
}
.friends-header-btns .ctrl-btn.small {
  padding: 4px 10px; font-size: 9px; min-height: auto;
}

.friends-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.friends-add-row {
  display: flex;
  gap: 6px;
}

.friends-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}

.friends-input:focus { border-color: var(--accent); }

.friends-add-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 4px;
  width: 32px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.friends-section-title {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.friends-count {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
}

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

.friends-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 20px;
}

.friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.friend-item:hover { background: rgba(255,255,255,0.04); }

.friend-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-avatar span {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}

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

.friend-name {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-meta {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-flight {
  font-size: 10px;
  color: var(--info);
  margin-top: 2px;
}

.friend-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.friend-status.airborne { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.friend-status.scheduled { background: var(--gold); }
.friend-status.offline { background: var(--text-dim); }

/* Schedule import preview */
.sched-import-preview {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 4px 8px;
}

.sched-import-preview img {
  width: 100%;
  border-radius: 3px;
  opacity: 0.85;
}

.friend-btns {
  display: flex; gap: 4px; flex-shrink: 0; align-items: center;
}
.friend-vis-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  opacity: 0.3;
}
.friend-vis-btn.active {
  opacity: 1;
  border-color: #4fae84;
  color: #aef3d4;
  background: rgba(79,174,132,0.26);
  box-shadow: 0 0 0 1px rgba(79,174,132,0.65), 0 0 10px rgba(79,174,132,0.35);
}
.friend-vis-btn:hover {
  opacity: 1;
  border-color: #63c395;
  color: #c5ffe5;
  background: rgba(79,174,132,0.20);
}
.friend-vis-all.active { color: #c5ffe5; border-color: #63c395; }

.friend-item.friend-untracked { opacity: 0.5; }
.friend-item.friend-untracked:hover { opacity: 0.8; }
.friend-item.friend-overlap {
  background: rgba(255, 215, 0, 0.1);
  border-left: 3px solid #FFD700;
}
.friend-item.friend-overlap .friend-name::after {
  content: ' ★';
  color: #FFD700;
}

/* ─── Observer Links ─── */
.profile-divider { height: 1px; background: var(--border); margin: 12px 0; }
.profile-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--accent); margin-bottom: 6px;
}
.obs-count { color: var(--text-dim); font-weight: 400; }
.obs-hint { font-size: 10px; color: var(--text-dim); margin-bottom: 8px; }
.obs-empty { font-size: 10px; color: var(--text-dim); padding: 8px 0; }
.obs-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.obs-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: 4px; gap: 8px;
}
.obs-item.obs-expired { opacity: 0.4; }
.obs-info { flex: 1; min-width: 0; }
.obs-tag { font-size: 12px; font-weight: 600; color: var(--text); }
.obs-type {
  font-size: 9px; font-weight: 400; letter-spacing: 0.5px;
  color: var(--accent); margin-left: 4px;
}
.obs-expiry { font-size: 9px; color: var(--text-dim); margin-top: 2px; }
.obs-link {
  font-size: 9px; color: var(--accent); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 2px; opacity: 0.7;
}
.obs-link:hover { opacity: 1; text-decoration: underline; }
.obs-actions { display: flex; gap: 4px; flex-shrink: 0; }
.obs-btn {
  background: none; border: 1px solid var(--border); color: var(--text-dim);
  font-size: 12px; padding: 4px 6px; cursor: pointer; border-radius: 3px;
}
.obs-btn:hover { border-color: var(--accent); color: var(--accent); }
.obs-btn.obs-del:hover { border-color: var(--warn); color: var(--warn); }
.obs-add-row { display: flex; flex-direction: column; gap: 6px; }
.obs-primary-row { display: grid; grid-template-columns: minmax(110px, 1fr) auto; gap: 6px; align-items: stretch; }
.obs-actions-inline { display: flex; gap: 4px; align-items: center; }
.obs-btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 768px) {
  .obs-primary-row {
    grid-template-columns: 1fr;
  }
  .obs-actions-inline {
    display: grid;
    grid-template-columns: repeat(4, minmax(32px, 1fr));
    gap: 4px;
  }
  .obs-actions-inline .obs-btn { width: 100%; text-align: center; }
  .obs-btn-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(88px, 1fr));
    gap: 6px;
  }
  .obs-btn-row .sched-action-btn { width: 100%; }
}


/* ═══════════════════════════════════════════════════
   USER BUTTON (top bar)
   ═══════════════════════════════════════════════════ */

.user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 4px 14px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.user-btn:hover { border-color: var(--accent); }

.user-btn-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
}

.user-btn-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-btn-avatar span { font-size: 11px; color: var(--accent); font-weight: 600; }

/* Prevent accidental text selection on globe avatar overlays */
#avatar-overlay,
#avatar-overlay * {
  user-select: none;
  -webkit-user-select: none;
}

/* Co-located friend avatars: hovered one should come to front */
.friend-avatar-overlay:hover {
  z-index: 60 !important;
}

/* ═══════════════════════════════════════════════════
   BOTTOM NAV (Mobile)
   ═══════════════════════════════════════════════════ */

.bottom-nav {
  display: none; /* shown via media query on mobile */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 96px;
  padding-bottom: env(safe-area-inset-bottom, 12px);
  background: var(--panel);
  border-top: 1px solid var(--border);
  z-index: 1200;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  padding: 10px 20px;
  transition: color 0.2s;
}

.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item:hover { color: var(--accent); }

.bottom-nav-icon {
  font-size: 32px;
  line-height: 1;
}

.bottom-nav-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  background: var(--warn);
  color: #fff;
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 6px;
  min-width: 14px;
  text-align: center;
}

/* ═══════════════════════════════════════════════════
   MOBILE RESPONSIVE (max-width: 768px)
   ═══════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .bottom-nav { display: flex; }

  /* Make room for bottom nav */
  .minimap-container { bottom: 96px; }
  .alt-legend { bottom: 86px; }

  /* Detail panel: sit above bottom nav + collapsed minimap header */
  .detail-panel {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(96px + 38px);
    top: auto;
    width: 100%;
    max-height: 45vh;
    overflow-y: auto;
    border: none;
    border-top: 2px solid var(--accent);
    border-radius: 12px 12px 0 0;
    z-index: 1200;
    box-sizing: border-box;
  }
  .minimap-container.flight-info-hidden {
    transform: translateY(calc(100% - 38px)) !important;
  }

  /* Flight banner: above bottom nav + collapsed minimap header */
  .flight-banner {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(96px + 38px);
    top: auto;
    width: 100%;
    max-width: none;
    max-height: calc(100vh - 182px);
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--accent);
    box-sizing: border-box;
    z-index: 50;
  }

  /* Full-screen slide-over panels on mobile */
  .profile-panel,
  .friends-panel {
    width: 100%;
    top: 48px;
    bottom: 96px;
    border-left: none;
    border-top: none;
  }

  .auth-card {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
  }

  .auth-overlay { align-items: stretch; }

  /* Schedule panel adjustments for mobile */
  .schedule-panel {
    bottom: 96px;
  }
}

@media (max-width: 480px) {
  .profile-panel,
  .friends-panel {
    top: 48px;
    bottom: 96px;
    width: 100%;
    z-index: 1200;
  }

  /* Schedule panel full-screen when tapped from bottom nav */
  .schedule-panel.mobile-fullscreen {
    position: fixed !important;
    top: 40px !important;
    bottom: 80px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: none !important;
    z-index: 1200 !important;
    border: none !important;
    border-top: 1px solid var(--accent) !important;
    overflow-y: auto !important;
  }

  /* Hide desktop user button on mobile — use bottom nav instead */
  .user-btn { display: none; }
  #btnFriends { display: none; }

  /* Bottom nav always visible */
  .bottom-nav { display: flex; }
}
}
