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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #87ceeb, #98fb98);
}

#scene-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#ui-overlay > * {
    pointer-events: auto;
}

#header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 3px solid #fff;
    text-align: center;
    min-width: 300px;
}

#header h1 {
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 5px;
}

#coin-counter {
    color: #ffd700;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#track-info {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 3px solid #fff;
    color: white;
    min-width: 250px;
    text-align: center;
}

#track-info h3 {
    font-size: 20px;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#track-difficulty {
    font-size: 24px;
    margin: 10px 0;
}

#best-time {
    font-size: 14px;
    margin-bottom: 15px;
    opacity: 0.9;
}

#start-race-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

#start-race-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

#character-panel {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 3px solid #fff;
    min-width: 280px;
    max-height: 80vh;
    overflow-y: auto;
}

#character-panel h3 {
    color: #333;
    text-align: center;
    margin-bottom: 15px;
    font-size: 18px;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
}

#character-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.character-card {
    background: rgba(255,255,255,0.8);
    padding: 10px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.character-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.character-card.selected {
    border-color: #ff6b6b;
    background: rgba(255,255,255,1);
    transform: scale(1.05);
}

.character-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 auto 8px;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.character-name {
    font-size: 12px;
    font-weight: bold;
    color: #333;
}

#character-stats {
    background: rgba(255,255,255,0.9);
    padding: 10px;
    border-radius: 10px;
    font-size: 12px;
    color: #333;
}

#character-stats > div {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-bar {
    background: #ddd;
    height: 8px;
    border-radius: 4px;
    width: 100px;
    overflow: hidden;
    margin-left: 10px;
}

.stat-fill {
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

#controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
}

#controls button {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 2px solid #fff;
}

#controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

#settings-panel {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 3px solid #fff;
    color: white;
    min-width: 250px;
}

#settings-panel h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 18px;
}

#settings-panel label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
}

#settings-panel input[type="range"] {
    width: 100%;
    margin-left: 10px;
}

#close-settings {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    width: 100%;
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    font-size: 48px;
    animation: bounce 1s infinite;
    margin-bottom: 20px;
}

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

.hidden {
    display: none !important;
}

.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 3px solid #fff;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    z-index: 1001;
    animation: messageSlide 3s ease-in-out;
}

@keyframes messageSlide {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    10%, 90% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

footer {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    z-index: 99;
}

footer a {
    color: #4ecdc4;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #header {
        top: 10px;
        padding: 10px 15px;
        min-width: 250px;
    }
    
    #header h1 {
        font-size: 20px;
    }
    
    #track-info, #character-panel {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 90vw;
        max-height: 80vh;
    }
    
    #controls {
        bottom: 10px;
        flex-wrap: wrap;
        max-width: 90vw;
    }
    
    #controls button {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    #character-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}