:root {
  --bg: #0d0d0d;
  --panel: #1a1a1a;
  --panel2: #252525;
  --panel3: #333333;
  --text: #ffffff;
  --text2: #b0b0b0;
  --muted: #666666;
  --accent: #4f8cff;
  --accent2: #3d7be8;
  --border: #333333;
  --success: #4caf50;
  --warning: #ff9800;
  --error: #f44336;
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft Yahei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.nav-link:disabled {
  opacity: 1;
}

.nav-link:hover:not(:disabled) {
  background: var(--panel2);
  color: var(--text);
}

.nav-link:active:not(:disabled) {
  transform: scale(.96);
}

.nav-link.active {
  background: var(--panel2);
  color: var(--accent);
  cursor: default;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-selects {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Model Selector - 桌面端固定宽度 */
.header-selects .model-search-dropdown {
  width: 500px;
}

/* Model Selector - 移动端自适应 */
@media (max-width: 768px) {
  .header-selects .model-search-dropdown {
    width: auto;
    flex: 2;
    min-width: 120px;
    max-width: 50%;
  }
}

.header-select {
  padding: 6px 10px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  min-width: 140px;
  max-width: 280px;
}

.header-select:hover, .header-select:focus {
  border-color: var(--accent);
}

/* Main Layout */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Left Panel - Controls */
.left-panel {
  width: 320px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.queue-stats {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Upload Area */
.upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  margin-bottom: 20px;
}

.upload-area:hover {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.05);
}

.upload-area.dragover {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.1);
}

.upload-area.has-image {
  border-style: solid;
  border-color: var(--success);
  padding: 16px;
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 12px;
  color: var(--muted);
}

.upload-text {
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 8px;
}

.upload-hint {
  color: var(--muted);
  font-size: 12px;
}

.upload-input {
  display: none;
}

.upload-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.upload-btn {
  flex: 1;
  padding: 8px 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.upload-btn:hover {
  background: var(--panel3);
  border-color: var(--accent);
}

.upload-btn.secondary {
  background: transparent;
  color: var(--muted);
}

.upload-btn.secondary:hover {
  color: var(--error);
  border-color: var(--error);
}

/* Preview in upload area */
.upload-preview {
  position: relative;
  width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel3);
}

.upload-preview img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}

.upload-preview .remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.upload-preview .remove-btn:hover {
  background: var(--error);
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
}

/* 预设提示词样式 */
.prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.prompt-header .form-label {
  margin-bottom: 0;
}

.preset-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.preset-inline-btn:hover {
  border-color: var(--accent);
  background: var(--panel3);
  color: var(--text);
}

.preset-inline-btn .preset-count {
  font-size: 11px;
  padding: 1px 6px;
  background: var(--accent);
  border-radius: 8px;
  color: white;
  min-width: 16px;
  text-align: center;
}

.preset-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--panel3);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.preset-tag:hover {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.1);
}

.preset-tag.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.preset-tag .check {
  display: none;
  font-size: 10px;
}

.preset-tag.selected .check {
  display: inline;
}

.preset-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 0;
}

/* 预设管理弹窗 */
.preset-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.preset-modal {
  background: var(--panel);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.preset-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.preset-modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.preset-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preset-mode-btn {
  padding: 6px 14px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}

.preset-mode-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.preset-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  border-radius: 4px;
  font-size: 18px;
}

.preset-modal-close:hover {
  background: var(--panel2);
  color: var(--text);
}

.preset-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.preset-add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.preset-add-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

.preset-add-btn {
  padding: 8px 16px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.preset-add-btn:hover {
  background: var(--accent-hover);
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--panel2);
  border-radius: 4px;
}

.preset-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.preset-list-item:hover {
  background: var(--panel3);
}

.preset-list-item.selected {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.1);
}

.preset-list-check {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--accent);
  font-weight: bold;
}

.preset-list-text {
  flex: 1;
  font-size: 14px;
  word-break: break-all;
}

.preset-list-delete {
  padding: 4px 8px;
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  opacity: 0.6;
}

.preset-list-delete:hover {
  opacity: 1;
  text-decoration: underline;
}

.preset-list-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 14px;
}

.preset-apply-btn {
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: var(--success);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.preset-apply-btn:hover {
  background: #3dbb68;
}

.preset-apply-btn:disabled {
  background: var(--panel3);
  color: var(--muted);
  cursor: not-allowed;
}

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 8px;
  font-weight: 500;
}

/* Select */
.form-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.form-select:hover, .form-select:focus {
  border-color: var(--accent);
}

/* Ratio Options */
.ratio-options {
  display: flex;
  gap: 6px;
}

.ratio-option {
  flex: 1;
  padding: 8px 2px;
  background: var(--panel2);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.ratio-option:hover {
  background: var(--panel3);
}

.ratio-option.active {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.1);
}

.ratio-option .ratio-box {
  width: 20px;
  height: 16px;
  background: var(--panel3);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin: 0 auto 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--muted);
}

.ratio-option.active .ratio-box {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.ratio-option .ratio-auto {
  font-weight: 600;
}

.ratio-option .ratio-1-1 {
  width: 16px;
  height: 16px;
}

.ratio-option .ratio-4-3 {
  width: 20px;
  height: 15px;
}

.ratio-option .ratio-16-9 {
  width: 22px;
  height: 12px;
}

.ratio-option .ratio-3-4 {
  width: 12px;
  height: 16px;
}

.ratio-option .ratio-9-16 {
  width: 9px;
  height: 16px;
}

.ratio-option .ratio-label {
  font-size: 12px;
  color: var(--text);
  display: block;
}

/* Size Options */
.size-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.size-option {
  padding: 12px 8px;
  background: var(--panel2);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.size-option:hover {
  background: var(--panel3);
}

.size-option.active {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.1);
}

.size-option .size-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.size-option .size-res {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Textarea */
.form-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  resize: vertical;
  outline: none;
  font-family: inherit;
  line-height: 1.6;
  transition: border-color 0.2s;
}

.form-textarea:hover, .form-textarea:focus {
  border-color: var(--accent);
}

.form-textarea::placeholder {
  color: var(--muted);
}

/* Generate Button */
.generate-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.4);
}

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

.generate-btn .cost {
  font-size: 12px;
  opacity: 0.9;
  font-weight: 400;
}

/* Center Panel - Preview */
.center-panel {
  flex: 1;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.toolbar {
  height: 48px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.toolbar-title {
  font-size: 14px;
  color: var(--text2);
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--panel3);
  color: var(--text);
}

.preview-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
}

/* 结果预览容器 */
.result-preview-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel2);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.result-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.result-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-zoom-btn {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  background: var(--panel2);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-zoom-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.close-preview-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.close-preview-btn:hover {
  background: var(--panel2);
  color: var(--text);
}

.result-preview-image {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 8px;
  overflow: auto;
  min-height: 0;
}

.result-image-wrapper {
  cursor: grab;
  user-select: none;
}

.result-image-wrapper:active {
  cursor: grabbing;
}

.result-image-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  pointer-events: none;
}

.result-preview-info {
  padding: 8px 12px;
  background: transparent;
  flex-shrink: 0;
  max-height: 60px;
  overflow-y: auto;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.result-prompt {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.result-meta {
  display: flex;
  gap: 12px;
  font-size: 10px;
  color: var(--muted);
}

.preview-placeholder {
  text-align: center;
  color: var(--muted);
}

.preview-placeholder .icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.preview-placeholder .text {
  font-size: 14px;
}

.preview-image-container {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  cursor: grab;
  user-select: none;
}

.preview-image-container:active {
  cursor: grabbing;
}

.preview-image-container img {
  max-width: 100%;
  max-height: calc(100vh - 200px);
  display: block;
  pointer-events: none;
}

/* Right Panel - Tasks */
.right-panel {
  width: 300px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.empty-tasks {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-tasks .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.task-item {
  background: var(--panel2);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.task-item:hover {
  border-color: var(--border);
}

.task-item.active {
  border-color: var(--accent);
}

.task-item.viewing {
  border-color: var(--success);
  background: rgba(74, 222, 128, 0.1);
}

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

.task-id {
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}

.task-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.task-status.queued {
  background: var(--panel3);
  color: var(--text2);
}

.task-status.running {
  background: rgba(79, 140, 255, 0.2);
  color: var(--accent);
}

.task-status.completed {
  background: rgba(76, 175, 80, 0.2);
  color: var(--success);
}

.task-status.failed {
  background: rgba(244, 67, 54, 0.2);
  color: var(--error);
}

.task-status.cancelled {
  background: rgba(158, 158, 158, 0.2);
  color: #9e9e9e;
}

.task-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel3);
  margin-bottom: 8px;
}

.task-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--panel3);
}

.task-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--muted);
}

.task-info {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 4px;
}

.task-error {
  font-size: 11px;
  color: var(--error);
  margin-bottom: 4px;
  padding: 2px 4px;
  background: rgba(255, 77, 79, 0.1);
  border-radius: 3px;
}

.task-progress {
  height: 3px;
  background: var(--panel3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.task-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

.task-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.task-btn {
  flex: 1;
  padding: 6px;
  background: var(--panel3);
  border: none;
  border-radius: 6px;
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.task-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Loading Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--panel);
  color: var(--text);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

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

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--panel2);
  color: var(--text);
}

.modal-body {
  padding: 20px;
  flex: 1;
  overflow: auto;
}

.modal-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.modal-textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: monospace;
  resize: vertical;
  outline: none;
  line-height: 1.6;
}

.modal-textarea:focus {
  border-color: var(--accent);
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn.primary {
  background: var(--accent);
  color: #fff;
}

.modal-btn.primary:hover {
  background: var(--accent2);
}

.modal-btn.secondary {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
}

.modal-btn.secondary:hover {
  background: var(--panel3);
}

.mobile-tab-bar {
  display: none;
  min-height: 52px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-tab-bar-inner {
  display: flex;
  height: 52px;
}

.mobile-tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.mobile-tab-item .tab-icon {
  font-size: 20px;
  line-height: 1;
}

.mobile-tab-item.active {
  color: var(--accent);
}

/* Responsive */
@media (max-width: 1200px) {
  .right-panel {
    width: 260px;
  }
}

@media (max-width: 992px) {
  .left-panel {
    width: 280px;
  }
  .right-panel {
    width: 240px;
  }
}

@media (max-width: 768px) {
  .header {
    height: 48px;
    padding: 0 12px;
  }

  .logo {
    font-size: 15px;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }

  .logo span {
    display: none;
  }

  .nav-links {
    display: none;
  }

  .header-selects {
    flex: 1;
    min-width: 0;
    gap: 6px;
    margin-left: 12px;
  }

  .header-select {
    min-width: 0;
    flex: 1;
    max-width: none;
    font-size: 12px;
    padding: 5px 8px;
  }

.mobile-tab-bar {
    display: block;
  }

  .main {
    flex-direction: column;
    flex: 1;
    overflow: hidden;
  }

  .left-panel,
  .center-panel,
  .right-panel {
    width: 100% !important;
    height: 100% !important;
    flex: 1;
    border: none !important;
    display: none;
  }

  .left-panel.mobile-active,
  .center-panel.mobile-active,
  .right-panel.mobile-active {
    display: flex;
  }

  .panel-content {
    padding: 12px;
  }

  .upload-area {
    padding: 20px 16px;
    margin-bottom: 14px;
  }

  .upload-icon {
    font-size: 28px;
    margin-bottom: 8px;
  }

  .upload-text {
    font-size: 13px;
  }

  .upload-hint {
    font-size: 11px;
  }

  .upload-preview {
    max-height: 160px;
  }

  .upload-preview img {
    max-height: 160px;
  }

  .ratio-options {
    gap: 4px;
  }

  .ratio-option {
    padding: 6px 2px;
  }

  .ratio-option .ratio-label {
    font-size: 11px;
  }

  .size-options {
    gap: 6px;
  }

  .size-option {
    padding: 8px 4px;
  }

  .size-option .size-label {
    font-size: 14px;
  }

  .size-option .size-res {
    font-size: 10px;
  }

  .form-textarea {
    min-height: 80px;
    font-size: 16px;
  }

  .generate-btn {
    padding: 12px;
    font-size: 14px;
  }

  .toolbar {
    height: 40px;
    padding: 0 10px;
  }

  .preview-area {
    padding: 12px;
  }

  .task-list {
    padding: 10px;
  }

  .task-item {
    padding: 10px;
  }

  .preset-modal {
    width: 95%;
    max-height: 85vh;
  }

  .preset-add-form {
    flex-direction: column;
  }

  .preset-tag {
    padding: 5px 10px;
    font-size: 11px;
  }

  .preview-image-container img {
    max-height: calc(100vh - 180px);
  }

  .result-preview-image {
    padding: 36px 4px;
  }

  .result-preview-info {
    max-height: 50px;
    font-size: 11px;
  }

  .result-prompt {
    font-size: 11px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--panel3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
