/* ========== AI密友主题色 - 温暖亲密 + 科技感 ========== */
:root {
    /* 主色调 - 极光紫粉 */
    --primary-color: #7C3AED;
    --primary-light: #A78BFA;
    --primary-dark: #6D28D9;
    --secondary-color: #EC4899;
    --secondary-light: #F472B6;
    --accent-color: #F97316;
    
    /* 功能色 */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* 背景色 */
    --background: #FAFAFB;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    
    /* 文字色 */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    
    /* 边框 */
    --border-color: #E5E7EB;
    --border-light: #F3F4F6;
    
    /* 阴影 */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.25);
    --shadow-glow-pink: 0 0 40px rgba(236, 72, 153, 0.2);
    
    /* 渐变 */
    --gradient-primary: linear-gradient(135deg, #7C3AED 0%, #EC4899 50%, #F97316 100%);
    --gradient-warm: linear-gradient(135deg, #F472B6 0%, #FB923C 100%);
    --gradient-tech: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #A855F7 100%);
    --gradient-healing: linear-gradient(135deg, #A5F3FC 0%, #C4B5FD 100%);
    
    /* 玻璃拟态 */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    
    /* 圆角 */
    --radius: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;
    
    /* 布局 */
    --header-height: 60px;
    --input-height: 70px;
}

/* 深色模式 - 星空主题 */
[data-theme="dark"] {
    --background: #0F0F23;
    --surface: #1A1A2E;
    --surface-elevated: #252542;
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --border-color: #2D2D44;
    --border-light: #3D3D5C;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 60px rgba(124, 58, 237, 0.4);
    --glass-bg: rgba(30, 30, 56, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    background: var(--background);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

/* ========== 启动页 ========== */
.splash-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    color: white;
    padding: 20px;
}

.splash-icon {
    font-size: 80px;
    animation: bounce 2s infinite;
}

@media (min-width: 768px) {
    .splash-icon {
        font-size: 120px;
    }
}

.splash-title {
    font-size: 32px;
    font-weight: 700;
    margin: 20px 0 10px;
}

@media (min-width: 768px) {
    .splash-title {
        font-size: 48px;
    }
}

.splash-subtitle {
    font-size: 16px;
    opacity: 0.9;
}

@media (min-width: 768px) {
    .splash-subtitle {
        font-size: 20px;
    }
}

.splash-loader {
    width: 40px;
    height: 40px;
    margin: 30px auto 0;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 应用容器 ========== */
.app-container {
    width: 100%;
    min-height: 100vh;
    background: var(--surface);
    position: relative;
}

/* 聊天等内部页面限制最大宽度 */
.app-container .page:not(#login-page) {
    max-width: 768px;
    margin: 0 auto;
}

@media (min-width: 769px) {
    .app-container .page:not(#login-page) {
        box-shadow: var(--shadow-lg);
    }
}

/* ========== 页面 ========== */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== 登录页 ========== */
#login-page {
    background: linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%);
}

.login-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    min-height: 100vh;
    width: 100%;
}

.login-header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.login-logo {
    font-size: 64px;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    opacity: 0.9;
}

.login-form {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    box-shadow: var(--shadow-lg);
}

/* 登录方式切换标签 */
.login-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.login-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: 15px;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color 0.3s;
}

.login-tab.active {
    color: var(--primary-color);
    font-weight: 500;
}

.login-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
}

.login-tab-content {
    display: none;
}

.login-tab-content.active {
    display: block;
}

.login-helper {
    text-align: right;
    margin-top: 12px;
}

.login-helper a {
    font-size: 13px;
    color: var(--primary-color);
    text-decoration: none;
}

/* 登录页响应式 */
@media (max-width: 480px) {
    .login-wrapper {
        padding: 60px 20px 40px;
        justify-content: flex-start;
    }
    
    .login-form {
        max-width: 100%;
    }
}

@media (min-width: 768px) {
    .login-header h1 {
        font-size: 36px;
    }
    
    .login-logo {
        font-size: 80px;
    }
}

.form-group {
    margin-bottom: 16px;
}

.form-group input {
    width: 100%;
    height: 50px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0 16px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.code-group {
    display: flex;
    gap: 12px;
}

.code-group input {
    flex: 1;
}

.send-code-btn {
    width: 110px;
    height: 50px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.send-code-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.login-btn {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.login-btn:active {
    transform: scale(0.98);
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.login-divider span {
    padding: 0 16px;
}

.social-login {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.social-btn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.social-btn:hover {
    transform: scale(1.08);
}

.social-btn:active {
    transform: scale(0.95);
}

.social-btn svg {
    width: 26px;
    height: 26px;
}

.social-btn.wechat {
    background: #07c160;
    color: white;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
}

.social-btn.alipay {
    background: #1677ff;
    color: white;
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3);
}

.login-footer {
    width: 100%;
    max-width: 400px;
    margin-top: 24px;
    padding-top: 24px;
}

.agreement {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
}

.agreement input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.agreement a {
    color: white;
    text-decoration: underline;
}

@media (max-width: 480px) {
    .login-footer {
        max-width: 100%;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px 24px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        background: linear-gradient(transparent, rgba(99, 102, 241, 0.9));
    }
}

/* ========== 聊天页 ========== */
#chat-page {
    background: var(--background);
}

.chat-header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    width: 44px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
}

.ai-avatar img,
.welcome-avatar img,
.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ai-info h2 {
    font-size: 16px;
    font-weight: 600;
}

.ai-status {
    font-size: 12px;
    color: var(--success-color);
}

.icon-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s;
}

.icon-btn:hover {
    background: var(--background);
}

.voice-chat-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    color: white;
}

.voice-chat-btn:hover {
    opacity: 0.9;
}

/* 消息区域 */
.messages-container {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--background);
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.welcome-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.welcome-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.message-avatar {
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
}


.welcome-message h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.message-item {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-item.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.message-item.ai .message-avatar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.message-item.user .message-avatar {
    background: var(--text-muted);
}

.message-content {
    max-width: 75%;
    margin: 0 10px;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-break: break-word;
}

.message-item.ai .message-bubble {
    background: var(--surface);
    border-bottom-left-radius: 4px;
}

.message-item.user .message-bubble {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-bottom-right-radius: 4px;
}

.message-emotion {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 输入区域 */
.input-area {
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--background);
    border-radius: 25px;
    padding: 4px;
}

.input-action-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
}

#message-input {
    flex: 1;
    height: 40px;
    border: none;
    background: none;
    font-size: 15px;
    outline: none;
}

.send-btn {
    width: 64px;
    height: 36px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.3s;
}

.send-btn:active {
    transform: scale(0.95);
}

/* 聊天页响应式 */
@media (min-width: 768px) {
    .chat-header {
        padding: 0 24px;
    }
    
    .messages-container {
        padding: 24px;
    }
    
    .message-content {
        max-width: 65%;
    }
    
    .input-area {
        padding: 16px 24px;
    }
    
    .input-wrapper {
        max-width: 720px;
        margin: 0 auto;
    }
}

@media (min-width: 1024px) {
    .message-content {
        max-width: 55%;
    }
}

/* ========== 侧边栏 ========== */
.sidebar {
    position: fixed;
    inset: 0;
    z-index: 1000;
    visibility: hidden;
    transition: visibility 0.3s;
}

.sidebar.open {
    visibility: visible;
}

.sidebar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar.open .sidebar-overlay {
    opacity: 1;
}

.sidebar-content {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    max-width: 80%;
    background: var(--surface);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.open .sidebar-content {
    transform: translateX(0);
}

.sidebar-header {
    padding: 40px 20px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.user-info h3 {
    font-size: 16px;
    font-weight: 600;
}

.user-info p {
    font-size: 13px;
    opacity: 0.9;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.3s;
}

.nav-item:hover, .nav-item.active {
    background: var(--background);
}

.nav-item.active {
    color: var(--primary-color);
    font-weight: 500;
}

.nav-icon {
    font-size: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    width: 100%;
    height: 44px;
    border: 1px solid var(--danger-color);
    border-radius: var(--radius);
    background: none;
    color: var(--danger-color);
    font-size: 14px;
    cursor: pointer;
}

/* ========== 页面头部 ========== */
.page-header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-header h2 {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
}

.back-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: none;
    font-size: 22px;
    cursor: pointer;
}

.text-btn {
    border: none;
    background: none;
    color: var(--primary-color);
    font-size: 15px;
    cursor: pointer;
}

/* ========== 记忆库页 ========== */
.memory-tabs {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    background: var(--surface);
    overflow-x: auto;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: var(--background);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.memory-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--background);
}

.memory-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.memory-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.memory-card-header h4 {
    font-size: 15px;
    font-weight: 600;
}

.memory-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--primary-light);
    color: white;
}

.memory-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.memory-card-footer {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.5;
}

.empty-state p:first-of-type {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ========== 人设页 ========== */
.persona-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--background);
}

.persona-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.persona-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.persona-styles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 600px) {
    .persona-styles {
        grid-template-columns: repeat(4, 1fr);
    }
}

.style-card {
    background: var(--background);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.style-card.active {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.style-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.style-name {
    font-size: 14px;
    font-weight: 500;
}

.slider-group {
    margin-bottom: 16px;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 8px;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    appearance: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

/* ========== AI虚拟对象列表页 ========== */
.companion-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--background);
}

.companion-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.companion-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.companion-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.companion-card:active {
    transform: translateY(0);
}

.companion-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 16px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    border: 3px solid var(--primary-light);
    flex-shrink: 0;
}

.companion-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.companion-info {
    flex: 1;
}

.companion-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.companion-desc {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.companion-detail {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 12px;
}

.companion-attributes {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.attr-item {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--background);
    padding: 4px 12px;
    border-radius: 12px;
}

.companion-select-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.companion-select-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.companion-select-btn:active {
    transform: translateY(0);
}

@media (min-width: 600px) {
    .companion-card {
        flex-direction: row;
        align-items: center;
    }
    
    .companion-avatar {
        width: 150px;
        height: 150px;
        margin-right: 24px;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .companion-info {
        flex: 1;
    }
    
    .companion-select-btn {
        flex-shrink: 0;
        align-self: flex-end;
    }
}

/* ========== 设置页 ========== */
.settings-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--background);
}

.settings-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.settings-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.settings-item.clickable:hover {
    background: var(--surface);
}

.settings-value {
    color: var(--text-secondary);
}

.settings-arrow {
    color: var(--text-muted);
}

.settings-item select {
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 15px;
    text-align: right;
}

/* ========== 定时提醒页 ========== */
.reminder-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--background);
}

.reminder-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.reminder-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.reminder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.reminder-item:last-child {
    border-bottom: none;
}

.reminder-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.reminder-label {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.reminder-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.reminder-item input[type="time"],
.reminder-item input[type="text"] {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--surface);
}

.reminder-item input[type="text"] {
    flex: 1;
    margin-left: 12px;
}

.reminder-history {
    min-height: 100px;
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius);
}

.reminder-history .empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: 40px 0;
}

/* Switch开关 */
.switch {
    position: relative;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    inset: 0;
    background: var(--text-muted);
    border-radius: 28px;
    transition: 0.3s;
}

.switch .slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.switch input:checked + .slider {
    background: var(--primary-color);
}

.switch input:checked + .slider::before {
    transform: translateX(22px);
}

.settings-btn {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: var(--radius);
    background: var(--background);
    color: var(--text-primary);
    font-size: 15px;
    cursor: pointer;
    margin-bottom: 10px;
}

.settings-btn.danger {
    color: var(--danger-color);
}

.logout-btn-full {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: var(--radius);
    background: var(--danger-color);
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 20px;
}

/* ========== 模态框 ========== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

@media (min-width: 768px) {
    .modal {
        align-items: center;
    }
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 70vh;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    transform: translateY(100%);
    animation: slideUp 0.3s forwards;
}

@media (min-width: 768px) {
    .modal-content {
        border-radius: var(--radius-lg);
        max-height: 80vh;
        animation: fadeIn 0.3s forwards;
    }
}

@keyframes slideUp {
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--background);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(70vh - 120px);
}

@media (min-width: 768px) {
    .modal-body {
        max-height: calc(80vh - 120px);
    }
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--surface);
}

/* 反馈表单样式 */
.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-body .form-group textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    line-height: 1.5;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.modal-body .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modal-body .form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.modal-body .form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modal-body .char-count {
    text-align: right;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.modal-body .btn-primary,
.modal-body .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 80px;
}

.modal-body .btn-primary {
    background: var(--primary-color);
    color: white;
}

.modal-body .btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.modal-body .btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.modal-body .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.modal-body .btn-secondary {
    background: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-body .btn-secondary:hover {
    background: var(--surface);
    border-color: var(--text-secondary);
}

.scene-list {
    padding: 12px;
}

.scene-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.3s;
}

.scene-item:hover {
    background: var(--background);
}

.scene-item.active {
    background: rgba(99, 102, 241, 0.1);
}

.scene-icon {
    font-size: 28px;
}

.scene-info h4 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
}

.scene-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    z-index: 3000;
    animation: fadeIn 0.3s;
}

/* ========== 加载动画 ========== */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* ========== 流式输出打字机效果 ========== */
.message-ai .message-body {
    max-width: 80%;
}

.message-ai .message-content {
    background: var(--surface);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow);
    line-height: 1.6;
}

.typing-text {
    display: inline;
    word-break: break-word;
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--primary-color);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursor-blink 1s infinite;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.message-complete .message-content {
    animation: message-appear 0.3s ease-out;
}

@keyframes message-appear {
    from {
        opacity: 0.8;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.message-ai .message-meta {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.message-ai .message-emotion {
    font-size: 14px;
}
