﻿/**
 * 沉浸式写作页面样式 - 从 index.php 抽离
 * 包含：码字区布局、侧边栏、主题切换等
 */

/* ========== 基础布局 ========== */
.immersive-write { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #1a1a2e; display: flex; z-index: 1000; transition: background 0.3s; }
.immersive-sidebar { width: 180px; min-width: 180px; background: #16213e; border-right: 1px solid #0f3460; display: flex; flex-direction: column; transition: all 0.3s; flex-shrink: 0; }
.immersive-sidebar.collapsed { width: 0; min-width: 0; overflow: hidden; border: none; }
.immersive-main { flex: 1; display: flex; flex-direction: column; background: #1a1a2e; transition: background 0.3s; min-width: 0; }
.immersive-header { padding: 12px 24px; background: #16213e; border-bottom: 1px solid #0f3460; display: flex; justify-content: space-between; align-items: center; transition: background 0.3s, border-color 0.3s; }
.immersive-editor { flex: 1; padding: 20px 40px; overflow: hidden; display: flex; flex-direction: column; }
.immersive-editor form { display: flex; flex-direction: column; flex: 1; height: 100%; }
.immersive-title { background: transparent; border: none; color: #e8e8e8; font-size: 22px; font-weight: 600; padding: 10px 0; margin-bottom: 12px; width: 100%; outline: none; border-bottom: 1px solid #0f3460; transition: color 0.3s, border-color 0.3s; flex-shrink: 0; }
.immersive-title::placeholder { color: #4a5568; }
.immersive-content { flex: 1; background: #0f0f23; border: 1px solid #0f3460; border-radius: 8px; padding: 24px 32px; color: #e8e8e8; font-size: 16px; line-height: 2; resize: none; outline: none; font-family: inherit; transition: background 0.3s, color 0.3s, border-color 0.3s; width: 100%; box-sizing: border-box; }
.immersive-content::placeholder { color: #4a5568; }

/* ========== 侧边栏 ========== */
.sidebar-header { padding: 12px; border-bottom: 1px solid #0f3460; transition: border-color 0.3s; }
.sidebar-header h3 { color: #e8e8e8; font-size: 13px; margin: 0 0 6px; transition: color 0.3s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-stats { display: flex; gap: 12px; font-size: 11px; color: #94a3b8; transition: color 0.3s; }
.sidebar-chapters { flex: 1; overflow-y: auto; padding: 8px; }
.sidebar-chapter { padding: 10px; border-radius: 6px; margin-bottom: 6px; cursor: pointer; transition: all 0.2s; border: 2px solid transparent; text-decoration: none; display: block; }
.sidebar-chapter:hover { background: #1e3a5f; }
.sidebar-chapter.active { background: #1e3a5f; border-color: #4f46e5; }
.sidebar-chapter-title { color: #e8e8e8; font-size: 12px; font-weight: 500; margin-bottom: 3px; transition: color 0.3s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-chapter-meta { color: #64748b; font-size: 10px; transition: color 0.3s; }
.sidebar-footer { padding: 10px; border-top: 1px solid #0f3460; transition: border-color 0.3s; }
.btn-new-chapter { width: 100%; padding: 8px; background: #4f46e5; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 12px; }
.btn-new-chapter:hover { background: #4338ca; }

/* ========== 头部 ========== */
.immersive-write .header-left { display: flex !important; align-items: center; gap: 12px; }
.header-back { color: #94a3b8; text-decoration: none; font-size: 13px; display: flex; align-items: center; gap: 4px; transition: color 0.3s; }
.header-back:hover { color: #e8e8e8; }
.header-info { color: #94a3b8; font-size: 12px; transition: color 0.3s; }
.header-right { display: flex; align-items: center; gap: 12px; }
.word-count { color: #94a3b8; font-size: 12px; transition: color 0.3s; }
.word-count span { color: #4f46e5; font-weight: 600; }
.btn-save { padding: 6px 16px; background: #10b981; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 500; }
.btn-save:hover { background: #059669; }
.status-badge { padding: 3px 8px; border-radius: 4px; font-size: 11px; }
.status-new { background: #10b981; color: #fff; }
.status-edit { background: #f59e0b; color: #fff; }
.progress-bar { height: 2px; background: #0f3460; border-radius: 2px; margin-top: 4px; overflow: hidden; transition: background 0.3s; }
.progress-bar-fill { height: 100%; background: #4f46e5; transition: width 0.3s; }
.toggle-sidebar {
    background: #4f46e5;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.3s;
    font-weight: 600;
}
.toggle-sidebar:hover {
    background: #4338ca;
    transform: scale(1.05);
}
.immersive-sidebar.collapsed ~ .immersive-main .toggle-sidebar {
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* ========== 手机端隐藏式菜单 ========== */
.mobile-menu-btn { display: none; background: linear-gradient(135deg, #4f46e5, #7c3aed); border: none; color: #fff; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 18px; align-items: center; justify-content: center; }
.mobile-menu-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 9998; }
.mobile-menu-panel { display: none; position: fixed; top: 0; right: -280px; width: 280px; height: 100%; background: #fff; z-index: 9999; transition: right 0.3s ease; overflow-y: auto; box-shadow: -4px 0 20px rgba(0,0,0,0.15); }
.mobile-menu-panel.active { right: 0; }
.mobile-menu-header { padding: 16px; background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; display: flex; justify-content: space-between; align-items: center; }
.mobile-menu-header h3 { margin: 0; font-size: 16px; }
.mobile-menu-close { background: rgba(255,255,255,0.2); border: none; color: #fff; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; line-height: 1; }
.mobile-menu-section { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; }
.mobile-menu-section-title { font-size: 11px; color: #94a3b8; text-transform: uppercase; margin-bottom: 8px; font-weight: 600; }
.mobile-menu-item { display: flex; align-items: center; gap: 10px; padding: 12px; background: #f8fafc; border-radius: 8px; margin-bottom: 8px; cursor: pointer; border: none; width: 100%; text-align: left; font-size: 13px; color: #333; transition: all 0.2s; }
.mobile-menu-item:hover { background: #eef2ff; }
.mobile-menu-item:last-child { margin-bottom: 0; }
.mobile-menu-item-icon { font-size: 16px; width: 24px; text-align: center; }
.mobile-menu-item-text { flex: 1; }
.mobile-menu-item-badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: #4f46e5; color: #fff; }
.mobile-word-count { padding: 16px; background: #f8fafc; text-align: center; }
.mobile-word-count-num { font-size: 28px; font-weight: 700; color: #4f46e5; }
.mobile-word-count-label { font-size: 12px; color: #64748b; margin-top: 4px; }
.mobile-save-btn { margin: 16px; padding: 14px; background: linear-gradient(135deg, #10b981, #059669); color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; width: calc(100% - 32px); }

/* ========== 手机端底部工具栏 ========== */
.mobile-bottom-bar { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid #e2e8f0; padding: 8px 12px; z-index: 1000; box-shadow: 0 -2px 10px rgba(0,0,0,0.1); }
.mobile-bottom-bar-inner { display: flex; justify-content: space-around; align-items: center; max-width: 500px; margin: 0 auto; }
.mobile-bar-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 12px; background: none; border: none; cursor: pointer; color: #64748b; font-size: 10px; }
.mobile-bar-btn-icon { font-size: 20px; }
.mobile-bar-btn.active { color: #4f46e5; }
.mobile-bar-btn-save { background: linear-gradient(135deg, #10b981, #059669); color: #fff; border-radius: 8px; padding: 8px 16px; }
.mobile-bar-btn-save .mobile-bar-btn-icon { font-size: 16px; }

/* ========== 手机端响应式 ========== */
@media (max-width: 768px) { 
    .immersive-sidebar { position: fixed; left: -180px; top: 0; bottom: 0; z-index: 10001; transition: left 0.3s ease; width: 180px !important; min-width: 180px !important; overflow-y: auto !important; background: #16213e !important; display: flex !important; flex-direction: column !important; }
    .immersive-sidebar.mobile-show { left: 0 !important; }
    #mobileSidebarOverlay { z-index: 10000 !important; }
    /* 手机端各主题侧边栏背景色 */
    .light-theme .immersive-sidebar { background: #ffffff !important; }
    .sepia-theme .immersive-sidebar { background: #ebe5d6 !important; }
    .green-theme .immersive-sidebar { background: #c8e6c9 !important; }
    .blue-theme .immersive-sidebar { background: #bbdefb !important; }
    .purple-theme .immersive-sidebar { background: #e1bee7 !important; }
    .warm-theme .immersive-sidebar { background: #ffecb3 !important; }
    .night-theme .immersive-sidebar { background: #1c2529 !important; }
    .desktop-only { display: none !important; }
    .immersive-editor { padding: 12px 12px 80px 12px; }
    .immersive-header { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
    .header-left { flex: 1; min-width: 0; }
    .header-left .header-info { display: none; }
    .header-left .status-badge { display: none; }
    .header-right { display: none; }
    .mobile-menu-btn { display: flex; }
    .mobile-bottom-bar { display: block; }
    .immersive-title { font-size: 18px; padding: 8px 0; }
    .immersive-content { font-size: 15px; line-height: 1.9; padding: 16px; }
    /* 手机端隐藏切换按钮 */
    .toggle-sidebar { display: none !important; }
    /* 浮窗手机端适配 */
    #notesPanel, #uploadPanel, #aiExpansionPanel, #chapterEvalPanel, #keywordQuickPanel { 
        width: calc(100% - 24px) !important; 
        left: 12px !important; 
        right: 12px !important; 
        max-height: 70vh !important;
        top: 60px !important;
    }
    #charStatusPanelManual {
        width: calc(100% - 24px) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-height: 70vh !important;
    }
}

/* ========== 桌面端确保切换按钮显示 ========== */
@media (min-width: 769px) {
    .toggle-sidebar {
        display: inline-block !important;
    }
}

/* ========== 主题切换按钮 ========== */
.theme-toggle { background: none; border: 1px solid #0f3460; color: #94a3b8; cursor: pointer; font-size: 14px; padding: 4px 10px; border-radius: 6px; transition: all 0.3s; display: flex; align-items: center; gap: 4px; }
.theme-toggle:hover { background: #0f3460; color: #e8e8e8; }

/* ========== 白色主题 ========== */
.immersive-write.light-theme { background: #f8fafc; }
.light-theme .immersive-sidebar { background: #ffffff; border-right-color: #e2e8f0; }
.light-theme .immersive-main { background: #f8fafc; }
.light-theme .immersive-header { background: #ffffff; border-bottom-color: #e2e8f0; }
.light-theme .immersive-title { color: #1e293b; border-bottom-color: #e2e8f0; }
.light-theme .immersive-title::placeholder { color: #94a3b8; }
.light-theme .immersive-content { background: #ffffff; color: #1e293b; border-color: #e2e8f0; }
.light-theme .immersive-content::placeholder { color: #94a3b8; }
.light-theme .sidebar-header { border-bottom-color: #e2e8f0; }
.light-theme .sidebar-header h3 { color: #1e293b; }
.light-theme .sidebar-stats { color: #64748b; }
.light-theme .sidebar-chapter:hover { background: #f1f5f9; }
.light-theme .sidebar-chapter.active { background: #eef2ff; border-color: #4f46e5; }
.light-theme .sidebar-chapter-title { color: #1e293b; }
.light-theme .sidebar-chapter-meta { color: #64748b; }
.light-theme .sidebar-footer { border-top-color: #e2e8f0; }
.light-theme .header-back { color: #64748b; }
.light-theme .header-back:hover { color: #1e293b; }
.light-theme .header-info { color: #64748b; }
.light-theme .word-count { color: #64748b; }
.light-theme .toggle-sidebar { background: #4f46e5 !important; color: #fff !important; }
.light-theme .toggle-sidebar:hover { background: #4338ca !important; color: #fff !important; }
.light-theme .progress-bar { background: #e2e8f0; }
.light-theme .theme-toggle { border-color: #e2e8f0; color: #64748b; }
.light-theme .theme-toggle:hover { background: #f1f5f9; color: #1e293b; }

/* ========== 羊皮纸主题 ========== */
.immersive-write.sepia-theme { background: #f5f0e1; }
.sepia-theme .immersive-sidebar { background: #ebe5d6; border-right-color: #d4cfc0; }
.sepia-theme .immersive-main { background: #f5f0e1; }
.sepia-theme .immersive-header { background: #ebe5d6; border-bottom-color: #d4cfc0; }
.sepia-theme .immersive-title { color: #5d4e37; border-bottom-color: #d4cfc0; }
.sepia-theme .immersive-content { background: #faf6ed; color: #5d4e37; border-color: #d4cfc0; }
.sepia-theme .sidebar-header { border-bottom-color: #d4cfc0; }
.sepia-theme .sidebar-header h3 { color: #5d4e37; }
.sepia-theme .sidebar-stats { color: #8b7355; }
.sepia-theme .sidebar-chapter:hover { background: #e5dfd0; }
.sepia-theme .sidebar-chapter.active { background: #e5dfd0; border-color: #8b7355; }
.sepia-theme .sidebar-chapter-title { color: #5d4e37; }
.sepia-theme .sidebar-footer { border-top-color: #d4cfc0; }
.sepia-theme .header-back, .sepia-theme .header-info, .sepia-theme .word-count { color: #8b7355; }
.sepia-theme .toggle-sidebar { background: #4f46e5 !important; color: #fff !important; }
.sepia-theme .toggle-sidebar:hover { background: #4338ca !important; color: #fff !important; }
.sepia-theme .progress-bar { background: #d4cfc0; }
.sepia-theme .theme-toggle { border-color: #d4cfc0; color: #8b7355; }

/* ========== 护眼绿主题 ========== */
.immersive-write.green-theme { background: #e8f5e9; }
.green-theme .immersive-sidebar { background: #c8e6c9; border-right-color: #a5d6a7; }
.green-theme .immersive-main { background: #e8f5e9; }
.green-theme .immersive-header { background: #c8e6c9; border-bottom-color: #a5d6a7; }
.green-theme .immersive-title { color: #2e7d32; border-bottom-color: #a5d6a7; }
.green-theme .immersive-content { background: #f1f8e9; color: #33691e; border-color: #a5d6a7; }
.green-theme .sidebar-header { border-bottom-color: #a5d6a7; }
.green-theme .sidebar-header h3 { color: #2e7d32; }
.green-theme .sidebar-stats { color: #558b2f; }
.green-theme .sidebar-chapter:hover { background: #dcedc8; }
.green-theme .sidebar-chapter.active { background: #dcedc8; border-color: #66bb6a; }
.green-theme .sidebar-chapter-title { color: #2e7d32; }
.green-theme .sidebar-footer { border-top-color: #a5d6a7; }
.green-theme .header-back, .green-theme .header-info, .green-theme .word-count { color: #558b2f; }
.green-theme .toggle-sidebar { background: #4f46e5 !important; color: #fff !important; }
.green-theme .toggle-sidebar:hover { background: #4338ca !important; color: #fff !important; }
.green-theme .progress-bar { background: #a5d6a7; }
.green-theme .theme-toggle { border-color: #a5d6a7; color: #558b2f; }

/* ========== 淡蓝主题 ========== */
.immersive-write.blue-theme { background: #e3f2fd; }
.blue-theme .immersive-sidebar { background: #bbdefb; border-right-color: #90caf9; }
.blue-theme .immersive-main { background: #e3f2fd; }
.blue-theme .immersive-header { background: #bbdefb; border-bottom-color: #90caf9; }
.blue-theme .immersive-title { color: #1565c0; border-bottom-color: #90caf9; }
.blue-theme .immersive-content { background: #e8f4fc; color: #0d47a1; border-color: #90caf9; }
.blue-theme .sidebar-header { border-bottom-color: #90caf9; }
.blue-theme .sidebar-header h3 { color: #1565c0; }
.blue-theme .sidebar-stats { color: #1976d2; }
.blue-theme .sidebar-chapter:hover { background: #e1f5fe; }
.blue-theme .sidebar-chapter.active { background: #e1f5fe; border-color: #42a5f5; }
.blue-theme .sidebar-chapter-title { color: #1565c0; }
.blue-theme .sidebar-footer { border-top-color: #90caf9; }
.blue-theme .header-back, .blue-theme .header-info, .blue-theme .word-count { color: #1976d2; }
.blue-theme .toggle-sidebar { background: #4f46e5 !important; color: #fff !important; }
.blue-theme .toggle-sidebar:hover { background: #4338ca !important; color: #fff !important; }
.blue-theme .progress-bar { background: #90caf9; }
.blue-theme .theme-toggle { border-color: #90caf9; color: #1976d2; }

/* ========== 淡紫主题 ========== */
.immersive-write.purple-theme { background: #f3e5f5; }
.purple-theme .immersive-sidebar { background: #e1bee7; border-right-color: #ce93d8; }
.purple-theme .immersive-main { background: #f3e5f5; }
.purple-theme .immersive-header { background: #e1bee7; border-bottom-color: #ce93d8; }
.purple-theme .immersive-title { color: #7b1fa2; border-bottom-color: #ce93d8; }
.purple-theme .immersive-content { background: #fce4ec; color: #6a1b9a; border-color: #ce93d8; }
.purple-theme .sidebar-header { border-bottom-color: #ce93d8; }
.purple-theme .sidebar-header h3 { color: #7b1fa2; }
.purple-theme .sidebar-stats { color: #8e24aa; }
.purple-theme .sidebar-chapter:hover { background: #f8bbd9; }
.purple-theme .sidebar-chapter.active { background: #f8bbd9; border-color: #ab47bc; }
.purple-theme .sidebar-chapter-title { color: #7b1fa2; }
.purple-theme .sidebar-footer { border-top-color: #ce93d8; }
.purple-theme .header-back, .purple-theme .header-info, .purple-theme .word-count { color: #8e24aa; }
.purple-theme .toggle-sidebar { background: #4f46e5 !important; color: #fff !important; }
.purple-theme .toggle-sidebar:hover { background: #4338ca !important; color: #fff !important; }
.purple-theme .progress-bar { background: #ce93d8; }
.purple-theme .theme-toggle { border-color: #ce93d8; color: #8e24aa; }

/* ========== 暖黄主题 ========== */
.immersive-write.warm-theme { background: #fff8e1; }
.warm-theme .immersive-sidebar { background: #ffecb3; border-right-color: #ffe082; }
.warm-theme .immersive-main { background: #fff8e1; }
.warm-theme .immersive-header { background: #ffecb3; border-bottom-color: #ffe082; }
.warm-theme .immersive-title { color: #f57f17; border-bottom-color: #ffe082; }
.warm-theme .immersive-content { background: #fffde7; color: #e65100; border-color: #ffe082; }
.warm-theme .sidebar-header { border-bottom-color: #ffe082; }
.warm-theme .sidebar-header h3 { color: #f57f17; }
.warm-theme .sidebar-stats { color: #ff8f00; }
.warm-theme .sidebar-chapter:hover { background: #fff9c4; }
.warm-theme .sidebar-chapter.active { background: #fff9c4; border-color: #ffca28; }
.warm-theme .sidebar-chapter-title { color: #f57f17; }
.warm-theme .sidebar-footer { border-top-color: #ffe082; }
.warm-theme .header-back, .warm-theme .header-info, .warm-theme .word-count { color: #ff8f00; }
.warm-theme .toggle-sidebar { background: #4f46e5 !important; color: #fff !important; }
.warm-theme .toggle-sidebar:hover { background: #4338ca !important; color: #fff !important; }
.warm-theme .progress-bar { background: #ffe082; }
.warm-theme .theme-toggle { border-color: #ffe082; color: #ff8f00; }

/* ========== 夜间主题 ========== */
.immersive-write.night-theme { background: #263238; }
.night-theme .immersive-sidebar { background: #1c2529; border-right-color: #37474f; }
.night-theme .immersive-main { background: #263238; }
.night-theme .immersive-header { background: #1c2529; border-bottom-color: #37474f; }
.night-theme .immersive-title { color: #b0bec5; border-bottom-color: #37474f; }
.night-theme .immersive-content { background: #1e272c; color: #cfd8dc; border-color: #37474f; }
.night-theme .sidebar-header { border-bottom-color: #37474f; }
.night-theme .sidebar-header h3 { color: #b0bec5; }
.night-theme .sidebar-stats { color: #78909c; }
.night-theme .sidebar-chapter:hover { background: #37474f; }
.night-theme .sidebar-chapter.active { background: #37474f; border-color: #546e7a; }
.night-theme .sidebar-chapter-title { color: #b0bec5; }
.night-theme .sidebar-footer { border-top-color: #37474f; }
.night-theme .header-back, .night-theme .header-info, .night-theme .word-count { color: #78909c; }
.night-theme .toggle-sidebar { background: #4f46e5 !important; color: #fff !important; }
.night-theme .toggle-sidebar:hover { background: #4338ca !important; color: #fff !important; }
.night-theme .progress-bar { background: #37474f; }
.night-theme .theme-toggle { border-color: #37474f; color: #78909c; }

/* ========== 统一按钮样式 ========== */
.header-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    height: 28px;
    line-height: 1;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: all 0.2s;
}
.header-btn:hover { opacity: 0.9; }
label.header-btn { height: 28px; min-width: 48px; }
.header-right { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }

@media (max-width: 768px) {
    .header-right.desktop-only { display: none !important; }
}

/* ========== 深色主题(dark-write-theme) & 夜间主题 - 头部按钮适配 ========== */
/* 覆盖inline style的浅色背景，使按钮在深色背景下可见 */
.dark-write-theme .header-btn.ai-tip-btn,
.night-theme .header-btn.ai-tip-btn {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: #c8cdd3 !important;
}
.dark-write-theme .header-btn.ai-tip-btn:hover,
.night-theme .header-btn.ai-tip-btn:hover {
    background: rgba(255,255,255,0.15) !important;
    color: #e8e8e8 !important;
}
/* 保留有色按钮原色 */
.dark-write-theme .header-btn.btn-save,
.night-theme .header-btn.btn-save {
    background: #10b981 !important; color: #fff !important; border: none !important;
}
.dark-write-theme .header-btn[onclick*="deleteCurrentChapter"],
.night-theme .header-btn[onclick*="deleteCurrentChapter"] {
    background: #ef4444 !important; color: #fff !important;
}
.dark-write-theme .header-btn[onclick*="copyCurrentChapter"],
.night-theme .header-btn[onclick*="copyCurrentChapter"] {
    background: #6366f1 !important; color: #fff !important;
}
.dark-write-theme .header-btn[onclick*="showShareDialog"],
.night-theme .header-btn[onclick*="showShareDialog"] {
    background: #ec4899 !important; color: #fff !important;
}
/* 智能补齐按钮 */
.dark-write-theme #smartCompleteLabel,
.night-theme #smartCompleteLabel {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: #c8cdd3 !important;
}
.dark-write-theme #smartCompleteLabel.active,
.night-theme #smartCompleteLabel.active {
    background: #4f46e5 !important; border-color: #4f46e5 !important; color: #fff !important;
}
/* 字体大小调整容器 */
.dark-write-theme .header-right > div[style*="inline-flex"],
.night-theme .header-right > div[style*="inline-flex"] {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
}
.dark-write-theme #fontSizeDisplay,
.night-theme #fontSizeDisplay { color: #c8cdd3 !important; }
/* 字数统计栏 */
.dark-write-theme .word-count[style],
.night-theme .word-count[style] {
    background: rgba(255,255,255,0.08) !important; color: #c8cdd3 !important;
}
/* 历史按钮 */
.dark-write-theme .header-btn[onclick*="toggleVersionHistory"],
.night-theme .header-btn[onclick*="toggleVersionHistory"] {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: #c8cdd3 !important;
}

/* ========== 深色主题 - 浮窗面板通用适配 ========== */
.dark-write-theme #assistPanel,
.dark-write-theme #colorPickerPanel,
.dark-write-theme #aiExpansionPanel,
.dark-write-theme #chapterEvalPanel,
.dark-write-theme #timelinePanel,
.dark-write-theme #notesPanel,
.dark-write-theme #uploadPanel,
.dark-write-theme #charStatusPanelManual,
.dark-write-theme #keywordQuickPanel,
.dark-write-theme #versionHistoryPanel,
.night-theme #assistPanel,
.night-theme #colorPickerPanel,
.night-theme #aiExpansionPanel,
.night-theme #chapterEvalPanel,
.night-theme #timelinePanel,
.night-theme #notesPanel,
.night-theme #uploadPanel,
.night-theme #charStatusPanelManual,
.night-theme #keywordQuickPanel,
.night-theme #versionHistoryPanel {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
}

/* 浮窗内文字颜色覆盖 */
.dark-write-theme #assistPanel [style*="color:#333"],
.dark-write-theme #aiExpansionPanel [style*="color:#333"],
.dark-write-theme #chapterEvalPanel [style*="color:#333"],
.dark-write-theme #timelinePanel [style*="color:#333"],
.dark-write-theme #notesPanel [style*="color:#333"],
.dark-write-theme #uploadPanel [style*="color:#333"],
.dark-write-theme #charStatusPanelManual [style*="color:#333"],
.dark-write-theme #keywordQuickPanel [style*="color:#333"],
.dark-write-theme #versionHistoryPanel [style*="color:#333"],
.dark-write-theme #colorPickerPanel [style*="color:#666"],
.night-theme #assistPanel [style*="color:#333"],
.night-theme #aiExpansionPanel [style*="color:#333"],
.night-theme #chapterEvalPanel [style*="color:#333"],
.night-theme #timelinePanel [style*="color:#333"],
.night-theme #notesPanel [style*="color:#333"],
.night-theme #uploadPanel [style*="color:#333"],
.night-theme #charStatusPanelManual [style*="color:#333"],
.night-theme #keywordQuickPanel [style*="color:#333"],
.night-theme #versionHistoryPanel [style*="color:#333"],
.night-theme #colorPickerPanel [style*="color:#666"] {
    color: #e2e8f0 !important;
}

.dark-write-theme #assistPanel [style*="color:#666"],
.dark-write-theme #aiExpansionPanel [style*="color:#666"],
.dark-write-theme #chapterEvalPanel [style*="color:#666"],
.dark-write-theme #timelinePanel [style*="color:#666"],
.dark-write-theme #notesPanel [style*="color:#666"],
.dark-write-theme #uploadPanel [style*="color:#666"],
.dark-write-theme #keywordQuickPanel [style*="color:#666"],
.dark-write-theme #versionHistoryPanel [style*="color:#666"],
.night-theme #assistPanel [style*="color:#666"],
.night-theme #aiExpansionPanel [style*="color:#666"],
.night-theme #chapterEvalPanel [style*="color:#666"],
.night-theme #timelinePanel [style*="color:#666"],
.night-theme #notesPanel [style*="color:#666"],
.night-theme #uploadPanel [style*="color:#666"],
.night-theme #keywordQuickPanel [style*="color:#666"],
.night-theme #versionHistoryPanel [style*="color:#666"] {
    color: #94a3b8 !important;
}
.dark-write-theme #assistPanel [style*="color:#888"],
.dark-write-theme #aiExpansionPanel [style*="color:#888"],
.dark-write-theme #chapterEvalPanel [style*="color:#888"],
.dark-write-theme #notesPanel [style*="color:#888"],
.dark-write-theme #uploadPanel [style*="color:#888"],
.dark-write-theme #keywordQuickPanel [style*="color:#888"],
.night-theme #assistPanel [style*="color:#888"],
.night-theme #aiExpansionPanel [style*="color:#888"],
.night-theme #chapterEvalPanel [style*="color:#888"],
.night-theme #notesPanel [style*="color:#888"],
.night-theme #uploadPanel [style*="color:#888"],
.night-theme #keywordQuickPanel [style*="color:#888"] {
    color: #64748b !important;
}

/* 浮窗内浅色背景区域 */
.dark-write-theme #assistPanel [style*="background:linear-gradient"],
.dark-write-theme #chapterEvalPanel [style*="background:#f8fafc"],
.dark-write-theme #chapterEvalPanel [style*="background:#f3f4f6"],
.dark-write-theme #timelinePanel [style*="background:#f8fafc"],
.dark-write-theme #notesPanel [style*="background:#f8fafc"],
.dark-write-theme #uploadPanel [style*="background:#f8fafc"],
.dark-write-theme #keywordQuickPanel [style*="background:#f8fafc"],
.dark-write-theme #versionHistoryPanel [style*="background:#f8fafc"],
.dark-write-theme #aiExpansionPanel [style*="background:#f3f4f6"],
.dark-write-theme #aiExpansionPanel [style*="background:linear-gradient(145deg,#f8fafc"],
.night-theme #assistPanel [style*="background:linear-gradient"],
.night-theme #chapterEvalPanel [style*="background:#f8fafc"],
.night-theme #chapterEvalPanel [style*="background:#f3f4f6"],
.night-theme #timelinePanel [style*="background:#f8fafc"],
.night-theme #notesPanel [style*="background:#f8fafc"],
.night-theme #uploadPanel [style*="background:#f8fafc"],
.night-theme #keywordQuickPanel [style*="background:#f8fafc"],
.night-theme #versionHistoryPanel [style*="background:#f8fafc"],
.night-theme #aiExpansionPanel [style*="background:#f3f4f6"],
.night-theme #aiExpansionPanel [style*="background:linear-gradient(145deg,#f8fafc"] {
    background: #0f172a !important;
    border-color: #334155 !important;
}

/* 浮窗内浅色边框 */
.dark-write-theme #chapterEvalPanel [style*="border:1px solid #e2e8f0"],
.dark-write-theme #chapterEvalPanel [style*="border-bottom:1px solid #e2e8f0"],
.dark-write-theme #timelinePanel [style*="border:1px solid #e2e8f0"],
.dark-write-theme #notesPanel [style*="border:1px solid #e2e8f0"],
.dark-write-theme #uploadPanel [style*="border:1px solid #e2e8f0"],
.dark-write-theme #keywordQuickPanel [style*="border:1px solid #e2e8f0"],
.dark-write-theme #versionHistoryPanel [style*="border-bottom:1px solid #e2e8f0"],
.dark-write-theme #versionHistoryPanel [style*="border-top:1px solid #e2e8f0"],
.dark-write-theme #aiExpansionPanel [style*="border-bottom:1px solid #e2e8f0"],
.night-theme #chapterEvalPanel [style*="border:1px solid #e2e8f0"],
.night-theme #timelinePanel [style*="border:1px solid #e2e8f0"],
.night-theme #notesPanel [style*="border:1px solid #e2e8f0"],
.night-theme #uploadPanel [style*="border:1px solid #e2e8f0"],
.night-theme #keywordQuickPanel [style*="border:1px solid #e2e8f0"],
.night-theme #versionHistoryPanel [style*="border-bottom:1px solid #e2e8f0"],
.night-theme #aiExpansionPanel [style*="border-bottom:1px solid #e2e8f0"] {
    border-color: #334155 !important;
}

/* 辅助面板特殊区域 */
.dark-write-theme #assistPanel [style*="color:#1e293b"],
.night-theme #assistPanel [style*="color:#1e293b"] { color: #e2e8f0 !important; }
.dark-write-theme #assistPanel [style*="color:#64748b"],
.night-theme #assistPanel [style*="color:#64748b"] { color: #94a3b8 !important; }
.dark-write-theme #assistPanel [style*="color:#1e40af"],
.night-theme #assistPanel [style*="color:#1e40af"] { color: #60a5fa !important; }
.dark-write-theme #assistPanel [style*="color:#92400e"],
.dark-write-theme #assistPanel [style*="color:#a16207"],
.dark-write-theme #uploadPanel [style*="color:#92400e"],
.night-theme #assistPanel [style*="color:#92400e"],
.night-theme #assistPanel [style*="color:#a16207"],
.night-theme #uploadPanel [style*="color:#92400e"] { color: #fbbf24 !important; }
.dark-write-theme #assistPanel select,
.dark-write-theme #assistPanel input[type="number"],
.night-theme #assistPanel select,
.night-theme #assistPanel input[type="number"] {
    background: #1e293b !important; color: #e2e8f0 !important; border-color: #334155 !important;
}
.dark-write-theme #autoSaveIntervalDiv,
.night-theme #autoSaveIntervalDiv {
    background: #0f172a !important; border-color: #1e3a5f !important;
}
.dark-write-theme #assistPanel [style*="border-bottom:1px solid #f0f0f0"],
.night-theme #assistPanel [style*="border-bottom:1px solid #f0f0f0"] {
    border-bottom-color: #334155 !important;
}

/* AI面板标签页 */
.dark-write-theme #aiExpansionPanel .ai-tab-btn,
.night-theme #aiExpansionPanel .ai-tab-btn {
    background: #0f172a !important; color: #94a3b8 !important;
}
.dark-write-theme #aiExpansionPanel .ai-tab-btn.active,
.night-theme #aiExpansionPanel .ai-tab-btn.active {
    background: #4f46e5 !important; color: #fff !important;
}
.dark-write-theme #aiExpansionBody,
.night-theme #aiExpansionBody { background: #1e293b !important; }
.dark-write-theme #aiExpansionContent,
.dark-write-theme #aiContinueContent,
.dark-write-theme #aiSavedContinue,
.night-theme #aiExpansionContent,
.night-theme #aiContinueContent,
.night-theme #aiSavedContinue { color: #e2e8f0 !important; }

/* 上传面板提示区域 */
.dark-write-theme #uploadPanel [style*="background:#fef3c7"],
.night-theme #uploadPanel [style*="background:#fef3c7"] {
    background: #1a1a0a !important; border-color: #854d0e !important;
}

/* 浮窗内 input/textarea/select 深色适配 */
.dark-write-theme #chapterEvalPanel input, .dark-write-theme #chapterEvalPanel textarea, .dark-write-theme #chapterEvalPanel select,
.dark-write-theme #timelinePanel input,
.dark-write-theme #notesPanel input, .dark-write-theme #notesPanel textarea, .dark-write-theme #notesPanel select,
.dark-write-theme #uploadPanel input, .dark-write-theme #uploadPanel select,
.dark-write-theme #keywordQuickPanel input, .dark-write-theme #keywordQuickPanel select,
.dark-write-theme #charStatusPanelManual input, .dark-write-theme #charStatusPanelManual select,
.night-theme #chapterEvalPanel input, .night-theme #chapterEvalPanel textarea, .night-theme #chapterEvalPanel select,
.night-theme #timelinePanel input,
.night-theme #notesPanel input, .night-theme #notesPanel textarea, .night-theme #notesPanel select,
.night-theme #uploadPanel input, .night-theme #uploadPanel select,
.night-theme #keywordQuickPanel input, .night-theme #keywordQuickPanel select,
.night-theme #charStatusPanelManual input, .night-theme #charStatusPanelManual select {
    background: #0f172a !important; color: #e2e8f0 !important; border-color: #334155 !important;
}

/* 写作记录面板 */
.dark-write-theme .note-add-form,
.night-theme .note-add-form {
    background: #0f172a !important; border-color: #334155 !important;
}
.dark-write-theme .note-add-form input, .dark-write-theme .note-add-form textarea,
.night-theme .note-add-form input, .night-theme .note-add-form textarea {
    background: #1e293b !important; color: #e2e8f0 !important; border-color: #334155 !important;
}

/* 续写来源按钮 */
.dark-write-theme .continue-source-btn,
.night-theme .continue-source-btn {
    background: #0f172a !important; color: #94a3b8 !important; border-color: #334155 !important;
}
.dark-write-theme .continue-source-btn.active,
.night-theme .continue-source-btn.active {
    background: #4f46e5 !important; color: #fff !important; border-color: #4f46e5 !important;
}

/* 关键词面板搜索区域 */
.dark-write-theme #keywordQuickPanel [style*="background:linear-gradient"],
.night-theme #keywordQuickPanel [style*="background:linear-gradient"] {
    background: #0f172a !important;
}

/* 手机端菜单深色适配 */
.dark-write-theme .mobile-menu-panel,
.night-theme .mobile-menu-panel { background: #1e293b !important; }
.dark-write-theme .mobile-menu-item,
.night-theme .mobile-menu-item { background: #0f172a !important; color: #e2e8f0 !important; }
.dark-write-theme .mobile-menu-item:hover,
.night-theme .mobile-menu-item:hover { background: #1e3a5f !important; }
.dark-write-theme .mobile-menu-section,
.night-theme .mobile-menu-section { border-bottom-color: #334155 !important; }
.dark-write-theme .mobile-word-count,
.night-theme .mobile-word-count { background: #0f172a !important; }
.dark-write-theme .mobile-word-count-label,
.night-theme .mobile-word-count-label { color: #94a3b8 !important; }
.dark-write-theme .mobile-bottom-bar,
.night-theme .mobile-bottom-bar { background: #16213e !important; border-top-color: #0f3460 !important; }
.dark-write-theme .mobile-bar-btn,
.night-theme .mobile-bar-btn { color: #94a3b8 !important; }

/* ========== body.dark-mode 全面适配 ========== */
/* 当主站深色模式开启时，码字区强制深色，覆盖所有浅色主题 */

body.dark-mode .immersive-write,
body.dark-mode .immersive-main { background: #1a1a2e !important; }
body.dark-mode .immersive-sidebar { background: #16213e !important; border-right-color: #0f3460 !important; }
body.dark-mode .immersive-header { background: #16213e !important; border-bottom-color: #0f3460 !important; }

body.dark-mode .sidebar-header { border-bottom-color: #0f3460 !important; }
body.dark-mode .sidebar-header h3 { color: #e8e8e8 !important; }
body.dark-mode .sidebar-stats { color: #94a3b8 !important; }
body.dark-mode .sidebar-chapter:hover { background: #1e3a5f !important; }
body.dark-mode .sidebar-chapter.active { background: #1e3a5f !important; border-color: #4f46e5 !important; }
body.dark-mode .sidebar-chapter-title { color: #e8e8e8 !important; }
body.dark-mode .sidebar-chapter-meta { color: #64748b !important; }
body.dark-mode .sidebar-footer { border-top-color: #0f3460 !important; }

body.dark-mode .immersive-title { color: #e8e8e8 !important; border-bottom-color: #0f3460 !important; }
body.dark-mode .immersive-title::placeholder { color: #4a5568 !important; }
body.dark-mode .immersive-content { background: #0f0f23 !important; color: #e8e8e8 !important; border-color: #0f3460 !important; }
body.dark-mode .immersive-content::placeholder { color: #4a5568 !important; }

body.dark-mode .header-back { color: #94a3b8 !important; }
body.dark-mode .header-back:hover { color: #e8e8e8 !important; }
body.dark-mode .header-info { color: #94a3b8 !important; }
body.dark-mode .word-count { color: #94a3b8 !important; }
body.dark-mode .toggle-sidebar { background: #4f46e5 !important; color: #fff !important; }
body.dark-mode .toggle-sidebar:hover { background: #4338ca !important; color: #fff !important; }
body.dark-mode .progress-bar { background: #0f3460 !important; }
body.dark-mode .theme-toggle { border-color: #0f3460 !important; color: #94a3b8 !important; }
body.dark-mode .theme-toggle:hover { background: #0f3460 !important; color: #e8e8e8 !important; }

/* 工具栏按钮统一深色 */
body.dark-mode .immersive-header .header-btn.ai-tip-btn {
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: #c8cdd3 !important;
}
body.dark-mode .immersive-header .header-btn.ai-tip-btn:hover {
    background: rgba(255,255,255,0.15) !important;
    color: #e8e8e8 !important;
}
body.dark-mode .immersive-header .header-btn.btn-save {
    background: #10b981 !important; color: #fff !important; border: none !important;
}
body.dark-mode .immersive-header .header-btn[onclick*="deleteCurrentChapter"] {
    background: #ef4444 !important; color: #fff !important; border: none !important;
}
body.dark-mode .immersive-header .header-right > div[style*="inline-flex"] {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
}
body.dark-mode #fontSizeDisplay { color: #c8cdd3 !important; }
body.dark-mode .word-count[style] {
    background: rgba(255,255,255,0.08) !important; color: #c8cdd3 !important;
}
body.dark-mode .immersive-header .header-btn[onclick*="toggleVersionHistory"] {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: #c8cdd3 !important;
}
body.dark-mode .immersive-header .header-btn.theme-toggle[style] {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: #c8cdd3 !important;
}
body.dark-mode #smartCompleteLabel {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: #c8cdd3 !important;
}
body.dark-mode #smartCompleteLabel.active {
    background: #4f46e5 !important; border-color: #4f46e5 !important; color: #fff !important;
}
body.dark-mode #colorPickerPanel {
    background: #1e293b !important; border-color: #334155 !important;
}
body.dark-mode #colorPickerPanel div[style*="color:#666"] {
    color: #94a3b8 !important;
}

/* 侧边栏功能按钮深色适配 */
body.dark-mode .sidebar-header + div button[style*="background:#10b981"],
body.dark-mode .sidebar-header + div button[style*="background:#6366f1"],
body.dark-mode .sidebar-header + div button[style*="background:#f59e0b"],
body.dark-mode .sidebar-header + div button[style*="background:#ef4444"] {
    opacity: 0.85;
}

/* 批量删除栏 */
body.dark-mode #batchDeleteBar { background: #1a1a2e !important; }

/* 手机端底部栏 */
body.dark-mode .mobile-bottom-bar { background: #16213e !important; border-top-color: #0f3460 !important; }
body.dark-mode .mobile-bar-btn { color: #94a3b8 !important; }
body.dark-mode .mobile-menu-panel { background: #1e293b !important; }
body.dark-mode .mobile-menu-item { background: #0f172a !important; color: #e2e8f0 !important; }
body.dark-mode .mobile-menu-section { border-bottom-color: #334155 !important; }
body.dark-mode .mobile-word-count { background: #0f172a !important; }

/* 浮窗面板深色适配 */
body.dark-mode #assistPanel,
body.dark-mode #colorPickerPanel,
body.dark-mode #aiExpansionPanel,
body.dark-mode #chapterEvalPanel,
body.dark-mode #timelinePanel,
body.dark-mode #notesPanel,
body.dark-mode #uploadPanel,
body.dark-mode #charStatusPanelManual,
body.dark-mode #keywordQuickPanel,
body.dark-mode #versionHistoryPanel {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
}
body.dark-mode #assistPanel div[style*="color:#333"],
body.dark-mode #aiExpansionPanel div[style*="color:#333"],
body.dark-mode #chapterEvalPanel div[style*="color:#333"],
body.dark-mode #notesPanel div[style*="color:#333"],
body.dark-mode #uploadPanel div[style*="color:#333"],
body.dark-mode #keywordQuickPanel div[style*="color:#333"],
body.dark-mode #versionHistoryPanel div[style*="color:#333"] {
    color: #e2e8f0 !important;
}
body.dark-mode #assistPanel div[style*="color:#666"],
body.dark-mode #aiExpansionPanel div[style*="color:#666"],
body.dark-mode #chapterEvalPanel div[style*="color:#666"],
body.dark-mode #notesPanel div[style*="color:#666"],
body.dark-mode #uploadPanel div[style*="color:#666"],
body.dark-mode #keywordQuickPanel div[style*="color:#666"],
body.dark-mode #versionHistoryPanel div[style*="color:#666"] {
    color: #94a3b8 !important;
}
body.dark-mode #assistPanel select,
body.dark-mode #assistPanel input[type="number"] {
    background: #1e293b !important; color: #e2e8f0 !important; border-color: #334155 !important;
}
body.dark-mode #assistPanel div[style*="border-bottom:1px solid #f0f0f0"] {
    border-bottom-color: #334155 !important;
}
body.dark-mode #assistPanel label[style*="background:linear-gradient"] {
    background: #0f172a !important; border-color: #334155 !important;
}
body.dark-mode #assistPanel div[style*="color:#1e293b"] { color: #e2e8f0 !important; }
body.dark-mode #assistPanel div[style*="color:#64748b"] { color: #94a3b8 !important; }
body.dark-mode #assistPanel div[style*="color:#1e40af"] { color: #60a5fa !important; }
body.dark-mode #assistPanel div[style*="color:#92400e"],
body.dark-mode #assistPanel div[style*="color:#a16207"] { color: #fbbf24 !important; }
body.dark-mode #assistPanel div[style*="background:linear-gradient(135deg,#eff6ff"],
body.dark-mode #assistPanel div[style*="background:linear-gradient(135deg,#fefce8"] {
    background: #0f172a !important; border-color: #334155 !important;
}
