@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

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

body {
    margin: 0;
    padding: 0;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Orbitron', monospace;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

.arcade-cabinet {
    background: radial-gradient(ellipse at center, #1a1a1a 0%, #000 70%);
    padding: 2vw;
    border-radius: 2vw;
    position: relative;
    box-shadow: 
        0 0 100px rgba(0, 255, 0, 0.3),
        inset 0 0 50px rgba(255, 255, 255, 0.05);
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.crt-screen {
    position: relative;
    background: #000;
    border: 0.5vw solid #333;
    border-radius: 1vw;
    padding: 0;
    box-shadow: 
        inset 0 0 50px rgba(0, 255, 0, 0.1),
        0 0 30px rgba(0, 255, 0, 0.5);
    overflow: hidden;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.canvas-container {
    display: flex;
    gap: 1vw;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    height: 100%;
    padding: 0.5vw;
    box-sizing: border-box;
    flex-wrap: nowrap;
}

/* All canvases are centered within their grid cells */

canvas {
    display: block;
    background: #000;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: 
        contrast(1.3) 
        brightness(1.2) 
        saturate(0)
        drop-shadow(0 0 2px rgba(255, 255, 255, 0.8));
    width: 100%;
    height: 100%;
    object-fit: contain;
    flex: 1;
}

/* Responsive scaling for different screen sizes */
@media (max-width: 768px) {
    .arcade-cabinet {
        padding: 1vw;
    }
    
    .crt-screen {
        border: 0.3vw solid #333;
        border-radius: 0.5vw;
    }
    
    .canvas-container {
        flex-direction: column;
        gap: 0.5vw;
        padding: 0.5vw;
    }
}

@media (max-width: 480px) {
    .arcade-cabinet {
        padding: 0.5vw;
    }
    
    .crt-screen {
        border: 0.2vw solid #333;
        border-radius: 0.3vw;
    }
    
    .canvas-container {
        flex-direction: column;
        gap: 0.3vw;
        padding: 0.3vw;
    }
}

/* Large screens use object-fit: contain for proper scaling */

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .arcade-cabinet {
        padding: 1vw;
    }
}

/* Portrait orientation adjustments */
@media (orientation: portrait) and (max-width: 600px) {
    .arcade-cabinet {
        padding: 1vw;
    }
}

/* Scanlines effect */
.crt-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 4px,
        rgba(0, 0, 0, 0.15) 4px,
        rgba(0, 0, 0, 0.15) 8px
    );
    pointer-events: none;
    z-index: 10;
}

/* CRT glow and flicker */
.crt-screen::after {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    right: -10%;
    bottom: -10%;
    background: 
        radial-gradient(ellipse at center, 
            rgba(0, 255, 0, 0.1) 0%, 
            transparent 60%);
    animation: crtGlow 2s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 11;
}

@keyframes crtGlow {
    0% { 
        opacity: 0.8;
        transform: scale(1);
    }
    100% { 
        opacity: 1;
        transform: scale(1.02);
    }
}

/* Subtle flicker */
.crt-screen {
    animation: flicker 0.1s infinite linear alternate;
}

@keyframes flicker {
    0% { filter: brightness(1); }
    2% { filter: brightness(1.02); }
    4% { filter: brightness(0.98); }
    100% { filter: brightness(1); }
}

.game-over-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #0f0;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    display: none;
    text-shadow: 0 0 5px #0f0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.9);
    padding: 30px;
    border: 2px solid #0f0;
    border-radius: 10px;
    font-family: monospace;
    animation: gameOverGlow 1.5s ease-in-out infinite alternate;
}

@keyframes gameOverGlow {
    0% { 
        text-shadow: 0 0 5px #0f0;
        border-color: #0f0;
    }
    100% { 
        text-shadow: 0 0 8px #0f0;
        border-color: #0f0;
    }
}

/* Start screen styling */
.start-screen-text {
    text-shadow: 0 0 10px #0f0, 0 0 20px #0f0, 0 0 30px #0f0;
    animation: startScreenGlow 2s ease-in-out infinite alternate;
}

@keyframes startScreenGlow {
    0% { 
        text-shadow: 0 0 10px #0f0, 0 0 20px #0f0, 0 0 30px #0f0;
    }
    100% { 
        text-shadow: 0 0 15px #0f0, 0 0 30px #0f0, 0 0 45px #0f0;
    }
}

.controls-panel {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: #0f0;
    font-size: 18px;
    text-align: center;
    opacity: 0.9;
    text-shadow: 0 0 5px #0f0;
    z-index: 30;
    font-family: monospace;
    font-weight: bold;
    animation: controlsGlow 2s ease-in-out infinite alternate;
    letter-spacing: 1px;
}

@keyframes controlsGlow {
    0% { 
        text-shadow: 0 0 5px #0f0;
    }
    100% { 
        text-shadow: 0 0 8px #0f0;
    }
}

/* Responsive text scaling */
@media (max-width: 768px) {
    .game-over-overlay {
        font-size: 4vw;
        padding: 2vw;
    }
    
    .controls-panel {
        font-size: 3vw;
    }
}

@media (max-width: 480px) {
    .game-over-overlay {
        font-size: 5vw;
        padding: 3vw;
    }
    
    .controls-panel {
        font-size: 4vw;
    }
}

@media (min-width: 1920px) {
    .game-over-overlay {
        font-size: 2vw;
        padding: 1.5vw;
    }
    
    .controls-panel {
        font-size: 1.5vw;
    }
}

/* Portfolio Key Styles */
.portfolio-key {
    position: absolute;
    left: -200px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #0f0;
    border-radius: 10px;
    padding: 20px;
    color: #0f0;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    text-shadow: 0 0 5px #0f0;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    z-index: 100;
    min-width: 150px;
    animation: keyGlow 2s ease-in-out infinite alternate;
}

.key-title {
    font-size: 16px;
    text-align: center;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.key-item {
    display: flex;
    align-items: center;
    margin: 10px 0;
    font-size: 14px;
}

.key-color {
    width: 20px;
    height: 15px;
    margin-right: 10px;
    border-radius: 3px;
    box-shadow: 0 0 10px currentColor;
}

.key-color.bright {
    background: #ffffff;
    box-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
    animation: brightGlow 1s ease-in-out infinite alternate;
}

.key-instruction {
    margin-top: 15px;
    font-size: 12px;
    text-align: center;
    color: #0f0;
    text-shadow: 0 0 5px #0f0;
}

@keyframes brightGlow {
    0% { 
        box-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
    }
    100% { 
        box-shadow: 0 0 30px #00ffff, 0 0 60px #00ffff;
    }
}

@keyframes keyGlow {
    0% { 
        box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
        border-color: #0f0;
    }
    100% { 
        box-shadow: 0 0 30px rgba(0, 255, 0, 0.8);
        border-color: #0f0;
    }
}

.skip-button {
    position: absolute;
    top: 2vw;
    right: 2vw;
    background: transparent;
    border: 2px solid #0f0;
    color: #0f0;
    padding: 1vw 2vw;
    font-family: 'Orbitron', monospace;
    font-size: 1.2vw;
    font-weight: 700;
    cursor: pointer;
    text-shadow: 0 0 5px #0f0;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
    transition: all 0.3s ease;
    letter-spacing: 1px;
    z-index: 50;
}

.skip-button:hover {
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
    transform: scale(1.05);
}

/* Responsive Portfolio Key */
@media (max-width: 768px) {
    .portfolio-key {
        left: -180px;
        padding: 15px;
        min-width: 130px;
    }
    
    .key-title {
        font-size: 14px;
    }
    
    .key-item {
        font-size: 12px;
    }
    
    .key-color {
        width: 16px;
        height: 12px;
    }
    
    .skip-button {
        font-size: 2vw;
        padding: 2vw 3vw;
    }
}

@media (max-width: 480px) {
    .portfolio-key {
        left: -160px;
        padding: 10px;
        min-width: 110px;
    }
    
    .key-title {
        font-size: 12px;
    }
    
    .key-item {
        font-size: 10px;
    }
    
    .key-color {
        width: 14px;
        height: 10px;
    }
    
    .skip-button {
        font-size: 3vw;
        padding: 3vw 4vw;
    }
}
