:root {
    /* Primary Colors - Dark Neon */
    --color-bg-dark: #0a0a16;
    --color-purple: #9d4edd;
    --color-pink: #ff006e;
    --color-orange: #fb5607;
    --color-blue: #3a86ff;
    --color-green: #06d6a0;
    --color-white: #ffffff;
    --color-gray: #8d99ae;
    --color-red: #e63946;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--color-purple), var(--color-pink));
    --gradient-secondary: linear-gradient(135deg, var(--color-blue), var(--color-green));
    --gradient-warning: linear-gradient(135deg, var(--color-orange), var(--color-red));
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(12px);

    /* Typography */
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none; /* Prevent text selection while playing */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body {
    background-color: var(--color-bg-dark);
    color: var(--color-white);
    font-family: var(--font-main);
    overflow: hidden; /* Prevent scrolling */
    width: 100vw;
    height: 100vh;
}

#app-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Background */
#background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-gradient {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle at center, #1a0b2e 0%, var(--color-bg-dark) 70%);
    z-index: 1;
}

.bg-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.overlay {
    background: rgba(10, 10, 22, 0.8);
    backdrop-filter: blur(5px);
    z-index: 50;
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 24px;
    padding: 2rem;
}

.wide-panel {
    width: 90%;
    max-width: 600px;
}

/* Typography & Neon */
h1, h2, h3 {
    margin: 0;
}

.text-center { text-align: center; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1.5rem; }
.text-sm { font-size: 0.875rem; }
.text-gray { color: var(--color-gray); }
.text-red { color: var(--color-red); }
.w-full { width: 100%; }
.h-full { height: 90%; max-height: 800px; }
.scroll-y { overflow-y: auto; overflow-x: hidden; }

.neon-text-purple {
    color: var(--color-white);
    text-shadow: 0 0 10px var(--color-purple), 0 0 20px var(--color-purple), 0 0 40px var(--color-purple);
}
.neon-text-pink {
    color: var(--color-white);
    text-shadow: 0 0 10px var(--color-pink), 0 0 20px var(--color-pink), 0 0 40px var(--color-pink);
}
.neon-text-orange {
    color: var(--color-white);
    text-shadow: 0 0 10px var(--color-orange), 0 0 20px var(--color-orange);
}
.neon-text-blue {
    color: var(--color-white);
    text-shadow: 0 0 10px var(--color-blue), 0 0 20px var(--color-blue);
}
.neon-text-green {
    color: var(--color-white);
    text-shadow: 0 0 10px var(--color-green), 0 0 20px var(--color-green);
}

.main-title {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 2px;
}
.sub-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 5px;
}

/* Buttons */
button {
    font-family: var(--font-main);
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    padding: 1rem 3rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 20px rgba(157, 78, 221, 0.5);
}

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

.btn-secondary {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    border-radius: 12px;
}

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

.glass-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    color: white;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
}

/* Loading Bar */
.loading-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}
.loading-bar {
    height: 100%;
    background: var(--gradient-secondary);
    width: 0%;
    transition: width 0.3s ease;
}

/* Menu Components */
.player-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: transform 0.2s;
}
.player-summary:hover {
    transform: translateY(-2px);
}
.avatar-circle {
    width: 50px; height: 50px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}
.avatar-large {
    width: 100px; height: 100px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem;
    margin: 0 auto;
}
.player-info { text-align: left; flex-grow: 1; }
.player-name { font-size: 1.2rem; font-weight: 700; }
.player-level { font-size: 0.9rem; color: var(--color-green); }
.player-currency { display: flex; gap: 0.5rem; font-weight: 600; align-items: center;}

.main-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
    align-items: center;
}
.grid-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}
.bottom-tools {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

/* Mode Cards */
.mode-cards-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}
.mode-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}
.mode-card:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.15);
}
.mode-icon {
    font-size: 2.5rem;
}
.mode-info h3 { margin-bottom: 0.25rem; color: var(--color-orange); }
.mode-info p { font-size: 0.9rem; color: var(--color-gray); margin: 0; }

/* HUD & Canvas */
#game-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 5;
    touch-action: none; /* Crucial for swipe on mobile */
}

#game-hud {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.hud-score-container {
    padding: 0.5rem 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex; align-items: center; gap: 0.5rem;
}
.hud-lives {
    display: flex; gap: 0.5rem; font-size: 1.5rem;
}
#btn-pause {
    pointer-events: auto; /* Re-enable clicks */
}

.hud-center {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#combo-display {
    text-align: center;
    text-shadow: 0 0 10px var(--color-orange);
    transition: transform 0.1s;
}
#combo-text { display: block; font-size: 2rem; font-weight: 900; color: var(--color-orange); }
#combo-multiplier { display: block; font-size: 4rem; font-weight: 900; color: var(--color-white); }

.hud-bottom {
    display: flex;
    justify-content: center;
}
.hud-timer {
    padding: 0.5rem 2rem;
    font-size: 2rem;
    font-weight: 900;
    color: var(--color-pink);
}

/* Stats / Game Over */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: left;
}
.stat-box {
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 12px;
    display: flex; flex-direction: column; align-items: center;
}
.stat-label { font-size: 0.9rem; color: var(--color-gray); }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.buttons-row {
    display: flex; justify-content: center; gap: 1rem; align-items: center;
}

/* Settings */
.settings-list {
    display: flex; flex-direction: column; gap: 1rem;
}
.setting-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem; background: rgba(0,0,0,0.2); border-radius: 12px;
}
.toggle-btn {
    padding: 0.5rem 1rem; border-radius: 20px; font-weight: bold;
    background: rgba(255,255,255,0.1); color: var(--color-gray);
}
.toggle-btn.active {
    background: var(--color-green); color: black;
}

/* Shop */
.header-row {
    display: flex; justify-content: space-between; align-items: center;
    position: relative;
    padding-left: 60px; /* space for back button */
}
.tabs {
    display: flex; gap: 0.5rem; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.5rem;
}
.tab-btn {
    background: transparent; color: var(--color-gray); padding: 0.5rem 1rem; font-weight: 600;
}
.tab-btn.active {
    color: var(--color-white); border-bottom: 2px solid var(--color-purple);
}
.shop-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1rem;
    padding: 1rem 0; height: calc(100% - 100px);
}
.shop-item {
    background: rgba(0,0,0,0.2); border-radius: 12px; padding: 1rem;
    text-align: center; border: 1px solid var(--glass-border);
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
}
.shop-item .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.shop-item .name { font-size: 0.9rem; font-weight: bold; margin-bottom: 0.5rem; }
.shop-item .price { font-size: 0.9rem; color: var(--color-orange); font-weight: bold; }
.shop-item.owned .price { color: var(--color-green); }
