/* AI陪伴玩具 - 小伴 - 主题样式 */
:root {
    --bg-primary: #1a1520;
    --bg-secondary: #241e2e;
    --bg-card: #2d2638;
    --text-primary: #e8e0f0;
    --text-secondary: #a89cb8;
    --text-muted: #7a6e8a;
    --accent: #b48eff;
    --accent-soft: #9370db;
    --accent-glow: rgba(180, 142, 255, 0.3);
    --warm: #ffb366;
    --danger: #ff6b8a;
    --success: #66d9a0;
    --bubble-user: #3d2e5c;
    --bubble-ai: #2a2235;
    --radius: 16px;
    --radius-sm: 10px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary); color: var(--text-primary);
    height: 100vh; overflow: hidden; user-select: none;
}
.app-container {
    max-width: 480px; margin: 0 auto; height: 100vh;
    display: flex; flex-direction: column; position: relative;
    background: var(--bg-primary);
}
.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.bot-info { display: flex; align-items: center; gap: 8px; }
.bot-avatar { font-size: 24px; }
.bot-name { font-size: 18px; font-weight: 500; }
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted); transition: background 0.3s;
}
.status-dot.connected { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.speaking { background: var(--warm); box-shadow: 0 0 8px var(--warm); animation: pulse 1s infinite; }
.status-text { font-size: 12px; color: var(--text-muted); }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
    background: transparent; border: none; font-size: 20px;
    cursor: pointer; padding: 6px; border-radius: 8px; transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); }
.chat-area { flex: 1; overflow-y: auto; padding: 20px; scroll-behavior: smooth; }
.chat-area::-webkit-scrollbar { width: 4px; }
.chat-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.welcome-message { text-align: center; padding: 40px 20px; }
.welcome-text { font-size: 20px; margin: 20px 0 8px; }
.welcome-sub { font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; }
.welcome-hint { font-size: 13px; color: var(--text-muted); margin-top: 20px; }
.toy-body {
    width: 120px; height: 140px; margin: 0 auto;
    background: linear-gradient(135deg, var(--accent-soft), #7c5cbf);
    border-radius: 50% 50% 45% 45%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    position: relative; box-shadow: 0 8px 32px var(--accent-glow); transition: transform 0.3s;
}
.toy-body:hover { transform: scale(1.05); }
.toy-body.listening { animation: gentle-bounce 1.5s ease-in-out infinite; }
.toy-body.speaking { animation: gentle-sway 0.8s ease-in-out infinite; }
.toy-face { text-align: center; }
.toy-eyes { display: flex; gap: 20px; margin-bottom: 8px; }
.eye { font-size: 14px; color: #fff; text-shadow: 0 0 10px rgba(255,255,255,0.8); }
.toy-mouth { font-size: 20px; color: #fff; transition: all 0.3s; }
.breathing-light {
    position: absolute; bottom: 10px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--warm);
    animation: breathing 3s ease-in-out infinite; box-shadow: 0 0 12px var(--warm);
}
.messages { display: flex; flex-direction: column; gap: 12px; }
.message {
    max-width: 85%; padding: 12px 16px; border-radius: var(--radius);
    font-size: 15px; line-height: 1.6; animation: fadeInUp 0.3s ease; word-wrap: break-word;
}
.message.user { align-self: flex-end; background: var(--bubble-user); border-bottom-right-radius: 4px; }
.message.ai { align-self: flex-start; background: var(--bubble-ai); border-bottom-left-radius: 4px; border-left: 3px solid var(--accent-soft); }
.message.system { align-self: center; background: transparent; color: var(--text-muted); font-size: 12px; padding: 4px 12px; }
.message .time { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: block; }
.asr-bar {
    display: none; align-items: center; gap: 8px; padding: 8px 20px;
    background: var(--bg-secondary); border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 14px; color: var(--text-secondary);
}
.asr-bar.active { display: flex; }
.asr-icon { animation: pulse 1s infinite; }
.bottom-bar {
    display: flex; justify-content: center; align-items: center; gap: 32px;
    padding: 16px 20px 28px; background: var(--bg-secondary);
    border-top: 1px solid rgba(255,255,255,0.05);
}
.memory-btn, .text-btn {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: transparent; border: none; cursor: pointer;
    color: var(--text-secondary); font-size: 22px; transition: color 0.2s;
}
.memory-btn small, .text-btn small { font-size: 11px; color: var(--text-muted); }
.memory-btn:hover, .text-btn:hover { color: var(--accent); }
.mic-btn {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-soft));
    border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
    position: relative; box-shadow: 0 4px 20px var(--accent-glow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.mic-btn:hover { transform: scale(1.08); box-shadow: 0 6px 28px var(--accent-glow); }
.mic-btn:active { transform: scale(0.95); }
.mic-btn.recording { background: linear-gradient(135deg, var(--danger), #ff4d6a); animation: pulse-btn 1.5s infinite; }
.mic-icon { font-size: 28px; }
.mic-waves { position: absolute; display: none; gap: 3px; }
.mic-btn.recording .mic-waves { display: flex; }

/* 文字输入面板 */
.text-input-panel {
    display: none; padding: 12px 20px; background: var(--bg-secondary);
    border-top: 1px solid rgba(255,255,255,0.05);
}
.text-input-panel.active { display: block; }
.text-input-wrap { display: flex; gap: 8px; align-items: flex-end; }
.text-input-wrap textarea {
    flex: 1; background: var(--bg-card); border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text-primary);
    font-size: 14px; resize: none; outline: none; font-family: inherit;
}
.text-input-wrap textarea:focus { border-color: var(--accent-soft); }
.send-btn {
    padding: 10px 18px; background: var(--accent); color: #fff;
    border: none; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 14px; font-weight: 500; transition: background 0.2s;
}
.send-btn:hover { background: var(--accent-soft); }

/* 记忆面板 */
.memory-panel {
    position: absolute; top: 0; right: -100%; width: 100%; height: 100%;
    background: var(--bg-primary); z-index: 100; transition: right 0.3s ease;
    display: flex; flex-direction: column;
}
.memory-panel.active { right: 0; }
.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.panel-header h3 { font-size: 18px; font-weight: 500; }
.close-btn {
    background: transparent; border: none; color: var(--text-secondary);
    font-size: 20px; cursor: pointer; padding: 4px 8px;
}
.panel-body { flex: 1; overflow-y: auto; padding: 20px; }
.memory-section { margin-bottom: 24px; }
.memory-section h4 { font-size: 15px; color: var(--text-secondary); margin-bottom: 12px; }
.card-list { display: flex; flex-direction: column; gap: 8px; }
.memory-card {
    background: var(--bg-card); border-radius: var(--radius-sm);
    padding: 12px 16px; font-size: 14px; line-height: 1.5; color: var(--text-primary);
}
.memory-card .card-title { font-weight: 500; margin-bottom: 4px; }
.memory-card .card-detail { font-size: 13px; color: var(--text-secondary); }
.memory-card .card-emotion {
    display: inline-block; padding: 2px 8px; margin: 4px 4px 0 0;
    background: rgba(180,142,255,0.15); border-radius: 12px;
    font-size: 12px; color: var(--accent);
}
.memory-actions { margin-top: 20px; text-align: center; }
.danger-btn {
    padding: 10px 24px; background: transparent; color: var(--danger);
    border: 1px solid var(--danger); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 14px; transition: all 0.2s;
}
.danger-btn:hover { background: var(--danger); color: #fff; }

/* 主动记忆面板 */
.save-memory-panel {
    display: none; position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.6); z-index: 50; height: 100%;
    align-items: flex-end; justify-content: center;
}
.save-memory-panel.active { display: flex; }
.save-memory-content {
    background: var(--bg-secondary); border-radius: var(--radius) var(--radius) 0 0;
    padding: 28px 24px; width: 100%; text-align: center;
    animation: slideUp 0.3s ease;
}
.save-memory-icon { font-size: 40px; margin-bottom: 12px; }
.save-memory-content p { font-size: 16px; color: var(--text-primary); margin-bottom: 16px; }
.save-memory-content textarea {
    width: 100%; background: var(--bg-card); border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm); padding: 12px; color: var(--text-primary);
    font-size: 14px; resize: none; outline: none; font-family: inherit;
}
.save-memory-content textarea:focus { border-color: var(--accent-soft); }
.save-memory-actions { display: flex; gap: 12px; margin-top: 16px; justify-content: center; }
.cancel-btn {
    padding: 10px 24px; background: transparent; color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 14px;
}
.confirm-btn {
    padding: 10px 24px; background: var(--accent); color: #fff;
    border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
}
.confirm-btn:hover { background: var(--accent-soft); }
.empty-hint { color: var(--text-muted); font-size: 13px; text-align: center; padding: 12px; }

/* 动画 */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes pulse-btn {
    0%, 100% { box-shadow: 0 4px 20px rgba(255,107,138,0.3); }
    50% { box-shadow: 0 4px 32px rgba(255,107,138,0.5); }
}
@keyframes wave {
    0%, 100% { height: 8px; }
    50% { height: 24px; }
}
@keyframes breathing {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}
@keyframes gentle-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes gentle-sway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
