:root {
    --bg-dark: #030308;
    --neon-blue: #00f0ff;
    --neon-purple: #bd00ff;
    --neon-pink: #ff0055;
    --neon-green: #00ff88;
    --glass-bg: rgba(15, 15, 25, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f0f0f0;
    --text-muted: #8892b0;
    
    --font-heading: 'Syncopate', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-body);
    color: var(--text-main);
}

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

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

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to canvas by default */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Screens */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    pointer-events: auto; /* Catch clicks on active screens */
}

.screen.active {
    display: flex;
}

#screen-hud {
    pointer-events: none; /* HUD should not block game clicks */
    justify-content: flex-start;
    padding: 1.5rem;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    max-width: 500px;
    height: auto;
    padding: 3rem 2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
}

/* Typography */
.neon-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    text-shadow: 0 0 10px var(--neon-blue), 0 0 20px var(--neon-blue);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.sub-title {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 6px;
    color: var(--neon-purple);
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 2rem;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.highlight { color: var(--neon-blue); text-shadow: 0 0 8px rgba(0, 240, 255, 0.5); }
.text-magenta { color: var(--neon-purple); text-shadow: 0 0 8px rgba(189, 0, 255, 0.5); }
.text-red { color: var(--neon-pink); text-shadow: 0 0 8px rgba(255, 0, 85, 0.5); }
.text-sm { font-size: 0.85rem; color: var(--text-muted); }

/* Buttons */
.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    margin-bottom: 2.5rem;
}

.cyber-btn {
    position: relative;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 1.2rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 100%;
}

.cyber-btn:active { transform: scale(0.97); }

.cyber-btn.primary {
    background: linear-gradient(90deg, var(--neon-blue), #0077ff);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.cyber-btn.primary:hover {
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.6);
    filter: brightness(1.2);
}

.cyber-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.cyber-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Stats */
.stats-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.stat {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.stat span {
    font-size: 1.4rem;
    font-family: var(--font-heading);
    display: inline-block;
    margin-top: 0.3rem;
}

/* Garage */
.ship-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    padding: 1rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.icon-btn:hover { color: #fff; }
.ship-info { text-align: center; }

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.bar-bg {
    width: 65%;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-blue));
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* HUD */
.hud-top {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.score-display, .health-display {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.score-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
}

.score-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.health-bar-bg {
    width: 120px;
    height: 10px;
    background: rgba(255,0,85,0.2);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.health-bar-fill {
    height: 100%;
    width: 100%;
    background: var(--neon-pink);
    box-shadow: 0 0 10px var(--neon-pink);
    transition: width 0.2s ease;
}

/* Combo */
.hud-center {
    position: absolute;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.combo-box {
    background: rgba(189, 0, 255, 0.1);
    border: 1px solid rgba(189, 0, 255, 0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-box.hidden {
    opacity: 0;
    transform: scale(0.5);
}

.combo-text {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 15px var(--neon-purple);
}

.combo-timer-bg {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-top: 4px;
}

.combo-timer-fill {
    height: 100%;
    width: 100%;
    background: var(--neon-purple);
    transform-origin: left;
}

/* Boss Warning */
.boss-warning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(20, 0, 5, 0.8);
    padding: 2rem 4rem;
    border: 1px solid var(--neon-pink);
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(255, 0, 85, 0.3);
    animation: flash 1s infinite alternate;
}

.boss-warning.hidden { display: none; }

.glitch-text-red {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--neon-pink);
    text-shadow: 0 0 15px var(--neon-pink);
    letter-spacing: 5px;
    margin-bottom: 0.5rem;
}

@keyframes flash {
    0% { opacity: 0.5; box-shadow: 0 0 20px rgba(255, 0, 85, 0.1); }
    100% { opacity: 1; box-shadow: 0 0 80px rgba(255, 0, 85, 0.6); }
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}

.result-card {
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.result-card .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.result-card .value {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-top: 0.3rem;
}

/* Mobile Controls */
.mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    pointer-events: auto;
}

.joystick-zone {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 3rem;
}

.joystick-hint {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.8rem 2rem;
    border-radius: 30px;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
    letter-spacing: 2px;
    font-size: 0.8rem;
    pointer-events: none;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s;
}

@media (min-width: 768px) {
    .mobile-controls { display: none; }
}

/* Utilities */
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
