/* ========== RESET & VARIABLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00d9ff;
    --secondary-color: #ff6b9d;
    --accent-color: #ffeb3b;
    --bg-gradient-1: #667eea;
    --bg-gradient-2: #764ba2;
    --text-color: #ffffff;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glow: 0 0 20px rgba(0, 217, 255, 0.5);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
    cursor: none;
    user-select: none;
}

/* ========== THEMES ========== */
body.theme-ocean {
    --bg-gradient-1: #1e3c72;
    --bg-gradient-2: #2a5298;
    --primary-color: #00d9ff;
}

body.theme-space {
    --bg-gradient-1: #0f0c29;
    --bg-gradient-2: #302b63;
    --primary-color: #c471ed;
}

body.theme-candy {
    --bg-gradient-1: #ff9a9e;
    --bg-gradient-2: #fecfef;
    --primary-color: #ff6b9d;
}

body.day-mode {
    --bg-gradient-1: #74ebd5;
    --bg-gradient-2: #acb6e5;
    --primary-color: #ff6b9d;
}

body.night-mode {
    --bg-gradient-1: #232526;
    --bg-gradient-2: #414345;
    --primary-color: #00d9ff;
}

/* ========== BACKGROUND ANIMATION ========== */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2));
    animation: gradientShift 15s ease infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(30deg); }
}

/* Add animated waves for ocean theme */
body.theme-ocean .background-animation::before,
body.theme-ocean .background-animation::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 40%;
}

body.theme-ocean .background-animation::before {
    animation: wave 10s linear infinite;
}

body.theme-ocean .background-animation::after {
    animation: wave 15s linear infinite reverse;
    opacity: 0.5;
}

@keyframes wave {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ========== CUSTOM CURSOR ========== */
.cursor-trail {
    position: fixed;
    width: 30px;
    height: 30px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.1s ease;
    box-shadow: var(--glow);
}

/* ========== MENU SCREENS ========== */
.menu-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

.menu-screen.active {
    display: flex;
}

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

.menu-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 40px;
    box-shadow: var(--shadow);
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.5s ease;
}

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

.game-title {
    font-size: 3em;
    color: var(--text-color);
    text-shadow: 0 0 20px var(--primary-color);
    margin-bottom: 30px;
    animation: pulse 2s ease-in-out infinite;
}

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

h2 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 2em;
}

.menu-content p {
    text-align: center;
    margin: 10px 0;
}

.menu-content p.text-left {
    text-align: left;
}

#playerName {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--primary-color);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    font-size: 1.1em;
    margin-bottom: 20px;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

#playerName::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#playerName:focus {
    box-shadow: var(--glow);
    transform: scale(1.02);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-primary, .btn-secondary, .icon-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 15px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
}

/* ========== INSTRUCTIONS ========== */
.instructions {
    text-align: left;
    color: var(--text-color);
    line-height: 1.8;
    margin-bottom: 20px;
}

.instructions p {
    margin: 10px 0;
}

/* ========== SETTINGS ========== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
}

.setting-item label {
    color: var(--text-color);
    font-weight: bold;
}

.toggle-btn {
    padding: 8px 20px;
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

select {
    padding: 8px 15px;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    font-weight: bold;
    cursor: pointer;
    outline: none;
}

select option {
    background: #333;
    color: white;
}

/* ========== LEADERBOARD ========== */
.leaderboard-list {
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-color);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    font-size: 1.2em;
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #333;
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #e89d5f);
    color: #fff;
}

/* ========== GAME SCREEN ========== */
.game-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

.game-screen.active {
    display: block;
}

/* ========== HUD ========== */
.hud {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    z-index: 10;
}

.hud-left, .hud-right {
    display: flex;
    gap: 20px;
}

.score-display, .combo-display {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
}

.value {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--text-color);
    text-shadow: 0 0 10px var(--primary-color);
}

/* Timer Circle */
.timer-container {
    position: relative;
    width: 100px;
    height: 100px;
}

.timer-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
    filter: drop-shadow(0 0 10px var(--primary-color));
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    font-weight: bold;
    color: var(--text-color);
}

/* ========== GAME CONTROLS ========== */
.game-controls {
    position: absolute;
    top: 20px;
    right: 30px;
    display: flex;
    gap: 10px;
    z-index: 15;
}

.icon-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5em;
    padding: 0;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ========== GAME CONTAINER ========== */
.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ========== BUBBLES ========== */
.bubble {
    position: absolute;
    border-radius: 50%;
    cursor: pointer;
    animation: float 3s ease-in-out infinite, appear 0.3s ease;
    box-shadow: inset -10px -10px 20px rgba(0, 0, 0, 0.2),
                0 0 20px rgba(255, 255, 255, 0.5);
    transition: transform 0.1s ease;
}

.bubble::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 15%;
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 50%;
}

.bubble:hover {
    transform: scale(1.1);
}

@keyframes appear {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

/* Bubble Types */
.bubble.trap {
    background: linear-gradient(135deg, #ff0000, #990000);
    animation: float 3s ease-in-out infinite, pulse 1s ease-in-out infinite;
}

.bubble.powerup-freeze {
    background: linear-gradient(135deg, #00d9ff, #0099ff);
}

.bubble.powerup-bomb {
    background: linear-gradient(135deg, #ff6b00, #ff3d00);
}

.bubble.powerup-double {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
}

.bubble.powerup-life {
    background: linear-gradient(135deg, #ff69b4, #ff1493);
}

/* Pop Animation */
.bubble.popping {
    animation: pop 0.3s ease forwards;
}

@keyframes pop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}

/* ========== PARTICLES ========== */
.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    animation: particleBurst 0.6s ease forwards;
}

@keyframes particleBurst {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* ========== COUNTDOWN ========== */
.countdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10em;
    font-weight: bold;
    color: var(--text-color);
    text-shadow: 0 0 50px var(--primary-color);
    z-index: 200;
    display: none;
    animation: countdownPulse 1s ease;
}

.countdown.active {
    display: block;
}

@keyframes countdownPulse {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ========== FLOATING TEXT ========== */
.floating-text {
    position: fixed;
    font-size: 2em;
    font-weight: bold;
    pointer-events: none;
    z-index: 150;
    animation: floatUp 1s ease forwards;
    text-shadow: 0 0 10px var(--primary-color);
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-100px) scale(1.5); opacity: 0; }
}

/* ========== CLICK RIPPLE ========== */
.ripple {
    position: fixed;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    pointer-events: none;
    animation: rippleEffect 0.6s ease forwards;
    z-index: 50;
}

@keyframes rippleEffect {
    0% { width: 0; height: 0; opacity: 1; }
    100% { width: 100px; height: 100px; opacity: 0; }
}

/* ========== PAUSE MENU ========== */
.overlay-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.overlay-menu.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

/* ========== STATS DISPLAY ========== */
.stats-display {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-color);
}

/* ========== ACHIEVEMENTS ========== */
.achievements {
    margin: 20px 0;
}

.achievement {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 10px 20px;
    border-radius: 20px;
    margin: 5px;
    display: inline-block;
    animation: slideIn 0.5s ease;
}

/* ========== COMBO EFFECTS ========== */
.combo-display.active {
    animation: comboShake 0.3s ease;
}

@keyframes comboShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 768px) {
    .game-title {
        font-size: 2em;
    }
    
    .hud {
        padding: 0 10px;
        flex-wrap: wrap;
    }
    
    .hud-left, .hud-right {
        gap: 10px;
    }
    
    .score-display, .combo-display, .lives-display {
        padding: 8px 12px;
    }
    
    .value {
        font-size: 1.3em;
    }
    
    .timer-container {
        width: 70px;
        height: 70px;
    }
    
    .timer-text {
        font-size: 1.5em;
    }
    
    .stats-display {
        grid-template-columns: 1fr;
    }
    
    .menu-content {
        padding: 20px;
    }
    
    body {
        cursor: auto;
    }
    
    .cursor-trail {
        display: none;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}
