/* ========================================
   ESP32 AI Assistant - 优化版 CSS
   优化内容：
   1. 删除重复定义
   2. 合并相同样式
   3. 统一命名规范
   4. 优化响应式设计
   5. 减少代码冗余
   ======================================== */

/* ========================================
   1. 全局重置与基础样式
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    /* ✅ 修复：允许垂直滚动，但隐藏水平滚动 */
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
    margin: 0;
    padding: 0;
}

/* ========================================
   2. 主容器布局
   ======================================== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-radius: 0;
    overflow: hidden;
    position: relative;
}

/* ========================================
   3. 头部区域
   ======================================== */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* 日期时间显示 */
.datetime-display {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.date-text {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    white-space: nowrap;
}

.time-text {
    color: rgba(255, 255, 255, 0.95);
    font-family: 'Courier New', monospace;
    font-weight: 600;
    min-width: 80px;
    text-align: right;
    letter-spacing: 1px;
}

/* 连接状态指示器 */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.connection-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ccc;
    transition: background-color 0.3s ease;
}

.connection-status.connected {
    background-color: #4caf50;
}

.connection-status.disconnected {
    background-color: #f44336;
}

/* ========================================
   4. 聊天消息区域
   ======================================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.welcome-message h3 {
    margin-bottom: 10px;
    color: #333;
}

.welcome-message p {
    color: #888;
}

.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.message-user .avatar {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.message-ai .avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message-system .avatar {
    background: #ff9800;
}

.content {
    flex: 1;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    max-width: 80%;
    word-wrap: break-word;
}

.message-user .content {
    background: #e3f2fd;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.message-ai .content {
    background: white;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.message-system .content {
    background: #fff3e0;
    color: #e65100;
    text-align: center;
    border-radius: 18px;
    font-style: italic;
}

/* ========================================
   5. 打字机效果
   ======================================== */
.typing-dots {
    display: inline-flex;
    align-items: center;
}

.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1.5s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.typewriter-cursor {
    display: inline-block;
    font-weight: bold;
    color: #667eea;
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.typewriter-skip-hint {
    color: #999;
    font-size: 12px;
    margin-left: 8px;
    cursor: pointer;
    transition: color 0.2s;
}

.typewriter-skip-hint:hover {
    color: #667eea;
    text-decoration: underline;
}

.typewriter-animation {
    animation: fadeInText 0.3s ease-in-out;
}

@keyframes fadeInText {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

.typewriter-complete {
    animation: none;
}

/* ========================================
   6. 音乐播放器
   ======================================== */
.music-player {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: none; /* ✅ 默认隐藏 */
    visibility: hidden; /* ✅ 确保完全隐藏 */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* ✅ 显式定义 hidden 状态 */
.music-player.hidden {
    display: none !important;
    visibility: hidden !important;
}

/* ✅ 显式定义 visible 状态 */
.music-player.visible {
    display: block !important;
    visibility: visible !important;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.song-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}

.music-icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.song-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

#song-title {
    font-size: 0.95rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#artist-name.artist {
    font-size: 0.8rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.player-controls button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.player-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.mode-btn {
    position: relative;
}

#mode-icon {
    font-size: 16px;
    transition: all 0.3s ease;
}

.mode-btn:hover #mode-icon {
    transform: rotate(30deg) scale(1.2);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

#current-time, #duration {
    font-size: 0.75rem;
    min-width: 35px;
    opacity: 0.9;
    font-variant-numeric: tabular-nums;
}

#progress-bar, #volume-slider {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

#progress-bar::-webkit-slider-thumb,
#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#progress-bar::-moz-range-thumb,
#volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.volume-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

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

/* 播放/暂停按钮状态 */
#play-pause.playing::before {
    content: '⏸';
}

#play-pause.paused::before {
    content: '▶';
}

/* 音乐控制额外按钮（喜欢、收藏） */
.music-controls-extra {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.like-btn, .favorite-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.8rem;
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 50%;
}

.like-btn:hover, .favorite-btn:hover {
    transform: scale(1.2);
    background: rgba(102, 126, 234, 0.1);
}

.like-btn.liked {
    animation: heartBeat 0.5s ease;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* 收藏夹面板 */
.favorites-panel {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 300px;
    max-height: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow-y: auto;
    display: none;
}

.favorites-panel.show {
    display: block;
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.favorites-header {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.favorites-header h4 {
    margin: 0;
    font-size: 1rem;
}

.close-favorites {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.favorite-item:hover {
    background: #f8f9fa;
}

.favorite-info {
    flex: 1;
}

.favorite-title {
    font-weight: 600;
    color: #343a40;
    margin-bottom: 4px;
}

.favorite-artist {
    font-size: 0.85rem;
    color: #6c757d;
}

.favorite-actions {
    display: flex;
    gap: 8px;
}

.play-favorite, .remove-favorite {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.play-favorite:hover {
    background: #667eea;
    color: white;
}

.remove-favorite:hover {
    background: #dc3545;
    color: white;
}

.empty-favorites {
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
}

/* 播放模式切换提示动画 */
@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* 音乐通知动画 */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* ========================================
   7. 输入区域
   ======================================== */
.input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.input-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.voice-btn, .send-btn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    background: #f0f0f0;
}

.voice-btn:hover, .send-btn:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.voice-btn.recording {
    background: #ff6b6b;
    color: white;
    animation: recordingPulse 1.5s infinite;
}

@keyframes recordingPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 15px rgba(255, 107, 107, 0);
    }
}

#message-input {
    flex: 1;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    resize: none;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
    max-height: 150px;
}

#message-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-hints {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-selector label {
    font-weight: 500;
    color: #555;
}

#model-select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s ease;
}

#model-select:focus {
    border-color: #667eea;
}

.toggle-btn {
    padding: 8px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

.toggle-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 语音控制复选框样式 */
.voice-controls .checkbox-wrapper {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
}

.voice-controls .auto-send-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.voice-controls .auto-send-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    font-size: 13px;
    color: #667eea;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    border: 2px solid transparent;
}

.voice-controls .auto-send-label:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.3);
}

.voice-controls .auto-send-label:active {
    transform: translateY(0);
}

.voice-controls .checkbox-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
    flex-shrink: 0;
}

.voice-controls .auto-send-checkbox:checked + .auto-send-label .checkbox-icon {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 2px 8px rgba(17, 153, 142, 0.4);
}

.voice-controls .auto-send-checkbox:checked + .auto-send-label {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.15) 0%, rgba(56, 239, 125, 0.15) 100%);
    color: #11998e;
    border-color: rgba(17, 153, 142, 0.3);
}

.voice-controls .auto-send-checkbox:checked + .auto-send-label:hover {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.25) 0%, rgba(56, 239, 125, 0.25) 100%);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.3);
}

.voice-controls .checkbox-text {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* 麦克风图标动画 */
.mic-icon {
    transition: all 0.3s ease;
}

.voice-btn:hover .mic-icon {
    transform: scale(1.2);
}

.voice-btn.recording .mic-icon {
    animation: micBounce 0.6s infinite;
}

@keyframes micBounce {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.3); }
}

.voice-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ========================================
   8. 状态栏
   ======================================== */
.status-bar {
    display: flex;
    justify-content: space-around;
    padding: 12px 20px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    font-size: 14px;
    color: #666;
    position: relative;
    z-index: 1;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-weight: 500;
    color: #555;
}

/* ========================================
   9. 侧边面板（闹钟、笔记等）
   ======================================== */
.side-panel {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 280px;
    max-height: calc(100vh - 30px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s ease;
    display: none;
}

.side-panel.active,
.side-panel:not(:empty) {
    display: block;
}

.panel-section {
    margin-bottom: 0;
    border: none;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
}

.panel-section:first-child {
    border-radius: 16px 16px 0 0;
}

.panel-section:last-child {
    border-radius: 0 0 16px 16px;
    margin-bottom: 0;
}

.panel-section.hidden {
    display: none !important;
}

.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.panel-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.toggle-panel-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.toggle-panel-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.panel-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.panel-content {
    padding: 10px 15px;
    max-height: 250px;
    overflow-y: auto;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
}

.panel-content.collapsed {
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

/* 面板快速操作栏 */
.panel-quick-actions {
    padding: 10px 15px;
    border-top: 1px solid #e9ecef;
    background: rgba(248, 249, 250, 0.8);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-action-btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.quick-action-btn.danger {
    background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
}

.quick-action-btn:active {
    transform: translateY(0);
}

/* ✨ 快捷操作栏 - 显示在输入框下方 */
.quick-access-bar {
    display: flex;
    gap: 10px;
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-radius: 10px;
    margin: 10px 15px 15px 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.quick-access-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.quick-access-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.quick-access-btn:active {
    transform: translateY(-1px);
}

.empty-tip {
    text-align: center;
    color: #999;
    font-size: 0.9rem;
    padding: 20px;
}

/* 闹钟项样式 */
.alarm-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.2s;
}

.alarm-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.alarm-time {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.alarm-message {
    font-size: 0.9rem;
    color: #666;
}

.alarm-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.alarm-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.alarm-btn.delete {
    background: #ff4757;
    color: white;
}

.alarm-btn.delete:hover {
    background: #ff6b81;
}

.alarm-btn.snooze {
    background: #ffa502;
    color: white;
}

.alarm-btn.snooze:hover {
    background: #ffc048;
}

.alarm-btn.edit {
    background: #3742fa;
    color: white;
}

.alarm-btn.edit:hover {
    background: #535cff;
}

/* 笔记项样式 */
.note-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #764ba2;
    transition: all 0.2s;
}

.note-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.note-content {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.5;
}

.note-date {
    font-size: 0.8rem;
    color: #999;
}

.note-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.note-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.note-btn.edit {
    background: #3742fa;
    color: white;
}

.note-btn.edit:hover {
    background: #535cff;
}

.note-btn.delete {
    background: #ff4757;
    color: white;
}

.note-btn.delete:hover {
    background: #ff6b81;
}

/* ========================================
   10. 唤醒词相关
   ======================================== */
.wake-word-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    margin-top: 10px;
}

.wake-word-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wake-word-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.wake-word-btn:active {
    transform: translateY(0);
}

.wake-word-btn.active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    animation: wakePulse 2s infinite;
}

@keyframes wakePulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 107, 107, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

.wake-word-help {
    color: #666;
    font-size: 12px;
}

/* 唤醒状态提示 */
.wake-status {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(76, 175, 80, 0.9);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    font-size: 18px;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: wakeFadeInOut 3s ease-in-out;
}

.wake-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pulse-animation {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
    0% { transform: scale(0.8); opacity: 0.7; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.7; }
}

@keyframes wakeFadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    90% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* ========================================
   11. 推荐和快捷操作
   ======================================== */
.recommendations-section {
    position: fixed;
    bottom: 120px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 300px;
    z-index: 1000;
    display: none;
}

.quick-actions-section {
    position: fixed;
    top: 100px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 250px;
    z-index: 1000;
    display: none;
}

.recommendation-btn, .quick-action-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin: 5px 0;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
}

.recommendation-btn:hover, .quick-action-btn:hover {
    background: #5a6fd8;
}

.quick-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.close-quick-actions {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
}

/* ========================================
   12. 广告展示区域
   ======================================== */
.advertisement-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    margin: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: adSlideDown 0.5s ease-out;
    position: relative;
}

.advertisement-section.hidden {
    display: none;
}

@keyframes adSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ad-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}

.ad-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.ad-text {
    flex: 1;
}

.ad-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 4px;
}

.ad-description {
    font-size: 13px;
    opacity: 0.9;
}

.close-ad {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.close-ad:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.ad-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    top: 10px;
    right: 10px;
}

.ad-next-btn {
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.ad-next-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

.ad-next-btn:active {
    transform: scale(0.95);
}

/* ========================================
   13. AI 设置中心
   ======================================== */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.settings-panel.active {
    display: block;
}

/* 增强版 AI 设置面板 */
#ai-settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 700px;
    max-height: 85vh;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.15),
        0 0 0 1px rgba(0,0,0,0.05);
    z-index: 10000;
    display: none;
    overflow: hidden;
    animation: panelSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
}

#ai-settings-panel.active {
    display: block;
}

@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.settings-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h2 {
    margin: 0;
    font-size: 24px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.close-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

.settings-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.settings-section {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: #fafafa;
}

.settings-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.setting-item textarea,
.setting-item input,
.setting-item select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.setting-item textarea:focus,
.setting-item input:focus,
.setting-item select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.setting-item textarea {
    min-height: 80px;
    resize: vertical;
}

.apply-btn,
.save-btn,
.reset-btn,
.preview-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    margin-right: 10px;
}

.apply-btn {
    background-color: #28a745;
    color: white;
}

.apply-btn:hover {
    background-color: #218838;
}

.save-btn {
    background-color: #007bff;
    color: white;
}

.save-btn:hover {
    background-color: #0056b3;
}

.reset-btn {
    background-color: #6c757d;
    color: white;
}

.reset-btn:hover {
    background-color: #545b62;
}

.preview-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
}

.preview-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.preview-btn:active {
    transform: translateY(0);
}

.settings-actions {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

/* 遮罩层 */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: none;
    animation: overlayFadeIn 0.3s ease;
}

.settings-overlay.active {
    display: block;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 设置预览区域 */
.settings-preview {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    margin-top: 15px;
    border: 1px solid #e9ecef;
    display: none; /* 默认隐藏 */
}

.settings-preview.visible {
    display: block; /* 仅在点击预览按钮时显示 */
}

.settings-preview h4 {
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-section {
    background: white;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 3px solid #667eea;
}

.preview-section:last-child {
    margin-bottom: 0;
}

.preview-section h4 {
    font-size: 0.95rem;
    color: #343a40;
    margin-bottom: 10px;
    font-weight: 600;
}

.preview-section p {
    color: #6c757d;
    line-height: 1.6;
    margin: 0;
}

/* ========================================
   14. 底部操作按钮
   ======================================== */
.bottom-actions {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 1000;
}

.action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    background: white;
    color: #333;
    visibility: visible;
    opacity: 1;
}

.action-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    background: #f8f9fa;
}

.settings-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.music-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.voice-btn {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: #212529;
}

/* ========================================
   15. 滚动条样式
   ======================================== */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ========================================
   17. 客服弹窗样式
   ======================================== */

.modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.modal-body {
    padding: 20px;
}

.contact-info,
.contact-tips {
    margin-bottom: 20px;
}

.contact-info h3,
.contact-tips h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.contact-icon {
    font-size: 24px;
    margin-right: 15px;
}

.contact-detail {
    flex: 1;
}

.contact-detail strong {
    display: block;
    margin-bottom: 5px;
    color: #555;
}

.contact-detail a {
    color: #667eea;
    text-decoration: none;
}

.contact-detail a:hover {
    text-decoration: underline;
}

.contact-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.contact-tips li {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    font-size: 14px;
    color: #856404;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 手机端客服弹窗优化 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .contact-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .contact-icon {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .modal-footer {
        padding: 12px 15px;
    }
}

/* ========================================
   18. 完整响应式设计 - 优化版
   ======================================== */

/* 🖥️ 超大屏幕 (桌面显示器 > 1920px) */
@media (min-width: 1920px) {
    .chat-container {
        max-width: 90%;
        min-width: 1400px;
    }
    
    .side-panel {
        width: 380px;
        right: 40px;
        top: 30px;
    }
    
    .chat-header h1 {
        font-size: 1.8rem;
    }
    
    .datetime-display {
        font-size: 1rem;
    }
}

/* 💻 大屏幕 (大笔记本 1441px - 1919px) */
@media (max-width: 1919px) and (min-width: 1441px) {
    .chat-container {
        max-width: 95%;
        min-width: 1200px;
    }
    
    .side-panel {
        width: 350px;
        right: 25px;
        top: 20px;
    }
}

/* 📱 中等屏幕 (普通笔记本/平板横屏 1025px - 1440px) */
@media (max-width: 1440px) and (min-width: 1025px) {
    .chat-container {
        max-width: 98%;
    }
    
    .side-panel {
        width: 320px;
        right: 15px;
        top: 15px;
    }
    
    .chat-header {
        padding: 18px 20px;
    }
}

/* 📱 小屏幕 (平板竖屏 769px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .chat-container {
        max-width: 95%;
        margin: 10px auto;
        border-radius: 10px;
    }
    
    .side-panel {
        width: 300px;
        right: 10px;
        top: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .panel-header h3 {
        font-size: 0.9rem;
    }
    
    .chat-header {
        padding: 15px 18px;
    }
    
    .chat-header h1 {
        font-size: 1.3rem;
    }
    
    .datetime-display {
        font-size: 0.85rem;
        gap: 12px;
    }
}

/* 📱 手机模式 (< 768px) - 全面优化 */
@media (max-width: 768px) {
    /* ===== 主容器 ===== */
    .chat-container {
        max-width: 100%;
        min-height: 100vh;
        min-height: 100dvh; /* ✅ 使用 min-height 而不是 height，允许内容超出 */
        height: auto; /* ✅ 自动高度，支持滚动 */
        border-radius: 0;
        margin: 0;
        overflow: visible; /* ✅ 允许内容溢出 */
    }
    
    /* ===== 头部区域 ===== */
    .chat-header {
        padding: 12px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .header-left {
        flex: 1;
        min-width: 150px;
    }
    
    .chat-header h1 {
        font-size: 1.1rem;
        margin-bottom: 0;
    }
    
    /* 日期时间显示优化 */
    .datetime-display {
        gap: 5px;
        padding: 3px 8px;
        font-size: 0.7rem;
        flex-direction: row;
        flex-wrap: nowrap;
    }
    
    .date-text {
        font-size: 0.7rem;
        white-space: nowrap;
    }
    
    .time-text {
        font-size: 0.75rem;
        min-width: 60px;
    }
    
    /* 用户信息区域优化 */
    .status-indicator {
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
        order: 2;
        min-width: auto;
    }
    
    #current-model {
        font-size: 0.7rem;
    }
    
    .connection-status {
        width: 10px;
        height: 10px;
    }
    
    .user-info-section {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px !important;
    }
    
    #user-mode-badge {
        order: 1;
    }
    
    #login-btn, #logout-btn {
        order: 2;
        padding: 5px 10px;
        font-size: 11px;
    }
    
    /* 用户登录按钮优化 */
    #login-btn, #logout-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    #user-display-name {
        font-size: 0.75rem;
    }
    
    #visitor-badge, #logged-in-badge {
        font-size: 9px;
        padding: 2px 5px;
    }
    
    #device-ip-info {
        display: none !important; /* 手机端隐藏IP信息节省空间 */
    }
    
    /* ===== 广告区域 ===== */
    .advertisement-section {
        margin: 8px 10px;
        padding: 12px 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .ad-content {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .ad-icon {
        font-size: 24px;
    }
    
    .ad-title {
        font-size: 14px;
    }
    
    .ad-description {
        font-size: 12px;
    }
    
    .ad-controls {
        position: static;
        justify-content: center;
        width: 100%;
    }
    
    /* ===== 侧边面板 - 改为底部抽屉式 ===== */
    .side-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 70vh;
        max-height: 70vh;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
        transition: transform 0.3s ease;
        transform: translateY(100%);
        z-index: 10000;
    }
    
    .side-panel.active {
        transform: translateY(0);
    }
    
    .panel-section {
        margin-bottom: 10px;
        border-radius: 0;
    }
    
    .panel-section:first-child {
        border-radius: 20px 20px 0 0;
    }
    
    .panel-header {
        padding: 14px 18px;
    }
    
    .panel-header h3 {
        font-size: 1rem;
    }
    
    .panel-content {
        padding: 15px;
        max-height: calc(70vh - 120px);
    }
    
    .panel-action-btn,
    .toggle-panel-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    /* 闹钟和笔记项优化 */
    .alarm-item,
    .note-item {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .alarm-time {
        font-size: 1.1rem;
    }
    
    .alarm-message,
    .note-content {
        font-size: 0.85rem;
    }
    
    .alarm-btn,
    .note-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    
    /* ===== 聊天消息区域 ===== */
    .chat-messages {
        padding: 15px;
        padding-bottom: 80px; /* 为底部输入框留空间 */
        /* ✅ 确保聊天区域可以流畅滚动 */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: calc(100vh - 200px); /* 限制最大高度，留出头部和输入框空间 */
    }
    
    .message {
        gap: 8px;
    }
    
    .avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .content {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .welcome-message {
        padding: 30px 15px;
    }
    
    .welcome-message h3 {
        font-size: 1.1rem;
    }
    
    .welcome-message p {
        font-size: 0.85rem;
    }
    
    /* ===== 音乐播放器 ===== */
    .music-player {
        padding: 10px 12px;
        bottom: 60px; /* 在输入框上方 */
    }
    
    .song-details {
        font-size: 0.8rem;
    }
    
    #song-title {
        font-size: 0.85rem;
    }
    
    #artist-name.artist {
        font-size: 0.7rem;
    }
    
    .player-controls button {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .music-icon {
        font-size: 1.2rem;
    }
    
    /* ===== 输入区域 ===== */
    .input-area {
        padding: 12px 15px;
    }
    
    .input-controls {
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .voice-btn, .send-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    #message-input {
        font-size: 16px; /* 防止 iOS 自动缩放 */
        padding: 12px;
        min-height: 40px;
    }
    
    .input-hints {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .model-selector {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .voice-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    #model-select {
        font-size: 14px;
        padding: 6px 10px;
    }
    
    .toggle-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    /* 语音控制复选框优化 */
    .voice-controls .auto-send-label {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .voice-controls .checkbox-icon {
        width: 18px;
        height: 18px;
        font-size: 12px;
    }
    
    /* ===== 状态栏 ===== */
    .status-bar {
        flex-direction: column;
        gap: 6px;
        text-align: center;
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .status-item {
        justify-content: center;
    }
    
    /* ===== 设置面板 ===== */
    .settings-panel,
    #ai-settings-panel {
        width: 95%;
        max-width: 95%;
        max-height: 85vh;
        border-radius: 16px;
    }
    
    .settings-header {
        padding: 16px;
    }
    
    .settings-header h2 {
        font-size: 1.2rem;
    }
    
    .settings-content {
        padding: 15px;
        max-height: calc(85vh - 60px);
    }
    
    .settings-section {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .settings-section h3 {
        font-size: 1rem;
    }
    
    .setting-item textarea,
    .setting-item input,
    .setting-item select {
        font-size: 16px; /* 防止 iOS 缩放 */
        padding: 10px;
    }
    
    .apply-btn,
    .save-btn,
    .reset-btn,
    .preview-btn {
        width: 100%;
        margin: 8px 0;
        padding: 12px;
        font-size: 15px;
    }
    
    .settings-actions {
        margin: 0 -15px -15px -15px;
        padding: 15px;
    }
    
    /* ===== 底部操作按钮 ===== */
    .bottom-actions {
        bottom: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .action-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    /* ===== 推荐和快捷操作 ===== */
    .recommendations-section,
    .quick-actions-section {
        width: 90%;
        max-width: none;
        left: 5%;
        right: 5%;
    }
    
    .recommendations-section {
        bottom: 140px;
    }
    
    .quick-actions-section {
        top: 80px;
    }
    
    /* ===== 收藏夹面板 ===== */
    .favorites-panel {
        width: 90%;
        left: 5%;
        right: 5%;
        top: 50px;
        max-height: 50vh;
    }
}

/* 📱 小屏手机横屏 (iPhone SE 等 < 667px) */
@media (max-width: 667px) and (orientation: landscape) {
    .chat-container {
        height: 100vh;
    }
    
    .chat-header {
        padding: 8px 12px;
    }
    
    .chat-header h1 {
        font-size: 1rem;
    }
    
    .datetime-display {
        display: none; /* 横屏时隐藏日期时间节省空间 */
    }
    
    .side-panel {
        height: 80vh;
        max-height: 80vh;
    }
    
    .panel-content {
        max-height: calc(80vh - 100px);
    }
    
    .chat-messages {
        padding-bottom: 70px;
    }
    
    .music-player {
        bottom: 55px;
    }
}

/* 📱 超小屏幕 (老款手机 < 375px) */
@media (max-width: 375px) {
    .chat-header h1 {
        font-size: 0.95rem;
    }
    
    .datetime-display {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    .date-text {
        font-size: 0.7rem;
    }
    
    .time-text {
        font-size: 0.75rem;
    }
    
    .avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .content {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    
    .panel-header h3 {
        font-size: 0.9rem;
    }
    
    .alarm-btn,
    .note-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    
    .action-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

/* 折叠屏设备 */
@media (max-width: 768px) and (min-width: 500px) and (orientation: portrait) {
    .side-panel {
        width: 80%;
    }
}

/* 打印样式 */
@media print {
    .side-panel,
    .music-player,
    .chat-input-container {
        display: none !important;
    }
    
    .chat-messages {
        overflow: visible;
    }
}
