:root {
    --primary: #00f3ff;
    --primary-dim: rgba(0, 243, 255, 0.3);
    --secondary: #d300ff;
    --danger: #ff003c;
    --success: #00ff9d;
    --warning: #fcee0a;
    --dark-bg: #0b0b1a;
    --glass: rgba(16, 20, 40, 0.7);
    --glass-border: rgba(0, 243, 255, 0.3);
    --text-main: #e0f6ff;
    --text-muted: #8a9ba8;
    --font-head: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    /* Prevent selection */
}

body {
    font-family: var(--font-body);
    background-color: #0b0b1a;
    color: var(--text-main);
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    /* Fix viewport bounce on mobile */
    touch-action: none;
    /* Disable browser gestures */


}

/* New Dynamic Background System */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
    overflow: hidden;
}

.stars-sm,
.stars-md,
.stars-lg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

/* Small Stars (Fastest, Farthest visuals via parallax speed illusion) */
.stars-sm {
    background-image:
        radial-gradient(1px 1px at 10% 10%, #fff, transparent),
        radial-gradient(1px 1px at 20% 80%, #fff, transparent),
        radial-gradient(1px 1px at 40% 40%, #fff, transparent),
        radial-gradient(1px 1px at 60% 20%, #fff, transparent),
        radial-gradient(1px 1px at 80% 60%, #fff, transparent),
        radial-gradient(1px 1px at 90% 90%, #fff, transparent),
        radial-gradient(1px 1px at 30% 50%, #fff, transparent),
        radial-gradient(1px 1px at 70% 30%, #fff, transparent);
    background-size: 400px 400px;
    opacity: 0.6;
    animation: starsMove 20s linear infinite;
}

/* Holographic Tech Corners */
.plane-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    border-radius: 24px;
    background:
        linear-gradient(to right, #00f3ff 2px, transparent 2px) 0 0,
        linear-gradient(to bottom, #00f3ff 2px, transparent 2px) 0 0,
        linear-gradient(to left, #00f3ff 2px, transparent 2px) 100% 0,
        linear-gradient(to bottom, #00f3ff 2px, transparent 2px) 100% 0,
        linear-gradient(to right, #00f3ff 2px, transparent 2px) 0 100%,
        linear-gradient(to top, #00f3ff 2px, transparent 2px) 0 100%,
        linear-gradient(to left, #00f3ff 2px, transparent 2px) 100% 100%,
        linear-gradient(to top, #00f3ff 2px, transparent 2px) 100% 100%;
    background-size: 20px 20px;
    background-repeat: no-repeat;
    pointer-events: none;
    box-shadow: inset 0 0 20px rgba(0, 243, 255, 0.1);
    z-index: 20;
    opacity: 0.8;
}

/* Hide corners on mobile to save space/clutter */
@media (max-width: 600px) {
    .plane-preview::after {
        display: none;
    }
}

/* Medium Stars */
.stars-md {
    background-image:
        radial-gradient(2px 2px at 15% 15%, #fff, transparent),
        radial-gradient(2px 2px at 35% 75%, #fff, transparent),
        radial-gradient(2px 2px at 55% 25%, #fff, transparent),
        radial-gradient(2px 2px at 75% 65%, #fff, transparent),
        radial-gradient(2px 2px at 95% 45%, #fff, transparent);
    background-size: 500px 500px;
    opacity: 0.8;
    animation: starsMove 30s linear infinite;
}

/* Large Stars (Slowest, Nearest) */
.stars-lg {
    background-image:
        radial-gradient(3px 3px at 5% 5%, #fff, transparent),
        radial-gradient(3px 3px at 25% 85%, #fff, transparent),
        radial-gradient(3px 3px at 65% 35%, #fff, transparent),
        radial-gradient(3px 3px at 85% 55%, #fff, transparent);
    background-size: 600px 600px;
    opacity: 1;
    animation: starsMove 40s linear infinite;
}

/* Nebula Overlay for color */
.nebula-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(0, 243, 255, 0.1), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(211, 0, 255, 0.1), transparent 50%);
    animation: nebulaPulse 10s ease-in-out infinite alternate;
    mix-blend-mode: screen;
}

@keyframes starsMove {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 1000px;
    }
}

@keyframes nebulaPulse {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }

    100% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* Scanline Effect */
/* Scanline Effect */
body::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 243, 255, 0.03) 3px);
    pointer-events: none;
    z-index: 999;
    animation: scanlineScroll 10s linear infinite;
}

@keyframes scanlineScroll {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 100%;
    }
}

/* Global Styles */
button {
    cursor: pointer;
    font-family: var(--font-head);
    border: none;
    outline: none;
    transition: all 0.2s ease;
}

h1,
h2,
h3 {
    font-family: var(--font-head);
    text-transform: uppercase;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
    letter-spacing: 2px;
}

.hidden {
    display: none !important;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 10;
    padding: 20px;
}

.screen.active {
    display: flex;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Sci-Fi Glass Panels */
.glass-panel {
    background: rgba(16, 20, 40, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 243, 255, 0.2);
    box-shadow:
        0 0 30px rgba(0, 243, 255, 0.05),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    position: relative;
    padding: 2.5rem;
    color: #fff;
    max-width: 90%;
    width: 480px;
    text-align: center;
    background-image:
        linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* Decorative Corners for panels */
.glass-panel::before,
.glass-panel::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    transition: all 0.3s;
    box-shadow: 0 0 10px var(--primary);
}

.glass-panel::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 4px;
}

.glass-panel::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 4px;
}

.glass-panel.full-panel,
.glass-panel.content-panel {
    width: 1000px;
    max-width: 95vw;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
.game-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow:
        0 0 10px var(--primary),
        0 0 20px var(--primary),
        0 0 40px var(--primary-dim);
    animation: titlePulse 3s ease-in-out infinite alternate;
}

@keyframes titlePulse {
    from {
        text-shadow:
            0 0 10px var(--primary),
            0 0 20px var(--primary),
            0 0 40px var(--primary-dim);
    }

    to {
        text-shadow:
            0 0 15px var(--primary),
            0 0 30px var(--primary),
            0 0 50px var(--primary-dim);
    }
}

.game-title.small {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    letter-spacing: 3px;
    text-shadow: 0 0 15px var(--primary);
    animation: none;
}

/* Auth Form - Aero Redesign */
.auth-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 2rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    padding: 10px 15px;
    font-size: 0.9rem;
    border: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.tab-btn.active {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 18px;
}

.auth-form.active {
    display: flex;
}

/* Inputs - Aero Glass Style */
input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 16px 20px;
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
    width: 100%;
}

/* Prevent zoom on mobile inputs */
@media (max-width: 768px) {
    input {
        font-size: 16px;
    }
}

input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

input:focus {
    background: rgba(0, 243, 255, 0.05);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.15);
}

/* Sci-fi Buttons - Refined Aero */
.cta-btn,
.action-btn,
.diff-btn,
#btn-retry,
#btn-quit {
    background: linear-gradient(135deg, var(--primary) 0%, #00c2cc 100%);
    color: #000;
    padding: 16px 30px;
    border-radius: 8px;
    border: none;
    font-weight: 800;
    font-size: 1.1rem;
    margin-top: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.cta-btn:hover,
.action-btn:hover,
.diff-btn:hover,
#btn-retry:hover,
#btn-quit:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.6);
    filter: brightness(1.1);
}

.cta-btn:active,
.action-btn:active {
    transform: translateY(1px);
}

.cta-btn.secondary {
    border: 1px solid var(--secondary);
    color: var(--secondary);
    background: transparent;
    box-shadow: none;
}

.cta-btn.secondary:hover {
    background: var(--secondary);
    color: #fff;
    box-shadow: 0 0 20px var(--secondary);
}

.message {
    color: var(--danger);
    margin-top: 10px;
    font-size: 0.9rem;
    min-height: 20px;
    text-transform: uppercase;
}

/* User Profile - Pilot ID Card Style */
/* RE-DESIGN: Modern Aero Glass - Refined */
.user-profile-summary {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 60px;
    padding: 6px 20px 6px 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    margin: 0 auto 30px auto;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile-summary::after {
    display: none;
}

/* No scanlines */

.avatar-small {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    background: #000;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

#menu-username {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: var(--font-head);
}

.coin-display {
    font-size: 0.8rem;
    color: var(--warning);
    font-weight: 500;
}

.coin-display::before {
    content: none;
}

/* Simplify */

/* MENU GRID: Refined Layout */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
}

.menu-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 24px 15px;
    display: flex;
    flex-direction: column;
    text-align: center;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Remove hover slide effect */
.menu-card::before {
    display: none;
}

.menu-card:hover,
.menu-card:active {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(0, 243, 255, 0.15);
}

.menu-card .icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.2));
}

.menu-card-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.menu-card h3 {
    font-size: 1rem;
    color: #fff;
    margin: 0 0 4px 0;
    letter-spacing: 1.5px;
}

.menu-card p {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

/* Card Specifics - Clean look */
#btn-play h3,
#btn-hangar h3,
#btn-leaderboard h3,
#btn-info h3 {
    color: #fff;
    text-shadow: none;
}

/* Subtle color tints for background hover */
#btn-play:hover {
    background: linear-gradient(145deg, rgba(0, 255, 100, 0.2), rgba(0, 255, 100, 0.05));
    border-color: var(--success);
}

#btn-hangar:hover {
    background: linear-gradient(145deg, rgba(0, 243, 255, 0.2), rgba(0, 243, 255, 0.05));
    border-color: var(--primary);
}

#btn-leaderboard:hover {
    background: linear-gradient(145deg, rgba(255, 200, 0, 0.2), rgba(255, 200, 0, 0.05));
    border-color: var(--warning);
}

.logout-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-top: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 30px;
    border-radius: 50px;
    /* Pill shape */
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: var(--font-head);
}

.logout-btn:hover {
    background: rgba(255, 0, 60, 0.1);
    border-color: var(--danger);
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 0, 60, 0.4);
    transform: translateY(-2px);
    text-decoration: none;
}

/* Hangar & Leaderboard Inner */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.close-btn {
    background: transparent;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
}

.close-btn:hover {
    color: var(--danger);
}

.leaderboard-table,
.plane-list {
    width: 100%;
    text-align: left;
    overflow-y: auto;
}

.leaderboard-table th {
    padding: 10px;
    color: var(--primary);
    border-bottom: 1px solid var(--glass-border);
}

.leaderboard-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ============================================
   HANGAR — Premium Sci-Fi Ship Bay
   ============================================ */

.hangar-content {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 5px;
}

/* ---- Left: Ship Selection List ---- */
.plane-list {
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-dim) transparent;
}

.plane-list::-webkit-scrollbar {
    width: 4px;
}

.plane-list::-webkit-scrollbar-thumb {
    background: var(--primary-dim);
    border-radius: 4px;
}

.shop-item {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.shop-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    border-radius: 0 2px 2px 0;
}

/* Holographic Scanner Beam */
.plane-preview::after {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    width: 100%;
    height: 2px;
    background: #00f3ff;
    box-shadow: 0 0 15px #00f3ff, 0 0 30px #00f3ff;
    opacity: 0;
    animation: scannerMove 4s ease-in-out infinite;
    z-index: 5;
    pointer-events: none;
}

@keyframes scannerMove {
    0% {
        top: 10%;
        opacity: 0;
        width: 0%;
        left: 50%;
    }

    10% {
        opacity: 0.8;
        width: 100%;
        left: 0;
    }

    90% {
        opacity: 0.8;
        width: 100%;
        left: 0;
    }

    100% {
        top: 80%;
        opacity: 0;
        width: 0%;
        left: 50%;
    }
}

/* Shop Item - Exclusive Digital Folio */
.shop-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, rgba(20, 30, 50, 0.7) 0%, rgba(10, 15, 30, 0.4) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid rgba(255, 255, 255, 0.2);
    /* Thinner, cleaner border */
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 12px;
    /* Consistent rounding */
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.shop-item:hover {
    background: linear-gradient(90deg, rgba(30, 40, 70, 0.8), rgba(20, 25, 45, 0.6));
    border-color: rgba(0, 243, 255, 0.4);
    border-left-color: var(--primary);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.shop-item.active {
    background: linear-gradient(90deg, rgba(0, 243, 255, 0.1), transparent);
    border: 1px solid var(--primary);
    border-left: 4px solid var(--primary);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.15);
}

/* Exclusive Active Scanner Border */
.shop-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 10px #fff;
    animation: scanBorder 2s ease-in-out infinite;
    z-index: 5;
}

@keyframes scanBorder {
    0% {
        top: 0;
        height: 0;
        opacity: 0;
    }

    20% {
        opacity: 1;
        height: 100%;
        /* Scan full height */
    }

    100% {
        top: 100%;
        height: 0;
        opacity: 0;
    }
}

.shop-thumb {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    background-size: 80%;
    /* Prevent touching edges */
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.5));
    transition: all 0.4s;
    background-color: rgba(255, 255, 255, 0.03);
    /* Subtle backing */
    border-radius: 8px;
    margin-right: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.shop-item:hover .shop-thumb,
.shop-item.active .shop-thumb {
    filter: drop-shadow(0 0 15px rgba(0, 243, 255, 0.6));
    background-color: rgba(0, 243, 255, 0.05);
    border-color: rgba(0, 243, 255, 0.3);
    transform: scale(1.1);
}

.shop-info h4 {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
    font-family: var(--font-head);
    letter-spacing: 1px;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.shop-info p {
    margin: 5px 0 0;
    font-size: 0.8rem;
    color: rgba(200, 220, 255, 0.7);
    line-height: 1.2;
    font-family: 'Roboto Mono', monospace;
}

.shop-status {
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    font-family: var(--font-head);
    white-space: nowrap;
    letter-spacing: 2px;
}

.status-owned {
    color: #ffd700;
    /* Gold */
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    background: linear-gradient(90deg, #ffd700, #ffaa00);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-equipped {
    color: #00f3ff;
    padding: 4px 12px;
    border: 1px solid rgba(0, 243, 255, 0.3);
    background: rgba(0, 243, 255, 0.1);
    border-radius: 20px;
    font-size: 0.65rem;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

/* ---- Right: Preview Panel ---- */
/* ---- Right: Preview Panel - Luxury Glass ---- */
.plane-preview {
    flex: 1;
    background: linear-gradient(135deg, rgba(8, 12, 24, 0.85) 0%, rgba(16, 24, 45, 0.9) 100%);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 24px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.6),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05),
        0 0 20px rgba(0, 243, 255, 0.05);
    overflow: hidden;
    min-height: 0;
    backdrop-filter: blur(12px);
}

/* Subtle Animated Hexagon Mesh Background */
.plane-preview::before {
    content: '';
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background-image:
        radial-gradient(circle at center, transparent 0%, rgba(10, 20, 40, 0.8) 100%),
        repeating-linear-gradient(60deg, rgba(0, 243, 255, 0.03) 0px, rgba(0, 243, 255, 0.03) 1px, transparent 1px, transparent 40px),
        repeating-linear-gradient(-60deg, rgba(0, 243, 255, 0.03) 0px, rgba(0, 243, 255, 0.03) 1px, transparent 1px, transparent 40px);
    background-size: 100% 100%, 70px 120px, 70px 120px;
    transform: perspective(600px) rotateX(20deg);
    animation: hexScroll 15s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes hexScroll {
    0% {
        background-position: 0 0, 0 0, 0 0;
    }

    100% {
        background-position: 0 0, 0 120px, 0 120px;
    }
}

/* Ship Name & Description */
.plane-header-info {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
    position: relative;
    z-index: 10;
}

.plane-header-info h2 {
    font-size: 2.2rem;
    margin-bottom: 5px;
    letter-spacing: 2px;
    background: linear-gradient(180deg, #ffffff 20%, #b0c0d0 50%, #8899aa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px rgba(0, 243, 255, 0.5);
    position: relative;
    font-weight: 800;
}

.plane-header-info h2::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent 40%, rgba(255, 255, 255, 0.8) 45%, transparent 50%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    pointer-events: none;
    background-size: 100% 200%;
    animation: shineText 4s infinite linear;
    opacity: 0.5;
}

@keyframes shineText {
    0% {
        background-position: 0 100%;
    }

    100% {
        background-position: 0 -100%;
    }
}

.plane-desc {
    color: rgba(160, 200, 255, 0.9);
    font-size: 0.9rem;
    font-style: italic;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0, 100, 255, 0.3);
}

/* Hero Ship Image - Premium Flight Mode */
#current-plane-display {
    width: 220px;
    height: 220px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 20px rgba(0, 243, 255, 0.4));
    animation: flightHoverPremium 4s ease-in-out infinite;
    margin-bottom: 50px;
    transition: all 0.5s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

@keyframes flightHoverPremium {
    0% {
        transform: translateY(0) scale(1) rotate(0deg);
        filter: drop-shadow(0 0 15px rgba(0, 243, 255, 0.3));
    }

    50% {
        transform: translateY(-15px) scale(1.05) rotate(2deg);
        filter: drop-shadow(0 0 30px rgba(0, 243, 255, 0.6));
    }

    100% {
        transform: translateY(0) scale(1) rotate(0deg);
        filter: drop-shadow(0 0 15px rgba(0, 243, 255, 0.3));
    }
}

/* Engine Thrust Effect - Shock Diamonds (Outer Plume) */
#current-plane-display::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 90px;
    /* Mach Diamond Pattern */
    background: repeating-linear-gradient(to bottom,
            rgba(0, 255, 255, 0.8) 0%,
            rgba(0, 200, 255, 0.2) 15%,
            rgba(0, 255, 255, 0.8) 30%);
    background-size: 100% 30px;
    /* Spacing of diamonds */
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    filter: blur(4px);
    border-radius: 50% 50% 20% 20%;
    animation: enginePulse 0.1s infinite alternate, flowDiamonds 0.5s linear infinite;
    z-index: -2;
    box-shadow: 0 0 20px rgba(0, 150, 255, 0.6);
}

/* Engine Nozzle (Inner Hot Spot) */
#current-plane-display::before {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 25px;
    background: radial-gradient(circle at center top, #fff, #0ff);
    border-radius: 50%;
    filter: blur(2px);
    z-index: -1;
    box-shadow: 0 0 15px #0ff, 0 0 30px #00f;
    animation: engineCore 0.05s infinite alternate;
}

@keyframes flowDiamonds {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 30px;
    }
}

@keyframes flightHover {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
    }

    25% {
        transform: translateY(-15px) rotate(3deg) scale(1.05);
    }

    50% {
        transform: translateY(-5px) rotate(0deg) scale(1);
    }

    75% {
        transform: translateY(-10px) rotate(-3deg) scale(1.05);
    }

    100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
}

@keyframes enginePulse {
    from {
        height: 50px;
        opacity: 0.7;
        width: 18px;
    }

    to {
        height: 80px;
        opacity: 0.4;
        width: 24px;
    }
}

@keyframes engineCore {
    from {
        height: 25px;
        opacity: 1;
    }

    to {
        height: 35px;
        opacity: 0.8;
    }
}

/* Stats Bars - Integrated Look */
.stats-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    margin-bottom: 25px;
    position: relative;
    z-index: 10;
    backdrop-filter: blur(5px);
}

/* Engine Thrust Effect - Shock Diamonds (Outer Plume) */
#current-plane-display::after {
    content: '';
    position: absolute;
    bottom: -70px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 110px;
    /* Larger and longer */
    background: repeating-linear-gradient(to bottom,
            rgba(0, 255, 255, 0.9) 0%,
            rgba(0, 180, 255, 0.3) 15%,
            rgba(0, 255, 255, 0.9) 30%);
    background-size: 100% 35px;
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    filter: blur(5px);
    border-radius: 50% 50% 20% 20%;
    animation: enginePulse 0.1s infinite alternate, flowDiamonds 0.4s linear infinite;
    z-index: -2;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.8);
}

/* Action Buttons */
.hangar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: auto;
    padding-top: 10px;
}

.action-btn {
    padding: 16px 10px;
    background: rgba(15, 20, 35, 0.8);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-family: var(--font-head);
    font-size: 0.95rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    border-radius: 8px;
    /* Clean rounded tech look */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn.equipped {
    border: 1px solid var(--primary);
    color: var(--primary);
    background: rgba(0, 243, 255, 0.08);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.15), inset 0 0 10px rgba(0, 243, 255, 0.05);
    cursor: default;
    text-shadow: 0 0 8px var(--primary);
}

.action-btn.upgrade,
.action-btn.buy {
    background: linear-gradient(135deg, var(--success), #00ff88);
    color: #000;
    border: none;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.action-btn.upgrade:hover,
.action-btn.buy:hover {
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.6);
    transform: translateY(-2px);
    letter-spacing: 2px;
}

.action-btn.equip {
    border-color: var(--primary);
    color: #fff;
}

.action-btn.equip:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 20px var(--primary);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-label {
    width: 40px;
    text-align: right;
    font-family: var(--font-head);
    color: rgba(200, 240, 255, 0.9);
    font-size: 0.75rem;
    letter-spacing: 1px;
    flex-shrink: 0;
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.3);
}

.stat-bar-bg {
    flex: 1;
    height: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.8);
}

/* Crystal Segment Overlay */
.stat-bar-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(90deg,
            transparent,
            transparent 19%,
            rgba(0, 0, 0, 0.9) 19%,
            rgba(0, 0, 0, 0.9) 20%);
    z-index: 2;
    pointer-events: none;
    mix-blend-mode: overlay;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #88eeff);
    width: 0%;
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 0 10px var(--primary);
    border-radius: 1px;
    position: relative;
    z-index: 1;
}

.stat-fill.damage {
    background: linear-gradient(90deg, #ff2244, #ff6688);
    box-shadow: 0 0 8px var(--danger);
}

.stat-fill.health {
    background: linear-gradient(90deg, #00cc66, #66ffaa);
    box-shadow: 0 0 8px var(--success);
}

.stat-fill.speed {
    background: linear-gradient(90deg, #eedd00, #ffff66);
    box-shadow: 0 0 8px var(--warning);
}

.stat-value {
    width: 45px;
    color: #fff;
    font-weight: bold;
    font-size: 0.85rem;
    text-align: left;
    font-family: var(--font-head);
    flex-shrink: 0;
}

/* Action Buttons */
.hangar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: auto;
    padding-top: 10px;
}

.action-btn {
    padding: 14px 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.25s ease;
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.action-btn:hover {
    letter-spacing: 2px;
    filter: drop-shadow(0 0 5px rgba(0, 243, 255, 0.5));
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 243, 255, 0.1);
}

.action-btn:active {
    transform: scale(0.98);
}

/* Shine sweep animation on buttons */
.action-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s;
    pointer-events: none;
}

.action-btn:hover::after {
    left: 120%;
}

.action-btn.equip {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.action-btn.equip:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.5);
}

.action-btn.equipped {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: default;
    letter-spacing: 2px;
}

.action-btn.buy {
    background: linear-gradient(135deg, var(--warning) 0%, #ffaa00 100%);
    color: #000;
    grid-column: span 2;
    font-size: 1.1rem;
}

.action-btn.buy:hover {
    background: linear-gradient(135deg, #fff 0%, var(--warning) 100%);
    box-shadow: 0 0 25px rgba(252, 238, 10, 0.5);
    transform: translateY(-2px);
}

.action-btn.upgrade {
    background: linear-gradient(135deg, #00dd55 0%, #22ff88 100%);
    color: #000;
}

.action-btn.upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 255, 100, 0.5);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(80%);
    transform: none !important;
    box-shadow: none !important;
}

/* Level Select */
.glass-panel.small-panel {
    max-width: 400px;
    width: 90%;
    /* Ensure it fits on mobile */
    padding: 30px 20px;
    height: auto;
    /* Allow content to define height */
    min-height: auto;
    /* Restore modal look on mobile */
    border-radius: 16px !important;
    border: 1px solid rgba(0, 243, 255, 0.2) !important;
    background: rgba(16, 20, 40, 0.9);
}

.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 25px 0;
    width: 100%;
}

.diff-btn {
    padding: 18px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* border-radius: 8px; Removed for clip-path */
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.diff-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: width 0.3s ease;
    z-index: -1;
}

.diff-btn:hover::before {
    width: 100%;
}

.diff-btn:hover {
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.5);
    padding-left: 25px;
}

/* Difficulty Colors */
.diff-btn[data-mode="easy"] {
    border-color: var(--success);
    color: var(--success);
}

.diff-btn[data-mode="easy"]::before {
    background: var(--success);
}

.diff-btn[data-mode="easy"]:hover {
    color: #000;
}

.diff-btn[data-mode="medium"] {
    border-color: var(--warning);
    color: var(--warning);
}

.diff-btn[data-mode="medium"]::before {
    background: var(--warning);
}

.diff-btn[data-mode="medium"]:hover {
    color: #000;
}

.diff-btn[data-mode="hard"] {
    border-color: var(--danger);
    color: var(--danger);
}

.diff-btn[data-mode="hard"]::before {
    background: var(--danger);
}

.diff-btn[data-mode="hard"]:hover {
    color: #fff;
    /* Keep white text on red bg for contrast */
}

/* Nightmare Difficulty Button */
.diff-btn[data-mode="nightmare"] {
    border-color: #8b00ff;
    color: #8b00ff;
    text-shadow: 0 0 5px #8b00ff;
    background: rgba(10, 0, 20, 0.6);
}

.diff-btn[data-mode="nightmare"]::before {
    background: #8b00ff;
}

.diff-btn[data-mode="nightmare"]:hover {
    color: #fff;
    background: rgba(139, 0, 255, 0.2);
    animation: btnGlitch 0.3s infinite;
    text-shadow: 2px 0 #ff0000, -2px 0 #00ffff;
}

@keyframes btnGlitch {
    0% {
        transform: translate(0);
    }

    25% {
        transform: translate(-2px, 2px);
    }

    50% {
        transform: translate(2px, -2px);
    }

    75% {
        transform: translate(-2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

.back-text-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: underline;
    opacity: 0.7;
    margin-top: 10px;
    padding: 10px;
}

.back-text-btn:hover {
    opacity: 1;
    color: #fff;
}

/* GAME UI */
/* Game Container - Infinite Deep Space */
#game-container {
    width: 100vw;
    height: 100vh;
    background: #050a14;
    position: relative;
    overflow: hidden;
    /* Dramatic Vignette */
    box-shadow: inset 0 0 150px rgba(0, 0, 0, 0.9);
}

/* Nebula Layers - Dynamic Themes */
#game-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    /* Default Colors (restored by JS or CSS vars) */
    --nebula-1: rgba(76, 29, 149, 0.15);
    /* Violet */
    --nebula-2: rgba(6, 182, 212, 0.1);
    /* Cyan */
    --nebula-3: rgba(236, 72, 153, 0.1);
    /* Pink */
    --nebula-4: rgba(124, 58, 237, 0.15);
    /* Purple */

    background:
        radial-gradient(circle at 20% 30%, var(--nebula-1), transparent 40%),
        radial-gradient(circle at 80% 20%, var(--nebula-2), transparent 50%),
        radial-gradient(circle at 40% 80%, var(--nebula-3), transparent 40%),
        radial-gradient(circle at 90% 90%, var(--nebula-4), transparent 50%);
    animation: nebulaRotate 120s linear infinite;
    z-index: 0;
    pointer-events: none;
    filter: blur(80px);
    transition: background 2s ease;
}

/* THEMES */
/* Level 1: Sector Alpha (Deep Space) */
#game-container.bg-sector-alpha::before {
    --nebula-1: rgba(30, 50, 180, 0.2);
    --nebula-2: rgba(0, 200, 255, 0.15);
    --nebula-3: rgba(100, 0, 200, 0.15);
    --nebula-4: rgba(50, 50, 100, 0.3);
}

/* Level 2: Crimson Void (Red/Orange Magma) */
#game-container.bg-crimson-void::before {
    --nebula-1: rgba(200, 20, 20, 0.2);
    --nebula-2: rgba(255, 100, 0, 0.15);
    --nebula-3: rgba(100, 0, 0, 0.3);
    --nebula-4: rgba(255, 50, 50, 0.1);
}

/* Level 3: Cyber City (Matrix Green/Cyan) */
#game-container.bg-cyber-city::before {
    --nebula-1: rgba(0, 255, 100, 0.15);
    --nebula-2: rgba(0, 100, 255, 0.15);
    --nebula-3: rgba(0, 255, 200, 0.1);
    --nebula-4: rgba(0, 50, 50, 0.3);
}

/* Level 4: Nightmare (Dark Void) */
#game-container.bg-nightmare {
    background: #050000;
    animation: nightmarePulse 6s infinite ease-in-out;
}

#game-container.bg-nightmare::before {
    --nebula-1: rgba(100, 0, 0, 0.2);
    --nebula-2: rgba(50, 0, 0, 0.4);
    --nebula-3: rgba(20, 0, 0, 0.6);
    --nebula-4: rgba(0, 0, 0, 0.9);
    animation: nebulaRotate 60s linear infinite, glitchShift 5s infinite steps(5);
    filter: blur(60px) contrast(1.2);
}

/* Nightmare Glitch Overlay (Replaces speed lines) */
#game-container.bg-nightmare::after {
    background: repeating-linear-gradient(transparent 0%, rgba(255, 0, 0, 0.05) 50%, transparent 100%);
    background-size: 100% 4px;
    animation: bgGlitch 2s infinite steps(2);
    opacity: 0.3;
    mix-blend-mode: color-dodge;
}

@keyframes nightmarePulse {

    0%,
    100% {
        background-color: #050000;
    }

    50% {
        background-color: #1a0000;
    }
}

@keyframes glitchShift {
    0% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(2px, -2px);
    }

    60% {
        transform: translate(-2px, -2px);
    }

    80% {
        transform: translate(2px, 2px);
    }

    100% {
        transform: translate(0, 0);
    }
}

@keyframes bgGlitch {
    0% {
        transform: translate(0, 0);
        opacity: 0.3;
    }

    20% {
        transform: translate(-5px, 0);
        opacity: 0.2;
    }

    40% {
        transform: translate(5px, 0);
        opacity: 0.3;
    }

    60% {
        transform: translate(0, 5px);
        opacity: 0.1;
    }

    80% {
        transform: translate(0, -5px);
        opacity: 0.4;
    }

    100% {
        transform: translate(0, 0);
        opacity: 0.3;
    }
}


/* Star speed lines overlay for speed effect */
#game-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 10, 20, 0.2) 100%);
    z-index: 1;
    pointer-events: none;
}

@keyframes nebulaRotate {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(5deg) scale(1.1);
    }

    100% {
        transform: rotate(0deg) scale(1);
    }
}

#game-area {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Entities */
.entity {
    position: absolute;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.player {
    z-index: 100;
}

.enemy {
    z-index: 50;
}

.bullet {
    z-index: 40;
}

.airdrop {
    z-index: 45;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from {
        transform: scale(1);
        filter: brightness(1);
    }

    to {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

/* HUD */
.hud-top {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 200;
    pointer-events: none;
    font-family: var(--font-head);
    padding: 8px 16px;
    background: rgba(5, 10, 25, 0.75);
    border: 1px solid rgba(0, 243, 255, 0.25);
    border-radius: 8px;
    backdrop-filter: blur(6px);
    gap: 12px;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    white-space: nowrap;
}

.hud-label {
    font-size: 0.65rem;
    color: rgba(0, 243, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    line-height: 1;
    margin-bottom: 2px;
}

.hud-value {
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'Roboto Mono', monospace;
    color: #fff;
    line-height: 1;
}

/* HP Bar - Desktop: sits inline with other HUD items */
.hud-item.bar-container {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 220px;
    background: none;
    padding: 0;
    border: none;
    clip-path: none;
}

/* Boss Warning */
@keyframes warningPulse {

    0%,
    100% {
        box-shadow: inset 0 0 0 rgba(255, 0, 0, 0);
    }

    50% {
        box-shadow: inset 0 0 80px rgba(255, 0, 0, 0.4);
    }
}

.boss-warning-active {
    animation: warningPulse 0.8s infinite;
}

/* ---- MOBILE HUD ---- */
/* ---- MOBILE HUD ---- */
@media (max-width: 600px) {
    .hud-top {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        grid-template-rows: auto;
        grid-template-areas: "score boss wave";
        padding: 5px 12px;
        gap: 5px;
        height: auto;
        align-items: center;

        /* FIX: Disable containing block creators so HP bar can escape */
        background: transparent;
        border: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transform: none;
        perspective: none;

        top: 5px;
    }

    /* Reset Flex properties */
    .hud-item {
        flex: initial;
        min-width: auto;
        margin: 0;
    }

    /* Score: Left */
    .hud-item:nth-child(1) {
        grid-area: score;
        align-items: flex-start;
        justify-self: start;
    }

    /* Wave: Right */
    .hud-item:nth-child(2) {
        grid-area: wave;
        align-items: flex-end;
        justify-self: end;
    }

    /* Boss/Targets: Center */
    .hud-item:nth-child(3) {
        grid-area: boss;
        align-items: center;
        justify-self: center;
    }

    /* HP Bar: MOVED TO BOTTOM OF SCREEN */
    .hud-item.bar-container {
        position: fixed;
        bottom: 15px;
        /* Lower to save space */
        left: 50%;
        transform: translateX(-50%);
        width: 94%;
        /* Wider */
        flex-direction: column;
        align-items: center;
        gap: 2px;
        z-index: 200;
        background: rgba(0, 0, 0, 0.6);
        /* More transparent */
        padding: 6px 4px;
        /* Thinner container */
        border-radius: 10px;
        border: 1px solid rgba(0, 243, 255, 0.2);
        box-shadow: none;
    }

    /* Hide HP label on mobile or keep small? Keep very small */
    .bar-container .hud-value {
        font-size: 0.6rem;
        order: -1;
        margin-bottom: 1px;
        opacity: 0.8;
        display: none;
        /* Actually hide label to be super clean? User said "Only Score on top" implies clean. Let's hide 'HP' text */
    }

    .hp-bar-bg {
        height: 6px;
        /* Thinner bar */
        width: 100%;
        border-radius: 3px;
        border: none;
        background: rgba(255, 255, 255, 0.1);
    }

    .hud-label {
        font-size: 0.55rem;
        letter-spacing: 0.5px;
        margin-bottom: 0px;
        opacity: 0.8;
    }

    .hud-value {
        font-size: 0.9rem;
        line-height: 1;
    }
}

/* HP Bar Visuals */
.hp-bar-bg {
    flex: 1;
    height: 10px;
    min-height: 10px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

#hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger), var(--success));
    width: 100%;
    transition: width 0.2s cubic-bezier(0.1, 0.7, 1.0, 0.1);
    box-shadow: 0 0 10px var(--success);
}

.hp-bar-bg::after {
    content: " ";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(90deg, transparent, transparent 19%, #000 20%);
    opacity: 0.5;
}

/* Modal */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    /* Ensure top-most layer */
    pointer-events: auto;
}

/* Mobile Modal Enhancements */
.modal-content {
    background: rgba(10, 5, 5, 0.95);
    border: 1px solid rgba(255, 0, 50, 0.3);
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.2), inset 0 0 100px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    width: 90%;
    max-width: 400px;
    border-radius: 4px;
    padding: 30px;
}

/* Red Scanline Overlay */
.modal-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(rgba(255, 0, 0, 0.05) 0px, transparent 1px, transparent 4px);
    pointer-events: none;
    z-index: 0;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    /* Stack vertically on mobile */
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
    width: 100%;
    position: relative;
    z-index: 10;
    /* Above overlay */
}

.modal-actions button {
    padding: 16px 20px;
    border-radius: 2px;
    font-size: 1.1rem;
    font-family: var(--font-head);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: none;
    position: relative;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: all 0.2s;
    width: 100%;
    cursor: pointer;
    touch-action: manipulation;
    /* Optimize for touch */
    pointer-events: auto;
}

#btn-retry {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

#btn-retry:active {
    background: #fff;
    transform: scale(0.98);
}

#btn-quit {
    background: rgba(255, 0, 50, 0.2);
    color: #ff0033;
    border: 1px solid rgba(255, 0, 50, 0.5);
}

#btn-quit:hover,
#btn-quit:active {
    background: rgba(255, 0, 50, 0.8);
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
}

/* Glitch Title Animation */
#game-over-modal h2 {
    font-size: 3rem;
    color: #ff0033;
    text-shadow: 2px 2px 0px #00ffff, -2px -2px 0px #ff0000;
    animation: glitchSkew 1s infinite linear alternate-reverse;
    margin-bottom: 5px;
}

@keyframes glitchSkew {
    0% {
        transform: skew(0deg);
    }

    10% {
        transform: skew(-2deg);
    }

    20% {
        transform: skew(4deg);
    }

    30% {
        transform: skew(-1deg);
    }

    40% {
        transform: skew(3deg);
    }

    50% {
        transform: skew(-5deg);
        filter: blur(1px);
    }

    60% {
        transform: skew(1deg);
        filter: none;
    }

    70% {
        transform: skew(-3deg);
    }

    80% {
        transform: skew(2deg);
    }

    90% {
        transform: skew(-1deg);
    }

    100% {
        transform: skew(0deg);
    }
}

/* ============================================
   RESPONSIVE — Mobile Hangar
   ============================================ */

/* ============================================
   RESPONSIVE — Mobile Optimizations
   ============================================ */

/* Tablet & Mobile Combined Logic */
@media (max-width: 1024px) {

    .glass-panel.full-panel,
    .glass-panel.content-panel {
        width: 100vw;
        height: 100dvh;
        max-width: 100%;
        border-radius: 0;
        border: none;
        padding: 15px;
    }

    .plane-list {
        flex: 0 0 280px;
        /* Vertical list on tablet */
    }
}

/* Fail State Animations */
.fail-title-anim {
    color: var(--danger);
    text-shadow: 0 0 20px var(--danger);
    animation: failPulse 1.5s infinite alternate;
    font-size: 2.5rem;
}

@keyframes failPulse {
    from {
        opacity: 0.8;
        transform: scale(1);
    }

    to {
        opacity: 1;
        transform: scale(1.1);
        text-shadow: 0 0 30px #ff0000;
    }
}

.fail-modal-anim {
    border: 2px solid var(--danger);
    box-shadow: 0 0 30px rgba(255, 0, 60, 0.4);
    animation: failBorderPulse 2s infinite;
}

@keyframes failBorderPulse {
    0% {
        box-shadow: 0 0 20px rgba(255, 0, 60, 0.3);
    }

    50% {
        box-shadow: 0 0 50px rgba(255, 0, 60, 0.6);
    }

    100% {
        box-shadow: 0 0 20px rgba(255, 0, 60, 0.3);
    }
}

/* Modal Content Responsive Fix */
.modal-content {
    background: rgba(16, 20, 40, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
    .modal-content {
        padding: 30px 20px;
        width: 85%;
    }

    .modal-actions {
        flex-direction: column;
        gap: 15px;
        margin-top: 20px;
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-actions button {
        width: 100%;
        margin: 0;
    }
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    50% {
        transform: translateX(10px);
    }

    75% {
        transform: translateX(-10px);
    }

    100% {
        transform: translateX(0);
    }
}

/* Mobile Portrait Specific */
@media (max-width: 768px) {

    /* Screen Layout */
    .screen {
        padding: 0;
        /* justify-content: flex-start;  <-- REMOVE THIS to allow centering */
        justify-content: center;
        /* Center vertically */
        align-items: center;
        /* Center horizontally */
    }

    .glass-panel {
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
        border: none;
        padding: 20px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    /* Override for popups like Difficulty Select */
    .glass-panel.small-panel {
        width: 90%;
        height: auto;
        max-height: 80vh;
        border-radius: 20px !important;
        background: rgba(16, 20, 40, 0.95);
        justify-content: center;
        border: 1px solid rgba(0, 243, 255, 0.3) !important;
    }

    /* Auth Screen refinement */
    .auth-panel {
        height: auto;
        min-height: auto;
        width: 90%;
        max-width: 380px;
        margin: auto;
        border-radius: 24px !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        background: rgba(16, 20, 40, 0.85) !important;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6) !important;
        padding: 30px 20px !important;
        justify-content: center;
    }

    .auth-panel .game-title {
        font-size: 2rem;
        letter-spacing: 2px;
        margin-bottom: 25px;
    }

    .glass-panel::before,
    .glass-panel::after {
        display: none;
        /* Remove corners to save rendering/space */
    }

    /* Game HUD Mobile */
    .hud-top {
        top: 0;
        left: 0;
        width: 100%;
        padding: 10px 15px;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent);
        font-size: 0.8rem;
        flex-wrap: wrap;
        gap: 5px;
    }

    .hud-item {
        margin: 0;
    }

    .bar-container {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 80%;
        height: 12px;
        z-index: 900;
        background: rgba(0, 0, 0, 0.6);
        border: 1px solid var(--primary);
        /* Bottom HP bar is easier to see than top-left on tall phones */
    }

    .bar-container span {
        display: none;
    }

    .hp-bar-bg {
        height: 100%;
    }

    /* HANGAR MOBILE LAYOUT: List at Bottom */
    .hangar-content {
        flex-direction: column-reverse;
        height: 100%;
        gap: 10px;
        overflow: hidden;
        padding: 0;
    }

    /* Bottom Scroll Strip */
    .plane-list {
        flex: 0 0 110px;
        /* Fixed height for thumb strip */
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 5px;
        background: rgba(0, 0, 0, 0.4);
        border-top: 1px solid var(--glass-border);
        white-space: nowrap;
        scrollbar-width: none;
        /* Hide scrollbar */
        gap: 10px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .plane-list::-webkit-scrollbar {
        display: none;
    }

    .shop-item {
        scroll-snap-align: center;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 85px;
        min-width: 85px;
        height: 95px;
        padding: 5px;
        margin: 0;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
    }

    .shop-item.active {
        background: rgba(0, 243, 255, 0.15);
        border-color: var(--primary);
        transform: translateY(-2px);
    }

    .shop-thumb {
        width: 50px;
        height: 50px;
        margin-bottom: 5px;
    }

    .shop-info {
        display: none;
    }

    /* Hide descriptions */

    .shop-status {
        font-size: 0.6rem;
        width: 100%;
        text-align: center;
    }

    /* Top Preview Area */
    .plane-preview {
        flex: 1;
        width: 100%;
        padding: 10px;
        background: transparent;
        border: none;
        box-shadow: none;
        overflow-y: visible;
        overflow-x: hidden;
        /* Prevent horizontal scroll from grid */
        justify-content: flex-start;
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
        z-index: 10;
    }

    /* Reset grid for mobile to avoid 3D transform overflow */
    .plane-preview::before {
        inset: 0;
        width: 100%;
        height: 100%;
        transform: none;
        animation: gridScroll 10s linear infinite;
        mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
        -webkit-mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
        opacity: 0.2;
    }

    #current-plane-display {
        width: 160px;
        /* Slightly larger */
        height: 160px;
        margin: 0 auto 30px auto;
        /* More space for thrust */
        flex-shrink: 0;
    }

    .plane-header-info {
        width: 100%;
        text-align: center;
        margin-bottom: 5px;
        z-index: 10;
    }

    .plane-header-info h2 {
        font-size: 1.4rem;
        margin-bottom: 2px;
        text-shadow: 0 0 15px rgba(0, 243, 255, 0.6);
        background: none;
        -webkit-text-fill-color: #fff;
        color: #fff;
    }

    .plane-header-info h2::after {
        display: none;
        /* Hide flashy text overlay on mobile */
    }

    .plane-desc {
        font-size: 0.85rem;
        margin-bottom: 15px;
        display: block;
        opacity: 0.8;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
    }

    .stats-container {
        padding: 0;
        gap: 8px;
        background: transparent !important;
        border: none !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        width: 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }

    .stat-row {
        gap: 10px;
        align-items: center;
    }

    .stat-label {
        font-size: 0.8rem;
        width: 40px;
        text-align: right;
    }

    .stat-value {
        font-size: 0.8rem;
        width: 40px;
        text-align: left;
    }

    /* Bigger Action Buttons */
    .hangar-actions {
        position: relative;
        z-index: 10;
        padding: 10px 0;
        margin-top: auto;
        gap: 10px;
    }

    .action-btn {
        min-height: 48px;
        /* Touch target size */
        font-size: 0.9rem;
        padding: 10px;
    }

    /* Leaderboard Mobile */
    .leaderboard-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .glass-panel.menu-panel {
        justify-content: center;
        padding: 30px 20px;
    }

    .menu-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 0;
        width: 100%;
    }

    .menu-card {
        padding: 15px 10px;
        min-height: 110px;
        aspect-ratio: auto;
        border-radius: 16px;
    }

    .menu-card .icon {
        font-size: 2rem;
        margin-bottom: 8px;
    }

    .menu-card h3 {
        font-size: 0.8rem;
        letter-spacing: 1px;
    }
}

/* Very Small Screen Optimizations */
@media (max-width: 380px) {
    .menu-grid {
        grid-template-columns: 1fr;
        /* Single column for very small screens */
        gap: 15px;
    }

    .menu-card {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        padding: 15px 25px;
        min-height: 80px;
        text-align: left;
        gap: 20px;
    }

    .menu-card .icon {
        margin-bottom: 0;
        font-size: 1.8rem;
    }

    .menu-card-text {
        align-items: flex-start;
    }

    .game-title {
        font-size: 2.5rem;
    }

    .header-info h2 {
        font-size: 1.2rem;
    }
}

.mobile-only {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .mobile-only {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: absolute;
        bottom: 20%;
        left: 0;
        right: 0;
        width: 100%;
        text-align: center;
        opacity: 0.8;
        pointer-events: none;
        color: rgba(255, 255, 255, 0.7);
        font-family: var(--font-head);
        letter-spacing: 2px;
        text-shadow: 0 0 5px #000;
        z-index: 500;
        font-size: 1rem;
    }

    .mobile-only::before {
        content: '👆';
        /* Finger emoji */
        font-size: 3rem;
        margin-bottom: 10px;
        animation: swipeHint 1.5s ease-in-out infinite;
        filter: drop-shadow(0 0 10px var(--primary));
    }
}

@keyframes swipeHint {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.8;
    }

    50% {
        transform: translateY(-20px);
        opacity: 1;
    }
}

/* ============================================
   WIN ANIMATIONS
   ============================================ */

.win-title-anim {
    background: linear-gradient(to right, #6666ff, #0099ff, #00ff00, #ff3399, #6666ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: rainbow_animation 6s ease-in-out infinite;
    background-size: 400% 100%;
    font-size: 3rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
}

@keyframes rainbow_animation {

    0%,
    100% {
        background-position: 0 0;
    }

    50% {
        background-position: 100% 0;
    }
}

.win-modal-anim {
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.3), inset 0 0 20px rgba(255, 215, 0, 0.2);
    border: 2px solid #ffd700;
    animation: modalWinPulse 2s infinite alternate;
}

@keyframes modalWinPulse {
    from {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
        transform: scale(1);
    }

    to {
        box-shadow: 0 0 60px rgba(255, 215, 0, 0.6);
        transform: scale(1.02);
    }
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    z-index: 2000;
    pointer-events: none;
    animation: confettiFly 1.5s ease-out forwards;
}

@keyframes confettiFly {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }

    50% {
        opacity: 1;
    }

    100% {
        /* Move using CSS vars set in JS */
        transform: translate(calc(var(--vx) * 20), calc(var(--vy) * 20 + 800px)) rotate(720deg);
        opacity: 0;
    }
}



@keyframes explode {
    0% {
        transform: scale(0.5);
        opacity: 1;
        filter: hue-rotate(0deg);
    }

    50% {
        transform: scale(1.5);
        opacity: 0.8;
        filter: hue-rotate(45deg);
    }

    100% {
        transform: scale(3);
        opacity: 0;
        filter: hue-rotate(90deg);
    }
}

@keyframes scrollBg {
    from {
        background-position: center 0;
    }

    to {
        background-position: center 1000px;
    }
}


/* Particles */
.explosion-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ffaa00;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 5px #ff4400;
    animation: particleMove 0.5s ease-out forwards;
}

@keyframes particleMove {
    0% {
        transform: translate(0, 0) scale(1.5);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* Engine Trail Particles */
.trail-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    /* Soft circle */
    pointer-events: none;
    opacity: 0.8;
    z-index: 50;
    box-shadow: 0 0 4px var(--primary);
    animation: trailFade 0.6s linear forwards;
}

@keyframes trailFade {
    0% {
        transform: scale(1) translateY(0);
        opacity: 0.8;
    }

    100% {
        transform: scale(3) translateY(20px);
        opacity: 0;
    }
}