.image-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  flex-shrink: 0;
}

.drop-zone {
  flex: 1;
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  min-height: 120px;
  position: relative;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: var(--surface2); }
.drop-zone .icon { font-size: 32px; opacity: .35; }
.drop-zone p { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; }
.drop-zone small { font-size: 10px; color: var(--dim-text); }

.img-preview-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  display: none;
}
.img-preview-wrap.visible { display: flex; flex-direction: column; gap: 4px; }
.img-preview-wrap img {
  flex: 1;
  width: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}
.img-toolbar {
  position: absolute;
  top: 4px; right: 4px;
  z-index: 2;
  display: flex;
  gap: 4px;
}
.img-tool-btn {
  background: var(--overlay);
  border: 1px solid var(--border2);
  border-radius: 5px;
  color: var(--muted);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.img-tool-btn:hover { color: var(--text); border-color: var(--accent); }
.img-tool-btn.danger:hover { border-color: var(--danger); }

.mask-indicator {
  position: absolute;
  bottom: 4px;
  left: 4px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(74, 158, 255, 0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px 2px 2px;
  border-radius: 4px;
  pointer-events: none;
}
.mask-indicator img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.3);
}

.img-filename {
  font-size: 10px; color: var(--dim-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex-shrink: 0;
}

/* ── Prompt area ── */
.prompt-area {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

textarea {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  padding: 10px 12px;
  resize: none;
  outline: none;
  min-height: 80px;
}
textarea:focus { border-color: var(--accent); }
textarea::placeholder { color: var(--dim-text); }

.prompt-suffix {
  font-size: 12px;
  color: var(--accent-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 6px 12px;
  margin-top: -10px;
  line-height: 1.5;
  font-style: italic;
}

.settings-row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.setting {
  display: flex;
  align-items: center;
  gap: 6px;
}
.setting label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }
.setting input[type=range] { accent-color: var(--accent); width: 80px; }
.setting .val { font-size: 12px; color: var(--accent); width: 28px; }
.setting input[type=number] {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 5px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  padding: 4px 6px;
  width: 80px;
  outline: none;
}
.setting input[type=number]:focus { border-color: var(--accent); }
.setting input[type=number]::placeholder { color: var(--dim-text); }

.setting select {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 5px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  cursor: pointer;
}
.setting select:focus { border-color: var(--accent); }

.btn-generate {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity .2s;
  letter-spacing: .03em;
  position: relative;
  overflow: hidden;
}
.btn-generate:disabled { background: var(--border2); color: var(--muted); cursor: not-allowed; }
.btn-generate:not(:disabled):hover { opacity: .85; }
.btn-progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent-dim);
  width: 0%; transition: width .3s ease;
  pointer-events: none;
}
.btn-generate .btn-label { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; }

.shortcut-hint { font-size: 11px; opacity: .5; margin-left: 4px; }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Generation overlay on preview pane ── */
.generation-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: 8px;
  z-index: 5;
}
.generation-overlay.visible { display: flex; }
.generation-overlay .overlay-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.generation-overlay .overlay-label {
  font-size: 13px;
  color: var(--text);
  text-align: center;
}

.queue-banner {
  display: none;
  margin-top: 8px;
  padding: 10px 18px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  max-width: 340px;
  line-height: 1.4;
  animation: queue-pulse 2s ease-in-out infinite;
}
.queue-banner.visible { display: block; }

@keyframes queue-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.7; }
}

.btn-generate.cancelling {
  background: var(--border2);
  color: var(--muted);
  cursor: not-allowed;
}

.error-msg {
  font-size: 12px; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 15%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--bg));
  border-radius: 6px;
  padding: 8px 10px;
  line-height: 1.55;
}

/* ── Preview pane ── */
.preview-pane {
  display: none;
  flex: 1;
  min-height: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  padding: 18px;
  gap: 12px;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.preview-pane.visible { display: flex; }
.preview-pane > .preview-img-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}
.preview-pane > .preview-img-wrap > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.preview-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  min-height: 0;
}
.preview-prompt {
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  line-height: 1.35;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  position: relative;
  cursor: default;
}
.prompt-suffix-inline {
  color: var(--accent-dim);
}

.preview-prompt-tooltip {
  display: none;
  position: absolute;
  bottom: 60px;
  left: 18px;
  right: 18px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  padding: 12px 14px;
  z-index: 50;
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--text);
  max-height: 300px;
  overflow-y: auto;
  pointer-events: none;
}
.preview-prompt-tooltip.visible {
  display: block;
}
.preview-info { font-size: 11px; color: var(--muted); line-height: 1.6; white-space: nowrap; }

.preview-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-outline {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--accent);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
}
.btn-outline:hover { border-color: var(--accent); }

.btn-solid {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
}
.btn-solid:hover { opacity: .85; }

/* ── History list ── */
.history-wrap {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--dim-text);
}
.history-empty .big-icon { font-size: 48px; opacity: .25; }
.history-empty p { font-size: 13px; text-align: center; line-height: 1.7; max-width: 280px; }

.history-card {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  align-items: center;
}
.history-card:hover    { border-color: var(--border2); background: var(--surface2); }
.history-card.selected { border-color: var(--accent); background: var(--surface2); }

.history-card img {
  width: 76px; height: 58px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.history-card-meta { flex: 1; overflow: hidden; }
.history-card-prompt {
  font-size: 13px; color: var(--text-sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 3px;
}
.history-card-sub { font-size: 11px; color: var(--muted); }
.seed-value { color: inherit; font-weight: 700; }

.card-actions { display: flex; gap: 6px; }
.btn-sm-solid {
  background: var(--accent);
  border: none; border-radius: 5px;
  color: var(--bg); font-family: 'DM Sans', sans-serif;
  font-size: 11px; font-weight: 500;
  padding: 5px 10px; cursor: pointer; white-space: nowrap;
}
.btn-sm-outline {
  background: none;
  border: 1px solid var(--border2); border-radius: 5px;
  color: var(--muted); font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  padding: 5px 10px; cursor: pointer;
}
.btn-sm-solid:hover   { opacity: .85; }
.btn-sm-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm-outline.del-btn:hover { border-color: var(--danger); color: var(--danger); }

.hist-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hist-header-row .section-label { flex: 1; }
.btn-export-history, .btn-clear-history {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 5px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  padding: 3px 8px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-export-history:hover { border-color: var(--accent); color: var(--accent); }
.btn-clear-history:hover { border-color: var(--danger); color: var(--danger); }

/* ── Theme toggle ── */
.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--muted);
  font-size: 16px;
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  flex-shrink: 0;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.btn-reset {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: .05em;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-reset:hover { border-color: var(--danger); color: var(--danger); }

/* ── Clear prompt button ── */
.clear-prompt-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: none;
  border: none;
  color: var(--dim-text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px;
  transition: color .15s;
  z-index: 2;
}
.clear-prompt-btn:hover:not(:disabled) { color: var(--danger); }
.clear-prompt-btn:disabled { opacity: .25; cursor: default; }
