@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Outfit:wght@400;600;800&display=swap');

:root {
    --bg-dark: #0D1117;
    --card-bg: #161B22;
    --accent-orange: #FF6D00;
    --accent-gold: #FFD700;
    --accent-pink: #EC407A;
    --accent-green: #00E676;
    --accent-purple: #7B1FA2;
    --text-color: #F0F6FC;
    --border-color: #30363D;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    padding: 10px;
}

/* Header Container */
.game-header {
    text-align: center;
    margin-bottom: 12px;
}

.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.8rem;
    color: var(--accent-orange);
    text-shadow: 3px 3px 0px #BF360C, 6px 6px 0px #000;
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.game-subtitle {
    font-size: 0.95rem;
    color: #8B949E;
    letter-spacing: 0.5px;
}

/* Main Game Cabinet Container */
.game-container {
    position: relative;
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16 / 9;
    background: #000;
    border: 4px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7), 0 0 25px rgba(255, 109, 0, 0.2);
    overflow: hidden;
}

/* Canvas Styling */
#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    image-rendering: -moz-crisp-edges;
}

/* CRT Scanline Overlay */
.crt-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 10;
}

/* HUD Overlay */
.hud-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.75rem;
    z-index: 20;
    border-bottom: 2px solid var(--border-color);
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-level {
    color: var(--accent-green);
}

.hud-lives {
    font-size: 1rem;
    letter-spacing: 2px;
}

.hud-score {
    color: var(--accent-gold);
}

.hud-hams {
    color: var(--accent-pink);
}

/* Screen Overlay (Start / Level Complete / Game Over / Win) */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 23, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    z-index: 30;
    backdrop-filter: blur(6px);
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    display: none;
}

.overlay-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 2.2rem;
    color: var(--accent-orange);
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 20px;
    animation: bounce 1.2s infinite alternate ease-in-out;
}

.overlay-sub {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.85rem;
    color: #C9D1D9;
    line-height: 1.8;
    max-width: 600px;
    white-space: pre-line;
    margin-bottom: 25px;
}

.start-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.95rem;
    color: #FFF;
    background: linear-gradient(185deg, #FF6D00, #E65100);
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 6px 0 #BF360C, 0 10px 20px rgba(0,0,0,0.5);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #BF360C, 0 12px 22px rgba(0,0,0,0.6);
}

.start-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #BF360C, 0 4px 10px rgba(0,0,0,0.5);
}

/* Touch & Mobile Controls */
.touch-controls {
    display: none;
    margin-top: 15px;
    width: 100%;
    max-width: 960px;
    justify-content: space-between;
    padding: 0 10px;
}

.touch-btn-group {
    display: flex;
    gap: 12px;
}

.touch-btn {
    width: 65px;
    height: 65px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-color);
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    touch-action: manipulation;
}

.touch-btn:active {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

/* Show touch controls on small screens */
@media (max-width: 768px) {
    .touch-controls {
        display: flex;
    }
    .game-title {
        font-size: 1.3rem;
    }
    .hud-bar {
        font-size: 0.6rem;
        padding: 0 6px;
    }
    .overlay-title {
        font-size: 1.4rem;
    }
    .overlay-sub {
        font-size: 0.7rem;
    }
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-8px); }
}
