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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #2c1810, #4a3425);
    color: #D4C5A0;
    min-height: 100vh;
    overflow-x: auto;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: #FF6B35;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.console-area {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

#canvas {
    border: 8px solid #4A3425;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-width: 100%;
    height: auto;
}

.controls-panel {
    flex: 1;
    min-width: 300px;
    background: linear-gradient(145deg, #E5D6B7, #C3B49A);
    border: 4px solid #4A3425;
    border-radius: 12px;
    padding: 20px;
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.2);
}

.power-section {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    align-items: center;
}

.power-button {
    background: linear-gradient(145deg, #DC143C, #B91C3C);
    border: 3px solid #4A3425;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    padding: 12px 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    position: relative;
    transition: all 0.2s;
}

.power-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.power-button:active {
    transform: translateY(1px);
}

.power-led {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid #333;
}

.power-led.off {
    background: #444;
}

.power-led.on {
    background: #00FF00;
    box-shadow: 0 0 8px #00FF00;
}

.channel-select {
    background: #D4C5A0;
    border: 2px solid #4A3425;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: inherit;
    font-weight: bold;
    color: #4A3425;
}

.game-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.joystick-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.joystick {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, #666, #333);
    border: 4px solid #4A3425;
    border-radius: 50%;
    position: relative;
    cursor: grab;
}

.joystick:active {
    cursor: grabbing;
}

.joystick-stick {
    width: 24px;
    height: 24px;
    background: linear-gradient(145deg, #888, #444);
    border: 2px solid #222;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 40px;
    height: 40px;
    border: 3px solid #4A3425;
    border-radius: 50%;
    background: linear-gradient(145deg, #FF6B35, #DC143C);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn.pressed {
    transform: scale(0.95);
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.3);
}

.keypad {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 150px;
}

.keypad-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(145deg, #D4C5A0, #B8A082);
    border: 2px solid #4A3425;
    border-radius: 4px;
    color: #4A3425;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.keypad-btn:hover {
    background: linear-gradient(145deg, #E5D6B7, #C3B49A);
}

.keypad-btn.pressed {
    transform: scale(0.9);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.system-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.system-btn {
    padding: 8px 16px;
    background: linear-gradient(145deg, #1E3A8A, #1E40AF);
    border: 2px solid #4A3425;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    transition: all 0.2s;
}

.system-btn:hover {
    background: linear-gradient(145deg, #2563EB, #3B82F6);
}

.system-btn.pressed {
    transform: scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.cartridge-section {
    margin-bottom: 25px;
}

.cartridge-section h3 {
    color: #4A3425;
    margin-bottom: 15px;
    font-size: 16px;
}

.cartridge-rack {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.cartridge {
    background: linear-gradient(145deg, #666, #444);
    border: 2px solid #333;
    border-radius: 4px;
    padding: 12px 8px;
    color: white;
    text-align: center;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cartridge:hover {
    background: linear-gradient(145deg, #777, #555);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.cartridge.inserted {
    background: linear-gradient(145deg, #FF6B35, #DC143C);
    border-color: #4A3425;
    box-shadow: 0 0 12px rgba(255, 107, 53, 0.5);
}

.settings-panel {
    border-top: 2px solid #4A3425;
    padding-top: 20px;
}

.volume-control, .difficulty-switches {
    margin-bottom: 15px;
}

.volume-control label, .difficulty-switches label {
    display: block;
    color: #4A3425;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 5px;
}

.volume-control input[type="range"] {
    width: 100%;
    margin-top: 5px;
}

.difficulty-switches select {
    background: #D4C5A0;
    border: 1px solid #4A3425;
    border-radius: 3px;
    padding: 4px 8px;
    font-family: inherit;
    color: #4A3425;
    margin-top: 5px;
    width: 100%;
}

.info-panel {
    background: linear-gradient(145deg, #1a1a1a, #333);
    border: 3px solid #4A3425;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.score-display, .game-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-display span, .game-info span {
    color: #39FF14;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 0 4px #39FF14;
}

#gameTitle {
    color: #FF6B35 !important;
    text-shadow: 0 0 4px #FF6B35 !important;
}

footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 14px;
}

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

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

/* Responsive design */
@media (max-width: 768px) {
    .console-area {
        flex-direction: column;
    }
    
    #canvas {
        width: 100%;
        height: auto;
    }
    
    .game-controls {
        justify-content: center;
    }
    
    .cartridge-rack {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .info-panel {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .controls-panel {
        padding: 15px;
    }
    
    .cartridge-rack {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 1.8rem;
    }
}

/* CRT Effect */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.98; }
}

#canvas {
    animation: flicker 0.15s infinite linear;
}

/* Button animations */
@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.pressed {
    animation: buttonPress 0.1s ease;
}