/* ===== CSS Variables & Reset ===== */
:root {
    --primary: #00e676;
    --primary-dark: #00c853;
    --accent: #ffea00;
    --accent-glow: #ffd600;
    --danger: #ff1744;
    --bg-dark: #0a0e17;
    --bg-card: rgba(15, 25, 50, 0.85);
    --glass: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.12);
    --text: #e8eaed;
    --text-dim: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(0, 230, 118, 0.3);
    --font-main: 'Outfit', sans-serif;
    --font-display: 'Orbitron', sans-serif;
    --radius: 16px;
    --radius-sm: 8px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.hidden {
    display: none !important;
}

/* ===== Splash Screen ===== */
.splash-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0e17 0%, #0d1f2d 30%, #0a1a0a 60%, #0a0e17 100%);
    z-index: 100;
    overflow: hidden;
}

.splash-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(0, 230, 118, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(255, 234, 0, 0.05) 0%, transparent 50%);
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-5%, 5%) scale(1.1); }
}

.splash-content {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.splash-ball {
    font-size: 80px;
    animation: ballBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px rgba(0, 230, 118, 0.4));
}

@keyframes ballBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

.splash-title {
    font-family: var(--font-display);
    font-size: clamp(48px, 10vw, 80px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 4px 20px rgba(0, 230, 118, 0.3));
}

.splash-title span {
    font-size: 0.6em;
    letter-spacing: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, #ff9100 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.splash-subtitle {
    font-size: 18px;
    color: var(--text-dim);
    font-weight: 400;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.btn-start {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 48px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #000;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 230, 118, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.btn-start::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-start:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 40px rgba(0, 230, 118, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-start:hover::before {
    left: 100%;
}

.btn-start:active {
    transform: translateY(0) scale(0.98);
}

.btn-icon {
    font-size: 18px;
}

.splash-controls {
    display: flex;
    gap: 24px;
    margin-top: 20px;
    padding: 16px 32px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.control-key {
    font-size: 28px;
}

.control-text {
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.splash-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

/* ===== Game Screen ===== */
.game-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-dark);
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* ===== HUD ===== */
.hud {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 10;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-40px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hud-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(20px);
    min-width: 90px;
}

.hud-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-dim);
    text-transform: uppercase;
}

.hud-value {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.hud-score .hud-value { color: var(--primary); }
.hud-streak .hud-value { color: var(--accent); }
.hud-wind .hud-value { color: #80deea; }

/* ===== Power Bar ===== */
.power-bar-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    backdrop-filter: blur(20px);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.power-bar-container.visible {
    opacity: 1;
}

.power-bar-label {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 2px;
}

.power-bar {
    width: 200px;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.power-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--danger));
    transition: width 0.05s linear;
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.5);
}

.power-bar-indicator {
    position: absolute;
    top: -4px;
    left: 0%;
    width: 4px;
    height: 18px;
    background: #fff;
    border-radius: 2px;
    transition: left 0.05s linear;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.power-bar-value {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    min-width: 40px;
    text-align: right;
}

/* ===== Message Overlay ===== */
.message-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
}

.message-text {
    font-family: var(--font-display);
    font-size: clamp(48px, 12vw, 100px);
    font-weight: 900;
    text-transform: uppercase;
    animation: messagePopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.message-text.goal {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(0, 230, 118, 0.5));
}

.message-text.miss {
    background: linear-gradient(135deg, var(--danger), #ff6f00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(255, 23, 68, 0.5));
}

.message-text.save {
    background: linear-gradient(135deg, #42a5f5, #1565c0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(66, 165, 245, 0.5));
}

@keyframes messagePopIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== Aim Hint ===== */
.aim-hint {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    backdrop-filter: blur(20px);
    font-size: 16px;
    z-index: 10;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

/* ===== Game Over ===== */
.gameover-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 23, 0.95);
    backdrop-filter: blur(20px);
    z-index: 100;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gameover-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.gameover-trophy {
    font-size: 80px;
    animation: trophyBounce 1s ease-in-out infinite;
}

@keyframes trophyBounce {
    0%, 100% { transform: scale(1) rotate(-5deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

.gameover-title {
    font-family: var(--font-display);
    font-size: clamp(32px, 6vw, 48px);
    font-weight: 900;
    background: linear-gradient(135deg, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gameover-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.stat-item {
    padding: 16px 24px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    min-width: 100px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 900;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 4px;
}

.btn-restart {
    background: linear-gradient(135deg, var(--accent), #ff9100);
    color: #000;
}

.btn-restart:hover {
    box-shadow: 0 8px 40px rgba(255, 234, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ===== Sound Toggle ===== */
.sound-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    font-size: 20px;
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sound-toggle:hover {
    background: var(--glass);
    transform: scale(1.1);
}

/* ===== Home Link Button ===== */
.home-link {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 50;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.home-link:hover {
    background: var(--glass);
    color: var(--primary);
    transform: translateX(-3px) scale(1.03);
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.3);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .home-link {
        padding: 8px 14px;
        font-size: 12px;
        top: 10px;
        left: 10px;
    }

    .hud {
        gap: 6px;
    }
    
    .hud-panel {
        padding: 8px 12px;
        min-width: 70px;
    }
    
    .hud-value {
        font-size: 18px;
    }
    
    .splash-controls {
        gap: 16px;
        padding: 12px 20px;
    }
    
    .power-bar {
        width: 140px;
    }
    
    .gameover-stats {
        gap: 10px;
    }
    
    .stat-item {
        padding: 12px 16px;
        min-width: 80px;
    }
    
    .stat-value {
        font-size: 24px;
    }
}

/* ===== Confetti ===== */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 30;
    pointer-events: none;
    animation: confettiFall 3s ease-in forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg) scale(0.3);
    }
}

/* ===== Screen Shake ===== */
.screen-shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-5px, -3px); }
    20% { transform: translate(5px, 3px); }
    30% { transform: translate(-4px, 2px); }
    40% { transform: translate(4px, -2px); }
    50% { transform: translate(-3px, 3px); }
    60% { transform: translate(3px, -1px); }
    70% { transform: translate(-2px, 1px); }
    80% { transform: translate(2px, -1px); }
    90% { transform: translate(-1px, 1px); }
}
