/* ===== Birthday App 全屏适配修复 ===== */
#birthdayApp {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.birthday-container {
    flex: 1;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
    /* iOS安全区域适配 */
    padding-top: env(safe-area-inset-top, 44px);
    padding-bottom: env(safe-area-inset-bottom, 34px);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}


.birthday-setup {
    padding: 30px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    color: #333;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 80%;
}

.birthday-setup h2 {
    margin-bottom: 20px;
    color: #ff6b6b;
}

.birthday-setup input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ff9a9e;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 16px;
    text-align: center;
}

.countdown-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.countdown-number {
    font-size: 80px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.countdown-label {
    font-size: 20px;
    opacity: 0.9;
}

/* Birthday Party Mode */
.party-mode {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    padding-top: calc(env(safe-area-inset-top, 44px) + 16px);
    padding-bottom: calc(env(safe-area-inset-bottom, 34px) + 16px);
    overflow-y: auto;
}

.party-header {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-20px);}
    60% {transform: translateY(-10px);}
}

.cake-game {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    margin-bottom: 20px;
    position: relative;
}

.cake-base {
    width: 200px;
    height: 150px;
    background-color: #fce4ec;
    border: 4px solid #f48fb1;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px;
}
.cake-base::after {
    content: '🎂';
}

.cake-base:active {
    transform: scale(0.95);
}

.candle {
    width: 10px;
    height: 40px;
    background: #ffeb3b;
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 5px;
}

.flame {
    width: 15px;
    height: 25px;
    background: #ff5722;
    border-radius: 50% 50% 20% 20%;
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    animation: flicker 0.5s infinite alternate;
    display: none;
}

.flame.lit {
    display: block;
}

@keyframes flicker {
    0% {transform: translateX(-50%) scale(1);}
    100% {transform: translateX(-50%) scale(1.1);}
}

.letter-box {
    background: #fff;
    color: #333;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    font-family: 'Courier New', cursive;
    line-height: 1.6;
    text-align: left;
}

.party-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
}

.party-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 15px;
    background: #fff;
    color: #ff6b6b;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,0.1);
}

.party-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Select Friends Modal */
.friend-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
}

.select-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
}

.select-item.selected {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.select-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-size: cover;
}

/* Gift Box */
.gift-box {
    width: 100px;
    height: 100px;
    background: #ff4757;
    position: relative;
    margin: 0 auto;
    cursor: pointer;
    animation: shake 2s infinite;
}

.gift-lid {
    width: 110px;
    height: 30px;
    background: #ff6b81;
    position: absolute;
    top: -15px;
    left: -5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.gift-ribbon {
    width: 20px;
    height: 100%;
    background: #ffd32a;
    position: absolute;
    left: 40px;
}

@keyframes shake {
    0%, 100% {transform: rotate(0deg);}
    25% {transform: rotate(5deg);}
    75% {transform: rotate(-5deg);}
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f00;
    animation: fall linear forwards;
}

@keyframes fall {
    to {transform: translateY(100vh) rotate(720deg);}
}
/* ===== iOS/Android 兼容性修复 ===== */

/* 支持旧版浏览器的vh回退 */
@supports not (height: 100dvh) {
    #birthdayApp {
        height: auto;
        height: -webkit-fill-available;
    }
}

/* 支持动态视口高度 */
@supports (height: 100dvh) {
    #birthdayApp {
        height: 100dvh;
    }
}

/* 防止iOS Safari地址栏问题 */
@supports (-webkit-touch-callout: none) {
    #birthdayApp {
        min-height: -webkit-fill-available;
    }

    .birthday-container {
        min-height: -webkit-fill-available;
    }
}

/* 确保蛋糕游戏区域不会溢出 */
.cake-game {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* 信件盒子滚动优化 */
.letter-box {
    max-height: auto;
    -webkit-overflow-scrolling: touch;
}

/* 派对按钮组固定在底部 */
.party-actions {
    flex-shrink: 0;
    margin-top: auto;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
