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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    touch-action: pan-y;
}

/* Prevent zoom on double-tap */
button, a, input {
    touch-action: manipulation;
}

/* Fireworks Canvas */
#fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

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

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f0f;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Balloons */
.balloons {
    position: fixed;
    bottom: -150px;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.balloon {
    position: absolute;
    width: 60px;
    height: 75px;
    background: var(--color);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: float 6s ease-in-out infinite;
    animation-delay: var(--delay);
    bottom: -150px;
    left: calc(10% + var(--delay) * 10);
    box-shadow:
        inset -10px -10px 20px rgba(0, 0, 0, 0.1),
        0 10px 30px rgba(0, 0, 0, 0.3);
}

.balloon::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100px;
    background: rgba(255, 255, 255, 0.3);
}

.balloon::after {
    content: '🎈';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.3;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(-5deg);
    }
    25% {
        transform: translateY(-600px) translateX(30px) rotate(5deg);
    }
    50% {
        transform: translateY(-1200px) translateX(-30px) rotate(-5deg);
    }
    75% {
        transform: translateY(-1800px) translateX(30px) rotate(5deg);
    }
    100% {
        transform: translateY(-2400px) translateX(0) rotate(-5deg);
    }
}

/* Main Container */
.container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
    z-index: 3;
}

/* Birthday Card */
.birthday-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 3rem 2rem;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
    animation: cardEntrance 1s ease-out;
}

@keyframes cardEntrance {
    from {
        transform: scale(0.5) rotate(-5deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Stars */
.stars {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.stars span {
    animation: twinkle 1.5s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.2s);
}

.stars span:nth-child(1) { --i: 0; }
.stars span:nth-child(2) { --i: 1; }
.stars span:nth-child(3) { --i: 2; }
.stars span:nth-child(4) { --i: 3; }
.stars span:nth-child(5) { --i: 4; }

@keyframes twinkle {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.5;
    }
}

/* Birthday Title */
.birthday-title {
    font-size: 3.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b9d, #c06c84, #6c5ce7, #a29bfe);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s ease infinite;
    margin-bottom: 0.5rem;
}

.letter {
    display: inline-block;
    animation: bounce 0.6s ease-in-out;
    animation-delay: calc(var(--i) * 0.1s);
}

.letter:nth-child(1) { --i: 0; }
.letter:nth-child(2) { --i: 1; }
.letter:nth-child(3) { --i: 2; }
.letter:nth-child(4) { --i: 3; }
.letter:nth-child(5) { --i: 4; }

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

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

/* Age Container */
.age-container {
    display: inline-flex;
    align-items: baseline;
    margin-bottom: 1rem;
}

.age-number {
    font-size: 6rem;
    font-weight: bold;
    background: linear-gradient(45deg, #f093fb, #f5576c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 2s ease-in-out infinite;
}

.age-suffix {
    font-size: 2.5rem;
    color: #f5576c;
    font-weight: bold;
    margin-left: 0.2rem;
}

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

/* Birthday Subtitle */
.birthday-subtitle {
    font-size: 2.5rem;
    color: #6c5ce7;
    margin-bottom: 1rem;
    animation: slideIn 1s ease-out 0.5s both;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Name */
.name-container {
    margin: 2rem 0;
}

.name {
    font-size: 4rem;
    font-weight: bold;
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s ease infinite, nameGlow 2s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

@keyframes nameGlow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 30px rgba(245, 87, 108, 0.8));
    }
}

/* Birthday Photo */
.photo-container {
    position: relative;
    width: 250px;
    height: 250px;
    max-width: 90vw;
    max-height: 90vw;
    margin: 2rem auto;
    animation: photoEntrance 1s ease-out 0.8s both;
    overflow: hidden;
}

@keyframes photoEntrance {
    from {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.birthday-photo {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    border: 8px solid #fff;
    box-shadow:
        0 10px 40px rgba(102, 126, 234, 0.4),
        0 0 0 15px rgba(240, 147, 251, 0.2),
        inset 0 0 20px rgba(255, 255, 255, 0.3);
    animation: photoFloat 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
    display: block;
}

@keyframes photoFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow:
            0 10px 40px rgba(102, 126, 234, 0.4),
            0 0 0 15px rgba(240, 147, 251, 0.2);
    }
    50% {
        transform: translateY(-10px) scale(1.02);
        box-shadow:
            0 20px 50px rgba(245, 87, 108, 0.6),
            0 0 0 15px rgba(108, 92, 231, 0.3);
    }
}

.photo-frame {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #f5576c);
    background-size: 300% 300%;
    animation: frameRotate 4s linear infinite;
    z-index: 1;
    filter: blur(8px);
    opacity: 0.6;
}

@keyframes frameRotate {
    0% {
        background-position: 0% 50%;
        transform: rotate(0deg);
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
        transform: rotate(360deg);
    }
}

/* Cake */
.cake {
    position: relative;
    width: 200px;
    height: 180px;
    margin: 2rem auto;
    animation: cakeEntrance 1s ease-out 1s both;
}

@keyframes cakeEntrance {
    from {
        transform: translateY(50px) scale(0);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.cake-layer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.layer-1 {
    bottom: 0;
    width: 180px;
    height: 60px;
    background: linear-gradient(180deg, #ff6b9d, #f5576c);
}

.layer-2 {
    bottom: 55px;
    width: 140px;
    height: 50px;
    background: linear-gradient(180deg, #6c5ce7, #5f4db8);
}

.layer-3 {
    bottom: 100px;
    width: 100px;
    height: 40px;
    background: linear-gradient(180deg, #00cec9, #00b894);
}

.candle {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 40px;
    background: linear-gradient(180deg, #fff, #fdcb6e);
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.flame {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 25px;
    background: linear-gradient(180deg, #ff6b00, #feca57);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 0 0 20px #ff6b00;
    animation: flicker 0.3s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) scale(1.1);
        opacity: 0.8;
    }
}

/* Message */
.message {
    font-size: 1.2rem;
    color: #555;
    line-height: 1.8;
    margin: 2rem 0;
    animation: fadeIn 1s ease-out 1.5s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Surprise Button */
.surprise-btn {
    background: linear-gradient(45deg, #ff6b9d, #f5576c);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.3rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
    transition: all 0.3s ease;
    animation: buttonPulse 2s ease-in-out infinite;
    margin: 1rem 0;
}

.surprise-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(245, 87, 108, 0.6);
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
    }
    50% {
        box-shadow: 0 15px 50px rgba(245, 87, 108, 0.8);
    }
}

/* Wishes */
.wishes {
    margin-top: 2rem;
    animation: fadeIn 1s ease-out 2s both;
}

.wishes p {
    font-size: 1.1rem;
    color: #667eea;
    margin: 0.8rem 0;
    font-weight: 500;
}

/* Music Notes */
#music-notes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.music-note {
    position: absolute;
    font-size: 2rem;
    animation: floatNote 4s linear forwards;
}

@keyframes floatNote {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .birthday-title {
        font-size: 2.5rem;
    }

    .age-number {
        font-size: 4rem;
    }

    .age-suffix {
        font-size: 1.8rem;
    }

    .birthday-subtitle {
        font-size: 2rem;
    }

    .name {
        font-size: 3rem;
    }

    .photo-container {
        width: 200px;
        height: 200px;
        max-width: 60vw;
        max-height: 60vw;
        margin: 1.5rem auto;
    }

    .birthday-photo {
        border: 5px solid #fff;
    }

    .cake {
        transform: scale(0.8);
    }

    .message {
        font-size: 1rem;
    }

    .surprise-btn {
        font-size: 1.1rem;
        padding: 0.8rem 1.5rem;
    }
}
