/**
 * Bubble Pop Blast - Match-3 Puzzle Game Styles
 * Dark theme with colorful bubble accents (Balatro-inspired)
 */

/* === CSS VARIABLES === */
:root {
    --bp-bg-dark: #0a0a1a;
    --bp-bg-mid: #111827;
    --bp-bg-light: #1e293b;
    --bp-bg-card: #162033;
    --bp-accent-red: #ef4444;
    --bp-accent-blue: #3b82f6;
    --bp-accent-green: #10b981;
    --bp-accent-yellow: #fbbf24;
    --bp-accent-purple: #8b5cf6;
    --bp-accent-cyan: #00d4ff;
    --bp-accent-pink: #ec4899;
    --bp-accent-orange: #f97316;
    --bp-text-primary: #e2e8f0;
    --bp-text-secondary: #94a3b8;
    --bp-text-muted: #64748b;
    --bp-border-color: rgba(255, 255, 255, 0.1);
    --bp-shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);

    /* Bubble colors */
    --bubble-red: #ef4444;
    --bubble-blue: #3b82f6;
    --bubble-green: #10b981;
    --bubble-yellow: #fbbf24;
    --bubble-purple: #8b5cf6;
}

/* === GAME CONTAINER === */
.bubble-pop-blast {
    background: linear-gradient(180deg, var(--bp-bg-dark) 0%, #0f172a 50%, var(--bp-bg-mid) 100%);
    min-height: 100dvh;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--bp-text-primary);
    position: relative;
    overflow: hidden;
}

/* === WELCOME OVERLAY === */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, var(--bp-bg-dark) 0%, var(--bp-bg-mid) 100%);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.welcome-overlay.active {
    display: flex;
    opacity: 1;
}

.welcome-content {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
}

.welcome-icon {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    animation: welcomeBounce 2s ease-in-out infinite;
}

.bubble-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-block;
}

.bubble-icon.bubble-red { background: radial-gradient(circle at 30% 30%, #ff6b6b, var(--bubble-red)); }
.bubble-icon.bubble-blue { background: radial-gradient(circle at 30% 30%, #60a5fa, var(--bubble-blue)); }
.bubble-icon.bubble-green { background: radial-gradient(circle at 30% 30%, #34d399, var(--bubble-green)); }

@keyframes welcomeBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-title {
    font-size: 2.2rem;
    font-weight: 900;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, var(--bp-accent-red) 0%, var(--bp-accent-yellow) 25%, var(--bp-accent-green) 50%, var(--bp-accent-blue) 75%, var(--bp-accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
}

.welcome-subtitle {
    font-size: 1.1rem;
    color: var(--bp-text-secondary);
    margin: 0 0 2rem 0;
}

.welcome-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.welcome-stats .stat-item {
    text-align: center;
}

.welcome-stats .stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--bp-accent-yellow);
}

.welcome-stats .stat-label {
    font-size: 0.75rem;
    color: var(--bp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-prompt {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--bp-text-secondary);
}

.login-prompt a {
    color: var(--bp-accent-cyan);
    text-decoration: none;
    font-weight: 600;
}

.login-prompt a:hover {
    text-decoration: underline;
}

.start-btn {
    background: linear-gradient(135deg, var(--bp-accent-red) 0%, var(--bp-accent-pink) 100%);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
    padding: 1rem 3rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(239, 68, 68, 0.6);
}

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

/* === WELCOME BUTTONS === */
.welcome-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.secondary-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--bp-text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.1rem;
}

/* === TOP BAR === */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    min-height: 50px;
    margin-bottom: 0.35rem;
}

.level-section,
.score-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Level Badge - Prominent */
.level-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, var(--bp-accent-purple) 0%, #6d28d9 100%);
    padding: 0.4rem 0.75rem;
    border-radius: 10px;
    min-width: 50px;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}

.level-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.1em;
}

.level-number {
    font-size: 1.3rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}

/* Target Badge */
.target-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
}

.target-label {
    font-size: 0.5rem;
    font-weight: 600;
    color: var(--bp-accent-green);
    letter-spacing: 0.1em;
}

.target-number {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--bp-accent-green);
    line-height: 1.1;
}

/* Score Badge */
.score-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    min-width: 55px;
}

.score-label {
    font-size: 0.5rem;
    font-weight: 600;
    color: var(--bp-accent-yellow);
    letter-spacing: 0.1em;
}

#score-display {
    font-size: 1rem;
    font-weight: 800;
    color: var(--bp-accent-yellow);
    line-height: 1.1;
}

/* Moves Badge */
.moves-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    min-width: 50px;
}

.moves-label {
    font-size: 0.5rem;
    font-weight: 600;
    color: var(--bp-accent-cyan);
    letter-spacing: 0.1em;
}

#moves-display {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--bp-accent-cyan);
    line-height: 1;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

/* === MOVES DISPLAY (Above Grid) === */
.moves-display-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.moves-display-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(0, 150, 200, 0.1) 100%);
    border: 2px solid rgba(0, 212, 255, 0.4);
    border-radius: 15px;
    padding: 0.5rem 1.5rem;
    min-width: 100px;
}

.moves-number {
    font-family: var(--heading-font, 'Poppins', sans-serif);
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--bp-accent-cyan);
    line-height: 1;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
}

.moves-text {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(0, 212, 255, 0.8);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* Low moves warning */
.moves-display-main.warning {
    border-color: var(--bp-accent-yellow);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(200, 150, 0, 0.1) 100%);
    animation: movesWarning 0.5s ease-in-out infinite;
}

.moves-display-main.warning .moves-number {
    color: var(--bp-accent-yellow);
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
}

.moves-display-main.danger {
    border-color: var(--bp-accent-red);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(180, 50, 50, 0.2) 100%);
    animation: movesDanger 0.3s ease-in-out infinite;
}

.moves-display-main.danger .moves-number {
    color: var(--bp-accent-red);
    text-shadow: 0 0 25px rgba(239, 68, 68, 0.8);
}

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

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

/* Cascade display */
.cascade-display {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 10px;
    padding: 0.4rem 0.8rem;
}

.cascade-display .cascade-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--bp-accent-purple);
}

/* === LEVEL PROGRESS BAR === */
.level-progress-bar {
    position: relative;
    height: 18px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 9px;
    margin-bottom: 0.35rem;
    overflow: hidden;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.level-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--bp-accent-green) 0%, #34d399 100%);
    border-radius: 9px;
    transition: width 0.4s ease;
    width: 0%;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.level-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.level-progress-bar.near-levelup {
    animation: nearLevelUpGlow 1s ease-in-out infinite;
}

.level-progress-bar.near-levelup .level-progress-fill {
    background: linear-gradient(90deg, #10b981 0%, #fbbf24 50%, #10b981 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes nearLevelUpGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
    }
    50% {
        box-shadow: 0 0 15px rgba(251, 191, 36, 0.8), 0 0 25px rgba(16, 185, 129, 0.5);
    }
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* === INFO BAR (Cascade + Coins) === */
.info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.75rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    margin-bottom: 0.35rem;
    min-height: 32px;
}

.coins-section {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(251, 191, 36, 0.15);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--bp-accent-yellow);
}

.coin-icon {
    font-size: 0.9rem;
}

/* === CASCADE & COMBO STYLES === */
.cascade-section {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.cascade-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--bp-text-muted);
    letter-spacing: 0.05em;
}

.cascade-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--bp-accent-purple);
    transition: all 0.3s ease;
}

.cascade-value.active {
    color: var(--bp-accent-yellow);
    transform: scale(1.2);
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
}

.combo-section {
    animation: comboPop 0.5s ease-out;
}

.combo-text {
    font-size: 1rem;
    font-weight: 800;
    color: var(--bp-accent-red);
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

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

/* === POWER-UPS BAR === */
.powerups-bar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.powerup-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 50px;
}

.powerup-btn:hover:not(.disabled):not(.active) {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.powerup-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--bp-accent-cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

.powerup-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.powerup-icon {
    font-size: 1.2rem;
}

.powerup-count {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--bp-accent-cyan);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    min-width: 18px;
}

/* === BUBBLE GRID === */
.bubble-grid-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.bubble-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: clamp(2px, 0.8vw, 6px);
    width: 100%;
    max-width: min(100vw - 1rem, 400px);
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: clamp(4px, 1vw, 8px);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* === BUBBLE CELL === */
.bubble-cell {
    aspect-ratio: 1;
    position: relative;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.bubble-cell:hover:not(.empty):not(.locked) {
    transform: scale(1.08);
}

.bubble-cell.selected {
    transform: scale(1.15);
    z-index: 10;
}

.bubble-cell.selected::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 3px solid #fff;
    border-radius: 50%;
    animation: selectPulse 0.8s ease-in-out infinite;
}

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

.bubble-cell.hint {
    animation: hintBounce 0.5s ease infinite;
}

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

.bubble-cell.locked {
    cursor: default;
    opacity: 0.7;
}

.bubble-cell.empty {
    background: transparent !important;
    box-shadow: none !important;
    cursor: default;
}

/* === BUBBLE COLORS === */
.bubble {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
}

/* Shine effect removed for cleaner look */

.bubble.red {
    background: radial-gradient(circle at 35% 35%, #ff8080, var(--bubble-red) 60%, #b91c1c);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.5), inset 0 -3px 8px rgba(0, 0, 0, 0.3);
}

.bubble.blue {
    background: radial-gradient(circle at 35% 35%, #93c5fd, var(--bubble-blue) 60%, #1d4ed8);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.5), inset 0 -3px 8px rgba(0, 0, 0, 0.3);
}

.bubble.green {
    background: radial-gradient(circle at 35% 35%, #6ee7b7, var(--bubble-green) 60%, #047857);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5), inset 0 -3px 8px rgba(0, 0, 0, 0.3);
}

.bubble.yellow {
    background: radial-gradient(circle at 35% 35%, #fde68a, var(--bubble-yellow) 60%, #b45309);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.5), inset 0 -3px 8px rgba(0, 0, 0, 0.3);
}

.bubble.purple {
    background: radial-gradient(circle at 35% 35%, #c4b5fd, var(--bubble-purple) 60%, #5b21b6);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.5), inset 0 -3px 8px rgba(0, 0, 0, 0.3);
}

/* === SPECIAL BUBBLES === */

/* LINE BLASTER - Horizontal */
.bubble.special-line {
    position: relative;
    animation: lineBubblePulse 1.5s ease-in-out infinite;
}

.bubble.special-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -20%;
    right: -20%;
    height: 4px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    transform: translateY(-50%);
    animation: lineGlow 1s ease-in-out infinite;
}

.bubble.special-line::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.8) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    animation: specialGlow 1.2s ease-in-out infinite;
}

/* LINE BLASTER - Vertical */
.bubble.special-line.vertical::before {
    top: -20%;
    bottom: -20%;
    left: 50%;
    right: auto;
    width: 4px;
    height: auto;
    background: linear-gradient(180deg, transparent, #fff, transparent);
    transform: translateX(-50%);
}

@keyframes lineBubblePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 10px currentColor;
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px currentColor, 0 0 30px currentColor;
    }
}

@keyframes lineGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* BOMB BUBBLE - 3x3 explosion */
.bubble.special-bomb {
    position: relative;
    animation: bombPulse 0.8s ease-in-out infinite;
}

.bubble.special-bomb::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
        transparent 0deg,
        rgba(255,200,0,0.6) 30deg,
        transparent 60deg,
        rgba(255,100,0,0.6) 120deg,
        transparent 150deg,
        rgba(255,200,0,0.6) 210deg,
        transparent 240deg,
        rgba(255,100,0,0.6) 300deg,
        transparent 330deg
    );
    animation: bombRotate 2s linear infinite;
}

.bubble.special-bomb::after {
    content: '💣';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(0.7rem, 2.5vw, 1rem);
    animation: bombIcon 0.5s ease-in-out infinite;
}

@keyframes bombPulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.08);
        filter: brightness(1.2);
    }
}

@keyframes bombRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

/* COLOR BOMB - Clears all of one color */
.bubble.special-color-bomb {
    position: relative;
    background: conic-gradient(
        var(--bubble-red),
        var(--bubble-yellow),
        var(--bubble-green),
        var(--bubble-blue),
        var(--bubble-purple),
        var(--bubble-red)
    ) !important;
    animation: colorBombRotate 2s linear infinite, colorBombPulse 1s ease-in-out infinite;
}

.bubble.special-color-bomb::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: conic-gradient(
        var(--bubble-red),
        var(--bubble-yellow),
        var(--bubble-green),
        var(--bubble-blue),
        var(--bubble-purple),
        var(--bubble-red)
    );
    filter: blur(8px);
    opacity: 0.6;
    animation: colorBombRotate 2s linear infinite reverse;
    z-index: -1;
}

.bubble.special-color-bomb::after {
    content: '⭐';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(0.8rem, 3vw, 1.2rem);
    animation: starPulse 0.6s ease-in-out infinite;
    filter: drop-shadow(0 0 5px #fff);
}

@keyframes colorBombRotate {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(360deg); }
}

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

@keyframes starPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    50% { transform: translate(-50%, -50%) scale(1.2) rotate(15deg); }
}

/* RAINBOW BOMB - Ultimate power */
.bubble.special-rainbow {
    position: relative;
    background: linear-gradient(135deg,
        var(--bubble-red) 0%,
        var(--bubble-yellow) 25%,
        var(--bubble-green) 50%,
        var(--bubble-blue) 75%,
        var(--bubble-purple) 100%
    ) !important;
    animation: rainbowShimmer 2s ease-in-out infinite, rainbowPulse 1.2s ease-in-out infinite;
}

.bubble.special-rainbow::before {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        var(--bubble-red),
        var(--bubble-yellow),
        var(--bubble-green),
        var(--bubble-blue),
        var(--bubble-purple),
        var(--bubble-red)
    );
    filter: blur(12px);
    opacity: 0.7;
    animation: rainbowGlowRotate 3s linear infinite;
    z-index: -1;
}

.bubble.special-rainbow::after {
    content: '🌈';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(0.8rem, 3vw, 1.2rem);
    animation: rainbowIcon 1s ease-in-out infinite;
    filter: drop-shadow(0 0 8px #fff);
}

@keyframes rainbowShimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

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

@keyframes rainbowGlowRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rainbowIcon {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    25% { transform: translate(-50%, -50%) scale(1.15) rotate(-5deg); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    75% { transform: translate(-50%, -50%) scale(1.15) rotate(5deg); }
}

@keyframes specialGlow {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(0.8); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.2); }
}

/* === EXPLOSION EFFECTS === */
.explosion-ring {
    position: absolute;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.8);
    animation: explosionRing 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes explosionRing {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
        border-width: 4px;
    }
    100% {
        width: 150px;
        height: 150px;
        opacity: 0;
        border-width: 1px;
        margin-left: -75px;
        margin-top: -75px;
    }
}

/* Line blast effect */
.line-blast {
    position: absolute;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
    height: 8px;
    animation: lineBlast 0.4s ease-out forwards;
    pointer-events: none;
}

.line-blast.vertical {
    width: 8px;
    height: auto;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.9), transparent);
    animation: lineBlastVertical 0.4s ease-out forwards;
}

@keyframes lineBlast {
    0% {
        left: 50%;
        right: 50%;
        opacity: 1;
    }
    100% {
        left: -10%;
        right: -10%;
        opacity: 0;
    }
}

@keyframes lineBlastVertical {
    0% {
        top: 50%;
        bottom: 50%;
        opacity: 1;
    }
    100% {
        top: -10%;
        bottom: -10%;
        opacity: 0;
    }
}

/* Color bomb wave */
.color-wave {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: colorWave 0.8s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes colorWave {
    0% {
        width: 0;
        height: 0;
        opacity: 0.8;
        background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, transparent 70%);
    }
    100% {
        width: 200vmax;
        height: 200vmax;
        opacity: 0;
        background: radial-gradient(circle, rgba(255,255,255,0) 0%, transparent 70%);
    }
}

/* === BUBBLE ANIMATIONS === */

.bubble-cell.falling {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.bubble-cell.spawning {
    animation: spawnBubble 0.3s ease-out;
}

@keyframes spawnBubble {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.bubble-cell.swapping {
    transition: transform 0.2s ease-in-out;
    z-index: 20;
}

.bubble-cell.invalid-swap {
    animation: invalidShake 0.3s ease;
}

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

/* Matched highlight - shows what's about to pop */
.bubble-cell.matched {
    animation: matchedPulse 0.15s ease-out;
    z-index: 15;
}

.bubble-cell.matched .bubble {
    filter: brightness(1.5) saturate(1.3);
    box-shadow: 0 0 15px currentColor, 0 0 30px currentColor;
}

@keyframes matchedPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1.1);
    }
}

/* Improved popping animation */
.bubble-cell.popping {
    animation: popBubbleImproved 0.25s ease-out forwards;
    z-index: 25;
}

@keyframes popBubbleImproved {
    0% {
        transform: scale(1.1);
        opacity: 1;
    }
    40% {
        transform: scale(1.4);
        opacity: 0.9;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* === PARTICLES === */
.particle-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.particle.spark {
    width: 6px;
    height: 6px;
    animation: sparkFly 0.6s ease-out forwards;
}

@keyframes sparkFly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx), var(--dy)) scale(0);
    }
}

.particle.star {
    font-size: 1rem;
    animation: starFloat 0.8s ease-out forwards;
}

@keyframes starFloat {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx), var(--dy)) scale(0.5) rotate(180deg);
    }
}

/* Glow burst - expands and fades */
.particle.glow-burst {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    animation: glowBurst 0.4s ease-out forwards;
    transform: translate(-50%, -50%);
}

@keyframes glowBurst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(3);
    }
}

/* Sparkle - tiny twinkling dots */
.particle.sparkle {
    width: 4px;
    height: 4px;
    background: #fff;
    animation: sparkle 0.5s ease-out forwards;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px #fff, 0 0 10px #fff;
}

@keyframes sparkle {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.5);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
}

/* Trail particles for movement */
.particle.trail {
    width: 8px;
    height: 8px;
    animation: trailFade 0.3s ease-out forwards;
}

@keyframes trailFade {
    0% {
        opacity: 0.8;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* === SCORE POPUPS === */
.score-popup-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.score-popup {
    position: absolute;
    font-size: clamp(0.9rem, 3vw, 1.3rem);
    font-weight: 800;
    color: var(--bp-accent-yellow);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(251, 191, 36, 0.5);
    animation: scoreFloat 0.8s ease-out forwards;
    pointer-events: none;
    white-space: nowrap;
}

.score-popup.cascade {
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    color: var(--bp-accent-purple);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 15px rgba(139, 92, 246, 0.6);
}

.score-popup.combo {
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    color: var(--bp-accent-red);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 20px rgba(239, 68, 68, 0.7);
}

.score-popup.mega {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 20px rgba(251, 191, 36, 0.8));
    animation: megaScoreFloat 1s ease-out forwards;
}

.score-popup.epic {
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    background: linear-gradient(135deg, #ff0000 0%, #ff8800 25%, #ffff00 50%, #00ff00 75%, #0088ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 30px rgba(255, 255, 255, 0.9));
    animation: epicScoreFloat 1.2s ease-out forwards;
}

@keyframes megaScoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.5) rotate(-5deg);
    }
    20% {
        transform: translateY(-15px) scale(1.4) rotate(3deg);
    }
    40% {
        transform: translateY(-25px) scale(1.2) rotate(-2deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8) rotate(0deg);
    }
}

@keyframes epicScoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.3) rotate(-10deg);
    }
    15% {
        transform: translateY(-20px) scale(1.6) rotate(5deg);
    }
    30% {
        transform: translateY(-35px) scale(1.3) rotate(-3deg);
    }
    50% {
        transform: translateY(-50px) scale(1.1) rotate(2deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.6) rotate(0deg);
    }
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    20% {
        transform: translateY(-10px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scale(0.8);
    }
}

/* === SCREEN SHAKE (Applied to body for full-screen effect) === */
body.screen-shake {
    animation: screenShake 0.3s ease;
}

body.screen-shake-intense {
    animation: screenShakeIntense 0.5s ease;
}

body.screen-shake-epic {
    animation: screenShakeEpic 0.7s ease;
}

body.screen-shake-mega {
    animation: screenShakeMega 0.8s ease;
}

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

@keyframes screenShakeIntense {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    5% { transform: translate(-15px, -5px) rotate(-1deg); }
    10% { transform: translate(15px, 5px) rotate(1deg); }
    15% { transform: translate(-12px, 6px) rotate(-0.5deg); }
    20% { transform: translate(12px, -6px) rotate(0.5deg); }
    25% { transform: translate(-10px, 4px) rotate(-0.3deg); }
    30% { transform: translate(10px, -4px) rotate(0.3deg); }
    40% { transform: translate(-8px, 3px); }
    50% { transform: translate(8px, -3px); }
    60% { transform: translate(-5px, 2px); }
    70% { transform: translate(5px, -2px); }
    80% { transform: translate(-3px, 1px); }
    90% { transform: translate(2px, 0); }
}

@keyframes screenShakeEpic {
    0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
    5% { transform: translate(-20px, -8px) rotate(-2deg) scale(1.01); }
    10% { transform: translate(20px, 8px) rotate(2deg) scale(1.01); }
    15% { transform: translate(-18px, 10px) rotate(-1.5deg) scale(1.005); }
    20% { transform: translate(18px, -10px) rotate(1.5deg) scale(1.005); }
    25% { transform: translate(-15px, 8px) rotate(-1deg); }
    30% { transform: translate(15px, -8px) rotate(1deg); }
    40% { transform: translate(-12px, 6px) rotate(-0.5deg); }
    50% { transform: translate(12px, -6px) rotate(0.5deg); }
    60% { transform: translate(-8px, 4px); }
    70% { transform: translate(8px, -4px); }
    80% { transform: translate(-4px, 2px); }
    90% { transform: translate(2px, -1px); }
}

@keyframes screenShakeMega {
    0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
    3% { transform: translate(-25px, -10px) rotate(-3deg) scale(1.02); }
    6% { transform: translate(25px, 10px) rotate(3deg) scale(1.02); }
    10% { transform: translate(-22px, 12px) rotate(-2.5deg) scale(1.015); }
    15% { transform: translate(22px, -12px) rotate(2.5deg) scale(1.015); }
    20% { transform: translate(-18px, 10px) rotate(-2deg) scale(1.01); }
    25% { transform: translate(18px, -10px) rotate(2deg) scale(1.01); }
    30% { transform: translate(-15px, 8px) rotate(-1.5deg); }
    40% { transform: translate(15px, -8px) rotate(1.5deg); }
    50% { transform: translate(-10px, 5px) rotate(-1deg); }
    60% { transform: translate(10px, -5px) rotate(1deg); }
    70% { transform: translate(-6px, 3px) rotate(-0.5deg); }
    80% { transform: translate(6px, -3px) rotate(0.5deg); }
    90% { transform: translate(-3px, 1px); }
}

/* Flash effect */
.bubble-pop-blast.flash::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    animation: flashFade 0.2s ease-out forwards;
    z-index: 1000;
}

@keyframes flashFade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* === GAME OVER OVERLAY === */
.gameover-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 1rem;
}

.gameover-overlay.active {
    display: flex;
    opacity: 1;
}

.gameover-content {
    text-align: center;
    padding: 1.5rem;
    max-width: 360px;
    width: 100%;
    background: linear-gradient(180deg, var(--bp-bg-mid) 0%, var(--bp-bg-dark) 100%);
    border-radius: 16px;
    border: 2px solid var(--bp-border-color);
    margin: auto;
}

.gameover-title {
    font-size: 1.8rem;
    font-weight: 900;
    margin: 0 0 1rem 0;
    color: var(--bp-accent-red);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.gameover-title.victory {
    color: var(--bp-accent-green);
}

.gameover-level {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.gameover-level .level-label {
    font-size: 0.75rem;
    color: var(--bp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.gameover-level .level-value {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--bp-accent-purple) 0%, var(--bp-accent-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.gameover-stats {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.gameover-stats .stat-item {
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    min-width: 70px;
}

.gameover-stats .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--bp-accent-cyan);
}

.gameover-stats .stat-label {
    font-size: 0.65rem;
    color: var(--bp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gameover-coins {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bp-accent-yellow);
    margin-bottom: 1rem;
}

.gameover-highscore {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bp-accent-yellow);
    margin-bottom: 1rem;
    animation: highscorePulse 1s ease-in-out infinite;
}

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

.gameover-login-prompt {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    display: none;
}

.gameover-login-prompt.visible {
    display: block;
}

.gameover-login-prompt p {
    margin: 0 0 0.5rem 0;
    color: var(--bp-text-secondary);
    font-size: 0.85rem;
}

.login-prompt-btn {
    background: linear-gradient(135deg, var(--bp-accent-purple) 0%, #6d28d9 100%);
    border: none;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-prompt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.gameover-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.retry-btn {
    background: linear-gradient(135deg, var(--bp-accent-red) 0%, var(--bp-accent-pink) 100%);
    border: none;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(239, 68, 68, 0.6);
}

.home-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--bp-text-primary);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.home-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* === NEW ACHIEVEMENTS === */
.new-achievements {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.new-achievements-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--bp-accent-yellow);
    margin-bottom: 0.5rem;
    text-align: center;
}

.new-achievements-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.new-achievement-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
}

.new-achievement-icon {
    font-size: 1rem;
}

.new-achievement-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bp-text-primary);
}

.new-achievement-reward {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bp-accent-yellow);
}

/* === NO MOVES POPUP === */
.no-moves-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid var(--bp-accent-yellow);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    z-index: 80;
    text-align: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.no-moves-popup.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.no-moves-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.no-moves-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bp-text-primary);
    margin-bottom: 0.25rem;
}

.no-moves-subtext {
    font-size: 0.9rem;
    color: var(--bp-text-secondary);
}

/* === ROTATE PROMPT === */
.rotate-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bp-bg-dark);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.rotate-content {
    text-align: center;
    color: var(--bp-text-primary);
}

.rotate-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.rotate-arrow {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: rotateArrow 2s ease-in-out infinite;
}

@keyframes rotateArrow {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.rotate-text {
    font-size: 1.1rem;
    color: var(--bp-text-secondary);
}

/* === RESPONSIVE === */
@media (max-width: 500px) {
    .bubble-grid {
        gap: clamp(2px, 0.6vw, 4px);
        padding: clamp(3px, 0.8vw, 6px);
    }

    .top-bar {
        padding: 0.4rem 0.5rem;
    }

    .welcome-title {
        font-size: 1.8rem;
    }

    .welcome-stats {
        gap: 1rem;
    }

    .welcome-buttons {
        flex-direction: column;
    }

    .secondary-btn {
        justify-content: center;
    }

    .powerups-bar {
        gap: 0.35rem;
    }

    .powerup-btn {
        padding: 0.4rem 0.5rem;
        min-width: 42px;
    }

    .powerup-icon {
        font-size: 1rem;
    }

    .gameover-buttons {
        flex-direction: column;
    }

    .retry-btn,
    .home-btn {
        width: 100%;
    }
}

/* Tablet and up */
@media (min-width: 501px) {
    .bubble-grid {
        gap: 5px;
        max-width: 380px;
    }
}

/* === SAFE AREA INSETS (iOS) === */
@supports (padding: max(0px)) {
    .bubble-pop-blast {
        padding-left: max(0.5rem, env(safe-area-inset-left));
        padding-right: max(0.5rem, env(safe-area-inset-right));
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    }
}

/* === DARK MODAL OVERRIDES === */
.word-game-page .game-modal__content,
body.word-game-page .game-modal .game-modal__content {
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%) !important;
    color: #f0f0f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.word-game-page .game-modal__content h2 {
    color: #f0f0f0;
    margin-top: 0;
}

.word-game-page .game-modal__content h3 {
    color: var(--bp-accent-cyan);
}

.word-game-page .game-modal__content p {
    color: #9ca3af;
}

.word-game-page .wordle-btn,
.word-game-page .modal-btn {
    background: linear-gradient(135deg, var(--bp-accent-red) 0%, var(--bp-accent-pink) 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-top: 1rem;
}

.word-game-page .wordle-btn:hover,
.word-game-page .modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

/* === LEVEL UP ANIMATION === */
@keyframes levelUpPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
    }
    30% {
        transform: scale(1.3);
        box-shadow: 0 0 30px rgba(139, 92, 246, 0.8), 0 0 50px rgba(236, 72, 153, 0.5);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
    }
}

.level-badge.level-up {
    animation: levelUpPulse 0.6s ease;
}

/* === LEVEL UP POPUP === */
.level-up-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.level-up-popup.active {
    opacity: 1;
    visibility: visible;
}

.level-up-content {
    text-align: center;
    animation: levelUpPopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes levelUpPopIn {
    0% {
        transform: scale(0.3) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(3deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.level-up-stars {
    font-size: 3rem;
    animation: starSpin 0.6s ease;
}

@keyframes starSpin {
    0% {
        transform: rotate(0deg) scale(0);
    }
    50% {
        transform: rotate(180deg) scale(1.3);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.level-up-title {
    font-family: var(--heading-font, 'Poppins', sans-serif);
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    letter-spacing: 0.1em;
    margin: 0.5rem 0;
}

.level-up-number {
    font-family: var(--heading-font, 'Poppins', sans-serif);
    font-size: 5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.8), 0 0 60px rgba(236, 72, 153, 0.6);
    line-height: 1;
    animation: levelNumberPulse 0.8s ease infinite;
}

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

.level-up-bonus {
    font-family: var(--heading-font, 'Poppins', sans-serif);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bp-accent-green);
    margin-top: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    display: inline-block;
}

/* === OBSTACLES === */

/* Obstacle icon container */
.obstacle-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(0.8rem, 2.5vw, 1.1rem);
    z-index: 2;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}

/* SKULL - Costs moves when matched */
.bubble.obstacle-skull {
    position: relative;
    animation: skullPulse 1.5s ease-in-out infinite;
}

.bubble.obstacle-skull::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 0, 0, 0.4) 0%, transparent 70%);
    animation: skullAura 2s ease-in-out infinite;
}

@keyframes skullPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(0.8) saturate(0.8); }
}

@keyframes skullAura {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* ICE - Frozen bubble, needs two hits */
.bubble.obstacle-ice {
    position: relative;
}

.bubble.obstacle-ice.frozen {
    filter: brightness(1.2) saturate(0.6);
}

.bubble.obstacle-ice.frozen::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(200, 230, 255, 0.6) 0%, rgba(100, 180, 255, 0.3) 50%, rgba(200, 230, 255, 0.6) 100%);
    border: 2px solid rgba(150, 200, 255, 0.8);
    animation: iceShimmer 2s ease-in-out infinite;
}

@keyframes iceShimmer {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* BOMB TIMER - Countdown, explodes when 0 */
.bubble.obstacle-bomb-timer {
    position: relative;
    animation: bombTimerTick 1s ease-in-out infinite;
}

.bubble.obstacle-bomb-timer::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 100, 100, 0.8);
    animation: bombTimerRotate 3s linear infinite;
}

.bomb-timer-icon {
    font-family: var(--heading-font, 'Poppins', sans-serif);
    font-size: clamp(1rem, 3vw, 1.4rem) !important;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 10px #ef4444, 0 0 20px #ef4444, 0 2px 4px rgba(0,0,0,0.8);
    animation: bombTimerPulse 0.5s ease-in-out infinite;
}

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

@keyframes bombTimerRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

/* Obstacle Warning Popup */
.obstacle-warning {
    position: absolute;
    font-family: var(--heading-font, 'Poppins', sans-serif);
    font-size: 1rem;
    font-weight: 800;
    white-space: nowrap;
    animation: obstacleWarningFloat 1s ease-out forwards;
    pointer-events: none;
    z-index: 50;
    transform: translateX(-50%);
}

.obstacle-warning.obstacle-skull {
    color: #ef4444;
    text-shadow: 0 0 10px #ef4444, 0 2px 4px rgba(0,0,0,0.8);
}

.obstacle-warning.obstacle-ice {
    color: #60a5fa;
    text-shadow: 0 0 10px #60a5fa, 0 2px 4px rgba(0,0,0,0.8);
}

.obstacle-warning.obstacle-bomb {
    color: #ff6b6b;
    font-size: 1.2rem;
    text-shadow: 0 0 15px #ef4444, 0 0 25px #ef4444, 0 2px 4px rgba(0,0,0,0.8);
}

@keyframes obstacleWarningFloat {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(0.8);
    }
    20% {
        transform: translateX(-50%) translateY(-10px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-50px) scale(0.9);
    }
}
