@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Fredoka+One&display=swap');

/* --- Global & Body Styles --- */
html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden; /* Prevent scrolling */
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #2c3e50, #4a69bd); /* Dark gradient background */
    font-family: 'Fredoka One', cursive; /* More playful font */
    color: #ecf0f1;
    user-select: none; /* Prevent text selection */
    -webkit-user-select: none; /* For Safari */
    -moz-user-select: none; /* For Firefox */
    -ms-user-select: none; /* For IE/Edge */
    touch-action: manipulation; /* Improve touch responsiveness on mobile */
    /* Fix for mobile browsers with address bars */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* --- Game Container (Portrait Mode) --- */
#game-container {
    width: min(95vw, 50vh); /* Slightly smaller to ensure full visibility */
    height: min(95vh, 190vw); /* Reduced height to account for browser UI */
    max-width: 380px; /* Slightly reduced max size */
    max-height: 760px; /* Reduced max height */
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #1abc9c, #27ae60); /* Inner game gradient */
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden; /* Clip game elements */
    position: relative;
    padding: 8px; /* Slightly reduced padding */
    box-sizing: border-box; /* Include padding in width/height */
    margin: 10px; /* Add margin to ensure spacing from edges */
}

/* --- Game Header (UI) --- */
#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 5px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 0.8em;
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.1), inset 0 -2px 5px rgba(0,0,0,0.3);
    gap: 3px;
    flex-wrap: wrap;
}

.ui-element {
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    min-width: 45px;
    text-align: center;
    flex: 0 0 auto;
    font-size: 0.9em;
}

#level-display {
    min-width: 70px;
}
#score-display {
    min-width: 75px;
}

.timer-container {
    position: relative;
    width: 65px;
    height: 22px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 11px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}

#timer-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%; /* Will be reduced by JS */
    background: linear-gradient(to right, #2ecc71, #27ae60); /* Green initially */
    transition: width 1s linear, background 1s linear; /* Note: background for color change */
    z-index: 1;
}

#timer-display {
    position: relative;
    z-index: 2;
    font-family: 'Press Start 2P', cursive; /* Retro font for timer */
    font-size: 0.8em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Pause button styling */
#pause-button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 5px;
    color: white;
    font-size: 1em;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    width: 32px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#pause-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

#pause-button:active {
    transform: scale(0.95);
}

/* Hammer button styling */
#hammer-button {
    background: rgba(255, 165, 0, 0.3);
    border: 1px solid rgba(255, 165, 0, 0.6);
    border-radius: 5px;
    color: white;
    font-size: 0.9em;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
}

#hammer-button:hover:not(:disabled) {
    background: rgba(255, 165, 0, 0.5);
    border-color: rgba(255, 165, 0, 0.8);
    transform: scale(1.05);
}

#hammer-button:active {
    transform: scale(0.95);
}

#hammer-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(128, 128, 128, 0.3);
    border-color: rgba(128, 128, 128, 0.5);
}

#hammer-button.active {
    background: rgba(255, 0, 0, 0.5);
    border-color: rgba(255, 0, 0, 0.8);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

#hammer-count {
    font-weight: bold;
    min-width: 12px;
}


/* --- Game Board --- */
#game-board {
    display: grid;
    flex-grow: 1; /* Takes remaining space */
    width: 100%;
    aspect-ratio: 1 / 1; /* Force board to be square */
    grid-template-columns: repeat(8, 1fr); /* 8 columns */
    grid-template-rows: repeat(8, 1fr); /* 8 rows */
    gap: 2px; /* Small gap between logical grid cells */
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 5px; /* Padding around the grid */
    box-sizing: border-box;
    position: relative; /* Crucial for absolute positioning of blocks */
    overflow: hidden; /* Important for new blocks falling from above */
    /* Add a subtle inner shadow to the board itself for depth */
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

/* --- Game Blocks (The visually impressive part!) --- */
.game-block {
    /* Dimensions will be set by JS based on cell size */
    position: absolute; /* Crucial for precise JS positioning and animation */
    border-radius: 15%; /* Slightly rounded square for a gem-like look */
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em; /* For debugging or special icons */
    transition: transform 0.2s ease-out; /* Basic transition for selection feedback */
    transform-style: preserve-3d; /* Key for child 3D transforms */
    perspective: 1000px; /* Overall perspective */
    box-sizing: border-box;

    /* Base 3D shadow/glow - simulates depth */
    box-shadow: 0 5px 15px rgba(0,0,0,0.5), /* Overall drop shadow */
                inset 0 0 10px rgba(255,255,255,0.2); /* Subtle inner glow */
    will-change: transform, opacity; /* Hint to browser for animation performance */
}

/* Pseudo 3D effects for blocks */
.game-block::before,
.game-block::after {
    content: '';
    position: absolute;
    border-radius: inherit;
    top: 0; left: 0; right: 0; bottom: 0;
}

/* Inner surface highlight (top-left) */
.game-block::before {
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 70%);
    transform: translateZ(1px); /* Slightly lifted */
}

/* Inner surface shadow (bottom-right) */
.game-block::after {
    background: radial-gradient(circle at 80% 80%, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0) 70%);
    transform: translateZ(1px); /* Slightly lifted */
}

/* --- Unique Block Colors & Gradients (Pseudo 3D) --- */
.block-red {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 2px solid #a52a2a;
}
.block-blue {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: 2px solid #1a527c;
}
.block-green {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: 2px solid #1f7842;
}
.block-yellow {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    border: 2px solid #c87f0a;
}
.block-purple {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    border: 2px solid #6b2e81;
}
.block-orange {
    background: 
        repeating-linear-gradient(
            45deg,
            #e67e22 0px,
            #e67e22 8px,
            #d35400 8px,
            #d35400 16px
        );
    border: 2px solid #a04000;
}
.block-pink {
    background: 
        radial-gradient(circle at 25% 25%, #ffffff 2px, transparent 2px),
        radial-gradient(circle at 75% 75%, #ffffff 2px, transparent 2px),
        linear-gradient(135deg, #e91e63, #c2185b);
    background-size: 12px 12px, 12px 12px, 100% 100%;
    border: 2px solid #8e1538;
}
.block-cyan {
    background: 
        linear-gradient(90deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%),
        linear-gradient(0deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%),
        linear-gradient(135deg, #1abc9c, #16a085);
    border: 2px solid #0f6b5e;
}

/* --- Power-Up Blocks --- */
.game-block.striped-h {
    background: repeating-linear-gradient(
        45deg,
        var(--block-base-color),
        var(--block-base-color) 10px,
        rgba(255,255,255,0.3) 10px,
        rgba(255,255,255,0.3) 20px
    );
    border-color: var(--block-accent-color);
    box-shadow: 0 0 15px 5px rgba(255,255,0,0.5), inset 0 0 8px rgba(255,255,255,0.7);
    animation: pulse-border 1.5s infinite alternate;
}

.game-block.striped-v {
    background: repeating-linear-gradient(
        -45deg, /* Different angle for vertical stripes */
        var(--block-base-color),
        var(--block-base-color) 10px,
        rgba(255,255,255,0.3) 10px,
        rgba(255,255,255,0.3) 20px
    );
    border-color: var(--block-accent-color);
    box-shadow: 0 0 15px 5px rgba(255,255,0,0.5), inset 0 0 8px rgba(255,255,255,0.7);
    animation: pulse-border 1.5s infinite alternate;
}

.game-block.wrapped {
    background: radial-gradient(circle at center, var(--block-base-color) 0%, var(--block-base-color) 50%, rgba(255,255,255,0.4) 100%);
    border-color: var(--block-accent-color);
    box-shadow: 0 0 20px 8px rgba(0,255,255,0.6), inset 0 0 10px rgba(255,255,255,0.8);
    animation: pulse-glow 1.8s infinite ease-in-out alternate;
}

/* Base colors for power-ups using CSS variables */
.block-red.striped-h, .block-red.striped-v, .block-red.wrapped {
    --block-base-color: #c0392b; --block-accent-color: #e74c3c;
}
.block-blue.striped-h, .block-blue.striped-v, .block-blue.wrapped {
    --block-base-color: #2980b9; --block-accent-color: #3498db;
}
.block-green.striped-h, .block-green.striped-v, .block-green.wrapped {
    --block-base-color: #27ae60; --block-accent-color: #2ecc71;
}
.block-yellow.striped-h, .block-yellow.striped-v, .block-yellow.wrapped {
    --block-base-color: #f39c12; --block-accent-color: #f1c40f;
}
.block-purple.striped-h, .block-purple.striped-v, .block-purple.wrapped {
    --block-base-color: #8e44ad; --block-accent-color: #9b59b6;
}
.block-orange.striped-h, .block-orange.striped-v, .block-orange.wrapped {
    --block-base-color: #d35400; --block-accent-color: #e67e22;
}
.block-pink.striped-h, .block-pink.striped-v, .block-pink.wrapped {
    --block-base-color: #c2185b; --block-accent-color: #e91e63;
}
.block-cyan.striped-h, .block-cyan.striped-v, .block-cyan.wrapped {
    --block-base-color: #16a085; --block-accent-color: #1abc9c;
}

/* Power-up animation keyframes */
@keyframes pulse-border {
    from { border-color: var(--block-accent-color); transform: scale(1); }
    to { border-color: rgba(255,255,255,0.8); transform: scale(1.03); }
}
@keyframes pulse-glow {
    from { box-shadow: 0 0 10px 5px rgba(0,255,255,0.4), inset 0 0 10px rgba(255,255,255,0.8); }
    to { box-shadow: 0 0 30px 10px rgba(0,255,255,0.8), inset 0 0 15px rgba(255,255,255,0.9); }
}

/* --- General Animations --- */

/* Selected block visual feedback */
.game-block.selected {
    box-shadow: 0 0 20px 10px rgba(255, 255, 0, 0.7), /* Bright glow */
                0 5px 15px rgba(0,0,0,0.5),
                inset 0 0 10px rgba(255,255,255,0.2);
    transform: scale(1.05) rotateY(10deg); /* Slight scale and rotation */
    z-index: 10; /* Bring to front during selection */
}

/* Swap animation (JS will manipulate transform) */
.game-block.swapping {
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Springy effect */
    z-index: 20; /* Higher z-index during swap to appear above others */
}

/* Destruction animation (JS will add this class) */
.game-block.destroying {
    animation: destroy-block 0.5s forwards ease-out;
    pointer-events: none; /* No interaction during destruction */
    z-index: 15; /* Above normal blocks during destruction */
}

@keyframes destroy-block {
    0% {
        transform: scale(1) rotateY(0deg) rotateX(0deg);
        opacity: 1;
        box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    }
    25% {
        transform: scale(1.15) rotateY(15deg) rotateX(-15deg);
        opacity: 0.9;
        box-shadow: 0 0 30px 15px rgba(255, 255, 255, 0.9); /* Bright flash */
    }
    50% {
        transform: scale(1.3) rotateY(45deg) rotateX(-45deg);
        opacity: 0.7;
        box-shadow: 0 0 40px 20px rgba(255, 215, 0, 0.8); /* Golden explosion */
    }
    75% {
        transform: scale(0.8) rotateY(75deg) rotateX(-75deg);
        opacity: 0.4;
        box-shadow: 0 0 50px 25px rgba(255, 100, 255, 0.6); /* Purple sparkle */
    }
    100% {
        transform: scale(0) rotateY(90deg) rotateX(-90deg); /* Shrink and rotate away */
        opacity: 0;
        box-shadow: 0 0 60px 30px rgba(0, 255, 255, 0.3); /* Final cyan burst */
        visibility: hidden; /* Hide completely */
    }
}

/* Enhanced particle effect for matches - Fixed positioning */
.game-block.match-sparkle {
    animation: sparkle-effect 0.6s ease-out;
    z-index: 20;
    position: absolute; /* Ensure proper positioning */
}

@keyframes sparkle-effect {
    0% { 
        box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3); 
        transform: scale(1);
        filter: brightness(1);
    }
    25% { 
        box-shadow: 0 2px 12px rgba(255, 255, 255, 0.6),
                    0 0 8px rgba(255, 215, 0, 0.4);
        transform: scale(1.08);
        filter: brightness(1.3);
    }
    50% { 
        box-shadow: 0 2px 15px rgba(255, 255, 255, 0.8),
                    0 0 12px rgba(255, 215, 0, 0.6);
        transform: scale(1.12);
        filter: brightness(1.5);
    }
    75% { 
        box-shadow: 0 2px 10px rgba(255, 255, 255, 0.5),
                    0 0 8px rgba(255, 215, 0, 0.3);
        transform: scale(1.06);
        filter: brightness(1.2);
    }
    100% { 
        box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3); 
        transform: scale(1);
        filter: brightness(1);
    }
}

/* Combo celebration animation - More contained and less flashy */
.game-block.combo-celebration {
    animation: combo-burst 0.8s ease-out;
    z-index: 25;
    position: absolute; /* Ensure proper positioning */
}

@keyframes combo-burst {
    0% { 
        transform: scale(1) rotate(0deg);
        box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
        filter: brightness(1) hue-rotate(0deg);
    }
    25% { 
        transform: scale(1.15) rotate(5deg);
        box-shadow: 0 2px 15px rgba(255, 215, 0, 0.7);
        filter: brightness(1.4) hue-rotate(30deg);
    }
    50% { 
        transform: scale(1.25) rotate(-5deg);
        box-shadow: 0 2px 20px rgba(255, 100, 255, 0.8);
        filter: brightness(1.6) hue-rotate(60deg);
    }
    75% { 
        transform: scale(1.15) rotate(3deg);
        box-shadow: 0 2px 15px rgba(0, 255, 255, 0.6);
        filter: brightness(1.3) hue-rotate(30deg);
    }
    100% { 
        transform: scale(1) rotate(0deg);
        box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
        filter: brightness(1) hue-rotate(0deg);
    }
}

/* Fall animation (JS will add this class) - 2x faster */
.game-block.falling {
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* 2x faster bounce effect */
    z-index: 5; /* Slightly above static blocks, below swapping/destroying */
}

/* Power-up specific activation animations - Fixed to prevent screen lighting */
.game-block.activating-striped-h {
    animation: activate-striped-h 0.4s forwards ease-out;
    pointer-events: none;
    z-index: 25;
    position: absolute;
    overflow: hidden;
}
@keyframes activate-striped-h {
    0% { 
        transform: scale(1); 
        opacity: 1; 
        box-shadow: 0 2px 8px rgba(255, 255, 0, 0.4);
        filter: brightness(1.2);
    }
    50% { 
        transform: scale(1.1); 
        opacity: 1; 
        box-shadow: 0 2px 12px rgba(255, 255, 0, 0.6);
        filter: brightness(1.4);
    }
    100% { 
        transform: scaleX(3) scaleY(0.3); 
        opacity: 0; 
        box-shadow: 0 0 8px rgba(255, 255, 0, 0.2);
        filter: brightness(1);
    }
}

.game-block.activating-striped-v {
    animation: activate-striped-v 0.4s forwards ease-out;
    pointer-events: none;
    z-index: 25;
    position: absolute;
    overflow: hidden;
}
@keyframes activate-striped-v {
    0% { 
        transform: scale(1); 
        opacity: 1; 
        box-shadow: 0 2px 8px rgba(255, 255, 0, 0.4);
        filter: brightness(1.2);
    }
    50% { 
        transform: scale(1.1); 
        opacity: 1; 
        box-shadow: 0 2px 12px rgba(255, 255, 0, 0.6);
        filter: brightness(1.4);
    }
    100% { 
        transform: scaleY(3) scaleX(0.3); 
        opacity: 0; 
        box-shadow: 0 0 8px rgba(255, 255, 0, 0.2);
        filter: brightness(1);
    }
}

.game-block.activating-wrapped {
    animation: activate-wrapped 0.5s forwards ease-out;
    pointer-events: none;
    z-index: 25;
    position: absolute;
}
@keyframes activate-wrapped {
    0% { 
        transform: scale(1); 
        opacity: 1; 
        box-shadow: 0 2px 8px rgba(0, 255, 255, 0.4);
        filter: brightness(1.2);
    }
    50% { 
        transform: scale(1.3); 
        opacity: 0.8; 
        box-shadow: 0 2px 15px rgba(0, 255, 255, 0.7);
        filter: brightness(1.5);
    }
    100% { 
        transform: scale(0.2); 
        opacity: 0; 
        box-shadow: 0 0 5px rgba(0, 255, 255, 0.2);
        filter: brightness(1);
    }
}

/* Hammer destruction animation */
.game-block.hammer-destroy {
    animation: hammer-smash 0.6s forwards ease-out;
    pointer-events: none;
    z-index: 30;
}

@keyframes hammer-smash {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
        filter: brightness(1);
    }
    25% {
        transform: scale(1.3) rotate(-5deg);
        opacity: 0.9;
        box-shadow: 0 0 20px rgba(255, 165, 0, 0.8);
        filter: brightness(1.5) hue-rotate(30deg);
    }
    50% {
        transform: scale(1.1) rotate(3deg);
        opacity: 0.7;
        box-shadow: 0 0 30px rgba(255, 0, 0, 0.9);
        filter: brightness(2) hue-rotate(60deg);
    }
    75% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0.4;
        box-shadow: 0 0 40px rgba(128, 0, 128, 0.6);
        filter: brightness(1.5) hue-rotate(90deg);
    }
    100% {
        transform: scale(0) rotate(15deg);
        opacity: 0;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
        filter: brightness(0);
        visibility: hidden;
    }
}


/* Overlay for game states (Game Over, Level Complete) */
#game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    flex-direction: column;
}

#game-overlay.visible {
    opacity: 1;
    visibility: visible;
}

#overlay-content {
    background: #34495e;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
    transform: scale(0.8);
    opacity: 0;
    animation: overlay-slide-in 0.5s forwards cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes overlay-slide-in {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#overlay-message {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: #ecf0f1;
    text-shadow: 2px 2px 3px rgba(0,0,0,0.6);
}

#overlay-button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#overlay-button:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.overlay-secondary-button {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    margin-top: 15px;
    margin-left: 10px;
}

.overlay-secondary-button:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.hidden {
    display: none !important;
}

/* Hammer reward celebration */
.hammer-celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: celebration-fade-in 0.5s ease-out;
}

.hammer-celebration-content {
    text-align: center;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.8);
    animation: celebration-bounce 0.8s ease-out;
}

.hammer-celebration-icon {
    font-size: 4em;
    margin-bottom: 15px;
    animation: celebration-hammer-spin 1s ease-in-out infinite;
}

.hammer-celebration-text h2 {
    color: white;
    font-size: 1.8em;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
    animation: celebration-glow 1.5s ease-in-out infinite alternate;
}

.hammer-celebration-text p {
    color: #fff3e0;
    font-size: 1.2em;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

@keyframes celebration-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes celebration-bounce {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    50% { transform: scale(1.1) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes celebration-hammer-spin {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-15deg) scale(1.1); }
    50% { transform: rotate(0deg) scale(1.2); }
    75% { transform: rotate(15deg) scale(1.1); }
    100% { transform: rotate(0deg) scale(1); }
}

@keyframes celebration-glow {
    from { text-shadow: 2px 2px 4px rgba(0,0,0,0.7), 0 0 10px rgba(255,255,255,0.3); }
    to { text-shadow: 2px 2px 4px rgba(0,0,0,0.7), 0 0 20px rgba(255,255,255,0.8); }
}

/* Ad success celebration */
.ad-success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: ad-success-fade-in 0.5s ease-out;
}

.ad-success-content {
    text-align: center;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(39, 174, 96, 0.8);
    animation: ad-success-bounce 0.8s ease-out;
}

.ad-success-icon {
    font-size: 4em;
    margin-bottom: 15px;
    animation: ad-success-sparkle 1s ease-in-out infinite;
}

.ad-success-content h2 {
    color: white;
    font-size: 1.8em;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.ad-success-content p {
    color: #e8f5e8;
    font-size: 1.2em;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

@keyframes ad-success-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ad-success-bounce {
    0% { transform: scale(0.3) rotate(-5deg); opacity: 0; }
    50% { transform: scale(1.1) rotate(2deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes ad-success-sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); filter: brightness(1); }
    25% { transform: scale(1.1) rotate(-10deg); filter: brightness(1.3); }
    50% { transform: scale(1.2) rotate(0deg); filter: brightness(1.5); }
    75% { transform: scale(1.1) rotate(10deg); filter: brightness(1.3); }
}