:root {
  color-scheme: light;
  --bg1: #f7fbff;
  --bg2: #eef9fb;
  --bg3: #f3fbf6;
  --text: #27465c;
  --muted: rgba(39, 70, 92, 0.68);
  --line: rgba(104, 165, 208, 0.18);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --shadow: 0 20px 40px rgba(61, 102, 137, 0.10);
  --accent: #58aef6;
  --accent2: #8aa8ff;
  --accent3: #72d8d4;
  --accent4: #8ad06a;
  --platform-accent: #FF6B2B;
  --platform-accent-hover: #e85a1a;
  --bg-card: #FFFFFF;
  --bg-surface: #EDE8DF;
  --border-default: #DDD5C5;
  --text-primary: #1A1714;
  --text-secondary: #7A6F65;
  --shadow-elevated: 0 4px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 48%, var(--bg3) 100%);
  padding: 0;
  overflow-x: hidden;
}

.app {
  width: min(440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.50);
  border: 0;
  box-shadow: none;
  backdrop-filter: blur(20px);
  overflow: hidden;
  position: relative;
}

.page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.02)),
    repeating-linear-gradient(
      135deg,
      rgba(104, 165, 208, 0.03) 0,
      rgba(104, 165, 208, 0.03) 1px,
      transparent 1px,
      transparent 18px
    );
  pointer-events: none;
}

.page-inner {
  position: relative;
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

.siteTop {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 16px;
  width: 100%;
}

.step-nav__brand {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.step-nav__brand-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 2px 0 0;
}

.nav a, .nav .active {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  color: rgba(39, 70, 92, 0.72);
  background: rgba(255,255,255,0.48);
  border: 1px solid rgba(104, 165, 208, 0.14);
}

.nav .active {
  color: #2563eb;
  background: linear-gradient(135deg, rgba(232, 246, 255, 0.96), rgba(243, 251, 255, 0.98));
  border-color: rgba(88, 174, 246, 0.28);
  box-shadow: 0 10px 18px rgba(88, 174, 246, 0.10);
}

.nav svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.model-bar {
  width: fit-content;
  max-width: calc(100vw - 32px);
  margin: -6px auto 0;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(104, 165, 208, 0.20);
  box-shadow: 0 10px 20px rgba(85, 132, 173, 0.08);
}

.model-bar label {
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-bar label.compact {
  min-width: 104px;
}

.model-bar span {
  color: rgba(39, 70, 92, 0.66);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.model-bar select {
  min-width: 0;
  height: 30px;
  border: 1px solid rgba(104, 165, 208, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(39, 70, 92, 0.86);
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.model-bar strong {
  color: #2563eb;
  font-size: 12px;
  white-space: nowrap;
}

.topUser {
  justify-self: end;
}

.platform-user-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.platform-login {
  padding: 6px 16px;
  border-radius: 8px;
  background: var(--platform-accent);
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.platform-login:hover {
  background: var(--platform-accent-hover);
}

.platform-user {
  position: relative;
}

.platform-user-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 6px;
  border: 1px solid var(--border-default);
  border-radius: 20px;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  font-family: inherit;
}

.platform-user-button:hover,
.platform-user-button.is-open {
  border-color: var(--platform-accent);
}

.platform-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B2B, #e85a1a);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.platform-user-points {
  color: var(--platform-accent);
  font-weight: 700;
}

.platform-user-plan {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 600;
}

.platform-user-plan.is-paid {
  background: rgba(255,107,43,0.1);
  color: var(--platform-accent);
}

.platform-user-plan.is-team {
  background: rgba(46,125,50,0.1);
  color: var(--platform-accent);
}

.platform-user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 8px;
  min-width: 180px;
  box-shadow: var(--shadow-elevated);
  z-index: 1000;
}

.platform-user-menu-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 4px;
}

.platform-user-name {
  font-weight: 700;
  font-size: 14px;
}

.platform-user-email {
  font-size: 11px;
  color: var(--text-secondary);
}

.platform-user-row {
  padding: 8px 12px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.platform-user-row span {
  color: var(--text-secondary);
}

.platform-user-row strong {
  color: var(--platform-accent);
}

.platform-user-menu button {
  width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.platform-user-menu [data-auth-logout] {
  background: rgba(231,76,60,0.08);
  color: #e74c3c;
}

[hidden] {
  display: none !important;
}

.hero {
  padding: 2px 2px 0;
}

.hero h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: 0;
}

.hero p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  border-radius: 24px;
  background: var(--glass);
  border: 1px solid rgba(104, 165, 208, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    0 12px 24px rgba(85, 132, 173, 0.08);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section {
  padding: 14px;
}

.section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

.section-sub {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.mini-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.60);
  border: 1px solid rgba(104, 165, 208, 0.16);
  color: rgba(39, 70, 92, 0.76);
  font-size: 12px;
  font-weight: 700;
}

.chip.active {
  color: white;
  background: linear-gradient(135deg, #66b9f7, #6cd8d0);
  border-color: transparent;
}

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

.label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.input,
.textarea,
.select,
.dropzone,
.slider,
.result-box,
.preview-box,
.param-grid .opt,
.segment {
  border-radius: 20px;
  border: 1px solid rgba(104, 165, 208, 0.18);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.input,
.select {
  height: 48px;
  width: 100%;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text);
}

.select span { color: var(--muted); }

.textarea {
  width: 100%;
  min-height: 130px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(39, 70, 92, 0.88);
  resize: vertical;
  font-family: inherit;
  outline: none;
}

.negative-textarea {
  min-height: 82px;
}

.textarea .placeholder {
  color: rgba(39, 70, 92, 0.34);
}

textarea.textarea::placeholder {
  color: rgba(39, 70, 92, 0.34);
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.param-grid .opt {
  min-height: 58px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  text-align: center;
  font-size: 11px;
  color: rgba(39, 70, 92, 0.75);
  border-radius: 16px;
  cursor: pointer;
}

.ratio-preview {
  width: 34px;
  border-radius: 6px;
  border: 1px solid rgba(117, 154, 191, 0.30);
  background: linear-gradient(180deg, rgba(246, 251, 255, 0.98), rgba(235, 244, 252, 0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.84);
  flex: 0 0 auto;
}

.ratio-preview.r1x1 { aspect-ratio: 1 / 1; }
.ratio-preview.r4x3 { aspect-ratio: 4 / 3; width: 36px; }
.ratio-preview.r9x16 { aspect-ratio: 9 / 16; height: 34px; width: auto; }
.ratio-preview.r21x9 { aspect-ratio: 21 / 9; width: 42px; }
.ratio-preview.r16x9 { aspect-ratio: 16 / 9; width: 40px; }
.ratio-preview.r2x3 { aspect-ratio: 2 / 3; height: 36px; width: auto; }

.ratio-preview::after {
  content: "";
  position: absolute;
}

.param-grid .opt .ratio-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.param-grid .opt .small {
  font-size: 10px;
  color: rgba(39, 70, 92, 0.52);
}

.param-grid .opt.active {
  background: linear-gradient(180deg, rgba(232, 246, 255, 0.98), rgba(243, 251, 255, 0.98));
  border-color: rgba(88, 174, 246, 0.30);
  color: #2563eb;
}

.param-grid .opt.active .ratio-preview {
  border-color: rgba(88, 174, 246, 0.40);
  background: linear-gradient(180deg, rgba(231, 245, 255, 0.98), rgba(221, 239, 255, 0.96));
}

.param-grid .opt.active .small {
  color: rgba(37, 99, 235, 0.72);
}

.preview-box {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  color: rgba(39, 70, 92, 0.72);
}

.preview-illus {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 24px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, rgba(88,174,246,0.16), rgba(114,216,212,0.14));
}

.preview-box strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.preview-box small {
  display: block;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.upload-zone {
  position: relative;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.upload-zone.dragging,
.upload-zone:hover {
  border-color: rgba(88, 174, 246, 0.42);
  background: rgba(232, 246, 255, 0.78) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.84), 0 12px 24px rgba(88, 174, 246, 0.10);
}

.file-input {
  display: none;
}

.reference-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 128px));
  justify-content: center;
  gap: 8px;
  max-height: 286px;
  overflow-y: auto;
  padding: 2px 4px 6px;
}

.reference-item {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 128px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(104, 165, 208, 0.18);
  background: rgba(255,255,255,0.84);
  box-shadow: 0 10px 18px rgba(85, 132, 173, 0.08);
  cursor: grab;
}

.reference-item.dragging-reference {
  opacity: 0.52;
  cursor: grabbing;
}

.reference-item.drop-target {
  outline: 3px solid rgba(88, 174, 246, 0.46);
  outline-offset: 2px;
}

.reference-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.reference-order {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: flex;
  gap: 4px;
}

.reference-order button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(18, 35, 50, 0.72);
  color: white;
  font-size: 18px;
  line-height: 24px;
  cursor: pointer;
}

.reference-order button:disabled {
  opacity: 0.35;
  cursor: default;
}

.reference-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(18, 35, 50, 0.72);
  color: white;
  font-size: 16px;
  line-height: 24px;
  cursor: pointer;
}

.paste-target {
  width: min(100%, 320px);
  min-height: 30px;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px dashed rgba(104, 165, 208, 0.36);
  background: rgba(255, 255, 255, 0.62);
  color: rgba(39, 70, 92, 0.58);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  outline: none;
}

.paste-target:focus {
  border-color: rgba(88, 174, 246, 0.58);
  color: rgba(39, 70, 92, 0.78);
  box-shadow: 0 0 0 4px rgba(88, 174, 246, 0.10);
}

.slider {
  padding: 14px;
}

.slider-line {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(104,165,208,0.18), rgba(88,174,246,0.28));
}

.slider-line::before,
.slider-line::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: white;
  border: 2px solid #58aef6;
  box-shadow: 0 8px 14px rgba(88, 174, 246, 0.14);
}

.slider-line::before { left: 30%; }
.slider-line::after { left: 72%; }

.actions {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  height: 48px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  border: 1px solid rgba(104, 165, 208, 0.18);
  color: rgba(39, 70, 92, 0.8);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  user-select: none;
}

.btn.primary {
  color: white;
  background: linear-gradient(135deg, #66b9f7, #6cd8d0);
  border-color: transparent;
  box-shadow: 0 14px 24px rgba(88, 174, 246, 0.16);
}

.btn[aria-disabled="true"] {
  opacity: 0.62;
  pointer-events: none;
}

.result-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.result-grid img {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(104, 165, 208, 0.18);
  box-shadow: 0 12px 24px rgba(85, 132, 173, 0.10);
  background: white;
  cursor: zoom-in;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 35, 50, 0.72);
  backdrop-filter: blur(10px);
}

.image-lightbox.open {
  display: flex;
}

.image-lightbox img {
  max-width: min(96vw, 900px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  background: white;
}

.image-lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.status-line {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.status-line.error {
  color: #b45454;
}

/* Desktop web layout for the text-to-image workspace. */
.app.web-workbench {
  width: min(1900px, 100%);
  min-height: 100vh;
}

.web-workbench .page {
  min-height: 100vh;
  overflow: visible;
}

.web-workbench .page-inner {
  min-height: 100vh;
  padding: 30px clamp(18px, 3vw, 64px) 36px;
  gap: 20px;
}

.web-workbench .nav {
  justify-content: center;
}

.desktop-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.08fr) minmax(380px, 1fr);
  gap: clamp(18px, 2vw, 34px);
  align-items: stretch;
}

.workspace-column {
  min-width: 0;
  min-height: 0;
  display: flex;
}

.workspace-panel {
  width: 100%;
  min-height: calc(100vh - 116px);
  padding: clamp(20px, 1.8vw, 30px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
}

.workspace-column.column-stack {
  flex-direction: column;
  gap: 20px;
}

.workspace-column.column-stack .workspace-panel {
  min-height: auto;
}

.web-workbench .section-title {
  font-size: clamp(20px, 1.45vw, 28px);
}

.web-workbench .section-sub {
  margin-top: 6px;
  font-size: clamp(14px, 1vw, 18px);
}

.web-workbench .label {
  font-size: clamp(16px, 1.05vw, 21px);
}

.web-workbench .chip {
  min-height: 38px;
  height: auto;
  padding: 8px 18px;
  font-size: clamp(14px, 1vw, 18px);
}

.web-workbench .param-grid {
  gap: 14px;
}

.web-workbench .param-grid .opt {
  min-height: 138px;
  padding: 18px 12px;
  border-radius: 24px;
  justify-content: center;
  font-size: 17px;
}

.web-workbench .param-grid .opt .small {
  font-size: 14px;
}

.web-workbench .ratio-preview {
  width: 54px;
  border-radius: 9px;
}

.web-workbench .ratio-preview.r4x3 { width: 58px; }
.web-workbench .ratio-preview.r9x16 { height: 58px; }
.web-workbench .ratio-preview.r21x9 { width: 72px; }
.web-workbench .ratio-preview.r16x9 { width: 68px; }
.web-workbench .ratio-preview.r2x3 { height: 60px; }

.web-workbench .slider {
  padding: 24px;
  border-radius: 28px;
}

.web-workbench .slider-line {
  height: 10px;
}

.web-workbench .slider-line::before,
.web-workbench .slider-line::after {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

.prompt-panel {
  justify-content: flex-start;
}

.prompt-panel .field {
  gap: 12px;
}

.web-workbench .textarea {
  border-radius: 28px;
  padding: 28px 30px;
  font-size: clamp(18px, 1.2vw, 24px);
  line-height: 1.55;
}

.web-workbench .prompt-textarea {
  min-height: clamp(260px, 33vh, 420px);
}

.web-workbench .negative-textarea {
  min-height: clamp(150px, 20vh, 230px);
}

.prompt-suggestions {
  margin-top: auto;
}

.prompt-suggestions .mini-chip-row {
  flex-direction: column;
  align-items: flex-start;
}

.prompt-suggestions .chip {
  max-width: 100%;
  justify-content: flex-start;
  white-space: normal;
  text-align: left;
  line-height: 1.35;
}

.preview-panel {
  overflow: hidden;
}

.preview-panel .preview-box {
  flex: 1;
  min-height: 420px;
  padding: clamp(22px, 2vw, 36px);
  align-items: center;
  justify-items: center;
  overflow: auto;
  border-radius: 28px;
}

.preview-panel .preview-illus {
  margin-left: auto;
  margin-right: auto;
}

.preview-panel .result-grid {
  grid-template-columns: 1fr;
  align-items: start;
  justify-items: start;
}

.preview-panel .result-grid img {
  width: min(100%, 440px);
}

.preview-panel .status-line {
  min-height: 24px;
  margin-top: 0;
  font-size: clamp(14px, 1vw, 18px);
}

.preview-panel .actions {
  margin-top: auto;
}

.web-workbench .btn {
  min-height: 64px;
  height: auto;
  font-size: clamp(18px, 1.2vw, 24px);
}

.image-workbench .reference-panel,
.image-workbench .ratio-panel,
.image-workbench .edit-panel,
.image-workbench .quality-panel {
  flex: 0 0 auto;
}

.image-workbench .reference-panel {
  min-height: 310px;
}

.image-workbench .ratio-panel {
  flex: 1 1 auto;
}

.image-workbench .image-upload-zone {
  flex: 1;
  min-height: 0;
  padding: clamp(12px, 1.2vw, 18px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  place-items: center;
  text-align: center;
  background: rgba(255,255,255,0.66);
}

.image-upload-zone [data-upload-empty] strong {
  display: block;
  font-size: clamp(18px, 1.2vw, 24px);
  margin-bottom: 8px;
}

.image-upload-zone [data-upload-empty] small {
  display: block;
  font-size: clamp(14px, 1vw, 18px);
  line-height: 1.45;
  color: var(--muted);
}

.image-workbench .reference-grid {
  grid-template-columns: repeat(2, minmax(0, 128px));
}

.image-workbench .edit-panel .prompt-textarea {
  min-height: clamp(230px, 28vh, 340px);
}

.image-workbench .edit-panel .negative-textarea {
  min-height: clamp(150px, 18vh, 230px);
}

.image-workbench .quality-panel {
  margin-top: auto;
}

.image-preview-panel .preview-box {
  min-height: 520px;
}

@media (min-width: 1181px) {
  .image-workbench .page-inner {
    padding-top: 16px;
    padding-bottom: 16px;
    gap: 10px;
  }

  .image-workbench .nav a,
  .image-workbench .nav .active {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
  }

  .image-workbench .step-nav__brand {
    font-size: 18px;
  }

  .image-workbench .desktop-workspace {
    grid-template-columns: minmax(270px, 0.88fr) minmax(340px, 1fr) minmax(320px, 0.94fr);
    gap: clamp(12px, 1.25vw, 20px);
  }

  .image-workbench .workspace-column.column-stack {
    gap: 10px;
  }

  .image-workbench .workspace-panel {
    min-height: auto;
    padding: clamp(12px, 1.05vw, 18px);
    gap: 10px;
  }

  .image-workbench .panel-head {
    margin-bottom: 4px;
  }

  .image-workbench .section-title {
    font-size: clamp(16px, 1vw, 21px);
  }

  .image-workbench .section-sub {
    margin-top: 3px;
    font-size: clamp(12px, 0.82vw, 14px);
  }

  .image-workbench .label {
    font-size: clamp(14px, 0.9vw, 18px);
  }

  .image-workbench .chip {
    min-height: 30px;
    padding: 5px 13px;
    font-size: clamp(12px, 0.82vw, 14px);
  }

  .image-workbench .reference-panel {
    min-height: 0;
  }

  .image-workbench .image-upload-zone {
    min-height: 0;
    padding: 12px;
    border-radius: 18px;
  }

  .image-workbench .reference-grid {
    grid-template-columns: repeat(2, minmax(0, 112px));
    max-height: 248px;
    gap: 8px;
  }

  .image-workbench .reference-item {
    max-width: 112px;
    border-radius: 12px;
  }

  .image-workbench .image-upload-zone .preview-illus {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 22px;
    margin-bottom: 8px;
  }

  .image-upload-zone [data-upload-empty] strong {
    font-size: clamp(16px, 1vw, 20px);
    margin-bottom: 4px;
  }

  .image-upload-zone [data-upload-empty] small {
    font-size: clamp(12px, 0.85vw, 15px);
  }

  .image-workbench .ratio-panel {
    flex: 1 1 0;
  }

  .image-workbench .param-grid {
    gap: 8px;
  }

  .image-workbench .param-grid .opt {
    min-height: 82px;
    padding: 9px 7px;
    border-radius: 16px;
    font-size: 13px;
    gap: 4px;
  }

  .image-workbench .param-grid .opt .small {
    font-size: 11px;
  }

  .image-workbench .ratio-preview {
    width: 36px;
    border-radius: 7px;
  }

  .image-workbench .ratio-preview.r4x3 { width: 40px; }
  .image-workbench .ratio-preview.r9x16 { height: 38px; }
  .image-workbench .ratio-preview.r21x9 { width: 48px; }
  .image-workbench .ratio-preview.r16x9 { width: 46px; }
  .image-workbench .ratio-preview.r2x3 { height: 40px; }

  .image-workbench .textarea {
    border-radius: 20px;
    padding: 16px 18px;
    font-size: clamp(14px, 0.9vw, 17px);
  }

  .image-workbench .prompt-panel .prompt-textarea {
    min-height: clamp(220px, 28vh, 330px);
  }

  .image-workbench .prompt-panel .negative-textarea {
    min-height: clamp(120px, 16vh, 190px);
  }

  .image-workbench .edit-panel .prompt-textarea {
    min-height: clamp(138px, 18vh, 198px);
  }

  .image-workbench .edit-panel .negative-textarea {
    min-height: clamp(92px, 12vh, 140px);
  }

  .image-workbench .quality-panel {
    padding-bottom: 14px;
  }

  .image-workbench .quality-panel .mini-chip-row {
    gap: 10px;
  }

  .image-preview-panel {
    min-height: calc(100vh - 82px);
  }

  .image-preview-panel .preview-box {
    min-height: 0;
    padding: 16px;
    border-radius: 20px;
  }

  .image-workbench .preview-panel .result-grid img {
    width: min(100%, 380px);
  }

  .image-preview-panel .preview-illus {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    font-size: 24px;
    margin-bottom: 8px;
  }

  .image-preview-panel .preview-box strong {
    font-size: 16px;
  }

  .image-preview-panel .preview-box small {
    font-size: 12px;
  }

  .image-preview-panel .status-line {
    font-size: clamp(11px, 0.78vw, 13px);
  }

  .image-preview-panel .actions {
    gap: 12px;
  }

  .image-workbench .btn {
    min-height: 46px;
    font-size: clamp(14px, 0.9vw, 17px);
  }
}

@media (max-width: 980px) {
  .siteTop {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .step-nav__brand,
  .topUser {
    justify-self: center;
  }
}

@media (max-width: 1180px) {
  .desktop-workspace {
    grid-template-columns: 1fr;
  }

  .workspace-panel {
    min-height: auto;
  }

  .preview-panel .preview-box {
    min-height: 320px;
  }

  .image-workbench .quality-panel {
    margin-top: 0;
  }
}

@media (max-width: 420px) {
  body { padding: 0; }
  .app { min-height: 100vh; }
  .param-grid { gap: 8px; }
  .param-grid .opt { min-height: 70px; }
  .ratio-preview.r4x3 { width: 34px; }
  .ratio-preview.r21x9 { width: 40px; }
}
