/* ═══════════════════════════════════════════
   🎨 八爪鱼特效皮肤系统
   ═══════════════════════════════════════════ */

/* 特效激活时的全局样式覆盖 */
body.fx-active {
    --chat-bg: transparent !important;
}

body.fx-active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--fx-bg, linear-gradient(135deg, #0c1445, #006064));
    z-index: -1;
    transition: background 0.8s ease;
}

body.fx-active #app {
    background: transparent;
}

body.fx-active #messages {
    background: transparent;
}

/* 特效模式下气泡 — 提高可读性 */
body.fx-active .msg.bot .bubble {
    background: rgba(0, 0, 20, 0.55);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

body.fx-active .msg.user .bubble {
    background: rgba(7, 160, 80, 0.45);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: #fff;
    border: 1px solid rgba(7, 193, 96, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 顶栏毛玻璃 */
body.fx-active #header {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body.fx-active .header-name {
    color: #fff;
}

body.fx-active .header-status {
    color: #00e676;
}

/* 🐙 顶栏头像动起来 */
body.fx-active .header-avatar {
    animation: octoAlive 4s ease-in-out infinite;
    font-size: 18px;
    filter: drop-shadow(0 0 6px rgba(100, 200, 255, 0.6));
}

/* 包含浮动 + 发光 + 周期性扭动的复合动画 */
@keyframes octoAlive {
    0% {
        transform: translateY(0) rotate(0deg);
        filter: drop-shadow(0 0 4px rgba(100, 200, 255, 0.4));
    }

    15% {
        transform: translateY(-2px) rotate(2deg);
        filter: drop-shadow(0 0 8px rgba(100, 200, 255, 0.7));
    }

    30% {
        transform: translateY(0) rotate(-2deg);
        filter: drop-shadow(0 0 4px rgba(100, 200, 255, 0.4));
    }

    /* 扭动 */
    60% {
        transform: translateY(1px) rotate(0deg);
        filter: drop-shadow(0 0 6px rgba(100, 200, 255, 0.5));
    }

    68% {
        transform: translateY(0) rotate(12deg);
        filter: drop-shadow(0 0 10px rgba(100, 200, 255, 0.8));
    }

    74% {
        transform: translateY(0) rotate(-10deg);
        filter: drop-shadow(0 0 10px rgba(100, 200, 255, 0.8));
    }

    80% {
        transform: translateY(0) rotate(5deg);
        filter: drop-shadow(0 0 6px rgba(100, 200, 255, 0.5));
    }

    88% {
        transform: translateY(0) rotate(-2deg);
        filter: drop_shadow(0 0 4px rgba(100, 200, 255, 0.4));
    }

    100% {
        transform: translateY(0) rotate(0deg);
        filter: drop-shadow(0 0 4px rgba(100, 200, 255, 0.4));
    }
}

/* 🐙 思考中 — 疯狂扭动 + 变色发光 */
body.fx-active .header-avatar.thinking {
    animation: octoThink 0.6s ease-in-out infinite !important;
    font-size: 20px;
}

@keyframes octoThink {
    0% {
        transform: rotate(0deg) scale(1);
        filter: drop-shadow(0 0 8px rgba(255, 100, 200, 0.8));
    }

    25% {
        transform: rotate(20deg) scale(1.1);
        filter: drop-shadow(0 0 14px rgba(100, 200, 255, 0.9));
    }

    50% {
        transform: rotate(-15deg) scale(0.95);
        filter: drop-shadow(0 0 8px rgba(200, 100, 255, 0.8));
    }

    75% {
        transform: rotate(10deg) scale(1.05);
        filter: drop-shadow(0 0 14px rgba(100, 255, 200, 0.9));
    }

    100% {
        transform: rotate(0deg) scale(1);
        filter: drop-shadow(0 0 8px rgba(255, 100, 200, 0.8));
    }
}

/* 🐙 开心 — 大幅弹跳 + 发光 */
body.fx-active .header-avatar.happy {
    animation: octoHappy 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 3 !important;
    font-size: 22px !important;
}

@keyframes octoHappy {
    0% {
        transform: scale(1) translateY(0);
        filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
    }

    30% {
        transform: scale(1.6) translateY(-8px);
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.9));
    }

    60% {
        transform: scale(0.9) translateY(2px);
        filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
    }

    100% {
        transform: scale(1) translateY(0);
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.7));
    }
}

/* 🐙 兴奋 — 旋转 + 彩虹 */
body.fx-active .header-avatar.excited {
    animation: octoExcited 0.4s ease-in-out 4 !important;
    font-size: 20px !important;
}

@keyframes octoExcited {
    0% {
        transform: rotate(0deg) scale(1);
        filter: drop-shadow(0 0 8px rgba(255, 0, 100, 0.8));
    }

    50% {
        transform: rotate(180deg) scale(1.3);
        filter: drop-shadow(0 0 16px rgba(0, 200, 255, 0.9));
    }

    100% {
        transform: rotate(360deg) scale(1);
        filter: drop-shadow(0 0 8px rgba(100, 255, 0, 0.8));
    }
}

/* 输入栏毛玻璃 */
body.fx-active #input-bar {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

body.fx-active #input {
    background: rgba(255, 255, 255, 0.1);
    color: #f0f0f0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

body.fx-active #input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

body.fx-active #mic-btn,
body.fx-active #cam-btn {
    color: rgba(255, 255, 255, 0.6);
}

body.fx-active .msg-time {
    color: rgba(255, 255, 255, 0.4);
}

/* 欢迎页 */
body.fx-active .welcome-text {
    color: rgba(255, 255, 255, 0.7);
}

body.fx-active .welcome-avatar {
    filter: drop-shadow(0 0 20px rgba(100, 200, 255, 0.5));
}

body.fx-active .quick-btns button {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

body.fx-active .quick-btns button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* 菜谱卡片 — 增强可读性 */
body.fx-active .recipe-card {
    background: rgba(0, 0, 20, 0.4);
    border-left-color: #00e676;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body.fx-active .recipe-card h4 {
    color: #00e676;
    text-shadow: 0 0 8px rgba(0, 230, 118, 0.4);
}

body.fx-active .dish-info h5 {
    color: #fff;
    font-weight: 700;
}

body.fx-active .dish-cat {
    background: rgba(0, 230, 118, 0.3);
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

body.fx-active .dish-reason,
body.fx-active .dish-ingredients,
body.fx-active .dish-method {
    color: rgba(255, 255, 255, 0.8);
}

body.fx-active .dish-toggle {
    color: #69f0ae;
    font-weight: 600;
}

body.fx-active .copy-menu-btn {
    color: #69f0ae;
    background: rgba(0, 230, 118, 0.15);
}

body.fx-active .shopping-list h5 {
    color: #69f0ae;
}

body.fx-active .shopping-list li {
    background: rgba(0, 230, 118, 0.15);
    color: rgba(255, 255, 255, 0.85);
}

body.fx-active .bubble strong {
    color: #fff;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.2);
}

/* ═══ 皮肤切换按钮 ═══ */
#skin-btn {
    position: fixed;
    bottom: max(80px, calc(env(safe-area-inset-bottom) + 70px));
    right: max(12px, calc((100vw - 500px) / 2 + 12px));
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    z-index: 200;
    transition: all 0.3s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    animation: skinBtnPulse 3s ease-in-out infinite;
}

#skin-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

#skin-btn:active {
    transform: scale(0.95);
}

@keyframes skinBtnPulse {

    0%,
    100% {
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    }

    50% {
        box-shadow: 0 2px 20px rgba(100, 200, 255, 0.3);
    }
}

/* ═══ 皮肤选择面板 ═══ */
#skin-picker {
    position: fixed;
    bottom: max(130px, calc(env(safe-area-inset-bottom) + 120px));
    right: max(12px, calc((100vw - 500px) / 2 + 12px));
    width: 220px;
    padding: 16px;
    background: rgba(20, 20, 30, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 200;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
}

#skin-picker.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.skin-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
    text-align: center;
}

.skin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.skin-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s;
}

.skin-option:hover {
    background: rgba(255, 255, 255, 0.12);
}

.skin-option.active {
    border-color: #00e676;
    background: rgba(0, 230, 118, 0.1);
}

.skin-preview {
    width: 40px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.skin-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
}

/* 桌面端位置修正 */
@media (min-width: 501px) {
    body.fx-active {
        background: transparent !important;
    }

    body.fx-active #app {
        border-color: rgba(255, 255, 255, 0.08);
    }
}

/* 樱花主题浅色覆盖 */
body.fx-active[data-skin="sakura"] .msg.bot .bubble {
    background: rgba(150, 50, 80, 0.15);
    color: #4a1030;
}