:root {
    --primary: #ff9a9e;
    --secondary: #fad0c4;
    --accent: #ffecd2;
    --text-main: #5d4e60;
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-bg: rgba(255, 255, 255, 0.75);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Heiti SC", "WenQuanYi Micro Hei", "Noto Sans CJK SC", "Source Han Sans SC", Arial, sans-serif;
    color: var(--text-main);
    -webkit-tap-highlight-color: transparent;
}

/* --- BACKGROUND DECORATION --- */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.6;
    animation: floatOrb 15s infinite alternate ease-in-out;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle, #ff9a9e 0%, #fecfef 100%);
}

.orb-2 {
    bottom: -10%;
    right: -10%;
    width: 80vw;
    height: 80vw;
    background: radial-gradient(circle, #a18cd1 0%, #fbc2eb 100%);
    animation-delay: -5s;
}

.orb-3 {
    top: 40%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    background: #ffecd2;
    opacity: 0.4;
    animation-delay: -10s;
}

@keyframes floatOrb {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

/* --- LANDING --- */
#landing {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.landing-content {
    text-align: center;
    animation: fadeInUp 1s ease-out;
    z-index: 2;
}

.landing-content h1 {
    font-family: "Segoe Script", "Brush Script MT", "KaiTi", "FZKai-Z03", "STKaiti", cursive;
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: #444;
}

.landing-content p {
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.start-btn {
    font-size: 1.2rem;
    padding: 16px 48px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(255, 154, 158, 0.4);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: pulse 2s infinite;
}

.start-btn:active {
    transform: scale(0.95);
}

/* --- STAGE --- */
#stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through to bubbles */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.hero-container {
    text-align: center;
    position: relative;
    z-index: 5;
}

.hero-name {
    font-family: "KaiTi", "FZKai-Z03", "STKaiti", "HanziPen SC", "Yuanti SC", cursive;
    /* Chinese calligraphy style */
    font-size: 4.5rem;
    margin: 0;
    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.birthday-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #888;
    margin-top: -10px;
    margin-bottom: 10px;
    border: 1px solid white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.hero-subtitle {
    font-family: "Segoe Script", "Brush Script MT", "KaiTi", "FZKai-Z03", "STKaiti", cursive;
    font-size: 1.5rem;
    color: #777;
    margin: 0;
    letter-spacing: 1px;
}

/* --- LIFE COUNTER --- */
#life-counter {
    margin-top: 15px;
    font-size: 0.9rem;
    color: #888;
    font-weight: 400;
    opacity: 0.8;
}

#time-count {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #ff758c;
    font-size: 1.1rem;
    display: block;
    margin-top: 5px;
}

/* --- MODAL --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 85%;
    width: 320px;
    position: relative;
    border: 2px solid #ffeeba;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}

.modal-content h2 {
    font-family: "Segoe Script", "Brush Script MT", "KaiTi", "FZKai-Z03", "STKaiti", cursive;
    color: #d4a017;
    margin-top: 0;
}

.ticket-text {
    font-size: 1.1rem;
    color: #555;
    font-style: italic;
    line-height: 1.5;
    margin: 20px 0;
}

.ticket-sub {
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ticket-stamp {
    display: inline-block;
    border: 2px solid #ff758c;
    color: #ff758c;
    padding: 5px 10px;
    font-weight: bold;
    transform: rotate(-10deg);
    margin: 15px 0;
    opacity: 0.8;
}

.redeem-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: linear-gradient(to right, #ff758c, #ff7eb3);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- BUBBLES --- */
.bubble-container {
    position: absolute;
    bottom: -100px;
    z-index: 20;
    cursor: pointer;
    /* Animation set in JS */
    will-change: transform, opacity;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 14px 20px;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 80vw;
    transition: transform 0.2s;
}

.card:active {
    transform: scale(0.95);
}

.card.gold {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 248, 220, 0.9) 100%);
    border: 1px solid #ffeeba;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.25);
}

.card.gold .text {
    color: #d4a017;
    font-weight: 700;
}

.icon {
    font-size: 1.4rem;
}

.text {
    font-size: 1rem;
    color: #555;
    font-weight: 500;
}

/* --- ANIMATIONS --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 154, 158, 0.4);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(255, 154, 158, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 154, 158, 0);
    }
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0.8) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
        transform: translateY(-10vh) scale(1) rotate(2deg);
    }

    50% {
        transform: translateY(-50vh) rotate(-2deg);
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-120vh) rotate(1deg);
        opacity: 0;
    }
}

/* Burst Particles */
.particle {
    position: absolute;
    font-size: 20px;
    pointer-events: none;
    animation: burst 0.8s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
    z-index: 100;
}

@keyframes burst {
    0% {
        transform: translate(0, 0) scale(0.5);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(1.2);
        opacity: 0;
    }
}

/* --- MAGIC FEATURES --- */

/* 1. Growing Tree */
.tree-container {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    opacity: 0.6;
}

.tree {
    position: relative;
    width: 200px;
    height: 300px;
    transform-origin: bottom center;
    animation: growTree 2.5s ease-out forwards;
}

.trunk {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 0;
    background: linear-gradient(to top, #8b5a2b, #a0522d);
    border-radius: 5px;
    animation: growTrunk 1.5s ease-out forwards;
}

.leaves {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, #ff9a9e 0%, #fad0c4 100%);
    border-radius: 50%;
    opacity: 0.8;
    filter: blur(2px);
    animation: growLeaves 1.5s 1.2s ease-out forwards;
}

@keyframes growTrunk {
    to {
        height: 150px;
    }
}

@keyframes growLeaves {
    to {
        transform: translateX(-50%) scale(1);
    }
}

@keyframes growTree {
    from {
        transform: translateX(-50%) scale(0.5);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) scale(1);
        opacity: 0.6;
    }
}

/* 2. Wish Candle */
.candle-container {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    cursor: pointer;
    z-index: 50;
    transition: opacity 1s;
}

.candle {
    position: relative;
    width: 30px;
    height: 80px;
    background: linear-gradient(to right, #fff, #eee);
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.wick {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 10px;
    background: #333;
}

.flame {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 20px;
    background: radial-gradient(ellipse at bottom, #ffeb3b 0%, #ff9800 50%, rgba(255, 87, 34, 0) 100%);
    border-radius: 50% 50% 20% 20%;
    animation: flicker 0.1s infinite alternate;
    box-shadow: 0 0 10px #ffeb3b, 0 0 20px #ff9800;
}

.candle-text {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #888;
    text-align: center;
    white-space: nowrap;
    animation: pulseText 2s infinite;
}

@keyframes flicker {
    0% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateX(-50%) scale(0.9, 1.1);
        opacity: 0.8;
    }
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* 3. Heart Trail */
.heart-trail {
    position: fixed;
    pointer-events: none;
    font-size: 1.2rem;
    z-index: 9999;
    animation: fadeTrail 0.8s linear forwards;
}

@keyframes fadeTrail {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .tree {
        width: 150px;
        height: 200px;
    }

    .candle-container {
        bottom: 15%;
    }

    .hero-name {
        font-size: 3.5rem;
    }
}