:root {
  --bg: #071018;
  --panel: rgba(8, 14, 22, 0.82);
  --panel-edge: rgba(140, 170, 190, 0.14);
  --line: rgba(140, 170, 190, 0.14);
  --text: #eef4f8;
  --muted: #8a9bab;
  --accent: #5fd0c8;
  --accent-dim: rgba(95, 208, 200, 0.12);
  --warn: #ff7a7a;
  --ink: #0a121a;
  --font-ui: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-display: "Sora", "IBM Plex Sans", sans-serif;
  --map-trail: #5fd0c8;
  --map-route-ahead: #7d8ea3;
  --plane-color: #5fd0c8;
  --nearby-color: #54697f;
  --map-grade: none;
  --atmo-a: transparent;
  --atmo-b: transparent;
  --atmo-c: transparent;
  --sky-chip-color: rgba(238, 244, 248, 0.72);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  transition: background 1.4s ease, color 0.8s ease;
}

/* z-index atrapa controles Leaflet (attribution z=1000) para que no tapen el lower-third. */
#map { position: absolute; inset: 0; z-index: 0; background: var(--bg); }

#map .leaflet-tile-pane {
  filter: var(--map-grade);
  transition: filter 1.6s ease;
}

#map .map-base-tiles {
  transition: opacity 0.9s ease;
}

#map-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 350;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 70% at 50% 42%, var(--atmo-a), transparent 62%),
    radial-gradient(ellipse 120% 80% at 50% 100%, var(--atmo-b), transparent 55%),
    linear-gradient(180deg, var(--atmo-c), transparent 28%, transparent 72%, var(--atmo-b));
  transition: opacity 1.2s ease, background 1.6s ease;
  mix-blend-mode: soft-light;
  opacity: 0.9;
}

body.mood-approach #map-atmosphere {
  mix-blend-mode: screen;
  opacity: 0.55;
}

body.mood-approach #map-atmosphere::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 160vmax;
  height: 160vmax;
  margin-left: -80vmax;
  margin-top: -80vmax;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(224, 164, 90, 0.1) 32deg,
    transparent 70deg
  );
  animation: radar-spin 8s linear infinite;
  mix-blend-mode: screen;
  opacity: 0.8;
  mask-image: radial-gradient(circle, black 0%, transparent 52%);
  -webkit-mask-image: radial-gradient(circle, black 0%, transparent 52%);
}

@keyframes radar-spin {
  to { transform: rotate(360deg); }
}

#sky-chip {
  position: absolute;
  right: 16px;
  bottom: 18px;
  z-index: 510;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid rgba(140, 170, 190, 0.18);
  border-radius: 3px;
  background: rgba(8, 14, 22, 0.72);
  backdrop-filter: blur(10px);
  pointer-events: none;
  transition: opacity 0.6s ease, border-color 0.8s ease, background 0.8s ease;
}

#sky-chip.hidden { display: none; }

#terrain-chip {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 450;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 132px;
  padding: 8px 12px 6px;
  border: 1px solid rgba(140, 170, 190, 0.18);
  border-radius: 3px;
  background: rgba(8, 14, 22, 0.72);
  backdrop-filter: blur(10px);
  pointer-events: none;
  transition: opacity 0.6s ease, border-color 0.8s ease, background 0.8s ease;
}

#terrain-chip.hidden { display: none; }

#wx-radar-chip {
  display: none !important;
}

#wx-radar-chip.active {
  border-color: rgba(95, 208, 200, 0.45);
  color: var(--accent);
  box-shadow: 0 0 16px rgba(95, 208, 200, 0.18);
}

#wx-radar-chip.loading {
  border-color: rgba(255, 180, 84, 0.45);
  color: #ffb454;
  animation: wx-radar-loading 0.9s ease-in-out infinite alternate;
}

#wx-radar-chip.error {
  border-color: rgba(255, 118, 118, 0.45);
  color: #ff8a8a;
}

#wx-radar-chip.pulse {
  animation: wx-radar-pulse 0.85s ease-in-out 4 alternate;
}

@keyframes wx-radar-pulse {
  from { box-shadow: 0 0 8px rgba(255, 180, 84, 0.2); border-color: rgba(255, 180, 84, 0.35); }
  to { box-shadow: 0 0 22px rgba(255, 180, 84, 0.55); border-color: rgba(255, 180, 84, 0.75); }
}

@keyframes wx-radar-loading {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

body.has-airport-cam #wx-radar-chip {
  top: 56px;
}

/* Keep map chrome clear of the storm upper-third. */
body.has-storm-ut {
  --storm-ut-h: 72px;
}

body.has-storm-ut #wx-radar-chip,
body.has-storm-ut.has-airport-cam #wx-radar-chip {
  top: calc(var(--storm-ut-h) + 10px);
}

body.has-storm-ut #airport-cam.links-only {
  top: calc(var(--storm-ut-h) + 10px);
  transition: top 0.25s ease;
}

body.has-storm-ut #dest-board,
body.has-storm-ut.has-airport-cam #dest-board,
body.has-storm-ut #divert-board,
body.has-storm-ut.has-airport-cam #divert-board {
  top: calc(var(--storm-ut-h) + 52px);
  transition: top 0.25s ease;
}

body.has-storm-ut.has-airport-cam #sky-chip {
  top: calc(var(--storm-ut-h) + 10px);
}

#map .wx-radar-tiles {
  mix-blend-mode: screen;
  transition: opacity 0.35s ease;
}

.tn-tag {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.tn-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text);
  letter-spacing: 0.02em;
}

.tn-sep {
  color: var(--muted);
  opacity: 0.55;
}

#tn-elev {
  color: var(--text);
}

#tn-agl {
  color: var(--accent);
  font-weight: 560;
}

.tn-profile {
  width: 120px;
  height: 28px;
  margin-top: 2px;
  opacity: 0.9;
}

.tn-profile .tn-fill {
  fill: rgba(95, 208, 200, 0.14);
}

.tn-profile .tn-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.85;
}

.tn-profile .tn-now {
  fill: var(--accent);
}

#sky-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

#sky-local {
  font-size: 11px;
  color: var(--sky-chip-color);
  font-variant-numeric: tabular-nums;
}

/* --- cielos --- */

body.sky-night {
  --bg: #050b12;
  --accent: #5fd0c8;
  --accent-dim: rgba(95, 208, 200, 0.12);
  --map-trail: #5fd0c8;
  --map-route-ahead: #6a7c90;
  --plane-color: #5fd0c8;
  --map-grade: brightness(0.92) saturate(1.05) hue-rotate(8deg);
  --atmo-a: rgba(40, 90, 130, 0.22);
  --atmo-b: rgba(4, 10, 20, 0.55);
  --atmo-c: rgba(12, 28, 48, 0.35);
}

body.sky-dawn {
  --bg: #120e10;
  --accent: #f0a878;
  --accent-dim: rgba(240, 168, 120, 0.14);
  --map-trail: #f0a878;
  --map-route-ahead: #8a7468;
  --plane-color: #ffc49a;
  --map-grade: brightness(1.05) sepia(0.28) saturate(1.2) hue-rotate(-18deg);
  --atmo-a: rgba(255, 160, 100, 0.28);
  --atmo-b: rgba(40, 18, 28, 0.45);
  --atmo-c: rgba(255, 140, 90, 0.22);
}

body.sky-day {
  --bg: #071018;
  --accent: #6ec8e0;
  --accent-dim: rgba(110, 200, 224, 0.12);
  --map-trail: #6ec8e0;
  --map-route-ahead: #7a90a4;
  --plane-color: #8ad6ea;
  --map-grade: brightness(1.04) contrast(1.04) saturate(1.12) hue-rotate(6deg);
  --atmo-a: rgba(70, 130, 170, 0.14);
  --atmo-b: rgba(4, 12, 22, 0.4);
  --atmo-c: rgba(40, 80, 110, 0.12);
}

body.sky-dusk {
  --bg: #100c12;
  --accent: #e08a6a;
  --accent-dim: rgba(224, 138, 106, 0.14);
  --map-trail: #e08a6a;
  --map-route-ahead: #7a6a68;
  --plane-color: #f0a090;
  --map-grade: brightness(0.98) sepia(0.4) saturate(1.25) hue-rotate(8deg);
  --atmo-a: rgba(220, 100, 70, 0.26);
  --atmo-b: rgba(30, 12, 24, 0.5);
  --atmo-c: rgba(180, 70, 50, 0.2);
}

body.mood-approach {
  --accent: #e0a45a;
  --accent-dim: rgba(224, 164, 90, 0.16);
  --map-trail: #e0a45a;
  --map-route-ahead: #8a7a68;
  --plane-color: #f0c080;
  --map-grade: brightness(1.08) contrast(1.12) saturate(1.35) sepia(0.18) hue-rotate(-8deg);
  --atmo-a: rgba(224, 164, 90, 0.2);
  --atmo-b: rgba(20, 12, 6, 0.42);
  --atmo-c: rgba(224, 164, 90, 0.12);
}

body.mood-landed {
  --accent: #5dffa8;
  --map-trail: #5dffa8;
  --plane-color: #5dffa8;
}

body.map-touchdown #map-atmosphere {
  animation: atmo-touch 1.4s ease-out;
}

@keyframes atmo-touch {
  0% { background: radial-gradient(circle at 50% 50%, rgba(93, 255, 168, 0.55), transparent 40%); opacity: 1; }
  100% { opacity: 0.9; }
}

#panel {
  position: absolute;
  top: 16px;
  left: 16px;
  bottom: 16px;
  z-index: 500;
  width: 348px;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  background:
    linear-gradient(165deg, rgba(18, 34, 48, 0.55) 0%, transparent 42%),
    linear-gradient(180deg, rgba(8, 14, 22, 0.92), rgba(6, 11, 18, 0.88)),
    var(--panel);
  backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 170, 190, 0.25) transparent;
}

#panel::-webkit-scrollbar { width: 5px; }
#panel::-webkit-scrollbar-thumb {
  background: rgba(140, 170, 190, 0.25);
  border-radius: 3px;
}

#panel header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-shrink: 0;
}

#panel h1 {
  margin: 0;
  line-height: 0;
}

#panel h1 .brand-logo {
  display: block;
  height: 22px;
  width: auto;
  max-width: 100%;
}

.identity {
  flex-shrink: 0;
  padding-bottom: 2px;
}

.id-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.id-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  min-width: 0;
  max-width: 48%;
  padding-bottom: 2px;
  text-align: right;
}

.id-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.status-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-chip.phase-approach {
  background: color-mix(in srgb, #e0a45a 16%, transparent);
  border-color: color-mix(in srgb, #e0a45a 28%, transparent);
  color: #e0a45a;
}

.status-chip.phase-landed {
  background: color-mix(in srgb, #5dffa8 14%, transparent);
  border-color: color-mix(in srgb, #5dffa8 24%, transparent);
  color: #5dffa8;
}

.status-chip.phase-cruise {
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  border-color: color-mix(in srgb, var(--muted) 18%, transparent);
  color: var(--muted);
}

.status-chip.is-locked {
  background: color-mix(in srgb, #ff7a7a 14%, transparent);
  border-color: color-mix(in srgb, #ff7a7a 24%, transparent);
  color: #ff7a7a;
}

.status-chip.is-until-land {
  background: color-mix(in srgb, #e0a45a 14%, transparent);
  border-color: color-mix(in srgb, #e0a45a 24%, transparent);
  color: #e0a45a;
}

.status-chip.is-emergency {
  background: rgba(255, 30, 30, 0.15);
  border-color: color-mix(in srgb, #ff2a2a 30%, transparent);
  color: #ff4d4d;
  animation: em-squawk-blink 0.9s steps(2, end) infinite;
}

.watch-hint {
  margin: 6px 0 0;
  min-height: 0;
  font-size: 10px;
  letter-spacing: 0.03em;
  color: var(--muted);
  line-height: 1.35;
  opacity: 0.85;
}

.watch-hint:empty,
.watch-hint[hidden] {
  display: none;
}

.watch-hint[data-kind="recall"] {
  color: #e0a45a;
  opacity: 1;
  padding-left: 8px;
  border-left: 2px solid #e0a45a;
  font-weight: 500;
}

.watch-hint[data-kind="watch"] {
  color: var(--muted);
}

.id-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.eta-line.schedule {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.eta-line.schedule.early { color: #5dffa8; }
.eta-line.schedule.late { color: #ffb454; }
.eta-line.schedule.ontime { color: var(--accent); }

#silence-exit {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 700;
  padding: 8px 12px;
  border: 1px solid var(--panel-edge);
  border-radius: 3px;
  background: rgba(8, 14, 22, 0.82);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

#silence-exit.hidden { display: none; }

body.ui-silence #panel,
body.ui-silence #weather-bar,
body.ui-silence #sky-chip,
body.ui-silence #terrain-chip,
body.ui-silence #airport-cam {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

body.ui-silence #map-atmosphere {
  opacity: 0.55;
}

body:not(.ui-silence) #panel,
body:not(.ui-silence) #weather-bar,
body:not(.ui-silence) #sky-chip,
body:not(.ui-silence) #terrain-chip,
body:not(.ui-silence) #airport-cam {
  transition: opacity 0.45s ease;
}

.block {
  padding-top: 16px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.block:first-of-type,
.flight-panel > .block:first-child {
  padding-top: 12px;
  margin-top: 0;
  border-top: none;
}

.flight-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 170, 190, 0.25) transparent;
}

.flight-panel::-webkit-scrollbar { width: 5px; }
.flight-panel::-webkit-scrollbar-thumb {
  background: rgba(140, 170, 190, 0.25);
  border-radius: 3px;
}


/* Callsign HUD (radar console) */
.flip-board {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.flip-mode {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
  padding-left: 1px;
}

.callsign-display {
  position: relative;
  display: inline-block;
  padding-bottom: 3px;
}

.callsign-text {
  display: block;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text);
  line-height: 1.05;
  white-space: nowrap;
  transition: opacity 0.14s ease;
}

.callsign-text.swapping {
  opacity: 0.28;
}

.callsign-scan {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  opacity: 0.4;
  transform-origin: left center;
  animation: callsign-scan 2.6s ease-in-out infinite;
}

@keyframes callsign-scan {
  0%, 100% { opacity: 0.22; transform: scaleX(0.82); }
  50% { opacity: 0.62; transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .callsign-text { transition: none; }
  .callsign-text.swapping { opacity: 1; }
  .callsign-scan { animation: none; opacity: 0.38; }
}

.airline {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-type {
  font-size: 11px;
  color: var(--text);
  opacity: 0.78;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-ids {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-type:empty,
.ac-ids:empty { display: none; }

.sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.4;
}

.label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.label.spaced { margin-top: 16px; }
.chart-now {
  float: right;
  color: var(--text);
  letter-spacing: 0;
  text-transform: none;
  font-size: 11px;
  font-family: var(--font-ui);
  font-weight: 500;
}

/* --- ruta: pase digital (identidad ≠ dest-board) --- */

.route-block {
  position: relative;
  margin: 12px 0 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid rgba(140, 170, 190, 0.2) !important;
  border-radius: 4px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 10px,
      rgba(140, 170, 190, 0.035) 10px 11px
    ),
    linear-gradient(180deg, rgba(10, 16, 24, 0.94), rgba(7, 12, 18, 0.9));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

.route-pass {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  min-height: 0;
  align-items: stretch;
}

.route-pass-main {
  min-width: 0;
  padding: 12px 12px 12px 14px;
  border-right: 1px dashed rgba(140, 170, 190, 0.28);
}

.route-pass-stub {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  gap: 0;
  padding: 0;
  margin: 0;
  text-align: center;
  min-height: 100%;
  background: transparent;
}

.stub-block {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 12px 6px;
  border-radius: 0;
  transition: background 0.35s ease;
}

/* Degradé leve a todo el ancho/alto del stub (como al principio) */
.stub-block.ontime {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 22%, transparent) 0%,
    color-mix(in srgb, var(--accent) 6%, transparent) 55%,
    transparent 100%
  );
}
.stub-block.early {
  background: linear-gradient(
    180deg,
    rgba(93, 255, 168, 0.2) 0%,
    rgba(93, 255, 168, 0.05) 55%,
    transparent 100%
  );
}
.stub-block.late {
  background: linear-gradient(
    180deg,
    rgba(255, 180, 84, 0.22) 0%,
    rgba(255, 180, 84, 0.06) 55%,
    transparent 100%
  );
}

.stub-rule {
  width: 100%;
  height: 0;
  border: 0;
  border-top: 1px solid rgba(140, 170, 190, 0.22);
  background: transparent;
  flex-shrink: 0;
  margin: 0;
}

.stub-kicker {
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.route-pass-stub .stub-clock {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--text);
  min-height: 1.1em;
}
.route-pass-stub .stub-clock-sm {
  font-size: 13px;
  font-weight: 600;
}

/* Hora con tinte suave según el estado del bloque */
.stub-block.ontime .stub-clock { color: var(--accent); }
.stub-block.early .stub-clock { color: #5dffa8; }
.stub-block.late .stub-clock { color: #ffb454; }

.route-pass-stub .schedule {
  margin: 0;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.25;
  max-width: 72px;
}
.stub-block.ontime .schedule { color: var(--accent); }
.stub-block.early .schedule { color: #5dffa8; }
.stub-block.late .schedule { color: #ffb454; }

.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.ticket-brand {
  color: var(--muted);
  letter-spacing: 0.18em;
}

.ticket-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.12em;
}

.ticket-live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: ticket-live 1.8s ease-in-out infinite;
}

@keyframes ticket-live {
  50% {
    opacity: 0.35;
    box-shadow: 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
  }
}

.route-hero {
  display: grid;
  grid-template-columns: minmax(52px, auto) minmax(72px, 1fr) minmax(52px, auto);
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 0;
  padding-bottom: 14px;
}

.endpoint { display: flex; flex-direction: column; min-width: 0; }
.endpoint.right { text-align: right; align-items: flex-end; }

.code {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--text);
}

.place {
  margin-top: 5px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 88px;
}

.route-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 0 2px;
}

.route-line {
  position: relative;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: var(--line);
  overflow: visible;
}

.route-line::before,
.route-line::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
}

.route-line::before { left: -1px; background: var(--accent); }
.route-line::after { right: -1px; }

.route-line span {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 55%, transparent)
  );
  transition: width 1s linear;
}

/* ✈ base ~↗; giro antihorario para que mire a la derecha */
.route-line span::after {
  content: "✈";
  position: absolute;
  right: -8px;
  top: 50%;
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  transform: translateY(-58%) rotate(-2deg);
  text-shadow: 0 0 6px color-mix(in srgb, var(--accent) 50%, transparent);
}

.route-pct {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.metrics.time-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 14px;
  padding: 12px 0 2px;
  margin-top: 0;
  border-top: 1px dashed rgba(140, 170, 190, 0.32);
}

.distance-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px 14px;
  margin-top: 10px;
}

.distance-box {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--muted) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 12%, transparent);
  border-radius: 2px;
}

.distance-box .m-lab {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 8px;
  letter-spacing: 0.12em;
  opacity: 1;
}

.distance-box .m-val {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.distance-strip .m-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.distance-strip .m-sec {
  font-size: 9px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metrics.time-strip .metric {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.metrics.telemetry {
  gap: 12px 14px;
}

.metrics.telemetry .metric {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--muted) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 12%, transparent);
  border-radius: 2px;
}

.metrics.telemetry .m-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.metrics.telemetry .m-row .m-val {
  flex: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metrics.telemetry .m-row .m-sec {
  flex: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metrics.telemetry .m-lab {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 8px;
  letter-spacing: 0.12em;
  opacity: 1;
}

.metrics.telemetry .m-val {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.m-sec {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: normal;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--muted) 78%, transparent);
  white-space: nowrap;
}

.metrics.telemetry #vspeed.is-up {
  color: #5dffa8;
}

.metrics.telemetry #vspeed.is-down {
  color: color-mix(in srgb, var(--warn) 80%, var(--text));
}

.metric {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  min-width: 0;
}

.m-val {
  display: block;
  font-size: 17px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metrics.time-strip .m-val {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow: visible;
  text-overflow: clip;
}

#elapsed,
#eta {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
}

.metrics.time-strip #eta { color: var(--accent); }

.m-lab {
  display: block;
  margin-top: 3px;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.9;
}

.route-foot {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.eta-line {
  font-size: 12px;
  color: var(--muted);
  min-height: 1.2em;
  letter-spacing: 0.02em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  row-gap: 4px;
}

.tags:empty { display: none; }

.tag {
  padding: 0 7px;
  border: 0;
  border-radius: 0;
  border-right: 1px solid rgba(140, 170, 190, 0.22);
  font-size: 10px;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: transparent;
  line-height: 1.3;
}
.tag:first-child { padding-left: 0; }
.tag:last-child { border-right: 0; padding-right: 0; }

.tag.accent {
  border-color: rgba(140, 170, 190, 0.22);
  color: var(--accent);
  background: transparent;
  font-weight: 600;
}

.tag.clock {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 0 7px;
  font-variant-numeric: tabular-nums;
}

.tag.clock .clk-arrow {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.9;
}

.tag.clock .clk-digits {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1;
}

.tag.clock .clk-z {
  font-family: var(--font-ui);
  font-size: 8px;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.tag.clock.ontime {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
  background: transparent;
}

.tag.clock.early {
  border-color: rgba(93, 255, 168, 0.4);
  color: #5dffa8;
  background: transparent;
}

.tag.clock.late {
  border-color: rgba(255, 180, 84, 0.45);
  color: #ffb454;
  background: transparent;
}

/* --- estadisticas (legacy) --- */

.stats { display: grid; gap: 9px 10px; margin: 0; }
.stats.two { grid-template-columns: 1fr 1fr; }
.stats div { margin: 0; min-width: 0; }
.stats dt { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stats dd {
  margin: 2px 0 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- graficas --- */

.charts-block { padding-bottom: 8px; }

canvas {
  display: block;
  width: 100%;
  height: 54px;
  margin-bottom: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

/* --- controles --- */

.bar {
  height: 2px;
  border-radius: 0;
  background: var(--line);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.9s linear;
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.chips button {
  flex: 1;
  min-width: 42px;
  padding: 7px 4px;
  font-size: 11px;
  border-radius: 3px;
}

.custom-interval {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.custom-interval input {
  min-width: 0;
  flex: 1;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: none;
  background: rgba(4, 10, 16, 0.35);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.custom-interval input:focus {
  border-color: rgba(95, 208, 200, 0.55);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.custom-interval input.invalid {
  border-color: var(--warn);
}

.custom-interval button {
  padding: 7px 10px;
  font-size: 11px;
}

.custom-interval-hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.custom-interval-hint.error {
  color: var(--warn);
}

.buttons { display: flex; gap: 8px; margin-top: 16px; }

button {
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.buttons button { flex: 1; }
button:hover { border-color: rgba(95, 208, 200, 0.55); color: var(--accent); }
button.active {
  border-color: rgba(95, 208, 200, 0.55);
  color: var(--accent);
  background: var(--accent-dim);
}

#status { font-size: 12px; line-height: 1.45; }
.error { margin-top: 6px; font-size: 12px; color: var(--warn); }
.hidden { display: none; }

#history {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

#history .empty { list-style: none; margin-left: -18px; }

/* --- mapa --- */

.plane svg { display: block; }
.plane.target svg { filter: drop-shadow(0 0 6px var(--accent)); }

.plane.pulse {
  animation: plane-pulse var(--pulse-period, 2.4s) ease-in-out infinite;
  transform-origin: center center;
}

@keyframes plane-pulse {
  0%, 100% { opacity: 0.82; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(1.25); }
}

/* Destello de aviones cercanos: mas fuerte cuanto mas cerca. */
.plane.glow svg {
  animation: nb-glow var(--glow-period, 2s) ease-in-out infinite;
}

@keyframes nb-glow {
  0%, 100% {
    filter: drop-shadow(0 0 1px rgba(95, 208, 200, 0.15));
  }
  50% {
    filter: drop-shadow(0 0 var(--glow-size, 6px) rgba(95, 208, 200, var(--glow-alpha, 0.6)));
  }
}

.airport-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg);
}

.airport-dot.divert {
  width: 11px;
  height: 11px;
  border-color: #ff6b6b;
  background: rgba(40, 0, 0, 0.85);
  box-shadow: 0 0 10px rgba(255, 50, 50, 0.55);
}

.leaflet-tooltip.divert-tip {
  background: rgba(28, 0, 0, 0.88);
  border: 1px solid rgba(255, 80, 80, 0.45);
  color: #ffd6d6;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 3px 7px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.leaflet-container { background: var(--bg); }
.leaflet-control-attribution { background: rgba(11, 15, 20, 0.7) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-tooltip {
  background: rgba(8, 14, 22, 0.94);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 11px;
  border-radius: 3px;
}
.leaflet-tooltip::before { display: none; }

.leaflet-tooltip.nearby-tip {
  padding: 6px 8px;
  border-radius: 3px;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
}
.nb-tip strong {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.nb-tip div + div {
  color: var(--muted);
  font-size: 10px;
}

/* --- fase / modos --- */

.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.pill.approach { border-color: #e0a45a; color: #e0a45a; }
.pill.landed { border-color: #5dffa8; color: #5dffa8; }
.pill.lock { border-color: #ff7a7a; color: #ff7a7a; }
.pill.lock.emergency {
  border-color: #ff2a2a;
  color: #ff4d4d;
  background: rgba(255, 30, 30, 0.12);
  animation: em-squawk-blink 0.9s steps(2, end) infinite;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.check input { accent-color: var(--accent); }

#airport-mode-block { display: none; }
body.mode-airport #airport-mode-block { display: block; }
body.mode-until_land #interval-chips,
body.mode-until_land .custom-interval,
body.mode-until_land .custom-interval-hint,
body.mode-until_land .label.spaced:has(+ #interval-chips) { opacity: 0.35; pointer-events: none; }

select#airport-select {
  width: 100%;
  margin-bottom: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.board ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 140px;
  overflow-y: auto;
}

.board li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  cursor: pointer;
  color: var(--muted);
}

.board li:hover { color: var(--accent); }
.board li .code { color: var(--text); font-weight: 600; }
.board li.empty { cursor: default; border: none; }

/* --- lower third: clima dep/arr (una fila, rota) --- */

#weather-bar {
  position: absolute;
  left: calc(364px + 16px);
  right: 16px;
  bottom: 12px;
  z-index: 500;
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-height: 52px;
  padding: 0 10px 0 0;
  border: 1px solid var(--panel-edge);
  border-radius: 2px;
  background: rgba(6, 11, 18, 0.92);
  backdrop-filter: blur(12px) saturate(1.05);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  overflow: visible;
}

#weather-bar.hidden { display: none; }

#weather-bar.single .wx-dots { display: none; }

.wx-aside-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  margin-left: auto;
  align-self: center;
  padding-right: 0;
}

.wx-aside {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 0 12px;
  border-left: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 0;
  max-width: min(340px, 38vw);
  align-self: center;
}

.wx-landing-near {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 22px);
  width: auto;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  padding: 9px 10px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(8, 14, 22, 0.96);
  backdrop-filter: blur(10px) saturate(1.02);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
  z-index: 8;
}

.wx-landing-near.is-open {
  pointer-events: auto;
}

.wx-landing-near.is-up {
  opacity: 1;
  transform: translateY(0);
  animation: wx-near-up 0.32s ease;
}

@keyframes wx-near-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wx-landing-near-title {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  white-space: nowrap;
}

.wx-landing-near-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wx-landing-near-list li {
  display: grid;
  grid-template-columns: minmax(4.8ch, 1fr) auto auto;
  column-gap: 8px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}

.wx-landing-near-list li.is-today {
  margin: 0 -4px 2px;
  padding: 4px 6px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.wx-landing-near-list li.is-today .near-day {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.wx-landing-near-list li.is-today .near-count {
  font-size: 15px;
  color: var(--text);
}

.wx-landing-near-list li.is-today .near-delta {
  color: var(--muted);
}

.wx-landing-near-list .near-day {
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.wx-landing-near-list .near-count {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 650;
  color: var(--accent);
  text-align: right;
  white-space: nowrap;
}

.wx-landing-near-list .near-delta {
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.wx-landing-near-list .near-delta.pos { color: #7ec8a0; }
.wx-landing-near-list .near-delta.neg { color: #c8907e; }
.wx-landing-near-list .near-delta.same { color: var(--muted); }

.wx-landing-near[data-page="most"] .wx-landing-near-list li,
.wx-landing-near[data-page="least"] .wx-landing-near-list li {
  grid-template-columns: minmax(4.8ch, 1fr) auto auto;
}

.wx-landing-near[data-page="least"] .wx-landing-near-list li:first-child .near-day,
.wx-landing-near[data-page="least"] .wx-landing-near-list li:first-child .near-count {
  color: var(--muted);
}

.wx-aside.swap {
  animation: wx-lt-in 0.35s ease;
}

.wx-aside-tag {
  font-size: 7px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.wx-aside strong {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1;
}

.wx-aside-sub {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wx-aside.is-time .wx-aside-tag {
  flex-shrink: 0;
}

.wx-aside.is-time .wx-aside-sub {
  max-width: min(220px, 28vw);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
  flex-shrink: 1;
  min-width: 0;
}

.wx-aside-clock {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f2f5f8;
}

/* Emergencia en el lower third: rojo, tipificado por squawk. */
.wx-aside.is-emergency {
  border-left-color: rgba(255, 70, 70, 0.55);
}

.wx-aside.is-emergency .wx-aside-tag,
.wx-aside.is-emergency strong,
.wx-aside.is-emergency .wx-aside-sub {
  color: #ff4d4d;
  text-shadow: 0 0 12px rgba(255, 40, 40, 0.35);
}

.wx-aside.em-7500 strong { color: #ff2a2a; }
.wx-aside.em-7600 strong { color: #ff6b4a; }
.wx-aside.em-7700 strong { color: #ff4d4d; }

.wx-aside.is-clear .wx-aside-tag,
.wx-aside.is-clear strong,
.wx-aside.is-clear .wx-aside-sub {
  color: var(--muted);
  text-shadow: none;
}

.wx-aside.is-watch {
  border-left-color: rgba(120, 180, 220, 0.45);
}

.wx-aside.is-atc {
  border-left-color: rgba(90, 200, 160, 0.5);
}

.wx-aside.is-atc .wx-aside-tag,
.wx-aside.is-atc .wx-aside-sub {
  color: #9fd9c0;
}

.wx-aside.is-atc .wx-aside-clock {
  color: #c8f0dc;
}

.wx-aside.is-atc:not(.is-atc-off) {
  border-left-color: rgba(70, 220, 160, 0.75);
}

.wx-aside.is-atc:not(.is-atc-off) .wx-aside-sub {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #b8ecd0;
}

.wx-atc-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  flex-shrink: 0;
}

.wx-atc-eq i {
  display: block;
  width: 2px;
  height: 100%;
  border-radius: 1px;
  background: linear-gradient(180deg, #7dffc0, #2bb87a);
  transform-origin: bottom center;
  animation: wx-atc-eq 0.9s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(80, 255, 180, 0.35);
}

.wx-atc-eq i:nth-child(1) { animation-duration: 0.72s; animation-delay: -0.35s; }
.wx-atc-eq i:nth-child(2) { animation-duration: 0.95s; animation-delay: -0.15s; }
.wx-atc-eq i:nth-child(3) { animation-duration: 0.68s; animation-delay: -0.55s; }
.wx-atc-eq i:nth-child(4) { animation-duration: 1.05s; animation-delay: -0.25s; }
.wx-atc-eq i:nth-child(5) { animation-duration: 0.8s; animation-delay: -0.45s; }

@keyframes wx-atc-eq {
  0%, 100% { transform: scaleY(0.28); opacity: 0.55; }
  35% { transform: scaleY(1); opacity: 1; }
  60% { transform: scaleY(0.45); opacity: 0.75; }
}

@media (prefers-reduced-motion: reduce) {
  .wx-atc-eq i { animation: none; transform: scaleY(0.55); opacity: 0.7; }
}

.wx-aside.is-atc-off {
  border-left-color: rgba(140, 150, 160, 0.35);
}

.wx-aside.is-atc-off .wx-aside-tag,
.wx-aside.is-atc-off .wx-aside-sub {
  color: var(--muted);
}

.wx-aside.is-recall {
  border-left-color: rgba(240, 190, 90, 0.55);
}

.wx-aside.is-recall .wx-aside-tag,
.wx-aside.is-recall strong,
.wx-aside.is-recall .wx-aside-sub {
  color: #e8c56a;
}

/* Hora local / terreno arriba del lower third (no tapados). */
body.has-weather-bar #sky-chip {
  bottom: 72px;
  right: 16px;
}

body.has-weather-bar #terrain-chip {
  bottom: 72px;
}

body.has-weather-bar .leaflet-bottom.leaflet-right {
  bottom: 60px;
}

/* Near-pop abierto: sube el weather-bar y aparta hora local + copyright. */
body.has-landing-near #weather-bar {
  z-index: 560;
}

body.has-landing-near #sky-chip {
  bottom: auto;
  top: 14px;
  right: 16px;
}

body.has-landing-near.has-airport-cam #sky-chip {
  top: 14px;
}

body.has-landing-near .leaflet-bottom.leaflet-right {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* --- cam aeropuerto (approach / landed) --- */

#airport-cam {
  position: absolute;
  z-index: 520;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(8, 14, 22, 0.94), rgba(6, 11, 18, 0.9));
  backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

#airport-cam.hidden { display: none; }

/* Sin embed: chip compacto arriba a la derecha (solo links). */
#airport-cam.links-only {
  right: 16px;
  top: 56px;
  width: auto;
  max-width: min(360px, calc(100vw - 400px));
}

#airport-cam.links-only .cam-frame,
#airport-cam.links-only .cam-note {
  display: none;
}

#airport-cam.links-only .cam-head {
  padding: 8px 10px;
  align-items: center;
}

#airport-cam.links-only .cam-sub {
  display: none;
}

/* El video ya no flota sobre el mapa: va al panel (gráficas). */
#airport-cam.has-embed {
  display: none;
}

body.has-airport-cam #sky-chip {
  right: 16px;
  bottom: auto;
  top: 14px;
}

/* Panel: swap charts ↔ embed en approach */
#charts-wrap.hidden,
#panel-cam.hidden {
  display: none;
}

body.has-airport-embed .flight-panel[data-panel="vuelo"] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.has-airport-embed .flight-panel[data-panel="vuelo"] .route-foot,
body.has-airport-embed .flight-panel[data-panel="vuelo"] .ticket-head {
  display: none;
}

body.has-airport-embed .flight-panel[data-panel="vuelo"] .route-pass-stub {
  padding: 0;
}

body.has-airport-embed .flight-panel[data-panel="vuelo"] .route-pass {
  grid-template-columns: minmax(0, 1fr) 72px;
}

body.has-airport-embed .flight-panel[data-panel="vuelo"] .block:not(.charts-block) {
  flex-shrink: 0;
}

body.has-airport-embed .charts-block {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding-bottom: 0;
}

body.has-airport-embed #panel-cam:not(.hidden) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.has-airport-embed .panel-cam-head,
body.has-airport-embed .panel-cam-tabs {
  margin-bottom: 6px;
}

.panel-cam-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.panel-cam-titles {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-width: 0;
}

.panel-cam-titles strong {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-cam-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px 1px 4px;
  border-radius: 999px;
  background: rgba(255, 59, 59, 0.12);
  border: 1px solid rgba(255, 59, 59, 0.35);
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #ff5a5a;
  flex-shrink: 0;
}

.panel-cam-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff3b3b;
  box-shadow: 0 0 6px rgba(255, 59, 59, 0.55);
}

.panel-cam-city {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.panel-cam-source {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.panel-cam-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin-bottom: 8px;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 170, 190, 0.25) transparent;
}

.panel-cam-tabs.hidden {
  display: none;
}

.panel-cam-tabs button {
  font: inherit;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.panel-cam-tabs button:hover {
  border-color: var(--accent);
  color: var(--text);
}

.panel-cam-tabs button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.panel-cam-tabs button.link-only::after {
  content: ' ↗';
  font-size: 10px;
  opacity: 0.7;
}

.panel-cam-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 3px;
  overflow: hidden;
  background: #05080c;
  border: 1px solid var(--line);
}

body.has-airport-embed .panel-cam-frame {
  flex: 1;
  min-height: 100px;
  aspect-ratio: unset;
  height: auto;
}

.panel-cam-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

#panel-cam-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#panel-cam-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cam-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 8px;
}

.cam-titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cam-tag {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.cam-titles strong {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

#airport-cam.links-only .cam-titles {
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}

#airport-cam.links-only .cam-titles strong {
  font-size: 13px;
}

.cam-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cam-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.cam-link {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.cam-link:hover { text-decoration: underline; }

#cam-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#cam-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cam-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #05080c;
}

.cam-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.cam-note {
  margin: 0;
  padding: 6px 10px 8px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

@media (max-width: 900px) {
  #airport-cam.links-only {
    left: auto;
    right: 12px;
    top: 56px;
    bottom: auto;
    width: auto;
    max-width: min(280px, calc(100vw - 24px));
  }

  #dest-board,
  #divert-board {
    right: 10px;
    top: 92px;
    width: min(250px, calc(100vw - 20px));
    max-height: min(38vh, 320px);
  }
}

/* Dest/divert board: instrumento aviación contemporáneo sobre el mapa */
#dest-board,
#divert-board {
  position: absolute;
  z-index: 510;
  right: 14px;
  top: 92px;
  width: min(292px, calc(100vw - 390px));
  max-height: min(48vh, 420px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--panel-edge);
  border-radius: 11px;
  background:
    linear-gradient(165deg, rgba(18, 34, 48, 0.38) 0%, transparent 52%),
    linear-gradient(180deg, rgba(8, 14, 22, 0.92), rgba(6, 11, 18, 0.88));
  backdrop-filter: blur(16px) saturate(1.12);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 color-mix(in srgb, var(--accent) 12%, transparent);
  pointer-events: auto;
}
#dest-board::before,
#divert-board::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 85%, transparent),
    color-mix(in srgb, var(--accent) 25%, transparent)
  );
  pointer-events: none;
}

#dest-board.hidden,
#divert-board.hidden { display: none; }
body.ui-silence #dest-board,
body.ui-silence #divert-board { display: none !important; }
body.has-airport-cam #dest-board,
body.has-airport-cam #divert-board { top: 92px; }

/* Divert board: 4 cols (Airport · Runway · ETA · Dist) */
#divert-board {
  width: min(320px, calc(100vw - 390px));
}
#divert-board .db-cols,
#divert-board .db-row {
  grid-template-columns: 72px minmax(0, 1fr) 48px 52px;
  gap: 6px;
}
#divert-board .db-flight {
  max-width: 72px;
}
#divert-board .db-min {
  justify-self: start;
  font-size: 11px;
  padding: 3px 5px;
}
#divert-board .db-dist {
  justify-self: end;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
}

.db-head { padding: 11px 12px 0 15px; flex-shrink: 0; }

.db-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.db-brand-mark {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.72;
}

.db-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 5px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.db-live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 5px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: ticket-live 1.8s ease-in-out infinite;
}

.db-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin-bottom: 11px;
}

.db-code {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 0 28px color-mix(in srgb, var(--accent) 18%, transparent);
}

.db-city {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 0 0 10px;
}

.db-tab {
  appearance: none;
  margin: 0;
  padding: 7px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(140, 170, 190, 0.04);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.db-tab em {
  font-style: normal;
  margin-left: 4px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
}
.db-tab:hover {
  color: var(--text);
  background: rgba(140, 170, 190, 0.07);
}
.db-tab.active {
  color: var(--text);
  background: var(--accent-dim);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.db-tab.active em { opacity: 1; color: var(--accent); }

.db-cols {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 44px;
  gap: 8px;
  padding: 6px 12px 5px 15px;
  border-top: 1px solid var(--line);
  background: rgba(140, 170, 190, 0.03);
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.8;
}

.db-list {
  list-style: none;
  margin: 0;
  padding: 0 0 6px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 170, 190, 0.22) transparent;
  transition: opacity 0.2s ease;
}
.db-list.db-list-swap {
  opacity: 0.25;
}
.db-list::-webkit-scrollbar { width: 3px; }
.db-list::-webkit-scrollbar-thumb {
  background: rgba(140, 170, 190, 0.22);
  border-radius: 2px;
}

.db-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px 7px 15px;
  border-top: 1px solid rgba(140, 170, 190, 0.07);
  transition: background 0.15s ease;
}
.db-row:first-child {
  border-top: 0;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.db-row:hover {
  background: color-mix(in srgb, var(--accent) 9%, rgba(140, 170, 190, 0.05));
}
.db-row.is-target {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.db-row.is-target .db-flight {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, rgba(8, 14, 22, 0.55));
  color: var(--accent);
}

.db-flight {
  display: inline-flex;
  align-items: center;
  max-width: 88px;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--panel-edge);
  background: rgba(8, 14, 22, 0.55);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-route {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}
.db-route b {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Codigos cortos (IATA/ICAO): que nunca se corten a una letra. */
.db-route b { flex-shrink: 0; }
.db-route b:last-child { flex-shrink: 1; }

.db-route-track {
  position: relative;
  flex: 1;
  min-width: 14px;
  max-width: 32px;
  height: 1px;
  background: var(--line);
  flex-shrink: 1;
}
.db-route-track::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
}
.db-route-track::after {
  content: "→";
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}

.db-min {
  justify-self: end;
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--accent-dim);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
}
.db-min.is-blank {
  padding: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.db-min.is-soon {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 32%, transparent);
}

.db-list .empty {
  padding: 16px 12px 16px 15px;
  font-size: 11px;
  color: var(--muted);
  border: 0;
}

.wx-card {
  display: none;
  position: relative;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 0;
  padding: 4px 0 4px 14px;
  animation: wx-lt-in 0.35s ease;
}

.wx-card.active {
  display: flex;
}

.wx-card.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 0 1px 1px 0;
  background: color-mix(in srgb, var(--line) 55%, transparent);
}

.wx-card.active:has(.wx-cat.VFR)::before { background: #5dffa8; }
.wx-card.active:has(.wx-cat.MVFR)::before { background: var(--accent); }
.wx-card.active:has(.wx-cat.IFR)::before { background: #ffb454; }
.wx-card.active:has(.wx-cat.LIFR)::before { background: #ff7676; }

.wx-card.wx-storm.active::before {
  background: rgba(255, 180, 84, 0.75);
}

.wx-card.wx-storm .wx-cat {
  color: #ffb454;
}

.wx-runway-card.active::before {
  background: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.wx-runway-card .wx-head {
  max-width: min(200px, 28%);
  flex: 0 1 160px;
  border-right: 1px solid var(--line);
  padding-right: 12px;
}

.wx-runway-card .wx-grid {
  border-left: none;
  padding-left: 12px;
}

.wx-runway-card .runway-line {
  flex: 1 1 auto;
  min-width: 88px;
}

.wx-runway-card .runway-line .val {
  max-width: 140px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.04em;
}

@keyframes wx-lt-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.wx-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  column-gap: 16px;
  row-gap: 2px;
  min-width: 0;
  flex: 0 1 auto;
  max-width: none;
  padding-right: 12px;
  border-right: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
}

.wx-place {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  flex: 0 1 auto;
  line-height: 1.05;
}

.wx-head:has(.wx-gate:not([hidden])) .wx-place,
.wx-head:has(.wx-cat:not(:empty)) .wx-place {
  padding-right: 14px;
  border-right: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.wx-clocks {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text);
  padding: 0 14px;
  border-right: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
}

.wx-clocks span {
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1.1;
}

.wx-clocks em {
  font-style: normal;
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 2.6ch;
  flex: 0 0 auto;
}

.wx-clocks b {
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--text) 92%, white);
}

.wx-tag {
  font-size: 7px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--muted) 88%, transparent);
  flex: 1 0 100%;
  line-height: 1;
}

.wx-code {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  flex: 0 0 auto;
  line-height: 1.05;
}

.wx-city {
  font-size: 10px;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--text) 58%, var(--muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 16ch;
  min-width: 0;
  line-height: 1.1;
}

.wx-gate {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  flex: 0 0 auto;
  max-width: 16ch;
  margin-left: 0;
  padding-right: 4px;
  line-height: 1.05;
  text-align: center;
}

.wx-gate[hidden] { display: none; }

.wx-gate-kicker {
  font-style: normal;
  font-size: 7px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--muted) 92%, transparent);
  white-space: nowrap;
}

.wx-gate-val {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 78%, var(--text));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 16ch;
  line-height: 1.05;
}

.wx-cat {
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex: 0 0 auto;
  align-self: center;
  margin-top: 1px;
  background: color-mix(in srgb, var(--muted) 8%, transparent);
  border-color: color-mix(in srgb, var(--muted) 14%, transparent);
  color: color-mix(in srgb, var(--muted) 92%, var(--text));
}

.wx-cat:empty { display: none; }
.wx-cat.VFR {
  background: color-mix(in srgb, #5dffa8 14%, transparent);
  border-color: color-mix(in srgb, #5dffa8 24%, transparent);
  color: #5dffa8;
}
.wx-cat.MVFR {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--accent);
}
.wx-cat.IFR {
  background: color-mix(in srgb, #ffb454 14%, transparent);
  border-color: color-mix(in srgb, #ffb454 24%, transparent);
  color: #ffb454;
}
.wx-cat.LIFR {
  background: color-mix(in srgb, #ff7676 14%, transparent);
  border-color: color-mix(in srgb, #ff7676 24%, transparent);
  color: #ff7676;
}

.wx-grid {
  list-style: none;
  margin: 0;
  padding: 0 0 0 10px;
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 7px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 14px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 14px), transparent);
}

.wx-grid li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 0 auto;
  min-width: 48px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 2px;
  background: color-mix(in srgb, var(--line) 7%, transparent);
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.wx-grid li.empty {
  flex-direction: row;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  padding: 0 4px;
}

.wx-grid .ico {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--accent) 82%, var(--muted));
}

.wx-grid .ico svg {
  display: block;
  width: 100%;
  height: 100%;
}

.wx-grid .val {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  font-size: 12px;
  line-height: 1.1;
  text-align: center;
}

.wx-grid li.accent .val {
  color: var(--accent);
  font-weight: 600;
}

.wx-grid li.wide {
  min-width: 88px;
}

.wx-grid li.wide .val {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}

.wx-grid .val b {
  color: var(--accent);
  font-weight: 600;
}

.wx-dots {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  flex: 0 0 auto;
  padding: 0 4px 0 2px;
  align-self: center;
}

.wx-dots span {
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: rgba(140, 170, 190, 0.22);
  transition: background 0.2s ease;
}

.wx-dots span.on {
  background: var(--accent);
}

.wx-dots span.hidden {
  display: none;
}

/* --- event lower-thirds (touchdown / signal-lost / emergency) --- */

@keyframes evt-lt-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes evt-lt-accent {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.evt-lt {
  position: absolute;
  left: calc(364px + 16px);
  right: 16px;
  bottom: 12px;
  display: flex;
  align-items: stretch;
  min-height: 52px;
  border-radius: 2px;
  background: rgba(6, 11, 18, 0.94);
  backdrop-filter: blur(12px) saturate(1.05);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  animation: evt-lt-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.evt-lt-accent {
  flex: 0 0 4px;
  transform-origin: bottom center;
  animation: evt-lt-accent 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.08s both;
}

.evt-lt-body {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 14px;
  padding: 7px 14px 7px 12px;
}

.evt-lt-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  gap: 1px;
}

.evt-lt-col--main {
  flex: 0 1 auto;
  max-width: 42%;
}

.evt-lt-col--detail {
  flex: 1 1 auto;
}

.evt-lt-kicker {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evt-lt-primary {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.8vw, 30px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evt-lt-sep {
  flex: 0 0 1px;
  align-self: stretch;
  margin: 8px 0;
  background: color-mix(in srgb, var(--line) 85%, transparent);
}

.evt-lt-detail {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evt-lt-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evt-lt-pill {
  flex: 0 0 auto;
  align-self: center;
  padding: 4px 10px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid;
  white-space: nowrap;
}

.evt-lt-pill:empty {
  display: none;
}

.evt-lt-flash {
  pointer-events: none;
}

/* --- touchdown --- */

#touchdown {
  position: absolute;
  inset: 0;
  z-index: 800;
  pointer-events: none;
}

#touchdown .flash.evt-lt-flash {
  position: absolute;
  left: calc(364px + 16px);
  right: 16px;
  bottom: 0;
  height: 96px;
  background: linear-gradient(0deg, rgba(93, 255, 168, 0.24) 0%, transparent 72%);
  animation: td-flash 1.2s ease-out;
}

.evt-lt--touchdown {
  border: 1px solid rgba(93, 255, 168, 0.42);
  min-height: 58px;
}

.evt-lt--touchdown .evt-lt-accent {
  background: #5dffa8;
  box-shadow: 0 0 12px rgba(93, 255, 168, 0.45);
}

.evt-lt--touchdown .evt-lt-kicker {
  color: #5dffa8;
}

.evt-lt--touchdown .evt-lt-primary {
  color: #eafff4;
}

.evt-lt--touchdown .evt-lt-pill {
  margin-left: auto;
  border-color: rgba(93, 255, 168, 0.55);
  background: rgba(93, 255, 168, 0.1);
  color: #5dffa8;
}

.evt-lt--touchdown .evt-lt-col--detail {
  flex: 0 1 auto;
  max-width: min(30%, 24ch);
}

.evt-lt-col--flight {
  flex: 1 1 0;
  align-items: stretch;
  min-width: 0;
  justify-content: center;
  gap: 2px;
}

.evt-lt-flight-top,
.evt-lt-flight-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  min-width: 0;
}

.evt-lt-col--flight #td-route,
.evt-lt-col--flight #td-punctual {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.evt-lt-col--flight .evt-lt-detail--time {
  flex: 0 0 auto;
  margin-left: auto;
  text-align: right;
}

.evt-lt-col--flight .evt-lt-detail,
.evt-lt-col--flight .evt-lt-meta {
  max-width: 100%;
}

.evt-lt-detail--time {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.evt-lt--touchdown .evt-lt-meta#td-punctual.ontime {
  color: #5dffa8;
}

.evt-lt--touchdown .evt-lt-meta#td-punctual.early {
  color: #7ec8ff;
}

.evt-lt--touchdown .evt-lt-meta#td-punctual.late {
  color: #ffb454;
}

#td-route:empty,
#td-time:empty,
#td-punctual:empty {
  display: none;
}

.evt-lt--touchdown #td-punctual:not(:empty) {
  display: block;
  min-height: 1.2em;
  line-height: 1.25;
}

.td-gate {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  flex: 0 0 auto;
  margin-left: auto;
  max-width: 16ch;
  line-height: 1.05;
  text-align: right;
}

.td-gate[hidden] { display: none; }

.td-gate-kicker {
  font-style: normal;
  font-size: 7px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--muted) 92%, transparent);
  white-space: nowrap;
}

.td-gate-val {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: color-mix(in srgb, #ffb454 72%, #5dffa8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 16ch;
  line-height: 1.05;
}

/* --- signal lost --- */

#signal-lost {
  position: absolute;
  inset: 0;
  z-index: 920;
  pointer-events: none;
}

#signal-lost.hidden { display: none; }

#signal-lost .sl-flash.evt-lt-flash {
  position: absolute;
  left: calc(364px + 16px);
  right: 16px;
  bottom: 0;
  height: 96px;
  background: linear-gradient(0deg, rgba(255, 180, 84, 0.28) 0%, transparent 72%);
  animation: td-flash 1.2s ease-out;
}

.evt-lt--signal-lost {
  border: 1px solid rgba(255, 180, 84, 0.52);
}

.evt-lt--signal-lost .evt-lt-accent {
  background: #ffb454;
  box-shadow: 0 0 12px rgba(255, 180, 84, 0.4);
}

.evt-lt--signal-lost .evt-lt-kicker {
  color: #ffb454;
}

.evt-lt--signal-lost .evt-lt-primary {
  color: #ffe8c8;
}

.evt-lt--signal-lost .evt-lt-meta {
  color: rgba(255, 180, 84, 0.85);
}

.evt-lt--signal-lost .evt-lt-pill {
  border-color: rgba(255, 180, 84, 0.55);
  background: rgba(255, 180, 84, 0.1);
  color: #ffb454;
}

@media (max-width: 900px) {
  .evt-lt,
  #touchdown .flash.evt-lt-flash,
  #signal-lost .sl-flash.evt-lt-flash {
    left: 12px;
    right: 12px;
  }

  .evt-lt {
    bottom: 10px;
  }

  .evt-lt-col--main {
    max-width: 46%;
  }

  .evt-lt-body {
    gap: 10px;
    padding: 7px 10px 7px 10px;
  }

  .evt-lt-pill {
    padding: 3px 8px;
    font-size: 9px;
  }

  .evt-lt--touchdown .evt-lt-col--detail {
    max-width: min(36%, 18ch);
  }

  .evt-lt-flight-top,
  .evt-lt-flight-bottom {
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .evt-lt,
  .evt-lt-accent {
    animation: none;
  }
}

/* --- storm upper third (broadcast bars) --- */

#storm-ut {
  position: absolute;
  top: 0;
  left: calc(16px + 348px + 16px);
  right: 0;
  width: auto;
  z-index: 780;
  pointer-events: none;
}

body.ui-silence #storm-ut {
  left: 0;
}

#storm-ut.hidden { display: none; }

/* Sin underline / edge naranja de threat en la barra de weather. */
#storm-ut.su-threat-forecast .su-top-bar,
#storm-ut.su-threat-advisory .su-top-bar,
#storm-ut.su-threat-active .su-top-bar,
#storm-ut.su-threat-forecast .su-wx-row,
#storm-ut.su-threat-advisory .su-wx-row,
#storm-ut.su-threat-active .su-wx-row {
  box-shadow: none;
}

#storm-ut.su-threat-forecast .su-alert-bar.sev-impact,
#storm-ut.su-threat-forecast .su-alert-bar {
  animation: su-forecast-pulse 2.4s ease-in-out infinite;
}

#storm-ut.su-threat-advisory .su-alert-bar {
  animation: su-advisory-pulse 2.8s ease-in-out infinite;
}

#storm-ut.su-threat-active .su-alert-bar {
  animation: su-storm-pulse 1.6s ease-in-out infinite;
}

#storm-ut.su-flash .su-alert-bar {
  animation: su-lightning 0.65s ease-out 1;
}

@media (prefers-reduced-motion: reduce) {
  #storm-ut.su-threat-forecast .su-alert-bar,
  #storm-ut.su-threat-advisory .su-alert-bar,
  #storm-ut.su-threat-active .su-alert-bar,
  #storm-ut.su-flash .su-alert-bar {
    animation: none;
  }
}

.su-bars {
  width: 100%;
  --su-tcas-col: min(42vw, 420px);
}

.su-top-main,
.su-wx-row,
.su-alert-row {
  animation: su-slide-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.su-tcas {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: stretch;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
  background: #080808;
  z-index: 1;
}

.su-tcas-gutter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  visibility: hidden;
  pointer-events: none;
}

.su-tcas.hidden {
  display: none;
}

.su-top-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 14px;
  align-items: center;
  padding: 7px 16px 6px;
  background: #080808;
  color: #f2f2f2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.su-top-bar:has(#su-tcas:not(.hidden)),
.su-alert-bar:has(#su-tcas-alert:not(.hidden)) {
  grid-template-columns: minmax(0, 1fr) var(--su-tcas-col);
  column-gap: 0;
}

.su-top-bar:has(#su-tcas:not(.hidden)) {
  padding: 7px 0 6px 16px;
  gap: 2px 0;
}

.su-alert-bar:has(#su-tcas-alert:not(.hidden)) {
  gap: 0;
}

.su-top-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
}

.su-top-kicker {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.68);
  white-space: nowrap;
}

.su-top-sep,
.su-alert-sep {
  opacity: 0.42;
  font-weight: 300;
}

#su-airport {
  font-family: var(--font-display);
  font-size: clamp(11px, 2.2vw, 13px);
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.su-wx-row {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.su-wx-line {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  font-size: clamp(10px, 1.9vw, 12px);
  letter-spacing: 0.01em;
  color: rgba(230, 230, 230, 0.86);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.su-dist {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.42);
  white-space: nowrap;
}

.su-dist.hidden {
  display: none;
}

.su-tcas-flights,
.su-tcas-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  align-items: stretch;
}

.su-tcas-flights.cols-1,
.su-tcas-meta.cols-1 {
  grid-template-columns: minmax(0, 1fr);
}

.su-tcas-meta {
  height: 100%;
  min-height: 100%;
  align-self: stretch;
}

.su-tcas-flight {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1px;
  padding: 0 12px;
  min-width: 0;
}

.su-tcas-call {
  font-family: var(--font-display);
  font-size: clamp(11px, 2.2vw, 13px);
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.su-tcas-route {
  font-family: var(--font-ui);
  font-size: clamp(9px, 1.8vw, 10px);
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0.75;
}

.su-tcas-flight.tier-caution {
  color: #e6a817;
}

.su-tcas-flight.tier-warning {
  color: #e63946;
}

.su-tcas-call.tier-caution {
  color: #e6a817;
}

.su-tcas-call.tier-warning {
  color: #e63946;
}

.su-brand {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.su-alert-bar {
  --su-alert-bg: #00a651;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  color: #0a0a0a;
  background: var(--su-alert-bg);
  position: relative;
}

.su-alert-bar.sev-impact {
  --su-alert-bg: #e85d04;
  color: #fff;
}

.su-alert-bar.sev-flood {
  --su-alert-bg: #00a651;
  color: #fff;
}

.su-alert-bar.sev-heat {
  --su-alert-bg: #ff6a00;
  color: #fff;
}

.su-alert-bar.sev-marine {
  --su-alert-bg: #0b6e99;
  color: #fff;
}

.su-alert-bar.sev-nearby {
  --su-alert-bg: #c9a227;
  color: #111;
}

.su-alert-bar.sev-watch {
  --su-alert-bg: #1a4d6e;
  color: #fff;
}

.su-alert-bar.sev-quiet {
  --su-alert-bg: #141c24;
  color: rgba(255, 255, 255, 0.58);
}

/* Con TCAS: el color de severidad solo en la columna izquierda. */
.su-alert-bar:has(#su-tcas-alert:not(.hidden)) {
  background: #141c24;
}

.su-alert-bar:has(#su-tcas-alert:not(.hidden))::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(100% - var(--su-tcas-col));
  background: var(--su-alert-bg);
  pointer-events: none;
  z-index: 0;
}

.su-alert-bar:has(#su-tcas-alert:not(.hidden)) > * {
  position: relative;
  z-index: 1;
}

.su-alert-bar.hidden {
  display: none;
}

.su-alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  grid-column: 1;
  grid-row: 1;
  padding: 7px 16px 8px;
  min-width: 0;
}

.su-alert-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

#su-alert-title {
  font-family: var(--font-display);
  font-size: clamp(12px, 2.4vw, 15px);
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

#su-alert-place {
  font-family: var(--font-display);
  font-size: clamp(11px, 2.2vw, 14px);
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.su-expires-block {
  font-family: var(--font-display);
  font-size: clamp(10px, 2vw, 12px);
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0.95;
}

.su-expires-block.hidden,
.su-progress-track.hidden {
  display: none;
}

.su-progress-track {
  grid-column: 1 / -1;
  margin: 5px 16px 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 1px;
  overflow: hidden;
}

.su-alert-bar:has(#su-tcas-alert:not(.hidden)) .su-progress-track {
  grid-column: 1;
  margin: 0 16px 8px;
}

.su-tcas-alert {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: stretch;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  height: 100%;
  min-height: 100%;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
  overflow: hidden;
  background: #141c24;
  color: rgba(255, 255, 255, 0.72);
  z-index: 2;
}

.su-tcas-alert.hidden {
  display: none;
}

.su-tcas-meta-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  height: 100%;
  align-self: stretch;
  padding: 7px 12px;
  border-radius: 0;
  box-sizing: border-box;
  font-family: var(--font-ui);
  font-size: clamp(11px, 2.2vw, 12px);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.85);
  background: #1a2430;
}

.su-tcas-meta-item.tier-caution {
  background: #c9a227;
  color: #111;
}

.su-tcas-meta-item.tier-warning {
  background: #e63946;
  color: #fff;
}

.su-alert-bar.sev-impact .su-progress-track {
  background: rgba(0, 0, 0, 0.28);
}

.su-alert-bar.sev-flood .su-progress-track,
.su-alert-bar.sev-heat .su-progress-track,
.su-alert-bar.sev-marine .su-progress-track {
  background: rgba(0, 0, 0, 0.28);
}

.su-progress-fill {
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.92);
  transition: width 0.8s linear;
}

body.storm-active #map-atmosphere {
  mix-blend-mode: screen;
  opacity: 0.72;
}

body.storm-active:not(.emergency) {
  --atmo-a: rgba(95, 208, 200, 0.08);
  --atmo-c: rgba(255, 180, 84, 0.06);
}

body.emergency #storm-ut {
  display: none;
}

@keyframes su-slide-in {
  0% { transform: translateY(-100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes su-forecast-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

@keyframes su-advisory-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

@keyframes su-storm-pulse {
  0%, 100% { filter: brightness(1); box-shadow: none; }
  40% { filter: brightness(1.18); box-shadow: 0 0 18px rgba(232, 93, 4, 0.35); }
  55% { filter: brightness(0.96); }
}

@keyframes su-edge-sweep {
  0%, 100% { opacity: 0.25; transform: scaleY(0.55); }
  50% { opacity: 1; transform: scaleY(1); }
}

@keyframes su-lightning {
  0% { filter: brightness(1); }
  18% { filter: brightness(1.55); }
  28% { filter: brightness(0.92); }
  42% { filter: brightness(1.35); }
  100% { filter: brightness(1); }
}

@media (max-width: 900px) {
  #wx-radar-chip {
    left: auto;
    right: 14px;
    top: auto;
    bottom: 68px;
  }

  body.has-weather-bar #wx-radar-chip {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  body.has-storm-ut #wx-radar-chip,
  body.has-storm-ut.has-airport-cam #wx-radar-chip {
    top: auto;
    bottom: 68px;
  }

  body.has-storm-ut.has-airport-cam #sky-chip {
    top: calc(var(--storm-ut-h) + 10px);
  }

  .su-top-bar {
    padding: 6px 10px 5px;
    gap: 2px 8px;
  }

  .su-top-bar:has(#su-tcas:not(.hidden)) {
    padding: 6px 0 5px 10px;
    gap: 2px 0;
  }

  .su-top-kicker {
    letter-spacing: 0.14em;
  }

  .su-alert-row {
    padding: 6px 10px 7px;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .su-alert-bar:has(#su-tcas-alert:not(.hidden)) .su-progress-track {
    margin: 0 10px 7px;
  }

  .su-progress-track {
    margin: 5px 10px 0;
  }

  .su-alert-main {
    flex-wrap: wrap;
  }
}

/* --- emergencia squawk --- */

#emergency {
  position: absolute;
  inset: 0;
  z-index: 850;
  pointer-events: none;
}

#emergency.hidden { display: none; }

#emergency .em-flash.evt-lt-flash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 75% 65% at 50% 48%, transparent 42%, rgba(90, 0, 0, 0.28) 100%),
    linear-gradient(180deg, rgba(120, 0, 0, 0.22) 0%, transparent 22%, transparent 78%, rgba(60, 0, 0, 0.2) 100%),
    linear-gradient(0deg, rgba(255, 42, 42, 0.18) 0%, transparent 28%),
    repeating-linear-gradient(
      -12deg,
      transparent 0 18px,
      rgba(180, 0, 0, 0.03) 18px 36px
    );
  opacity: 0.42;
  animation: em-siren 4.5s ease-in-out infinite;
}

.evt-lt--emergency {
  border: 1px solid rgba(255, 42, 42, 0.72);
  animation:
    evt-lt-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both,
    em-banner-tick 4.5s ease-in-out infinite;
}

.evt-lt--emergency .evt-lt-accent {
  background: #ff2a2a;
  box-shadow: 0 0 14px rgba(255, 42, 42, 0.55);
}

.evt-lt--emergency .evt-lt-kicker {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #ff6b6b;
  text-shadow: 0 0 12px rgba(255, 0, 0, 0.55);
}

.evt-lt--emergency .evt-lt-primary {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.6vw, 26px);
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 0 0 16px rgba(255, 40, 40, 0.65);
}

.evt-lt--emergency .evt-lt-detail {
  color: #ffb4b4;
}

.evt-lt--emergency .evt-lt-meta {
  color: rgba(255, 200, 200, 0.75);
}

.evt-lt--emergency .evt-lt-pill {
  border-color: rgba(255, 42, 42, 0.65);
  background: rgba(255, 42, 42, 0.14);
  color: #ff6b6b;
}

@media (max-width: 900px) {
  #emergency .em-flash.evt-lt-flash {
    inset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #emergency .em-flash.evt-lt-flash,
  .evt-lt--emergency {
    animation: none;
  }
}

.divert-rank-marker { background: transparent; border: none; }

.divert-rank {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 100, 100, 0.75);
  background: rgba(40, 0, 0, 0.88);
  color: #ffd6d6;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 0 8px rgba(255, 50, 50, 0.45);
}
.divert-rank.is-passed {
  border-color: rgba(255, 180, 180, 0.45);
  background: rgba(30, 10, 10, 0.72);
  color: rgba(255, 210, 210, 0.7);
  box-shadow: none;
  font-size: 11px;
  line-height: 16px;
}

body.emergency {
  --bg: #1a0000;
  --accent: #ff3b3b;
  --accent-dim: rgba(255, 40, 40, 0.18);
  --map-trail: #ff6b6b;
  --map-route-ahead: #b07070;
  --plane-color: #fff0f0;
  --nearby-color: #c08080;
  --warn: #ff7a7a;
  /* Tint red without crushing map geography under the plane */
  --map-grade: brightness(0.96) saturate(1.25) hue-rotate(-10deg) contrast(1.06);
  --atmo-a: rgba(255, 60, 60, 0.12);
  --atmo-b: rgba(40, 0, 0, 0.22);
  --atmo-c: rgba(120, 0, 0, 0.12);
  --panel-edge: rgba(255, 70, 70, 0.45);
  --line: rgba(255, 80, 80, 0.28);
}

body.emergency #panel,
body.emergency #weather-bar,
body.emergency #sky-chip,
body.emergency #terrain-chip {
  border-color: rgba(255, 60, 60, 0.55);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.22);
  animation: em-panel-pulse 4.5s ease-in-out infinite;
}

body.emergency #panel h1,
body.emergency .flip-board .callsign-text,
body.emergency #sky-label {
  color: #ff4d4d !important;
  text-shadow: 0 0 16px rgba(255, 0, 0, 0.55);
}

body.emergency .metric .m-val#squawk,
body.emergency #squawk,
#squawk.em-hot {
  color: #ff2a2a !important;
  animation: em-squawk-blink 4.5s steps(1, end) infinite;
}

body.emergency .pill,
body.emergency .status-chip.is-emergency {
  border-color: #ff3b3b;
  color: #ff6b6b;
}

body.emergency #map-atmosphere {
  mix-blend-mode: soft-light;
  opacity: 0.55;
}

body.emergency .plane.target svg {
  filter: drop-shadow(0 0 8px rgba(255, 40, 40, 0.95)) drop-shadow(0 0 2px #fff);
}

body.emergency.ui-silence #emergency {
  opacity: 1;
}

/* Quiet most of the cycle; short double-blink every ~4.5s */
@keyframes em-siren {
  0%, 78%, 100% { opacity: 0.38; }
  82% { opacity: 0.72; }
  86% { opacity: 0.4; }
  90% { opacity: 0.78; }
  94% { opacity: 0.4; }
}

@keyframes em-banner-tick {
  0%, 78%, 100% {
    box-shadow:
      0 2px 10px rgba(0, 0, 0, 0.28),
      0 0 0 1px rgba(255, 80, 80, 0.3),
      0 0 24px rgba(255, 0, 0, 0.22);
  }
  82%, 90% {
    box-shadow:
      0 2px 10px rgba(0, 0, 0, 0.28),
      0 0 0 1px rgba(255, 120, 120, 0.55),
      0 0 40px rgba(255, 0, 0, 0.42);
  }
  86%, 94% {
    box-shadow:
      0 2px 10px rgba(0, 0, 0, 0.28),
      0 0 0 1px rgba(255, 80, 80, 0.35),
      0 0 28px rgba(255, 0, 0, 0.28);
  }
}

@keyframes em-panel-pulse {
  0%, 78%, 100% { box-shadow: 0 0 16px rgba(255, 0, 0, 0.16); }
  82%, 90% { box-shadow: 0 0 34px rgba(255, 0, 0, 0.4); }
  86%, 94% { box-shadow: 0 0 16px rgba(255, 0, 0, 0.16); }
}

@keyframes em-squawk-blink {
  0%, 78%, 100% { opacity: 1; }
  82%, 90% { opacity: 0.35; }
  86%, 94% { opacity: 1; }
}

@keyframes td-flash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

@keyframes td-pop {
  0% { transform: translateX(-50%) scale(0.85); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* --- aproximacion: pistas + viento --- */

.rwy-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #9aacbc;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  white-space: nowrap;
}

.rwy-label.preferred {
  color: var(--accent);
  font-size: 11px;
}

.rwy-threshold {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-radius: 2px;
  background: rgba(95, 208, 200, 0.35);
  box-shadow: 0 0 10px rgba(95, 208, 200, 0.55);
  transform: rotate(var(--rwy, 0deg));
  animation: rwy-pulse 1.6s ease-in-out infinite;
}

@keyframes rwy-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(95, 208, 200, 0.35); }
  50% { box-shadow: 0 0 14px rgba(95, 208, 200, 0.85); }
}

.rwy-tip.preferred strong { color: var(--accent); }

.wind-badge {
  min-width: 140px;
  padding: 7px 10px;
  border: 1px solid rgba(95, 208, 200, 0.35);
  border-radius: 3px;
  background: rgba(8, 14, 22, 0.9);
  color: var(--text);
  text-align: center;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.wb-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.wb-wind,
.wb-rwy {
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
}

.wind-streak {
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: rotate(calc(var(--wdir, 0deg) + 90deg));
  opacity: 0.85;
  animation: wind-pulse 1.1s ease-in-out infinite;
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent);
}

@keyframes wind-pulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.95; }
}

@media (max-width: 900px) {
  #panel { max-height: 55vh; }
  #weather-bar {
    left: 12px;
    right: 12px;
    bottom: 10px;
    padding: 0 8px 0 0;
    gap: 6px;
  }
  .wx-card { padding-left: 13px; }
  .wx-aside-sub { max-width: 110px; }
  .wx-aside strong { font-size: 17px; }
  .wx-landing-near {
    padding: 8px 8px 7px;
    bottom: calc(100% + 20px);
  }
  .wx-landing-near-title { font-size: 9px; margin-bottom: 6px; }
  .wx-landing-near-list { gap: 4px; }
  .wx-landing-near-list li {
    column-gap: 6px;
    font-size: 11px;
  }
  .wx-landing-near-list .near-count { font-size: 13px; }
  .wx-landing-near-list li.is-today .near-count { font-size: 14px; }
  .wx-landing-near-list .near-delta { font-size: 10px; }
  .wx-head { max-width: none; flex: 0 1 auto; }
  .wx-code { font-size: 17px; }
  .wx-city { display: none; }
  .wx-place { gap: 0; }
  .wx-clocks { gap: 1px; padding-right: 8px; }
  .wx-clocks b { font-size: 11px; }
  .wx-grid { gap: 4px; padding-left: 6px; }
  .wx-grid li { min-width: 36px; padding: 3px 5px; }
  .wx-grid li.wide { min-width: 60px; }
  .wx-grid .val { max-width: none; overflow: visible; font-size: 9px; }
  .wx-grid li.wide .val { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
  #sky-chip {
    right: 14px;
    bottom: auto;
    top: 14px;
  }
  #terrain-chip {
    left: 14px;
    bottom: auto;
    top: 14px;
  }
}

/* —— Hub · Daily Mix telemetría —— */
.hub-dmix-card .hub-dmix-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.hub-dmix-card .hub-dmix-head > h2 {
  margin: 0;
}

.hub-dmix-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 12px 16px;
  align-items: start;
}

.hub-dmix-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text, #e8eef4);
}

.hub-dmix-stats span b {
  color: var(--muted, #8498ac);
  font-weight: 600;
  margin-right: 4px;
}

.hub-dmix-hist {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  min-height: 72px;
  padding: 6px 4px 0;
  border: 1px solid var(--line, rgba(140, 170, 190, 0.16));
  border-radius: 4px;
  background: rgba(4, 7, 11, 0.45);
}

.hub-dmix-bar {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 64px;
  justify-content: flex-end;
}

.hub-dmix-bar i {
  display: block;
  width: 100%;
  max-width: 28px;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, var(--teal, #5fd0c8), rgba(95, 208, 200, 0.35));
}

.hub-dmix-bar span {
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #8498ac);
}

.hub-dmix-bar em {
  font-style: normal;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text, #e8eef4);
}

.hub-dmix-mode.on {
  color: var(--ok, #5dffa8);
  border-color: rgba(93, 255, 168, 0.35);
}

.hub-dmix-mode.shadow {
  color: var(--warn, #e0a45a);
  border-color: rgba(224, 164, 90, 0.35);
}

.hub-dmix-events-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line, rgba(140, 170, 190, 0.16));
}

.hub-dmix-events-label {
  margin: 0 0 8px;
  font-family: var(--font-display, Sora, sans-serif);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted, #8498ac);
}

.hub-dmix-events {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 168px;
  overflow: auto;
}

.hub-dmix-events li {
  display: grid;
  grid-template-columns: 4.5em minmax(0, 0.9fr) minmax(0, 1.2fr) auto;
  gap: 8px;
  align-items: baseline;
  padding: 5px 6px;
  border: 1px solid rgba(140, 170, 190, 0.1);
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted, #8498ac);
  background: rgba(5, 8, 12, 0.35);
}

.hub-dmix-ev-time {
  font-variant-numeric: tabular-nums;
  color: var(--teal, #5fd0c8);
}

.hub-dmix-ev-flight strong {
  color: var(--text, #e8eef4);
  font-weight: 600;
}

.hub-dmix-ev-tier {
  text-align: right;
  white-space: nowrap;
}

.hub-dmix-week {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line, rgba(140, 170, 190, 0.16));
}

.hub-dmix-week-title {
  margin: 0 0 8px;
  font-family: var(--font-display, Sora, sans-serif);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted, #8498ac);
}

.hub-dmix-week-chart {
  width: 100%;
  overflow-x: auto;
}

.hub-dmix-week-inner {
  min-width: min(100%, 320px);
}

.hub-dmix-svg {
  display: block;
  width: 100%;
  height: auto;
}

.hub-dmix-svg-act-picks { fill: var(--teal, #5fd0c8); }
.hub-dmix-svg-act-impressions { fill: var(--accent, #e0a45a); }
.hub-dmix-svg-act-touchdowns { fill: var(--ok, #5dffa8); }
.hub-dmix-svg-tier-0 { fill: rgba(132, 152, 172, 0.45); }
.hub-dmix-svg-tier-1 { fill: rgba(132, 152, 172, 0.72); }
.hub-dmix-svg-tier-2 { fill: rgba(95, 208, 200, 0.78); }
.hub-dmix-svg-tier-3 { fill: rgba(93, 255, 168, 0.88); }
.hub-dmix-svg-null { stroke: rgba(140, 170, 190, 0.35); stroke-width: 1; }
.hub-dmix-svg-muted {
  fill: var(--muted, #8498ac);
  font-size: 11px;
}
.hub-dmix-svg-day {
  fill: var(--muted, #8498ac);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.hub-dmix-svg-day.is-today { fill: var(--teal, #5fd0c8); }
.hub-dmix-svg-hit { fill: transparent; stroke: none; pointer-events: all; }

.hub-dmix-week-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 10px;
  color: var(--muted, #8498ac);
}

.hub-dmix-week-legend li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hub-dmix-week-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.hub-dmix-week-legend .swatch.act-picks { background: var(--teal, #5fd0c8); }
.hub-dmix-week-legend .swatch.act-imp { background: var(--accent, #e0a45a); }
.hub-dmix-week-legend .swatch.act-td { background: var(--ok, #5dffa8); }
.hub-dmix-week-legend .swatch.tier-0 { background: rgba(132, 152, 172, 0.45); }
.hub-dmix-week-legend .swatch.tier-1 { background: rgba(132, 152, 172, 0.72); }
.hub-dmix-week-legend .swatch.tier-2 { background: rgba(95, 208, 200, 0.78); }
.hub-dmix-week-legend .swatch.tier-3 { background: rgba(93, 255, 168, 0.88); }

.hub-dmix-week-legend-sep { opacity: 0.45; }

.hub-dmix-week-days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.hub-dmix-week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  border: 1px solid rgba(140, 170, 190, 0.12);
  border-radius: 4px;
  background: rgba(5, 8, 12, 0.35);
  font-size: 10px;
  text-align: center;
}

.hub-dmix-week-day.is-today {
  border-color: rgba(95, 208, 200, 0.35);
  background: rgba(95, 208, 200, 0.06);
}

.hub-dmix-week-day-label {
  font-variant-numeric: tabular-nums;
  color: var(--text, #e8eef4);
  font-weight: 600;
}

.hub-dmix-week-day-ls {
  color: var(--muted, #8498ac);
  font-size: 9px;
}

.hub-dmix-week-meta,
.hub-dmix-week-lim {
  margin-top: 8px;
}

.hub-dmix-week-empty {
  margin: 0;
  padding: 10px;
  border: 1px dashed rgba(140, 170, 190, 0.18);
  border-radius: 4px;
}

.hub-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hub-dmix-guide {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--line, rgba(140, 170, 190, 0.16));
  border-radius: 4px;
  background: rgba(5, 8, 12, 0.35);
  font-size: 11px;
  line-height: 1.45;
}

.hub-dmix-guide summary {
  cursor: pointer;
  font-family: var(--font-display, Sora, sans-serif);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal, #5fd0c8);
  list-style: none;
}

.hub-dmix-guide summary::-webkit-details-marker { display: none; }

.hub-dmix-guide summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s ease;
}

.hub-dmix-guide[open] summary::before { transform: rotate(90deg); }

.hub-dmix-guide-body { margin-top: 8px; }

.hub-dmix-guide-lead {
  margin: 0 0 8px;
  color: var(--muted, #8498ac);
}

.hub-dmix-guide-lead strong {
  color: var(--text, #e8eef4);
  font-weight: 600;
}

.hub-dmix-guide-dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hub-dmix-guide-item dt {
  font-weight: 600;
  color: var(--text, #e8eef4);
  font-size: 11px;
}

.hub-dmix-guide-item dd {
  margin: 2px 0 0;
  color: var(--muted, #8498ac);
  font-size: 11px;
}

.hub-dmix-week-legend abbr {
  text-decoration: none;
  border-bottom: 1px dotted rgba(140, 170, 190, 0.45);
  cursor: help;
}

@media (max-width: 720px) {
  .hub-dmix-body { grid-template-columns: 1fr; }
  .hub-dmix-events li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .hub-dmix-ev-tier { text-align: left; }
}

