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

body {
    background: #0a0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Courier New', monospace;
    color: #e0e0e0;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: min(800px, calc(100vw - 20px));
    height: min(600px, calc(100vh - 20px));
    max-width: 1024px;
    max-height: 768px;
}

#gameCanvas {
    display: block;
    background: #0a0a0a;
    border: 2px solid #333;
    box-shadow: 0 0 30px rgba(255, 0, 100, 0.4);
}

/* Screens */
/* Screen Transitions */
.screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.88);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.screen.active { 
    display: flex; 
    opacity: 1;
    animation: screen-fade 0.3s ease;
}
@keyframes screen-fade {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Typography */
.neon-title {
    font-size: 3em;
    color: #ff0066;
    text-shadow: 0 0 10px #ff0066, 0 0 30px #ff0066, 0 0 60px #ff0033;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 10px;
    animation: neon-pulse 2s ease-in-out infinite;
}
.subtitle {
    font-size: 1.1em;
    color: #ff8800;
    text-shadow: 0 0 5px #ff8800;
    margin-bottom: 20px;
}
@keyframes neon-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Input */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.input-group input {
    background: transparent;
    border: 2px solid #ff0066;
    color: #ff0066;
    padding: 10px 16px;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    text-align: center;
    width: 200px;
    outline: none;
}
.input-group input:focus {
    box-shadow: 0 0 15px rgba(255, 0, 100, 0.5);
}

/* Buttons */
button {
    background: transparent;
    border: 2px solid #ff0066;
    color: #ff0066;
    padding: 10px 24px;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
button::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 0, 100, 0.1), transparent);
    transition: left 0.4s;
}
button:hover {
    background: #ff0066;
    color: #0a0a0a;
    box-shadow: 0 0 20px rgba(255, 0, 100, 0.6), 0 0 40px rgba(255, 0, 100, 0.3);
}
button:hover::before {
    left: 100%;
}
button:active {
    transform: scale(0.95);
}

/* Room List */
.room-list-wrap {
    margin-top: 15px;
    text-align: center;
}
.room-list-wrap h3 {
    color: #ff8800;
    margin-bottom: 10px;
    font-size: 1em;
}
#room-list {
    max-height: 200px;
    overflow-y: auto;
}
.room-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 20px;
    margin: 4px 0;
    border: 1px solid #333;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 250px;
}
.room-item:hover {
    border-color: #ff0066;
    background: rgba(255, 0, 100, 0.1);
}
.room-item span:first-child { color: #00ffff; font-weight: bold; }
.room-item span:last-child { color: #888; }

/* Room Actions in Menu */
.room-actions-menu {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

/* Bot Options */
.bot-options {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    justify-content: center;
}
.bot-options label {
    color: #888;
    font-size: 0.9em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
.bot-options input[type="checkbox"] {
    accent-color: #ff0066;
}

/* Room Screen */
.room-info {
    text-align: center;
    margin-bottom: 20px;
}
.room-info h2 { color: #ff0066; margin-bottom: 15px; }
.room-code { color: #00ffff; font-size: 1.5em; }
#player-list { margin-top: 10px; }
.player-item {
    padding: 5px 0;
    color: #e0e0e0;
    border-bottom: 1px solid #222;
}

.room-actions {
    display: flex;
    gap: 15px;
}

/* Countdown */
#countdown-screen h1 {
    font-size: 6em;
    color: #ff0066;
    text-shadow: 0 0 30px #ff0066;
    animation: countdown-pulse 1s ease-in-out infinite;
}
@keyframes countdown-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* HUD */
#hud {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: none;
    pointer-events: none;
    z-index: 5;
}
#hud-position {
    position: absolute;
    top: 15px; left: 15px;
    font-size: 2em;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
}
#hud-lap {
    position: absolute;
    top: 15px; left: 50%;
    transform: translateX(-50%);
    font-size: 1.2em;
    color: #ff8800;
}
#hud-speed {
    position: absolute;
    bottom: 15px; right: 15px;
    font-size: 1.5em;
    color: #00ff41;
    text-shadow: 0 0 10px #00ff41;
}

/* Results */
#results-screen { text-align: center; }
#results-screen h1 {
    font-size: 2.5em;
    color: #ffcc00;
    text-shadow: 0 0 20px #ffcc00;
    margin-bottom: 20px;
}
.result-item {
    padding: 8px 0;
    font-size: 1.1em;
    color: #e0e0e0;
    border-bottom: 1px solid #222;
}
#btn-results-menu {
    margin-top: 20px;
}

/* Loading & Status Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255, 0, 100, 0.2);
    border-top-color: #ff0066;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Responsive */
@media (max-width: 600px) {
    .neon-title { font-size: 2em; }
    .subtitle { font-size: 0.9em; }
    button { padding: 8px 16px; font-size: 0.9em; }
    #hud-speed { font-size: 1.2em; }
    #hud-position { font-size: 1.5em; }
}
#mobile-controls {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 120px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 20;
}
#mobile-controls.hidden { display: none; }
.touch-btn {
    width: 60px; height: 60px;
    border: 2px solid rgba(255, 0, 100, 0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 0, 100, 0.7);
    font-size: 1.2em;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    backdrop-filter: blur(4px);
    transition: all 0.15s;
}
.touch-btn:active {
    background: rgba(255, 0, 100, 0.3);
    transform: scale(0.9);
    box-shadow: 0 0 15px rgba(255, 0, 100, 0.4);
}
