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

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    background-color: #000000;
    color: #ff0000;
}

/* Background Container for Loading Bar Animation */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background-color: #000000;
}

#loadingCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Main Content Overlay */
.content {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    text-align: center;
    pointer-events: none;
}

.logo-container {
    padding: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid #ff0000;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

.site-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 8px;
    color: #ff0000;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8), 0 0 40px rgba(255, 0, 0, 0.5);
    margin-bottom: 20px;
}

.tagline {
    font-size: 1.5rem;
    color: #ffffff;
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* Game Container */
.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gameCanvas {
    border: 3px solid #ff0000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

/* Game UI */
.game-ui {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    width: auto;
    pointer-events: none;
}

.score-display {
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 30px;
    border: 2px solid #ff0000;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    gap: 40px;
    align-items: center;
    justify-content: center;
}

.score-display h2, .score-display h3 {
    color: #ff0000;
    text-shadow: 0 0 15px rgba(255, 0, 0, 1);
    margin: 0;
    font-size: 1.5rem;
    white-space: nowrap;
    font-weight: 900;
}

.score-display h3 {
    font-size: 1.2rem;
}

.score-display span {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Game Over */
.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #ff0000;
    border-radius: 15px;
    padding: 35px 45px;
    text-align: center;
    z-index: 200;
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.8);
    width: 480px;
    max-width: 480px;
    pointer-events: auto;
}

.game-over h2 {
    font-size: 2.2rem;
    color: #ff0000;
    margin-bottom: 12px;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}

.game-over p {
    font-size: 1.2rem;
    color: #ffffff;
    margin-bottom: 18px;
}

.game-over input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: #000000;
    border: 2px solid #ff0000;
    color: #ffffff;
    font-size: 1rem;
    border-radius: 5px;
    pointer-events: auto;
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
}

.game-over input:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

.game-over button {
    width: 100%;
    padding: 14px;
    margin: 6px 0;
    background: #ff0000;
    border: none;
    color: #000000;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.game-over button:hover {
    background: #ffffff;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}

.achievement {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: #ffff00;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(255, 255, 0, 0.8);
    margin: 10px 0;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Leaderboard */
.leaderboard {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #ff0000;
    border-radius: 10px;
    padding: 20px;
    min-width: 300px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

.leaderboard h2 {
    color: #ff0000;
    text-align: center;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

#leaderboardList {
    color: #ffffff;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin: 5px 0;
    background: rgba(255, 0, 0, 0.1);
    border-left: 3px solid #ff0000;
}

.leaderboard-entry.top3 {
    background: rgba(255, 0, 0, 0.2);
    border-left: 5px solid #ff0000;
}

.leaderboard-entry .rank {
    color: #ff0000;
    font-weight: bold;
    margin-right: 10px;
}

.leaderboard-entry .name {
    flex-grow: 1;
}

.leaderboard-entry .score {
    color: #ff0000;
    font-weight: bold;
}

/* Glitch effect */
.glitch {
    animation: glitch 0.3s infinite;
}

@keyframes glitch {
    0% {
        transform: translate(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);
    }
}

/* Start Message */
.start-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, 80px);
    z-index: 45;
    text-align: center;
    animation: flash 1.5s infinite;
    pointer-events: none;
}

.start-message h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: #ff0000;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8), 0 0 40px rgba(255, 0, 0, 0.5);
    margin-bottom: 8px;
    letter-spacing: 3px;
}

.start-message p {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.mobile-only {
    display: none;
}

@keyframes flash {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}


/* Responsive Design */
@media (max-width: 768px) {
    .site-title {
        font-size: 2rem;
        letter-spacing: 3px;
    }

    .tagline {
        font-size: 0.9rem;
        letter-spacing: 2px;
    }

    .logo-container {
        padding: 20px;
        margin: 20px;
    }

    /* Show mobile-only text */
    .mobile-only {
        display: block;
    }

    /* Smaller start message on mobile */
    .start-message {
        transform: translate(-50%, 70px);
    }

    .start-message h2 {
        font-size: 1.2rem;
    }

    .start-message p {
        font-size: 0.75rem;
    }

    /* Make game canvas smaller on mobile */
    #gameCanvas {
        max-width: 100vw;
        max-height: 60vh;
        width: auto !important;
        height: auto !important;
    }

    .game-container {
        flex-direction: column;
        overflow-y: auto;
    }

    .leaderboard {
        position: relative;
        top: auto;
        right: auto;
        margin: 20px auto;
        max-width: 90%;
        max-height: 300px;
    }

    .game-ui {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .score-display {
        padding: 12px 25px;
        gap: 30px;
        justify-content: center;
    }

    .score-display h2 {
        font-size: 1.3rem;
    }

    .score-display h3 {
        font-size: 1.1rem;
    }

    .game-over {
        width: auto;
        max-width: 85%;
        padding: 25px 35px;
    }

    .game-over h2 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    .game-over p {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .game-over input {
        padding: 10px;
        margin-bottom: 12px;
    }

    .game-over button {
        padding: 11px;
        font-size: 0.95rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .site-title {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }

    .tagline {
        font-size: 0.8rem;
    }

    .game-ui {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .score-display {
        padding: 10px 20px;
        gap: 20px;
        flex-direction: row;
        justify-content: center;
    }

    .score-display h2 {
        font-size: 1.1rem;
    }

    .score-display h3 {
        font-size: 0.9rem;
    }

    .start-message {
        transform: translate(-50%, 50px);
    }

    .start-message h2 {
        font-size: 0.9rem;
    }

    .start-message p {
        font-size: 0.65rem;
    }

    .game-over {
        width: auto;
        max-width: 90%;
        padding: 20px 30px;
    }

    .game-over h2 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .game-over p {
        font-size: 0.95rem;
        margin-bottom: 12px;
    }

    .game-over input {
        padding: 10px;
        margin-bottom: 10px;
        font-size: 0.9rem;
    }

    .game-over button {
        padding: 10px;
        font-size: 0.9rem;
    }

    .achievement {
        font-size: 0.9rem;
    }
}
