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

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0b0c10;
    font-family: 'Press Start 2P', monospace, sans-serif;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ARCADE CONTAINER */
.arcade-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1000px;
    max-height: 750px;
    display: flex;
    flex-direction: column;
    background: #12131a;
    border: 6px solid #282c37;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0, 229, 255, 0.15), 0 0 80px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

/* TOP ARCADE MARQUEE / HEADER */
.marquee-bar {
    min-height: 48px;
    height: auto;
    flex-shrink: 0;
    background: linear-gradient(180deg, #222633 0%, #171924 100%);
    border-bottom: 4px solid #000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    padding-top: max(6px, env(safe-area-inset-top));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    z-index: 100;
    box-sizing: border-box;
}

.logo-text {
    font-size: 16px;
    color: #ffec27;
    text-shadow: 2px 2px #000, -1px -1px 0 #ff004d;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.logo-text span {
    color: #00e756;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-icon {
    background: #282c37;
    border: 2px solid #5f677a;
    color: #fff;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-icon:hover, .btn-icon:active {
    background: #00e756;
    color: #000;
    border-color: #fff;
    transform: translateY(-1px);
}

/* MAIN GAME CANVAS SCREEN AREA */
.screen-area {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    background-color: #64b0ff;
    overflow: hidden;
    cursor: crosshair;
}

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

/* CRT SCANLINE OVERLAY */
.crt-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    ), linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.03),
        rgba(0, 255, 0, 0.01),
        rgba(0, 0, 255, 0.03)
    );
    background-size: 100% 3px, 6px 100%;
    z-index: 5;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.crt-overlay.disabled {
    opacity: 0;
}

/* LIGHT GUN SHOT FLASH EFFECT */
.shot-flash {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #ffffff;
    pointer-events: none;
    opacity: 0;
    z-index: 20;
    transition: opacity 0.04s ease-out;
}

.shot-flash.active {
    opacity: 1;
}

/* OVERLAY UI SCREENS (START, PAUSE, GAME OVER) */
.overlay-screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 14, 26, 0.88);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 30;
    padding: 20px;
    gap: 20px;
}

.hidden {
    display: none !important;
}

.game-title {
    font-size: 32px;
    color: #ffec27;
    text-shadow: 3px 3px 0 #000, -2px -2px 0 #ff004d;
    line-height: 1.3;
    animation: titlePulse 2s infinite alternate ease-in-out;
}

@keyframes titlePulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.03); }
}

.subtitle {
    font-size: 12px;
    color: #00e756;
    text-shadow: 1px 1px #000;
}

.mode-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 360px;
    margin: 10px 0;
}

.btn-mode {
    background: #171924;
    border: 3px solid #ff004d;
    color: #fff;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 0 #000;
}

.btn-mode:hover, .btn-mode:focus {
    background: #ff004d;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #000;
}

.btn-mode.selected {
    border-color: #ffec27;
    background: #282c37;
    color: #ffec27;
}

.btn-start {
    background: #00e756;
    border: 4px solid #fff;
    color: #000;
    padding: 16px 36px;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 6px 0 #000;
    transition: all 0.1s ease;
    margin-top: 10px;
}

.btn-start:hover {
    background: #ffec27;
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #000;
}

.btn-start:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #000;
}

.controls-hint {
    font-size: 10px;
    color: #ab5236;
    margin-top: 10px;
    line-height: 1.6;
}

.high-score-display {
    font-size: 11px;
    color: #ffec27;
}

/* GAME OVER MODAL METRICS */
.game-over-stats {
    background: #171924;
    border: 3px solid #ffec27;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 12px;
    min-width: 260px;
    box-shadow: 0 6px 0 #000;
}

.stat-row {
    display: flex;
    justify-content: space-between;
}

.stat-value {
    color: #00e756;
}

/* MOBILE RESPONSIVE FIT */
@media (max-width: 768px) {
    html, body {
        height: 100%;
        min-height: -webkit-fill-available;
    }

    .arcade-wrapper {
        border: none;
        border-radius: 0;
        max-width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
        height: 100vh;
        height: 100dvh;
    }

    .marquee-bar {
        min-height: 40px;
        padding: 4px 8px;
        padding-top: max(4px, env(safe-area-inset-top));
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }

    .logo-text {
        font-size: 11.5px;
        gap: 5px;
    }

    .top-actions {
        gap: 4px;
    }

    .btn-icon {
        padding: 4px 6px;
        font-size: 8px;
    }

    .game-title {
        font-size: 22px;
    }

    .btn-mode {
        padding: 10px 14px;
        font-size: 10px;
    }

    .btn-start {
        padding: 12px 24px;
        font-size: 14px;
    }

    .hud-bar {
        min-height: 40px;
        padding: 4px 8px;
        padding-bottom: max(4px, env(safe-area-inset-bottom));
        padding-left: max(6px, env(safe-area-inset-left));
        padding-right: max(6px, env(safe-area-inset-right));
        font-size: 8px;
    }

    .hud-section {
        gap: 3px;
        flex-shrink: 1;
    }

    .hud-label {
        margin-right: 1px;
    }

    .shells-box {
        gap: 2.5px;
    }

    .shell-icon {
        width: 7px;
        height: 12px;
        border-width: 1.5px;
    }

    .tracker-box {
        gap: 2px;
        padding: 2px 4px;
        border-width: 1.5px;
    }

    .duck-icon {
        width: 7.5px;
        height: 7.5px;
    }
}

@media (max-width: 480px) {
    .marquee-bar {
        min-height: 36px;
        padding: 3px 6px;
        padding-top: max(3px, env(safe-area-inset-top));
        padding-left: max(5px, env(safe-area-inset-left));
        padding-right: max(5px, env(safe-area-inset-right));
    }

    .logo-text {
        font-size: 10px;
        gap: 3px;
    }

    .top-actions {
        gap: 3px;
    }

    .btn-icon {
        padding: 3px 5px;
        font-size: 7.5px;
    }

    .hud-bar {
        min-height: 36px;
        padding: 3px 5px;
        padding-bottom: max(3px, env(safe-area-inset-bottom));
        padding-left: max(4px, env(safe-area-inset-left));
        padding-right: max(4px, env(safe-area-inset-right));
        font-size: 7.5px;
    }

    .hud-section {
        gap: 2px;
    }

    .hud-label {
        margin-right: 1px;
    }

    .shells-box {
        gap: 2px;
    }

    .shell-icon {
        width: 6px;
        height: 10px;
        border-width: 1px;
    }

    .tracker-box {
        gap: 1.5px;
        padding: 2px 3px;
        border-width: 1px;
    }

    .duck-icon {
        width: 6.5px;
        height: 6.5px;
    }
}

@media (max-width: 360px) {
    .logo-text {
        font-size: 9px;
    }

    .btn-icon {
        padding: 2px 3px;
        font-size: 6.5px;
    }

    .hud-bar {
        font-size: 6.5px;
        padding: 2px 3px;
        padding-bottom: max(2px, env(safe-area-inset-bottom));
    }

    .hud-section {
        gap: 1px;
    }

    .tracker-box {
        gap: 1px;
        padding: 1px 2px;
        border-width: 1px;
    }

    .duck-icon {
        width: 5.5px;
        height: 5.5px;
    }

    .shell-icon {
        width: 5px;
        height: 9px;
        border-width: 1px;
    }
}

/* NES BOTTOM HUD PANEL */
.hud-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: 52px;
    height: auto;
    background: #000000;
    border-top: 4px solid #00e756;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 16px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    font-size: 10px;
    z-index: 10;
    box-sizing: border-box;
    overflow: hidden;
}

.hud-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.hud-label {
    color: #00e756;
    margin-right: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.hud-value {
    color: #ffffff;
    white-space: nowrap;
    flex-shrink: 0;
}

/* SHELL ICONS */
.shells-box {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.shell-icon {
    width: 10px;
    height: 16px;
    background: #ff004d;
    border: 2px solid #ffec27;
    border-radius: 2px 2px 0 0;
    box-shadow: inset -2px 0 0 rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.shell-icon.empty {
    background: #282c37;
    border-color: #5f677a;
}

/* DUCK TRACKER ICONS */
.tracker-box {
    display: flex;
    gap: 5px;
    align-items: center;
    background: #171924;
    padding: 4px 10px;
    border: 2px solid #282c37;
    border-radius: 4px;
    flex-shrink: 0;
}

.duck-icon {
    width: 12px;
    height: 12px;
    background: #fff;
    clip-path: polygon(20% 0%, 80% 0%, 100% 40%, 80% 100%, 20% 100%, 0% 40%);
    flex-shrink: 0;
}

.duck-icon.pending {
    background: #5f677a;
}

.duck-icon.hit {
    background: #ff004d;
}

.duck-icon.miss {
    background: #ffffff;
}

.duck-icon.active {
    background: #ffec27;
    animation: duckBlink 0.4s infinite alternate;
}

@keyframes duckBlink {
    0% { opacity: 0.2; }
    100% { opacity: 1.0; }
}


