/* =============================================
   Dockerfile 生成器 - 主样式
   ============================================= */

/* ---- 容器布局 ---- */
.df-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 600px;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ---- 顶部工具栏 ---- */
.df-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
}
.toolbar-group + .toolbar-group {
    margin-left: 4px;
    padding-left: 12px;
    border-left: 1px solid #e2e8f0;
}

/* ---- 按钮基础 ---- */
.df-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 13px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
}
.df-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.df-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}
.df-btn-primary {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #fff;
}
.df-btn-primary:hover:not(:disabled) {
    background: #0284c7;
    border-color: #0284c7;
}
.df-btn-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #fff;
}
.df-btn-ai:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4296 100%);
}

/* ---- 三栏主区域 ---- */
.df-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---- 左侧面板 ---- */
.df-left-panel {
    width: 220px;
    min-width: 200px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.panel-header {
    padding: 10px 14px 8px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.panel-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.template-search-wrap {
    padding: 8px 10px;
    flex-shrink: 0;
}
.template-search {
    width: 100%;
    padding: 5px 9px;
    font-size: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    outline: none;
    background: #f8fafc;
    color: #374151;
    box-sizing: border-box;
}
.template-search:focus {
    border-color: #0ea5e9;
    background: #fff;
}

/* 模板分类 */
.template-categories {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 4px;
}
.t-category {}
.t-cat-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    cursor: pointer;
    user-select: none;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    background: #f8fafc;
    border-top: 1px solid #f0f0f0;
    transition: background .12s;
}
.t-cat-header:hover { background: #f1f5f9; }
.cat-icon { font-size: 13px; }
.cat-name { flex: 1; }
.cat-arrow {
    font-size: 10px;
    color: #94a3b8;
    transition: transform .2s;
}
.t-cat-header.collapsed .cat-arrow { transform: rotate(-90deg); }
.t-cat-body {
    display: none;
    padding: 2px 0;
}
.t-cat-body.open { display: block; }
.t-item {
    padding: 6px 16px 6px 30px;
    font-size: 12.5px;
    color: #4b5563;
    cursor: pointer;
    transition: background .12s, color .12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.t-item:hover {
    background: #eff6ff;
    color: #0ea5e9;
}
.t-item.active {
    background: #e0f2fe;
    color: #0284c7;
    font-weight: 600;
}

/* 历史记录 */
.history-section {
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    max-height: 200px;
    display: flex;
    flex-direction: column;
}
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #f0f0f0;
}
.clear-history-btn {
    font-size: 11px;
    color: #ef4444;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
}
.clear-history-btn:hover { background: #fef2f2; }
.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.history-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    padding: 12px;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    color: #4b5563;
    transition: background .12s;
}
.history-item:hover { background: #f0f9ff; }
.history-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item-time { font-size: 10px; color: #94a3b8; flex-shrink: 0; }
.history-item-del {
    font-size: 11px;
    color: #d1d5db;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0 2px;
}
.history-item-del:hover { color: #ef4444; }

/* ---- 中间配置面板 ---- */
.df-config-panel {
    width: 360px;
    min-width: 320px;
    flex-shrink: 0;
    border-right: 1px solid #e2e8f0;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.config-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0 20px;
}

/* 配置区块 */
.cfg-section {
    padding: 10px 16px;
    border-bottom: 1px solid #f3f4f6;
}
.cfg-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 8px;
}
.cfg-row {
    margin-bottom: 8px;
}
.cfg-label {
    display: block;
    font-size: 12.5px;
    color: #374151;
    margin-bottom: 4px;
    font-weight: 500;
}
.required { color: #ef4444; }
.cfg-input {
    width: 100%;
    padding: 6px 9px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    outline: none;
    color: #111827;
    background: #fff;
    box-sizing: border-box;
    font-family: 'Consolas', 'Courier New', monospace;
    transition: border-color .15s;
}
.cfg-input:focus { border-color: #0ea5e9; box-shadow: 0 0 0 2px rgba(14,165,233,.1); }
.cfg-select {
    width: 100%;
    padding: 6px 9px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    outline: none;
    color: #111827;
    background: #fff;
    box-sizing: border-box;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s;
}
.cfg-select:focus { border-color: #0ea5e9; }
.cfg-textarea {
    width: 100%;
    padding: 6px 9px;
    font-size: 12.5px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    outline: none;
    color: #111827;
    background: #fff;
    box-sizing: border-box;
    resize: vertical;
    font-family: 'Consolas', 'Courier New', monospace;
    transition: border-color .15s;
}
.cfg-textarea:focus { border-color: #0ea5e9; }
.cfg-hint {
    font-size: 11.5px;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.4;
}

/* 建议下拉 */
.suggest-wrap { position: relative; }
.image-suggest {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 5px 5px;
    z-index: 100;
    max-height: 160px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 8px rgba(0,0,0,.08);
}
.suggest-item {
    padding: 6px 10px;
    font-size: 12.5px;
    color: #374151;
    cursor: pointer;
    font-family: monospace;
    transition: background .1s;
}
.suggest-item:hover { background: #eff6ff; }

/* 动态列表（端口/环境变量） */
.list-container { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.list-row { display: flex; align-items: center; gap: 6px; }
.env-eq { font-weight: 700; color: #6b7280; flex-shrink: 0; }
.list-remove-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #fef2f2;
    color: #ef4444;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    flex-shrink: 0;
    transition: background .15s;
}
.list-remove-btn:hover { background: #fee2e2; }
.add-list-btn {
    font-size: 12.5px;
    color: #0ea5e9;
    background: none;
    border: 1px dashed #bae6fd;
    border-radius: 5px;
    padding: 5px 12px;
    cursor: pointer;
    width: 100%;
    transition: background .15s;
    font-family: inherit;
}
.add-list-btn:hover { background: #f0f9ff; }

/* 高级选项 */
.advanced-toggle:hover { color: #0ea5e9; }
.arrow-icon { transition: transform .2s; display: inline-block; }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] { cursor: pointer; width: 14px; height: 14px; }

/* 生成按钮区 */
.generate-row {
    display: flex;
    gap: 8px;
    padding-top: 4px;
}
.generate-big-btn {
    flex: 1;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    justify-content: center;
}
.reset-btn {
    padding: 9px 14px;
    font-size: 13px;
    color: #6b7280;
}

/* ---- 右侧输出面板 ---- */
.df-output-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #1e293b;
    overflow: hidden;
}
.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #0f172a;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}
.output-meta { display: flex; align-items: center; gap: 10px; }
.output-title {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
}
.line-count {
    font-size: 11.5px;
    color: #64748b;
    background: #1e293b;
    padding: 2px 8px;
    border-radius: 10px;
}
.output-actions { display: flex; gap: 6px; }
.out-btn {
    padding: 4px 10px;
    font-size: 12px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    border-radius: 4px;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}
.out-btn:hover:not(:disabled) {
    background: #334155;
    color: #e2e8f0;
}
.out-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 代码区域 */
.output-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}
.code-wrap {
    height: 100%;
    overflow: auto;
    display: flex;
}
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #475569;
    text-align: center;
    padding: 20px;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .6; }
.empty-text { font-size: 14px; color: #64748b; margin-bottom: 6px; }
.empty-sub { font-size: 12.5px; color: #475569; }

/* 代码高亮视图 */
.code-view {
    display: flex;
    width: 100%;
    min-height: 100%;
    font-family: 'Consolas', 'Courier New', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
}
/* ---- 行号 sticky 定位（防止水平滚动时行号消失）---- */
.line-nums {
    padding: 14px 10px 14px 14px;
    text-align: right;
    color: #475569;
    user-select: none;
    min-width: 44px;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    flex-shrink: 0;
    position: sticky;
    left: 0;
    z-index: 1;
}
.line-num { display: block; }
.code-pre {
    flex: 1;
    margin: 0;
    padding: 14px 16px;
    overflow: visible;
    background: transparent;
    color: #e2e8f0;
    white-space: pre;
}
.code-pre code { font-family: inherit; font-size: inherit; }

/* 语法高亮 */
.df-keyword { color: #38bdf8; font-weight: 700; }
.df-comment { color: #64748b; font-style: italic; }
.df-string  { color: #86efac; }
.df-value   { color: #fbbf24; }
.df-flag    { color: #f9a8d4; }

/* 编辑模式textarea */
.code-editor {
    width: 100%;
    height: 100%;
    padding: 14px 16px;
    background: #1e293b;
    color: #e2e8f0;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    box-sizing: border-box;
    display: block;
}

/* 底部快速指令说明 */
.quick-guide {
    background: #0f172a;
    border-top: 1px solid #334155;
    padding: 8px 14px;
    flex-shrink: 0;
}
.guide-title {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.guide-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.guide-chip {
    font-size: 11.5px;
    color: #94a3b8;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 2px 8px;
}
.guide-chip code {
    color: #38bdf8;
    font-family: monospace;
    font-size: 11px;
}

/* =============================================
   AI 侧边栏
   ============================================= */
.df-ai-sidebar {
    position: fixed;
    top: 0;
    right: -480px;
    width: 460px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right .3s ease;
}
.df-ai-sidebar.open { right: 0; }
.ai-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    flex-shrink: 0;
}
.ai-sidebar-header h4 { margin: 0; font-size: 15px; font-weight: 600; }
.ai-close-btn {
    background: rgba(255,255,255,.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.ai-close-btn:hover { background: rgba(255,255,255,.35); }
.ai-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ai-prompt-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.ai-prompt-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    resize: vertical;
    color: #111827;
    font-family: inherit;
    line-height: 1.5;
    box-sizing: border-box;
    transition: border-color .15s;
}
.ai-prompt-group textarea:focus { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,.12); }
.ai-examples-title { font-size: 12px; color: #6b7280; margin-bottom: 6px; }
.ai-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip {
    font-size: 12px;
    padding: 4px 10px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    color: #374151;
    transition: all .15s;
}
.ai-chip:hover {
    background: #ede9fe;
    border-color: #7c3aed;
    color: #5b21b6;
}
.ai-buttons { display: flex; gap: 8px; }
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}
.loading-dots { display: flex; gap: 6px; }
.loading-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: dotBounce 1.2s infinite ease-in-out;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(.6); opacity: .5; }
    40% { transform: scale(1); opacity: 1; }
}
.loading-text { font-size: 13px; color: #6b7280; }
.ai-result-wrap { display: flex; flex-direction: column; gap: 8px; }
.ai-result-header { display: flex; align-items: center; justify-content: space-between; }
.ai-result-title { font-size: 13px; font-weight: 600; color: #374151; }
.ai-result-code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: 6px;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre;
}

/* ---- 遮罩 ---- */
.df-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 999;
    display: none;
}
.df-overlay.active { display: block; }

/* =============================================
   帮助弹窗
   ============================================= */
.df-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}
.df-modal.open { display: flex; }
.modal-content {
    background: #fff;
    border-radius: 10px;
    width: 600px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: 15px; color: #1e293b; }
.modal-close {
    background: none;
    border: none;
    font-size: 16px;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.modal-close:hover { background: #f1f5f9; color: #374151; }
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
    font-size: 13.5px;
    color: #374151;
    line-height: 1.6;
}
.modal-body h4 { color: #1e293b; margin: 16px 0 8px; font-size: 14px; }
.modal-body h4:first-child { margin-top: 0; }
.modal-body ol, .modal-body ul { padding-left: 20px; margin: 6px 0; }
.modal-body li { margin-bottom: 5px; }
.help-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 6px 0;
}
.help-table td {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
}
.help-table tr:nth-child(even) td { background: #f8fafc; }
kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11.5px;
    font-family: monospace;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    color: #1e293b;
}

/* =============================================
   Toast 通知
   ============================================= */
.df-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: #f1f5f9;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13.5px;
    z-index: 9999;
    opacity: 0;
    transition: opacity .25s, transform .25s;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.df-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.df-toast.success { background: #0f766e; }
.df-toast.error   { background: #b91c1c; }
.df-toast.info    { background: #1d4ed8; }

/* =============================================
   细滚动条（规范：4px，#ccc，平滑滚动）
   ============================================= */
.template-categories,
.config-scroll,
.history-list,
.ai-sidebar-body,
.modal-body {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    scroll-behavior: smooth;
}
.template-categories::-webkit-scrollbar,
.config-scroll::-webkit-scrollbar,
.history-list::-webkit-scrollbar,
.ai-sidebar-body::-webkit-scrollbar,
.modal-body::-webkit-scrollbar { width: 4px; }
.template-categories::-webkit-scrollbar-track,
.config-scroll::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track,
.ai-sidebar-body::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track { background: transparent; }
.template-categories::-webkit-scrollbar-thumb,
.config-scroll::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb,
.ai-sidebar-body::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
.template-categories::-webkit-scrollbar-thumb:hover,
.config-scroll::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* 代码区域滚动条（深色主题）*/
.code-wrap {
    scrollbar-width: thin;
    scrollbar-color: #475569 transparent;
}
.code-wrap::-webkit-scrollbar { width: 4px; height: 4px; }
.code-wrap::-webkit-scrollbar-track { background: transparent; }
.code-wrap::-webkit-scrollbar-thumb { background: #475569; border-radius: 2px; }
.code-wrap::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* 输出面板更新闪动动画 */
@keyframes df-code-flash {
    0%   { opacity: 0.55; }
    100% { opacity: 1; }
}
.code-view.df-flashing {
    animation: df-code-flash 0.28s ease-out;
}

/* 生成按钮加载中状态 */
.df-btn-primary.loading {
    opacity: .7;
    cursor: wait;
    pointer-events: none;
}

/* outputSave 按钮 */
#outputSave:not(:disabled):hover {
    background: #1e3a5f;
    color: #7dd3fc;
    border-color: #3b82f6;
}

/* =============================================
   响应式布局
   ============================================= */
@media (max-width: 768px) {
    .df-left-panel {
        width: 180px;
        min-width: 160px;
    }
    .df-config-panel {
        width: 300px;
        min-width: 270px;
    }
    .guide-grid { gap: 4px; }
    .guide-chip { font-size: 11px; padding: 2px 6px; }
}

@media (max-width: 640px) {
    .df-container {
        height: auto;
        min-height: unset;
    }
    .df-main {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .df-left-panel {
        width: 100%;
        min-width: unset;
        max-height: 220px;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        flex-direction: row;
        overflow: hidden;
    }
    .template-search-wrap { display: none; }
    .template-categories {
        flex: 1;
        overflow-x: auto;
        overflow-y: hidden;
        display: flex;
        max-height: unset;
    }
    .t-category { flex-shrink: 0; }
    .t-cat-body { display: block !important; max-height: 160px; overflow-y: auto; }
    .history-section { display: none; }
    .df-config-panel {
        width: 100%;
        min-width: unset;
        max-height: 420px;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    .df-output-panel { min-height: 320px; }
    .quick-guide { display: none; }
    .df-ai-sidebar { width: 100%; right: -100%; }
}

/* 手机端隐藏快捷键提示 */
@media (max-width: 600px) {
    .toolbar-group + .toolbar-group:last-of-type { display: none; }
}

/* =============================================
   追加样式：视觉修复与 UX 增强
   ============================================= */

/* 历史记录激活项高亮（缺失 Bug 修复）*/
.history-item.active {
    background: #e0f2fe;
    color: #0284c7;
    font-weight: 500;
}
.history-item.active .history-item-name { color: #0284c7; }
.history-item.active .history-item-time { color: #7dd3fc; }

/* 编辑按钮激活态（编辑模式下高亮显示）*/
.out-btn.active,
.out-btn.active:hover:not(:disabled) {
    background: #1d4ed8;
    border-color: #3b82f6;
    color: #fff;
}

/* 模板搜索无结果提示 */
.t-no-results {
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    padding: 20px 12px;
    line-height: 1.6;
}

/* AI结果代码区深色细滚动条 */
.ai-result-code {
    scrollbar-width: thin;
    scrollbar-color: #475569 transparent;
}
.ai-result-code::-webkit-scrollbar { width: 4px; height: 4px; }
.ai-result-code::-webkit-scrollbar-track { background: transparent; }
.ai-result-code::-webkit-scrollbar-thumb { background: #475569; border-radius: 2px; }

/* 镜像建议下拉滚动条 */
.image-suggest {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}
.image-suggest::-webkit-scrollbar { width: 4px; }
.image-suggest::-webkit-scrollbar-track { background: transparent; }
.image-suggest::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* 配置区块标题增强 */
.cfg-section-title {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 生成区域底部加阴影分隔 */
.generate-row {
    border-top: 1px solid #e5e7eb;
    margin-top: 4px;
    padding-top: 14px !important;
    background: #f8fafc;
    border-radius: 0 0 0 0;
    padding-bottom: 10px;
}

/* 历史记录 hover 时显示删除按钮 */
.history-item .history-item-del {
    opacity: 0;
    transition: opacity .15s;
}
.history-item:hover .history-item-del {
    opacity: 1;
}
.history-item.active .history-item-del {
    opacity: 0.6;
}
.history-item.active:hover .history-item-del {
    opacity: 1;
}

/* =============================================
   第二批追加：UX 精化与 Bug 修复
   ============================================= */

/* 模板搜索框清除按钮布局 */
.search-input-wrap {
    position: relative;
    width: 100%;
}
.search-clear-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .12s;
}
.search-clear-btn:hover { color: #4b5563; }
/* 输入框右侧为清除按钮预留空间 */
.template-search { padding-right: 26px; }

/* AI prompt 字数计数 */
.ai-char-count {
    font-size: 11px;
    color: #9ca3af;
    text-align: right;
    margin-top: 3px;
}
.ai-char-count.warn { color: #f59e0b; }
.ai-char-count.over { color: #ef4444; font-weight: 600; }

/* AI 应用按钮：绿色主色（在白色面板上显示正确）*/
#aiApplyBtn {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
    padding: 5px 14px;
    font-size: 12.5px;
}
#aiApplyBtn:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
    color: #fff;
}

/* 空状态鲸鱼浮动动画 */
@keyframes df-whale-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}
.empty-icon {
    animation: df-whale-float 2.8s ease-in-out infinite;
}

/* 配置区标题底部细线分隔 */
.cfg-section-title {
    border-bottom: 1px solid #e0f2fe;
    padding-bottom: 5px;
    margin-bottom: 10px !important;
}

/* 工具栏匹配更好的高度 */
.df-toolbar {
    min-height: 46px;
}

/* 生成按钮 hover 高亮动画 */
.generate-big-btn {
    transition: all .2s, transform .1s;
}
.generate-big-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(14,165,233,.35);
}
.generate-big-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* 输出区头部标题加强 */
.output-title {
    font-weight: 700;
    letter-spacing: .3px;
}

/* 历史记录无内容时整体居中 */
.history-empty {
    padding: 16px 12px;
}

/* 快速指令卡片 hover 效果 */
.guide-chip {
    transition: background .12s, border-color .12s;
    cursor: default;
}
.guide-chip:hover {
    background: #263348;
    border-color: #475569;
}

/* =============================================
   全屏模式
   ============================================= */
.df-container.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 999;
    height: 100vh;
    width: 100vw;
    border-radius: 0;
}
