[hidden] { display: none !important; }
:root {
  --bg: #1c1a22;
  --surface: #26232c;
  --surface-raised: #2f2b36;
  --border: #3a3641;
  --text: #f2ede4;
  --text-muted: #9c96a3;
  --accent: #e8a33d;
  --accent-dim: #b97f2e;
  --danger: #d97575;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}

.wordmark {
  font-family: "Fraunces", serif;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.creditBadge {
  font-size: 0.875rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab {
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  padding: 24px;
  margin-bottom: 14px;
  transition: border-color 0.15s ease;
}

.dropzone:hover {
  border-color: var(--accent-dim);
}

.dropzoneTitle {
  display: block;
  font-size: 0.9375rem;
}

.dropzoneSubtitle {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.dropzone img {
  max-width: 100%;
  max-height: 280px;
  border-radius: 6px;
  object-fit: contain;
}

.promptInput {
  width: 100%;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  resize: vertical;
  margin-bottom: 12px;
}

.promptInput:focus {
  outline: none;
  border-color: var(--accent-dim);
}

.chipsRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.chipsLabel {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 2px;
}

.chip {
  font-family: inherit;
  font-size: 0.75rem;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.submitButton {
  width: 100%;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 13px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.submitButton:disabled {
  opacity: 0.5;
  cursor: default;
}

.submitButton:not(:disabled):hover {
  background: var(--accent-dim);
}

.resultArea {
  margin-top: 20px;
  text-align: center;
}

.resultArea img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.downloadLink {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 100%;
}

.dialog h2 {
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
  margin: 0 0 8px;
}

.dialog p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 20px;
}

.dialogButton {
  width: 100%;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  margin-bottom: 10px;
}

.dialogButton:disabled {
  opacity: 0.6;
}

.dialogSecondary {
  width: 100%;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}

.dialogSecondary:hover {
  color: var(--accent);
}

.progressBar {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progressFill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.toastHost {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 0.875rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--accent); }

@media (max-width: 480px) {
  .page { padding: 16px 14px 48px; }
  .panel { padding: 16px; }
}
