/* ========== 阿里云核心参数配置区 ========== */


/* ========== UI参数配置区 ========== */
:root {
    /* 默认主题色 */
    --theme-color: #d35b7e;
    --theme-shadow: 0 4px 15px rgba(211, 91, 126, 0.3);
    
    /* 9种内置主题色 */
    --color-1: #d35b7e;
    --color-2: #fad354;
    --color-3: #778ccc;
    --color-4: #b0d097;
    --color-5: #fa86a9;
    --color-6: #71bcec;
    --color-7: #f6b6c3;
    --color-8: #b6e3e7;
    --color-9: #c09f7e;
    
    /* 字体设置 */
    --font-default: 'Microsoft YaHei', sans-serif;
    --font-custom: 'CustomFont', 'Microsoft YaHei', sans-serif;
}


/* ========== 动画参数配置区 ========== */
/* 加载动画 - 1.5圈/秒 (0.67s一圈) */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 呼吸动画 - 周期3秒 */
@keyframes breathe {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* 增强版呼吸动画 */
@keyframes breatheStrong {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.12);
        opacity: 0.85;
    }
}

/* 闪动动画 - 加分金色进度条 */
@keyframes flashGoldBar {
    0%, 100% {
        box-shadow: 0 0 3px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.9), 0 0 25px rgba(255, 193, 7, 0.7);
    }
}

/* 闪动动画 - 加分金色文字 */
@keyframes flashGoldText {
    0%, 100% {
        text-shadow: 0 0 3px rgba(255, 215, 0, 0.3);
        color: #666;
    }
    50% {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.9), 0 0 20px rgba(255, 193, 7, 0.7);
        color: #d4a574;
    }
}

/* 闪动动画 - 减分绿色进度条 */
@keyframes flashGreenBar {
    0%, 100% {
        box-shadow: 0 0 3px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.9), 0 0 25px rgba(139, 195, 74, 0.7);
    }
}

/* 闪动动画 - 减分绿色文字 */
@keyframes flashGreenText {
    0%, 100% {
        text-shadow: 0 0 3px rgba(76, 175, 80, 0.3);
        color: #666;
    }
    50% {
        text-shadow: 0 0 10px rgba(76, 175, 80, 0.9), 0 0 20px rgba(139, 195, 74, 0.7);
        color: #4caf50;
    }
}

/* 卡片抖动动画 */
@keyframes cardShake {
    0%, 100% {
        transform: translateX(0) rotate(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-3px) rotate(-1deg);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(3px) rotate(1deg);
    }
}

/* 边缘微光动画 */
@keyframes cardGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.3), 0 0 20px rgba(255, 193, 7, 0.2);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 193, 7, 0.5), 0 0 60px rgba(255, 215, 0, 0.3);
    }
}

/* 降级绿色边缘微光动画 */
@keyframes cardGlowGreen {
    0%, 100% {
        box-shadow: 0 0 10px rgba(76, 175, 80, 0.3), 0 0 20px rgba(139, 195, 74, 0.2);
    }
    50% {
        box-shadow: 0 0 25px rgba(76, 175, 80, 0.8), 0 0 40px rgba(139, 195, 74, 0.5), 0 0 60px rgba(76, 175, 80, 0.3);
    }
}

/* 烟花粒子动画 */
@keyframes fireworkParticle {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* 烟花爆炸动画 */
@keyframes fireworkBurst {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* 文字弹出动画 */
@keyframes textPopIn {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* 文字淡出动画 */
@keyframes textFadeOut {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
}

/* 卡片内文字弹出动画 */
@keyframes cardTextPopIn {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* 卡片内文字淡出动画 */
@keyframes cardTextFadeOut {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
}

/* ========== 加分特效动画 ========== */
/* 宠物跳跃动画 - 增强版 */
@keyframes petBounce {
    0% {
        transform: translateY(0) scale(1);
    }
    8% {
        transform: translateY(5px) scale(0.95, 1.05);
    }
    16% {
        transform: translateY(-25px) scale(1.1, 0.9);
    }
    28% {
        transform: translateY(-30px) scale(1.05);
    }
    40% {
        transform: translateY(0) scale(0.95, 1.05);
    }
    48% {
        transform: translateY(3px) scale(0.97, 1.03);
    }
    56% {
        transform: translateY(-18px) scale(1.08, 0.92);
    }
    68% {
        transform: translateY(-20px) scale(1.03);
    }
    80% {
        transform: translateY(0) scale(0.98, 1.02);
    }
    88% {
        transform: translateY(-8px) scale(1.02);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* 食物飞行动画 - 加速版 */
@keyframes foodFlyIn {
    0% {
        transform: translate(0, 0) scale(0.6) rotate(0deg);
        opacity: 1;
    }
    60% {
        transform: translate(var(--fly-x-mid), var(--fly-y-mid)) scale(1.3) rotate(270deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--fly-x-end), var(--fly-y-end)) scale(1.8) rotate(360deg);
        opacity: 1;
    }
}

/* 食物到达后停留抖动动画 */
@keyframes foodShake {
    0% {
        transform: translate(var(--fly-x-end), var(--fly-y-end)) scale(1.8) rotate(0deg);
    }
    15% {
        transform: translate(var(--fly-x-end), var(--fly-y-end)) scale(2.0) rotate(-12deg);
    }
    30% {
        transform: translate(var(--fly-x-end), var(--fly-y-end)) scale(1.7) rotate(12deg);
    }
    45% {
        transform: translate(var(--fly-x-end), var(--fly-y-end)) scale(1.9) rotate(-8deg);
    }
    60% {
        transform: translate(var(--fly-x-end), var(--fly-y-end)) scale(1.75) rotate(8deg);
    }
    75% {
        transform: translate(var(--fly-x-end), var(--fly-y-end)) scale(1.85) rotate(-4deg);
    }
    100% {
        transform: translate(var(--fly-x-end), var(--fly-y-end)) scale(1.8) rotate(0deg);
    }
}

/* 食物消失动画 */
@keyframes foodFadeOut {
    0% {
        transform: translate(var(--fly-x-end), var(--fly-y-end)) scale(1.8);
        opacity: 1;
    }
    100% {
        transform: translate(var(--fly-x-end), var(--fly-y-end)) scale(2.5);
        opacity: 0;
    }
}

/* 桃心/五角星迸发动画 - 增强版 */
@keyframes particleBurst {
    0% {
        transform: translate(0, 0) scale(0) rotate(0deg);
        opacity: 1;
    }
    15% {
        transform: translate(calc(var(--burst-x) * 0.3), calc(var(--burst-y) * 0.3)) scale(1.2) rotate(calc(var(--burst-rotate) * 0.3));
        opacity: 1;
    }
    40% {
        transform: translate(calc(var(--burst-x) * 0.7), calc(var(--burst-y) * 0.7)) scale(1.1) rotate(calc(var(--burst-rotate) * 0.7));
        opacity: 1;
    }
    100% {
        transform: translate(var(--burst-x), var(--burst-y)) scale(0.6) rotate(var(--burst-rotate));
        opacity: 0;
    }
}

/* 桃心/五角星飘落动画 */
@keyframes particleFloat {
    0% {
        transform: translate(0, 0) scale(0.5) rotate(0deg);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--float-x), var(--float-y)) scale(0.8) rotate(var(--float-rotate));
        opacity: 0;
    }
}

/* ========== 加分特效增强动画 ========== */
/* 边框四周橙红色到金色渐变外发光动画 - 单向渐变过渡，起始颜色柔和 */
@keyframes borderRedToGoldFlash {
    0% {
        border-color: color-mix(in srgb, var(--theme-color) 20%, transparent);
        box-shadow: 
            0 0 6px rgba(255, 140, 105, 0.7),
            0 0 12px rgba(255, 140, 105, 0.5),
            0 0 18px rgba(255, 140, 105, 0.3);
    }
    12% {
        border-color: color-mix(in srgb, var(--theme-color) 18%, transparent);
        box-shadow: 
            0 0 8px rgba(255, 130, 80, 0.8),
            0 0 16px rgba(255, 130, 80, 0.6),
            0 0 24px rgba(255, 130, 80, 0.4);
    }
    25% {
        border-color: color-mix(in srgb, var(--theme-color) 16%, transparent);
        box-shadow: 
            0 0 10px rgba(255, 145, 60, 0.9),
            0 0 20px rgba(255, 145, 60, 0.7),
            0 0 30px rgba(255, 145, 60, 0.5);
    }
    38% {
        border-color: color-mix(in srgb, var(--theme-color) 15%, transparent);
        box-shadow: 
            0 0 12px rgba(255, 165, 40, 0.95),
            0 0 24px rgba(255, 165, 40, 0.75),
            0 0 36px rgba(255, 165, 40, 0.55);
    }
    50% {
        border-color: color-mix(in srgb, var(--theme-color) 15%, transparent);
        box-shadow: 
            0 0 14px rgba(255, 185, 20, 1),
            0 0 28px rgba(255, 185, 20, 0.85),
            0 0 42px rgba(255, 185, 20, 0.65);
    }
    65% {
        border-color: color-mix(in srgb, var(--theme-color) 15%, transparent);
        box-shadow: 
            0 0 16px rgba(255, 200, 0, 1),
            0 0 32px rgba(255, 200, 0, 0.9),
            0 0 48px rgba(255, 200, 0, 0.7);
    }
    80% {
        border-color: color-mix(in srgb, var(--theme-color) 16%, transparent);
        box-shadow: 
            0 0 18px rgba(255, 210, 0, 1),
            0 0 36px rgba(255, 210, 0, 0.95),
            0 0 54px rgba(255, 193, 7, 0.75);
    }
    100% {
        border-color: color-mix(in srgb, var(--theme-color) 20%, transparent);
        box-shadow: 
            0 0 20px rgba(255, 215, 0, 1),
            0 0 40px rgba(255, 215, 0, 1),
            0 0 60px rgba(255, 193, 7, 0.85);
    }
}

/* 进度条主题色到金色渐进动画 */
@keyframes progressThemeToGold {
    0% {
        background: linear-gradient(90deg, 
            var(--theme-color) 0%, 
            var(--theme-color) 100%);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    }
    20% {
        background: linear-gradient(90deg, 
            var(--theme-color) 0%, 
            color-mix(in srgb, var(--theme-color) 70%, #ffd700) 40%,
            var(--theme-color) 100%);
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    }
    40% {
        background: linear-gradient(90deg, 
            var(--theme-color) 0%, 
            color-mix(in srgb, var(--theme-color) 50%, #ffd700) 30%,
            color-mix(in srgb, var(--theme-color) 30%, #ffd700) 60%,
            var(--theme-color) 100%);
        box-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
    }
    60% {
        background: linear-gradient(90deg, 
            color-mix(in srgb, var(--theme-color) 60%, #ffd700) 0%, 
            color-mix(in srgb, var(--theme-color) 30%, #ffd700) 40%,
            #ffd700 70%,
            color-mix(in srgb, var(--theme-color) 50%, #ffd700) 100%);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.85);
    }
    80% {
        background: linear-gradient(90deg, 
            color-mix(in srgb, var(--theme-color) 40%, #ffd700) 0%, 
            #ffd700 30%,
            #ffec8b 60%,
            #ffd700 80%,
            color-mix(in srgb, var(--theme-color) 60%, #ffd700) 100%);
        box-shadow: 0 0 18px rgba(255, 215, 0, 0.95), 0 0 30px rgba(255, 193, 7, 0.5);
    }
    100% {
        background: linear-gradient(90deg, 
            #ffd700 0%, 
            #ffec8b 30%,
            #fff8dc 50%,
            #ffec8b 70%,
            #ffd700 100%);
        box-shadow: 0 0 20px rgba(255, 215, 0, 1), 0 0 40px rgba(255, 193, 7, 0.7);
    }
}

/* 进度条金色闪耀保持动画 */
@keyframes progressGoldShimmer {
    0%, 100% {
        background: linear-gradient(90deg, 
            #ffd700 0%, 
            #ffec8b 25%,
            #fff8dc 50%,
            #ffec8b 75%,
            #ffd700 100%);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.9), 0 0 30px rgba(255, 193, 7, 0.5);
    }
    50% {
        background: linear-gradient(90deg, 
            #ffec8b 0%, 
            #fff8dc 25%,
            #fffacd 50%,
            #fff8dc 75%,
            #ffec8b 100%);
        box-shadow: 0 0 25px rgba(255, 215, 0, 1), 0 0 50px rgba(255, 193, 7, 0.8);
    }
}

/* ========== 新版升级特效动画 ========== */
/* 覆盖层淡入动画 */
@keyframes overlayFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 覆盖层淡出动画 */
@keyframes overlayFadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.05);
    }
}

/* 恭喜图标飞入动画 - 从左上角飞入并放大（绝对定位版本） */
@keyframes congratsIconFlyIn {
    0% {
        left: -10px;
        top: -10px;
        transform: scale(0.3) rotate(-30deg);
        opacity: 0;
    }
    50% {
        left: 50px;
        top: 40px;
        transform: scale(1.2) rotate(10deg);
        opacity: 1;
    }
    100% {
        left: 75px;
        top: 55px;
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* 恭喜图标飞入动画 - 飞到"啦"字上方（绝对定位版本） */
@keyframes congratsIconFlyInLocal {
    0% {
        top: -60px;
        right: -40px;
        transform: scale(0.3) rotate(-30deg);
        opacity: 0;
    }
    50% {
        top: -38px;
        right: 5px;
        transform: scale(1.2) rotate(10deg);
        opacity: 1;
    }
    100% {
        top: -32px;
        right: 8px;
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* 文字上下跳跃动画 */
@keyframes textBounce {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-8px);
    }
}

/* 文字弹入动画 */
@keyframes textPopIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    60% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 粒子上升动画 - 从下方升起，接近文字时虚化 */
@keyframes particleRiseUp {
    0% {
        transform: translateY(0) translateX(0) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 1;
        transform: translateY(-20px) translateX(var(--horizontal-offset, 0)) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-100px) translateX(calc(var(--horizontal-offset, 0) * 1.5)) scale(1.1);
    }
    75% {
        opacity: 0.6;
        transform: translateY(-160px) translateX(calc(var(--horizontal-offset, 0) * 1.8)) scale(0.9);
        filter: blur(1px);
    }
    100% {
        opacity: 0;
        transform: translateY(-220px) translateX(calc(var(--horizontal-offset, 0) * 2)) scale(0.6);
        filter: blur(3px);
    }
}

/* ========== 养成完成特效动画 ========== */
/* 养成完成时卡片四周循环光环效果 - 浅金色到柔和橙色渐变 */
@keyframes petCompleteGlow {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(255, 224, 130, 0.6),
            0 0 30px rgba(255, 202, 40, 0.4),
            0 0 45px rgba(255, 167, 38, 0.2),
            -12px 12px 20px -5px color-mix(in srgb, var(--theme-color) 35%, transparent),
            12px 12px 20px -5px color-mix(in srgb, var(--theme-color) 35%, transparent);
    }
    50% {
        box-shadow: 
            0 0 25px rgba(255, 224, 130, 0.8),
            0 0 50px rgba(255, 202, 40, 0.6),
            0 0 75px rgba(255, 167, 38, 0.4),
            -12px 12px 20px -5px color-mix(in srgb, var(--theme-color) 35%, transparent),
            12px 12px 20px -5px color-mix(in srgb, var(--theme-color) 35%, transparent);
    }
}

/* 领取徽章按钮上方烟花迸发动画 */
@keyframes claimFireworkBurst {
    0% {
        transform: translate(0, 0) scale(0.5);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--fw-x), var(--fw-y)) scale(0);
        opacity: 0;
    }
}

/* 徽章弹窗弹入动画 */
@keyframes badgeCardPopIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 徽章弹窗缩小消失动画 */
@keyframes badgeCardShrinkOut {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.3);
        opacity: 0;
    }
}

/* 徽章闪耀动画 */
@keyframes badgeShine {
    0%, 100% {
        box-shadow: 
            0 0 30px rgba(255, 215, 0, 0.6),
            0 0 60px rgba(255, 193, 7, 0.3),
            inset 0 0 20px rgba(255, 255, 255, 0.8);
    }
    50% {
        box-shadow: 
            0 0 50px rgba(255, 215, 0, 0.9),
            0 0 100px rgba(255, 193, 7, 0.5),
            inset 0 0 30px rgba(255, 255, 255, 1);
    }
}

/* 领取徽章按钮呼吸动画 */
@keyframes claimBtnBreathe {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 6px 20px rgba(255, 193, 7, 0.6);
    }
}


/* ========== 资源引用区 ========== */
/* 自定义字体 */
@font-face {
    font-family: 'CustomFont';
    src: url('../images/font_katong.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}


/* ========== 基础重置样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: var(--font-default);
    background-color: #fff;
    color: #333;
    line-height: 1.6;
}


/* ========== 加载动画样式 ========== */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

#loading.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading .loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--theme-color);
    border-radius: 50%;
    animation: spin 0.67s linear infinite;
}

#loading p {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}


/* ========== 主容器样式 ========== */
#app {
    min-height: 100vh;
    padding: 20px;
}


/* ========== 工具类 ========== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}


/* ========== 消息提示样式 ========== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: #4caf50;
}

.toast.error {
    background: #f44336;
}

.toast.warning {
    background: #ff9800;
}


/* ========== 响应式断点 ========== */
/* 小屏幕手机 */
@media (max-width: 480px) {
    #app {
        padding: 10px;
    }
}

/* 大屏幕设备 */
@media (min-width: 1025px) {
    #app {
        max-width: 1200px;
        margin: 0 auto;
    }
}
