/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');
@import './components/neon.css';
@import './components/menu.css';
@import './components/game-ui.css';
@import './components/game-over.css';
@import './components/shop.css';
@import './components/missions.css';
@import './components/settings.css';


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

html, body {
    overflow: hidden;
    background: #05060a;
}

body {
    font-family: 'Orbitron', monospace;
    height: 100vh;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

#gameContainer {
    position: relative;
    width: min(100vw, calc(100vh * 9 / 16));
    height: 100vh;
    margin: 0 auto;
    overflow: hidden;
    background: #000;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: radial-gradient(ellipse at center, #0f0f23 0%, #000000 100%);
    touch-action: none;
}

/* Coin display styles */
#coinDisplayMenu,
#coinDisplayGame,
#coinDisplayGlobal {
    position: absolute;
    font-size: 1.5rem;
    z-index: 200;
    color: #FFD700;
    text-shadow: 0 0 10px #FFD700;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 15px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

#coinDisplayMenu {
    top: 30px;
    right: 30px;
}

#coinDisplayGame {
    top: 10px;
    right: 20px;
    font-size: 1.2rem;
}

#coinDisplayGlobal {
    top: 30px;
    right: 30px;
}

.grid-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 1;
}

@keyframes titleFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    #gameTitle {
        font-size: 3rem !important;
    }
    
    #highScore {
        font-size: 1.4rem !important;
        padding: 15px 30px !important;
    }
    
    #playButton {
        font-size: 1.2rem !important;
        padding: 20px 40px !important;
    }
    
    #shopIcon, #missionIcon {
        width: 60px !important;
        height: 60px !important;
        font-size: 24px !important;
        bottom: 30px !important;
    }
    
    #shopIcon {
        right: 30px !important;
    }
    
    #missionIcon {
        left: 30px !important;
    }
    
    #scoreDisplay {
        font-size: 1.8rem !important;
    }
    
    #gameOver h2 {
        font-size: 2.8rem !important;
    }
    
    #gameOver .score-result {
        font-size: 1.6rem !important;
    }
}

@media (max-width: 480px) {
    #gameTitle {
        font-size: 2.5rem !important;
    }
    
    #highScore {
        font-size: 1.2rem !important;
        padding: 12px 25px !important;
    }
    
    #playButton {
        font-size: 1rem !important;
        padding: 18px 35px !important;
    }
    
    #shopIcon, #missionIcon {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
        bottom: 20px !important;
    }
    
    #shopIcon {
        right: 20px !important;
    }
    
    #missionIcon {
        left: 20px !important;
    }
    
    #scoreDisplay {
        font-size: 1.5rem !important;
    }
    
    #gameOver h2 {
        font-size: 2.2rem !important;
    }
    
    #gameOver .score-result {
        font-size: 1.3rem !important;
    }
}

/* --------------------------------------------------------------
 * Letterbox side decor: fixed neon panels filling the gutters
 * left/right of the centered 9:16 #gameContainer. Purely visual
 * (pointer-events: none), zero-width on phones where the game is
 * full-bleed. Never affects layout of #gameContainer.
 * ---------------------------------------------------------- */
body::before,
body::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    width: calc((100vw - min(100vw, calc(100vh * 9 / 16))) / 2);
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    background-color: #05060a;
    animation: gutterPulse 14s ease-in-out infinite;
}

/* Left gutter: cyan/blue drifting grid, floating orbs, IMPULSE watermark */
body::before {
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    content: 'IMPULSE';
    writing-mode: vertical-rl;
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 7vh;
    letter-spacing: 0.6em;
    text-transform: uppercase;
    color: rgba(0, 255, 255, 0.07);
    text-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
    background-image:
        linear-gradient(to right, transparent calc(100% - 2px), rgba(0, 255, 255, 0.85) calc(100% - 2px), rgba(0, 255, 255, 0.95) 100%),
        linear-gradient(to left, rgba(0, 255, 255, 0.12), transparent 26px),
        repeating-linear-gradient(0deg, rgba(0, 255, 255, 0.055) 0, rgba(0, 255, 255, 0.055) 1px, transparent 1px, transparent 56px),
        repeating-linear-gradient(90deg, rgba(0, 102, 255, 0.07) 0, rgba(0, 102, 255, 0.07) 1px, transparent 1px, transparent 56px),
        radial-gradient(circle 110px at 30% 16%, rgba(0, 255, 255, 0.16), transparent 70%),
        radial-gradient(circle 130px at 65% 58%, rgba(255, 0, 255, 0.12), transparent 70%),
        radial-gradient(circle 90px at 35% 86%, rgba(255, 170, 0, 0.1), transparent 70%),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.25) 0, rgba(0, 0, 0, 0.25) 1px, transparent 1px, transparent 4px),
        radial-gradient(ellipse at 50% 0%, rgba(0, 102, 255, 0.18), transparent 60%),
        radial-gradient(ellipse at 0% 100%, rgba(255, 0, 255, 0.1), transparent 55%);
    background-size: auto, auto, 100% 56px, 56px 100%, 100% 100%, 100% 100%, 100% 100%, auto, 100% 100%, 100% 100%;
    background-repeat: repeat, repeat, repeat, repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat, no-repeat;
    background-position: 0 0, 0 0, 0 0, 0 0, -24px -30px, 28px 24px, -20px -18px, 0 0, 0 0, 0 0;
    animation: gutterPanLeft 26s linear infinite alternate, gutterPulse 14s ease-in-out infinite;
}

/* Right gutter: magenta/orange accents, single drifting grid, floating orbs */
body::after {
    right: 0;
    background-image:
        linear-gradient(to left, transparent calc(100% - 2px), rgba(255, 0, 255, 0.85) calc(100% - 2px), rgba(255, 170, 0, 0.6) 100%),
        linear-gradient(to right, rgba(255, 0, 255, 0.12), transparent 26px),
        repeating-linear-gradient(0deg, rgba(255, 0, 255, 0.05) 0, rgba(255, 0, 255, 0.05) 1px, transparent 1px, transparent 56px),
        radial-gradient(circle 140px at 60% 22%, rgba(255, 0, 255, 0.14), transparent 70%),
        radial-gradient(circle 100px at 30% 50%, rgba(0, 102, 255, 0.16), transparent 70%),
        radial-gradient(circle 120px at 68% 78%, rgba(255, 170, 0, 0.12), transparent 70%),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0, rgba(0, 0, 0, 0.28) 1px, transparent 1px, transparent 4px),
        radial-gradient(ellipse at 100% 30%, rgba(255, 0, 255, 0.14), transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(255, 170, 0, 0.08), transparent 55%);
    background-size: auto, auto, 100% 56px, 100% 100%, 100% 100%, 100% 100%, auto, 100% 100%, 100% 100%;
    background-repeat: repeat, repeat, repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat, no-repeat;
    background-position: 0 0, 0 0, 0 0, 30px -26px, -26px 22px, 22px 28px, 0 0, 0 0, 0 0;
    animation: gutterPanRight 30s linear infinite alternate, gutterPulse 14s ease-in-out infinite;
}

@keyframes gutterPanLeft {
    0% {
        background-position: 0 0, 0 0, 0 0, 0 0, -24px -30px, 28px 24px, -20px -18px, 0 0, 0 0, 0 0;
    }
    100% {
        background-position: 0 0, 0 0, 0 56px, 56px 0, 24px 30px, -28px -24px, 20px 18px, 0 0, 0 0, 0 0;
    }
}

@keyframes gutterPanRight {
    0% {
        background-position: 0 0, 0 0, 0 0, 30px -26px, -26px 22px, 22px 28px, 0 0, 0 0, 0 0;
    }
    100% {
        background-position: 0 0, 0 0, 0 56px, -30px 26px, 26px -22px, -22px -28px, 0 0, 0 0, 0 0;
    }
}

@keyframes gutterPulse {
    0%, 100% { opacity: 0.92; }
    50% { opacity: 1; }
}
