body {
    margin: 0;
    overflow: hidden;
    background: #000000;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ── Loading Screen ── */

#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #1a2520 0%, #050a08 100%);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    font-family: "Courier New", monospace;
}

#loadingScreen.active {
    display: flex;
}

#loadingScreen.fade-out {
    animation: loadingFadeOut 0.6s ease-out forwards;
}

@keyframes loadingFadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.loading-radar {
    position: relative;
    width: 140px;
    height: 140px;
}

.radar-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 1px solid rgba(100, 150, 100, 0.25);
}

.radar-circle-2 {
    width: 80px;
    height: 80px;
    border-color: rgba(100, 150, 100, 0.2);
}

.radar-circle-3 {
    width: 40px;
    height: 40px;
    border-color: rgba(100, 150, 100, 0.15);
}

.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 2px;
    transform-origin: 0% 50%;
    background: linear-gradient(90deg, rgba(100, 200, 100, 0.8), transparent);
    animation: radarSweep 2s linear infinite;
}

@keyframes radarSweep {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.radar-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: #6f9f6f;
    box-shadow: 0 0 8px rgba(100, 200, 100, 0.7);
    animation: radarDotPulse 1.5s ease-in-out infinite;
}

@keyframes radarDotPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.4); }
}

.loading-title {
    font-size: 16px;
    letter-spacing: 6px;
    color: #6f9f6f;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(100, 150, 100, 0.4);
    animation: loadingTitlePulse 2.5s ease-in-out infinite;
}

@keyframes loadingTitlePulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.loading-bar-track {
    width: 240px;
    height: 4px;
    background: rgba(100, 150, 100, 0.15);
    border: 1px solid rgba(100, 150, 100, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4a7a4a, #6f9f6f);
    box-shadow: 0 0 6px rgba(100, 200, 100, 0.4);
    transition: width 0.3s ease-out;
}

.loading-status {
    font-size: 10px;
    letter-spacing: 2px;
    color: #5a8a5a;
    text-transform: uppercase;
}

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

#WebGL-output canvas {
    touch-action: none;
}

#overlay {
    position: fixed;
    top: 14px;
    left: 14px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.45);
    color: #f2f2f2;
    font-size: 13px;
    letter-spacing: 0.4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    pointer-events: none;
}

#threejsStatsHud {
    display: none;
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 250;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #e7f4ff;
    font-size: 12px;
    line-height: 1.45;
    letter-spacing: 0.2px;
    border: 1px solid rgba(120, 180, 255, 0.28);
    border-radius: 8px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
    white-space: pre-line;
    min-width: 180px;
    text-align: left;
}

#controlButtons {
    display: none;
}

.hudButton {
    display: none;
}

#militaryMenu {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(15, 20, 30, 0.95);
    border: 2px solid rgba(100, 150, 100, 0.6);
    border-radius: 2px;
    padding: 12px 25px;
    font-family: "Courier New", monospace;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(100, 150, 100, 0.1);
    display: none;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
    max-width: 95vw;
    overflow-x: auto;
}

#militaryMenu.game-active {
    display: flex;
}

.menu-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.menu-title {
    color: #6f9f6f;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding-right: 10px;
    border-right: 1px solid rgba(100, 150, 100, 0.4);
    min-width: 60px;
    text-align: right;
}

.menu-option {
    padding: 5px 11px;
    color: #b0d4b0;
    background: rgba(30, 45, 35, 0.7);
    border: 1px solid rgba(100, 150, 100, 0.4);
    border-radius: 1px;
    font-size: 10px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-width: auto;
    white-space: nowrap;
}

.menu-option:hover {
    background: rgba(60, 90, 60, 0.9);
    border-color: rgba(100, 150, 100, 0.8);
    color: #d0f0d0;
    box-shadow: 0 0 8px rgba(100, 150, 100, 0.3);
}

.menu-option.active {
    background: rgba(80, 120, 80, 0.8);
    border-color: rgba(150, 200, 150, 0.7);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(100, 150, 100, 0.5);
}

#backToMenuBtn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(30, 45, 35, 0.8);
    border: 2px solid rgba(100, 150, 100, 0.6);
    color: #b0d4b0;
    padding: 10px 20px;
    font-size: 14px;
    font-family: "Courier New", monospace;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), inset 0 0 5px rgba(100, 150, 100, 0.1);
    display: none; 
}

#backToMenuBtn:hover {
    background: rgba(60, 90, 60, 0.9);
    border-color: rgba(150, 200, 150, 0.9);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(100, 150, 100, 0.6);
    transform: scale(1.05);
}

#mainMenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #1a2520 0%, #050a08 100%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: "Courier New", monospace;
    color: #b0d4b0;
}

.main-header {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 50px;
    text-transform: uppercase;
    letter-spacing: 8px;
    color: #6f9f6f;
    text-shadow: 0 0 20px rgba(100, 150, 100, 0.5);
    text-align: center;
}

.main-btn {
    background: rgba(30, 45, 35, 0.8);
    border: 2px solid rgba(100, 150, 100, 0.6);
    color: #b0d4b0;
    padding: 15px 40px;
    margin: 12px;
    font-size: 18px;
    font-family: "Courier New", monospace;
    font-weight: bold;
    letter-spacing: 3px;
    cursor: pointer;
    width: 280px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.main-btn:hover {
    background: rgba(60, 90, 60, 0.9);
    border-color: rgba(150, 200, 150, 0.9);
    color: #ffffff;
    box-shadow: 0 0 20px rgba(100, 150, 100, 0.6);
    transform: scale(1.05);
}

#mobileControls {
    position: fixed;
    bottom: 40px;
    left: 20px;
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 200;
}

.dpad-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.dpad-btn {
    width: 50px;
    height: 50px;
    background: rgba(30, 45, 35, 0.8);
    border: 2px solid rgba(100, 150, 100, 0.6);
    color: #b0d4b0;
    font-size: 20px;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    touch-action: none;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.dpad-btn:active {
    background: rgba(60, 90, 60, 0.9);
    box-shadow: 0 0 15px rgba(100, 150, 100, 0.6);
}

#hamburgerBtn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    background: rgba(30, 45, 35, 0.8);
    border: 2px solid rgba(100, 150, 100, 0.6);
    color: #b0d4b0;
    padding: 8px 12px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    display: none;
    border-radius: 4px;
    transition: all 0.2s;
}

#hamburgerBtn:hover {
    background: rgba(60, 90, 60, 0.9);
    color: #ffffff;
}

.sub-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 900;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1a2520 0%, #050a08 100%);
    font-family: "Courier New", monospace;
    color: #b0d4b0;
    overflow-y: auto;
    padding: 80px 24px 40px;
    box-sizing: border-box;
}

.sub-page.active {
    display: flex;
}

.sub-page-header {
    font-size: 32px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 6px;
    color: #6f9f6f;
    text-shadow: 0 0 16px rgba(100, 150, 100, 0.4);
    margin-bottom: 12px;
    text-align: center;
}

.sub-page-subtitle {
    font-size: 13px;
    letter-spacing: 2px;
    color: #7a9a7a;
    margin-bottom: 36px;
    text-align: center;
    max-width: 560px;
    line-height: 1.6;
}

.model-pick-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    max-width: 900px;
}

.model-pick-btn {
    background: rgba(30, 45, 35, 0.85);
    border: 2px solid rgba(100, 150, 100, 0.6);
    color: #b0d4b0;
    padding: 28px 36px;
    min-width: 220px;
    font-size: 16px;
    font-family: "Courier New", monospace;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
}

.model-pick-btn:hover {
    background: rgba(60, 90, 60, 0.9);
    border-color: rgba(150, 200, 150, 0.9);
    color: #ffffff;
    transform: scale(1.04);
}

#modelViewerPage {
    padding: 0;
    justify-content: flex-start;
    background: #000;
}

#modelViewerPage.active {
    display: block;
}

#modelViewerCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 901;
}

#modelViewerPanel {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 902;
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 95vw;
    padding: 14px 20px;
    background: rgba(15, 20, 30, 0.95);
    border: 2px solid rgba(100, 150, 100, 0.6);
    border-radius: 2px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

#modelViewerPanel.active {
    display: flex;
}

#modelViewerTitle {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 902;
    display: none;
    font-size: 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #6f9f6f;
    background: rgba(15, 20, 30, 0.85);
    padding: 8px 18px;
    border: 1px solid rgba(100, 150, 100, 0.5);
}

#modelViewerTitle.active {
    display: block;
}

.viewer-btn {
    padding: 8px 16px;
    color: #b0d4b0;
    background: rgba(30, 45, 35, 0.8);
    border: 1px solid rgba(100, 150, 100, 0.5);
    font-size: 11px;
    font-family: "Courier New", monospace;
    letter-spacing: 1px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.viewer-btn:hover {
    background: rgba(60, 90, 60, 0.9);
    color: #fff;
}

.viewer-btn.on {
    background: rgba(80, 120, 80, 0.85);
    border-color: rgba(150, 200, 150, 0.7);
    color: #fff;
}

.info-panel {
    max-width: 720px;
    width: 100%;
    background: rgba(15, 20, 30, 0.7);
    border: 2px solid rgba(100, 150, 100, 0.4);
    padding: 28px 32px;
    line-height: 1.75;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.info-panel h3 {
    color: #6f9f6f;
    font-size: 13px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 22px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(100, 150, 100, 0.3);
}

.info-panel h3:first-child {
    margin-top: 0;
}

.info-panel ul {
    margin: 0;
    padding-left: 22px;
}

.info-panel li {
    margin-bottom: 6px;
}

.info-panel kbd {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(30, 45, 35, 0.9);
    border: 1px solid rgba(100, 150, 100, 0.5);
    border-radius: 2px;
    font-size: 12px;
    margin: 0 2px;
}

.author-link {
    color: #ffffff;
    text-decoration: none;
}

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

.sub-back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 910;
    display: none;
    background: rgba(30, 45, 35, 0.9);
    border: 2px solid rgba(100, 150, 100, 0.6);
    color: #b0d4b0;
    padding: 10px 20px;
    font-size: 14px;
    font-family: "Courier New", monospace;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), inset 0 0 5px rgba(100, 150, 100, 0.1);
}

.sub-back-btn:hover {
    background: rgba(60, 90, 60, 0.9);
    border-color: rgba(150, 200, 150, 0.9);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(100, 150, 100, 0.6);
    transform: scale(1.05);
}

.sub-back-btn.active {
    display: block;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    #militaryMenu.game-active {
        display: none !important;
    }
    #militaryMenu.game-active.mobile-open {
        display: flex !important;
        position: fixed;
        top: 70px;
        right: 20px;
        left: auto;
        bottom: auto;
        transform: none;
        flex-direction: column;
        align-items: flex-end;
        max-width: 80vw;
        padding: 10px 15px;
    }
    .menu-section {
        flex-wrap: wrap;
        justify-content: flex-end;
        margin-bottom: 10px;
        width: 100%;
    }
    .menu-title {
        text-align: right;
        border-right: none;
        border-bottom: 1px solid rgba(100, 150, 100, 0.4);
        padding-right: 0;
        padding-bottom: 4px;
        margin-bottom: 6px;
        width: 100%;
    }
    button[data-action="view-heli"],
    button[data-action="lights-heli"] {
        display: none !important;
    }
    #hamburgerBtn.game-active {
        display: block;
    }
}