/* ========== 代码解释工具 - 代码主题样式 ========== */
/* 版本约束：基于 jQuery 3.7.1，禁止升级或降级 */

/* ===== 主容器 ===== */
.ce-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #0d1117;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.ce-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ===== 顶部工具栏 ===== */
.ce-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #21262d 100%);
    border-bottom: 1px solid #30363d;
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-brand {
    font-size: 13px;
    font-weight: 700;
    color: #58a6ff;
    letter-spacing: 0.5px;
    font-family: 'Consolas', 'Monaco', monospace;
    margin-right: 4px;
}

.ce-btn {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #c9d1d9;
    transition: all 0.2s;
    white-space: nowrap;
}

.ce-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    transform: translateY(-1px);
}

.ce-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ce-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.ce-btn-primary {
    background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
    border-color: transparent;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(35, 134, 54, 0.35);
}

.ce-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2ea043 0%, #3fb950 100%);
    box-shadow: 0 3px 12px rgba(35, 134, 54, 0.5);
}

.ce-btn-cancel {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    border-color: transparent;
    color: white;
}

.ce-btn-cancel:hover {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

/* ===== 主内容区 ===== */
.ce-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== 左栏：历史记录 ===== */
.ce-history-panel {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #161b22;
    border-right: 1px solid #30363d;
    overflow: hidden;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #0d1117;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #8b949e;
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-count-badge {
    background: #238636;
    color: white;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: 600;
}

.history-clear-btn {
    background: transparent;
    border: 1px solid #30363d;
    color: #8b949e;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.history-clear-btn:hover {
    background: #da3633;
    border-color: #da3633;
    color: white;
}

.history-clear-btn.confirming {
    background: #da3633;
    border-color: #b91c1c;
    color: white;
    font-weight: 600;
    animation: confirmPulse 0.4s ease;
}

@keyframes confirmPulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.history-search-wrap {
    padding: 8px;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

.history-search-wrap input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #30363d;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s;
    background: #0d1117;
    color: #c9d1d9;
}

.history-search-wrap input:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}

.history-search-wrap input::placeholder { color: #484f58; }

.history-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: #30363d #161b22;
}

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: #161b22; }
.history-list::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }

.history-empty {
    padding: 20px 12px;
    text-align: center;
    color: #484f58;
    font-size: 11px;
    line-height: 1.6;
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 9px 10px;
    margin: 3px 0;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    animation: fadeIn 0.2s ease;
}

.history-item:hover {
    background: #161b22;
    border-color: #58a6ff;
    transform: translateX(2px);
}

.history-item.active {
    background: #0d2137;
    border-color: #58a6ff;
    box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.2);
}

.history-item-title {
    font-size: 11px;
    font-weight: 600;
    color: #e6edf3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.history-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
}

.history-item-lang {
    font-size: 10px;
    color: white;
    background: #1f6feb;
    padding: 1px 5px;
    border-radius: 6px;
    font-weight: 500;
    font-family: 'Consolas', monospace;
}

.history-item-mode {
    font-size: 10px;
    color: #8b949e;
    background: #21262d;
    padding: 1px 5px;
    border-radius: 6px;
}

.history-item-time {
    font-size: 10px;
    color: #484f58;
    margin-top: 2px;
}

.history-item-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: transparent;
    color: #484f58;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    border: none;
    line-height: 1;
}

.history-item:hover .history-item-del { opacity: 1; }

.history-item-del:hover {
    background: #da3633;
    color: white;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== 中栏：输入面板 ===== */
.ce-input-panel {
    width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #161b22;
    border-right: 1px solid #30363d;
    overflow: hidden;
}

.panel-header {
    padding: 10px 14px;
    background: #0d1117;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #e6edf3;
}

.panel-tip {
    font-size: 11px;
    color: #8b949e;
}

.ce-input-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: #30363d #161b22;
}

.ce-input-body::-webkit-scrollbar { width: 4px; }
.ce-input-body::-webkit-scrollbar-track { background: #161b22; }
.ce-input-body::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8b949e;
    margin-bottom: 6px;
}

.required-mark {
    color: #f78166;
    margin-left: 2px;
}

.label-opt {
    font-size: 11px;
    font-weight: 400;
    color: #484f58;
}

/* 代码编辑框 */
.code-editor-wrap {
    border: 1px solid #30363d;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.code-editor-wrap:focus-within {
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}

.code-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: #21262d;
    border-bottom: 1px solid #30363d;
}

.lang-select {
    background: transparent;
    border: none;
    color: #8b949e;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    font-family: 'Consolas', monospace;
    padding: 0;
}

.lang-select option { background: #161b22; color: #c9d1d9; }

.code-stats {
    display: flex;
    gap: 6px;
}

.stat-badge {
    font-size: 10px;
    color: #484f58;
    font-family: 'Consolas', monospace;
    background: #0d1117;
    padding: 1px 6px;
    border-radius: 4px;
}

.ce-code-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    background: #0d1117;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e6edf3;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    tab-size: 4;
}

.ce-code-textarea::placeholder { color: #484f58; }

.textarea-footer {
    margin-top: 4px;
}

.shortcut-tip {
    font-size: 11px;
    color: #484f58;
}

/* 解释模式选择器 */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.mode-option {
    display: flex;
    cursor: pointer;
}

.mode-option input[type="radio"] {
    display: none;
}

.mode-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 6px;
    border: 1.5px solid #30363d;
    border-radius: 8px;
    background: #0d1117;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
    gap: 2px;
}

.mode-label:hover {
    border-color: #58a6ff;
    background: #0d2137;
}

.mode-option input[type="radio"]:checked + .mode-label {
    border-color: #58a6ff;
    background: #0d2137;
    box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.3);
}

.mode-icon { font-size: 16px; }
.mode-name {
    font-size: 12px;
    font-weight: 600;
    color: #e6edf3;
}
.mode-desc {
    font-size: 10px;
    color: #484f58;
}

/* 通用输入框 */
.ce-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #30363d;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #0d1117;
    color: #c9d1d9;
}

.ce-input:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}

.ce-input::placeholder { color: #484f58; }

/* ===== 右栏：结果面板 ===== */
.ce-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    overflow: hidden;
    min-width: 320px;
}

.ce-result-panel .panel-header {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 44px;
}

.ce-result-panel .panel-header h3 { color: #e6edf3; }

.result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.result-lang-badge {
    font-size: 11px;
    background: #1f6feb;
    color: white;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 500;
    font-family: 'Consolas', monospace;
}

.result-mode-badge {
    font-size: 11px;
    background: #1a7f37;
    color: white;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 500;
}

.result-time {
    font-size: 11px;
    color: #484f58;
}

.ce-result-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: #30363d #0d1117;
}

.ce-result-body::-webkit-scrollbar { width: 6px; }
.ce-result-body::-webkit-scrollbar-track { background: #0d1117; }
.ce-result-body::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
.ce-result-body::-webkit-scrollbar-thumb:hover { background: #444c56; }

/* 占位区 */
.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #8b949e;
    text-align: center;
    padding: 24px;
}

.placeholder-visual { margin-bottom: 20px; }

.placeholder-terminal {
    width: 260px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
    text-align: left;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #21262d;
    border-bottom: 1px solid #30363d;
}

.term-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.term-dot.red { background: #da3633; }
.term-dot.yellow { background: #e3b341; }
.term-dot.green { background: #3fb950; }

.term-title {
    font-size: 11px;
    color: #8b949e;
    font-family: 'Consolas', monospace;
    margin-left: 4px;
}

.terminal-body {
    padding: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.8;
}

.term-line { color: #8b949e; }
.term-prompt {
    color: #3fb950;
    margin-right: 6px;
    font-weight: bold;
}

.term-cursor {
    color: #58a6ff;
    animation: cursorBlink 1s infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.placeholder-title {
    font-size: 15px;
    font-weight: 600;
    color: #6e7681;
    margin: 8px 0 4px;
}

.placeholder-desc {
    font-size: 12px;
    color: #484f58;
    margin: 2px 0;
}

/* 加载中 */
.result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 14px;
    padding: 20px;
}

.loading-animation {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-ring {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 3px solid #30363d;
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-code-icon {
    font-size: 22px;
    z-index: 1;
}

.loading-text {
    color: #8b949e;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
}

.loading-progress {
    width: 240px;
    height: 3px;
    background: #21262d;
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 5%;
    background: linear-gradient(90deg, #58a6ff, #3fb950);
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite alternate;
}

@keyframes progress {
    from { width: 5%; }
    to   { width: 90%; }
}

.loading-steps {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.loading-step {
    font-size: 11px;
    color: #484f58;
    padding: 3px 10px;
    border: 1px solid #30363d;
    border-radius: 12px;
    transition: all 0.3s;
}

.loading-step.active {
    color: #58a6ff;
    border-color: #58a6ff;
    background: rgba(88, 166, 255, 0.1);
}

/* 抖动动画 */
@keyframes ce-shake {
    0%, 100% { transform: translateX(0); }
    15%  { transform: translateX(-5px); }
    30%  { transform: translateX(4px); }
    45%  { transform: translateX(-3px); }
    60%  { transform: translateX(2px); }
    75%  { transform: translateX(-1px); }
}

.ce-code-textarea.shake {
    animation: ce-shake 0.45s ease;
    border-color: #f78166 !important;
    box-shadow: 0 0 0 2px rgba(247, 129, 102, 0.2) !important;
}

/* ===== Markdown 结果渲染样式 ===== */
.result-content.markdown-body {
    color: #e6edf3;
    font-size: 14px;
    line-height: 1.7;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.markdown-body h1, .markdown-body h2 {
    color: #58a6ff;
    font-size: 16px;
    font-weight: 700;
    margin: 20px 0 10px;
    padding: 6px 12px;
    border-left: 3px solid #58a6ff;
    background: rgba(88, 166, 255, 0.06);
    border-radius: 0 6px 6px 0;
}

.markdown-body h1:first-child, .markdown-body h2:first-child {
    margin-top: 0;
}

.markdown-body h3 {
    color: #3fb950;
    font-size: 14px;
    font-weight: 600;
    margin: 16px 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.markdown-body h3::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: #3fb950;
    border-radius: 2px;
}

.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    color: #e3b341;
    font-size: 13px;
    font-weight: 600;
    margin: 12px 0 6px;
}

.markdown-body p {
    margin: 8px 0;
    color: #c9d1d9;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 20px;
    margin: 8px 0;
}

.markdown-body li {
    color: #c9d1d9;
    margin: 4px 0;
    line-height: 1.6;
}

.markdown-body li::marker { color: #58a6ff; }

.markdown-body strong {
    color: #e6edf3;
    font-weight: 700;
}

.markdown-body em { color: #d2a8ff; }

.markdown-body code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    background: #161b22;
    color: #ffa657;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #30363d;
}

.markdown-body pre {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: #30363d #0d1117;
    position: relative;
}

.markdown-body pre::-webkit-scrollbar { height: 4px; }
.markdown-body pre::-webkit-scrollbar-track { background: #0d1117; }
.markdown-body pre::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }

/* 代码块复制按钮 */
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid #30363d;
    color: #8b949e;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Consolas', monospace;
    transition: all 0.2s;
    opacity: 0;
    white-space: nowrap;
    line-height: 1.5;
}

.code-copy-btn.with-label { top: 34px; }

.markdown-body pre:hover .code-copy-btn { opacity: 1; }

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #58a6ff;
    color: #e6edf3;
}

.code-copy-btn.copied {
    color: #3fb950;
    border-color: #3fb950;
    background: rgba(63, 185, 80, 0.1);
    opacity: 1;
}

.markdown-body pre code {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 13px;
    color: #e6edf3;
    line-height: 1.6;
}

/* 代码块语言标签 */
.code-lang-label {
    display: block;
    background: #1f6feb;
    color: white;
    font-size: 11px;
    font-family: 'Consolas', 'Monaco', monospace;
    padding: 3px 12px;
    margin: -14px -16px 10px -16px;
    border-bottom: 1px solid #30363d;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: lowercase;
    border-radius: 0;
}

.markdown-body blockquote {
    border-left: 3px solid #e3b341;
    background: rgba(227, 179, 65, 0.06);
    padding: 8px 14px;
    margin: 10px 0;
    border-radius: 0 6px 6px 0;
    color: #e3b341;
    font-size: 13px;
}

.markdown-body ol {
    padding-left: 20px;
    margin: 8px 0;
}

.markdown-body ol li {
    color: #c9d1d9;
    margin: 4px 0;
    line-height: 1.6;
}

.markdown-body ol li::marker { color: #e3b341; }

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
    font-size: 13px;
}

.markdown-body th {
    background: #21262d;
    color: #e6edf3;
    padding: 8px 12px;
    border: 1px solid #30363d;
    text-align: left;
    font-weight: 600;
}

.markdown-body td {
    padding: 7px 12px;
    border: 1px solid #30363d;
    color: #c9d1d9;
}

.markdown-body tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }

.markdown-body a { color: #58a6ff; text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }

.markdown-body hr {
    border: none;
    border-top: 1px solid #30363d;
    margin: 16px 0;
}

/* ===== Toast ===== */
.ce-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: #161b22;
    color: #e6edf3;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 13px;
    z-index: 99999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    border: 1px solid #30363d;
    pointer-events: none;
}

.ce-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ce-toast.success { background: #1a7f37; border-color: #238636; }
.ce-toast.error   { background: #b91c1c; border-color: #da3633; }
.ce-toast.info    { background: #1d4ed8; border-color: #2563eb; }

/* ===== 示例模态框 ===== */
.ce-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 100000;
    backdrop-filter: blur(3px);
}

.ce-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100001;
    width: 620px;
    max-width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.ce-modal-content {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

.ce-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #0d1117;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

.ce-modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e6edf3;
}

.ce-modal-close {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.08);
    border: 1px solid #30363d;
    color: #8b949e;
    font-size: 14px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ce-modal-close:hover { background: #da3633; border-color: #da3633; color: white; }

.ce-modal-body {
    overflow-y: auto;
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: #30363d #161b22;
}

.example-card {
    padding: 12px 14px;
    background: #0d1117;
    border: 1.5px solid #30363d;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.example-card:hover {
    border-color: #58a6ff;
    background: #0d2137;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.example-card-lang {
    display: inline-block;
    font-size: 10px;
    background: #1f6feb;
    color: white;
    padding: 1px 7px;
    border-radius: 8px;
    font-family: 'Consolas', monospace;
    font-weight: 600;
    margin-bottom: 6px;
}

.example-card-mode {
    display: inline-block;
    font-size: 10px;
    background: #1a7f37;
    color: white;
    padding: 1px 7px;
    border-radius: 8px;
    font-weight: 500;
    margin-bottom: 6px;
    margin-left: 4px;
}

.example-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #e6edf3;
    margin-bottom: 4px;
    margin-top: 2px;
}

.example-card-desc {
    font-size: 11px;
    color: #8b949e;
    line-height: 1.5;
}

/* ===== 响应式适配 ===== */
@media (max-width: 900px) {
    .ce-history-panel { display: none; }
    .ce-input-panel { width: 320px; }
}

@media (max-width: 680px) {
    .ce-input-panel { width: 100%; border-right: none; border-bottom: 1px solid #30363d; }
    .ce-result-panel { min-width: 0; }
    .ce-main-content { flex-direction: column; }
    .mode-selector { grid-template-columns: 1fr 1fr; }
    .ce-modal-body { grid-template-columns: 1fr; }
}

/* ========== 暗黑模式（body.dark 前缀覆盖） ========== */
body.dark .ce-container {
    background: #080c10;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

body.dark .ce-toolbar {
    background: linear-gradient(135deg, #080c10 0%, #0d1117 100%);
    border-bottom-color: #21262d;
}

body.dark .ce-history-panel {
    background: #0d1117;
    border-right-color: #21262d;
}

body.dark .history-panel-header { background: #080c10; border-bottom-color: #21262d; }

body.dark .history-search-wrap { border-bottom-color: #21262d; }
body.dark .history-search-wrap input {
    background: #080c10;
    border-color: #21262d;
    color: #8b949e;
}
body.dark .history-search-wrap input:focus { border-color: #388bfd; }

body.dark .history-item {
    background: #080c10;
    border-color: #21262d;
}
body.dark .history-item:hover { background: #0d1117; border-color: #388bfd; }
body.dark .history-item.active { background: #051d36; border-color: #388bfd; }

body.dark .ce-input-panel {
    background: #0d1117;
    border-right-color: #21262d;
}

body.dark .panel-header { background: #080c10; border-bottom-color: #21262d; }
body.dark .ce-input-body::-webkit-scrollbar-track { background: #0d1117; }
body.dark .ce-input-body::-webkit-scrollbar-thumb { background: #21262d; }

body.dark .code-editor-wrap { border-color: #21262d; }
body.dark .code-editor-wrap:focus-within { border-color: #388bfd; }
body.dark .code-editor-header { background: #161b22; border-bottom-color: #21262d; }
body.dark .lang-select { color: #6e7681; }
body.dark .lang-select option { background: #0d1117; }
body.dark .stat-badge { background: #080c10; color: #8b949e; }
body.dark .ce-code-textarea { background: #080c10; color: #e6edf3; }

body.dark .mode-label { background: #080c10; border-color: #21262d; }
body.dark .mode-label:hover { background: #051d36; border-color: #388bfd; }
body.dark .mode-option input[type="radio"]:checked + .mode-label {
    background: #051d36;
    border-color: #388bfd;
    box-shadow: 0 0 0 1px rgba(56, 139, 253, 0.3);
}

body.dark .ce-input { background: #080c10; border-color: #21262d; color: #8b949e; }
body.dark .ce-input:focus { border-color: #388bfd; }

body.dark .ce-result-panel { background: #080c10; }
body.dark .ce-result-panel .panel-header { background: #0d1117; border-bottom-color: #21262d; }

body.dark .ce-result-body::-webkit-scrollbar-track { background: #080c10; }
body.dark .ce-result-body::-webkit-scrollbar-thumb { background: #21262d; }

body.dark .placeholder-terminal { background: #0d1117; border-color: #21262d; }
body.dark .terminal-bar { background: #161b22; border-bottom-color: #21262d; }

body.dark .loading-progress { background: #161b22; }
body.dark .loading-step { border-color: #21262d; color: #8b949e; }

body.dark .markdown-body h1, body.dark .markdown-body h2 {
    background: rgba(56, 139, 253, 0.06);
}
body.dark .markdown-body pre { background: #080c10; border-color: #21262d; }

body.dark .code-copy-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: #21262d;
    color: #6e7681;
}
body.dark .code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #388bfd;
    color: #c9d1d9;
}
body.dark .code-copy-btn.copied {
    color: #3fb950;
    border-color: #3fb950;
    background: rgba(63, 185, 80, 0.08);
}
body.dark .markdown-body code { background: #0d1117; border-color: #21262d; }
body.dark .markdown-body th { background: #161b22; border-color: #21262d; }
body.dark .markdown-body td { border-color: #21262d; }
body.dark .markdown-body hr { border-top-color: #21262d; }

body.dark .ce-toast { background: #0d1117; border-color: #30363d; }
body.dark .ce-toast.success { background: #0f4a1f; border-color: #1a7f37; }
body.dark .ce-toast.error   { background: #5c0a0a; border-color: #b91c1c; }
body.dark .ce-toast.info    { background: #0d2c8a; border-color: #1d4ed8; }

body.dark .ce-modal-overlay { background: rgba(0, 0, 0, 0.8); }
body.dark .ce-modal-content { background: #0d1117; border-color: #21262d; }
body.dark .ce-modal-header { background: #080c10; border-bottom-color: #21262d; }
body.dark .ce-modal-close { border-color: #21262d; }

body.dark .example-card { background: #080c10; border-color: #21262d; }
body.dark .example-card:hover { background: #051d36; border-color: #388bfd; }
body.dark .example-card-title { color: #c9d1d9; }
body.dark .example-card-desc { color: #6e7681; }

body.dark .ce-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: #30363d;
    color: #8b949e;
}
body.dark .ce-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: #58a6ff;
    color: #e6edf3;
}

body.dark .history-count-badge { background: #1f6feb; }
body.dark .history-list { scrollbar-color: #21262d #0d1117; }
body.dark .history-list::-webkit-scrollbar-track { background: #0d1117; }
body.dark .history-list::-webkit-scrollbar-thumb { background: #21262d; }

body.dark .ce-input-body { scrollbar-color: #21262d #0d1117; }
body.dark .ce-result-body { scrollbar-color: #21262d #080c10; }

body.dark .history-clear-btn { border-color: #21262d; color: #6e7681; }
body.dark .history-clear-btn.confirming { background: #b91c1c; border-color: #7f1d1d; }

body.dark .markdown-body h4, body.dark .markdown-body h5,
body.dark .markdown-body h6 {
    color: #d29922;
}

body.dark .markdown-body blockquote {
    border-left-color: #d29922;
    background: rgba(210, 153, 34, 0.08);
    color: #d29922;
}

body.dark .markdown-body ol li { color: #8b949e; }
body.dark .markdown-body ol li::marker { color: #d29922; }

body.dark .code-lang-label {
    background: #1d4ed8;
    border-bottom-color: #21262d;
}
body.dark .result-mode-badge { background: #15803d; }

/* 暗黑模式低对比度文本修复（WCAG ≥ 4.2:1） */
body.dark .result-time { color: #8b949e; }
body.dark .history-item-time { color: #8b949e; }
body.dark .history-empty { color: #8b949e; }
body.dark .shortcut-tip { color: #8b949e; }
body.dark .placeholder-desc { color: #8b949e; }
body.dark .mode-desc { color: #8b949e; }
body.dark .label-opt { color: #8b949e; }

/* 暗黑模式 placeholder 颜色修复（三个输入块均缺少覆盖） */
body.dark .history-search-wrap input::placeholder { color: #6e7681; }
body.dark .ce-code-textarea::placeholder { color: #6e7681; }
body.dark .ce-input::placeholder { color: #6e7681; }

/* 暗黑模式 history-item-del 颜色修复 */
body.dark .history-item-del { color: #6e7681; }
