/* ========== 代码格式化工具主容器 ========== */
.cf-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 210px);
    min-height: 560px;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ========== 顶部工具栏 ========== */
.cf-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(17, 153, 142, 0.3);
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    min-height: 28px;
}

.toolbar-btn {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #11998e;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cf-btn-primary {
    background: #fff !important;
    color: #11998e !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.cf-btn-primary:hover:not(:disabled) {
    background: #f0fdf4 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18) !important;
}

.cf-btn-primary.active {
    background: #dcfce7 !important;
    color: #166534 !important;
}

.toolbar-select {
    padding: 5px 8px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.92);
    color: #11998e;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.toolbar-select:focus {
    background: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* ========== 主内容区域（三栏布局） ========== */
.cf-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #f8fafc;
}

/* ========== 左侧历史面板 ========== */
.cf-history-panel {
    width: 200px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 3px;
    transition: all 0.2s;
}

.history-clear-btn:hover {
    background: #fde8e8;
}

.history-search {
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.history-search input:focus {
    border-color: #11998e;
    box-shadow: 0 0 0 2px rgba(17, 153, 142, 0.1);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.history-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    padding: 24px 8px;
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 7px 9px;
    margin-bottom: 3px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    animation: fadeIn 0.2s ease;
}

.history-item:hover {
    background: #f0fdf4;
    border-color: #86efac;
    transform: translateX(2px);
}

.history-item.active {
    background: #dcfce7;
    border-color: #22c55e;
    box-shadow: 0 1px 3px rgba(34, 197, 94, 0.2);
}

.history-item-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #fde8e8;
    color: #ef4444;
    border: none;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    opacity: 0;
    transition: all 0.2s;
    cursor: pointer;
    line-height: 1;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: #ef4444;
    color: white;
}

.history-item-name {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 3px;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 18px;
}

.history-item-meta {
    font-size: 11px;
    color: #64748b;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.history-item-lang {
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 3px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* ========== 中间输入面板 ========== */
.cf-editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
    min-width: 280px;
    border-right: 1px solid #e2e8f0;
}

/* ========== 右侧输出面板 ========== */
.cf-output-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
    min-width: 280px;
}

/* ========== 面板公共头部 ========== */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    gap: 6px;
}

.panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

/* ========== 字符计数（颜色分级） ========== */
.char-count {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 3px;
    background: #f1f5f9;
    transition: all 0.2s;
    white-space: nowrap;
}

.char-count.cc-gray {
    color: #94a3b8;
    background: #f1f5f9;
}

.char-count.cc-red {
    color: #dc2626;
    background: #fef2f2;
}

.char-count.cc-orange {
    color: #d97706;
    background: #fffbeb;
}

.char-count.cc-green {
    color: #16a34a;
    background: #f0fdf4;
}

.char-count.cc-orange-bold {
    color: #b45309;
    background: #fef3c7;
    font-weight: 700;
}

.char-count.cc-red-bold {
    color: #991b1b;
    background: #fef2f2;
    font-weight: 700;
}

/* ========== 操作小按钮 ========== */
.small-action-btn {
    padding: 3px 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.small-action-btn:hover {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

/* ========== 格式化状态标签 ========== */
.format-status {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    transition: all 0.3s;
}

.format-status.status-success {
    background: #dcfce7;
    color: #166534;
}

.format-status.status-error {
    background: #fef2f2;
    color: #991b1b;
}

.format-status.status-warning {
    background: #fffbeb;
    color: #92400e;
}

/* ========== 代码文本区域 ========== */
.code-textarea {
    flex: 1;
    padding: 14px 16px;
    font-family: 'Consolas', 'Monaco', 'Lucida Console', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.65;
    border: none;
    outline: none;
    resize: none;
    background: #fafafa;
    color: #2d3748;
    transition: background 0.2s;
    tab-size: 4;
    user-select: text;
    overflow: auto;
}

.code-textarea::placeholder {
    color: #94a3b8;
    font-style: italic;
}

.code-textarea:focus {
    background: #fff;
    box-shadow: inset 0 0 0 1px #e0e0e0;
}

.output-textarea {
    background: #f5fef8;
    color: #1a2e22;
    border-left: 3px solid #bbf7d0;
}

.output-textarea:focus {
    background: #edfdf3;
    box-shadow: inset 0 0 0 1px #bbf7d0;
}

/* ========== 底部状态栏 ========== */
.cf-statusbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 5px 12px;
    background: linear-gradient(to bottom, #f1f5f9, #e8edf3);
    border-top: 1px solid #e2e8f0;
    font-size: 11px;
    color: #64748b;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.cf-statusbar span {
    white-space: nowrap;
}

.statusbar-hint {
    margin-left: auto;
    color: #94a3b8;
    font-style: italic;
}

/* ========== AI侧边栏 ========== */
.ai-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.ai-sidebar.open {
    right: 0;
}

.ai-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.ai-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.ai-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    flex-shrink: 0;
}

.ai-sidebar-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.ai-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* AI 模式标签 */
.ai-mode-tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 3px;
    gap: 2px;
}

.ai-mode-tab {
    flex: 1;
    padding: 6px;
    border: none;
    border-radius: 5px;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-mode-tab.active {
    background: white;
    color: #11998e;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-mode-desc {
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    padding: 8px 10px;
    border-radius: 6px;
    border-left: 3px solid #11998e;
}

.ai-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-input-group label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.ai-input-group textarea {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    resize: vertical;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
    color: #374151;
}

.ai-input-group textarea:focus {
    border-color: #11998e;
    box-shadow: 0 0 0 2px rgba(17, 153, 142, 0.1);
}

.ai-actions {
    display: flex;
    gap: 10px;
}

.ai-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-btn-primary {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
}

.ai-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.35);
}

.ai-btn-cancel {
    background: #f1f5f9;
    color: #64748b;
    display: none;
}

.ai-btn-cancel.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-btn-cancel:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* AI结果区 */
.ai-result {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    display: none;
}

.ai-result.visible {
    display: block;
}

.ai-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.ai-result-content {
    padding: 10px 12px;
    font-size: 12px;
    color: #374151;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    font-family: 'Consolas', 'Monaco', monospace;
}

.ai-tips {
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    border-radius: 6px;
    padding: 12px;
    font-size: 12px;
    color: #374151;
}

.ai-tips p {
    margin: 0 0 6px;
    font-weight: 600;
    color: #166534;
}

.ai-tips ul {
    margin: 0;
    padding-left: 16px;
}

.ai-tips li {
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ========== 模态框 ========== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow-y: auto;
    min-width: 340px;
}

.modal-sm {
    width: 420px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 15px;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.modal-body {
    padding: 20px;
}

/* ========== 快捷键表格 ========== */
.shortcut-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.shortcut-table thead th {
    background: #f0fdf4;
    color: #166534;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #bbf7d0;
}

.shortcut-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.shortcut-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    color: #374151;
}

.shortcut-table tbody td:first-child {
    font-family: 'Consolas', monospace;
    background: #f0fdf4;
    color: #166534;
    font-weight: 600;
    border-radius: 3px;
    white-space: nowrap;
}

/* ========== Toast通知 ========== */
.cf-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1e293b;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    max-width: 80vw;
}

.cf-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cf-toast.success {
    background: #166534;
}

.cf-toast.error {
    background: #991b1b;
}

.cf-toast.warning {
    background: #92400e;
}

/* ========== 暗黑主题 ========== */
.cf-dark .cf-container {
    background: #1e1e2e;
}

.cf-dark .cf-main {
    background: #1e1e2e;
}

.cf-dark .cf-history-panel,
.cf-dark .cf-editor-panel,
.cf-dark .cf-output-panel {
    background: #252535;
    border-color: #3a3a5c;
}

.cf-dark .history-header,
.cf-dark .panel-header {
    background: linear-gradient(to bottom, #2d2d45, #252535);
    border-color: #3a3a5c;
}

.cf-dark .history-header h3,
.cf-dark .panel-title {
    color: #94a3b8;
}

.cf-dark .history-item {
    background: #2d2d45;
    border-color: #3a3a5c;
}

.cf-dark .history-item:hover {
    background: #323250;
    border-color: #4a9a8f;
}

.cf-dark .history-item.active {
    background: #1a3a35;
    border-color: #11998e;
}

.cf-dark .history-item-name {
    color: #e2e8f0;
}

.cf-dark .history-item-meta {
    color: #64748b;
}

.cf-dark .code-textarea {
    background: #1e1e2e;
    color: #e2e8f0;
}

.cf-dark .code-textarea:focus {
    background: #252535;
    box-shadow: inset 0 0 0 1px #3a3a5c;
}

.cf-dark .output-textarea {
    background: #1a2e24;
    color: #c3f9d0;
}

.cf-dark .output-textarea:focus {
    background: #1e3328;
    box-shadow: inset 0 0 0 1px #2d5a42;
}

.cf-dark .cf-statusbar {
    background: linear-gradient(to bottom, #252535, #1e1e2e);
    border-color: #3a3a5c;
    color: #64748b;
}

.cf-dark .history-search input {
    background: #2d2d45;
    border-color: #3a3a5c;
    color: #e2e8f0;
}

.cf-dark .history-search input::placeholder {
    color: #64748b;
}

.cf-dark .char-count {
    background: #2d2d45;
    color: #94a3b8;
}

.cf-dark .small-action-btn {
    background: #2d2d45;
    border-color: #3a3a5c;
    color: #94a3b8;
}

.cf-dark .small-action-btn:hover {
    background: #1a3a35;
    border-color: #11998e;
    color: #38ef7d;
}

/* ========== 动画 ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes copied-flash {
    0%   { box-shadow: inset 0 0 0 2px #22c55e; background: #dcfce7; }
    80%  { box-shadow: inset 0 0 0 2px #22c55e; background: #dcfce7; }
    100% { box-shadow: none; background: #f8fff9; }
}

/* ========== 输出区复制闪烁反馈 ========== */
.output-textarea.just-copied {
    animation: copied-flash 0.9s ease forwards;
}

.cf-dark .output-textarea.just-copied {
    animation: none;
    background: #1a3a35 !important;
    box-shadow: inset 0 0 0 2px #22c55e !important;
    transition: background 0.9s ease, box-shadow 0.9s ease;
}

/* ========== 拖拽加载文件视觉反馈 ========== */
.cf-editor-panel {
    position: relative;
}

.cf-editor-panel.drag-over .code-textarea {
    background: #f0fdf4 !important;
    box-shadow: inset 0 0 0 3px #22c55e;
    opacity: 0.85;
}

.cf-editor-panel.drag-over .panel-header {
    background: linear-gradient(to bottom, #dcfce7, #f0fdf4);
}

.cf-dark .cf-editor-panel.drag-over .code-textarea {
    background: #1a3a35 !important;
    box-shadow: inset 0 0 0 3px #22c55e;
}

/* ========== 历史记录数量徽章 ========== */
.history-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #11998e;
    color: white;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    margin-left: 4px;
    vertical-align: middle;
    transition: all 0.2s;
}

.history-count-badge:empty {
    display: none;
}

.cf-dark .history-count-badge {
    background: #38ef7d;
    color: #1e1e2e;
}

/* ========== 工具栏分组分隔线 ========== */
.toolbar-group + .toolbar-group {
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.22);
}

/* ========== 暗黑模式补全 - format-status ========== */
.cf-dark .format-status.status-success {
    background: #1a3a35;
    color: #6ee7b7;
}

.cf-dark .format-status.status-error {
    background: #3a1a1a;
    color: #fca5a5;
}

.cf-dark .format-status.status-warning {
    background: #3a2a10;
    color: #fcd34d;
}

/* ========== 暗黑模式补全 - AI侧边栏 ========== */
.cf-dark .ai-sidebar {
    background: #252535;
}

.cf-dark .ai-sidebar-body {
    background: #252535;
}

.cf-dark .ai-mode-tabs {
    background: #1e1e2e;
}

.cf-dark .ai-mode-tab {
    color: #64748b;
}

.cf-dark .ai-mode-tab.active {
    background: #2d2d45;
    color: #38ef7d;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.cf-dark .ai-mode-desc {
    background: #1e1e2e;
    color: #94a3b8;
    border-left-color: #38ef7d;
}

.cf-dark .ai-input-group label {
    color: #94a3b8;
}

.cf-dark .ai-input-group textarea {
    background: #1e1e2e;
    border-color: #3a3a5c;
    color: #e2e8f0;
}

.cf-dark .ai-input-group textarea:focus {
    border-color: #11998e;
    box-shadow: 0 0 0 2px rgba(17, 153, 142, 0.2);
}

.cf-dark .ai-result {
    border-color: #3a3a5c;
}

.cf-dark .ai-result-header {
    background: #2d2d45;
    border-color: #3a3a5c;
    color: #94a3b8;
}

.cf-dark .ai-result-content {
    background: #1e1e2e;
    color: #c3f9d0;
}

.cf-dark .ai-tips {
    background: #1a3a35;
    border-color: #2d5a42;
}

.cf-dark .ai-tips p {
    color: #6ee7b7;
}

.cf-dark .ai-tips li {
    color: #94a3b8;
}

/* ========== 暗黑模式补全 - 模态框 ========== */
.cf-dark .modal-content {
    background: #252535;
    color: #e2e8f0;
}

.cf-dark .modal-body {
    background: #252535;
}

.cf-dark .shortcut-table thead th {
    background: #1a3a35;
    color: #6ee7b7;
    border-color: #2d5a42;
}

.cf-dark .shortcut-table tbody tr:nth-child(even) {
    background: #1e1e2e;
}

.cf-dark .shortcut-table tbody td {
    border-color: #3a3a5c;
    color: #94a3b8;
}

.cf-dark .shortcut-table tbody td:first-child {
    background: #1a3a35;
    color: #6ee7b7;
}

/* ========== 暗黑模式补全 - 历史清空按鈕 ========== */
.cf-dark .history-clear-btn {
    background: #3a1a1a;
    color: #fca5a5;
}

.cf-dark .history-clear-btn:hover {
    background: #4a1a1a;
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .cf-history-panel {
        width: 160px;
    }
    .statusbar-hint {
        display: none;
    }
}

@media (max-width: 768px) {
    .cf-history-panel {
        width: 140px;
    }

    .cf-toolbar {
        gap: 4px;
        padding: 6px 8px;
    }

    .toolbar-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .toolbar-select {
        font-size: 11px;
        padding: 4px 6px;
    }

    .code-textarea {
        font-size: 12px;
        padding: 12px;
    }
}

@media (max-width: 640px) {
    .cf-main {
        flex-direction: column;
    }

    .cf-history-panel {
        width: 100%;
        height: 120px;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        flex-direction: row;
        flex-shrink: 0;
    }

    .history-list {
        display: flex;
        flex-direction: row;
        gap: 6px;
        padding: 6px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .history-item {
        min-width: 120px;
        margin-bottom: 0;
    }

    .cf-editor-panel,
    .cf-output-panel {
        min-height: 200px;
    }

    .cf-container {
        height: auto;
        min-height: unset;
    }
}

/* ========== 应用层全屏模式 ========== */
.cf-container.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 999;
    border-radius: 0;
    height: 100vh;
    width: 100vw;
}

/* ========== 示例模板下拉菜单 ========== */
.template-dropdown-wrap {
    position: relative;
    display: inline-block;
}

.template-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
    z-index: 10002;
    display: none;
    min-width: 130px;
    overflow: hidden;
    animation: fadeIn 0.15s ease;
}

.template-dropdown.open {
    display: block;
}

.template-dropdown-item {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: #374151;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    white-space: nowrap;
}

.template-dropdown-item:hover {
    background: #f0fdf4;
    color: #11998e;
}

.template-dropdown-item:not(:last-child) {
    border-bottom: 1px solid #f1f5f9;
}

/* 暗黑模式适配 */
.cf-dark .template-dropdown {
    background: #252535;
    border-color: #3a3a5c;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.cf-dark .template-dropdown-item {
    color: #e2e8f0;
}

.cf-dark .template-dropdown-item:hover {
    background: #1a3a35;
    color: #38ef7d;
}

.cf-dark .template-dropdown-item:not(:last-child) {
    border-color: #3a3a5c;
}
