/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #ff6b9d, #c44ffc, #4facfe, #00f2fe);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    min-height: 100vh;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Main container */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    background: linear-gradient(45deg, #ff6b9d, #c44ffc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.stats {
    display: flex;
    gap: 30px;
}

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

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin-top: 5px;
}

/* Main game area */
.game-main {
    flex: 1;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.game-board-container {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 4px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.3);
    width: 480px;
    height: 480px;
}

.candy {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
}

.candy:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.candy.selected {
    transform: scale(1.15);
    box-shadow: 0 0 20px #ffdd59, 0 0 40px #ffdd59;
    border-color: #ffdd59;
    animation: pulse 0.6s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1.15); }
    100% { transform: scale(1.25); }
}

.candy.matched {
    animation: matchAnimation 0.6s ease-out forwards;
}

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

.candy.falling {
    animation: fallAnimation 0.5s ease-in forwards;
}

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

/* Candy types */
.candy.red { background: linear-gradient(135deg, #ff6b9d, #ff8a9b); }
.candy.blue { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.candy.green { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.candy.yellow { background: linear-gradient(135deg, #ffeaa7, #fdcb6e); }
.candy.purple { background: linear-gradient(135deg, #a29bfe, #6c5ce7); }
.candy.orange { background: linear-gradient(135deg, #fd79a8, #fdcb6e); }

/* Sidebar */
.game-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.progress-section,
.power-ups {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.progress-section h3,
.power-ups h3 {
    font-family: 'Fredoka One', cursive;
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #43e97b, #38f9d7);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.target-score {
    font-weight: 600;
    color: #666;
}

.power-up-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.power-up {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 15px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.power-up:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.power-up-icon {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.power-up-count {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Particles */
.particle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    animation: particleAnimation 1s ease-out forwards;
}

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

/* Modal */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.game-overlay.show {
    display: flex;
}

.modal {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
    animation: modalSlideIn 0.5s ease-out;
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    margin-bottom: 15px;
}

.modal p {
    margin-bottom: 25px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: white;
}

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Ad containers */
.ad-container {
    margin: 15px 0;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ad-banner-top {
    max-width: 728px;
    margin: 0 auto 20px auto;
    min-height: 90px;
}

.ad-banner-bottom {
    max-width: 728px;
    margin: 20px auto 0 auto;
    min-height: 90px;
}

.ad-sidebar {
    min-height: 250px;
    margin-bottom: 20px;
}

.ad-mobile-bottom {
    display: none;
    min-height: 250px;
}

.ad-interstitial {
    margin: 20px 0;
    min-height: 300px;
    max-width: 336px;
    margin-left: auto;
    margin-right: auto;
}

/* AdSense responsive adjustments */
.adsbygoogle {
    display: block !important;
}

/* Loading placeholder for ads */
.ad-container:empty:before {
    content: "Advertisement";
    display: block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .game-main {
        flex-direction: column;
    }
    
    .game-sidebar {
        width: 100%;
        order: -1;
    }
    
    .game-board {
        width: 100%;
        max-width: 400px;
        height: 400px;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .stats {
        gap: 15px;
    }
    
    .candy {
        font-size: 1.5rem;
    }

    /* Mobile ad adjustments */
    .ad-banner-top,
    .ad-banner-bottom {
        max-width: 320px;
        min-height: 50px;
    }
    
    .ad-sidebar {
        display: none;
    }
    
    .ad-mobile-bottom {
        display: block;
    }
    
    .ad-interstitial {
        min-height: 250px;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }
    
    .game-board {
        max-width: 320px;
        height: 320px;
        padding: 10px;
    }
    
    .candy {
        font-size: 1.2rem;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
} 