/* ============================================
   🎉 今日快乐弹窗 - 独立 CSS 文件
   使用方式：<link rel="stylesheet" href="happy-popup.css">
   ============================================ */

/* ---------- 遮罩层 ---------- */
.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

/* 隐藏状态（JS 会加 .is-hidden） */
.popup-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ---------- 弹窗主体 ---------- */
.popup-box {
    position: relative;
    width: 420px;
    max-width: calc(100vw - 40px);
    padding: 48px 36px 36px;
    border-radius: 24px;
    background: linear-gradient(145deg, #ffffff 0%, #fdf2f8 50%, #eff6ff 100%);
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    text-align: center;
    transform: scale(1) translateY(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

/* 隐藏时弹窗缩小 */
.popup-overlay.is-hidden .popup-box {
    transform: scale(0.7) translateY(40px);
}

/* ---------- 顶部彩虹条 ---------- */
.popup-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg,
        #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #9b59b6, #ff6b9d, #ff6b6b);
    background-size: 200% 100%;
    animation: rainbow-slide 3s linear infinite;
}

@keyframes rainbow-slide {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* ---------- 关闭按钮 ---------- */
.popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: #888;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    text-decoration: none;
    z-index: 10;
}

.popup-close:hover {
    background: #ff6b6b;
    color: #fff;
    transform: rotate(90deg) scale(1.1);
}

.popup-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* ---------- Emoji 动画 ---------- */
.popup-emoji {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 12px;
    animation: emoji-bounce 1s ease infinite;
    display: inline-block;
}

@keyframes emoji-bounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25%      { transform: translateY(-12px) rotate(-8deg); }
    50%      { transform: translateY(0) rotate(0deg); }
    75%      { transform: translateY(-6px) rotate(8deg); }
}

/* ---------- 标题（流光渐变） ---------- */
.popup-title {
    font-size: 28px;
    font-weight: 800;
    margin: 8px 0 12px;
    background: linear-gradient(90deg, #ff6b6b, #ff9f43, #feca57, #48dbfb, #ff6b9d, #ff6b6b);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s ease infinite;
}

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

/* ---------- 描述文字 ---------- */
.popup-desc {
    font-size: 15px;
    color: #666;
    line-height: 1.8;
    margin: 0 0 28px;
}

/* ---------- 按钮 ---------- */
.popup-btn {
    display: inline-block;
    padding: 13px 44px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, #ff6b6b, #ff9f43);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.35);
}

.popup-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 14px 36px rgba(255, 107, 107, 0.5);
}

.popup-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ---------- 纸屑 ---------- */
.confetti {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    opacity: 0;
    animation: confetti-fall linear infinite;
}

.confetti:nth-child(1)  { left: 8%;  background: #ff6b6b; animation-duration: 3s;   animation-delay: 0.2s; }
.confetti:nth-child(2)  { left: 18%; background: #ffd93d; animation-duration: 2.5s; animation-delay: 0.5s; }
.confetti:nth-child(3)  { left: 28%; background: #6bcb77; animation-duration: 3.5s; animation-delay: 0.1s; }
.confetti:nth-child(4)  { left: 38%; background: #4d96ff; animation-duration: 2.8s; animation-delay: 0.7s; }
.confetti:nth-child(5)  { left: 48%; background: #9b59b6; animation-duration: 3.2s; animation-delay: 0.3s; }
.confetti:nth-child(6)  { left: 58%; background: #ff6b9d; animation-duration: 2.6s; animation-delay: 0.9s; }
.confetti:nth-child(7)  { left: 68%; background: #feca57; animation-duration: 3.4s; animation-delay: 0.4s; }
.confetti:nth-child(8)  { left: 78%; background: #48dbfb; animation-duration: 2.9s; animation-delay: 0.6s; }
.confetti:nth-child(9)  { left: 88%; background: #ff9f43; animation-duration: 3.1s; animation-delay: 0.8s; }
.confetti:nth-child(10) { left: 13%; background: #55efc4; animation-duration: 3.6s; animation-delay: 0.15s; }
.confetti:nth-child(11) { left: 53%; background: #fd79a8; animation-duration: 2.7s; animation-delay: 0.55s; }
.confetti:nth-child(12) { left: 73%; background: #a29bfe; animation-duration: 3.3s; animation-delay: 0.35s; }

@keyframes confetti-fall {
    0%   { opacity: 1; transform: translateY(0)    rotate(0deg); }
    100% { opacity: 0; transform: translateY(420px) rotate(720deg); }
}

/* ---------- 弹窗弹出动画 ---------- */
.popup-overlay:not(.is-hidden) .popup-box {
    animation: popup-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes popup-in {
    0%   { transform: scale(0.5) translateY(60px); opacity: 0; }
    60%  { transform: scale(1.05) translateY(-5px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 480px) {
    .popup-box {
        padding: 40px 24px 28px;
        border-radius: 20px;
    }
    .popup-title { font-size: 24px; }
    .popup-emoji { font-size: 52px; }
    .popup-btn { padding: 12px 36px; font-size: 15px; }
}

/* ---------- 暗色模式适配 ---------- */
@media (prefers-color-scheme: dark) {
    .popup-box {
        background: linear-gradient(145deg, #2d2d44 0%, #3a2a4a 50%, #2a3a5a 100%);
    }
    .popup-desc { color: #ccc; }
    .popup-close { background: rgba(255,255,255,0.1); color: #aaa; }
}
