@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body {
    margin: 0;
    padding: 20px 0;
    background-color: #111;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.page-title {
    font-size: 4vw;
    margin: 0 0 20px 0;
    color: #FF0055;
    text-shadow: 4px 4px 0 #000, 0 0 20px #FF0055;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

@media (min-width: 1024px) {
    .page-title { font-size: 40px; }
}

.footer {
    margin-top: 20px;
    font-size: 12px;
    color: #AAA;
    text-align: center;
    text-shadow: 1px 1px 0 #000;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 1024px;
    aspect-ratio: 4/3;
    height: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), 0 0 50px rgba(255, 0, 85, 0.3);
    overflow: hidden;
    border-radius: 8px;
    background-color: #000;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    font-size: 20px;
    z-index: 10;
    pointer-events: none;
}

.hud-item {
    color: #FFF;
}

#speedValue { color: #00FFCC; }
#scoreValue { color: #FFCC00; }
#timeValue { color: #FF0055; }

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 20;
    backdrop-filter: blur(4px);
}

.overlay h1 {
    font-size: 56px;
    margin-bottom: 30px;
    color: #FF0055;
    text-shadow: 4px 4px 0 #000, 0 0 20px #FF0055;
    text-transform: uppercase;
    letter-spacing: 2px;
}

p {
    font-size: 16px;
    line-height: 2;
    margin-bottom: 10px;
    color: #E6E6FA;
    text-shadow: 2px 2px 0 #000;
}

.blink {
    margin-top: 30px;
    color: #00FFCC;
    animation: blinker 1.5s linear infinite;
}

@keyframes blinker {
    50% { opacity: 0; }
}

.ui-button {
    position: absolute;
    top: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
    color: #fff;
    font-family: inherit;
    font-size: 18px;
    padding: 5px 10px;
    cursor: pointer;
    z-index: 30;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.ui-button:hover {
    background: #FF0055;
    border-color: #FF0055;
}

#fullscreen-btn { right: 10px; }
#mobile-toggle-btn { right: 60px; font-size: 16px; top: 11px; padding: 6px 8px; }

#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 30;
    pointer-events: none;
}

.dpad, .action-buttons {
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.mobile-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 20px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.mobile-btn:active, .mobile-btn.active {
    background: rgba(255, 0, 85, 0.6);
    border-color: #FF0055;
}

#btn-accel, #btn-brake {
    width: 80px;
    height: 80px;
    font-size: 12px;
}

#btn-brake { background: rgba(255, 0, 0, 0.1); }
#btn-brake:active, #btn-brake.active { background: rgba(255, 0, 0, 0.6); }

@media (max-width: 600px) {
    .overlay h1 { font-size: 30px; margin-bottom: 20px; }
    #hud { font-size: 12px; }
    .mobile-btn { width: 50px; height: 50px; font-size: 16px; }
    #btn-accel, #btn-brake { width: 65px; height: 65px; font-size: 10px; }
    #mobile-controls { bottom: 10px; left: 10px; right: 10px; }
    #mobile-toggle-btn { right: 55px; }
}
