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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(45deg, #2c1810, #4a2c1a);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.device-container {
    max-width: 400px;
    width: 100%;
}

.handheld-device {
    background: linear-gradient(145deg, #ff6b35, #d55028);
    border-radius: 25px;
    padding: 20px;
    box-shadow: 
        inset 2px 2px 5px rgba(255, 255, 255, 0.2),
        inset -2px -2px 5px rgba(0, 0, 0, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.4);
    position: relative;
    border: 3px solid #b84520;
}

.device-header {
    text-align: center;
    margin-bottom: 15px;
}

.mattel-logo {
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    letter-spacing: 3px;
}

.game-title {
    font-size: 14px;
    color: #ffeb3b;
    font-weight: bold;
    margin-top: 5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.screen-area {
    background: #1a1a1a;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 
        inset 3px 3px 8px rgba(0, 0, 0, 0.8),
        inset -1px -1px 3px rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
    align-items: center;
}

#gameCanvas {
    background: #000000;
    border: 2px solid #333;
    border-radius: 8px;
    flex: 1;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.1);
}

.speed-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.speed-label {
    color: #ffeb3b;
    font-size: 10px;
    font-weight: bold;
}

.speed-leds {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.speed-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
    border: 1px solid #555;
}

.speed-led.active {
    background: #00ff00;
    box-shadow: 0 0 8px #00ff00;
}

.score-area {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    background: #2a2a2a;
    border-radius: 10px;
    padding: 10px;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.5);
}

.score-display, .high-score-display {
    text-align: center;
}

.score-label, .high-score-label {
    color: #ffeb3b;
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 5px;
}

.score-value, .high-score-value {
    color: #00ff00;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 8px #00ff00;
    background: #000;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #333;
}

.controls-area {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 15px;
}

.control-btn {
    flex: 1;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #ffeb3b, #ffc107);
    color: #333;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 
        3px 3px 8px rgba(0, 0, 0, 0.3),
        inset 1px 1px 3px rgba(255, 255, 255, 0.3);
    transition: all 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
    transform: scale(0.95);
    box-shadow: 
        1px 1px 4px rgba(0, 0, 0, 0.3),
        inset 3px 3px 8px rgba(0, 0, 0, 0.2);
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.game-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #4caf50, #388e3c);
    color: white;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
}

.game-btn:active {
    transform: scale(0.95);
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.pause-btn {
    background: linear-gradient(145deg, #ff9800, #f57c00);
}

.speed-slider {
    width: 200px;
    margin: 10px 0;
}

.speed-slider-label {
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-content {
    background: linear-gradient(145deg, #ff6b35, #d55028);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 3px solid #b84520;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.game-over-title {
    color: white;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.final-score {
    color: #ffeb3b;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
}

.restart-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #4caf50, #388e3c);
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
}

.restart-btn:active {
    transform: scale(0.95);
}

.instructions {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    color: white;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.instructions h3 {
    color: #ffeb3b;
    margin-bottom: 10px;
}

.instructions p {
    margin-bottom: 8px;
    line-height: 1.4;
    font-size: 14px;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .device-container {
        padding: 10px;
    }
    
    .handheld-device {
        padding: 15px;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    .control-btn {
        height: 50px;
        font-size: 11px;
    }
    
    .instructions {
        font-size: 12px;
    }
}

/* Responsive canvas */
@media (max-width: 350px) {
    #gameCanvas {
        width: 150px;
        height: 200px;
    }
}