@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Orbitron', sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

#start-screen, #end-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 51, 0.8);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    pointer-events: auto;
    border: 2px solid #00FFFF;
    box-shadow: 0 0 20px #00FFFF, 0 0 30px #FF00FF;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #FF00FF; /* Magenta */
    text-shadow: 0 0 10px #FF00FF, 0 0 20px #FF00FF;
    letter-spacing: 2px;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #00FFFF; /* Cyan */
    text-shadow: 0 0 10px #00FFFF;
}

p {
    margin-bottom: 1rem;
    line-height: 1.5;
    color: #FFFFFF;
    text-shadow: 0 0 5px #FFFFFF;
}

.instructions {
    text-align: left;
    margin: 1.5rem 0;
    line-height: 2;
}

.key {
    display: inline-block;
    background-color: #000033;
    color: #00FFFF;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    min-width: 1.5rem;
    text-align: center;
    margin: 0 0.2rem;
    border: 1px solid #00FFFF;
    box-shadow: 0 0 5px #00FFFF;
}

button {
    background-color: #000033;
    color: #FF00FF;
    border: 2px solid #FF00FF;
    padding: 0.8rem 1.5rem;
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
    pointer-events: auto;
    transition: all 0.2s;
    text-shadow: 0 0 5px #FF00FF;
    box-shadow: 0 0 10px #FF00FF;
    letter-spacing: 1px;
}

button:hover {
    background-color: #FF00FF;
    color: #000033;
    box-shadow: 0 0 15px #FF00FF, 0 0 25px #FF00FF;
}

#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: rgba(0, 0, 51, 0.6);
    padding: 15px;
    border-radius: 8px;
    color: white;
    font-size: 1.2rem;
    pointer-events: none;
    border: 1px solid #FF00FF; /* Changed to magenta for retrowave style */
    box-shadow: 0 0 15px #FF00FF;
    width: auto;
    min-width: 220px; /* Ensure enough width for the content */
    z-index: 5;
}

/* On-screen controls */
#controls-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    pointer-events: auto;
    z-index: 10; /* Ensure controls are above other elements */
}

#steering-controls, #acceleration-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.control-button {
    background-color: rgba(0, 0, 51, 0.8);
    color: #00FFFF;
    border: 2px solid #00FFFF;
    border-radius: 8px;
    padding: 15px;
    font-size: 1.2rem;
    cursor: pointer;
    min-width: 50px;
    transition: all 0.2s;
    pointer-events: auto;
    box-shadow: 0 0 10px #00FFFF;
}

.control-button:hover {
    background-color: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 15px #00FFFF, 0 0 25px #00FFFF;
}

.control-button:active {
    background-color: #00FFFF;
    color: #000033;
}

#brake-button {
    padding: 15px 30px;
    color: #FF00FF;
    border-color: #FF00FF;
    box-shadow: 0 0 10px #FF00FF;
}

#brake-button:hover {
    background-color: rgba(255, 0, 255, 0.3);
    box-shadow: 0 0 15px #FF00FF, 0 0 25px #FF00FF;
}

#brake-button:active {
    background-color: #FF00FF;
    color: #000033;
}

#speed-container, #time-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

#speed-value, #time-value {
    font-weight: bold;
    color: #00FFFF;
    min-width: 3.5rem; /* Increased width to prevent overflow */
    text-align: right;
    text-shadow: 0 0 5px #00FFFF;
    display: inline-block; /* Ensure proper sizing */
}

#score-container {
    margin: 1.5rem 0;
    text-align: left;
}

#score-container p {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

#final-score {
    font-size: 1.5rem;
    color: #FF00FF;
    font-weight: bold;
    text-shadow: 0 0 10px #FF00FF;
}

.hidden {
    display: none;
}
