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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    align-items: start;
}

/* Console Area */
#console-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* TV Container */
#tv-container {
    background: linear-gradient(145deg, #3d2f1f, #2a1f15);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 3px solid #4a3728;
}

#tv-frame {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #333;
    position: relative;
}

#screen-container {
    position: relative;
    background: #000;
    border-radius: 5px;
    overflow: hidden;
    border: 2px solid #222;
}

#screen-container.curved {
    border-radius: 8px;
    transform: perspective(400px) rotateX(2deg);
}

#canvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

#scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0,255,0,0.03) 1px,
        rgba(0,255,0,0.03) 2px
    );
    pointer-events: none;
}

#screen-glow {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(ellipse at center, rgba(0,255,0,0.1) 0%, transparent 70%);
    pointer-events: none;
}

#channel-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,100,0,0.8);
    color: black;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
}

/* Console Unit */
#console-unit {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 10px;
    padding: 20px;
    border: 2px solid #444;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#console-body {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto auto;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

#console-logo {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #silver;
    background: linear-gradient(90deg, #c0c0c0, #silver);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

#power-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #333;
}

.led-off {
    background: #330000;
}

.led-on {
    background: #ff0000;
    box-shadow: 0 0 10px #ff0000;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { opacity: 1; }
    to { opacity: 0.6; }
}

#cartridge-slot {
    background: #111;
    height: 20px;
    border: 2px inset #333;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

#inserted-cartridge {
    display: none;
    background: #444;
    color: #fff;
    padding: 2px 6px;
    font-size: 10px;
    text-align: center;
    border-radius: 2px;
    transition: transform 0.3s ease;
}

#controller-ports {
    display: flex;
    gap: 10px;
}

.port {
    width: 25px;
    height: 15px;
    background: #111;
    border: 1px solid #333;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #666;
}

#power-btn {
    background: linear-gradient(145deg, #ff6600, #cc4400);
    border: none;
    border-radius: 5px;
    padding: 8px 16px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

#power-btn:hover {
    background: linear-gradient(145deg, #ff7722, #dd5511);
    transform: translateY(-1px);
}

#power-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Controls Area */
#controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#game-selection h3 {
    color: #00ff00;
    margin-bottom: 10px;
    font-size: 16px;
}

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

.cartridge {
    background: linear-gradient(145deg, #333, #222);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.cartridge:hover {
    background: linear-gradient(145deg, #444, #333);
    border-color: #00ff00;
    transform: translateY(-2px);
}

.cartridge-placeholder {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 5px;
    border-radius: 3px;
    background: linear-gradient(145deg, #555, #333);
    border: 1px solid #666;
}

.asteroids-cartridge {
    background: linear-gradient(145deg, #001122, #000);
}

.maze-cartridge {
    background: linear-gradient(145deg, #220011, #000);
}

.invaders-cartridge {
    background: linear-gradient(145deg, #112200, #000);
}

.pong-cartridge {
    background: linear-gradient(145deg, #221100, #000);
}

.snake-cartridge {
    background: linear-gradient(145deg, #002211, #000);
}

.cartridge span {
    display: block;
    color: #ccc;
    font-weight: bold;
}

/* Controller Interface */
#controller-interface {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #444;
}

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

.controller-body {
    background: linear-gradient(145deg, #333, #222);
    border-radius: 15px;
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 15px;
    border: 2px solid #555;
}

.joystick {
    grid-row: 1 / 3;
}

.joystick-base {
    width: 60px;
    height: 60px;
    background: #111;
    border: 2px inset #333;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.joystick-stick {
    width: 20px;
    height: 20px;
    background: linear-gradient(145deg, #666, #444);
    border-radius: 50%;
    border: 1px solid #333;
    cursor: pointer;
}

.fire-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fire-btn {
    background: linear-gradient(145deg, #ff3333, #cc0000);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    color: white;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
}

.fire-btn:active {
    background: linear-gradient(145deg, #cc0000, #990000);
    transform: scale(0.95);
}

.number-pad {
    grid-column: 1 / 3;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}

.num-btn {
    background: linear-gradient(145deg, #555, #333);
    border: 1px solid #666;
    border-radius: 3px;
    color: white;
    font-size: 10px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.num-btn:active {
    background: linear-gradient(145deg, #333, #222);
    transform: scale(0.95);
}

.controller-label {
    font-size: 12px;
    color: #00ff00;
    font-weight: bold;
}

/* Settings Panel */
#settings-panel {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #444;
}

#settings-panel h3 {
    color: #00ff00;
    margin-bottom: 10px;
    font-size: 14px;
}

.setting-group {
    margin-bottom: 10px;
}

.setting-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #ccc;
}

.setting-group input[type="range"] {
    flex: 1;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
}

.setting-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

#clean-cartridge {
    background: linear-gradient(145deg, #00aa00, #006600);
    border: none;
    border-radius: 5px;
    padding: 6px 12px;
    color: white;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#clean-cartridge:hover {
    background: linear-gradient(145deg, #00cc00, #008800);
}

/* Key Mapping */
#key-mapping {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #444;
}

#key-mapping h4 {
    color: #00ff00;
    margin-bottom: 8px;
    font-size: 12px;
}

#key-mapping p {
    font-size: 11px;
    color: #ccc;
    line-height: 1.4;
}

/* Startup Screen */
#startup-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

#startup-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#startup-screen.visible {
    opacity: 1;
}

#coleco-logo {
    margin-bottom: 30px;
    text-align: center;
}

.logo-text {
    font-size: 48px;
    font-weight: bold;
    color: #silver;
    background: linear-gradient(90deg, #c0c0c0, #silver, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 10px;
}

.logo-subtitle {
    font-size: 14px;
    color: #aaa;
    font-style: italic;
}

#startup-text {
    color: #00ff00;
    font-size: 14px;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 15px;
    color: #666;
    font-size: 12px;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    #app {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    #cartridge-grid {
        grid-template-columns: 1fr;
    }
    
    .controller-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .joystick {
        grid-row: 1;
        justify-self: center;
    }
    
    .number-pad {
        grid-column: 1;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    #tv-container {
        padding: 10px;
    }
    
    #console-unit {
        padding: 15px;
    }
    
    .controller-body {
        padding: 10px;
    }
}