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

html, body, #map {
  width: 100%; height: 100%;
  background: #05111f;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Map ─────────────────────────────────────────────────────── */
#map { position: absolute; inset: 0; }

/* ── HUD (top-left status bar) ───────────────────────────────── */
#hud {
  position: absolute;
  top: 20px; left: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

#hud-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffd166;
  text-shadow: 0 0 22px rgba(255,180,60,0.7), 0 0 6px rgba(255,140,0,0.4);
  pointer-events: none;
}

#hud-clock {
  font-size: 0.88rem;
  color: #06d6a0;
  letter-spacing: 0.06em;
  pointer-events: none;
}

#hud-mode-bar {
  display: flex;
  gap: 6px;
  pointer-events: all;
}

.mode-btn {
  background: rgba(5,30,25,0.75);
  border: 1px solid rgba(6,214,160,0.3);
  color: #06d6a0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}
.mode-btn:hover  { border-color: rgba(6,214,160,0.8); color: #ffd166; }
.mode-btn.active {
  background: rgba(6,140,90,0.45);
  border-color: rgba(6,214,160,0.9);
  color: #ffd166;
  box-shadow: 0 0 14px rgba(6,214,160,0.35);
}

/* ── Time-lapse controls (bottom bar) ───────────────────────── */
#tl-controls {
  position: absolute;
  bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(3,20,18,0.85);
  border: 1px solid rgba(6,214,160,0.2);
  border-radius: 40px;
  padding: 10px 22px;
  backdrop-filter: blur(12px);
  white-space: nowrap;
}

#tl-play {
  background: none;
  border: 1px solid rgba(6,214,160,0.4);
  color: #06d6a0;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
#tl-play:hover { background: rgba(6,140,90,0.35); border-color: rgba(6,214,160,0.9); color: #ffd166; }

#tl-slider {
  width: min(400px, 40vw);
  height: 4px;
  accent-color: #06d6a0;
  cursor: pointer;
}

#tl-date {
  font-size: 0.88rem;
  color: #ffd166;
  letter-spacing: 0.06em;
  min-width: 140px;
  text-align: center;
}

#tl-speed-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

#tl-speed-wrap button {
  background: none;
  border: 1px solid rgba(6,214,160,0.3);
  color: #06d6a0;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
#tl-speed-wrap button:hover { color: #ffd166; border-color: #06d6a0; }

#tl-speed-label {
  font-size: 0.78rem;
  color: #06d6a0;
  min-width: 60px;
  text-align: center;
  letter-spacing: 0.04em;
}

/* ── Ship info card (follow mode) ───────────────────────────── */
#ship-card {
  position: absolute;
  bottom: 28px; right: 28px;
  z-index: 100;
  background: rgba(3,20,18,0.88);
  border: 1px solid rgba(6,214,160,0.25);
  border-radius: 16px;
  padding: 18px 22px;
  backdrop-filter: blur(14px);
  min-width: 200px;
  transition: opacity 0.5s;
}

#card-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffd166;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

#card-status {
  font-size: 0.82rem;
  color: #06d6a0;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}

#card-dest {
  font-size: 0.82rem;
  color: #06d6a0;
  letter-spacing: 0.04em;
}

/* ── Loading screen ──────────────────────────────────────────── */
#loading {
  position: absolute; inset: 0;
  z-index: 999;
  background: #05111f;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s;
}

#loading.fade-out { opacity: 0; pointer-events: none; }

#loading-inner { text-align: center; }

#loading-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #c8e6ff;
  text-shadow: 0 0 30px rgba(80,160,255,0.6);
  margin-bottom: 14px;
}

#loading-sub {
  font-size: 0.9rem;
  color: #7ab8e8;
  letter-spacing: 0.1em;
  margin-bottom: 22px;
}

#loading-bar-wrap {
  width: 220px;
  height: 3px;
  background: rgba(100,170,255,0.15);
  border-radius: 2px;
  margin: 0 auto;
  overflow: hidden;
}

#loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #06856a, #06d6a0, #ffd166);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── Key hint ────────────────────────────────────────────────── */
#key-hint {
  position: absolute;
  bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 101;
  background: rgba(5,17,40,0.7);
  border: 1px solid rgba(100,170,255,0.15);
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 0.76rem;
  color: rgba(122,184,232,0.8);
  letter-spacing: 0.05em;
  backdrop-filter: blur(8px);
  transition: opacity 1s;
  pointer-events: none;
}
#key-hint span {
  display: inline-block;
  background: rgba(100,170,255,0.15);
  border: 1px solid rgba(100,170,255,0.3);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.7rem;
  margin: 0 2px;
}
#key-hint.hidden { opacity: 0; }

/* ── MapLibre popup override ─────────────────────────────────── */
.maplibregl-popup-content {
  background: rgba(5,17,40,0.92) !important;
  border: 1px solid rgba(100,170,255,0.3) !important;
  border-radius: 10px !important;
  color: #c8e6ff !important;
  padding: 10px 14px !important;
  font-family: inherit !important;
  font-size: 0.82rem !important;
  backdrop-filter: blur(10px) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5) !important;
}
.maplibregl-popup-tip { display: none !important; }
.maplibregl-ctrl-bottom-right { transition: opacity 0.6s; }

/* ── Fullscreen button (top-right) ───────────────────────────── */
#btn-fullscreen {
  position: absolute;
  top: 20px; right: 20px;
  z-index: 101;
  background: rgba(3,20,18,0.75);
  border: 1px solid rgba(6,214,160,0.25);
  color: #06d6a0;
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  transition: opacity 0.6s, border-color 0.2s, color 0.2s;
}
#btn-fullscreen:hover { border-color: rgba(6,214,160,0.8); color: #ffd166; }

/* ── Auto-hide: UI elements fade when idle ───────────────────── */
#hud-title, #hud-mode-bar, #tl-controls, #ship-card, #btn-fullscreen, #btn-settings {
  transition: opacity 0.6s;
}
.ui-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Easter egg overlay ──────────────────────────────────────── */
#egg-overlay {
  position: absolute; inset: 0;
  z-index: 150;
  pointer-events: none;
  overflow: hidden;
}

/* ── Settings gear button (below fullscreen) ─────────────────── */
#btn-settings {
  position: absolute;
  top: 68px; right: 20px;
  z-index: 101;
  background: rgba(3,20,18,0.75);
  border: 1px solid rgba(6,214,160,0.25);
  color: #06d6a0;
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  transition: opacity 0.6s, border-color 0.2s, color 0.2s;
}
#btn-settings:hover { border-color: rgba(6,214,160,0.8); color: #ffd166; }
#btn-settings.active { border-color: #ffd166; color: #ffd166; }

/* ── Settings panel ──────────────────────────────────────────── */
#settings-panel {
  position: absolute;
  top: 116px; right: 20px;
  z-index: 102;
  background: rgba(3,20,18,0.92);
  border: 1px solid rgba(6,214,160,0.3);
  border-radius: 16px;
  padding: 18px 20px;
  min-width: 220px;
  backdrop-filter: blur(16px);
  color: #c8fff0;
  font-size: 0.82rem;
}

#settings-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffd166;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
  text-align: center;
}

.settings-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(6,214,160,0.12);
}
.settings-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.settings-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #06d6a0;
  margin-bottom: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 12px;
}
.toggle-row span { color: #c8fff0; }
.toggle-row input[type="checkbox"] {
  accent-color: #06d6a0;
  width: 16px; height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

#freq-buttons {
  display: flex;
  gap: 6px;
}
.freq-btn {
  flex: 1;
  background: rgba(3,20,18,0.6);
  border: 1px solid rgba(6,214,160,0.25);
  color: #06d6a0;
  padding: 5px 4px;
  border-radius: 12px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
}
.freq-btn:hover  { border-color: rgba(6,214,160,0.7); color: #ffd166; }
.freq-btn.active {
  background: rgba(6,140,90,0.4);
  border-color: rgba(6,214,160,0.8);
  color: #ffd166;
}

/* ── Utility ─────────────────────────────────────────────────── */
.hidden { display: none !important; }
