:root {
    color-scheme: dark;
    font-family: Montserrat, "Source Sans Pro", system-ui, sans-serif;
    --sunwave-navy: #0b3d91;
    --sunwave-blue: #1676d2;
    --sunwave-orange: #f28c00;
    --sunwave-gold: #ffb000;
    --panel: rgba(4, 19, 43, 0.94);
    --text: #f7fbff;
    --muted: #afc1d8;
}

* { box-sizing: border-box; }
html, body, .live-map-shell { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #071426; color: var(--text); }
.live-map-shell { position: relative; }
.live-map-canvas { position: absolute; inset: 0; }
.live-map-panel {
    position: absolute;
    z-index: 2;
    top: 1rem;
    left: 1rem;
    width: min(24rem, calc(100% - 2rem));
    max-height: calc(100% - 2rem);
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 1rem;
    background: var(--panel);
    box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(0.7rem);
}
.live-map-panel__header { display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.15rem 0.8rem; }
.live-map-panel h1, .flight-card h2 { margin: 0; }
.live-map-eyebrow, .flight-card__eyebrow { margin: 0 0 0.2rem; color: var(--sunwave-gold); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.live-map-count { align-self: center; padding: 0.35rem 0.55rem; border-radius: 999px; background: rgba(22, 118, 210, 0.25); color: #dceeff; font-size: 0.8rem; white-space: nowrap; }
.live-map-status { margin: 0; padding: 0 1.15rem 1rem; color: var(--muted); font-size: 0.88rem; }
.live-map-status[data-level="warning"] { color: #ffd38a; }
.live-map-status[data-level="error"] { color: #ffb3ad; }
.flight-card { position: relative; border-top: 1px solid rgba(255, 255, 255, 0.12); padding: 1rem 1.15rem 1.2rem; }
.flight-card__close { position: absolute; top: 0.7rem; right: 0.8rem; border: 0; background: transparent; color: var(--muted); font-size: 1.5rem; cursor: pointer; }
.flight-card__close:focus-visible { outline: 3px solid var(--sunwave-gold); outline-offset: 2px; }
.flight-card__title-row { display: flex; align-items: center; justify-content: space-between; min-height: 5.25rem; gap: 0.8rem; padding-right: 1.75rem; }
.flight-card__airline-logo { display: block; width: auto; max-width: 7rem; height: auto; max-height: 5.25rem; object-fit: contain; flex: 0 0 auto; }
.flight-card__airline-logo[hidden] { display: none; }
.flight-card__grid { display: grid; grid-template-columns: minmax(7rem, 0.8fr) 1.2fr; gap: 0.45rem 0.8rem; margin: 1rem 0; font-size: 0.86rem; }
.flight-card__grid dt { color: var(--muted); }
.flight-card__grid dd { margin: 0; overflow-wrap: anywhere; }
.flight-card__legend { display: flex; flex-wrap: wrap; gap: 0.9rem; color: var(--muted); font-size: 0.76rem; }
.flight-card__legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.flight-card__network {
    margin-top: 0.9rem;
    padding: 0.48rem 0.75rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-align: center;
}
.flight-card__network--ivao { background: rgba(30, 82, 150, 0.24); color: #8fc5ff; }
.flight-card__network--vatsim { background: rgba(128, 70, 154, 0.24); color: #d9a8f0; }
.flight-card__network[hidden] { display: none; }
.legend-line { width: 1.5rem; border-top: 3px solid; }
.legend-line--route { border-color: var(--sunwave-orange); border-top-style: dashed; }
.legend-line--track { border-color: var(--sunwave-blue); }

.aircraft-marker { z-index: 20 !important; width: 5.5rem; border: 0; background: transparent; box-shadow: none; text-align: center; cursor: pointer; }
.aircraft-marker__visual { position: relative; width: 4.75rem; height: 4.75rem; margin: auto; transform-origin: 50% 50%; transition: width 200ms ease, height 200ms ease; }
.aircraft-marker__image { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0.18rem 0.16rem rgba(0, 0, 0, 0.42)); transform-origin: 50% 50%; }
.aircraft-marker__fallback { position: absolute; inset: 0.35rem; border: 2px solid #fff; border-radius: 50% 50% 44% 44%; background: var(--sunwave-blue); }
.aircraft-marker__fallback::before { content: ""; position: absolute; left: 50%; top: -0.35rem; width: 0; height: 0; border-right: 0.3rem solid transparent; border-bottom: 0.55rem solid #fff; border-left: 0.3rem solid transparent; transform: translateX(-50%); }
.aircraft-marker[data-has-image="true"] .aircraft-marker__fallback { display: none; }
.aircraft-marker[data-has-image="false"] .aircraft-marker__image { display: none; }
.aircraft-marker__label { display: inline-block; margin-top: 0.05rem; padding: 0.12rem 0.32rem; border-radius: 0.28rem; background: rgba(4, 19, 43, 0.88); color: #fff; font-size: 0.65rem; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.aircraft-marker:focus-visible { outline: 3px solid var(--sunwave-gold); outline-offset: 3px; }

.airport-marker {
    position: relative;
    z-index: 5 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.7rem !important;
    min-width: 2.7rem !important;
    max-width: 2.7rem !important;
    height: 2.7rem !important;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    letter-spacing: 0.04em;
    box-shadow: 0 0.3rem 0.7rem rgba(0, 0, 0, 0.35);
}
.airport-marker::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -0.48rem;
    width: 0.65rem;
    height: 0.65rem;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    background: inherit;
    transform: translateX(-50%) rotate(45deg);
}
.airport-marker--origin { background: var(--sunwave-blue); }
.airport-marker--destination { background: var(--sunwave-orange); }

@media (max-width: 700px) {
    .live-map-panel { top: auto; bottom: 0.65rem; left: 0.65rem; width: calc(100% - 1.3rem); max-height: 48%; border-radius: 0.85rem; }
    .live-map-panel__header { padding-top: 0.85rem; }
    .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: 48%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
    .aircraft-marker__visual { transition: none; }
}
