/* Custom Neon Design System - Synthwave / Retro-Cyber Theme */
:root {
    --bg-dark: #0b0716;
    --bg-card: rgba(18, 12, 33, 0.75);
    --neon-cyan: #00ffcc;
    --neon-blue: #00b3ff;
    --neon-magenta: #ff007f;
    --neon-red: #ff3b30;
    --neon-amber: #ffcc00;
    --neon-green: #39ff14;
    --text-primary: #f0ecfa;
    --text-secondary: #a39cb5;
    --font-display: 'Orbitron', 'Inter', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
    --glow-cyan: 0 0 10px rgba(0, 255, 204, 0.5), 0 0 20px rgba(0, 255, 204, 0.2);
    --glow-magenta: 0 0 10px rgba(255, 0, 127, 0.5), 0 0 20px rgba(255, 0, 127, 0.2);
    --glow-blue: 0 0 10px rgba(0, 179, 255, 0.5), 0 0 20px rgba(0, 179, 255, 0.2);
    --glow-amber: 0 0 10px rgba(255, 204, 0, 0.5), 0 0 20px rgba(255, 204, 0, 0.2);
    --glow-red: 0 0 10px rgba(255, 59, 48, 0.5), 0 0 20px rgba(255, 59, 48, 0.2);
    --glow-green: 0 0 10px rgba(57, 255, 20, 0.5), 0 0 20px rgba(57, 255, 20, 0.2);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at center, #1b0f33 0%, #06030c 100%);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* CRT Screen Effect overlay */
.crt-overlay {
    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.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 4px, 6px 100%;
    z-index: 20;
    pointer-events: none;
}

/* Glassmorphism Overlays Container */
.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

.overlay-container > div {
    pointer-events: auto;
}

/* HUD System Overlay */
.hud-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 5;
    pointer-events: none;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.hud-block {
    display: flex;
    flex-direction: column;
    background: rgba(18, 12, 33, 0.5);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.hud-label {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.hud-value {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Progress bar under Multiplier */
#multiplier-bar-container {
    width: 100px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}

#multiplier-bar {
    width: 100%;
    height: 100%;
    background: var(--neon-magenta);
    box-shadow: 0 0 5px var(--neon-magenta);
    transition: width 0.1s linear;
}

.hud-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    align-items: flex-end;
}

.hud-stat-container {
    background: rgba(18, 12, 33, 0.6);
    padding: 12px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.hud-stat-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
}

.stat-bar-outer {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    padding: 2px;
    border: 1px solid transparent;
}

.border-green { border-color: rgba(57, 255, 20, 0.3); }
.border-cyan { border-color: rgba(0, 255, 204, 0.3); }

.stat-bar-inner {
    height: 100%;
    border-radius: 1px;
    transition: width 0.15s ease-out;
}

.bg-green {
    background: var(--neon-green);
    box-shadow: 0 0 8px var(--neon-green);
}

.bg-cyan {
    background: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan);
}

.hud-weapon-card {
    background: rgba(18, 12, 33, 0.6);
    padding: 12px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.weapon-info {
    display: flex;
    flex-direction: column;
}

.weapon-bar-outer {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

/* Glassmorphic Menu Panels */
.menu-card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 204, 0.15);
    border-radius: 16px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 255, 204, 0.05);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    z-index: 15;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.menu-card.hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    display: none !important;
}

.logo-area {
    text-align: center;
}

.game-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    margin-bottom: 5px;
    text-shadow: var(--glow-red);
}

.logo-area-compact {
    text-align: center;
    width: 100%;
}

.logo-area-compact h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}

.logo-area-compact p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.subtitle {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5em;
    margin-left: 0.5em;
    text-shadow: var(--glow-cyan);
}

.menu-description {
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: center;
    color: var(--text-secondary);
    max-width: 600px;
}

/* Start screen instructions panels */
.preview-panel {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
    width: 100%;
    margin-top: 10px;
}

.preview-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.preview-section h3 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.weapon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.weapon-preview-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s ease;
}

.weapon-preview-card.active {
    border-color: var(--neon-cyan);
    background: rgba(0, 255, 204, 0.05);
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.1);
}

.wpn-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
}
.wpn-icon.pulse { color: var(--neon-cyan); }
.wpn-icon.spread { color: var(--neon-magenta); }
.wpn-icon.rail { color: var(--neon-blue); }
.wpn-icon.missile { color: var(--neon-amber); }

.weapon-preview-card h4 {
    font-family: var(--font-display);
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.weapon-preview-card p {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.controls-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.controls-list li {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.controls-list span:last-child {
    margin-left: 10px;
}

.kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--neon-cyan);
    margin-right: 4px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
    min-width: 20px;
    text-align: center;
    display: inline-block;
}

.settings-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

/* Premium Buttons Styling */
.btn-primary {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 16px 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn-toggle {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-toggle.active {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    background: rgba(0, 255, 204, 0.05);
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.1);
}

.btn-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Custom neon button glowing shadows */
.glow-button-cyan {
    background: var(--neon-cyan);
    color: #030a08;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.4);
}
.glow-button-cyan:hover {
    box-shadow: 0 0 25px rgba(0, 255, 204, 0.7);
    transform: translateY(-2px);
}
.glow-button-cyan:active {
    transform: translateY(1px);
}

.glow-button-red {
    background: var(--neon-red);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.4);
}
.glow-button-red:hover {
    box-shadow: 0 0 25px rgba(255, 59, 48, 0.7);
    transform: translateY(-2px);
}

.glow-button-green {
    background: var(--neon-green);
    color: #020a01;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
}
.glow-button-green:hover {
    box-shadow: 0 0 25px rgba(57, 255, 20, 0.7);
    transform: translateY(-2px);
}

.glow-button-amber {
    background: var(--neon-amber);
    color: #0b0700;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.3);
}
.glow-button-amber:hover {
    box-shadow: 0 0 18px rgba(255, 204, 0, 0.6);
    transform: translateY(-1px);
}

/* Upgrades Shop Screen Styles */
.core-tally-bar {
    background: rgba(255, 204, 0, 0.05);
    border: 1px dashed rgba(255, 204, 0, 0.2);
    border-radius: 8px;
    width: 100%;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.shop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom Scrollbar for Shop */
.shop-grid::-webkit-scrollbar {
    width: 6px;
}
.shop-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}
.shop-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.shop-grid::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan);
}

.shop-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 15px;
    transition: all 0.2s ease;
}

.shop-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.shop-header {
    display: flex;
    gap: 15px;
    align-items: center;
}

.shop-icon {
    font-size: 2rem;
    min-width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-title-desc h4 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.shop-title-desc p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.shop-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-indicator {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
}

.btn-upgrade {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 900;
    padding: 8px 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-upgrade:disabled {
    background: rgba(255, 255, 255, 0.05) !important;
    color: rgba(255, 255, 255, 0.2) !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

.shop-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

/* GameOver Screen stats grid */
.gameover-stats {
    background: rgba(255, 59, 48, 0.03);
    border: 1px solid rgba(255, 59, 48, 0.1);
    border-radius: 12px;
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 500px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

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

/* Pause menu details */
.pause-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 300px;
}

.pause-controls .btn-toggle {
    padding: 14px;
    font-size: 0.9rem;
}

/* Flashing Alert Banner (Boss alert) */
.alert-banner {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 600px;
    background: rgba(255, 59, 48, 0.1);
    border-top: 2px solid var(--neon-red);
    border-bottom: 2px solid var(--neon-red);
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 30px rgba(255, 59, 48, 0.2);
    animation: alert-pulse 1s infinite alternate;
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.alert-icon {
    font-size: 2.5rem;
    animation: bounce 0.5s infinite alternate;
}

.alert-texts h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--neon-red);
    letter-spacing: 0.1em;
}

.alert-texts p {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #ff8882;
    letter-spacing: 0.2em;
    margin-top: 4px;
}

/* Animations */
@keyframes alert-pulse {
    0% { background: rgba(255, 59, 48, 0.08); box-shadow: 0 0 20px rgba(255, 59, 48, 0.1); }
    100% { background: rgba(255, 59, 48, 0.25); box-shadow: 0 0 45px rgba(255, 59, 48, 0.4); }
}

@keyframes bounce {
    0% { transform: translateY(-2px); }
    100% { transform: translateY(4px); }
}

/* Custom glow text utility styles */
.glow-text-red {
    color: #ffffff;
    text-shadow: 0 0 10px var(--neon-red), 0 0 20px var(--neon-red), 0 0 40px rgba(255, 59, 48, 0.5);
    animation: red-glow-pulse 2s infinite alternate;
}

@keyframes red-glow-pulse {
    0% { text-shadow: 0 0 10px var(--neon-red), 0 0 20px var(--neon-red), 0 0 40px rgba(255, 59, 48, 0.5); }
    100% { text-shadow: 0 0 15px var(--neon-red), 0 0 30px var(--neon-red), 0 0 60px rgba(255, 59, 48, 0.8); }
}

/* Neon classes for color matching */
.neon-cyan { color: var(--neon-cyan); text-shadow: 0 0 5px rgba(0, 255, 204, 0.4); }
.neon-blue { color: var(--neon-blue); text-shadow: 0 0 5px rgba(0, 179, 255, 0.4); }
.neon-magenta { color: var(--neon-magenta); text-shadow: 0 0 5px rgba(255, 0, 127, 0.4); }
.neon-red { color: var(--neon-red); text-shadow: 0 0 5px rgba(255, 59, 48, 0.4); }
.neon-amber { color: var(--neon-amber); text-shadow: 0 0 5px rgba(255, 204, 0, 0.4); }
.neon-green { color: var(--neon-green); text-shadow: 0 0 5px rgba(57, 255, 20, 0.4); }

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: scale(0.97) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Utility alignments */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: var(--font-mono); }
.text-xl { font-size: 1.5rem; }

/* Sliding Boss HUD health system */
.boss-hud-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 700px;
    background: rgba(18, 12, 33, 0.85);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 12px;
    padding: 12px 24px;
    box-shadow: 0 0 25px rgba(255, 59, 48, 0.2), inset 0 0 10px rgba(255, 59, 48, 0.1);
    backdrop-filter: blur(10px);
    z-index: 9;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.boss-hud-container.hidden {
    top: -120px; /* slide offscreen */
    opacity: 0;
    display: block !important; /* overrides standard hidden to keep animation active */
}

.boss-hud-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.boss-name {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.25em;
    animation: alert-blink 1.2s infinite alternate;
}

@keyframes alert-blink {
    0% { opacity: 0.5; color: #ff8882; }
    100% { opacity: 1; color: var(--neon-red); }
}

.boss-bar-outer {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    border: 1px solid rgba(255, 59, 48, 0.2);
    overflow: hidden;
}

/* Floating Combo Announcement overlay */
.announcement-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 8;
    text-align: center;
}

.announcement-glow {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: #ffffff;
    text-shadow: 0 0 15px var(--neon-magenta), 0 0 35px var(--neon-magenta);
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pop-fade 1.6s ease-out forwards;
}

.announcement-glow.hidden {
    opacity: 0;
    transform: scale(0.6);
    display: none !important;
}

@keyframes pop-fade {
    0% { opacity: 0; transform: scale(0.5); }
    15% { opacity: 1; transform: scale(1.1); }
    30% { opacity: 1; transform: scale(1.0); }
    80% { opacity: 1; transform: scale(1.0) translateY(0); }
    100% { opacity: 0; transform: scale(0.95) translateY(-50px); }
}

