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

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(to bottom, #1a1a2e, #16213e);
    font-family: Arial, sans-serif;
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: auto;
    background: #fff;
    border: 2px solid #fff;
    border-radius: 5px;
    padding: 25px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

h1 {
    margin: 0;
    color: #333;
    font-size: 36px;
    text-align: center;
}

#score {
    font-size: 28px;
    color: #333;
    font-weight: bold;
}

#gameBoard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 15px;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.card {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #2196F3;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    cursor: pointer;
    transition: transform 0.3s;
    transform-style: preserve-3d;
    position: relative;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    background: #4CAF50;
    cursor: default;
}

.card.matched .card-front {
    background: #4CAF50;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    transition: background-color 0.3s;
    font-size: 100px;
    line-height: 1;
}

.card-front {
    background: #2196F3;
}

.card-back {
    background: white;
    transform: rotateY(180deg);
}

#startMessage {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #333;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.back-button {
    color: white;
    text-decoration: none;
    font-size: 18px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    transition: background 0.3s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 992px) {
    .game-container {
        max-width: 700px;
        padding: 20px;
    }

    .card-front, .card-back {
        font-size: 70px;
    }

    h1 {
        font-size: 32px;
    }

    #score {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    .game-container {
        max-width: 600px;
        padding: 15px;
    }

    .card-front, .card-back {
        font-size: 50px;
    }

    h1 {
        font-size: 28px;
    }

    #score {
        font-size: 22px;
    }

    .back-button {
        font-size: 16px;
    }
}

@media (max-width: 600px) {
    .game-container {
        padding: 10px;
        max-width: 95%;
    }

    .card-front, .card-back {
        font-size: 30px;
    }

    #gameBoard {
        gap: 8px;
        padding: 8px;
    }

    h1 {
        font-size: 24px;
    }

    #score {
        font-size: 20px;
    }

    .back-button {
        font-size: 14px;
        padding: 8px 15px;
    }
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over.active {
    display: flex;
}

.game-over-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 90%;
    width: 400px;
}

.game-over-content h2 {
    color: #333;
    font-size: 28px;
    margin-bottom: 15px;
}

.game-over-content p {
    color: #666;
    font-size: 20px;
    margin-bottom: 20px;
}

#playAgain {
    background: #2196F3;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 18px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#playAgain:hover {
    background: #1976D2;
}

#playAgain:active {
    transform: scale(0.98);
}

/* Interstitial Ad Overlay */
.interstitial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.interstitial-overlay.active {
    display: flex;
}

.interstitial-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 90%;
    width: 400px;
}

.interstitial-content h2 {
    color: #333;
    font-size: 28px;
    margin-bottom: 15px;
}

.interstitial-content p {
    color: #666;
    font-size: 20px;
    margin-bottom: 20px;
}

.interstitial-ad {
    margin: 20px 0;
    min-height: 100px;
    background-color: #e0e0e0; /* Temporary static color for ads */
    width: 100%; /* Ensure it takes full available width */
    height: 250px; /* Give it a fixed height for ad rendering */
}

.skip-ad {
    background: #2196F3;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 18px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.skip-ad:hover:not(:disabled) {
    background: #1976D2;
}

.skip-ad:disabled {
    background: #ccc;
    cursor: not-allowed;
} 