/* ========================================
   任务完成 & 徽章获取页
   ======================================== */

.badge-page {
    min-height: 100vh;
    background: linear-gradient(180deg,
        var(--color-stone-blue) 0%,
        var(--color-paper-warm) 50%,
        var(--color-rice) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    position: relative;
    overflow: hidden;
}

/* Background Decorations - 水墨云雾效果 */
.badge-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center,
        rgba(91, 122, 138, 0.15) 0%,
        rgba(222, 213, 197, 0.08) 50%,
        transparent 70%);
    animation: bgRotate 30s linear infinite;
}

@keyframes bgRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Particles */
.particles-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--color-xiangye);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 3s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-200px) scale(0);
        opacity: 0;
    }
}

/* Badge Container */
.badge-container {
    position: relative;
    z-index: 10;
    text-align: center;
    animation: badgeDrop 1s var(--ease-spring);
}

@keyframes badgeDrop {
    0% {
        transform: translateY(-100vh) rotate(-180deg) scale(0.5);
        opacity: 0;
    }
    60% {
        transform: translateY(20px) rotate(10deg) scale(1.1);
    }
    80% {
        transform: translateY(-10px) rotate(-5deg) scale(0.95);
    }
    100% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
}

/* Badge */
.badge {
    width: 180px;
    height: 180px;
    margin: 0 auto var(--space-xl);
    position: relative;
}

.badge-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
        var(--color-xiangye) 0%,
        var(--color-chihong) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow:
        0 0 0 8px rgba(255, 255, 255, 0.4),
        0 0 0 12px var(--color-dopamine-pink),
        0 20px 60px rgba(255, 157, 187, 0.4);
    animation: badgeBounce 0.6s var(--ease-spring) 0.8s forwards,
               badgeGlow 2s ease-in-out infinite 1s;
}

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

@keyframes badgeGlow {
    0%, 100% {
        box-shadow:
            0 0 0 8px rgba(255, 255, 255, 0.4),
            0 0 0 12px var(--color-dopamine-pink),
            0 20px 60px rgba(255, 157, 187, 0.4);
    }
    50% {
        box-shadow:
            0 0 0 8px rgba(255, 255, 255, 0.5),
            0 0 0 16px var(--color-dopamine-pink),
            0 30px 80px rgba(255, 157, 187, 0.5);
    }
}

.badge-inner::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 50%;
}

.badge-inner::after {
    content: '';
    position: absolute;
    inset: 16px;
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.3) 0%,
        transparent 50%);
    border-radius: 50%;
}

.badge-icon {
    font-size: 80px;
    position: relative;
    z-index: 2;
}

.badge-sparkle {
    position: absolute;
    font-size: 24px;
    animation: sparkle 1.5s ease-in-out infinite;
}

.badge-sparkle:nth-child(1) {
    top: 10px;
    left: 20px;
    animation-delay: 0s;
}

.badge-sparkle:nth-child(2) {
    top: 30px;
    right: 10px;
    animation-delay: 0.3s;
}

.badge-sparkle:nth-child(3) {
    bottom: 20px;
    left: 10px;
    animation-delay: 0.6s;
}

.badge-sparkle:nth-child(4) {
    bottom: 10px;
    right: 25px;
    animation-delay: 0.9s;
}

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

/* Badge Text */
.badge-text {
    position: relative;
    z-index: 10;
    animation: textFadeIn 0.8s ease-out 0.5s both;
}

@keyframes textFadeIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.badge-congrats {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--space-sm);
}

.badge-title {
    font-family: var(--font-title);
    font-size: 28px;
    color: var(--color-cloud);
    margin-bottom: var(--space-xs);
    text-shadow: 0 2px 10px rgba(42, 74, 98, 0.3);
}

.badge-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.85);
}

.badge-city {
    color: var(--color-xiangye);
    font-weight: 600;
}

/* Action Buttons */
.badge-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    position: relative;
    z-index: 10;
    animation: textFadeIn 0.8s ease-out 0.8s both;
}

.badge-btn {
    flex: 1;
    padding: 16px 20px;
    border-radius: var(--radius-full);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    transition: all var(--duration-normal) var(--ease-smooth);
    min-width: 140px;
}

.badge-btn-icon {
    font-size: 24px;
}

.badge-btn-primary {
    background: linear-gradient(135deg,
        var(--color-tianqing) 0%,
        var(--color-danqing) 100%);
    color: var(--color-cloud);
    border: none;
    box-shadow: 0 8px 24px rgba(90, 143, 126, 0.4);
}

.badge-btn-primary:active {
    transform: scale(0.95);
    box-shadow: 0 4px 12px rgba(90, 143, 126, 0.3);
}

.badge-btn-heart {
    background: var(--color-cloud);
    color: var(--color-chihong);
    border: 3px solid var(--color-chihong);
    box-shadow: 0 4px 16px rgba(227, 94, 91, 0.2);
}

.badge-btn-heart:active {
    transform: scale(0.95);
    background: rgba(227, 94, 91, 0.1);
}

.badge-btn-text {
    font-size: 13px;
    opacity: 0.9;
}

/* Confetti */
.confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
}

.confetti.animation {
    animation: confettiFall 3s ease-out forwards;
}

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

/* Badge Details */
.badge-details {
    position: absolute;
    bottom: var(--space-xl);
    left: var(--space-lg);
    right: var(--space-lg);
    background: var(--color-cloud);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    z-index: 10;
    animation: slideUp 0.6s ease-out 1.2s both;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.badge-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: var(--space-xs) 0;
}

.badge-detail-label {
    color: var(--color-ink-light);
}

.badge-detail-value {
    color: var(--color-dailan);
    font-weight: 500;
}

/* Rare Badge Animation */
.badge.rare .badge-inner {
    background: linear-gradient(135deg,
        #FFD700 0%,
        #FFA500 50%,
        #FF6B6B 100%);
    animation: badgeBounce 0.6s var(--ease-spring) 0.8s forwards,
               rareBadgeGlow 1.5s ease-in-out infinite 1s;
}

@keyframes rareBadgeGlow {
    0%, 100% {
        box-shadow:
            0 0 0 8px rgba(255, 215, 0, 0.3),
            0 0 0 12px #FFD700,
            0 0 60px rgba(255, 215, 0, 0.6),
            0 0 100px rgba(255, 165, 0, 0.4);
    }
    50% {
        box-shadow:
            0 0 0 8px rgba(255, 215, 0, 0.5),
            0 0 0 16px #FFD700,
            0 0 80px rgba(255, 215, 0, 0.8),
            0 0 120px rgba(255, 165, 0, 0.6);
    }
}

/* Charity Badge Variant */
.badge.charity .badge-inner {
    background: linear-gradient(135deg,
        var(--color-chihong) 0%,
        #FF6B9D 100%);
    box-shadow:
        0 0 0 8px rgba(255, 255, 255, 0.3),
        0 0 0 12px var(--color-chihong),
        0 20px 60px rgba(227, 94, 91, 0.4);
}

.badge.charity .badge-icon::after {
    content: '❤️';
    position: absolute;
    bottom: -5px;
    right: -5px;
    font-size: 28px;
    animation: heartBeat 1s ease-in-out infinite;
}

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