/* ==========================================
   🎨 智慧树 V3.2 样式表
   ========================================== */

/* ========== 主题变量 ========== */
:root {
    --trunk-w: 120px;
    --fruit-size: 60px;
    --canopy-h: 180px;
    --speed: 0.6s;

    /* 夏季主题颜色 */
    --leaf: #7cb342;
    --leaf-light: #aed581;
    --branch: #6d4c41;
    --branch-dark: #4e342e;
    --grass: #81c784;
    --grass-dark: #66bb6a;

    /* 通用颜色 */
    --white: #ffffff;
    --text: #37474f;
    --text2: #78909c;
    --shadow: rgba(0,0,0,0.12);
    --glass: rgba(255,255,255,0.88);
}

/* 秋季主题颜色 */
.theme-autumn {
    --leaf: #ff8a65;
    --leaf-light: #ffab91;
    --branch: #6d4c41;
    --branch-dark: #4e342e;
    --grass: #bcaaa4;
    --grass-dark: #a1887f;
}

/* ========== 开场视频 ========== */
.video-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
}

.video-splash.hidden {
    opacity: 0;
    pointer-events: none;
}

.video-splash video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 视频控制按钮容器 */
.video-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 10001;
}

/* 静音按钮 */
.mute-btn {
    padding: 10px 20px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 25px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mute-btn:hover {
    background: rgba(0,0,0,0.7);
    transform: scale(1.05);
}

/* 跳过按钮 */
.skip-btn {
    padding: 10px 20px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 25px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.skip-btn:hover {
    background: rgba(0,0,0,0.7);
    transform: scale(1.05);
}

/* ========== 基础重置 ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: url('assets/背景.png') center/cover no-repeat fixed;
    color: var(--text);
    transition: background var(--speed);
}

/* ========== 主布局 ========== */
.app {
    display: flex;
    height: 100vh;
}

/* ========== 左侧导航栏 ========== */
.trunk {
    width: var(--trunk-w);
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 8px 16px;
    position: relative;
    flex-shrink: 0;
    z-index: 20;
    transition: transform 0.3s ease;
}

.trunk::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
}

.trunk-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: contain;
    background: var(--white);
    padding: 4px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.trunk-btns {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    position: relative;
    z-index: 1;
    margin-top: 90px;
}

.trunk-btn {
    width: 100%;
    padding: 10px 4px;
    background: rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(5px);
}

.trunk-btn-icon { font-size: 20px; }
.trunk-btn-text { font-size: 10px; font-weight: 600; letter-spacing: 0.5px; }

.trunk-btn:hover {
    background: rgba(0,0,0,0.65);
    transform: scale(1.05);
}

.trunk-btn.active {
    background: var(--leaf);
    border-color: var(--leaf-light);
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    transform: scale(1.05);
}

/* ========== 右侧主内容 ========== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    margin-left: 10px;
}

/* ========== 分身头像区域 ========== */
.canopy {
    height: 15vh;
    position: relative;
    flex-shrink: 0;
    padding: 0 20px;
}

.fruits {
    position: relative;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    z-index: 2;
    gap: 10px;
}

/* 单个分身 */
.fruit {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    position: relative;
}

.fruit:hover { transform: translateY(-4px) scale(1.05); }

/* 分身选中效果（大光圈） */
.fruit.active::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(var(--fruit-size) + 40px);
    height: calc(var(--fruit-size) + 40px);
    border-radius: 50%;
    background: radial-gradient(circle, var(--leaf-light) 0%, var(--leaf) 40%, transparent 70%);
    filter: blur(12px);
    opacity: 0.8;
    z-index: -1;
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.9; transform: translate(-50%, -50%) scale(1.15); }
}

/* 分身图片 */
.fruit-img {
    width: var(--fruit-size);
    height: auto;
    border-radius: 0;
    object-fit: contain;
    border: none;
    box-shadow: none;
    background: transparent;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.fruit-img.emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: transparent;
}

/* 分身名称标签 */
.fruit-name {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #000000;
    background: rgba(255,255,255,0.9);
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 80px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

/* ========== 对话框区域 ========== */
.chat-wrapper {
    flex: 1;
    height: 65vh;
    margin: 10px 12px 0;
    padding: 8px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.4) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.4),
        inset 0 -1px 0 rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    min-height: 0;
    z-index: 3;
    position: relative;
}

.chat {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: transparent;
}

.chat iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* 全屏按钮（玻璃磨砂质感） */
.fullscreen-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.fullscreen-btn svg {
    width: 18px;
    height: 18px;
    color: var(--text);
}

.fullscreen-btn:hover {
    background: rgba(255,255,255,0.5);
    transform: scale(1.1);
}

/* 全屏状态 */
.chat-wrapper.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    z-index: 9999;
}

/* ========== 底部信息栏 ========== */
.footer {
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text2);
}

.footer-divider {
    color: rgba(0,0,0,0.2);
}

.footer-visits {
    display: flex;
    align-items: center;
    gap: 4px;
}

#visitCount {
    font-weight: 600;
    color: var(--leaf);
}

/* ========== 移动端菜单按钮 ========== */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    width: 36px;
    height: 36px;
    background: var(--glass);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 2px 8px var(--shadow);
}

.mobile-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
}

/* ========== 遮罩层 ========== */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    transition: opacity 0.3s ease;
}

.overlay.show {
    display: block;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .trunk {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
        z-index: 1000;
    }

    .trunk.open { transform: translateX(0); }

    .mobile-toggle { display: flex; }

    .main {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .canopy { height: 130px; padding-top: 8px; }

    :root { --fruit-size: 50px; --canopy-h: 130px; }

    .fruit-name { font-size: 10px; }

    .chat-wrapper { margin: 6px 8px 0; height: 60vh; }

    .footer-content { 
        flex-wrap: wrap; 
        justify-content: center;
        gap: 8px;
    }

    .footer { height: auto; padding: 8px 12px; }
}

@media (max-width: 480px) {
    :root { --fruit-size: 44px; --canopy-h: 110px; }
    .fruit-name { font-size: 9px; }
    .footer-content { font-size: 10px; }
}
