/* ==========================================
   1. GLOBAL RESET & BASE STYLES
   ========================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #020617;
    color: #ffffff;
}

/* ==========================================
   2. GAME CANVAS
   ========================================== */
#gameCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
    touch-action: none;
    filter: contrast(1.1) brightness(1.1);
}

/* ==========================================
   3. TOP BAR & HUD
   ========================================== */
.top-bar {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.bar-left, .bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(6, 182, 212, 0.4);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.25);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
}

#coins { color: #ffd600; }
.combo-glow { 
    color: #f43f5e; 
    text-shadow: 0 0 10px #f43f5e; 
}

/* ==========================================
   4. BUTTONS & UI ACTIONS
   ========================================== */
.glow-btn {
    border: none;
    border-radius: 12px;
    color: #ffffff;
    cursor: pointer;
    background: linear-gradient(135deg, #0284c7, #6366f1);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.glow-btn.small { 
    padding: 6px 14px; 
    font-size: 11px; 
}

.glow-btn.pause-icon, 
.glow-btn.shop-icon { 
    width: 38px; 
    height: 38px; 
    border-radius: 50%; 
    font-size: 14px; 
}

.glow-btn:active { 
    transform: scale(0.92); 
}

/* ==========================================
   5. OVERLAY SCREENS & MODALS
   ========================================== */
.screen {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 200;
    text-align: center;
    padding: 20px;
}

.screen.show { 
    display: flex; 
}

.glow-text {
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 0 12px #06b6d4, 0 0 30px #3b82f6;
    margin-bottom: 6px;
}

.glow-text.mega { 
    font-size: 32px; 
    letter-spacing: 1px; 
}

.glow-text.danger { 
    text-shadow: 0 0 25px #ef4444; 
}

.sub-text { 
    font-size: 12px; 
    color: #94a3b8; 
    margin-bottom: 20px; 
}

.main-btn { 
    padding: 14px 36px; 
    font-size: 16px; 
}

/* ==========================================
   6. SHOP SYSTEM
   ========================================== */
.shop-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 340px;
    margin-bottom: 25px;
}

.shop-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.shop-item h4 { 
    font-size: 13px; 
    color: #38bdf8; 
    margin-bottom: 2px;
}

.shop-item p { 
    font-size: 10px; 
    color: #64748b; 
}

/* ==========================================
   7. SHIP SELECTION CAROUSEL
   ========================================== */
.ship-select-container {
    display: flex;
    gap: 14px;
    margin-bottom: 25px;
    width: 100%;
    max-width: 380px;
    overflow-x: auto;
    padding: 10px 5px;
    scrollbar-width: none; /* Firefox */
}

.ship-select-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.ship-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 14px;
    width: 130px;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
    text-align: center;
}

.ship-card.active {
    border-color: #10b981;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.12);
}

.ship-preview { 
    font-size: 34px; 
    margin-bottom: 6px; 
}

.ship-card h3 { 
    font-size: 13px; 
    margin-bottom: 4px; 
}

.ship-card p { 
    font-size: 10px; 
    color: #94a3b8; 
    margin-bottom: 6px; 
}

.ship-card span { 
    font-size: 9px; 
    color: #10b981; 
    font-weight: 700; 
}

/* ==========================================
   8. MOBILE CONTROLS (IN-GAME)
   ========================================== */
.controls {
    position: fixed;
    bottom: 25px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 15px;
    z-index: 150;
}

.move-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    font-size: 22px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.move-btn.ultimate-btn {
    width: 72px;
    height: 72px;
    font-size: 11px;
    font-weight: 800;
    background: linear-gradient(135deg, #f43f5e, #a855f7);
    border: 2px solid #facc15;
}

.move-btn.dash-btn {
    width: 62px;
    height: 62px;
    font-size: 11px;
    font-weight: 800;
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
}

.move-btn:active { 
    transform: scale(0.92); 
}

/* ==========================================
   9. ALERTS & ANIMATIONS
   ========================================== */
.alert-text {
    position: fixed;
    top: 85px;
    left: 0;
    width: 100%;
    text-align: center;
    color: #ef4444;
    font-weight: 800;
    font-size: 18px;
    text-shadow: 0 0 15px #000000;
    display: none;
    animation: blink 0.4s infinite alternate;
    z-index: 50;
}

.pulse-btn {
    animation: pulseGlow 1.5s infinite alternate;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 15px rgba(6, 182, 212, 0.4); }
    100% { box-shadow: 0 0 35px rgba(99, 102, 241, 0.9); }
}

@keyframes blink { 
    0% { opacity: 1; } 
    100% { opacity: 0.2; } 
}
