/* Neon Gridlock Synthwave/Cyberpunk Theme stylesheet */

:root {
    --bg-black: #060613;
    --bg-card: rgba(12, 12, 36, 0.75);
    
    /* Neon Palettes */
    --neon-cyan: #00f0ff;
    --neon-cyan-dim: rgba(0, 240, 255, 0.2);
    --neon-magenta: #ff007f;
    --neon-magenta-dim: rgba(255, 0, 127, 0.2);
    --neon-purple: #9d4edd;
    --neon-purple-dim: rgba(157, 78, 221, 0.2);
    --neon-green: #39ff14;
    --neon-green-dim: rgba(57, 255, 20, 0.2);
    --neon-yellow: #ffaa00;
    --neon-yellow-dim: rgba(255, 170, 0, 0.2);
    --neon-red: #ff3333;
    --neon-red-dim: rgba(255, 51, 51, 0.2);
    
    /* Fonts */
    --font-cyber: 'Orbitron', sans-serif;
    --font-clean: 'Inter', sans-serif;
    
    /* Panel border glows */
    --cyan-glow: 0 0 15px rgba(0, 240, 255, 0.4), inset 0 0 10px rgba(0, 240, 255, 0.2);
    --magenta-glow: 0 0 15px rgba(255, 0, 127, 0.4), inset 0 0 10px rgba(255, 0, 127, 0.2);
    --purple-glow: 0 0 15px rgba(157, 78, 221, 0.4), inset 0 0 10px rgba(157, 78, 221, 0.2);
}

/* Reset and Core Layout */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    outline: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-black);
    font-family: var(--font-clean);
    color: #e2e8f0;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #0f0f35 0%, #03030c 100%);
}

/* Retro CRT CRT Scanline and Screen Glow overlays */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    ), linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.04),
        rgba(0, 255, 0, 0.01),
        rgba(0, 0, 255, 0.04)
    );
    background-size: 100% 4px, 6px 100%;
    z-index: 18;
    pointer-events: none;
}

.grid-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 240, 255, 0.05) 0%, rgba(255, 0, 127, 0.02) 70%, transparent 100%);
    z-index: 2;
    pointer-events: none;
}

/* Gameplay Canvas */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
}

/* Heads-Up Display (HUD) */
#hud {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 1000px;
    z-index: 10;
    padding: 12px 24px;
    border-radius: 14px;
    border: 1px solid rgba(0, 240, 255, 0.2);
    background: rgba(8, 8, 28, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--cyan-glow), 0 10px 30px rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    pointer-events: auto; /* Allow clicking the mute button */
}

.hud-group {
    display: flex;
    align-items: center;
    gap: 24px;
}

.center-hud {
    flex: 1;
    justify-content: center;
    max-width: 320px;
}

.hud-item {
    display: flex;
    flex-direction: column;
}

.health-panel {
    width: 100%;
    align-items: center;
}

.hud-label {
    font-family: var(--font-cyber);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(226, 232, 240, 0.5);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.hud-value {
    font-family: var(--font-cyber);
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

.neon-purple {
    color: var(--neon-purple);
    text-shadow: 0 0 8px rgba(157, 78, 221, 0.5);
}

.neon-cyan {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

/* Multiplier combo bar */
.multiplier-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mult-bar-bg {
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mult-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--neon-purple);
    box-shadow: 0 0 6px var(--neon-purple);
    transition: width 0.1s linear;
}

/* Shield Status Indicator */
.shield-indicator-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

.shield-indicator {
    padding: 6px 16px;
    border-radius: 8px;
    font-family: var(--font-cyber);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.shield-indicator.status-off {
    background: rgba(255, 51, 51, 0.08);
    border-color: rgba(255, 51, 51, 0.2);
    color: rgba(255, 51, 51, 0.6);
    text-shadow: none;
}

.shield-indicator.status-on {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
    animation: pulse-border 1.5s infinite alternate;
}

/* Mute button styling */
.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

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

/* Overlays (Start and Game Over screens) */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 4, 15, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.glass-card {
    background: var(--bg-card);
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    padding: 40px;
    text-align: center;
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.overlay.active .glass-card {
    transform: translateY(0);
}

.neon-border-cyan {
    border: 1px solid rgba(0, 240, 255, 0.3);
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.15), inset 0 0 20px rgba(0, 240, 255, 0.05);
}

.neon-border-magenta {
    border: 1px solid rgba(255, 0, 127, 0.3);
    box-shadow: 0 0 35px rgba(255, 0, 127, 0.15), inset 0 0 20px rgba(255, 0, 127, 0.05);
}

.cyber-tag {
    font-family: var(--font-cyber);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--neon-cyan);
    margin-bottom: 15px;
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.3);
}

.cyber-tag.text-red {
    color: var(--neon-red);
    text-shadow: 0 0 5px rgba(255, 51, 51, 0.3);
}

.game-title {
    font-family: var(--font-cyber);
    font-size: 2.8rem;
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: 4px;
    color: #ffffff;
    margin-bottom: 12px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.neon-text-magenta {
    color: var(--neon-magenta);
    text-shadow: 0 0 15px var(--neon-magenta);
}

.neon-text-red {
    color: var(--neon-red);
    text-shadow: 0 0 15px var(--neon-red);
}

.neon-text-cyan {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.neon-text-purple {
    color: var(--neon-purple);
    text-shadow: 0 0 8px rgba(157, 78, 221, 0.6);
}

.neon-text-yellow {
    color: var(--neon-yellow);
    text-shadow: 0 0 8px rgba(255, 170, 0, 0.6);
}

.game-tagline {
    font-size: 0.9rem;
    color: rgba(226, 232, 240, 0.65);
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Instructions Panel */
.instructions-card, .stats-card {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.instruction-title {
    font-family: var(--font-cyber);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    padding-bottom: 6px;
}

.instruction-list {
    list-style: none;
}

.instruction-list li {
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: rgba(226, 232, 240, 0.8);
    line-height: 1.4;
}

.instruction-list li:last-child {
    margin-bottom: 0;
}

.instruction-list li strong {
    color: #ffffff;
}

.powerup-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.78rem;
}

.powerup-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(226, 232, 240, 0.7);
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.green {
    background: var(--neon-green);
    box-shadow: 0 0 6px var(--neon-green);
}

.legend-dot.blue {
    background: var(--neon-cyan);
    box-shadow: 0 0 6px var(--neon-cyan);
}

.legend-dot.yellow {
    background: var(--neon-yellow);
    box-shadow: 0 0 6px var(--neon-yellow);
}

/* Stats Summary */
.stats-card {
    text-align: center;
    padding: 16px 24px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-row:last-child {
    border-bottom: none;
    padding-bottom: 4px;
}

.stat-row span {
    color: rgba(226, 232, 240, 0.65);
}

.stat-row strong {
    font-family: var(--font-cyber);
    font-size: 1.25rem;
    font-weight: 800;
}

/* Cybernetic Glow Buttons */
.glow-btn {
    width: 100%;
    padding: 16px 32px;
    font-family: var(--font-cyber);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.btn-cyan {
    background: linear-gradient(135deg, #0099ff 0%, var(--neon-cyan) 100%);
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.btn-cyan:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 240, 255, 0.5), 0 0 15px rgba(0, 240, 255, 0.3);
}

.btn-magenta {
    background: linear-gradient(135deg, var(--neon-magenta) 0%, #b5179e 100%);
    box-shadow: 0 4px 15px rgba(255, 0, 127, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.btn-magenta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 127, 0.5), 0 0 15px rgba(255, 0, 127, 0.3);
}

.glow-btn:active {
    transform: translateY(1px);
}

.restart-hint {
    margin-top: 20px;
    font-size: 0.8rem;
    color: rgba(226, 232, 240, 0.4);
}

.restart-hint span {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.7);
}

/* Mobile Virtual D-Pad overlay */
#mobile-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    pointer-events: none; /* Let canvas drag register if swipe used, but D-pad button overrides */
    display: none; /* Hidden by default, toggled on by media queries */
    justify-content: center;
    align-items: center;
    width: 220px;
    height: 220px;
}

.dpad {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

.dpad-middle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dpad-center {
    width: 60px;
    height: 60px;
    background: rgba(12, 12, 36, 0.8);
    border: 1px solid rgba(0, 240, 255, 0.1);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    border-radius: 12px;
}

.dpad-btn {
    width: 65px;
    height: 65px;
    background: rgba(8, 8, 28, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid rgba(0, 240, 255, 0.25);
    color: var(--neon-cyan);
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.dpad-btn.up {
    border-radius: 16px 16px 6px 16px;
    margin-bottom: -5px;
}

.dpad-btn.down {
    border-radius: 6px 16px 16px 16px;
    margin-top: -5px;
}

.dpad-btn.left {
    border-radius: 16px 6px 16px 16px;
    margin-right: -5px;
}

.dpad-btn.right {
    border-radius: 6px 16px 16px 16px;
    margin-left: -5px;
}

.dpad-btn:active {
    background: rgba(0, 240, 255, 0.25);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
    transform: scale(0.92);
}

/* Animations */
@keyframes pulse-border {
    0% {
        border-color: rgba(0, 240, 255, 0.4);
        box-shadow: 0 0 4px rgba(0, 240, 255, 0.1);
    }
    100% {
        border-color: var(--neon-cyan);
        box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
    }
}

/* Responsive Viewports */
@media (max-width: 768px) {
    #hud {
        top: 15px;
        padding: 8px 16px;
        border-radius: 10px;
    }
    
    .hud-group {
        gap: 12px;
    }
    
    .hud-value {
        font-size: 1.1rem;
    }
    
    .hud-label {
        font-size: 0.6rem;
        letter-spacing: 1px;
    }
    
    .center-hud {
        max-width: 140px;
    }
    
    .shield-indicator {
        padding: 4px 8px;
        font-size: 0.65rem;
    }
    
    .icon-btn {
        width: 32px;
        height: 32px;
        border-radius: 6px;
    }
    
    .glass-card {
        padding: 24px 20px;
        max-width: 90%;
    }
    
    .game-title {
        font-size: 2.2rem;
    }
    
    .game-tagline {
        font-size: 0.8rem;
        margin-bottom: 15px;
    }
    
    .instructions-card, .stats-card {
        padding: 12px;
        margin-bottom: 20px;
    }
    
    .instruction-list li {
        font-size: 0.78rem;
        margin-bottom: 8px;
    }
    
    /* Toggle Mobile D-Pad on smaller screens */
    #mobile-controls {
        display: flex;
    }
}

/* Landscape orientation adjustments for mobile (prevents overlap) */
@media (max-height: 480px) and (orientation: landscape) {
    #hud {
        top: 8px;
        padding: 6px 14px;
        width: 95%;
    }
    
    .hud-value {
        font-size: 1rem;
    }
    
    .glass-card {
        max-width: 480px;
        padding: 15px 30px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .game-title {
        width: 100%;
        font-size: 1.6rem;
        margin-bottom: 2px;
    }
    
    .game-tagline {
        width: 100%;
        font-size: 0.75rem;
        margin-bottom: 5px;
    }
    
    .instructions-card, .stats-card {
        width: 100%;
        margin-bottom: 8px;
        padding: 10px;
    }
    
    .glow-btn {
        width: auto;
        min-width: 180px;
        padding: 10px 20px;
    }
    
    .restart-hint {
        display: none;
    }
    
    /* Reposition mobile controls for landscape */
    #mobile-controls {
        display: flex;
        bottom: 10px;
        right: 10px;
        left: auto;
        transform: none;
        width: 150px;
        height: 150px;
    }
    
    .dpad-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .dpad-center {
        width: 40px;
        height: 40px;
    }
}
