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

body {
    overflow: hidden;
    font-family: 'Press Start 2P', cursive;
    background-color: #111;
    color: #fff;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: fixed;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #111;
}

.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    transition: opacity 0.5s;
    text-align: center;
}

.hidden {
    display: none;
}

#start-screen {
    background: linear-gradient(45deg, #ff006e, #8338ec, #3a86ff);
    background-size: 600% 600%;
    animation: gradientBG 10s ease infinite;
}

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

#start-screen h1 {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    color: #ffea00;
    text-shadow: 4px 4px 0 #ff006e, 8px 8px 0 #3a86ff;
    animation: bounce 2s infinite;
}

#start-screen h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #fff;
    text-shadow: 2px 2px 0 #ff006e;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.instructions {
    margin-top: 40px;
    font-size: 12px;
    line-height: 1.8;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    max-width: 80%;
}

.credits {
    position: absolute;
    bottom: 20px;
    font-size: 10px;
    line-height: 1.6;
    opacity: 0.8;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    z-index: 5;
}

#game-over-screen .credits {
    margin-top: 30px;
    position: relative;
    bottom: auto;
}

.credits a {
    color: #fff;
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.credits a:hover {
    color: #ffcc00;
    border-bottom-color: #ffcc00;
}

button {
    font-family: 'Press Start 2P', cursive;
    background-color: #ffea00;
    color: #111;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0.25rem 0.25rem 0 #ff006e;
    transition: all 0.2s;
    outline: none;
}

button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 0.35rem 0.35rem 0 #ff006e;
}

button:active {
    transform: translate(2px, 2px);
    box-shadow: 0.15rem 0.15rem 0 #ff006e;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#mobile-controls {
    position: absolute;
    bottom: 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 2;
}

#direction-pad {
    display: grid;
    grid-template-areas:
        ". up ."
        "left . right"
        ". down .";
    gap: 10px;
}

#up-btn { grid-area: up; }
#left-btn { grid-area: left; }
#right-btn { grid-area: right; }
#down-btn { grid-area: down; }

#direction-pad button {
    width: 60px;
    height: 60px;
    font-size: 24px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 234, 0, 0.7);
}

#boost-btn {
    font-size: 1rem;
    padding: 1rem;
    background-color: rgba(255, 0, 110, 0.7);
    color: white;
    align-self: flex-end;
}

#stats {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 2;
    pointer-events: none;
}

#speed-container, #score-container {
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #ffea00;
    padding: 10px;
    border-radius: 4px;
    min-width: 120px;
}

#speed-label, #score-label {
    font-size: 0.8rem;
    color: #ffea00;
    margin-bottom: 5px;
}

#speed-value, #score-value {
    font-size: 1.2rem;
    color: #fff;
}

#game-over-screen {
    background: linear-gradient(to bottom, #000, #300a24);
    z-index: 3;
}

#game-over-screen h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: #ff006e;
    animation: glitch 1s infinite;
}

@keyframes glitch {
    0% {text-shadow: 3px 0 #3a86ff, -3px 0 #8338ec;}
    25% {text-shadow: -3px 0 #3a86ff, 3px 0 #8338ec;}
    50% {text-shadow: 3px 0 #3a86ff, -3px 0 #8338ec;}
    75% {text-shadow: -3px 0 #3a86ff, 3px 0 #8338ec;}
    100% {text-shadow: 3px 0 #3a86ff, -3px 0 #8338ec;}
}

#final-score, #finish-time {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 1.5rem;
}

/* Name entry form styles */
#name-entry {
    background-color: rgba(0, 0, 0, 0.8);
    padding: 1.5rem;
    border-radius: 10px;
    margin: 1rem 0;
    border: 2px solid #ff006e;
    max-width: 90%;
    width: 400px;
}

#name-entry p {
    margin-bottom: 1rem;
    font-size: 0.8rem;
    line-height: 1.5;
}

#player-name {
    background-color: #1a1a1a;
    border: 2px solid #3a86ff;
    color: #fff;
    padding: 0.7rem 1rem;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.9rem;
    width: 100%;
    margin-bottom: 1rem;
    text-align: center;
    outline: none;
}

#player-name:focus {
    border-color: #ff006e;
}

#submit-score {
    background-color: #ff006e;
    margin-top: 0.5rem;
}

/* Leaderboard styles */
#leaderboard-container {
    background-color: rgba(0, 0, 0, 0.8);
    padding: 1.5rem;
    border-radius: 10px;
    margin: 1rem 0;
    border: 2px solid #3a86ff;
    max-width: 90%;
    width: 400px;
}

#leaderboard-container h2 {
    font-size: 1.3rem;
    color: #3a86ff;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#leaderboard {
    text-align: left;
    width: 100%;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #333;
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.entry-name {
    font-size: 0.8rem;
    color: #fff;
}

.entry-time {
    font-size: 0.8rem;
    color: #ffdd00;
}

/* Restart button update */
#restart-button {
    margin-top: 1.5rem;
    background-color: #3a86ff;
}

/* Hide mobile controls on desktop */
@media (min-width: 768px) {
    #mobile-controls {
        display: none;
    }
}

/* Smaller fonts for smaller screens */
@media (max-width: 600px) {
    #start-screen h1 {
        font-size: 2.5rem;
    }
    
    #start-screen h2 {
        font-size: 1.5rem;
    }
    
    #game-over-screen h1 {
        font-size: 2rem;
    }
    
    #name-entry p {
        font-size: 0.6rem;
    }
    
    #leaderboard-container h2 {
        font-size: 1rem;
    }
    
    .entry-name, .entry-time {
        font-size: 0.6rem;
    }
}

/* Debug toggle button */
#debug-toggle {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 2;
}

#debug-btn {
    font-size: 0.6rem;
    padding: 0.7rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid #8338ec;
    box-shadow: none;
}

#debug-btn.active {
    background-color: rgba(131, 56, 236, 0.7);
    border: 2px solid #ffea00;
}

/* Hide debug toggle on very small screens */
@media (max-width: 400px) {
    #debug-toggle {
        display: none;
    }
} 