/* ===== CSS变量 / 设计系统 ===== */
:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #161616;
  --bg-tertiary: #1e1e1e;
  --bg-card: #252525;
  --bg-hover: #2e2e2e;
  --bg-active: #333333;

  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-muted: #606060;

  --accent: #7c5cfc;
  --accent-hover: #9479fd;
  --accent-light: rgba(124, 92, 252, 0.15);
  --accent-border: rgba(124, 92, 252, 0.4);

  --success: #4caf50;
  --warning: #ff9800;
  --error: #f44336;

  --border: #2a2a2a;
  --border-light: #333;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);

  --transition: all 0.2s ease;
  --header-height: 60px;
  --left-panel-width: 240px;
  --right-panel-width: 260px;
  --layer-panel-height: 100px;
}

/* ===== 重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
}
button { cursor: pointer; border: none; outline: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; outline: none; border: none; background: none; color: inherit; }
select { cursor: pointer; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #666; }

/* ===== APP布局 ===== */
#app {
  display: grid;
  grid-template-rows: var(--header-height) 1fr var(--layer-panel-height);
  grid-template-columns: 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ===== 顶部导航 ===== */
.app-header {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.logo-icon {
  font-size: 20px;
  color: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, #7c5cfc, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-center { flex: 1; display: flex; justify-content: center; }

.generation-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 6px 8px 6px 16px;
  max-width: 800px;
  width: 100%;
}

.theme-input {
  flex: 1;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  min-width: 200px;
}

.theme-input::placeholder { color: var(--text-muted); }

.cover-type-select,
.generate-count-select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.cover-type-select option,
.generate-count-select option {
  background: var(--bg-card);
}

.generate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}

.generate-btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,92,252,0.4); }
.generate-btn:active { transform: translateY(0); }
.generate-btn.loading { opacity: 0.7; pointer-events: none; }

.btn-icon { font-size: 14px; }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.header-btn {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 13px;
  transition: var(--transition);
}

.header-btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.header-btn.secondary { background: var(--bg-tertiary); }

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ===== 主体布局 ===== */
.app-body {
  grid-row: 2;
  display: grid;
  grid-template-columns: var(--left-panel-width) 1fr var(--right-panel-width);
  overflow: hidden;
  min-height: 0;
}

/* ===== 左侧面板 ===== */
.left-panel {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 4px 4px 0;
  gap: 2px;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  color: var(--text-secondary);
  font-size: 11px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: var(--transition);
}

.tab-btn .tab-icon { font-size: 14px; }
.tab-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab-btn.active { color: var(--accent); background: var(--accent-light); }

.panel-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.tab-panel.active { display: flex; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.panel-header h3 { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.new-project-btn, .upload-btn {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}

.new-project-btn:hover, .upload-btn:hover { background: var(--accent); color: #fff; }

/* 项目列表 */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.project-item:hover { border-color: var(--accent-border); background: var(--bg-hover); }
.project-item.active { border-color: var(--accent); background: var(--accent-light); }

.project-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-item-meta { font-size: 10px; color: var(--text-muted); }

.project-item-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  gap: 4px;
}

.project-item:hover .project-item-actions { display: flex; }

.project-action-btn {
  width: 20px;
  height: 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.project-action-btn:hover { background: var(--error); color: #fff; }

/* 模板网格 */
.template-categories, .material-categories, .sticker-categories {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.cat-btn {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 8px;
  font-size: 11px;
  transition: var(--transition);
}

.cat-btn:hover { color: var(--text-primary); }
.cat-btn.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent-border); }

.template-grid, .material-grid, .sticker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.template-thumb, .material-thumb, .sticker-thumb {
  aspect-ratio: 16/9;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-thumb:hover, .material-thumb:hover, .sticker-thumb:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.template-thumb img, .material-thumb img { width: 100%; height: 100%; object-fit: cover; }

.template-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  padding: 3px 6px;
  font-size: 10px;
  color: #fff;
}

/* ===== 右侧面板 ===== */
.right-panel {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.props-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
  gap: 0;
}

.props-tab {
  flex: 1;
  padding: 10px 4px;
  color: var(--text-secondary);
  font-size: 12px;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  text-align: center;
}

.props-tab:hover { color: var(--text-primary); }
.props-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.props-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 0;
}

.props-panel.active { display: flex; }

.prop-section {
  margin-bottom: 16px;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* 背景类型 */
.bg-type-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.bg-tab {
  flex: 1;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 6px;
  font-size: 11px;
  text-align: center;
  transition: var(--transition);
  min-width: 40px;
}

.bg-tab:hover { color: var(--text-primary); }
.bg-tab.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent-border); }

.bg-panel { display: none; }
.bg-panel.active { display: block; }

/* 颜色选择 */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.color-picker {
  width: 40px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.color-picker-sm {
  width: 28px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.hex-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-primary);
}

.hex-input-sm {
  width: 70px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-primary);
}

.preset-colors {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.preset-color {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.preset-color:hover { transform: scale(1.15); border-color: #fff; }

/* 渐变 */
.gradient-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.gradient-row label { font-size: 12px; color: var(--text-secondary); width: 40px; }

.prop-select {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-primary);
}

.prop-select option { background: var(--bg-card); }

.apply-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  padding: 7px;
  font-size: 12px;
  font-weight: 600;
  margin: 8px 0;
  transition: var(--transition);
}

.apply-btn:hover { background: var(--accent-hover); }

.gradient-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 8px;
}

.gradient-preset {
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}

.gradient-preset:hover { transform: scale(1.05); border-color: #fff; }

/* 上传区域 */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  transition: var(--transition);
}

.upload-area:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* AI背景 */
.ai-prompt-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.ai-prompt-input::placeholder { color: var(--text-muted); }

.ai-bg-styles {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.style-tag {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3px 10px;
  font-size: 11px;
  transition: var(--transition);
}

.style-tag:hover, .style-tag.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent-border); }

/* 属性网格 */
.prop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.prop-item { display: flex; flex-direction: column; gap: 3px; }
.prop-item label { font-size: 10px; color: var(--text-muted); }

.prop-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-primary);
  width: 100%;
}

.prop-input:focus { border-color: var(--accent); }

/* 文字属性 */
.text-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  font-size: 13px;
  color: var(--text-primary);
  resize: vertical;
  min-height: 60px;
}

.text-textarea:focus { border-color: var(--accent); }

.prop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.prop-row label { font-size: 12px; color: var(--text-secondary); min-width: 36px; }
.prop-input-sm {
  width: 60px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 12px;
  color: var(--text-primary);
}

.style-toggle {
  width: 28px;
  height: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  transition: var(--transition);
}

.style-toggle:hover, .style-toggle.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.italic-btn { font-style: italic; }

.slider {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox { accent-color: var(--accent); cursor: pointer; }

.align-buttons {
  display: flex;
  gap: 4px;
}

.align-btn {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px;
  color: var(--text-secondary);
  font-size: 11px;
  transition: var(--transition);
}

.align-btn:hover, .align-btn.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent-border); }

.position-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.pos-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: var(--transition);
  text-align: center;
}

.pos-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent-border); }

/* 滤镜 */
.filter-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}

.filter-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.filter-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: var(--transition);
}

.filter-item:hover .filter-preview { border-color: var(--accent); }
.filter-item.active .filter-preview { border-color: var(--accent); }

.cinema-preview { background: linear-gradient(135deg, #434343 0%, #000 100%); }
.vintage-preview { background: linear-gradient(135deg, #c79081 0%, #dfa579 100%); filter: sepia(0.5); }
.fresh-preview { background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%); }
.ecom-preview { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }

.filter-item span { font-size: 10px; color: var(--text-secondary); }

.filter-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.filter-slider-row label { font-size: 11px; color: var(--text-secondary); min-width: 36px; }
.filter-slider-row span { font-size: 11px; color: var(--text-muted); min-width: 24px; text-align: right; }

/* 蒙版 */
.mask-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.mask-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  color: var(--text-secondary);
  font-size: 11px;
  transition: var(--transition);
  text-align: center;
}

.mask-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent-border); }
.mask-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 底部图层面板 */
.layer-panel {
  grid-row: 3;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.layer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.layer-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }

.layer-actions { display: flex; gap: 4px; }

.layer-action-btn {
  width: 22px;
  height: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.layer-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.layer-list {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 12px;
}

.layer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 4px 6px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  transition: var(--transition);
}

.layer-item:hover { background: var(--bg-hover); }
.layer-item.selected { border-color: var(--accent); background: var(--accent-light); }

.layer-thumb {
  width: 50px;
  height: 32px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.layer-name { font-size: 9px; color: var(--text-muted); max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }

.layer-visibility {
  width: 14px;
  height: 14px;
  background: none;
  color: var(--text-muted);
  font-size: 9px;
  position: absolute;
  top: 2px;
  right: 2px;
}

/* 加载覆盖层 */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  min-width: 300px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { font-size: 14px; color: var(--text-primary); text-align: center; }

.loading-progress {
  width: 200px;
  height: 3px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
}

.loading-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
  animation: loading-progress 2s ease-in-out infinite;
}

@keyframes loading-progress {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 95%; }
}

/* 通知 */
.notification-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.notification {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  animation: slide-in 0.3s ease;
  pointer-events: all;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification.success { border-left: 3px solid var(--success); }
.notification.error { border-left: 3px solid var(--error); }
.notification.warning { border-left: 3px solid var(--warning); }
.notification.info { border-left: 3px solid var(--accent); }

@keyframes slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  min-width: 360px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 15px; font-weight: 600; }

.modal-close {
  color: var(--text-muted);
  font-size: 18px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 20px; }

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-btn {
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.modal-btn.primary { background: var(--accent); color: #fff; }
.modal-btn.primary:hover { background: var(--accent-hover); }
.modal-btn.secondary { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border); }
.modal-btn.secondary:hover { background: var(--bg-hover); }

/* 导出选项 */
.export-options { display: flex; flex-direction: column; gap: 16px; }
.export-format-group h4, .export-quality-group h4, .export-scale-group h4 { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }

.format-btns, .scale-btns {
  display: flex;
  gap: 6px;
}

.format-btn, .scale-btn {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  transition: var(--transition);
  text-align: center;
}

.format-btn.active, .scale-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.export-quality-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-quality-group .slider { width: 100%; }

/* 历史侧边栏 */
.history-sidebar {
  position: fixed;
  right: var(--right-panel-width);
  top: var(--header-height);
  bottom: var(--layer-panel-height);
  width: 200px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.history-list { flex: 1; overflow-y: auto; padding: 8px; }

/* 搜索 */
.material-search { margin-bottom: 8px; }
.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-primary);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); }
