/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Comic Sans MS", cursive, sans-serif;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57, #ff9ff3);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

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

.container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* Greeting Section */
.greeting-section {
    text-align: center;
    z-index: 10;
    position: relative;
    height: 100vh;
    display: flex;
    gap: 8rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Floating Balloons */
.balloon {
    position: absolute;
    font-size: 2rem;
    animation: float 6s ease-in-out infinite;
    z-index: 2;
}

.balloon1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.balloon2 {
    top: 20%;
    right: 15%;
    animation-delay: 1s;
}

.balloon3 {
    top: 60%;
    left: 5%;
    animation-delay: 2s;
}

.balloon4 {
    top: 70%;
    right: 10%;
    animation-delay: 3s;
}

.balloon5 {
    top: 40%;
    left: 20%;
    animation-delay: 4s;
}

.balloon6 {
    top: 30%;
    right: 25%;
    animation-delay: 5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(5deg); }
    50% { transform: translateY(-10px) rotate(-3deg); }
    75% { transform: translateY(-15px) rotate(2deg); }
}

/* Main Content - moved to greeting section above */

/* Birthday Title */
.birthday-title {
    font-size: 4rem;
    margin-bottom: 1rem;
    text-shadow: 3px 3px 0px #ff6b6b, 6px 6px 0px #4ecdc4, 9px 9px 0px #45b7d1;
    animation: titleBounce 2s ease-in-out infinite;
}

.letter {
    display: inline-block;
    animation: letterBounce 1.5s ease-in-out infinite;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.letter:nth-child(1) { animation-delay: 0.1s; }
.letter:nth-child(2) { animation-delay: 0.2s; }
.letter:nth-child(3) { animation-delay: 0.3s; }
.letter:nth-child(4) { animation-delay: 0.4s; }
.letter:nth-child(5) { animation-delay: 0.5s; }
.letter:nth-child(7) { animation-delay: 0.6s; }
.letter:nth-child(8) { animation-delay: 0.7s; }
.letter:nth-child(9) { animation-delay: 0.8s; }
.letter:nth-child(10) { animation-delay: 0.9s; }
.letter:nth-child(11) { animation-delay: 1.0s; }
.letter:nth-child(12) { animation-delay: 1.1s; }
.letter:nth-child(13) { animation-delay: 1.2s; }
.letter:nth-child(14) { animation-delay: 1.3s; }
.letter:nth-child(15) { animation-delay: 1.4s; }
.letter:nth-child(17) { animation-delay: 1.5s; }
.letter:nth-child(18) { animation-delay: 1.6s; }
.letter:nth-child(19) { animation-delay: 1.7s; }
.letter:nth-child(20) { animation-delay: 1.8s; }
.letter:nth-child(21) { animation-delay: 1.9s; }
.letter:nth-child(22) { animation-delay: 2.0s; }
.letter:nth-child(23) { animation-delay: 2.1s; }

.space {
    width: 1rem;
    display: inline-block;
}

.exclamation {
    color: #ff6b6b;
    animation: pulse 1s ease-in-out infinite;
}

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

@keyframes letterBounce {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

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

/* Cake Container */
.cake-container {
    margin: 2rem 0;
    perspective: 1000px;
}

.cake {
    position: relative;
    display: inline-block;
    animation: cakeRotate 4s ease-in-out infinite;
}

@keyframes cakeRotate {
    0%, 100% { transform: rotateY(0deg) scale(1); }
    50% { transform: rotateY(10deg) scale(1.1); }
}

.cake-layer {
    width: 250px;
    height: 60px;
    border-radius: 100px;
    position: relative;
    margin: 0 auto;
}

.layer1 {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    z-index: 3;
    animation: layerFloat 3s ease-in-out infinite;
}

.layer2 {
    background: linear-gradient(45deg, #4ecdc4, #6dd5d5);
    z-index: 2;
    margin-top: -10px;
    animation: layerFloat 3s ease-in-out infinite 0.5s;
}

.layer3 {
    background: linear-gradient(45deg, #45b7d1, #6bc5d5);
    z-index: 1;
    margin-top: -10px;
    animation: layerFloat 3s ease-in-out infinite 1s;
}

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

.candles {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 280px;
    justify-content: center;
    align-items: center;
}

.candle {
    width: 12px;
    height: 40px;
    background: linear-gradient(to bottom, #ffd700, #ffed4e);
    border-radius: 6px;
    position: relative;
    animation: candleFlicker 2s ease-in-out infinite;
}

.candle1 { animation-delay: 0s; }
.candle2 { animation-delay: 0.1s; }
.candle3 { animation-delay: 0.2s; }
.candle4 { animation-delay: 0.3s; }
.candle5 { animation-delay: 0.4s; }
.candle6 { animation-delay: 0.5s; }
.candle7 { animation-delay: 0.6s; }
.candle8 { animation-delay: 0.7s; }
.candle9 { animation-delay: 0.8s; }
.candle10 { animation-delay: 0.9s; }
.candle11 { animation-delay: 1.0s; }
.candle12 { animation-delay: 1.1s; }

@keyframes candleFlicker {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(1deg); }
    50% { transform: rotate(-1deg); }
    75% { transform: rotate(0.5deg); }
}

.flame {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 20px;
    background: radial-gradient(circle, #ff6b6b, #ff8e8e, #ffa500);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flameFlicker 1.5s ease-in-out infinite;
}

.flame1 { animation-delay: 0s; }
.flame2 { animation-delay: 0.1s; }
.flame3 { animation-delay: 0.2s; }
.flame4 { animation-delay: 0.3s; }
.flame5 { animation-delay: 0.4s; }
.flame6 { animation-delay: 0.5s; }
.flame7 { animation-delay: 0.6s; }
.flame8 { animation-delay: 0.7s; }
.flame9 { animation-delay: 0.8s; }
.flame10 { animation-delay: 0.9s; }
.flame11 { animation-delay: 1.0s; }
.flame12 { animation-delay: 1.1s; }

@keyframes flameFlicker {
    0%, 100% { transform: translateX(-50%) scale(1) rotate(0deg); }
    25% { transform: translateX(-50%) scale(1.1) rotate(2deg); }
    50% { transform: translateX(-50%) scale(0.9) rotate(-1deg); }
    75% { transform: translateX(-50%) scale(1.05) rotate(1deg); }
}

/* Party Elements */
.party-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.party-emoji {
    position: absolute;
    font-size: 2rem;
    animation: partyFloat 4s ease-in-out infinite;
}

.emoji1 {
    top: 15%;
    left: 15%;
    animation-delay: 0s;
}

.emoji2 {
    top: 25%;
    right: 20%;
    animation-delay: 0.5s;
}

.emoji3 {
    top: 65%;
    left: 10%;
    animation-delay: 1s;
}

.emoji4 {
    top: 75%;
    right: 15%;
    animation-delay: 1.5s;
}

.emoji5 {
    top: 45%;
    left: 25%;
    animation-delay: 2s;
}

.emoji6 {
    top: 35%;
    right: 30%;
    animation-delay: 2.5s;
}

@keyframes partyFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg) scale(1); }
    25% { transform: translateY(-15px) rotate(5deg) scale(1.1); }
    50% { transform: translateY(-8px) rotate(-3deg) scale(0.9); }
    75% { transform: translateY(-12px) rotate(2deg) scale(1.05); }
}

/* Floating Hearts */
.hearts {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.heart {
    position: absolute;
    font-size: 1.5rem;
    animation: heartFloat 5s ease-in-out infinite;
}

.heart1 {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.heart2 {
    top: 30%;
    right: 25%;
    animation-delay: 1s;
}

.heart3 {
    top: 60%;
    left: 15%;
    animation-delay: 2s;
}

.heart4 {
    top: 70%;
    right: 20%;
    animation-delay: 3s;
}

.heart5 {
    top: 50%;
    left: 30%;
    animation-delay: 4s;
}

@keyframes heartFloat {
    0%, 100% { transform: translateY(0px) scale(1); }
    25% { transform: translateY(-20px) scale(1.2); }
    50% { transform: translateY(-10px) scale(0.8); }
    75% { transform: translateY(-15px) scale(1.1); }
}

/* Games Section */
.games-section {
    height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
    padding: 6rem 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 10;
}

.games-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    animation: titleBounce 2s ease-in-out infinite;
}

.games-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
    justify-content: center;
    align-items: stretch;
}

.game-card {
    flex: 0 0 calc(33.333% - 1rem);
    min-width: 200px;
    max-width: 250px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

/* For the last two cards, make them centered in the second row */
.game-card:nth-child(4) {
    flex: 0 0 calc(50% - 0.75rem);
    max-width: 300px;
}

.game-card:nth-child(5) {
    flex: 0 0 calc(50% - 0.75rem);
    max-width: 300px;
}

.game-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border-color: #ff6b6b;
}

.game-card:active {
    transform: translateY(-5px) scale(1.02);
}

.game-preview {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.preview-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tic-Tac-Toe Preview */
.tic-tac-toe-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    width: 80px;
    height: 80px;
}

.cell {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

/* Snake Preview */
.snake-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.snake-dot {
    width: 12px;
    height: 12px;
    background: #4ecdc4;
    border-radius: 50%;
    animation: snakeMove 2s ease-in-out infinite;
}

.snake-dot:nth-child(2) { animation-delay: 0.2s; }
.snake-dot:nth-child(3) { animation-delay: 0.4s; }
.snake-dot:nth-child(4) { animation-delay: 0.6s; }

.food-dot {
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    border-radius: 50%;
    animation: foodPulse 1.5s ease-in-out infinite;
}

@keyframes snakeMove {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

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

/* Table Tennis Preview */
.tennis-preview {
    position: relative;
    width: 100px;
    height: 60px;
    background: linear-gradient(to bottom, #87CEEB, #98FB98);
    border-radius: 5px;
    overflow: hidden;
}

.paddle {
    position: absolute;
    width: 8px;
    height: 20px;
    background: #fff;
    border-radius: 2px;
    top: 50%;
    transform: translateY(-50%);
    animation: paddleMove 2s ease-in-out infinite;
}

.paddle.left {
    left: 10px;
}

.paddle.right {
    right: 10px;
    animation-delay: 1s;
}

.ball {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ff6b6b;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: ballBounce 1.5s ease-in-out infinite;
}

.net {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #fff;
    transform: translateX(-50%);
}

@keyframes paddleMove {
    0%, 100% { transform: translateY(-50%); }
    50% { transform: translateY(-70%); }
}

@keyframes ballBounce {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(-30%, -30%); }
    50% { transform: translate(-50%, -50%); }
    75% { transform: translate(-70%, -30%); }
}

/* Endless Runner Preview */
.runner-preview {
    position: relative;
    width: 100px;
    height: 60px;
    background: linear-gradient(to bottom, #87CEEB, #90EE90);
    border-radius: 5px;
    overflow: hidden;
}

.runner {
    position: absolute;
    width: 8px;
    height: 12px;
    background: #ff6b6b;
    border-radius: 2px;
    bottom: 20px;
    left: 20px;
    animation: runnerJump 1.5s ease-in-out infinite;
}

.obstacle {
    position: absolute;
    width: 6px;
    height: 15px;
    background: #8B4513;
    bottom: 20px;
    border-radius: 2px;
    animation: obstacleMove 2s linear infinite;
}

.obstacle:nth-child(2) {
    right: 30px;
    animation-delay: 0s;
}

.obstacle:nth-child(3) {
    right: 60px;
    animation-delay: 1s;
}

.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: #90EE90;
}

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

@keyframes obstacleMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-120px); }
}

/* Jump & Run Preview */
.jump-preview {
    position: relative;
    width: 100px;
    height: 60px;
    background: linear-gradient(to bottom, #87CEEB, #DDA0DD);
    border-radius: 5px;
    overflow: hidden;
}

.jumper {
    position: absolute;
    width: 8px;
    height: 12px;
    background: #4ecdc4;
    border-radius: 2px;
    bottom: 20px;
    left: 20px;
    animation: jumperMove 2s ease-in-out infinite;
}

.platform {
    position: absolute;
    height: 8px;
    background: #8B4513;
    border-radius: 2px;
    bottom: 20px;
    animation: platformMove 3s linear infinite;
}

.platform:nth-child(2) {
    width: 20px;
    right: 20px;
    animation-delay: 0s;
}

.platform:nth-child(3) {
    width: 15px;
    right: 50px;
    bottom: 35px;
    animation-delay: 1s;
}

.platform:nth-child(4) {
    width: 25px;
    right: 80px;
    bottom: 15px;
    animation-delay: 2s;
}

@keyframes jumperMove {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-20px) translateX(10px); }
    50% { transform: translateY(-10px) translateX(20px); }
    75% { transform: translateY(-15px) translateX(30px); }
}

@keyframes platformMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-120px); }
}

.game-name {
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .birthday-title {
        font-size: 2.5rem;
    }
    
    .cake-layer {
        width: 120px;
        height: 30px;
    }
    
    .candles {
        width: 140px;
        gap: 6px;
    }
    
    .candle {
        width: 8px;
        height: 25px;
    }
    
    .flame {
        width: 6px;
        height: 12px;
    }
    
    .games-section {
        margin-top: 2rem;
        padding: 1.5rem;
    }
    
    .games-title {
        font-size: 2rem;
    }
    
    .games-grid {
        gap: 1rem;
        max-width: 700px;
    }
    
    .game-card {
        flex: 0 0 calc(50% - 0.5rem);
        min-width: 150px;
        max-width: 200px;
    }
    
    .game-card:nth-child(4) {
        flex: 0 0 calc(50% - 0.5rem);
        max-width: 200px;
    }
    
    .game-card:nth-child(5) {
        flex: 0 0 calc(50% - 0.5rem);
        max-width: 200px;
    }
    
    .game-preview {
        height: 100px;
    }
}

@media (max-width: 480px) {
    .birthday-title {
        font-size: 2rem;
    }
    
    .balloon, .party-emoji, .heart {
        font-size: 1.5rem;
    }
    
    .cake-layer {
        width: 100px;
        height: 25px;
    }
    
    .candles {
        width: 120px;
        gap: 4px;
    }
    
    .candle {
        width: 6px;
        height: 20px;
    }
    
    .flame {
        width: 5px;
        height: 10px;
    }
    
    .games-section {
        margin-top: 1.5rem;
        padding: 1rem;
    }
    
    .games-title {
        font-size: 1.5rem;
    }
    
    .games-grid {
        gap: 0.8rem;
        max-width: 400px;
    }
    
    .game-card {
        flex: 0 0 calc(50% - 0.4rem);
        min-width: 120px;
        max-width: 150px;
        padding: 0.8rem;
    }
    
    .game-card:nth-child(4) {
        flex: 0 0 calc(50% - 0.4rem);
        max-width: 150px;
    }
    
    .game-card:nth-child(5) {
        flex: 0 0 calc(50% - 0.4rem);
        max-width: 150px;
    }
    
    .game-preview {
        height: 80px;
    }
    
    .game-name {
        font-size: 1rem;
    }
}
