/* ╔══════════════════════════════════════════════════════════════╗
   ║  Birthday App — Kawaii Maximalism / Exquisite Coquette       ║
   ║  极繁主义梦幻可爱风                                           ║
   ╚══════════════════════════════════════════════════════════════╝ */

/* ===== CSS Variables ===== */
:root {
    --bday-pink: #FFB6C1;
    --bday-pink-deep: #FF8FAB;
    --bday-pink-light: #FFE4EC;
    --bday-pink-pale: #FFF0F5;
    --bday-cream: #FFFDD0;
    --bday-lavender: #E8D5F5;
    --bday-lavender-deep: #C9A7EB;
    --bday-mint: #D4F0E7;
    --bday-mint-deep: #98D8C8;
    --bday-yellow: #FFF3C4;
    --bday-yellow-deep: #FFD93D;
    --bday-blue: #D6EAF8;
    --bday-white: #FFFBFE;
    --bday-text: #5C4A5A;
    --bday-text-light: #9B8A98;
    --bday-text-faint: #C4B5C2;
    --bday-shadow-pink: rgba(255, 182, 193, 0.35);
    --bday-shadow-lavender: rgba(200, 167, 235, 0.25);
    --bday-glow-pink: rgba(255, 143, 171, 0.5);
    --bday-glass: rgba(255, 251, 254, 0.72);
    --bday-glass-border: rgba(255, 182, 193, 0.4);
    --bday-radius: 20px;
    --bday-radius-lg: 28px;
    --bday-radius-sm: 12px;
    --bday-font: 'Gaegu', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== Base Container ===== */
#birthdayApp {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
    font-family: var(--bday-font);
    color: var(--bday-text);
    overflow: hidden;
}

/* ===== Effects Layers ===== */
.bday-effects-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 5;
}

.bday-particle-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}


/* ===== Birthday Page Base ===== */
.birthday-page {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ===== Gingham Background Pattern ===== */
.bday-page-setup,
.bday-page-countdown {
    background:
        linear-gradient(135deg, var(--bday-pink-pale) 0%, var(--bday-lavender) 50%, var(--bday-pink-light) 100%);
}

.bday-page-setup::before,
.bday-page-countdown::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image:
        linear-gradient(45deg, rgba(255,182,193,0.08) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,182,193,0.08) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,182,193,0.08) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,182,193,0.08) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    pointer-events: none;
    z-index: 0;
}

/* ===== Background Decorations ===== */
.bday-bg-deco {
    position: absolute;
    font-size: 24px;
    opacity: 0.3;
    animation: bdayFloat 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}
.bday-bg-deco-1 { top: 10%; left: 8%; animation-delay: 0s; font-size: 20px; }
.bday-bg-deco-2 { top: 15%; right: 12%; animation-delay: 1.5s; font-size: 16px; }
.bday-bg-deco-3 { bottom: 20%; left: 15%; animation-delay: 3s; font-size: 22px; }
.bday-bg-deco-4 { bottom: 25%; right: 10%; animation-delay: 4.5s; font-size: 14px; }

@keyframes bdayFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(8deg); }
}

/* ===== Back Button ===== */
.bday-back-btn {
    position: absolute;
    top: calc(env(safe-area-inset-top, 44px) + 8px);
    left: 12px;
    width: 36px; height: 36px;
    background: var(--bday-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid var(--bday-glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bday-pink-deep);
    font-size: 14px;
    cursor: pointer;
    z-index: 50;
    box-shadow: 0 2px 8px var(--bday-shadow-pink);
    transition: transform 0.15s, box-shadow 0.15s;
}
.bday-back-btn:active {
    transform: scale(0.9);
    box-shadow: 0 1px 4px var(--bday-shadow-pink);
}

/* ===== Setup Page ===== */
.bday-setup-card {
    position: relative;
    z-index: 2;
    width: 85%;
    max-width: 340px;
    background: var(--bday-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px dashed var(--bday-pink);
    border-radius: var(--bday-radius-lg);
    padding: 32px 24px;
    text-align: center;
    box-shadow:
        0 8px 32px var(--bday-shadow-pink),
        0 2px 8px var(--bday-shadow-lavender),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.bday-setup-deco {
    font-size: 40px;
    margin-bottom: 8px;
    animation: bdayFloat 3s ease-in-out infinite;
}

.bday-setup-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--bday-pink-deep);
    margin-bottom: 4px;
}

.bday-setup-subtitle {
    font-size: 14px;
    color: var(--bday-text-light);
    margin-bottom: 20px;
}

.bday-input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.bday-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bday-pink);
    font-size: 16px;
}

.bday-date-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 2px solid var(--bday-pink-light);
    border-radius: var(--bday-radius-sm);
    background: rgba(255,255,255,0.6);
    font-size: 16px;
    font-family: var(--bday-font);
    color: var(--bday-text);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.bday-date-input:focus {
    border-color: var(--bday-pink);
    box-shadow: 0 0 0 3px rgba(255,182,193,0.2);
}

.bday-setup-extras {
    text-align: left;
    margin-bottom: 16px;
}

.bday-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--bday-text-light);
    cursor: pointer;
    margin-bottom: 8px;
}

.bday-checkbox-label input[type="checkbox"] {
    display: none;
}

.bday-checkbox-custom {
    width: 18px; height: 18px;
    border: 2px solid var(--bday-pink);
    border-radius: 5px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.bday-checkbox-label input:checked + .bday-checkbox-custom {
    background: var(--bday-pink);
    border-color: var(--bday-pink-deep);
}

.bday-checkbox-label input:checked + .bday-checkbox-custom::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.bday-lunar-input-wrap {
    margin-top: 8px;
}

/* ===== Buttons ===== */
.bday-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--bday-radius);
    font-family: var(--bday-font);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.bday-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 50%);
    border-radius: inherit;
    pointer-events: none;
}

.bday-btn-primary {
    background: linear-gradient(135deg, var(--bday-pink) 0%, var(--bday-pink-deep) 100%);
    color: #fff;
    box-shadow:
        0 4px 14px var(--bday-shadow-pink),
        0 2px 0 rgba(0,0,0,0.05);
}
.bday-btn-primary:active {
    transform: translateY(2px) scale(0.97);
    box-shadow: 0 1px 4px var(--bday-shadow-pink);
}

.bday-btn-secondary {
    background: var(--bday-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid var(--bday-glass-border);
    color: var(--bday-pink-deep);
    box-shadow: 0 2px 8px var(--bday-shadow-pink);
}
.bday-btn-secondary:active {
    transform: translateY(1px) scale(0.97);
}

.bday-btn-glow {
    animation: bdayBtnGlow 2s ease-in-out infinite;
}

@keyframes bdayBtnGlow {
    0%, 100% { box-shadow: 0 4px 14px var(--bday-shadow-pink); }
    50% { box-shadow: 0 4px 24px var(--bday-glow-pink), 0 0 40px rgba(255,143,171,0.2); }
}

.bday-btn-icon {
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    background: var(--bday-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid var(--bday-glass-border);
    border-radius: var(--bday-radius);
    color: var(--bday-text);
    font-size: 12px;
    min-width: 60px;
    box-shadow: 0 3px 10px var(--bday-shadow-pink);
}
.bday-btn-icon:active {
    transform: scale(0.93);
}
.bday-btn-emoji {
    font-size: 22px;
}

/* ===== Countdown Page ===== */
.bday-page-countdown {
    padding-top: calc(env(safe-area-inset-top, 44px) + 16px);
    padding-bottom: 0;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.bday-countdown-main {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 20px 20px;
    gap: 18px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}



.bday-countdown-label-top {
    font-size: 16px;
    color: var(--bday-text-light);
    letter-spacing: 2px;
}

/* ===== Flip Clock ===== */
.bday-countdown-flipboard {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bday-flip-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.bday-flip-card {
    position: relative;
    width: 52px;
    height: 64px;
    perspective: 300px;
}

.bday-flip-top,
.bday-flip-bottom {
    position: absolute;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: var(--bday-pink-deep);
    background: var(--bday-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid var(--bday-glass-border);
    box-sizing: border-box;
}

.bday-flip-top {
    top: 0;
    height: 50%;
    border-radius: var(--bday-radius-sm) var(--bday-radius-sm) 0 0;
    border-bottom: 1px solid rgba(255,182,193,0.2);
    overflow: hidden;
    box-shadow: 0 -2px 8px rgba(255,182,193,0.1);
}

.bday-flip-bottom {
    bottom: 0;
    height: 50%;
    border-radius: 0 0 var(--bday-radius-sm) var(--bday-radius-sm);
    border-top: none;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--bday-shadow-pink);
}

.bday-flip-separator {
    font-size: 24px;
    font-weight: 700;
    color: var(--bday-pink);
    animation: bdayBlink 1s infinite;
    margin-bottom: 20px;
}

@keyframes bdayBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.bday-flip-unit {
    font-size: 11px;
    color: var(--bday-text-light);
    font-weight: 700;
}

/* ===== Progress Ring ===== */
.bday-progress-ring-wrap {
    position: relative;
    width: 100px;
    height: 100px;
}

.bday-progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.bday-ring-bg {
    fill: none;
    stroke: rgba(255,182,193,0.2);
    stroke-width: 8;
}

.bday-ring-fill {
    fill: none;
    stroke: var(--bday-pink-deep);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 1s ease;
    filter: drop-shadow(0 0 6px var(--bday-glow-pink));
}

.bday-ring-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 700;
    color: var(--bday-pink-deep);
}

/* ===== Info Cards ===== */
.bday-info-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 320px;
}

.bday-info-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bday-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid var(--bday-glass-border);
    border-radius: var(--bday-radius-sm);
    box-shadow: 0 2px 8px var(--bday-shadow-pink);
}

.bday-info-icon {
    font-size: 20px;
}

.bday-info-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--bday-text);
}

/* ===== Daily Quote ===== */
.bday-daily-quote {
    width: 100%;
    max-width: 320px;
    padding: 14px 18px;
    background: var(--bday-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px dashed var(--bday-pink);
    border-radius: var(--bday-radius);
    font-size: 14px;
    color: var(--bday-text-light);
    line-height: 1.6;
    text-align: center;
    box-shadow: 0 2px 10px var(--bday-shadow-pink);
}

.bday-daily-quote i {
    color: var(--bday-pink);
    margin-right: 6px;
    font-size: 12px;
}

/* ===== Countdown Bottom Buttons ===== */
.bday-countdown-btns {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 16px 20px;
    padding-bottom: calc(env(safe-area-inset-bottom, 34px) + 16px);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}


/* ===== Party Page ===== */
.bday-page-party {
    background: linear-gradient(180deg, #1a0a2e 0%, #2d1b4e 30%, #16213e 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}


.bday-page-party::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,143,171,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 60%, rgba(200,167,235,0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 90%, rgba(255,215,0,0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.bday-party-scroll {
    position: relative;
    z-index: 10;
    flex: 1;
    width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 16px 20px;
    padding-bottom: calc(env(safe-area-inset-bottom, 34px) + 20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 0;
    box-sizing: border-box;
}

/* ===== Effects Bar ===== */
.bday-party-effects-bar {
    position: relative;
    z-index: 10;
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    margin-top: calc(env(safe-area-inset-top, 44px) + 8px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 0;
}

.bday-party-effects-bar::-webkit-scrollbar { display: none; }

.bday-effect-toggle {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.bday-effect-toggle.active {
    border-color: var(--bday-pink);
    background: rgba(255,143,171,0.25);
    box-shadow: 0 0 12px var(--bday-glow-pink);
}
.bday-effect-toggle:active {
    transform: scale(0.85);
}

/* ===== Neon Header ===== */
.bday-neon-header {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    flex-wrap: wrap;
}

.bday-neon-letter {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    text-shadow:
        0 0 7px var(--bday-pink),
        0 0 10px var(--bday-pink),
        0 0 21px var(--bday-pink),
        0 0 42px var(--bday-pink-deep),
        0 0 82px var(--bday-pink-deep);
    animation: bdayNeonFlicker 3s ease-in-out infinite;
    display: inline-block;
}

.bday-neon-letter[data-delay="1"] { animation-delay: 0.1s; }
.bday-neon-letter[data-delay="2"] { animation-delay: 0.2s; }
.bday-neon-letter[data-delay="3"] { animation-delay: 0.3s; }
.bday-neon-letter[data-delay="4"] { animation-delay: 0.4s; }
.bday-neon-letter[data-delay="5"] { animation-delay: 0.5s; }
.bday-neon-letter[data-delay="6"] { animation-delay: 0.6s; }
.bday-neon-letter[data-delay="7"] { animation-delay: 0.7s; }
.bday-neon-letter[data-delay="8"] { animation-delay: 0.8s; }
.bday-neon-letter[data-delay="9"] { animation-delay: 0.9s; }
.bday-neon-letter[data-delay="10"] { animation-delay: 1.0s; }
.bday-neon-letter[data-delay="11"] { animation-delay: 1.1s; }
.bday-neon-letter[data-delay="12"] { animation-delay: 1.2s; }
.bday-neon-letter[data-delay="13"] { animation-delay: 1.3s; }

.bday-neon-space {
    width: 14px;
}

@keyframes bdayNeonFlicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow:
            0 0 7px var(--bday-pink),
            0 0 10px var(--bday-pink),
            0 0 21px var(--bday-pink),
            0 0 42px var(--bday-pink-deep),
            0 0 82px var(--bday-pink-deep);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* ===== Section Common ===== */
.bday-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.bday-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px rgba(255,182,193,0.5);
    text-align: center;
}

.bday-party-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
    margin-top: 12px;
}

/* ===== Letter Section ===== */
.bday-letter-envelope {
    width: 100%;
    max-width: 340px;
    position: relative;
    cursor: pointer;
}

.bday-envelope-flap {
    width: 100%;
    height: 60px;
    background: linear-gradient(135deg, var(--bday-pink-light) 0%, var(--bday-lavender) 100%);
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    position: relative;
    z-index: 2;
    transition: transform 0.6s ease;
    transform-origin: top center;
    border: 1.5px dashed var(--bday-pink);
}

.bday-envelope-body {
    background: linear-gradient(180deg, var(--bday-cream) 0%, #fff 100%);
    border: 2px dashed var(--bday-pink);
    border-top: none;
    border-radius: 0 0 var(--bday-radius) var(--bday-radius);
    padding: 20px;
    margin-top: -2px;
    box-shadow:
        0 8px 24px var(--bday-shadow-pink),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.bday-letter-paper {
    background: #fff;
    border: 1px solid rgba(255,182,193,0.2);
    border-radius: var(--bday-radius-sm);
    padding: 20px;
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.bday-letter-paper::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(
        transparent,
        transparent 27px,
        rgba(255,182,193,0.15) 27px,
        rgba(255,182,193,0.15) 28px
    );
    pointer-events: none;
}

.bday-letter-content {
    font-size: 14px;
    line-height: 28px;
    color: var(--bday-text);
    position: relative;
    z-index: 1;
    white-space: pre-wrap;
}

/* ===== Cake Customizer ===== */
.bday-cake-customizer {
    width: 100%;
    max-width: 340px;
    background: var(--bday-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: var(--bday-radius-lg);
    padding: 24px 20px;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.bday-cake-customizer .bday-section-title {
    margin-bottom: 16px;
}

.bday-cake-option {
    margin-bottom: 16px;
}

.bday-cake-option label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255,255,255,0.8);
    margin-bottom: 8px;
}

.bday-option-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bday-opt-btn {
    padding: 8px 12px;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: var(--bday-radius-sm);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    font-family: var(--bday-font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.bday-opt-btn.active {
    background: rgba(255,143,171,0.3);
    border-color: var(--bday-pink);
    color: #fff;
    box-shadow: 0 0 10px rgba(255,143,171,0.3);
}
.bday-opt-btn:active {
    transform: scale(0.93);
}

.bday-text-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: var(--bday-radius-sm);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-family: var(--bday-font);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.bday-text-input:focus {
    border-color: var(--bday-pink);
    box-shadow: 0 0 0 3px rgba(255,143,171,0.15);
}
.bday-text-input::placeholder {
    color: rgba(255,255,255,0.3);
}

/* ===== Cake Arena ===== */
.bday-cake-arena {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.bday-cake-hint {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    text-align: center;
    animation: bdayPulse 2s ease-in-out infinite;
}

@keyframes bdayPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.bday-cake-stage {
    position: relative;
    width: 260px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

/* ===== Dynamic Cake Layers ===== */
.bday-cake-layer {
    width: 100%;
    position: relative;
    border-radius: 8px 8px 10px 10px;
    transition: all 0.3s;
    cursor: pointer;
}

.bday-cake-layer:hover {
    filter: brightness(1.05);
}

.bday-cake-layer-1 { width: 100%; height: 50px; }
.bday-cake-layer-2 { width: 85%; height: 45px; }
.bday-cake-layer-3 { width: 70%; height: 40px; }
.bday-cake-layer-4 { width: 58%; height: 35px; }
.bday-cake-layer-5 { width: 46%; height: 30px; }

.bday-cake-plate {
    width: 110%;
    height: 14px;
    background: linear-gradient(180deg, #f0e6d3 0%, #d4c5a9 100%);
    border-radius: 50%;
    margin-top: 2px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.bday-cake-text-display {
    position: absolute;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    pointer-events: none;
    white-space: nowrap;
}

/* ===== Candle ===== */
.bday-candle-item {
    position: absolute;
    width: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}
.bday-candle-item:active {
    transform: scale(1.15);
}

.bday-candle-body {
    width: 6px;
    height: 28px;
    background: linear-gradient(180deg, #FFD93D 0%, #FF6B6B 100%);
    border-radius: 2px;
}

.bday-candle-flame {
    width: 10px;
    height: 16px;
    background: radial-gradient(circle at 50% 80%, #fff 0%, #FFD93D 40%, #FF6B6B 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    opacity: 0;
    transition: opacity 0.3s;
    filter: blur(0.5px);
}

.bday-candle-flame.lit {
    opacity: 1;
    animation: bdayFlameFlicker 0.4s infinite alternate;
}

@keyframes bdayFlameFlicker {
    0% { transform: scale(1) rotate(-2deg); }
    100% { transform: scale(1.15) rotate(2deg); }
}

/* ===== Decoration Toolbar ===== */
.bday-deco-toolbar {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--bday-radius);
    border: 1px solid rgba(255,255,255,0.1);
}

.bday-deco-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px;
    border: 1.5px solid transparent;
    border-radius: var(--bday-radius-sm);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}
.bday-deco-btn span {
    font-size: 20px;
}
.bday-deco-btn small {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    font-family: var(--bday-font);
}
.bday-deco-btn.active {
    border-color: var(--bday-pink);
    background: rgba(255,143,171,0.15);
}
.bday-deco-btn.active small {
    color: var(--bday-pink);
}

/* ===== Cake Decoration Items ===== */
.bday-deco-item {
    position: absolute;
    font-size: 16px;
    cursor: grab;
    transition: transform 0.1s;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
    z-index: 5;
}
.bday-deco-item:active {
    cursor: grabbing;
    transform: scale(1.2);
}

/* ===== Candle Phase ===== */
.bday-candle-phase {
    text-align: center;
}

.bday-candle-hint {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 10px;
}

/* ===== Wish Modal ===== */
.bday-wish-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.bday-wish-modal-inner {
    width: 85%;
    max-width: 320px;
    background: linear-gradient(135deg, #1a0a2e 0%, #2d1b4e 100%);
    border: 2px solid rgba(255,182,193,0.3);
    border-radius: var(--bday-radius-lg);
    padding: 30px 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.bday-wish-stars {
    font-size: 20px;
    letter-spacing: 8px;
    margin-bottom: 10px;
    color: var(--bday-yellow-deep);
    animation: bdayPulse 2s ease-in-out infinite;
}

.bday-wish-modal-inner h3 {
    color: #fff;
    font-size: 18px;
    margin-bottom: 16px;
}

.bday-wish-textarea {
    width: 100%;
    height: 80px;
    padding: 12px;
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: var(--bday-radius-sm);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-family: var(--bday-font);
    font-size: 14px;
    resize: none;
    outline: none;
    box-sizing: border-box;
    margin-bottom: 16px;
}
.bday-wish-textarea:focus {
    border-color: var(--bday-pink);
}
.bday-wish-textarea::placeholder {
    color: rgba(255,255,255,0.3);
}

/* ===== Cut Cake ===== */
.bday-cut-phase {
    text-align: center;
    width: 100%;
}

.bday-cut-hint {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 10px;
}

.bday-cut-area {
    width: 100%;
    max-width: 300px;
    height: 200px;
    margin: 0 auto;
    background: rgba(255,255,255,0.05);
    border: 1.5px dashed rgba(255,255,255,0.2);
    border-radius: var(--bday-radius);
    position: relative;
    cursor: crosshair;
    overflow: hidden;
}

.bday-cut-line {
    position: absolute;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, transparent, var(--bday-yellow-deep), transparent);
    left: -10px;
    top: 0;
    transition: left 0.05s linear;
    box-shadow: 0 0 10px var(--bday-yellow-deep);
}

/* ===== Cake Photo ===== */
.bday-cake-photo {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.bday-photo-frame {
    background: #fff;
    padding: 12px;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transform: rotate(-2deg);
}

.bday-photo-frame canvas {
    display: block;
    border-radius: 2px;
}

/* ===== Friend Selector ===== */
.bday-friend-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    width: 100%;
}

.bday-friend-selector .select-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: var(--bday-radius);
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.05);
}

.bday-friend-selector .select-item.selected {
    border-color: var(--bday-pink);
    background: rgba(255,143,171,0.15);
    box-shadow: 0 0 15px rgba(255,143,171,0.2);
}

.bday-friend-selector .select-avatar {
    width: 50px; height: 50px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(255,255,255,0.2);
}

.bday-friend-selector .select-item.selected .select-avatar {
    border-color: var(--bday-pink);
}

.bday-friend-selector .select-item span {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    font-weight: 700;
    text-align: center;
}

/* ===== Dialogue Box ===== */
.bday-dialogue-box {
    width: 100%;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: var(--bday-radius);
    padding: 20px;
    min-height: 200px;
    max-height: 350px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* ===== Gift Unwrap Stage ===== */
.bday-gift-stage {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-height: 300px;
    justify-content: center;
}

.bday-gift-box-3d {
    position: relative;
    width: 160px;
    height: 160px;
    perspective: 600px;
}

.bday-gift-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s;
}
.bday-gift-wrapper:active {
    transform: scale(0.95);
}

.bday-gift-paper {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bday-pink) 0%, var(--bday-lavender-deep) 100%);
    border-radius: var(--bday-radius);
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255,255,255,0.1) 10px,
            rgba(255,255,255,0.1) 20px
        );
    box-shadow: 0 8px 30px rgba(255,143,171,0.3);
    animation: bdayGiftShake 1.5s ease-in-out infinite;
}

@keyframes bdayGiftShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(3deg); }
    75% { transform: rotate(-3deg); }
}

.bday-gift-ribbon-cross {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}
.bday-gift-ribbon-cross::before,
.bday-gift-ribbon-cross::after {
    content: '';
    position: absolute;
    background: var(--bday-yellow-deep);
}
.bday-gift-ribbon-cross::before {
    width: 16px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
}
.bday-gift-ribbon-cross::after {
    width: 100%;
    height: 16px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 2px;
}

.bday-gift-inner-box {
    width: 100%;
    height: 100%;
    position: relative;
}

.bday-gift-lid {
    width: 110%;
    height: 30px;
    background: linear-gradient(180deg, #f8e0e0 0%, #ecc8c8 100%);
    border-radius: 8px;
    position: absolute;
    top: -5px;
    left: -5%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.5s ease;
    transform-origin: left top;
}

.bday-gift-base {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #fff 0%, #fce4ec 100%);
    border-radius: var(--bday-radius-sm);
    border: 2px solid rgba(255,182,193,0.3);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.bday-gift-reveal {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.bday-gift-spotlight {
    position: absolute;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: bdaySpotlight 3s ease-in-out infinite;
}

@keyframes bdaySpotlight {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

.bday-gift-item {
    font-size: 60px;
    animation: bdayGiftBounce 1s ease-out;
}

@keyframes bdayGiftBounce {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}

.bday-gift-desc {
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    line-height: 1.6;
    max-width: 280px;
}

.bday-gift-sender {
    font-size: 13px;
    color: var(--bday-pink);
    font-weight: 700;
}

.bday-gift-rarity {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.bday-gift-rarity[data-rarity="common"] {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.2);
}
.bday-gift-rarity[data-rarity="rare"] {
    background: rgba(100,149,237,0.15);
    color: #6495ED;
    border: 1px solid rgba(100,149,237,0.3);
}
.bday-gift-rarity[data-rarity="epic"] {
    background: rgba(186,85,211,0.15);
    color: #BA55D3;
    border: 1px solid rgba(186,85,211,0.3);
}
.bday-gift-rarity[data-rarity="legendary"] {
    background: rgba(255,215,0,0.15);
    color: #FFD700;
    border: 1px solid rgba(255,215,0,0.3);
    box-shadow: 0 0 15px rgba(255,215,0,0.2);
}

.bday-gift-card {
    background: rgba(255,255,255,0.06);
    border: 1px dashed rgba(255,255,255,0.15);
    border-radius: var(--bday-radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    font-style: italic;
    max-width: 280px;
    line-height: 1.5;
}

.bday-gift-hint {
    font-size: 14px;
    color: rgba(255,255,255,0.5);
    animation: bdayPulse 2s ease-in-out infinite;
}

/* ===== Modal Overlays ===== */
.bday-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.bday-modal-card {
    width: 90%;
    max-width: 380px;
    max-height: auto;
    max-height: 80dvh;
    background: var(--bday-white);
    border-radius: var(--bday-radius-lg);
    border: 2px dashed var(--bday-pink);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px var(--bday-shadow-pink);
}


.bday-modal-large {
    max-width: 420px;
    max-height: auto;
    max-height: 85dvh;
}


.bday-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1.5px dashed var(--bday-pink-light);
    font-size: 16px;
    font-weight: 700;
    color: var(--bday-pink-deep);
}

.bday-modal-header .bday-back-btn {
    position: static;
    width: 32px; height: 32px;
    font-size: 12px;
}

.bday-modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px;
}

/* ===== Confetti Particles ===== */
.bday-confetti {
    position: absolute;
    width: 8px; height: 8px;
    pointer-events: none;
    z-index: 198;
    animation: bdayConfettiFall linear forwards;
}

@keyframes bdayConfettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(1080deg); opacity: 0; }
}

/* ===== Balloon ===== */
.bday-balloon {
    position: absolute;
    bottom: -80px;
    width: 40px;
    height: 52px;
    border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
    cursor: pointer;
    z-index: 197;
    animation: bdayBalloonFloat linear forwards;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

.bday-balloon::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.4);
    transform: translateX(-50%);
}

@keyframes bdayBalloonFloat {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-120vh) rotate(15deg); }
}

.bday-balloon-pop {
    animation: bdayBalloonPop 0.3s ease-out forwards !important;
}

@keyframes bdayBalloonPop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}

/* ===== Star Sparkle ===== */
.bday-star {
    position: absolute;
    pointer-events: none;
    z-index: 196;
    animation: bdayStarTwinkle ease-in-out infinite;
}

@keyframes bdayStarTwinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ===== Sakura Petal ===== */
.bday-sakura {
    position: absolute;
    width: 12px; height: 12px;
    pointer-events: none;
    z-index: 195;
    background: radial-gradient(circle at 30% 30%, var(--bday-pink-light), var(--bday-pink));
    border-radius: 50% 0 50% 0;
    opacity: 0.7;
    animation: bdaySakuraFall linear forwards;
}

@keyframes bdaySakuraFall {
    0% { transform: translateY(-20px) rotate(0deg) translateX(0); opacity: 0.7; }
    100% { transform: translateY(100vh) rotate(360deg) translateX(80px); opacity: 0; }
}

/* ===== Snowflake ===== */
.bday-snow {
    position: absolute;
    pointer-events: none;
    z-index: 195;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    animation: bdaySnowFall linear forwards;
}

@keyframes bdaySnowFall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0.3; }
}

/* ===== Meteor ===== */
.bday-meteor {
    position: absolute;
    width: 3px;
    height: 60px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, transparent 100%);
    pointer-events: none;
    z-index: 196;
    transform: rotate(-45deg);
    animation: bdayMeteorFall 1s linear forwards;
    border-radius: 2px;
}

@keyframes bdayMeteorFall {
    0% { transform: translate(0, 0) rotate(-45deg); opacity: 1; }
    100% { transform: translate(-300px, 300px) rotate(-45deg); opacity: 0; }
}

/* ===== Halo Pulse ===== */
.bday-halo {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--bday-pink);
    pointer-events: none;
    z-index: 194;
    animation: bdayHaloExpand 3s ease-out infinite;
}

@keyframes bdayHaloExpand {
    0% { width: 20px; height: 20px; opacity: 0.8; }
    100% { width: 200px; height: 200px; opacity: 0; margin-top: -90px; margin-left: -90px; }
}

/* ===== Rainbow ===== */
.bday-rainbow {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 40%;
    border-radius: 50% 50% 0 0;
    background: conic-gradient(
        from 180deg,
        #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff0088,
        transparent 50%
    );
    opacity: 0;
    pointer-events: none;
    z-index: 193;
    mask: radial-gradient(ellipse at 50% 100%, transparent 60%, black 61%, black 65%, transparent 66%);
    -webkit-mask: radial-gradient(ellipse at 50% 100%, transparent 60%, black 61%, black 65%, transparent 66%);
    transition: opacity 1s;
}

.bday-rainbow.active {
    opacity: 0.25;
}

/* ===== iOS / Android Compatibility ===== */
@supports not (height: 100dvh) {
    #birthdayApp { height: auto; height: -webkit-fill-available; }
}
@supports (height: 100dvh) {
    #birthdayApp { height: 100dvh; }
}
@supports (-webkit-touch-callout: none) {
    #birthdayApp { min-height: -webkit-fill-available; }
}

/* ===== Scrollbar Styling ===== */
#birthdayApp ::-webkit-scrollbar {
    width: 4px;
}
#birthdayApp ::-webkit-scrollbar-track {
    background: transparent;
}
#birthdayApp ::-webkit-scrollbar-thumb {
    background: var(--bday-pink-light);
    border-radius: 4px;
}

/* ===== Sub-page for Gift Cabinet / Wishing Well ===== */
#birthdayApp .sub-page {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bday-white);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

#birthdayApp .sub-header {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 54px;
    padding-top: env(safe-area-inset-top, 44px);
    border-bottom: 1.5px dashed var(--bday-pink-light);
    background: var(--bday-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#birthdayApp .sub-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--bday-pink-deep);
}

#birthdayApp .sub-header .back-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--bday-pink-deep);
    cursor: pointer;
    padding: 8px;
}
