:root {
  color-scheme: light;
  --bg: #f2f5f3;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-2: #eef4ef;
  --ink: #14211e;
  --muted: #5f7470;
  --line: rgba(87, 76, 64, 0.22);
  --blue: #0f7a62;
  --blue-strong: #0a5c49;
  --green: #0f8a5f;
  --coral: #dc2626;
  --shadow: 0 24px 70px rgba(25, 35, 28, 0.16);
  --glass-line: rgba(255, 255, 255, 0.5);
  --pointer-x: 52%;
  --pointer-y: 38%;
  --parallax-x: 0px;
  --parallax-y: 0px;
  --parallax-inverse-x: 0px;
  --parallax-inverse-y: 0px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  background:
    linear-gradient(135deg, rgba(33, 28, 24, 0.42), rgba(33, 28, 24, 0.12) 36%, rgba(33, 28, 24, 0.26)),
    url("/assets/collector-background.jpg") center/cover no-repeat fixed,
    var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.ambient-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.18), rgba(240, 244, 239, 0.08) 36%, rgba(233, 239, 233, 0.14)),
    url("/assets/collector-background.jpg") center/cover no-repeat,
    #eef3f8;
}

.ambient-background::before {
  content: "";
  position: absolute;
  inset: -22%;
  z-index: 1;
  opacity: 0.18;
  background:
    conic-gradient(
      from 142deg at var(--pointer-x) var(--pointer-y),
      rgba(37, 99, 235, 0.08),
      rgba(15, 138, 95, 0.06),
      rgba(212, 84, 69, 0.05),
      rgba(111, 118, 143, 0.06),
      rgba(37, 99, 235, 0.08)
    );
  filter: blur(48px) saturate(1.1);
  transform: translate3d(var(--parallax-inverse-x), var(--parallax-inverse-y), 0);
  animation: spectrumDrift 18s ease-in-out infinite alternate;
}

.ambient-background::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.36) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.34) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: linear-gradient(to bottom, transparent, #000 15%, #000 78%, transparent);
  transform:
    perspective(900px)
    rotateX(64deg)
    translate3d(var(--parallax-x), calc(28px + var(--parallax-y)), 0)
    scale(1.34);
  transform-origin: center bottom;
}

.ambient-video {
  display: none;
}

.ambient-surface,
.ambient-grid,
.ambient-sheen {
  position: absolute;
  inset: 0;
}

.ambient-surface {
  z-index: 2;
  opacity: 0.22;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.03) 5%, rgba(255, 255, 255, 0.28) 22%, rgba(255, 255, 255, 0.04) 36%),
    linear-gradient(78deg, rgba(37, 99, 235, 0.04), transparent 30%, rgba(15, 138, 95, 0.035) 62%, transparent 82%),
    linear-gradient(160deg, transparent 0 34%, rgba(255, 255, 255, 0.24) 46%, transparent 58% 100%);
  background-size: 240% 240%, 160% 160%, 180% 180%;
  transform: translate3d(var(--parallax-x), var(--parallax-y), 0);
  animation: satinShift 16s ease-in-out infinite alternate;
}

.ambient-grid {
  z-index: 3;
  opacity: 0.1;
  background:
    repeating-linear-gradient(110deg, transparent 0 46px, rgba(24, 32, 47, 0.2) 47px, transparent 48px),
    repeating-linear-gradient(18deg, transparent 0 74px, rgba(37, 99, 235, 0.18) 75px, transparent 76px);
  mask-image: radial-gradient(ellipse at 50% 38%, #000 0 42%, transparent 74%);
  transform: translate3d(var(--parallax-inverse-x), var(--parallax-inverse-y), 0);
}

.ambient-sheen {
  z-index: 4;
  opacity: 0.14;
  background:
    linear-gradient(105deg, transparent 0 20%, rgba(255, 255, 255, 0.7) 35%, transparent 48% 100%);
  transform: translate3d(-28%, 0, 0) skewX(-8deg);
  animation: sheenSweep 9s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding:
    max(24px, env(safe-area-inset-top))
    max(32px, env(safe-area-inset-right))
    18px
    max(32px, env(safe-area-inset-left));
  border-bottom: 0;
  background: transparent;
  color: var(--ink);
  backdrop-filter: none;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: none;
}

.app-bar h1,
.result-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.app-bar h1,
.app-bar .eyebrow,
.app-bar .support-line {
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.82);
}

.app-bar > div:first-child {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 4px;
  color: rgba(20, 33, 30, 0.72);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.support-line {
  margin: 6px 0 0;
  color: rgba(20, 33, 30, 0.82);
  font-size: 13px;
  line-height: 1.4;
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 220px;
}

.status-pill,
.endpoint {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  color: rgba(255, 255, 255, 0.82);
}

.target-settings {
  gap: 16px;
}

.target-note {
  margin-top: -4px;
}

.inline-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.status-pill.ok {
  color: var(--green);
  border-color: rgba(15, 138, 95, 0.28);
  background: rgba(15, 138, 95, 0.08);
}

.status-pill.warn {
  color: var(--coral);
  border-color: rgba(212, 84, 69, 0.3);
  background: rgba(212, 84, 69, 0.08);
}

.endpoint {
  max-width: min(46vw, 520px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding:
    24px
    max(32px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom))
    max(32px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 24px;
}

.control-panel,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.22);
  position: relative;
  overflow: hidden;
}

.control-panel::before,
.result-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--glass-line);
  pointer-events: none;
}

.control-panel::after,
.result-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.1;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 38%),
    linear-gradient(315deg, rgba(37, 99, 235, 0.04), transparent 42%);
  pointer-events: none;
}

.control-panel > *,
.result-panel > * {
  position: relative;
  z-index: 1;
}

.control-panel {
  align-self: start;
  position: sticky;
  top: 104px;
}

.form-stack {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.api-settings,
.share-settings,
.detail-settings,
.detail-planner {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.48), rgba(246, 249, 253, 0.28)),
    rgba(248, 250, 252, 0.44);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
}

.api-settings[hidden],
.share-settings[hidden],
.detail-settings[hidden],
.detail-planner[hidden],
.detail-planner .field[hidden],
.access-code-field[hidden],
.endpoint[hidden] {
  display: none;
}

.fashion-settings {
  gap: 16px;
}

.fashion-settings textarea {
  min-height: 118px;
}

.fashion-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border-left: 3px solid var(--green);
  padding: 10px 11px;
  background: rgba(15, 138, 95, 0.07);
  color: #285247;
  font-size: 12px;
  line-height: 1.5;
}

.fashion-note svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--green);
}

.detail-planner {
  display: grid;
  gap: 14px;
  border-left: 3px solid var(--blue);
}

.detail-planner-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.detail-planner-heading .eyebrow {
  color: var(--blue);
}

.detail-planner-heading h3 {
  margin: 2px 0 0;
  font-size: 16px;
}

.detail-plan-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.detail-planner-controls {
  gap: 10px;
}

.detail-planner.is-fashion .detail-planner-controls {
  grid-template-columns: minmax(0, 1fr);
}

.detail-plan-list {
  max-height: 300px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  border-block: 1px solid var(--line);
}

.detail-plan-item {
  min-height: 52px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
}

.detail-plan-item:last-child {
  border-bottom: 0;
}

.detail-plan-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.detail-plan-content {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.detail-plan-content strong {
  color: var(--ink);
  font-size: 13px;
}

.detail-plan-content small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.fashion-parameter-grid {
  display: grid;
  gap: 12px;
}

.parameter-field {
  border: 1px solid var(--line);
  padding: 12px;
  background: rgba(255, 255, 255, 0.46);
}

.size-parameter {
  border-left: 3px solid var(--blue);
}

.color-parameter {
  border-left: 3px solid var(--coral);
}

.parameter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.parameter-heading span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.api-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #273247;
  font-size: 13px;
  font-weight: 800;
}

.api-title svg {
  width: 17px;
  height: 17px;
  color: var(--blue);
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: #273247;
  font-size: 13px;
  font-weight: 700;
}

.prompt-section {
  display: grid;
  gap: 10px;
}

.prompt-disclosure {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(248, 250, 252, 0.68);
  color: var(--ink);
  text-align: left;
}

.prompt-disclosure[hidden] {
  display: none;
}

.prompt-disclosure > span:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.prompt-disclosure strong {
  font-size: 13px;
}

.prompt-disclosure small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.prompt-disclosure-action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.prompt-disclosure-action svg {
  width: 16px;
  height: 16px;
  transition: transform 160ms ease;
}

.prompt-disclosure[aria-expanded="true"] .prompt-disclosure-action svg {
  transform: rotate(180deg);
}

#promptField[hidden] {
  display: none;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 252, 254, 0.72);
  color: var(--ink);
  backdrop-filter: blur(8px);
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

textarea {
  min-height: 216px;
  resize: vertical;
  padding: 12px 13px;
  line-height: 1.55;
}

input,
select {
  min-height: 42px;
  padding: 0 11px;
}

.secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.secret-row input {
  min-width: 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
}

.icon-button:hover {
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--blue);
}

.reference-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
}

.reference-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.upload-drop {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed #b7c3d4;
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.58);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.upload-drop:hover {
  border-color: rgba(37, 99, 235, 0.5);
  color: var(--blue);
}

.upload-drop.is-dragging {
  border-color: var(--blue);
  background: rgba(15, 122, 98, 0.1);
  color: var(--blue);
}

.paste-reference-button {
  min-width: 112px;
}

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

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

.reference-grid.show {
  display: grid;
}

.reference-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.reference-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.reference-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(24, 32, 47, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  color: var(--ink);
}

.reference-remove:hover {
  color: var(--coral);
}

.share-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.share-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: #1d4ed8;
  padding: 0 11px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-link:hover {
  border-color: rgba(37, 99, 235, 0.4);
}

.access-code-field {
  display: grid;
  gap: 8px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.7);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(238, 242, 247, 0.74);
}

.segment {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  background:
    linear-gradient(135deg, rgba(24, 32, 47, 0.96), rgba(45, 56, 78, 0.92));
  color: #ffffff;
}

.mode-segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-span {
  grid-column: 1 / -1;
}

.api-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.remaining-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.download-directory-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.download-directory-name {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remaining-pill {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.remaining-pill.ok {
  color: var(--green);
  border-color: rgba(15, 138, 95, 0.28);
  background: rgba(15, 138, 95, 0.08);
}

.remaining-pill.warn {
  color: var(--coral);
  border-color: rgba(212, 84, 69, 0.3);
  background: rgba(212, 84, 69, 0.08);
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.remember-row input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: var(--blue);
}

.compact-field {
  max-width: 180px;
}

.primary-action,
.ghost-button,
.tool-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action {
  width: 100%;
  border: 1px solid var(--blue);
  background:
    linear-gradient(135deg, #2563eb, #1d4ed8 55%, #0f8a5f);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.22);
}

.primary-action:hover {
  background: var(--blue-strong);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.ghost-button,
.tool-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  padding: 0 12px;
}

.ghost-button:hover,
.tool-button:hover {
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--blue);
}

.result-panel {
  min-height: calc(100vh - 154px);
  padding: 20px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.message {
  display: none;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(251, 252, 254, 0.72);
  line-height: 1.5;
}

.message.show {
  display: block;
}

.message.error {
  color: #9f2d22;
  border-color: rgba(212, 84, 69, 0.35);
  background: rgba(212, 84, 69, 0.08);
}

.message.success {
  color: #0d6849;
  border-color: rgba(15, 138, 95, 0.28);
  background: rgba(15, 138, 95, 0.08);
}

.failure-report {
  margin: 0 0 16px;
  border-block: 1px solid rgba(212, 84, 69, 0.28);
  padding: 12px 0;
}

.failure-report[hidden] {
  display: none;
}

.failure-report-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #8d2b22;
}

.failure-report-heading svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.failure-report-heading div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.failure-report-heading span {
  color: var(--muted);
  font-size: 12px;
}

.failure-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.failure-item {
  border-left: 3px solid rgba(212, 84, 69, 0.55);
  padding: 8px 10px;
  background: rgba(212, 84, 69, 0.05);
}

.failure-item summary {
  cursor: pointer;
  color: #8d2b22;
  font-weight: 700;
}

.failure-item p {
  margin: 8px 0 0;
  color: #653630;
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.empty-state {
  min-height: 520px;
  border: 1px dashed #c7d0dd;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.54), rgba(246, 249, 253, 0.28)),
    repeating-linear-gradient(45deg, rgba(37, 99, 235, 0.08) 0 1px, transparent 1px 16px),
    repeating-linear-gradient(-45deg, rgba(15, 138, 95, 0.06) 0 1px, transparent 1px 18px);
  background-color: rgba(255, 255, 255, 0.34);
  background-position:
    0 0,
    0 0,
    12px -12px;
  background-size:
    auto,
    24px 24px,
    24px 24px;
}

.empty-state p {
  margin: 0;
  font-weight: 700;
}

.preview-frame {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(16px);
}

.preview-frame svg {
  width: 34px;
  height: 34px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.image-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(18px);
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: 320px 560px;
}

.image-stage {
  position: relative;
}

.image-wrap {
  width: 100%;
  margin: 0;
  border: 0;
  padding: 0;
  appearance: none;
  background:
    linear-gradient(45deg, #edf1f6 25%, transparent 25%),
    linear-gradient(-45deg, #edf1f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #edf1f6 75%),
    linear-gradient(-45deg, transparent 75%, #edf1f6 75%);
  background-color: #ffffff;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
  aspect-ratio: var(--result-aspect-ratio, 1 / 1);
  display: grid;
  place-items: center;
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
}

.image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* Keep the image layer visible while a slow remote image is decoding. */
  opacity: 1;
  transition: opacity 160ms ease;
}

.image-wrap.is-loaded img {
  opacity: 1;
}

.image-load-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.image-wrap.is-loaded .image-load-status,
.image-stage.has-load-error .image-load-status {
  display: none;
}

.image-load-error {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(248, 250, 252, 0.94);
}

.image-stage.has-load-error .image-load-error {
  display: grid;
}

.image-wrap:focus-visible {
  outline: 3px solid rgba(15, 122, 98, 0.62);
  outline-offset: -3px;
}

.preview-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(20, 33, 30, 0.68);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.preview-hint svg {
  width: 17px;
  height: 17px;
}

.image-wrap:hover .preview-hint,
.image-wrap:focus-visible .preview-hint {
  opacity: 1;
  transform: translateY(0);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
  background: rgba(9, 12, 11, 0.94);
}

.image-lightbox[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
}

.image-lightbox::backdrop {
  background: rgba(9, 12, 11, 0.76);
}

.lightbox-stage {
  --lightbox-pad-top: max(64px, env(safe-area-inset-top));
  --lightbox-pad-right: max(18px, env(safe-area-inset-right));
  --lightbox-pad-bottom: max(24px, env(safe-area-inset-bottom));
  --lightbox-pad-left: max(18px, env(safe-area-inset-left));
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding:
    var(--lightbox-pad-top)
    var(--lightbox-pad-right)
    var(--lightbox-pad-bottom)
    var(--lightbox-pad-left);
  display: grid;
  place-items: center;
}

.lightbox-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - var(--lightbox-pad-left) - var(--lightbox-pad-right));
  max-height: calc(100vh - var(--lightbox-pad-top) - var(--lightbox-pad-bottom));
  max-height: calc(100dvh - var(--lightbox-pad-top) - var(--lightbox-pad-bottom));
  object-fit: contain;
}

.lightbox-close {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 2;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(20, 33, 30, 0.72);
}

.lightbox-close svg {
  width: 22px;
  height: 22px;
}

.image-meta {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.image-meta p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.result-prompt-disclosure {
  width: 100%;
  justify-content: flex-start;
  color: var(--muted);
  background: transparent;
}

.result-prompt-panel {
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.86);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.result-prompt-panel[hidden] {
  display: none;
}

.meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.meta-chip {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 4px 8px;
  background: rgba(238, 242, 247, 0.78);
  color: #334055;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px;
}

.tool-button {
  min-width: 0;
  font-size: 13px;
}

.tool-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.saved-link {
  display: block;
  overflow: hidden;
  color: var(--green);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-link:hover {
  color: #0a6847;
}

.hidden {
  display: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.dark {
  border-color: rgba(37, 99, 235, 0.2);
  border-top-color: var(--blue);
}

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

@keyframes spectrumDrift {
  0% {
    opacity: 0.46;
    rotate: -2deg;
  }

  100% {
    opacity: 0.6;
    rotate: 2deg;
  }
}

@keyframes satinShift {
  0% {
    background-position:
      0% 48%,
      0% 0%,
      12% 0%;
  }

  100% {
    background-position:
      100% 52%,
      80% 45%,
      78% 100%;
  }
}

@keyframes sheenSweep {
  0%,
  26% {
    transform: translate3d(-42%, 0, 0) skewX(-8deg);
  }

  62%,
  100% {
    transform: translate3d(46%, 0, 0) skewX(-8deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-background::before,
  .ambient-surface,
  .ambient-sheen,
  .spinner {
    animation: none;
  }

  .ambient-sheen {
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .app-bar {
    align-items: flex-start;
    padding:
      max(18px, env(safe-area-inset-top))
      max(18px, env(safe-area-inset-right))
      18px
      max(18px, env(safe-area-inset-left));
    position: static;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding:
      18px
      max(18px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom))
      max(18px, env(safe-area-inset-left));
  }

  .control-panel {
    position: static;
  }

  .result-panel {
    min-height: 520px;
  }

  .endpoint {
    max-width: 100%;
  }
}

@media (min-width: 981px) {
  body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }

  .workspace {
    flex: 1;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
  }

  .control-panel,
  .result-panel {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }

  .control-panel {
    align-self: stretch;
    position: relative;
    top: auto;
  }

  .result-panel {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .app-bar {
    flex-direction: column;
  }

  .status-strip {
    width: 100%;
    justify-content: flex-start;
  }

  .app-bar h1 {
    font-size: 22px;
  }

  .grid-fields,
  .gallery,
  .reference-upload,
  .share-row {
    grid-template-columns: 1fr;
  }

  .card-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .api-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .api-actions .ghost-button {
    width: 100%;
  }

  .download-directory-row {
    align-items: stretch;
    flex-direction: column;
  }

  .download-directory-row .ghost-button {
    width: 100%;
  }

  .download-directory-name {
    padding-inline: 2px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segment:nth-child(2n) {
    border-right: 0;
  }

  .segment:nth-child(5) {
    grid-column: span 2;
    border-top: 1px solid var(--line);
  }

  .mode-segmented {
    grid-template-columns: 1fr;
  }

  .mode-segmented .segment {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mode-segmented .segment:last-child {
    border-bottom: 0;
  }

  .compact-field {
    max-width: none;
  }
}

/* 030: full workbench visual pass. The existing controls and workflow stay intact. */
body {
  background:
    linear-gradient(135deg, rgba(16, 27, 24, 0.58), rgba(16, 27, 24, 0.18) 42%, rgba(16, 27, 24, 0.38)),
    url("/assets/collector-background.jpg") center/cover no-repeat fixed,
    #e9eeea;
}

.ambient-background {
  background:
    linear-gradient(135deg, rgba(16, 27, 24, 0.28), rgba(245, 248, 245, 0.12) 50%, rgba(16, 27, 24, 0.2)),
    url("/assets/collector-background.jpg") center/cover no-repeat,
    #e9eeea;
}

.ambient-background::before,
.ambient-background::after,
.ambient-surface,
.ambient-grid,
.ambient-sheen {
  opacity: 0;
}

.app-bar {
  min-height: 78px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 27, 24, 0.9);
  box-shadow: 0 10px 28px rgba(8, 16, 14, 0.2);
  color: #f5faf7;
  backdrop-filter: blur(18px) saturate(1.08);
}

.app-bar > div:first-child {
  min-height: 48px;
  padding-left: 60px;
}

.app-bar > div:first-child::before {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(178, 229, 210, 0.35);
  background: #dff3e9;
  color: #0b5e4a;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

.app-bar h1,
.app-bar .eyebrow,
.app-bar .support-line {
  color: inherit;
  text-shadow: none;
}

.app-bar .eyebrow {
  color: #9ed6c1;
}

.app-bar .support-line {
  color: rgba(245, 250, 247, 0.64);
}

.status-pill,
.endpoint {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(245, 250, 247, 0.82);
}

.status-pill.ok {
  color: #b9f0d5;
  border-color: rgba(185, 240, 213, 0.28);
  background: rgba(58, 166, 120, 0.18);
}

.workspace--editor {
  width: min(1500px, 100%);
  grid-template-columns: minmax(380px, 430px) minmax(0, 1fr);
  gap: 22px;
  padding-top: 22px;
}

.control-panel,
.result-panel {
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 10px;
  background: rgba(250, 252, 250, 0.91);
  box-shadow: 0 24px 56px rgba(15, 27, 24, 0.2);
  backdrop-filter: blur(20px) saturate(1.05);
}

.control-panel::before,
.result-panel::before {
  border-color: rgba(255, 255, 255, 0.78);
}

.control-panel::after,
.result-panel::after {
  display: none;
}

.form-stack {
  gap: 15px;
  padding: 22px;
}

.api-settings,
.detail-settings,
.detail-planner,
.settings-block,
.prompt-section {
  border-radius: 9px;
  border-color: rgba(20, 33, 30, 0.14);
  box-shadow: 0 6px 18px rgba(20, 33, 30, 0.045), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.api-settings {
  background: #eff7f2;
}

.api-settings .api-title {
  color: #183d33;
}

.detail-settings {
  background: #fffdfa;
}

.detail-planner {
  border-left-width: 3px;
  background: #eef8f3;
}

.workflow-field,
.prompt-section--primary,
.settings-block {
  position: relative;
}

.workflow-field::before,
.prompt-section--primary::before,
.settings-block::before {
  position: absolute;
  top: -9px;
  left: 12px;
  padding: 0 6px;
  background: #fafcfa;
  color: #6b817a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workflow-field::before {
  content: "01 方式";
}

.prompt-section--primary::before {
  content: "02 内容";
}

.target-settings::before {
  content: "03 适配";
}

.output-settings::before {
  content: "04 输出";
}

.workflow-field {
  padding: 8px 12px 12px;
  border: 1px solid rgba(20, 33, 30, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.52);
}

.mode-segmented {
  border-color: rgba(20, 33, 30, 0.12);
  background: #e9efec;
}

.mode-segmented .segment {
  color: #61736e;
}

.mode-segmented .segment.active {
  background: #14211e;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(20, 33, 30, 0.18);
}

.prompt-section--primary {
  padding: 18px 15px 15px;
  border-color: rgba(15, 122, 98, 0.2);
  background: #fffefa;
}

.prompt-section--primary textarea {
  min-height: 180px;
  border-color: rgba(20, 33, 30, 0.15);
  background: #ffffff;
}

.settings-block {
  padding: 16px 12px 12px;
  background: rgba(255, 255, 255, 0.55);
}

.detail-planner .detail-planner-heading {
  padding-bottom: 4px;
}

.detail-plan-summary {
  border-color: rgba(15, 122, 98, 0.2);
  background: rgba(255, 255, 255, 0.7);
}

.primary-action {
  min-height: 50px;
  border-radius: 9px;
  border-color: #0b6f58;
  background: #0f7a62;
  box-shadow: 0 12px 24px rgba(15, 122, 98, 0.24);
  font-size: 14px;
}

.primary-action:hover {
  background: #084f40;
}

.result-panel--output {
  min-width: 0;
  padding: 22px;
  background: rgba(251, 252, 250, 0.94);
}

.result-panel--output .result-header {
  margin-bottom: 22px;
  padding: 2px 2px 16px;
  border-bottom-color: rgba(20, 33, 30, 0.14);
}

.result-panel--output .result-header h2 {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.empty-state {
  min-height: 500px;
  border: 1px dashed rgba(15, 122, 98, 0.28);
  background:
    radial-gradient(circle at 50% 42%, rgba(221, 242, 232, 0.62), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 248, 243, 0.5));
}

.preview-frame {
  width: 92px;
  height: 92px;
  border-color: rgba(15, 122, 98, 0.22);
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 122, 98, 0.11);
  color: var(--blue);
}

.empty-state p {
  color: #4e6960;
  font-size: 14px;
}

.image-card {
  border-color: rgba(20, 33, 30, 0.14);
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 27, 24, 0.1);
}

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

@media (max-width: 640px) {
  .app-bar {
    min-height: 72px;
  }

  .app-bar > div:first-child {
    padding-left: 54px;
  }

  .app-bar > div:first-child::before {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .workspace--editor {
    gap: 12px;
    padding-top: 12px;
  }

  .form-stack,
  .result-panel--output {
    padding: 14px;
  }

  .empty-state {
    min-height: 360px;
  }
}

/* 028: keep the ten-page composition internal and present a quieter control surface. */
.target-settings,
.form-stack > .grid-fields:not(.target-settings) {
  border: 1px solid rgba(20, 33, 30, 0.1);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.42);
}

.target-settings .target-note {
  display: none;
}

.detail-settings {
  gap: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.detail-settings .grid-fields {
  gap: 10px;
}

.detail-planner {
  gap: 12px;
  border-left: 3px solid var(--blue);
  padding: 13px 15px;
  background: rgba(15, 122, 98, 0.06);
}

.detail-planner-heading {
  align-items: center;
}

.detail-planner-heading .eyebrow {
  margin-bottom: 2px;
  font-size: 10px;
}

.detail-planner-heading h3 {
  font-size: 15px;
}

.detail-planner-controls {
  gap: 10px;
}

.detail-planner .detected-category,
.detail-planner select {
  min-height: 40px;
}

.reference-upload {
  padding: 10px;
  border: 1px dashed rgba(20, 33, 30, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.34);
}

.form-stack > .field > label,
.form-stack > .grid-fields > .field > label {
  letter-spacing: 0.01em;
}

@media (max-width: 640px) {
  .detail-planner-controls {
    grid-template-columns: 1fr;
  }

  .target-settings,
  .form-stack > .grid-fields:not(.target-settings) {
    padding: 10px;
  }
}

/* 027: bring the workbench hierarchy forward without changing the workflow. */
.app-bar {
  padding-inline: max(30px, env(safe-area-inset-left)) max(30px, env(safe-area-inset-right));
  background: rgba(248, 251, 249, 0.72);
  border-bottom: 1px solid rgba(20, 33, 30, 0.12);
  box-shadow: 0 12px 32px rgba(20, 33, 30, 0.08);
}

.app-bar h1 {
  margin-top: 2px;
  letter-spacing: 0;
  font-size: clamp(24px, 2vw, 32px);
}

.workspace {
  gap: 18px;
  padding-top: 18px;
}

.control-panel,
.result-panel {
  border-color: rgba(20, 33, 30, 0.15);
  box-shadow: 0 20px 54px rgba(20, 33, 30, 0.13);
}

.form-stack {
  gap: 14px;
  padding: 18px;
}

.api-settings,
.detail-settings,
.detail-planner {
  border-color: rgba(20, 33, 30, 0.13);
  border-radius: 10px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.66);
}

.api-settings {
  gap: 12px;
  background: rgba(20, 33, 30, 0.045);
}

.mode-segmented {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  border-color: rgba(20, 33, 30, 0.14);
  background: rgba(20, 33, 30, 0.06);
}

.mode-segmented .segment {
  border: 0;
  border-radius: 7px;
  min-height: 42px;
}

.mode-segmented .segment.active {
  background: #14211e;
  box-shadow: 0 4px 12px rgba(20, 33, 30, 0.18);
}

.prompt-section {
  padding: 2px 0;
}

.prompt-section textarea {
  min-height: 180px;
  border-color: rgba(15, 122, 98, 0.3);
  background: rgba(255, 255, 255, 0.84);
}

.detail-settings {
  border-left: 3px solid var(--blue);
}

.detected-category {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(15, 122, 98, 0.24);
  border-radius: 8px;
  color: var(--blue-strong);
  background: rgba(15, 122, 98, 0.08);
  font-size: 13px;
  font-weight: 800;
}

.detail-plan-list {
  max-height: 250px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 0;
  overflow-y: auto;
}

.detail-plan-item {
  min-height: 58px;
  border: 1px solid rgba(20, 33, 30, 0.1);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.detail-plan-item:last-child {
  border-bottom: 1px solid rgba(20, 33, 30, 0.1);
}

.result-panel {
  padding: 18px;
}

.result-header {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(20, 33, 30, 0.1);
}

.empty-state {
  min-height: 420px;
  border-style: solid;
  border-color: rgba(20, 33, 30, 0.12);
  background: rgba(255, 255, 255, 0.34);
}

@media (max-width: 640px) {
  .app-bar {
    padding-inline: max(18px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-right));
  }

  .detail-plan-list {
    grid-template-columns: 1fr;
  }
}

/* 030 final precedence: keep the workbench redesign after the legacy tuning layers. */
body {
  background:
    linear-gradient(135deg, rgba(16, 27, 24, 0.58), rgba(16, 27, 24, 0.18) 42%, rgba(16, 27, 24, 0.38)),
    url("/assets/collector-background.jpg") center/cover no-repeat fixed,
    #e9eeea;
}

.ambient-background {
  background:
    linear-gradient(135deg, rgba(16, 27, 24, 0.28), rgba(245, 248, 245, 0.12) 50%, rgba(16, 27, 24, 0.2)),
    url("/assets/collector-background.jpg") center/cover no-repeat,
    #e9eeea;
}

.ambient-background::before,
.ambient-background::after,
.ambient-surface,
.ambient-grid,
.ambient-sheen {
  opacity: 0;
}

.app-bar {
  min-height: 78px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 27, 24, 0.94);
  box-shadow: 0 10px 28px rgba(8, 16, 14, 0.2);
  color: #f5faf7;
  backdrop-filter: blur(18px) saturate(1.08);
}

.app-bar > div:first-child {
  min-height: 48px;
  padding-left: 60px;
}

.app-bar > div:first-child::before {
  width: 46px;
  height: 46px;
  border-color: rgba(178, 229, 210, 0.35);
  background: #dff3e9;
  color: #0b5e4a;
}

.app-bar h1,
.app-bar .eyebrow,
.app-bar .support-line {
  color: inherit;
  text-shadow: none;
}

.app-bar .eyebrow {
  color: #9ed6c1;
}

.app-bar .support-line {
  color: rgba(245, 250, 247, 0.64);
}

.status-pill,
.endpoint {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(245, 250, 247, 0.82);
}

.workspace--editor {
  width: min(1500px, 100%);
  grid-template-columns: minmax(380px, 430px) minmax(0, 1fr);
  gap: 22px;
  padding-top: 22px;
}

.control-panel,
.result-panel {
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 10px;
  background: rgba(250, 252, 250, 0.91);
  box-shadow: 0 24px 56px rgba(15, 27, 24, 0.2);
  backdrop-filter: blur(20px) saturate(1.05);
}

.control-panel::before,
.result-panel::before {
  border-color: rgba(255, 255, 255, 0.78);
}

.control-panel::after,
.result-panel::after {
  display: none;
}

.form-stack {
  gap: 15px;
  padding: 22px;
}

.api-settings,
.detail-settings,
.detail-planner,
.settings-block,
.prompt-section {
  border-radius: 9px;
  border-color: rgba(20, 33, 30, 0.14);
  box-shadow: 0 6px 18px rgba(20, 33, 30, 0.045), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.api-settings { background: #eff7f2; }
.detail-settings { background: #fffdfa; }
.detail-planner { border-left-width: 3px; background: #eef8f3; }

.workflow-field,
.prompt-section--primary,
.settings-block {
  position: relative;
}

.workflow-field::before,
.prompt-section--primary::before,
.settings-block::before {
  position: absolute;
  top: -9px;
  left: 12px;
  padding: 0 6px;
  background: #fafcfa;
  color: #6b817a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.workflow-field::before { content: "01 方式"; }
.prompt-section--primary::before { content: "02 内容"; }
.target-settings::before { content: "03 适配"; }
.output-settings::before { content: "04 输出"; }

.workflow-field {
  padding: 8px 12px 12px;
  border: 1px solid rgba(20, 33, 30, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.52);
}

.mode-segmented {
  border-color: rgba(20, 33, 30, 0.12);
  background: #e9efec;
}

.mode-segmented .segment { color: #61736e; }
.mode-segmented .segment.active { background: #14211e; color: #ffffff; }

.prompt-section--primary {
  padding: 18px 15px 15px;
  border-color: rgba(15, 122, 98, 0.2);
  background: #fffefa;
}

.prompt-section--primary textarea {
  min-height: 180px;
  border-color: rgba(20, 33, 30, 0.15);
  background: #ffffff;
}

.settings-block {
  padding: 16px 12px 12px;
  background: rgba(255, 255, 255, 0.55);
}

.primary-action {
  min-height: 50px;
  border-radius: 9px;
  border-color: #0b6f58;
  background: #0f7a62;
  box-shadow: 0 12px 24px rgba(15, 122, 98, 0.24);
}

.primary-action:hover { background: #084f40; }

.result-panel--output {
  min-width: 0;
  padding: 22px;
  background: rgba(251, 252, 250, 0.94);
}

.result-panel--output .result-header {
  margin-bottom: 22px;
  padding: 2px 2px 16px;
  border-bottom-color: rgba(20, 33, 30, 0.14);
}

.result-panel--output .result-header h2 { font-size: 28px; }

.empty-state {
  min-height: 500px;
  border-color: rgba(15, 122, 98, 0.28);
  background:
    radial-gradient(circle at 50% 42%, rgba(221, 242, 232, 0.62), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 248, 243, 0.5));
}

.preview-frame {
  width: 92px;
  height: 92px;
  border-color: rgba(15, 122, 98, 0.22);
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 122, 98, 0.11);
  color: var(--blue);
}

.empty-state p { color: #4e6960; }
.image-card { background: #ffffff; box-shadow: 0 12px 28px rgba(15, 27, 24, 0.1); }

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

@media (max-width: 640px) {
  .app-bar { min-height: 72px; }
  .app-bar > div:first-child { padding-left: 54px; }
  .app-bar > div:first-child::before { width: 40px; height: 40px; font-size: 20px; }
  .workspace--editor { gap: 12px; padding-top: 12px; }
  .form-stack, .result-panel--output { padding: 14px; }
  .empty-state { min-height: 360px; }
}

/* 029: make the workbench feel deliberate without changing its workflow. */
.app-bar {
  min-height: 76px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: 14px;
  background: rgba(250, 252, 250, 0.84);
  border-bottom-color: rgba(20, 33, 30, 0.16);
  box-shadow: 0 8px 24px rgba(20, 33, 30, 0.09);
}

.app-bar > div:first-child {
  min-height: 46px;
  padding-left: 58px;
}

.app-bar > div:first-child::before {
  content: "万";
  position: absolute;
  left: 0;
  top: 1px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(15, 122, 98, 0.26);
  border-radius: 8px;
  background: linear-gradient(145deg, #e9f5ef, #ffffff 70%);
  color: var(--blue-strong);
  box-shadow: 0 8px 18px rgba(15, 122, 98, 0.12);
  font-size: 22px;
  font-weight: 900;
}

.app-bar h1 {
  font-size: clamp(23px, 2vw, 30px);
  line-height: 1.05;
}

.support-line {
  margin-top: 5px;
  color: rgba(20, 33, 30, 0.66);
}

.status-strip {
  min-width: 0;
}

.status-pill,
.endpoint {
  min-height: 30px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
}

.workspace {
  width: min(1480px, 100%);
  grid-template-columns: minmax(360px, 410px) minmax(0, 1fr);
  gap: 20px;
  padding-top: 20px;
}

.control-panel,
.result-panel {
  border-color: rgba(20, 33, 30, 0.16);
  background: rgba(250, 252, 250, 0.84);
  box-shadow: 0 18px 48px rgba(20, 33, 30, 0.14);
  backdrop-filter: blur(18px) saturate(1.08);
}

.control-panel::after,
.result-panel::after {
  opacity: 0.055;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 42%);
}

.form-stack {
  gap: 16px;
  padding: 20px;
}

.api-settings,
.detail-settings,
.detail-planner {
  border-radius: 8px;
  border-color: rgba(20, 33, 30, 0.14);
  box-shadow: 0 8px 20px rgba(20, 33, 30, 0.045), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.api-settings {
  background: rgba(241, 247, 244, 0.76);
}

.detail-settings {
  background: rgba(255, 255, 255, 0.78);
}

.detail-planner {
  border-left-width: 3px;
  background: rgba(232, 246, 240, 0.76);
}

.detail-plan-summary {
  max-width: 52%;
  padding: 6px 8px;
  border: 1px solid rgba(15, 122, 98, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--blue-strong);
  line-height: 1.25;
}

.prompt-section {
  padding: 15px;
  border: 1px solid rgba(15, 122, 98, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.prompt-section textarea {
  min-height: 172px;
  border-color: rgba(20, 33, 30, 0.16);
  background: rgba(255, 255, 255, 0.9);
}

.target-settings,
.form-stack > .grid-fields:not(.target-settings) {
  gap: 12px;
  border-color: rgba(20, 33, 30, 0.12);
  background: rgba(255, 255, 255, 0.48);
}

.field label {
  color: #30423e;
  font-size: 12px;
  letter-spacing: 0.02em;
}

textarea,
input,
select {
  border-color: rgba(20, 33, 30, 0.16);
  background: rgba(255, 255, 255, 0.78);
}

textarea:hover,
input:hover,
select:hover {
  border-color: rgba(15, 122, 98, 0.35);
}

.reference-upload {
  border-color: rgba(15, 122, 98, 0.28);
  background: rgba(239, 248, 243, 0.54);
}

.upload-drop {
  border-color: rgba(15, 122, 98, 0.32);
  background: rgba(255, 255, 255, 0.68);
}

.mode-segmented {
  background: rgba(20, 33, 30, 0.055);
}

.mode-segmented .segment.active {
  background: #14211e;
}

.primary-action {
  min-height: 48px;
  border-radius: 8px;
  background: #0f7a62;
  box-shadow: 0 10px 22px rgba(15, 122, 98, 0.2);
  font-size: 14px;
}

.primary-action:hover {
  background: #0a5c49;
  box-shadow: 0 12px 26px rgba(15, 122, 98, 0.26);
}

.result-panel {
  padding: 22px;
}

.result-header {
  align-items: flex-end;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom-color: rgba(20, 33, 30, 0.13);
}

.result-header h2 {
  font-size: 26px;
}

.empty-state {
  min-height: 460px;
  border-color: rgba(20, 33, 30, 0.14);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(240, 247, 243, 0.46)),
    rgba(255, 255, 255, 0.38);
}

.preview-frame {
  width: 88px;
  height: 88px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 24px rgba(20, 33, 30, 0.08);
}

.image-card {
  border-color: rgba(20, 33, 30, 0.14);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(20, 33, 30, 0.08);
}

@media (min-width: 981px) {
  .form-stack > .primary-action {
    position: sticky;
    bottom: 0;
    z-index: 4;
  }
}

@media (max-width: 640px) {
  .app-bar > div:first-child {
    padding-left: 54px;
  }

  .app-bar > div:first-child::before {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .workspace {
    gap: 12px;
    padding-top: 12px;
  }

  .form-stack,
  .result-panel {
    padding: 14px;
  }

  .prompt-section {
    padding: 12px;
  }

  .detail-plan-summary {
    max-width: 48%;
    text-align: right;
  }

  .result-header h2 {
    font-size: 23px;
  }
}

/* 030-final: overrides the earlier tuning layers. */
body {
  background:
    linear-gradient(135deg, rgba(16, 27, 24, 0.58), rgba(16, 27, 24, 0.18) 42%, rgba(16, 27, 24, 0.38)),
    url("/assets/collector-background.jpg") center/cover no-repeat fixed,
    #e9eeea;
}

.ambient-background {
  background:
    linear-gradient(135deg, rgba(16, 27, 24, 0.28), rgba(245, 248, 245, 0.12) 50%, rgba(16, 27, 24, 0.2)),
    url("/assets/collector-background.jpg") center/cover no-repeat,
    #e9eeea;
}

.ambient-background::before,
.ambient-background::after,
.ambient-surface,
.ambient-grid,
.ambient-sheen {
  opacity: 0;
}

.app-bar {
  min-height: 78px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 27, 24, 0.94);
  box-shadow: 0 10px 28px rgba(8, 16, 14, 0.2);
  color: #f5faf7;
  backdrop-filter: blur(18px) saturate(1.08);
}

.app-bar > div:first-child { min-height: 48px; padding-left: 60px; }
.app-bar > div:first-child::before {
  width: 46px;
  height: 46px;
  border-color: rgba(178, 229, 210, 0.35);
  background: #dff3e9;
  color: #0b5e4a;
}
.app-bar h1,
.app-bar .eyebrow,
.app-bar .support-line { color: inherit; text-shadow: none; }
.app-bar .eyebrow { color: #9ed6c1; }
.app-bar .support-line { color: rgba(245, 250, 247, 0.64); }
.status-pill,
.endpoint {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(245, 250, 247, 0.82);
}

.workspace--editor {
  width: min(1500px, 100%);
  grid-template-columns: minmax(380px, 430px) minmax(0, 1fr);
  gap: 22px;
  padding-top: 22px;
}

.control-panel,
.result-panel {
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 10px;
  background: rgba(250, 252, 250, 0.91);
  box-shadow: 0 24px 56px rgba(15, 27, 24, 0.2);
  backdrop-filter: blur(20px) saturate(1.05);
}
.control-panel::before,
.result-panel::before { border-color: rgba(255, 255, 255, 0.78); }
.control-panel::after,
.result-panel::after { display: none; }
.form-stack { gap: 15px; padding: 22px; }

.api-settings,
.detail-settings,
.detail-planner,
.settings-block,
.prompt-section {
  border-radius: 9px;
  border-color: rgba(20, 33, 30, 0.14);
  box-shadow: 0 6px 18px rgba(20, 33, 30, 0.045), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.api-settings { background: #eff7f2; }
.detail-settings { background: #fffdfa; }
.detail-planner { border-left-width: 3px; background: #eef8f3; }

.workflow-field,
.prompt-section--primary,
.settings-block { position: relative; }
.workflow-field::before,
.prompt-section--primary::before,
.settings-block::before {
  position: absolute;
  top: -9px;
  left: 12px;
  padding: 0 6px;
  background: #fafcfa;
  color: #6b817a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.workflow-field::before { content: "01 方式"; }
.prompt-section--primary::before { content: "02 内容"; }
.target-settings::before { content: "03 适配"; }
.output-settings::before { content: "04 输出"; }
.workflow-field {
  padding: 8px 12px 12px;
  border: 1px solid rgba(20, 33, 30, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.52);
}
.mode-segmented { border-color: rgba(20, 33, 30, 0.12); background: #e9efec; }
.mode-segmented .segment { color: #61736e; }
.mode-segmented .segment.active { background: #14211e; color: #ffffff; }
.prompt-section--primary { padding: 18px 15px 15px; border-color: rgba(15, 122, 98, 0.2); background: #fffefa; }
.prompt-section--primary textarea { min-height: 180px; border-color: rgba(20, 33, 30, 0.15); background: #ffffff; }
.settings-block { padding: 16px 12px 12px; background: rgba(255, 255, 255, 0.55); }

.primary-action {
  min-height: 50px;
  border-radius: 9px;
  border-color: #0b6f58;
  background: #0f7a62;
  box-shadow: 0 12px 24px rgba(15, 122, 98, 0.24);
}
.primary-action:hover { background: #084f40; }
.result-panel--output { min-width: 0; padding: 22px; background: rgba(251, 252, 250, 0.94); }
.result-panel--output .result-header { margin-bottom: 22px; padding: 2px 2px 16px; border-bottom-color: rgba(20, 33, 30, 0.14); }
.result-panel--output .result-header h2 { font-size: 28px; }
.empty-state {
  min-height: 500px;
  border-color: rgba(15, 122, 98, 0.28);
  background:
    radial-gradient(circle at 50% 42%, rgba(221, 242, 232, 0.62), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 248, 243, 0.5));
}
.preview-frame { width: 92px; height: 92px; border-color: rgba(15, 122, 98, 0.22); background: #ffffff; color: var(--blue); }
.empty-state p { color: #4e6960; }
.image-card { background: #ffffff; box-shadow: 0 12px 28px rgba(15, 27, 24, 0.1); }

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

@media (max-width: 640px) {
  .app-bar { min-height: 72px; }
  .app-bar > div:first-child { padding-left: 54px; }
  .app-bar > div:first-child::before { width: 40px; height: 40px; font-size: 20px; }
  .workspace--editor { gap: 12px; padding-top: 12px; }
  .form-stack, .result-panel--output { padding: 14px; }
  .empty-state { min-height: 360px; }
}
