/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    font-family: 'Orbitron', 'Courier New', monospace;
    background: #000;
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
}

/* Import Orbitron font */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

/* ===== CANVAS ===== */
#game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
}

/* ===== SCREEN CONTAINERS ===== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
    opacity: 0;
}

/* ===== LOADING SCREEN ===== */
#loading-screen {
    background: #000;
}

/* ===== START SCREEN WITH BACKGROUND ===== */
#start-screen {
    position: relative;
    background: transparent;
    /* Remove black background */
}

/* Full-screen background image layer */
#start-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/homepage/homepage.jpeg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.15;
    z-index: 0;
}

/* Ensure content is above background */
#start-screen>* {
    position: relative;
    z-index: 1;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 255, 255, 0.2);
    border-top: 4px solid #00ffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 20px;
    font-size: 1.2rem;
    color: #00ffff;
    letter-spacing: 4px;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Loading Progress Bar */
.loading-progress {
    margin-top: 30px;
    width: 300px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #ff00ff);
    border-radius: 10px;
    transition: width 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: #00ffff;
    letter-spacing: 2px;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ===== START SCREEN ===== */
.title-container {
    text-align: center;
    margin-bottom: 50px;
}

.game-title {
    font-size: 4rem;
    font-weight: 900;
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff, 0 0 60px #00ffff;
    letter-spacing: 8px;
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite;
}

.game-subtitle {
    font-size: 2rem;
    font-weight: 700;
    color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff, 0 0 20px #ff00ff;
    letter-spacing: 6px;
}

@keyframes glow {

    0%,
    100% {
        text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff, 0 0 60px #00ffff;
    }

    50% {
        text-shadow: 0 0 30px #00ffff, 0 0 60px #00ffff, 0 0 90px #00ffff;
    }
}

/* ===== INSTRUCTIONS ===== */
.instructions {
    background: rgba(0, 255, 255, 0.05);
    border: 2px solid rgba(0, 255, 255, 0.3);
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 40px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

.instruction-title {
    font-size: 1.2rem;
    color: #00ffff;
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: 3px;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.key {
    background: rgba(255, 0, 255, 0.2);
    border: 2px solid #ff00ff;
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: 700;
    color: #ff00ff;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}

.action {
    color: #fff;
    font-size: 0.9rem;
}

.mobile-note {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    margin-top: 15px;
}

/* ===== BUTTONS ===== */
.neon-btn {
    background: transparent;
    border: 3px solid #00ffff;
    color: #00ffff;
    padding: 15px 50px;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    letter-spacing: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    margin: 10px;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.neon-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.neon-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.8), inset 0 0 10px rgba(0, 255, 255, 0.3);
    transform: scale(1.05);
}

.neon-btn:hover::before {
    width: 300px;
    height: 300px;
}

.neon-btn:active {
    transform: scale(0.98);
}

.neon-btn.secondary {
    border-color: #ff00ff;
    color: #ff00ff;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
}

.neon-btn.secondary:hover {
    background: rgba(255, 0, 255, 0.1);
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.8), inset 0 0 10px rgba(255, 0, 255, 0.3);
}

/* ===== GAME HUD ===== */
#game-hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    pointer-events: none;
}

#game-hud.hidden {
    display: none;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid rgba(0, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 5px;
    min-width: 120px;
}

.hud-label {
    font-size: 0.7rem;
    color: #00ffff;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.hud-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px #00ffff;
}

.hud-bottom {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.shield-indicator,
.boost-indicator {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid;
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    animation: indicatorPulse 1s ease-in-out infinite;
}

.shield-indicator {
    border-color: #00aaff;
    color: #00aaff;
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.5);
}

.boost-indicator {
    border-color: #ffaa00;
    color: #ffaa00;
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.5);
}

@keyframes indicatorPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.shield-icon,
.boost-icon {
    font-size: 1.2rem;
}

/* ===== GAME OVER SCREEN ===== */
#gameover-screen {
    position: relative;
    background: transparent;
    /* Remove black background */
}

/* Full-screen background image layer */
#gameover-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/homepage/homepage.jpeg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.1;
    z-index: 0;
}

/* Ensure content is above background */
#gameover-screen>* {
    position: relative;
    z-index: 1;
}

.gameover-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: #ff0055;
    text-shadow: 0 0 20px #ff0055, 0 0 40px #ff0055;
    letter-spacing: 8px;
    margin-bottom: 40px;
    animation: glitchAnim 2s infinite;
}

@keyframes glitchAnim {

    0%,
    90%,
    100% {
        transform: translate(0);
    }

    92% {
        transform: translate(-2px, 2px);
    }

    94% {
        transform: translate(2px, -2px);
    }

    96% {
        transform: translate(-2px, -2px);
    }

    98% {
        transform: translate(2px, 2px);
    }
}

.score-container {
    background: rgba(0, 255, 255, 0.05);
    border: 2px solid rgba(0, 255, 255, 0.3);
    padding: 40px;
    border-radius: 10px;
    margin-bottom: 40px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

.final-score,
.high-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.score-label {
    font-size: 1rem;
    color: #00ffff;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

.score-value {
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 15px #00ffff;
}

.new-record {
    margin-top: 20px;
    padding: 15px 30px;
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid gold;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    animation: recordPulse 1.5s ease-in-out infinite;
}

@keyframes recordPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.record-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: gold;
    letter-spacing: 2px;
}

/* ===== MOBILE CONTROLS ===== */
#mobile-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 60;
}

#mobile-controls.hidden {
    display: none;
}

#joystick-container {
    position: relative;
    width: 150px;
    height: 150px;
}

#joystick-base {
    position: absolute;
    width: 150px;
    height: 150px;
    background: rgba(0, 255, 255, 0.2);
    border: 3px solid rgba(0, 255, 255, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

#joystick-stick {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 0, 255, 0.6);
    border: 3px solid #ff00ff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.5);
    transition: all 0.1s ease;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }

    .game-subtitle {
        font-size: 1.3rem;
        letter-spacing: 3px;
    }

    .instructions {
        padding: 20px;
        width: 90%;
    }

    .neon-btn {
        padding: 12px 35px;
        font-size: 1rem;
    }

    .hud-top {
        padding: 10px;
    }

    .hud-item {
        min-width: 80px;
        padding: 8px 12px;
    }

    .hud-label {
        font-size: 0.6rem;
    }

    .hud-value {
        font-size: 1.2rem;
    }

    .gameover-title {
        font-size: 2.5rem;
    }

    .score-value {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }

    .game-subtitle {
        font-size: 1rem;
    }

    .control-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Power-up Message ===== */
.powerup-message {
    position: fixed;
    top: 80px;
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #00ff00;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1.5rem;
    font-weight: 900;
    color: #00ff00;
    text-shadow: 0 0 20px #00ff00;
    box-shadow: 0 0 40px rgba(0, 255, 0, 0.6);
    animation: popup 0.5s ease-out;
    z-index: 200;
}

@keyframes popup {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.powerup-message.hidden {
    display: none;
}

/* ===== Power-up Timer ===== */
.powerup-timer {
    position: fixed;
    top: 80px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #ffaa00;
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 0 30px rgba(255, 170, 0, 0.5);
    z-index: 100;
}

.powerup-timer.hidden {
    display: none;
}

.timer-icon {
    font-size: 1.8rem;
    animation: pulse 1s ease-in-out infinite;
}

.timer-bar-container {
    width: 150px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 170, 0, 0.5);
}

.timer-bar {
    width: 100%;
    height: 100%;
    background: #00ff00;
    /* Will be changed dynamically */
    border-radius: 8px;
    transition: width 0.1s linear, background-color 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.8);
}

.timer-seconds {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffaa00;
    min-width: 40px;
    text-align: center;
}

/* ===== Crash Message ===== */
.crash-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    animation: crash-appear 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 300;
}

.crash-message.hidden {
    display: none;
}

@keyframes crash-appear {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-180deg);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

.crash-emoji {
    font-size: 6rem;
    animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-10deg);
    }

    75% {
        transform: rotate(10deg);
    }
}

.crash-text {
    font-size: 4rem;
    font-weight: 900;
    color: #ff0055;
    text-shadow: 0 0 30px #ff0055, 0 0 60px #ff0055;
    letter-spacing: 8px;
    animation: glitch-crash 0.3s ease-in-out infinite;
}

@keyframes glitch-crash {

    0%,
    100% {
        transform: translate(0);
    }

    20% {
        transform: translate(-3px, 3px);
    }

    40% {
        transform: translate(3px, -3px);
    }

    60% {
        transform: translate(-3px, -3px);
    }

    80% {
        transform: translate(3px, 3px);
    }
}

.crash-subtext {
    font-size: 1.5rem;
    color: #fff;
    text-shadow: 0 0 10px #ff0055;
    letter-spacing: 3px;
}

/* ===== FULL SCREEN BACKGROUND FIX ===== */
#start-screen,
#gameover-screen {
    background: #000 url('../assets/images/homepage/homepage.jpeg') center center / cover no-repeat fixed !important;
    min-height: 100vh !important;
    min-width: 100vw !important;
}

#start-screen::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 0;
    pointer-events: none;
}

#gameover-screen::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 0;
    pointer-events: none;
}

#start-screen>*,
#gameover-screen>* {
    position: relative;
    z-index: 1;
}