/* ==================== CSS 变量 ==================== */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --bg-panel: rgba(255, 255, 255, 0.08);
    --bg-input: rgba(255, 255, 255, 0.1);
    --bg-input-focus: rgba(255, 255, 255, 0.15);
    --text-primary: #fff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --border-color: rgba(255, 255, 255, 0.15);
    --border-active: #667eea;
    --accent-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-green: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --accent-pink: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

body.light {
    --bg-primary: #f0f2f5;
    --bg-secondary: #e8eaed;
    --bg-tertiary: #dde1e7;
    --bg-panel: rgba(255, 255, 255, 0.9);
    --bg-input: rgba(255, 255, 255, 0.8);
    --bg-input-focus: rgba(255, 255, 255, 1);
    --text-primary: #1a1a2e;
    --text-secondary: rgba(26, 26, 46, 0.7);
    --text-muted: rgba(26, 26, 46, 0.4);
    --border-color: rgba(26, 26, 46, 0.15);
    --border-active: #667eea;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ==================== 粒子动画 ==================== */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 15s infinite ease-in-out;
}

.light .particle {
    background: rgba(102, 126, 234, 0.3);
}

@keyframes float {
    0%, 100% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

/* ==================== 布局 ==================== */
.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    font-size: 3rem;
    margin-bottom: 10px;
}

h1 {
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ff6b9d 0%, #ffa500 50%, #ffd700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 107, 157, 0.5);
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
    .history-favorites-section { flex-direction: column; }
    .image-settings-head { flex-direction: column; align-items: flex-start; }
    .image-settings-hint { text-align: left; }
    .image-size-grid { grid-template-columns: 1fr; }
    .snapshot-create-row { grid-template-columns: 1fr; }
    .snapshot-save-btn { width: 100%; }
}

/* ==================== 面板 ==================== */
.panel {
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==================== 表单 ==================== */
.input-section { margin-bottom: 20px; }

.input-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: block;
}

.keyword-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
}

.keyword-input::placeholder { color: var(--text-muted); }

.keyword-input:focus {
    border-color: var(--border-active);
    background: var(--bg-input-focus);
}

/* ==================== 风格选择 ==================== */
.style-selector { margin-bottom: 20px; }

.style-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.style-chip {
    padding: 10px 15px;
    font-size: 0.85rem;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.style-chip:hover { background: var(--bg-input-focus); }

.style-chip.active {
    background: var(--accent-primary);
    border-color: transparent;
    color: #fff;
}

/* ==================== 按钮 ==================== */
.generate-btn {
    width: 100%;
    padding: 16px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

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

/* ==================== 提示词输出 ==================== */
.prompt-output { margin-bottom: 20px; }

.prompt-schema-panel {
    margin-bottom: 20px;
    padding: 18px;
    border-radius: 16px;
    background:
        radial-gradient(circle at top left, rgba(255, 196, 0, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(16, 25, 44, 0.62), rgba(16, 25, 44, 0.34));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.prompt-schema-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
}

.prompt-schema-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.prompt-schema-subtitle {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.schema-summary {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.prompt-schema-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.schema-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.schema-field span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.schema-field input,
.schema-field textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font: inherit;
    resize: vertical;
}

.schema-field input:focus,
.schema-field textarea:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.schema-field-wide {
    grid-column: 1 / -1;
}

.candidate-panel {
    margin-bottom: 20px;
    padding: 18px;
    border-radius: 16px;
    background: rgba(56, 239, 125, 0.08);
    border: 1px solid rgba(56, 239, 125, 0.16);
}

.candidate-panel-head {
    margin-bottom: 12px;
}

.candidate-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.candidate-subtitle {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.candidate-list {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.candidate-explain {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

.candidate-explain strong {
    color: var(--text-primary);
    font-size: 0.88rem;
}

.candidate-card {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.25s ease;
}

.candidate-card:hover {
    transform: translateY(-1px);
    border-color: rgba(56, 239, 125, 0.35);
}

.candidate-card.active {
    border-color: rgba(56, 239, 125, 0.55);
    box-shadow: 0 0 0 2px rgba(56, 239, 125, 0.14);
}

.candidate-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.candidate-card-title {
    font-weight: 700;
    color: var(--text-primary);
}

.candidate-card-summary,
.candidate-card-rationale {
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

.candidate-card-rationale {
    margin-top: 8px;
    color: var(--text-muted);
}

.candidate-card-note {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.45;
}

.candidate-feedback {
    display: grid;
    gap: 10px;
}

.preference-panel {
    margin-bottom: 20px;
    padding: 18px;
    border-radius: 16px;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.16);
}

.preference-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.preference-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preference-field span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.preference-field select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font: inherit;
}

.preference-actions {
    display: flex;
    gap: 12px;
}

.snapshot-panel {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.snapshot-create-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.snapshot-input {
    min-width: 0;
}

.snapshot-save-btn {
    flex: none;
    min-width: 132px;
}

.snapshot-list {
    display: grid;
    gap: 10px;
}

.snapshot-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
}

.snapshot-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.snapshot-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

.snapshot-card-time {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.snapshot-card-summary {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.snapshot-card-actions {
    display: flex;
    gap: 10px;
}

.snapshot-card-actions .action-btn {
    padding: 10px 14px;
    font-size: 0.88rem;
}

.preference-tools {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.preference-textarea {
    min-height: 120px;
}

.prompt-textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px 20px;
    font-size: 0.95rem;
    line-height: 1.8;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    resize: vertical;
    font-family: inherit;
    transition: all 0.3s ease;
}

.prompt-textarea::placeholder { color: var(--text-muted); }
.prompt-textarea:focus { border-color: #38ef7d; background: var(--bg-input-focus); }
.prompt-textarea::selection { background: rgba(102, 126, 234, 0.5); }

/* ==================== 操作按钮 ==================== */
.action-buttons { display: flex; gap: 15px; }

.action-btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.copy-btn { background: var(--accent-green); color: #fff; }
.copy-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(56, 239, 125, 0.4); }
.copy-btn.copied { background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%); }

.enhance-btn {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.enhance-btn:hover { background: var(--bg-input-focus); }

.clear-btn {
    background: rgba(245, 87, 108, 0.2);
    color: #f5576c;
    border: 1px solid rgba(245, 87, 108, 0.3);
}

.clear-btn:hover { background: rgba(245, 87, 108, 0.3); }

/* ==================== 加载状态 ==================== */
.loading {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.loading.show { display: flex; }

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 15px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-green);
    color: #fff;
    padding: 15px 30px;
    border-radius: 10px;
    font-weight: 500;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ==================== 快速增强面板 ==================== */
.enhancement-panel {
    margin-top: 15px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.enhancement-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.enhancement-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.enhance-tag {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: var(--bg-input);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.enhance-tag:hover { background: rgba(102, 126, 234, 0.5); }

/* ==================== AI 智能共创引导 ==================== */
.ai-wizard-btn {
    width: 100%;
    margin-top: 12px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 500;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ai-wizard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.ai-wizard-panel {
    margin-top: 15px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

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

.wizard-step {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 600;
}

.wizard-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 5px;
}

.wizard-close:hover { color: var(--text-primary); }

.wizard-question {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    line-height: 1.6;
}

.wizard-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.wizard-input:focus {
    outline: none;
    border-color: #667eea;
}

.wizard-buttons {
    display: flex;
    gap: 10px;
}

.wizard-skip {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wizard-skip:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.wizard-submit {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wizard-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.wizard-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-secondary);
}

/* ==================== 模板区域 ==================== */
.templates-section {
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--border-color);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.templates-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.template-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-card:hover {
    background: var(--bg-input-focus);
    transform: translateY(-3px);
    border-color: rgba(102, 126, 234, 0.5);
}

.template-icon { font-size: 1.8rem; margin-bottom: 8px; }
.template-name { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.template-desc { font-size: 0.8rem; color: var(--text-muted); }

/* ==================== 快速提示 ==================== */
.quick-tips {
    margin-top: 30px;
    background: var(--bg-input);
    border-radius: 15px;
    padding: 20px;
    transition: background 0.3s ease;
}

.quick-tips h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.tips-list { display: flex; flex-wrap: wrap; gap: 10px; }

.tip-tag {
    padding: 8px 15px;
    background: var(--bg-panel);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tip-tag:hover { background: rgba(102, 126, 234, 0.3); color: #fff; }

/* ==================== 图片生成 ==================== */
.image-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.image-settings {
    margin-bottom: 18px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 14px;
}

.image-settings-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.image-settings-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: right;
}

.image-recommendation {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.18);
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.image-recommendation strong {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.image-size-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.image-size-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 96px;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.image-size-card:hover {
    background: var(--bg-input-focus);
    border-color: rgba(102, 126, 234, 0.45);
    transform: translateY(-1px);
}

.image-size-card input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-size-card.selected {
    border-color: transparent;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.24), rgba(255, 107, 157, 0.2));
    box-shadow: 0 10px 24px rgba(102, 126, 234, 0.16);
}

.image-size-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.image-size-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.image-size-desc {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.image-preview {
    display: none;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.image-preview.show { display: block; }
.image-preview img { width: 100%; height: auto; display: block; }

.image-loading {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 20px;
}

.image-loading.show { display: flex; }

.image-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.generate-image-btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent-pink);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.generate-image-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 107, 157, 0.4);
}

.generate-image-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.image-actions { display: none; gap: 10px; margin-top: 15px; }
.image-actions.show { display: flex; }

.image-action-btn {
    flex: 1;
    padding: 10px 15px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.download-btn { background: var(--accent-green); color: #fff; }
.download-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(56, 239, 125, 0.4); }

.regenerate-btn {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.regenerate-btn:hover { background: var(--bg-input-focus); }

.image-error {
    display: none;
    padding: 20px;
    background: rgba(245, 87, 108, 0.2);
    border: 1px solid rgba(245, 87, 108, 0.3);
    border-radius: 12px;
    color: #f5576c;
    text-align: center;
    margin-bottom: 20px;
}

.image-error.show { display: block; }

/* ==================== 主题切换 ==================== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    padding: 8px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.theme-toggle:hover { background: var(--bg-input-focus); }

/* ==================== 快捷键提示 ==================== */
.shortcut-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
    z-index: 100;
}

.shortcut-hint kbd {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: inherit;
}

/* ==================== 历史/收藏/统计 ==================== */
.history-favorites-section {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.history-panel,
.favorites-panel,
.stats-panel {
    flex: 1;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.history-panel::-webkit-scrollbar,
.favorites-panel::-webkit-scrollbar { width: 6px; }

.history-panel::-webkit-scrollbar-thumb,
.favorites-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

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

.panel-header h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-history-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
    background: rgba(245, 87, 108, 0.2);
    border: 1px solid rgba(245, 87, 108, 0.3);
    border-radius: 12px;
    color: #f5576c;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-history-btn:hover { background: rgba(245, 87, 108, 0.3); }

.history-item,
.favorite-item {
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-item:hover,
.favorite-item:hover { background: var(--bg-input-focus); }

.history-item-text,
.favorite-item-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.history-item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.history-item:hover .item-actions,
.favorite-item:hover .item-actions { opacity: 1; }

.item-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.use-btn { background: rgba(102, 126, 234, 0.2); color: #667eea; }
.use-btn:hover { background: rgba(102, 126, 234, 0.4); }

.fav-btn { background: rgba(255, 107, 157, 0.2); color: #ff6b9d; }
.fav-btn:hover { background: rgba(255, 107, 157, 0.4); }

.del-btn { background: rgba(245, 87, 108, 0.2); color: #f5576c; }
.del-btn:hover { background: rgba(245, 87, 108, 0.4); }

.empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==================== 统计 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--bg-input);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.stats-chart { margin-top: 15px; }

.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.chart-label { width: 80px; font-size: 0.8rem; color: var(--text-secondary); }

.chart-fill {
    flex: 1;
    height: 20px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.chart-fill-inner {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.chart-count {
    width: 40px;
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==================== 无障碍 ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

[aria-live] { position: absolute; left: -9999px; }

.template-card:focus,
.style-chip:focus,
.tip-tag:focus,
.enhance-tag:focus,
.schema-field input:focus,
.schema-field textarea:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .prompt-schema-grid {
        grid-template-columns: 1fr;
    }
}
