
:root {
    --bg: #08111f;
    --panel: rgba(13, 22, 40, 0.88);
    --panel-2: rgba(18, 30, 53, 0.92);
    --border: rgba(148, 163, 184, 0.18);
    --text: #e8eefc;
    --muted: #93a4c7;
    --accent: #57b5ff;
    --accent-2: #7ef0c7;
    --warn: #ffb454;
    --danger: #ff6b7a;
    --shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
    radial-gradient(circle at top left, rgba(87, 181, 255, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(126, 240, 199, 0.08), transparent 24%),
    linear-gradient(180deg, #060d19 0%, #08111f 100%);
    color: var(--text);
    overflow: hidden;
}

.app {
    display: grid;
    grid-template-columns: 390px 1fr;
    height: 100vh;
    gap: 16px;
    padding: 16px;
}

.sidebar,
.map-shell {
    min-height: 0;
}

.sidebar {
    display: flex;
    flex-direction: column;
    overflow: auto;
    gap: 16px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.header-card {
    padding: 20px;
    background:
    linear-gradient(145deg, rgba(87, 181, 255, 0.16), rgba(126, 240, 199, 0.05)),
    var(--panel);
}

.eyebrow {
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

h1 {
    font-size: 28px;
    line-height: 1.05;
    margin: 0 0 10px;
    letter-spacing: -0.03em;
}

.subtle {
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
}

.controls-card,
.status-card,
.video-card,
.map-key-card,
.log-card,
.footer-card {
    padding: 18px;
}

.controls-grid {
    display: grid;
    gap: 12px;
}

.field label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.field input,
.field select {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(6, 13, 25, 0.85);
    color: var(--text);
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.field input:focus,
.field select:focus {
    border-color: rgba(87, 181, 255, 0.75);
    transform: translateY(-1px);
}

.button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 2px;
}

button {
    border: 0;
    border-radius: 14px;
    padding: 12px 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent), #3996ff);
    color: white;
    box-shadow: 0 10px 22px rgba(87, 181, 255, 0.25);
}

.secondary-btn {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.metric {
    background: var(--panel-2);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 16px;
    padding: 14px;
    min-height: 90px;
}

.metric-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.metric-value {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.metric-sub {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.log-card {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 0;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}

.section-title h2 {
    margin: 0;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
}

.pill-dot-active {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-2);
    box-shadow: 0 0 10px rgba(126, 240, 199, 0.7);
}

.pill-dot-inactive {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 10px rgba(229, 41, 12, 0.7);
}

.pill-dot-connecting {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d4ea0e;
    box-shadow: 0 0 10px rgba(218, 229, 12, 0.7);
}

.packet-log {
    overflow: auto;
    padding-right: 4px;
    display: grid;
    gap: 10px;
    align-content: start;
}

.packet-item {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.packet-item strong {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
}

.packet-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
}

.video-card {
    display: grid;
    gap: 14px;
}

.video-card .section-title {
    margin-bottom: 0;
}

.video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(6, 13, 25, 0.85);
}

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

/* .map-key-card {
    margin-top: auto;
} */

.map-key-card h2 {
    margin: 0 0 12px;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.map-key-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.map-key-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.map-key-line {
    width: 34px;
    height: 4px;
    flex: 0 0 auto;
    border-radius: 999px;
}

.map-key-circle {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border-radius: 50%;
}

.map-key-pin {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border: 2px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
}

.map-key-line-aprs {
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.45);
}

.map-key-line-lora {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
}

.map-key-circle-lora {
    background: rgba(239, 68, 68, 0.16);
    border: 2px solid rgba(239, 68, 68, 0.45);
}

.map-key-pin-lora {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.55);
}

.map-key-line-spot {
    background: #fbce04;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
}

.past-flights-card {
    margin: 0 0 12px;
    font-size: 16px;
    letter-spacing: -0.02em;
    padding: 10px;  
}

.past-flight-link {
    padding-bottom: 20px;
    /* margin-bottom: 10px; */
}

.past-flights-card h3 {
    margin-top: 8px;
}

.past-flight-link a {
    color: #cdd2ff;
    text-decoration: none;  
    font-size: 15px;
}

.footer-card {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    font-size: 13px;
    color: var(--muted);
}

.map-shell {
    position: relative;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: #07101d;
}

#map {
    display: block;
    width: 100%;
    height: 100%;
}

.map-overlay {
    position: absolute;
    top: 18px;
    left: 18px;
    right: 18px;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    z-index: 2;
}

.map-badge,
.legend {
    pointer-events: auto;
    background: rgba(9, 15, 28, 0.78);
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.map-badge {
    padding: 14px 16px;
    min-width: 240px;
}

.map-badge-title {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 6px;
    font-weight: 700;
}

.map-badge-value {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.legend {
    padding: 12px 14px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
}

.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 999px;
}

.empty-state {
    color: var(--muted);
    font-size: 13px;
    padding: 8px 2px;
}

.status-good { color: var(--accent-2); }
.status-warn { color: var(--warn); }
.status-bad { color: var(--danger); }

@media (max-width: 1100px) {
    html, body {
    overflow: auto;
    }

    .app {
    grid-template-columns: 1fr;
    height: auto;
    }

    .map-shell {
    height: 65vh;
    min-height: 420px;
    }
}
