/* ==========================================================================
   ATARI FLYING CIRCUS - RETRO ARCADE STYLES
   ========================================================================== */

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

:root {
    --bg-dark: #0a0814;
    --arcade-bg: #120e29;
    --neon-pink: #ff2a85;
    --neon-blue: #00f0ff;
    --neon-yellow: #ffb703;
    --neon-green: #39ff14;
    --neon-purple: #9d4edd;
    --atari-orange: #ff5500;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.15);
    --font-pixel: 'Press Start 2P', monospace;
    --font-arcade: 'Orbitron', sans-serif;
    --font-main: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: #ffffff;
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 50% 20%, rgba(157, 78, 221, 0.15) 0%, transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(0, 240, 255, 0.1) 0%, transparent 50%),
        linear-gradient(180deg, #090712 0%, #150f33 100%);
    background-attachment: fixed;
}

/* Header & Cover Banner */
.game-header {
    width: 100%;
    max-width: 1000px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(18, 14, 41, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    margin: 15px 0 10px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.atari-badge {
    background: linear-gradient(135deg, var(--atari-orange), #e63946);
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    padding: 6px 10px;
    border-radius: 4px;
    letter-spacing: 1.5px;
    box-shadow: 0 0 15px rgba(255, 85, 0, 0.5);
    animation: badgeGlow 2s infinite alternate;
}

@keyframes badgeGlow {
    0% { box-shadow: 0 0 10px rgba(255, 85, 0, 0.4); }
    100% { box-shadow: 0 0 20px rgba(255, 85, 0, 0.9); }
}

.game-title {
    font-family: var(--font-arcade);
    font-weight: 900;
    font-size: 1.8rem;
    background: linear-gradient(180deg, #ffffff 0%, var(--neon-yellow) 50%, var(--atari-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(255, 183, 3, 0.3);
}

/* Header Mode Tabs Bar */
.mode-tabs-bar {
    display: flex;
    gap: 8px;
    margin-right: 15px;
}

.mode-tab-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #b0b0d0;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-arcade);
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.mode-tab-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-2px);
}

.mode-tab-btn.active {
    background: linear-gradient(135deg, var(--neon-pink), var(--atari-orange));
    color: #fff;
    border-color: var(--neon-pink);
    box-shadow: 0 0 12px rgba(255, 42, 133, 0.5);
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}


.icon-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-arcade);
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
    transform: translateY(-2px);
}

.icon-btn.active {
    background: var(--neon-blue);
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 15px var(--neon-blue);
}

/* Cabinet Container */
.cabinet-wrapper {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px;
}

.arcade-bezel {
    position: relative;
    background: #0d0a1d;
    border: 4px solid #2a2250;
    border-radius: 20px;
    box-shadow: 
        0 0 0 2px #120e29,
        0 20px 50px rgba(0, 0, 0, 0.8),
        inset 0 0 30px rgba(0, 0, 0, 0.9),
        0 0 40px rgba(157, 78, 221, 0.2);
    overflow: hidden;
}

/* CRT Screen & Canvas */
.crt-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    border-radius: 12px;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #05040a;
}

/* CRT Scanlines & Screen Curve Overlay */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.35) 50%
    );
    background-size: 100% 4px;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.7);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

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

.crt-overlay::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: rgba(18, 16, 16, 0.05);
    opacity: 0;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.03; }
    50% { opacity: 0.07; }
    100% { opacity: 0.03; }
}

/* UI Overlays (Menu / Pause / Game Over) */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 8, 20, 0.88);
    backdrop-filter: blur(8px);
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
}

.overlay-screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

.mode-selection-title {
    font-family: var(--font-arcade);
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--neon-yellow);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-shadow: 0 0 15px rgba(255, 183, 3, 0.6);
}

.mode-subtitle {
    font-size: 1.05rem;
    color: #a0a0c0;
    margin-bottom: 25px;
}

/* Mode Cards Grid */
.modes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 900px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: var(--neon-blue);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mode-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--neon-blue);
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 240, 255, 0.25);
}

.mode-card:hover::before {
    opacity: 1;
}

.mode-card.card-pink:hover {
    border-color: var(--neon-pink);
    box-shadow: 0 15px 30px rgba(255, 42, 133, 0.3);
}
.mode-card.card-pink::before { background: var(--neon-pink); }

.mode-card.card-yellow:hover {
    border-color: var(--neon-yellow);
    box-shadow: 0 15px 30px rgba(255, 183, 3, 0.3);
}
.mode-card.card-yellow::before { background: var(--neon-yellow); }

.mode-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

.mode-name {
    font-family: var(--font-arcade);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}

.mode-desc {
    font-size: 0.85rem;
    color: #b0b0d0;
    line-height: 1.35;
    margin-bottom: 12px;
}

.mode-high-score {
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    color: var(--neon-green);
    background: rgba(57, 255, 20, 0.1);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(57, 255, 20, 0.3);
    margin-top: auto;
}

/* Controls Guide Box */
.controls-guide-bar {
    width: 100%;
    max-width: 1000px;
    margin-top: 15px;
    background: rgba(18, 14, 41, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #d0d0e0;
}

.key-badge {
    background: #1a1538;
    border: 1px solid #3d3570;
    box-shadow: 0 3px 0 #0d0a1f;
    color: var(--neon-yellow);
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    padding: 5px 10px;
    border-radius: 6px;
    display: inline-block;
}

/* Mobile Virtual Joystick Touch Controls */
.mobile-touch-panel {
    display: none;
    width: 100%;
    max-width: 1000px;
    margin-top: 12px;
    gap: 15px;
}

@media (max-width: 768px) {
    .modes-grid {
        grid-template-columns: 1fr;
    }
    .game-header {
        flex-direction: column;
        gap: 12px;
    }
    .controls-guide-bar {
        flex-wrap: wrap;
    }
    .mobile-touch-panel {
        display: flex;
    }
}

.touch-slider-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    touch-action: none;
}

.touch-slider-track {
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.touch-slider-thumb {
    width: 50px;
    height: 30px;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    border-radius: 15px;
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 15px var(--neon-blue);
}

.touch-action-btn {
    width: 80px;
    height: 56px;
    background: linear-gradient(135deg, var(--neon-pink), var(--atari-orange));
    border: none;
    border-radius: 12px;
    color: #fff;
    font-family: var(--font-pixel);
    font-size: 0.8rem;
    box-shadow: 0 0 15px rgba(255, 42, 133, 0.5);
    cursor: pointer;
}

.touch-action-btn:active {
    transform: scale(0.95);
}

/* Modals & Dialogs */
.game-over-title {
    font-family: var(--font-pixel);
    font-size: 2rem;
    color: var(--neon-pink);
    text-shadow: 0 0 20px var(--neon-pink);
    margin-bottom: 15px;
}

.score-summary-box {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px 40px;
    margin: 20px 0;
}

.final-score-val {
    font-family: var(--font-pixel);
    font-size: 2.2rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 15px var(--neon-yellow);
    margin-top: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    border: none;
    color: #fff;
    font-family: var(--font-arcade);
    font-weight: 700;
    font-size: 1.1rem;
    padding: 14px 32px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
    transition: all 0.25s ease;
    margin: 6px;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.8);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: var(--font-arcade);
    font-size: 0.95rem;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.25s ease;
    margin: 6px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--neon-yellow);
}

/* Footer info */
.game-footer {
    margin-top: 15px;
    font-size: 0.8rem;
    color: #707090;
    text-align: center;
    padding-bottom: 20px;
}
