/* ==========================================================================
   Map Winds Pro - Master Ultra-Transparent Crystal Glassmorphism Stylesheet
   ========================================================================== */

:root {
  /* DARK THEME TOKENS (Ultra-Transparent Crystal Glass) */
  --bg-primary: #040812;
  --bg-surface-glass: rgba(6, 12, 28, 0.22);
  --bg-card-glass: rgba(10, 18, 38, 0.18);
  --bg-inset-glass: rgba(2, 6, 18, 0.20);
  --bg-pill-glass: rgba(15, 25, 48, 0.25);
  
  --border-glass-bright: rgba(255, 255, 255, 0.18);
  --border-glass-subtle: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(56, 189, 248, 0.5);
  
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  
  --accent-cyan: #38bdf8;
  --accent-cyan-glow: rgba(56, 189, 248, 0.35);
  --accent-emerald: #10b981;
  --accent-amber: #facc15;
  --accent-orange: #fb923c;
  --accent-rose: #f43f5e;
  --accent-blue: #2563eb;
  
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-brand: 'Oswald', sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-glass: inset 0 1px 0 0 rgba(255, 255, 255, 0.22), 0 14px 36px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 24px rgba(56, 189, 248, 0.28);
  --backdrop-blur: blur(14px) saturate(160%);
}

/* LIGHT THEME TOKENS */
[data-theme="light"] {
  --bg-primary: #e2e8f0;
  --bg-surface-glass: rgba(255, 255, 255, 0.28);
  --bg-card-glass: rgba(255, 255, 255, 0.24);
  --bg-inset-glass: rgba(255, 255, 255, 0.20);
  --bg-pill-glass: rgba(255, 255, 255, 0.32);
  
  --border-glass-bright: rgba(0, 0, 0, 0.15);
  --border-glass-subtle: rgba(0, 0, 0, 0.08);
  --border-glass-hover: rgba(2, 132, 199, 0.5);
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  
  --accent-cyan: #0284c7;
  --accent-cyan-glow: rgba(2, 132, 199, 0.25);
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-orange: #ea580c;
  --accent-rose: #e11d48;
  
  --shadow-glass: inset 0 1px 0 0 rgba(255, 255, 255, 0.6), 0 10px 28px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphic Base Classes */
.glass-panel {
  background: var(--bg-surface-glass);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-glass-bright);
  box-shadow: var(--shadow-glass);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.glass-card {
  background: var(--bg-card-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass-subtle);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.12);
}

.glass-inset {
  background: var(--bg-inset-glass);
  border: 1px solid var(--border-glass-subtle);
  border-radius: var(--radius-sm);
}

.glass-pill {
  background: var(--bg-pill-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-full);
}

.glass-btn {
  background: var(--bg-pill-glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass-bright);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-btn:hover {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

.glass-badge {
  background: var(--accent-cyan-glow);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Top Navigation HUD
   ========================================================================== */
.top-nav {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  height: 60px;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
  border-radius: var(--radius-lg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: fit-content;
}

.brand-text h1 {
  font-family: var(--font-brand);
  font-size: 20px;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  line-height: 1.1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.brand-text h1 span {
  color: var(--accent-cyan);
  text-shadow: 0 0 12px var(--accent-cyan-glow);
}

.brand-text .subtext {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Search Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 320px;
  width: 100%;
  padding: 4px 8px 4px 14px;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px var(--accent-cyan-glow);
}

.search-icon {
  color: var(--text-muted);
  font-size: 13px;
  margin-right: 8px;
}

.search-box input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 12px;
  outline: none;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: transform 0.15s ease, box-shadow 0.2s;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.search-box button:hover {
  transform: scale(1.08);
}

/* Nav Controls */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Map Segmented Switch Button: Vector vs Satellite */
.map-switch-container {
  display: flex;
  padding: 3px;
  gap: 2px;
}

.map-switch-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-switch-btn.active {
  background: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
}

.control-group label {
  font-size: 11px;
  color: var(--text-muted);
}

.control-group select {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.control-group select option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.utc-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 4px 12px;
  min-width: 90px;
}

.clock-label {
  font-size: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

.clock-time {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-emerald);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* ==========================================================================
   Main Cockpit Layout
   ========================================================================== */
.cockpit-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
}

.leaflet-container {
  font-family: var(--font-main) !important;
  background: var(--bg-primary) !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--border-glass-bright) !important;
  box-shadow: var(--shadow-glass) !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
  margin-top: 86px !important;
  margin-left: 16px !important;
}

.leaflet-control-zoom a {
  background-color: var(--bg-surface-glass) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-glass-subtle) !important;
  backdrop-filter: var(--backdrop-blur) !important;
}

/* Loading Overlay */
.map-loader {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-glass-subtle);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Map Legend */
.map-legend {
  position: absolute;
  bottom: 96px;
  left: 16px;
  z-index: 1000;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 180px;
}

.legend-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.legend-header .badge {
  margin-left: auto;
  font-size: 9px;
  padding: 2px 6px;
}

.legend-scale {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scale-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.vector-sample {
  display: inline-block;
  height: 1.5px;
  border-radius: 1px;
  box-shadow: 0 0 4px currentColor;
}

.vector-sample.s-calm     { width: 6px; background: #10b981; color: #10b981; }
.vector-sample.s-moderate { width: 13px; background: #38bdf8; color: #38bdf8; }
.vector-sample.s-fresh    { width: 20px; background: #facc15; color: #facc15; }
.vector-sample.s-neargale { width: 27px; background: #fb923c; color: #fb923c; }
.vector-sample.s-gale     { width: 34px; background: #ef4444; color: #ef4444; }
.vector-sample.s-storm    { width: 42px; background: #c084fc; color: #c084fc; }

.legend-footer {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-glass-subtle);
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Right Telemetry & Navigation Drawer
   ========================================================================== */
.telemetry-drawer {
  position: absolute;
  top: 86px;
  right: 16px;
  bottom: 96px;
  width: 380px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.telemetry-drawer.closed {
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-glass-subtle);
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-cyan);
}

.drawer-title h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.btn-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* Telemetry Point Card */
.telemetry-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header .tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.source-badge {
  font-size: 9px;
  padding: 2px 8px;
}

.coords-display {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
}

.coord-item {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
}

.coord-label {
  color: var(--text-muted);
}

.coord-value {
  color: var(--accent-cyan);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Compass Rose & Speed Gauge */
.wind-gauge-container {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}

.compass-rose {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 90px;
}

.compass-ring.glass-compass {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 1px solid var(--border-glass-bright);
  background: radial-gradient(circle, var(--bg-inset-glass) 0%, rgba(2, 6, 18, 0.4) 100%);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.3), 0 0 12px var(--accent-cyan-glow);
}

.cardinal {
  position: absolute;
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.cardinal.n { top: 2px; left: 50%; transform: translateX(-50%); color: var(--accent-rose); }
.cardinal.e { top: 50%; right: 4px; transform: translateY(-50%); }
.cardinal.s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.cardinal.w { top: 50%; left: 4px; transform: translateY(-50%); }

.compass-needle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 52px;
  margin-top: -26px;
  margin-left: -1.5px;
  transform: rotate(0deg);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.needle-head {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 22px solid var(--accent-rose);
  margin: 0 auto;
  filter: drop-shadow(0 0 6px var(--accent-rose));
}

.bearing-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
}

.bearing-badge #bearingDeg {
  color: var(--text-primary);
  font-weight: 700;
}

.bearing-badge #cardinalText {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Gauge Stats */
.gauge-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-box.primary {
  padding: 8px 12px;
}

.stat-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-value-group {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.stat-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
}

.beaufort-chip {
  display: inline-block;
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  margin-top: 4px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.18);
  color: var(--accent-emerald);
}

.stat-row {
  display: flex;
  gap: 6px;
}

.stat-mini {
  flex: 1;
  padding: 5px 8px;
}

.mini-label {
  display: block;
  font-size: 8px;
  color: var(--text-muted);
}

.mini-val {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Route Relative Wind & Sailing HUD */
.route-relative-hud {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 6px;
  border-left: 3px solid var(--accent-cyan);
}

.rel-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rel-label {
  font-size: 8px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.rel-stat strong {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Route Section */
.route-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.section-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.title-with-count {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-cyan);
}

.title-with-count h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.count-badge {
  font-size: 9px;
  padding: 1px 6px;
}

.total-distance {
  font-size: 11px;
  color: var(--text-secondary);
}

.total-distance strong {
  font-family: var(--font-mono);
  color: var(--accent-emerald);
  margin-left: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.route-instructions {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

.table-scroll-container {
  flex: 1;
  min-height: 130px;
  max-height: 220px;
  overflow-y: auto;
}

.route-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
}

.route-table th {
  position: sticky;
  top: 0;
  background: rgba(6, 12, 28, 0.6);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-glass-subtle);
  backdrop-filter: blur(8px);
}

.route-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-glass-subtle);
  font-family: var(--font-mono);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.route-table tr:hover td {
  background: var(--accent-cyan-glow);
}

.empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 8px;
}

/* Route Action Buttons */
.route-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.btn-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.btn-action.danger {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-action.danger:hover {
  background: rgba(239, 68, 68, 0.4);
  color: #fff;
}

/* ==========================================================================
   Floating Bottom Timeline Scrubber Dock
   ========================================================================== */
.timeline-dock {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  width: calc(100% - 32px);
  max-width: 960px;
}

.dock-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: var(--radius-full);
  padding: 8px 20px;
}

.playback-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-dock {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.btn-dock.play-btn {
  width: 38px;
  height: 38px;
  background: var(--accent-cyan);
  color: #fff;
  border: none;
  font-size: 13px;
  box-shadow: 0 0 14px var(--accent-cyan-glow);
}

.btn-dock.play-btn:hover {
  transform: scale(1.08);
}

.btn-dock.speed-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-amber);
}

.slider-container {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.timeline-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-glow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.timeline-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-glow);
  cursor: pointer;
  border: none;
}

.timestamp-hud {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 130px;
}

.hud-label {
  font-size: 8px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.hud-date {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-glass-bright);
  border-radius: 4px;
}

/* Responsive */
@media screen and (max-width: 1024px) {
  .search-box { max-width: 220px; }
  .telemetry-drawer { width: 340px; }
}

@media screen and (max-width: 768px) {
  .top-nav {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }
  .brand-text .subtext { display: none; }
  .search-box { order: 3; max-width: 100%; }
  .utc-clock { display: none; }
  .telemetry-drawer {
    top: auto;
    bottom: 84px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 55vh;
  }
  .map-legend { display: none; }
  .timeline-dock { bottom: 10px; width: calc(100% - 20px); }
  .dock-inner { padding: 6px 14px; gap: 10px; }
  .timestamp-hud { min-width: fit-content; }
}

/* Live Sync Pulse Badge */
.live-dot-pulse {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-left: 6px;
  animation: live-glow 1.8s infinite ease-in-out;
}

@keyframes live-glow {
  0% { box-shadow: 0 0 4px rgba(16, 185, 129, 0.2); }
  50% { box-shadow: 0 0 12px rgba(16, 185, 129, 0.6); }
  100% { box-shadow: 0 0 4px rgba(16, 185, 129, 0.2); }
}

/* ==========================================================================
   Pro Search & Autocomplete Dropdown Styling
   ========================================================================== */
.search-container {
  position: relative;
  max-width: 380px;
  width: 100%;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 4px 6px 4px 14px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-box:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px var(--accent-cyan-glow), inset 0 1px 0 0 rgba(255, 255, 255, 0.3);
  background: var(--bg-pill-glass);
}

.search-icon {
  color: var(--text-muted);
  font-size: 13px;
  margin-right: 8px;
}

.search-box input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 500;
  outline: none;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 11px;
  transition: color 0.15s ease;
}

.search-clear-btn:hover {
  color: #fff;
}

.search-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: transform 0.15s ease, box-shadow 0.2s;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
  flex-shrink: 0;
}

.search-action-btn:hover {
  transform: scale(1.08);
}

/* Dropdown Menu */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1500;
  max-height: 420px;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--text-primary);
}

.suggestion-item:hover, .suggestion-item.active {
  background: var(--accent-cyan-glow);
  color: #fff;
}

.suggestion-icon {
  font-size: 12px;
  color: var(--accent-cyan);
  width: 18px;
  text-align: center;
}

.suggestion-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.suggestion-name {
  font-size: 12px;
  font-weight: 600;
}

.suggestion-coords {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.search-presets {
  border-top: 1px solid var(--border-glass-subtle);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preset-title {
  font-size: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.preset-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-1px);
}

.legend-arrow-box {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 54px;
}

.legend-arrow-box svg {
  display: block;
  overflow: visible;
  filter: drop-shadow(0 0 4px currentColor);
}

/* Dual-Vane Marine Wind Dial */
.compass-needle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 64px;
  margin-top: -32px;
  margin-left: -2px;
  transform: rotate(0deg);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* Cyan Arrow Head pointing in true flow direction matching map vectors */
.vane-flow-head {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 24px solid var(--accent-cyan);
  filter: drop-shadow(0 0 8px var(--accent-cyan-glow));
}

/* Center pivot */
.vane-center-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px #fff;
  z-index: 2;
}

/* Red Tail marking wind origin */
.vane-origin-tail {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 14px solid var(--accent-rose);
  opacity: 0.85;
}

.bearing-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 8px;
  min-width: 100px;
}

.bearing-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bearing-row strong {
  color: var(--accent-rose);
  font-size: 11px;
}

.bearing-row #cardinalText {
  color: var(--text-primary);
  font-weight: 700;
}

.bearing-flow-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  color: var(--text-muted);
}

.bearing-flow-sub strong {
  color: var(--accent-cyan);
}

.badge-sub {
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Direction Convention Switch (FROM vs TO) */
.dir-switch-container {
  display: flex;
  padding: 3px;
  gap: 2px;
}

.dir-switch-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dir-switch-btn.active {
  background: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

/* Style Switcher (Arrows vs Particles) */
.style-switch-container {
  display: flex;
  padding: 3px;
  gap: 2px;
}

.style-switch-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.style-switch-btn.active {
  background: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}
