/* ── Reset & tokens ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  overflow-x: hidden;
  width: 100%;
}

:root {
  --bg:        #eef2f7;
  --surface:   #ffffff;
  --surface2:  #e6edf6;
  --border:    #8897ab;
  --border2:   #bec9d8;
  --text:      #0f1724;
  --muted:     #2f3d4f;
  --dim:       #5a687a;

  --brand:     #005fa3;
  --brand-dim: #004b82;
  --teal:      #0b7a69;
  --teal-dim:  #086354;

  --safe:      #1f8f3a;
  --safe-bg:   rgba(31,143,58,.15);
  --caution:   #b56b00;
  --caution-bg:rgba(181,107,0,.16);
  --danger:    #b42318;
  --danger-bg: rgba(180,35,24,.14);

  --font: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Consolas", monospace;
  --r: 8px;
}

body {
  font-family: var(--font);
  background:
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 220px);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 60px;
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* ── Loading overlay ──────────────────────────────── */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 36, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.loading-content {
  text-align: center;
  color: #ffffff;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.topbar-centered {
  justify-content: center;
}

.modern-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  margin: 10px auto 8px auto;
  max-width: 1100px;
  width: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
  overflow: hidden;
}

body:not(.night-jump) .modern-header {
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
}

.header-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 10px 0 5px 0;
  gap: 1px;
}

/* Ensure station-bar never overlaps header */
.station-bar {
  margin-top: 0 !important;
  position: relative;
  z-index: 1;
  background: transparent;
  border-bottom: none;
  padding-top: 0;
}

.main-title-modern {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-align: center;
  margin-bottom: 0px;
}

.by-label-modern {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 0px;
  margin-top: 0px;
  text-align: center;
  opacity: 0.92;
}

.main-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.01em;
}

.dz-red {
  color: #ff0000;
  text-shadow: 2px 2px 0 #000, 4px 4px 0 #000;
}
.aloft-yellow {
  color: #ffd600;
  text-shadow: 2px 2px 0 #000, 4px 4px 0 #000;
}

.by-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: -2px;
}

.skyjunk-logo-small {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.topbar-sep {
  flex: 1;
}

.topbar-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.provider-badge {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-right: 6px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 600;
}

.topbar-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding-bottom: 6px;
  z-index: 10;
}

.btn-night {
  display: none !important; /* Hidden completely for now */
  position: absolute;
  top: 12px;
  right: 12px;
  height: 32px;
  padding: 0 10px;
  z-index: 20;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.btn-night.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* Night-vision-safe palette: dark base + low-glare warm/red accents */
body.night-jump {
  --bg: #0b0b0b;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: #5d4a4a;
  --border2: #3f3232;
  --text: #ffd7c2;
  --muted: #d39d83;
  --dim: #9a7161;
  --brand: #cc4b1f;
  --brand-dim: #a53a17;
  --teal: #c0612f;
  --teal-dim: #9d4f27;
  --safe: #d58e24;
  --safe-bg: rgba(213, 142, 36, .14);
  --caution: #e3651b;
  --caution-bg: rgba(227, 101, 27, .16);
  --danger: #f0472f;
  --danger-bg: rgba(240, 71, 47, .16);
}

/* ── Station input bar (Schulze-style search) ──── */
.station-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
  padding: 12px 16px;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0 !important;
}

.station-bar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field select {
  height: 44px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  padding: 0 12px;
  outline: none;
  transition: border-color 150ms;
}

.field input:focus,
.field select:focus {
  border-color: var(--brand);
}

.field.wide { flex: 1; }
.field.icao { min-width: 70px; flex: 0 1 auto; }

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.advanced-controls {
  display: none;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.advanced-controls.show {
  display: flex;
}

.btn-advanced {
  height: 40px;
  padding: 0 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--r);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  align-self: flex-start;
  cursor: pointer;
}

.btn-advanced:hover {
  border-color: var(--brand);
  color: var(--text);
}

.btn {
  height: 44px;
  padding: 0 18px;
  border-radius: var(--r);
  border: none;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 150ms, opacity 150ms;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-dim); }

.btn-geo {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-geo:hover { border-color: var(--teal); color: var(--teal); }

.btn-unit {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  height: 36px;
  padding: 0 12px;
}

.btn-unit.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* ── Main layout ────────────────────────────────── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

/* ── Left column ───────────────────────────────── */
.left-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  max-width: 100%;
  min-width: 0;
}

/* All card elements - ensure they don't exceed container */
.loc-card, .compass-card, .wind-table-wrap, .jr-card, .drift-card, .weather-card, .nearby-wrap {
  max-width: 100%;
  box-sizing: border-box;
}

/* ── Location card (Schulze style) ──────────────── */
.loc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
}

.loc-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.loc-detail {
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--mono);
  margin-bottom: 10px;
}

.loc-coords {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.coord-pill {
  font-family: var(--mono);
  font-size: 0.74rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 7px;
  color: var(--muted);
}

.weather-buttons {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-weather {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 120ms;
  font-family: inherit;
  flex: 1;
  min-width: 120px;
  justify-content: center;
}

.btn-weather:hover {
  background: var(--surface2);
  border-color: var(--brand);
  color: var(--brand);
}

.btn-weather svg {
  opacity: 0.7;
}

.btn-weather:hover svg {
  opacity: 1;
}

/* ── Compass card (Schulze style) ───────────────── */
.compass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  text-align: center;
}

.compass-card-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.compass-wrap {
  position: relative;
  width: 176px;
  height: 176px;
  margin: 0 auto 12px;
}

.compass-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: radial-gradient(circle at 50% 50%, rgba(31,111,235,.06), transparent 70%);
}

/* Cardinal labels */
.compass-cardinal {
  position: absolute;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--dim);
  line-height: 1;
}
.cardinal-n { top: 6px; left: 50%; transform: translateX(-50%); }
.cardinal-s { bottom: 6px; left: 50%; transform: translateX(-50%); }
.cardinal-e { right: 6px; top: 50%; transform: translateY(-50%); }
.cardinal-w { left: 6px; top: 50%; transform: translateY(-50%); }

/* Tick marks */
.compass-ticks {
  position: absolute;
  inset: 0;
}

.needle-group {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.needle-svg {
  width: 70%;
  height: 70%;
  transform-origin: center;
  transform: rotate(278deg);
  transition: transform 600ms cubic-bezier(.34,1.56,.64,1);
}

.compass-readout {
  font-family: var(--mono);
  font-size: 1rem;
}
.compass-readout strong { font-size: 1.45rem; color: var(--text); }
.compass-readout .muted { color: var(--muted); font-size: 0.86rem; }
.gust-inline {
  color: var(--caution);
  font-size: 1.05rem;
  font-weight: 700;
  margin-left: 6px;
}

/* ── Safety summary cards (skydiver additions) ──── */
.safety-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.safety-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px;
  position: relative;
  overflow: hidden;
}

.safety-tile::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.safety-tile.safe::before   { background: var(--safe); }
.safety-tile.caution::before{ background: var(--caution); }
.safety-tile.danger::before { background: var(--danger); }

.safety-tile-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.safety-tile-val {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 2px;
}

.safety-tile-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.safety-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 2px 5px;
  margin-top: 4px;
}
.badge-safe    { background: var(--safe-bg);    color: var(--safe); }
.badge-caution { background: var(--caution-bg); color: var(--caution); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }

.risk-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid var(--border);
}
.risk-dot.badge-safe { background: var(--safe); }
.risk-dot.badge-caution { background: var(--caution); }
.risk-dot.badge-danger { background: var(--danger); }

/* ── Right column ──────────────────────────────── */
.right-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 100%;
  min-width: 0;
}

/* ── Issued / valid header (USAirnet style) ───── */
.isu-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.isu-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.isu-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
}

.isu-val {
  font-family: var(--mono);
  font-size: 0.88rem;
}

.data-age {
  font-size: 0.68rem;
  font-weight: 500;
  margin-top: 2px;
}

.data-age.fresh {
  color: #22c55e;
}

.data-age.moderate {
  color: #f59e0b;
}

.data-age.stale {
  color: #ef4444;
}

.next-update {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 2px;
  opacity: 0.85;
}

.isu-sep { flex: 1; }

.unit-toggle {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ── Wind table (USAirnet style) ─────────────── */
.wind-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: visible;
  width: 100%;
  max-width: 100%;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  border-radius: 0 0 var(--r) var(--r);
}

.wind-table-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border2);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
}

.wind-table-header h2 {
  font-size: 0.92rem;
  font-weight: 600;
}

.wind-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border2);
  background: var(--surface2);
}

.src-chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--surface);
}

.src-chip strong {
  color: var(--text);
  font-weight: 600;
}

.src-chip-aloft {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #ffffff;
}

.src-chip-aloft strong,
.src-chip-aloft #src-aloft {
  color: #ffffff;
}

.src-chip-surface {
  background: #238636;
  border-color: #238636;
  color: #ffffff;
}

.src-chip-surface strong,
.src-chip-surface #src-surface {
  color: #ffffff;
}

.station-selector-advanced {
  position: relative;
  width: 100%;
}

.btn-station-picker {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 120ms, border-color 120ms;
}

.btn-station-picker:hover {
  background: var(--surface2);
  border-color: var(--brand);
}

.station-dropdown-icon {
  opacity: 0.6;
  transition: transform 150ms, opacity 150ms;
}

.btn-station-picker:hover .station-dropdown-icon {
  opacity: 1;
}

.station-selector-advanced.open .station-dropdown-icon {
  transform: rotate(180deg);
}

.station-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  max-height: 300px;
  overflow: hidden;
  z-index: 1000;
  display: none;
}

.station-selector-advanced.open .station-dropdown {
  display: block;
}

.station-dropdown-header {
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.station-dropdown-list {
  max-height: 250px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 1px;
  background: var(--border2);
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: var(--surface2);
}

th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border2);
  font-family: var(--mono);
  font-size: 0.85rem;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: rgba(0, 95, 163, .08); }

/* Row highlight bands (skydiver layers) */
tr.layer-canopy td:first-child { border-left: 3px solid var(--teal); }
tr.layer-ff      td:first-child { border-left: 3px solid var(--brand); }
tr.layer-high    td:first-child { border-left: 3px solid var(--caution); }
tr.layer-upper   td:first-child { border-left: 3px solid var(--danger); }

.alt-cell {
  font-weight: 600;
  color: var(--text);
}

.dir-cell {
  color: #0c4f83;
  font-weight: 600;
}

.dir-arrow {
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
  opacity: 0.7;
}

.temp-cell {
  color: var(--muted);
}

/* ── Column visibility ───────────────────────────── */
/* Layer now shown on all screen sizes including mobile */
th.col-layer, td.col-layer { display: table-cell; }
/* Risk hidden by default */
th.col-risk, td.col-risk   { display: none; }

/* Gust value */
.gust-val  { color: var(--caution); }
.gust-none { color: var(--dim); }

/* Surface / low-alt rows */
tr.layer-surface td:first-child { border-left: 3px solid var(--safe); }

/* ── Table horizontal scroll (mobile) ───────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Jump run card ───────────────────────────────── */
.jr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  text-align: center;
}
.jr-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.jr-sub {
  font-size: 0.72rem;
  color: var(--dim);
  margin-bottom: 10px;
}
#jr-compass { width: 176px; height: 176px; display: block; margin: 0 auto 10px; cursor: help; }
.jr-readout {
  font-family: var(--mono);
  font-size: 0.82rem;
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.jr-readout strong { color: var(--text); font-size: 1rem; }
.jr-method { font-size: 0.68rem; color: var(--dim); line-height: 1.45; }

/* ── Drift estimate row ────────────────────────── */
.drift-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
}

.drift-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.drift-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.drift-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  flex: 1;
  min-width: 100px;
}

.drift-item-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.drift-item-val {
  font-family: var(--mono);
  font-size: 1.0rem;
  font-weight: 600;
  margin-top: 3px;
}

.drift-item-sub {
  font-size: 0.7rem;
  color: var(--muted);
}

.weather-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
}

/* ── Nearby stations (USAirnet style) ─────────── */
.nearby-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  width: 100%;
}

.nearby-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border2);
  font-size: 0.85rem;
  font-weight: 600;
}

.nearby-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 1px;
  background: var(--border2);
}

.nearby-station {
  background: var(--surface);
  padding: 8px 10px;
  cursor: pointer;
  transition: background 120ms;
}

.nearby-station:hover { background: var(--surface2); }

.nearby-station.active {
  background: rgba(31,111,235,.15);
  border-bottom: 2px solid var(--brand);
}

.nearby-station.nearby-major {
  background: rgba(11,122,105,.12);
  border-left: 3px solid var(--teal);
}

.nearby-station.nearby-major:hover {
  background: rgba(11,122,105,.18);
}

.nearby-icao {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.nearby-dist {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 1px;
}

/* ── Footer note ──────────────────────────────── */
.footer-note {
  max-width: 1100px;
  margin: 16px auto 0;
  padding: 0 16px;
  font-size: 0.78rem;
  color: var(--dim);
  line-height: 1.5;
}

.footer-about-link {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.footer-about-link:hover { color: var(--text); text-decoration: underline; }

.pre-header-nav {
  text-align: center;
  padding: 0 16px 8px;
}

.footer-brand {
  max-width: 1100px;
  margin: 14px auto 0;
  padding: 0 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.footer-brand-copy {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.footer-brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.footer-brand-link:hover,
.footer-brand-link:focus,
.footer-brand-link:active,
.footer-brand-link:visited {
  color: inherit;
  text-decoration: none;
}

.footer-brand-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.footer-brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.footer-support {
  max-width: 1100px;
  margin: 14px auto 20px;
  padding: 0 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.raw-tools {
  max-width: 1100px;
  margin: 10px auto 0;
  padding: 0 16px;
  display: flex;
  justify-content: flex-end;
}

.raw-panel {
  max-width: 1100px;
  margin: 8px auto 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.45;
  white-space: pre-wrap;
  display: none;
  overflow-x: auto;
}

.raw-panel.show {
  display: block;
}

/* ── Responsive ───────────────────────────────── */
@media (min-width: 900px) {
  .main {
    max-width: 1280px;
    grid-template-columns: minmax(320px, 360px) 1fr;
  }
  .left-col {
    display: flex;
    flex-direction: column;
  }
  .topbar-meta { display: block; }
}

@media (max-width: 899px) {
  .main { grid-template-columns: 1fr; }
  .left-col { grid-template-columns: 1fr 1fr; }
  .loc-card  { grid-column: 1 / -1; }
  .jr-card   { grid-column: 1 / -1; }
  .safety-grid { grid-template-columns: repeat(4, 1fr); grid-column: 1 / -1; }
  .isu-header { gap: 10px; }
  .topbar-meta { display: none; }
}

@media (max-width: 600px) {
  .left-col { grid-template-columns: 1fr; }
  .compass-card { grid-column: 1 / -1; }
  .compass-wrap { width: 140px; height: 140px; }
  .safety-grid  { grid-template-columns: 1fr 1fr; }
  .drift-row    { flex-direction: column; }
  .drift-item   { min-width: unset; }
  .isu-header   { flex-direction: column; align-items: flex-start; }
  .unit-toggle  { align-self: flex-start; }
  .field.icao   { min-width: 60px; }
}

@media (max-width: 520px) {
  html { margin: 0; width: 100%; box-sizing: border-box; }
  body { padding-bottom: 20px; margin: 0; width: 100%; box-sizing: border-box; }
  .station-bar { padding: 12px 16px; }
  .station-bar-inner { max-width: 100%; margin: 0; flex-direction: column; align-items: stretch; gap: 8px; }
  .field-stack { width: 100%; }
  .compass-wrap { width: 120px; height: 120px; }
  .field { gap: 6px; }
  .field input, .field select { font-size: 16px; height: 44px; }
  .field.icao { width: 100%; }
  .field.wide { width: 100%; }
  .advanced-controls { width: 100%; flex-direction: column; align-items: stretch; }
  .nearby-list { grid-template-columns: repeat(3, 1fr); }
  .jr-readout { gap: 8px; flex-direction: column; }
  .topbar { padding: 0 16px; height: auto; }
  .topbar-logo { font-size: 0.95rem; }
  .btn-night { font-size: 0.75rem; padding: 0 10px; height: 36px; }
  .btn-primary, .btn-geo, .btn { height: 44px; font-size: 0.9rem; width: 100%; }
  .main { max-width: 100%; padding: 16px; gap: 12px; margin: 0; }
  .loc-card, .compass-card, .wind-table-wrap, .jr-card, .drift-card, .weather-card, .nearby-wrap { padding: 12px; }
  .wind-table-wrap { overflow: visible; }
  .table-scroll { overflow-x: auto; width: 100%; }
  table { font-size: 0.85rem; }
  th, td { padding: 8px 10px; }
  .compass-wrap { width: 140px; height: 140px; }
  .drift-item { min-width: unset; padding: 8px 10px; }
  .drift-item-val { font-size: 0.95rem; }
  .drift-row { gap: 8px; }
  .footer-note, .footer-brand, .footer-support { padding: 0 16px; }
  .raw-tools { padding: 0 12px; }
  .raw-panel { padding: 10px; margin: 8px auto 0; }
}

@media (max-width: 380px) {
  .topbar-logo small { display: none; }
  .topbar { padding: 0 10px; }
  .nearby-list { grid-template-columns: repeat(2, 1fr); }
  .safety-grid { grid-template-columns: 1fr; }
  .isu-header { padding: 8px 10px; gap: 8px; }
  .isu-val { font-size: 0.8rem; }
  .main { padding: 10px 10px 0; }
  .station-bar { padding: 10px; }
  .station-bar-inner { gap: 6px; }
  .field.icao { min-width: 55px; font-size: 0.85rem; }
  .btn { font-size: 0.85rem; padding: 0 10px; }
  th, td { padding: 6px 8px; font-size: 0.75rem; }
  .compass-wrap { width: 100px; height: 100px; }
}

/* ── Subtle entrance animation ──────────────────── */
.fade-in {
  opacity: 0;
  animation: fi 400ms ease forwards;
}
.fi-1 { animation-delay: 60ms; }
.fi-2 { animation-delay: 120ms; }
.fi-3 { animation-delay: 180ms; }
.fi-4 { animation-delay: 240ms; }
.fi-5 { animation-delay: 300ms; }

@keyframes fi {
  to { opacity: 1; }
}
