/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a0a;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

#game-canvas {
    display: block;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 30%, #0f3460 60%, #1a1a2e 100%);
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    padding: 20px;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid #e74c3c;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
}

.timer-icon {
    font-size: 24px;
}

.timer-display {
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px #e74c3c;
}

.timer-display.warning {
    animation: pulse-red 0.5s ease-in-out infinite;
}

@keyframes pulse-red {
    0%, 100% { color: #fff; text-shadow: 0 0 10px #e74c3c; }
    50% { color: #e74c3c; text-shadow: 0 0 20px #e74c3c; }
}

.score-container, .highscore-container {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid #3498db;
    text-align: center;
    min-width: 120px;
}

.highscore-container {
    border-color: #f39c12;
}

.score-label, .highscore-label {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 5px;
    letter-spacing: 2px;
}

.score-value, .highscore-value {
    font-size: 28px;
    font-weight: bold;
    color: #fff;
}

.highscore-value {
    color: #f39c12;
}

/* Speed Indicator */
.speed-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.speed-bar-container {
    width: 200px;
    height: 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid #444;
}

.speed-bar {
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    transition: width 0.3s ease, filter 0.3s ease;
}

.speed-bar.slow {
    width: 25%;
    filter: hue-rotate(240deg);
}

.speed-bar.boost {
    width: 100%;
    animation: pulse-speed 0.3s ease-in-out infinite;
}

@keyframes pulse-speed {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.speed-label {
    margin-top: 5px;
    font-size: 14px;
    color: #fff;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.speed-label.slow {
    color: #3498db;
}

.speed-label.boost {
    color: #e74c3c;
}

/* Screens */
#start-screen, #game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    backdrop-filter: blur(5px);
}

.title-container {
    text-align: center;
    margin-bottom: 40px;
}

.game-title {
    font-size: 72px;
    font-weight: 900;
    background: linear-gradient(135deg, #e74c3c, #f39c12, #e74c3c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(231, 76, 60, 0.5);
    letter-spacing: 4px;
    margin-bottom: 10px;
}

.game-subtitle {
    font-size: 18px;
    color: #aaa;
    letter-spacing: 8px;
    text-transform: uppercase;
}

.instructions {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 30px 40px;
    margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    color: #ddd;
    font-size: 16px;
}

.instruction-item:last-child {
    margin-bottom: 0;
}

.key {
    background: #333;
    padding: 5px 12px;
    border-radius: 5px;
    font-weight: bold;
    color: #fff;
    min-width: 50px;
    text-align: center;
    border: 1px solid #555;
}

.icon {
    font-size: 20px;
    min-width: 30px;
}

.btn-primary {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    border: none;
    padding: 18px 60px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 3px;
    box-shadow: 0 10px 30px rgba(231, 76, 60, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(231, 76, 60, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.credits {
    position: absolute;
    bottom: 20px;
    color: #666;
    font-size: 12px;
}

/* Game Over Screen */
.game-over-content {
    text-align: center;
}

.game-over-title {
    font-size: 56px;
    color: #e74c3c;
    margin-bottom: 40px;
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
    letter-spacing: 4px;
}

.final-stats {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 40px 60px;
    margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 300px;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: #aaa;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.stat-value {
    color: #fff;
    font-size: 32px;
    font-weight: bold;
}

.new-record {
    justify-content: center;
    background: rgba(243, 156, 18, 0.2);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #f39c12;
}

.new-record .stat-label {
    color: #f39c12;
    font-weight: bold;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .game-title {
        font-size: 48px;
    }
    
    .instructions {
        padding: 20px 30px;
    }
    
    .instruction-item {
        font-size: 14px;
    }
    
    .btn-primary {
        padding: 15px 40px;
        font-size: 20px;
    }
    
    .hud-top {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .timer-display {
        font-size: 24px;
    }
    
    .score-value, .highscore-value {
        font-size: 20px;
    }
}