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

body {
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #ff69b4, #87ceeb);
    padding: 20px;
}

.container {
    perspective: 1500px;
}

.card {
    width: 300px;
    height: 400px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: box-shadow 0.3s ease, transform 1s;
}

.card:hover {
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

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

.card-front, .card-inside {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    padding: 20px;
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow-y: auto;
}

.card-inside {
    transform: rotateY(180deg);
    background: #fff9f9;
}

/* Game Screens */
.game-screen {
    display: none;
    width: 100%;
}

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

.game-screen.hidden {
    display: none;
}

.challenge-instruction {
    text-align: center;
    color: #666;
    margin: 10px 0;
    font-style: italic;
}

.game-btn {
    display: block;
    margin: 15px auto;
    padding: 10px 25px;
    background: #ff69b4;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.game-btn:hover {
    transform: scale(1.05);
    background: #ff1493;
}

h1 {
    font-family: 'Pacifico', cursive;
    color: #ff1493;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
}

h2 {
    font-family: 'Pacifico', cursive;
    color: #ff69b4;
    text-align: center;
    margin-bottom: 15px;
}

.cake {
    width: 100px;
    height: 100px;
    position: relative;
    margin: 30px auto;
}

.cake-bottom, .cake-middle, .cake-top {
    width: 100%;
    height: 25px;
    background: #ff69b4;
    border-radius: 10px;
    position: absolute;
    bottom: 0;
}

.cake-middle {
    bottom: 25px;
    background: #ff1493;
    width: 90%;
    left: 5%;
}

.cake-top {
    bottom: 50px;
    background: #ff69b4;
    width: 80%;
    left: 10%;
}

.candle {
    width: 8px;
    height: 35px;
    background: #ffd700;
    position: absolute;
    bottom: 75px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 4px;
}

.flame {
    width: 15px;
    height: 30px;
    background: #ff4500;
    position: absolute;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    animation: flicker 0.6s infinite alternate;
}

@keyframes flicker {
    0% { transform: translateX(-50%) scale(1); }
    100% { transform: translateX(-50%) scale(0.9); }
}

.tap-instruction {
    text-align: center;
    color: #666;
    margin-top: 30px;
    font-style: italic;
}

.message {
    text-align: center;
    margin-bottom: 20px;
}

.message p {
    margin: 10px 0;
    color: #444;
    line-height: 1.5;
}

.buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    background: #ff69b4;
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

button:hover {
    transform: scale(1.05);
    background: #ff1493;
}

.hidden {
    display: none;
}

#joke-container, #memory-container {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    background: rgba(255, 105, 180, 0.1);
    border-radius: 10px;
}

.signature {
    text-align: right;
    margin-top: 20px;
    font-family: 'Pacifico', cursive;
    color: #ff69b4;
}

/* Candle Game Styles */
.candle-game {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 20px auto;
    max-width: 250px;
}

.game-candle {
    width: 30px;
    height: 80px;
    position: relative;
    cursor: pointer;
}

.game-candle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 60px;
    bottom: 0;
    background: #ffd700;
    border-radius: 5px;
}

.game-flame {
    width: 20px;
    height: 30px;
    background: #ff4500;
    position: absolute;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation: flicker 0.6s infinite alternate;
    z-index: 1;
}

/* Gift Game Styles */
.gift-game {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px auto;
    max-width: 250px;
}

.gift-box {
    width: 50px;
    height: 50px;
    background: #ff69b4;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s, background 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 20px;
}

.gift-box:hover {
    transform: scale(1.05);
}

.gift-box.opened {
    background: #87ceeb;
}

.gift-box.found {
    background: #ffd700;
}

/* Trivia Game Styles */
.trivia-game {
    margin: 15px 0;
}

#trivia-question {
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
}

.trivia-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 auto;
    max-width: 250px;
}

.trivia-option {
    padding: 10px;
    text-align: center;
    font-size: 0.9em;
}

.trivia-option.correct {
    background: #4CAF50;
}

.trivia-option.incorrect {
    background: #f44336;
}

/* Add dim overlay for wrong answers */
.trivia-game.dim-overlay {
    position: relative;
}

.trivia-game.dim-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 1;
}

/* Wrong answer shake effect */
@keyframes wrongAnswerShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.wrong-answer-shake {
    animation: wrongAnswerShake 0.8s cubic-bezier(.36,.07,.19,.97) both;
}

/* Final Birthday Surprise */
.final-message {
    margin: 15px 0;
    text-align: center;
}

.final-cake {
    width: 120px;
    height: 120px;
    position: relative;
    margin: 20px auto;
}

#number-19 {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #ff1493;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    font-family: 'Pacifico', cursive;
}

#final-confetti-btn {
    background: #ffd700;
    color: #333;
    font-weight: bold;
}

#final-confetti-btn:hover {
    background: #ffcc00;
}

/* Mobile Responsiveness */
@media (max-width: 400px) {
    .card {
        width: 280px;
        height: 380px;
    }

    h1 {
        font-size: 1.8em;
    }

    .buttons button {
        padding: 8px 16px;
        font-size: 0.9em;
    }
}

/* Enhanced animations */
.animate__pulse {
    animation-duration: 0.8s;
}

.animate__heartBeat {
    animation-duration: 1.3s;
}

.animate__fadeIn {
    animation-duration: 1s;
}

/* Improved flame animation */
.flame, .game-flame {
    box-shadow: 0 0 10px #ff4500, 0 0 20px #ff6347;
    animation: flicker 0.6s infinite alternate, glow 1.5s infinite alternate;
}

@keyframes glow {
    0% { box-shadow: 0 0 5px #ff4500; }
    100% { box-shadow: 0 0 15px #ff4500, 0 0 20px #ff6347; }
}

/* Enhanced cake appearance */
.cake-bottom, .cake-middle, .cake-top {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Improved final celebration */
#final-confetti-btn {
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#final-confetti-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.final-message p {
    margin-bottom: 10px;
    line-height: 1.5;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}