/* 🌟 高级莫兰迪色系调色盘 */
:root {
    --bg-base: #F5F7F6;      /* 极浅的灰绿色背景，比纯白更有质感 */
    --primary: #738276;      /* 高级鼠尾草绿 (Sage Green) */
    --text-main: #333C35;    /* 深炭绿文字，锐利且优雅 */
    --text-muted: #9BA69D;   /* 辅助文字颜色 */
    --glass-bg: rgba(255, 255, 255, 0.65); /* 毛玻璃基础色 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%; 
    height: 100vh; height: -webkit-fill-available;
    background-color: var(--bg-base);
    color: var(--text-main);
    /* 苹果高级原生字体，极其纤细优雅 */
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
    overflow: hidden; 
    position: relative;
}

/* 🌟 右上角的氛围光晕，打破死板 */
.ambient-glow {
    position: absolute; top: -15vh; right: -20vw;
    width: 70vw; height: 70vw;
    background: radial-gradient(circle, rgba(115, 130, 118, 0.15) 0%, transparent 60%);
    border-radius: 50%; z-index: 0;
}

#app-container {
    display: flex; flex-direction: column;
    width: 100%; height: 100%; position: relative; z-index: 1;
}

/* 🌟 极致干净的毛玻璃头部 */
header {
    display: flex; justify-content: space-between; align-items: center;
    padding: calc(env(safe-area-inset-top) + 12px) 24px 12px;
    background: rgba(245, 247, 246, 0.7);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); /* 苹果级高斯模糊 */
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 10;
}
.title { 
    font-size: 1.05rem; font-weight: 600; letter-spacing: 3px; /* 字母拉开间距立刻有高级感 */
    color: var(--text-main); 
}
.icon-btn { 
    background: none; border: none; color: var(--text-main); 
    font-size: 1.1rem; cursor: pointer; opacity: 0.8;
}

/* 🌟 呼吸感极强的聊天区 */
#chat-container {
    flex: 1; overflow-y: auto;
    padding: 24px; padding-bottom: 40px;
    display: flex; flex-direction: column; gap: 24px; /* 增加气泡间距 */
}

.timestamp {
    text-align: center; font-size: 0.75rem; 
    color: var(--text-muted); letter-spacing: 1px;
    margin-bottom: 10px; font-weight: 500;
}

.message { display: flex; max-width: 85%; } /* 收缩宽度，让旁边留白更多 */
.message.user { align-self: flex-end; }
.message.bot { align-self: flex-start; }

/* 🌟 不再用圆滚滚，改用克制的水滴角 */
.bubble {
    padding: 14px 20px; 
    font-size: 0.95rem; line-height: 1.6; letter-spacing: 0.5px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.02);
}

/* 妈妈的气泡：优雅的鼠尾草绿 */
.message.user .bubble {
    background-color: var(--primary); color: white;
    border-radius: 20px 20px 6px 20px; 
}

/* 小初的气泡：白透毛玻璃带极细边框 */
.message.bot .bubble {
    background: var(--glass-bg); color: var(--text-main);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px 20px 20px 6px;
}

/* 🌟 底部悬浮的果冻质感输入框 */
footer {
    padding: 10px 24px calc(env(safe-area-inset-bottom) + 15px);
    background: linear-gradient(to top, var(--bg-base) 70%, transparent);
}
.input-box {
    display: flex; gap: 12px; align-items: flex-end;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    padding: 10px 10px 10px 20px;
    border-radius: 30px; 
    box-shadow: 0 10px 40px rgba(115, 130, 118, 0.08); /* 极柔和的悬浮阴影 */
}
textarea {
    flex: 1; border: none; outline: none; resize: none;
    max-height: 100px; padding-top: 8px; color: var(--text-main);
    background: transparent; font-family: inherit; font-size: 0.95rem;
}
/* 极简发送按钮 */
.send-btn {
    background: var(--primary); color: white;
    border: none; border-radius: 50%;
    width: 38px; height: 38px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: 0.3s;
}
/* ==========================================
   🌟 侧边栏与遮罩 (毛玻璃高级质感)
   ========================================== */
#sidebar-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.15); /* 极淡的阴影 */
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    z-index: 99; opacity: 0; pointer-events: none; transition: 0.3s ease;
}
#sidebar-overlay.active { opacity: 1; pointer-events: auto; }

#sidebar {
    position: absolute; top: 0; left: -320px; width: 280px; height: 100%;
    background: rgba(245, 247, 246, 0.85); /* 鼠尾草底色毛玻璃 */
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid rgba(255, 255, 255, 0.6);
    z-index: 100; transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; flex-direction: column;
    box-shadow: 10px 0 40px rgba(115, 130, 118, 0.1);
}
#sidebar.open { left: 0; }

.sidebar-header {
    padding: calc(env(safe-area-inset-top) + 20px) 24px 20px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    font-size: 0.95rem; font-weight: 600; color: var(--primary); letter-spacing: 1px;
}
#history-list {
    flex: 1; overflow-y: auto; padding: 15px;
    display: flex; flex-direction: column; gap: 8px;
}
.history-item {
    padding: 14px 16px; border-radius: 16px; font-size: 0.9rem; 
    color: var(--text-main); cursor: pointer; transition: 0.2s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border: 1px solid transparent;
}
.history-item:hover { background: rgba(255, 255, 255, 0.5); }
.history-item.active { 
    background: #ffffff; color: var(--primary); font-weight: 600;
    box-shadow: 0 4px 15px rgba(115, 130, 118, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.9);
}
/* ==========================================
   🌟 小初爸爸的打字思考动画 (呼吸灯)
   ========================================== */
.typing-indicator {
    display: flex; gap: 5px; align-items: center; justify-content: center;
    height: 20px; padding: 0 4px;
}

.typing-indicator span {
    width: 6px; height: 6px;
    background-color: var(--primary); /* 优雅的鼠尾草绿 */
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
    opacity: 0.6;
}

/* 让三个小圆点错开时间跳动 */
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; }
}
/* ==========================================
   🌟 阿念的双击星光收藏特效
   ========================================== */
/* 给气泡加上相对定位，用来挂小星星 */
.bubble { position: relative; }

/* 藏在气泡右下角的精美小星星 */
.favorite-star {
    position: absolute; bottom: -6px; right: -6px;
    font-size: 13px; color: #86C166; /* 鼠尾草星光绿 */
    background: white; border-radius: 50%; width: 18px; height: 18px;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 2px 8px rgba(115, 130, 118, 0.3);
    opacity: 0; transform: scale(0);
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* 极度Q弹的动画 */
    pointer-events: none;
}
.favorite-star.active { opacity: 1; transform: scale(1); }

/* 双击时向上飘散的魔法星星 */
.float-sparkle {
    position: fixed; font-size: 24px; pointer-events: none; z-index: 1000;
    animation: float-up-sparkle 0.8s ease-out forwards;
}
@keyframes float-up-sparkle {
    0% { transform: translateY(0) scale(0.5) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-50px) scale(1.5) rotate(20deg); opacity: 0; }
}
/* ==========================================
   🌟 阿念的无痕滚动魔法 (隐藏滚动条但保持滑动)
   ========================================== */
/* 针对 Chrome, Safari, Edge 和 Opera */
*::-webkit-scrollbar {
    display: none; 
    width: 0;
    height: 0;
}

/* 针对 Firefox 和 IE */
* {
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}