:root {
    --accent: 100, 180, 255;
    --accent2: 60, 140, 255;
    --green: 80, 190, 140;
    --green2: 60, 200, 120;
    --text: 160, 220, 255;
    --bg-panel: 8, 12, 20;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #0a0a0f;
    font-family: "DM Mono", monospace;
}

#map {
    width: 100vw;
    height: 100vh;
    touch-action: none;
}

.leaflet-container {
    cursor: crosshair !important;
}

@media (prefers-color-scheme: dark) {
    .leaflet-layer,
    .leaflet-control-zoom-in,
    .leaflet-control-zoom-out,
    .leaflet-control-attribution {
        filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
    }
}

#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1000;
}

#plane-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#plane-svg {
    width: 168px;
    height: 168px;
    will-change: transform;
}

#instruments {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 18px;
    align-items: flex-end;
    pointer-events: none;
    background: rgba(var(--bg-panel), 0.82);
    border-radius: 40px;
    border: 1px solid rgba(var(--accent), 0.18);
    padding: 14px 20px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.55),
        0 8px 40px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(var(--accent), 0.06);
    backdrop-filter: blur(6px);
}

@media (max-width: 500px) {
    #instruments {
        left: 50%;
        transform: translateX(-50%) scale(0.58);
        transform-origin: bottom center;
    }
}

.gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.gauge-ring {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 38% 35%,
        rgba(30, 50, 80, 0.9) 0%,
        rgba(var(--bg-panel), 0.97) 65%
    );
    border: 1.5px solid rgba(var(--accent), 0.22);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        inset 0 0 20px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(var(--accent), 0.08),
        0 0 18px rgba(var(--accent2), 0.07);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-label {
    font-size: 9px;
    letter-spacing: 0.2em;
    color: rgba(100, 160, 220, 0.55);
    text-transform: uppercase;
}

#pos-gauge {
    align-self: center;
}

#coords {
    background: radial-gradient(
        ellipse at 50% 30%,
        rgba(10, 25, 40, 0.85) 0%,
        rgba(4, 8, 16, 0.92) 100%
    );
    border: 1.5px solid rgba(var(--accent), 0.18);
    border-radius: 12px;
    padding: 8px 14px;
    height: 72px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-family: "DM Mono", monospace;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.05em;
    color: rgba(var(--green), 0.9);
    line-height: 1.4;
    text-shadow: 0 0 8px rgba(var(--green), 0.4);
    box-shadow:
        inset 0 0 14px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(var(--accent), 0.05),
        0 0 0 1px rgba(0, 0, 0, 0.5);
}

#offline-warning {
    display: none;
    position: absolute;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(var(--bg-panel), 0.85);
    border: 1.5px solid rgba(var(--accent), 0.25);
    border-radius: 14px;
    padding: 10px 22px;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: rgba(var(--accent), 0.85);
    text-align: center;
    white-space: nowrap;
    box-shadow:
        inset 0 0 10px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

#support-strip {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(var(--bg-panel), 0.85);
    border-bottom: 1px solid rgba(var(--accent), 0.25);
    padding: 7px 0;
    text-align: center;
    font-size: 13px;
    letter-spacing: 0.1em;
    color: rgba(var(--text), 0.85);
    z-index: 1001;
    backdrop-filter: blur(6px);
    pointer-events: all;
}

#support-strip a {
    color: rgba(var(--accent), 0.9);
    text-decoration: none;
}

#support-strip a:hover {
    text-decoration: underline;
}

#eng-switch {
    cursor: pointer;
    pointer-events: all;
}

#trk-switch {
    cursor: pointer;
    pointer-events: all;
}

#nav-switch {
    cursor: pointer;
    pointer-events: all;
}

.switch-wrapper {
    width: 36px;
    height: 72px;
    background: radial-gradient(
        circle at 38% 30%,
        rgba(30, 50, 80, 0.9) 0%,
        rgba(var(--bg-panel), 0.97) 70%
    );
    border: 1.5px solid rgba(var(--accent), 0.22);
    border-radius: 10px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        inset 0 0 20px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(var(--accent), 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.switch-track {
    width: 8px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(var(--accent), 0.2);
    border-radius: 5px;
    position: relative;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
}

.switch-knob {
    width: 15px;
    height: 15px;
    background: rgba(100, 140, 180, 0.7);
    border: 1px solid rgba(var(--accent), 0.3);
    border-radius: 50%;
    position: absolute;
    left: 50%;
    transform: translate(-50%, 1px);
    transition: transform 0.15s;
}

.switch-on .switch-knob {
    transform: translate(-50%, 12px);
    background: rgba(var(--green2), 0.9);
    box-shadow: 0 0 8px rgba(var(--green2), 0.5);
}

#fl-dial-ring {
    cursor: pointer;
    pointer-events: all;
    touch-action: none;
}

#compass-needle {
    will-change: transform;
}

#pause-btn {
    position: absolute;
    top: 52px;
    left: 88px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(var(--bg-panel), 0.55);
    border: 1px solid rgba(var(--accent), 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    cursor: pointer;
    backdrop-filter: blur(4px);
    opacity: 0.75;
    transition:
        opacity 0.3s,
        border-color 0.3s;
}

#pause-btn:hover {
    opacity: 0.85;
    border-color: rgba(var(--accent), 0.3);
}

#help-btn {
    position: absolute;
    top: 52px;
    left: 52px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(var(--bg-panel), 0.55);
    border: 1px solid rgba(var(--accent), 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    cursor: pointer;
    backdrop-filter: blur(4px);
    opacity: 0.75;
    font-size: 14px;
    color: rgba(var(--accent), 0.7);
    transition:
        opacity 0.3s,
        border-color 0.3s;
}

#help-btn:hover {
    opacity: 0.85;
    border-color: rgba(var(--accent), 0.3);
}

@media (max-width: 500px) {
    #help-btn {
        top: 36px;
        left: 8px;
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    #pause-btn {
        top: 36px;
        left: 40px;
        width: 26px;
        height: 26px;
    }
}

#help-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2000;
    pointer-events: all;
    align-items: center;
    justify-content: center;
}

.help-panel {
    background: rgba(var(--bg-panel), 0.92);
    border: 1px solid rgba(var(--accent), 0.2);
    border-radius: 18px;
    padding: 28px 32px 24px;
    max-width: 360px;
    width: 90%;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.55),
        0 12px 60px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(var(--accent), 0.06);
    backdrop-filter: blur(10px);
    position: relative;
}

.help-title {
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 0.15em;
    color: rgba(var(--accent), 0.85);
    text-transform: uppercase;
    margin-bottom: 18px;
    text-align: center;
}

.help-close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 18px;
    color: rgba(var(--accent), 0.5);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.help-close:hover {
    color: rgba(var(--accent), 0.9);
}

.help-section {
    margin-bottom: 14px;
}

.help-section-title {
    font-size: 10px;
    letter-spacing: 0.15em;
    color: rgba(var(--green), 0.65);
    text-transform: uppercase;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(var(--accent), 0.08);
    padding-bottom: 4px;
}

.help-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 0;
    font-size: 12px;
    color: rgba(var(--text), 0.8);
}

.help-key {
    color: rgba(var(--accent), 0.75);
    white-space: nowrap;
}

.help-desc {
    color: rgba(var(--text), 0.55);
    text-align: right;
}
