@font-face {
  font-family: "FZVariable-LanTingHeiK";
  src: url("./assets/fz-variable-lantinghei-gbk.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Alimama FangYuanTi VF";
  src: url("./assets/fonts/AlimamaFangYuanTiVF-Thin-2.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue: #12c4ff;
  --ink: #191919;
  --muted: #8b8b8b;
  --line: rgba(25, 25, 25, 0.08);
  --paper: #fffdf8;
  --surface: #ffffff;
  --soft-blue: #e8f8ff;
  --soft-yellow: #fff4cf;
  --soft-coral: #ffe5df;
  --shadow: 0 22px 70px rgba(27, 49, 66, 0.1);
  --tight-shadow: 0 10px 28px rgba(27, 49, 66, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(232, 248, 255, 0.92) 0%, rgba(255, 253, 248, 1) 48%, #f7f8f4 100%);
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  -webkit-user-select: none;
  user-select: none;
}

button,
input,
textarea {
  font: inherit;
}

input,
textarea,
select {
  -webkit-user-select: text;
  user-select: text;
}

button {
  color: inherit;
}

img {
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

body.is-preview-open {
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px 24px;
  border-right: 1px solid rgba(25, 25, 25, 0.08);
  background: rgba(255, 253, 248, 0.78);
  backdrop-filter: blur(24px);
}

.brand-lockup {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  min-height: 30px;
}

.brand-mark {
  font-size: 22px;
  font-weight: 850;
  letter-spacing: 0;
}

.brand-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.upload-dropzone {
  position: relative;
  display: flex;
  min-height: 210px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px;
  border: 2px dashed rgba(18, 196, 255, 0.34);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(232, 248, 255, 0.72)),
    var(--surface);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9), var(--tight-shadow);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragover {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: 0 18px 42px rgba(18, 196, 255, 0.16);
}

.upload-dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 21px;
  color: var(--blue);
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(18, 196, 255, 0.16);
}

.upload-icon svg {
  width: 30px;
  height: 30px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-title {
  font-size: 16px;
  font-weight: 800;
}

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

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

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-action,
.secondary-action,
.ghost-action,
.clear-action {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 850;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-action,
.secondary-action {
  min-height: 46px;
  padding: 0 18px;
}

.primary-action {
  color: white;
  background: var(--ink);
  box-shadow: 0 10px 26px rgba(25, 25, 25, 0.16);
}

.secondary-action {
  color: var(--ink);
  background: var(--soft-blue);
  box-shadow: inset 0 0 0 1px rgba(18, 196, 255, 0.26);
}

.ghost-action,
.clear-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0 0 1px var(--line);
}

.ghost-action svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.36;
  transform: none;
  box-shadow: none;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
}

.brief-panel,
.status-panel {
  padding: 20px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0 0 1px rgba(25, 25, 25, 0.06);
}

.brief-panel {
  margin-top: auto;
}

.panel-kicker,
.meta-line {
  margin: 0 0 8px;
  color: rgba(25, 25, 25, 0.42);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brief-panel h1 {
  margin: 0 0 10px;
  font-family: "FZVariable-LanTingHeiK", "PingFang SC", sans-serif;
  font-size: 27px;
  line-height: 1.05;
  font-weight: 850;
}

.brief-panel p {
  margin: 0;
  color: #5d6366;
  font-size: 13px;
  line-height: 1.58;
}

.rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.rule-chips span {
  padding: 7px 10px;
  border-radius: 999px;
  color: #116881;
  background: var(--soft-blue);
  font-size: 11px;
  font-weight: 850;
}

.status-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.status-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-row strong {
  font-size: 26px;
  line-height: 1;
}

.workspace {
  min-width: 0;
  padding: 28px 34px 42px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.top-bar h2,
.gallery-header h3,
.hero-copy h3,
.empty-state h3,
.admin-card h2 {
  margin: 0;
  font-family: "FZVariable-LanTingHeiK", "PingFang SC", sans-serif;
  font-weight: 850;
  letter-spacing: 0;
}

.top-bar h2 {
  font-size: 24px;
}

.task-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  min-width: 150px;
  justify-content: center;
  padding: 0 16px;
  color: white;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 12px 32px rgba(25, 25, 25, 0.16);
}

.task-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--blue);
}

.task-pill.is-working .task-dot {
  animation: pulse 1.1s ease-in-out infinite;
}

.task-pill span,
.task-pill strong {
  font-size: 12px;
}

.hero-preview {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 286px;
  align-items: center;
  gap: 36px;
  min-height: 260px;
  padding: 34px;
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.94) 0%, rgba(232, 248, 255, 0.95) 100%),
    var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-preview::before {
  content: "";
  position: absolute;
  right: 250px;
  top: 40px;
  width: 100px;
  height: 100px;
  border-radius: 30px;
  background: var(--soft-yellow);
  transform: rotate(-8deg);
}

.hero-copy {
  position: relative;
  max-width: 720px;
}

.blue-label {
  display: inline-flex;
  margin-bottom: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #087ea0;
  background: var(--soft-blue);
  font-size: 12px;
  font-weight: 900;
}

.hero-copy h3 {
  max-width: 680px;
  font-size: 48px;
  line-height: 1.02;
}

.mini-cover {
  position: relative;
  width: 236px;
  height: 315px;
  padding: 20px 18px 16px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(18, 90, 125, 0.16);
  transform: rotate(2.5deg);
}

.mini-meta,
.mini-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(25, 25, 25, 0.38);
  font-size: 6px;
  font-weight: 900;
}

.mini-title {
  margin-top: 18px;
  font-family: "FZVariable-LanTingHeiK", "PingFang SC", sans-serif;
  font-size: 42px;
  line-height: 0.96;
  font-weight: 900;
}

.mini-title span {
  color: var(--blue);
}

.mini-map {
  position: relative;
  height: 152px;
  margin-top: 15px;
  border: 5px solid #fbfafa;
  border-radius: 22px;
  background:
    radial-gradient(circle at 32% 28%, rgba(18, 196, 255, 0.34) 0 5px, transparent 6px),
    linear-gradient(135deg, #eef8ef, #e9f7ff 48%, #fff4cf);
  overflow: hidden;
}

.mini-map::before,
.mini-map::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  border: 2px dashed rgba(18, 196, 255, 0.62);
}

.mini-map::before {
  width: 150px;
  height: 70px;
  left: 18px;
  top: 42px;
  transform: rotate(-12deg);
}

.mini-map::after {
  width: 120px;
  height: 48px;
  right: -20px;
  bottom: 18px;
  transform: rotate(14deg);
}

.mini-bubble {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  right: 18px;
  top: 20px;
  border-radius: 18px;
  background: white;
  font-size: 24px;
  box-shadow: 0 12px 24px rgba(25, 25, 25, 0.12);
}

.mini-caption {
  position: absolute;
  right: 0;
  bottom: 18px;
  padding: 9px 11px;
  border-radius: 14px 0 0 14px;
  background: white;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.25;
}

.mini-footer {
  margin-top: 12px;
}

.mini-footer span {
  width: 54px;
  height: 12px;
  border-radius: 999px;
  background: url("./assets/pi-travel-logo-with-type-sips.png") center / contain no-repeat;
}

.mini-footer em {
  font-style: normal;
}

.gallery-shell {
  margin-top: 26px;
  padding: 26px;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px rgba(25, 25, 25, 0.06);
}

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

.gallery-header h3 {
  font-size: 28px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 300px;
  text-align: center;
  color: var(--muted);
}

.empty-state[hidden] {
  display: none;
}

.empty-orbit {
  position: relative;
  width: 112px;
  height: 92px;
  margin-bottom: 18px;
}

.empty-orbit span {
  position: absolute;
  border-radius: 26px;
  background: white;
  box-shadow: 0 16px 36px rgba(27, 49, 66, 0.12);
}

.empty-orbit span:first-child {
  width: 76px;
  height: 76px;
  left: 0;
  top: 8px;
  border: 10px solid var(--soft-blue);
}

.empty-orbit span:last-child {
  width: 62px;
  height: 62px;
  right: 0;
  top: 0;
  border: 10px solid var(--soft-coral);
}

.empty-state h3 {
  color: var(--ink);
  font-size: 30px;
}

.empty-state p {
  margin: 8px 0 0;
  font-size: 14px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.result-card {
  position: relative;
  min-width: 0;
  border-radius: 24px;
  background: white;
  box-shadow: var(--tight-shadow);
  overflow: hidden;
}

.result-preview {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #f1f5f6;
  overflow: hidden;
}

.result-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-preview.is-original img {
  object-fit: contain;
  padding: 16px;
}

.result-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  color: white;
  background: rgba(25, 25, 25, 0.84);
  font-size: 11px;
  font-weight: 900;
}

.result-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--blue);
}

.result-body {
  padding: 15px;
}

.result-name {
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 900;
}

.result-meta {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-actions button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
  background: var(--soft-blue);
  font-size: 12px;
  font-weight: 900;
}

.card-actions button:nth-child(2) {
  background: var(--soft-yellow);
}

.variant-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 15px 15px;
}

.variant-strip img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  background: #f1f5f6;
}

.processing-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.84);
  backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 900;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 4px solid rgba(18, 196, 255, 0.22);
  border-top-color: var(--blue);
  animation: spin 0.85s linear infinite;
}

.admin-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(25, 25, 25, 0.34);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.admin-overlay.is-open {
  display: flex;
}

.admin-card {
  position: relative;
  width: min(720px, 96vw);
  max-height: 88vh;
  overflow: auto;
  padding: 30px;
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.22);
}

.admin-card h2 {
  margin-bottom: 20px;
  font-size: 32px;
}

.admin-close {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(25, 25, 25, 0.08);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.admin-input,
.admin-textarea {
  width: 100%;
  border: 1px solid rgba(25, 25, 25, 0.12);
  border-radius: 16px;
  outline: none;
  background: white;
  color: var(--ink);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

.admin-input {
  min-height: 46px;
  padding: 0 15px;
}

.admin-textarea {
  min-height: 120px;
  padding: 13px 15px;
  resize: vertical;
  line-height: 1.5;
}

.admin-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #555;
  font-size: 12px;
  font-weight: 900;
}

.admin-error {
  display: none;
  color: #d32626;
  font-size: 12px;
  font-weight: 800;
}

.admin-error.is-visible {
  display: block;
}

.wide {
  width: 100%;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.admin-tab {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(25, 25, 25, 0.08);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.admin-tab.active {
  color: white;
  background: var(--ink);
}

.admin-pane {
  display: none;
}

.admin-pane.active {
  display: block;
}

.admin-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.admin-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 20px;
}

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

@keyframes pulse {
  50% {
    opacity: 0.36;
    transform: scale(0.72);
  }
}

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

  .side-rail {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brief-panel {
    margin-top: 0;
  }

  .workspace {
    padding: 22px 18px 34px;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-preview {
    grid-template-columns: 1fr;
  }

  .hero-preview::before {
    right: 28px;
  }

  .hero-copy h3 {
    font-size: 38px;
  }

  .mini-cover {
    justify-self: center;
  }
}

@media (max-width: 560px) {
  .side-rail {
    padding: 22px 16px;
  }

  .workspace {
    padding: 18px 12px 26px;
  }

  .hero-preview,
  .gallery-shell {
    border-radius: 24px;
    padding: 20px;
  }

  .hero-copy h3 {
    font-size: 30px;
  }

  .status-panel,
  .button-row,
  .admin-actions {
    grid-template-columns: 1fr;
  }
}

/* Scene Lab distilled shell */
body {
  height: 100vh;
  overflow: hidden;
  background: var(--sky-1);
}

.app-shell {
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
}

.side-rail {
  gap: 20px;
  padding: 32px 24px;
  background: rgba(250, 250, 252, 0.75);
  border-right: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(20px) saturate(150%);
}

.brand-lockup {
  margin-bottom: 0;
}

.brand-mark {
  font-size: 20px;
  font-weight: 700;
}

.brand-note {
  font-size: 11px;
  font-weight: 500;
  color: #999;
}

.upload-dropzone {
  min-height: auto;
  padding: 48px 24px;
  gap: 8px;
  border: 1.5px dashed rgba(18, 196, 255, 0.38);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.upload-dropzone:hover,
.upload-dropzone.is-dragover {
  transform: none;
  border-color: rgba(18, 196, 255, 0.72);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 2px 10px rgba(18, 196, 255, 0.08);
}

.upload-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0.72;
}

.upload-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.upload-title {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.upload-meta {
  font-size: 12px;
  font-weight: 400;
  color: #999;
}

.control-stack {
  gap: 12px;
}

.button-row {
  gap: 12px;
}

.primary-action,
.secondary-action,
.ghost-action,
.clear-action {
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
}

.primary-action,
.secondary-action {
  min-height: 42px;
  padding: 12px 16px;
}

.primary-action {
  background: rgba(0, 0, 0, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 8px rgba(0, 0, 0, 0.18);
}

.secondary-action,
.ghost-action,
.clear-action {
  color: #555;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 2px 6px rgba(0, 0, 0, 0.06);
}

.ghost-action {
  min-height: 42px;
}

.ghost-action svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

button:not(:disabled):hover {
  transform: none;
}

.brief-panel,
.status-panel[hidden] {
  display: none !important;
}

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

.top-bar {
  position: relative;
  z-index: 2;
  min-height: 73px;
  margin: 0;
  padding: 24px 40px;
  background: rgba(250, 250, 252, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(20px) saturate(150%);
}

.top-bar h2 {
  margin: 0;
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-weight: 600;
}

.task-pill {
  min-width: 0;
  min-height: 0;
  max-width: 0;
  padding: 4px 0;
  gap: 6px;
  opacity: 0;
  overflow: hidden;
  transform: scale(0.82);
  transform-origin: right center;
  transition: max-width 0.5s cubic-bezier(0.22, 1, 0.36, 1), padding 0.4s ease, opacity 0.2s ease, transform 0.45s ease;
}

.task-pill.is-working {
  max-width: 180px;
  padding: 6px 12px;
  opacity: 1;
  transform: scale(1);
}

.task-pill span,
.task-pill strong {
  font-size: 11px;
  font-weight: 500;
}

.task-dot {
  width: 6px;
  height: 6px;
}

.gallery-shell {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 40px;
  overflow-y: auto;
  border-radius: 0;
  background: rgba(238, 240, 242, 0.5);
  box-shadow: none;
}

.gallery-header {
  min-height: 30px;
  margin: 0 0 18px;
}

.gallery-header h3 {
  display: none;
}

.clear-action {
  min-height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.clear-action:disabled {
  opacity: 0;
}

.empty-state {
  display: flex;
  min-height: calc(100vh - 210px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 80px 20px;
}

.empty-emoji {
  color: rgba(18, 196, 255, 0.45);
  font-size: 64px;
  line-height: 1;
}

.empty-text {
  color: #999;
  font-size: 15px;
  font-weight: 500;
}

.empty-state h3,
.empty-state p,
.empty-orbit {
  display: none;
}

.image-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 48px 60px;
}

.result-card {
  position: relative;
  overflow: visible;
  border-radius: 32px;
  background: transparent;
  box-shadow: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.26, 0.54, 1);
}

.result-card:hover {
  transform: translateY(-4px);
}

.result-card:hover .card-actions {
  opacity: 1;
  pointer-events: auto;
}

.result-preview {
  border: 1px solid #e8e8e8;
  border-radius: 28px;
  background: white;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.04);
}

.result-preview img {
  border-radius: 28px;
}

.result-preview.is-original img {
  padding: 0;
  object-fit: cover;
}

.result-badge {
  top: 10px;
  left: 10px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.74);
}

.result-badge::before {
  width: 5px;
  height: 5px;
}

.result-body {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  padding: 0;
  pointer-events: none;
}

.result-name {
  display: none;
}

.result-meta {
  display: none;
}

.card-actions {
  display: flex;
  grid-template-columns: none;
  justify-content: center;
  gap: 6px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.card-actions button {
  min-width: 54px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: #555;
  font-size: 12px;
  font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 2px 6px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(14px) saturate(150%);
}

.card-actions button:nth-child(2) {
  color: #087ea0;
  background: rgba(232, 248, 255, 0.82);
}

.variant-strip {
  gap: 8px;
  padding: 10px 2px 0;
}

.variant-strip img {
  border-radius: 12px;
  border: 1px solid #e8e8e8;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
  }

  .side-rail {
    position: relative;
    height: auto;
  }

  .gallery-shell {
    min-height: 60vh;
  }
}

/* Product tool light-blue system */
:root {
  --blue: #12c4ff;
  --blue-ink: #087ea0;
  --sky-0: #f7fdff;
  --sky-1: #e8f8ff;
  --sky-2: #d7f3ff;
  --sky-3: #b9ecff;
  --paper: #f7fdff;
}

body {
  background: var(--sky-1);
}

.side-rail {
  background: rgba(232, 248, 255, 0.82);
  border-right-color: rgba(255, 255, 255, 0.78);
}

.top-bar {
  background: rgba(247, 253, 255, 0.82);
  border-bottom-color: rgba(255, 255, 255, 0.8);
}

.gallery-shell {
  background: rgba(215, 243, 255, 0.58);
}

.upload-dropzone,
.reference-dropzone,
.reference-preview {
  background: rgba(247, 253, 255, 0.74);
  border-color: rgba(18, 196, 255, 0.34);
}

.primary-action {
  color: #073445;
  background: rgba(18, 196, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 8px rgba(18, 196, 255, 0.16);
}

.secondary-action,
.ghost-action,
.clear-action {
  background: rgba(247, 253, 255, 0.68);
  color: #3d6974;
}

.task-pill {
  color: #073445;
  background: rgba(18, 196, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.48);
}

.task-dot {
  background: white;
}

.empty-emoji {
  color: rgba(8, 126, 160, 0.42);
}

.result-preview {
  border-color: rgba(18, 196, 255, 0.22);
  background: var(--sky-0);
}

.result-badge {
  background: rgba(8, 126, 160, 0.78);
}

.card-actions button:nth-child(2) {
  color: #066f8f;
  background: rgba(232, 248, 255, 0.9);
}

.reference-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reference-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: #7b9aa3;
  font-size: 11px;
  font-weight: 500;
}

.reference-panel:not(.has-reference) .reference-head {
  display: none;
}

.reference-clear {
  border: 0;
  padding: 0;
  color: #6a9cab;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.reference-dropzone {
  position: relative;
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed rgba(18, 196, 255, 0.34);
  border-radius: 18px;
  color: #4e7d8a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 2px 8px rgba(18, 196, 255, 0.06);
}

.reference-dropzone:hover,
.reference-dropzone.is-dragover {
  border-color: rgba(18, 196, 255, 0.72);
  background: rgba(247, 253, 255, 0.88);
}

.reference-dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.reference-plus {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: #087ea0;
  background: rgba(18, 196, 255, 0.14);
  font-size: 18px;
  line-height: 1;
}

.reference-preview {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 6px;
  border: 1px solid rgba(18, 196, 255, 0.2);
  border-radius: 16px;
}

.reference-preview[hidden] {
  display: none;
}

.reference-preview img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 12px;
}

.reference-preview span {
  overflow: hidden;
  color: #4e7d8a;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.admin-overlay {
  background: rgba(8, 126, 160, 0.18);
  backdrop-filter: blur(18px) saturate(150%);
}

.admin-card {
  width: min(760px, 94vw);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 22px;
  background: rgba(232, 248, 255, 0.9);
  box-shadow: 0 18px 50px rgba(8, 126, 160, 0.16);
}

.admin-card h2 {
  margin: 0 0 16px;
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-weight: 600;
}

.admin-close {
  top: 18px;
  right: 18px;
  width: 28px;
  height: 28px;
  color: #6b8b94;
  background: rgba(255, 255, 255, 0.56);
  font-size: 18px;
}

.meta-line {
  margin-bottom: 8px;
  color: rgba(8, 126, 160, 0.52);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.admin-tabs {
  gap: 8px;
  margin-bottom: 16px;
}

.admin-tab {
  min-height: 30px;
  padding: 0 12px;
  color: #5d858f;
  background: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 500;
}

.admin-tab.active {
  color: #073445;
  background: rgba(18, 196, 255, 0.74);
}

.admin-card label {
  gap: 6px;
  margin-bottom: 12px;
  color: #5d858f;
  font-size: 11px;
  font-weight: 600;
}

.admin-input,
.admin-textarea {
  border-color: rgba(18, 196, 255, 0.24);
  border-radius: 14px;
  background: rgba(247, 253, 255, 0.82);
  color: #18353c;
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.admin-input {
  min-height: 38px;
  padding: 0 12px;
}

.admin-textarea {
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.45;
}

.admin-help {
  color: #72949d;
  font-size: 11px;
  line-height: 1.55;
}

.admin-ref-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.admin-ref-head strong {
  display: grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  color: #073445;
  background: rgba(18, 196, 255, 0.32);
  font-size: 12px;
  font-weight: 600;
}

.admin-small-label {
  color: #24444c;
  font-size: 13px;
  font-weight: 600;
}

.admin-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-url-row .secondary-action {
  min-height: 38px;
  padding: 0 12px;
  font-size: 12px;
}

.admin-ref-list {
  display: grid;
  max-height: 340px;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.admin-ref-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 6px;
  border: 1px solid rgba(18, 196, 255, 0.2);
  border-radius: 16px;
  background: rgba(247, 253, 255, 0.66);
}

.admin-ref-item img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
}

.admin-ref-item div {
  overflow: hidden;
  color: #5d858f;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.admin-ref-item button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  color: #6b8b94;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.admin-actions {
  gap: 10px;
  margin-top: 16px;
}

.admin-actions .primary-action,
.admin-actions .ghost-action {
  min-height: 38px;
  font-size: 12px;
}

/* Diff-note polish: saturated shell with warm canvas */
:root {
  --lab-blue: #3fb2ff;
  --lab-blue-deep: #08618d;
  --lab-brown: #704c1e;
  --lab-top: #745937;
  --lab-cream: #fff0d2;
  --lab-milk: #fff8ea;
  --lab-line: rgba(255, 240, 210, 0.28);
  --lab-shadow: rgba(44, 24, 5, 0.26);
}

body {
  background: var(--lab-brown);
}

.side-rail {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(6, 97, 141, 0.08)),
    var(--lab-blue);
  border-right: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow: inset -1px 0 0 rgba(4, 62, 96, 0.18), 10px 0 38px rgba(54, 125, 165, 0.16);
}

.brand-lockup {
  min-height: 26px;
}

.brand-mark {
  color: #06293b;
  font-size: 21px;
  font-weight: 760;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.24);
}

.brand-note {
  display: none;
}

.upload-dropzone,
.reference-dropzone,
.reference-preview {
  border-color: rgba(255, 240, 210, 0.38);
  background: rgba(240, 250, 255, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    inset 0 -18px 42px rgba(255, 255, 255, 0.12),
    0 10px 28px rgba(4, 71, 108, 0.12);
}

.upload-dropzone:hover,
.upload-dropzone.is-dragover,
.reference-dropzone:hover,
.reference-dropzone.is-dragover {
  border-color: rgba(255, 240, 210, 0.76);
  background: rgba(250, 255, 255, 0.46);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 14px 34px rgba(4, 71, 108, 0.18);
}

.upload-icon,
.reference-plus {
  color: #065f8a;
}

.upload-title,
.reference-dropzone,
.reference-preview span {
  color: #06293b;
}

.upload-meta,
.reference-head {
  color: rgba(6, 41, 59, 0.62);
}

.primary-action {
  color: #073047;
  background: linear-gradient(180deg, rgba(255, 240, 210, 0.82), rgba(178, 228, 255, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.64),
    0 8px 20px rgba(4, 75, 113, 0.16);
}

.secondary-action,
.ghost-action {
  color: #173d4a;
  background: rgba(255, 248, 234, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    0 7px 18px rgba(4, 75, 113, 0.1);
}

.top-bar {
  min-height: 72px;
  background:
    linear-gradient(180deg, rgba(255, 240, 210, 0.1), rgba(53, 29, 8, 0.08)),
    var(--lab-top);
  border-bottom: 1px solid rgba(255, 240, 210, 0.16);
  box-shadow: 0 8px 34px rgba(53, 29, 8, 0.18);
}

.top-bar h2 {
  color: var(--lab-cream);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar .clear-action {
  min-height: 34px;
  padding: 0 14px;
  color: #fff0d2;
  background: rgba(255, 240, 210, 0.13);
  border: 1px solid rgba(255, 240, 210, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 5px 16px rgba(40, 20, 5, 0.16);
}

.top-bar .clear-action:disabled {
  opacity: 0;
  pointer-events: none;
}

.task-pill {
  width: auto;
  min-width: 92px;
  max-width: none;
  min-height: 34px;
  padding: 6px 12px;
  opacity: 1;
  flex-shrink: 0;
  white-space: nowrap;
  color: #fff4dd;
  background: rgba(255, 240, 210, 0.15);
  border: 1px solid rgba(255, 240, 210, 0.24);
  transform: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 5px 16px rgba(40, 20, 5, 0.16);
}

.task-pill.is-working {
  max-width: none;
  padding: 6px 12px;
}

.task-dot {
  background: var(--lab-blue);
  box-shadow: 0 0 0 3px rgba(63, 178, 255, 0.18);
}

.gallery-shell {
  padding-top: 42px;
  background:
    radial-gradient(circle at 20% 8%, rgba(255, 240, 210, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 240, 210, 0.05), rgba(45, 23, 5, 0.1)),
    var(--lab-brown);
}

.gallery-header {
  display: none;
}

.empty-state {
  color: rgba(255, 240, 210, 0.72);
}

.empty-emoji {
  color: rgba(255, 240, 210, 0.42);
}

.empty-text {
  color: rgba(255, 240, 210, 0.7);
}

.result-card {
  filter: drop-shadow(0 18px 28px rgba(35, 17, 3, 0.2));
}

.result-preview {
  cursor: zoom-in;
  border: 1px solid rgba(255, 240, 210, 0.24);
  background: #5d3b17;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 14px 34px var(--lab-shadow);
}

.result-preview:focus-visible {
  outline: 2px solid var(--lab-blue);
  outline-offset: 4px;
}

.result-badge {
  color: #052d42;
  background: rgba(63, 178, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 6px 18px rgba(30, 13, 2, 0.2);
}

.result-badge::before {
  background: var(--lab-cream);
}

.card-actions button {
  color: #3c260e;
  background: rgba(255, 240, 210, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 8px 20px rgba(30, 13, 2, 0.18);
}

.card-actions button:nth-child(2) {
  color: #073047;
  background: rgba(63, 178, 255, 0.62);
}

.variant-strip img {
  cursor: zoom-in;
  border-color: rgba(255, 240, 210, 0.2);
  box-shadow: 0 8px 18px rgba(30, 13, 2, 0.18);
}

.preview-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 54px;
  background: rgba(24, 12, 2, 0.86);
  z-index: 30;
}

.preview-overlay.is-open {
  display: flex;
}

.preview-overlay img {
  max-width: min(78vw, 760px);
  max-height: 86vh;
  object-fit: contain;
  border-radius: 28px;
  box-shadow:
    0 0 0 1px rgba(255, 240, 210, 0.18),
    0 34px 90px rgba(0, 0, 0, 0.38);
}

.preview-close {
  position: fixed;
  top: 26px;
  right: 28px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 240, 210, 0.24);
  border-radius: 999px;
  color: var(--lab-cream);
  background: rgba(255, 240, 210, 0.12);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

@media (max-width: 980px) {
  .top-bar {
    flex-direction: row;
    align-items: center;
  }
}

/* Latest review pass: flat color surfaces, no decorative gradients or shadows. */
.side-rail {
  background: #3fb2ff;
  box-shadow: none;
  backdrop-filter: none;
}

.brand-mark {
  text-shadow: none;
}

.top-bar {
  background: #745937;
  box-shadow: none;
}

.gallery-shell {
  background: #704c1e;
  box-shadow: none;
}

.upload-dropzone,
.reference-dropzone,
.reference-preview {
  background: rgba(236, 249, 255, 0.34);
  border-color: rgba(237, 250, 255, 0.58);
  box-shadow: none;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragover,
.reference-dropzone:hover,
.reference-dropzone.is-dragover {
  background: rgba(236, 249, 255, 0.44);
  border-color: rgba(237, 250, 255, 0.82);
  box-shadow: none;
}

.primary-action {
  background: rgba(191, 238, 255, 0.72);
  border-color: rgba(237, 250, 255, 0.42);
  box-shadow: none;
}

.secondary-action,
.ghost-action {
  background: rgba(236, 249, 255, 0.5);
  border-color: rgba(237, 250, 255, 0.42);
  box-shadow: none;
}

.top-bar .clear-action,
.task-pill {
  background: rgba(255, 240, 210, 0.16);
  box-shadow: none;
}

.task-dot {
  box-shadow: none;
}

.empty-state {
  gap: 0;
}

.empty-emoji,
.upload-icon,
.reference-plus {
  display: none;
}

.result-card {
  filter: none;
}

.result-preview,
.result-badge,
.card-actions button,
.variant-strip img,
.preview-overlay img,
.preview-close {
  box-shadow: none;
}

.result-preview {
  background: #5f3c18;
}

.card-actions button {
  background: rgba(255, 240, 210, 0.58);
}

.card-actions button:nth-child(2) {
  background: rgba(63, 178, 255, 0.62);
}

.preview-overlay {
  backdrop-filter: none;
}

.admin-overlay {
  backdrop-filter: none;
}

.admin-card,
.admin-close,
.admin-tab,
.admin-input,
.admin-textarea,
.admin-ref-item {
  box-shadow: none;
}

.side-rail {
  color: #05293b;
}

.brand-mark,
.upload-title,
.reference-dropzone,
.reference-preview span,
.primary-action,
.secondary-action,
.ghost-action {
  color: #05293b;
}

.upload-meta,
.reference-head {
  color: rgba(5, 41, 59, 0.78);
}

.reference-clear {
  color: rgba(5, 41, 59, 0.72);
  font-weight: 650;
}

.side-rail button:disabled {
  color: rgba(5, 41, 59, 0.68);
  opacity: 0.58;
}

.upload-dropzone,
.reference-dropzone,
.reference-preview {
  background: rgba(236, 249, 255, 0.48);
}

.reference-preview {
  grid-template-columns: 42px minmax(0, 1fr);
  border-color: rgba(232, 243, 250, 0.58);
}

.reference-preview span {
  min-width: 0;
}

.reference-preview.is-selected {
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(238, 246, 252, 0.88);
  box-shadow: inset 0 0 0 1px rgba(63, 178, 255, 0.5);
}

.reference-select {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(5, 41, 59, 0.22);
  border-radius: 999px;
  color: #05293b;
  background: rgba(236, 249, 255, 0.62);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.reference-preview.is-selected .reference-select {
  color: #05293b;
  background: rgba(255, 240, 210, 0.72);
  border-color: rgba(5, 41, 59, 0.48);
}

.result-card {
  border-radius: 20px;
}

.result-preview,
.result-preview img {
  border-radius: 18px;
}

.ratio-picker {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 4px;
  border-radius: 18px;
  border: 1px solid rgba(232, 243, 250, 0.58);
  background: rgba(166, 207, 235, 0.72);
}

.ratio-option {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 58px;
  gap: 5px;
  border: 0;
  border-radius: 15px;
  color: rgba(5, 41, 59, 0.9);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
}

.ratio-option > * {
  pointer-events: none;
}

.ratio-option.is-active {
  color: #05293b;
  background: transparent;
}

.ratio-option:focus,
.engine-option:focus {
  outline: none;
}

.ratio-icon {
  display: block;
  border: 2px solid currentColor;
  border-radius: 3px;
}

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

.ratio-icon-4-3 {
  width: 19px;
  height: 15px;
}

.ratio-icon-1-1 {
  width: 17px;
  height: 17px;
}

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

.ratio-icon-9-16 {
  width: 11px;
  height: 22px;
}

.result-preview.ratio-16-9 {
  aspect-ratio: 16 / 9;
}

.result-preview.ratio-4-3 {
  aspect-ratio: 4 / 3;
}

.result-preview.ratio-1-1 {
  aspect-ratio: 1 / 1;
}

.result-preview.ratio-3-4 {
  aspect-ratio: 3 / 4;
}

.result-preview.ratio-9-16 {
  aspect-ratio: 9 / 16;
}

.click-spark-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 80;
}

.side-rail {
  gap: 14px;
  padding-top: 34px;
}

.brand-lockup {
  width: 100%;
  min-height: 34px;
  align-items: center;
  margin-bottom: 4px;
  transform: translateY(-10px);
}

.side-rail > .upload-dropzone,
.side-rail > .reference-panel,
.side-rail > .control-stack {
  transform: translateY(-2px);
}

.reference-panel {
  gap: clamp(8px, 1.2vh, 12px);
}

.control-stack {
  gap: 10px;
  margin-top: -2px;
}

.engine-picker {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid rgba(232, 243, 250, 0.58);
  border-radius: 17px;
  background: rgba(166, 207, 235, 0.72);
  isolation: isolate;
  overflow: visible;
}

.engine-option {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 100%;
  padding: 0 10px;
  border: 0;
  border-radius: 13px;
  color: rgba(5, 41, 59, 0.76);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  transition: color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.engine-option.is-active {
  color: #05293b;
  background: transparent;
  box-shadow: none;
}

.engine-gooey-filter {
  border-radius: 13px;
}

.ratio-picker {
  padding: 4px;
  border: 1px solid rgba(232, 243, 250, 0.58);
  background: rgba(166, 207, 235, 0.72);
  isolation: isolate;
  overflow: visible;
}

.ratio-option {
  min-height: 54px;
  color: rgba(5, 41, 59, 0.9);
  z-index: 2;
  text-shadow: none;
  transition: color 260ms ease, text-shadow 260ms ease;
}

.ratio-option.is-active {
  color: #05293b;
  background: transparent;
  text-shadow: none;
}

.ratio-gooey-effect {
  position: absolute;
  pointer-events: none;
  border-radius: 15px;
  opacity: 0;
  transform: translate3d(0, 0, 0.01px);
  transition:
    left 560ms cubic-bezier(0.16, 1, 0.3, 1),
    top 560ms cubic-bezier(0.16, 1, 0.3, 1),
    width 560ms cubic-bezier(0.16, 1, 0.3, 1),
    height 560ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 160ms ease;
}

.ratio-gooey-effect.is-visible {
  opacity: 1;
}

.ratio-gooey-filter {
  z-index: 1;
  filter: none;
}

.ratio-gooey-filter::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  border: 1px solid rgba(244, 249, 252, 0.72);
  background: rgba(238, 246, 252, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  opacity: 1;
  transform: scale(1);
}

.ratio-gooey-filter.is-active::after {
  animation: ratioGooeyPill 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes ratioGooeyPill {
  0% {
    opacity: 0.45;
    transform: scale(0.74);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.upload-dropzone input,
.reference-dropzone input {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
}

.upload-title,
.upload-meta,
#referenceLabel {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.native-file-input {
  position: fixed;
  left: -1000px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.reference-preview {
  grid-template-columns: 42px minmax(0, 1fr);
  cursor: pointer;
  position: relative;
}

.reference-preview.is-selected::after {
  content: none;
}

.reference-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  color: rgba(5, 41, 59, 0.82);
  background: rgba(236, 249, 255, 0.72);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
}

.reference-preview:hover .reference-remove,
.reference-preview:focus-within .reference-remove {
  opacity: 1;
  pointer-events: auto;
}

.reference-preview:focus-visible {
  outline: 2px solid rgba(5, 41, 59, 0.72);
  outline-offset: 2px;
}

.reference-select {
  display: none;
}

.reference-list {
  display: flex;
  max-height: 168px;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(5, 41, 59, 0.2) transparent;
}

.reference-list[hidden] {
  display: none;
}

.reference-item {
  position: relative;
  display: grid;
  min-height: 54px;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 1px solid rgba(232, 243, 250, 0.58);
  border-radius: 16px;
  background: rgba(236, 249, 255, 0.48);
  cursor: pointer;
}

.reference-item img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 12px;
}

.reference-item span {
  min-width: 0;
  overflow: hidden;
  color: #05293b;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 560;
}

.reference-item.is-selected {
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(238, 246, 252, 0.9);
  box-shadow: inset 0 0 0 1px rgba(63, 178, 255, 0.48);
}

.reference-item:focus-visible {
  outline: 2px solid rgba(236, 249, 255, 0.86);
  outline-offset: 2px;
}

.reference-item .reference-remove {
  top: 5px;
  right: 5px;
}

.reference-item:hover .reference-remove,
.reference-item:focus-within .reference-remove {
  opacity: 1;
  pointer-events: auto;
}

.ratio-picker {
  margin: 6px 0;
}

.image-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 28px 34px;
  contain: layout style;
}

.result-card {
  width: fit-content;
  contain: layout style;
}

.result-preview {
  --preview-height: 286px;
  width: calc(var(--preview-height) * 3 / 4);
  height: var(--preview-height);
  aspect-ratio: auto;
}

.result-preview.ratio-natural {
  width: var(--preview-width, calc(var(--preview-height) * 3 / 4));
  aspect-ratio: auto;
}

.result-preview.ratio-16-9 {
  width: calc(var(--preview-height) * 16 / 9);
  aspect-ratio: auto;
}

.result-preview.ratio-4-3 {
  width: calc(var(--preview-height) * 4 / 3);
  aspect-ratio: auto;
}

.result-preview.ratio-1-1 {
  width: var(--preview-height);
  aspect-ratio: auto;
}

.result-preview.ratio-3-4 {
  width: calc(var(--preview-height) * 3 / 4);
  aspect-ratio: auto;
}

.result-preview.ratio-9-16 {
  width: calc(var(--preview-height) * 9 / 16);
  aspect-ratio: auto;
}

.result-preview img {
  object-fit: cover;
}

.result-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  color: rgba(5, 41, 59, 0.82);
  background: rgba(236, 249, 255, 0.72);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
}

.result-preview:hover .result-remove,
.result-preview:focus-within .result-remove {
  opacity: 1;
  pointer-events: auto;
}

/* Series stack: keep the generated set attached to one target card. */
.result-card {
  --preview-height: 286px;
  overflow: visible;
}

.result-stack {
  position: relative;
  width: var(--preview-width, calc(var(--preview-height) * 3 / 4));
  height: var(--preview-height);
}

.result-stack .result-preview,
.result-stack .variant-stack-layer {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  contain: layout paint;
}

.result-card.has-variants {
  padding-right: 9px;
  padding-bottom: 7px;
}

.result-card.has-variants .result-preview {
  position: relative;
  z-index: 3;
}

.variant-stack-layer {
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid rgba(255, 240, 210, 0.18);
  border-radius: 18px;
  background: #5f3c18;
  box-shadow: none;
  overflow: hidden;
  pointer-events: none;
  transform-origin: bottom center;
  transition: transform 280ms ease, opacity 220ms ease;
  z-index: 1;
}

.variant-stack-layer img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.variant-stack-layer.stack-left {
  opacity: 0.38;
  transform: translate(-7px, 5px) rotate(-4deg) scale(0.972);
}

.variant-stack-layer.stack-right {
  opacity: 0.32;
  transform: translate(8px, 6px) rotate(4deg) scale(0.972);
}

.result-card.has-variants:hover .variant-stack-layer.stack-left {
  opacity: 0.52;
  transform: translate(-11px, 7px) rotate(-7deg) scale(0.968);
}

.result-card.has-variants:hover .variant-stack-layer.stack-right {
  opacity: 0.46;
  transform: translate(13px, 8px) rotate(7deg) scale(0.968);
}

.variant-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  min-width: 30px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 240, 210, 0.26);
  border-radius: 999px;
  color: var(--lab-cream);
  background: rgba(34, 17, 3, 0.48);
  font-size: 11px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  pointer-events: none;
}

.preview-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  max-width: 94vw;
  max-height: 92vh;
  -webkit-user-select: none;
  user-select: none;
  contain: layout paint;
}

.preview-image-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.preview-overlay .preview-main-image {
  max-width: min(78vw, 760px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 28px;
  display: block;
  contain: paint;
}

.preview-overlay .preview-main-image.is-loading {
  opacity: 0;
}

.preview-regenerate {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  min-width: 74px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 240, 210, 0.3);
  border-radius: 999px;
  color: #073047;
  background: rgba(63, 178, 255, 0.82);
  box-shadow: 0 10px 24px rgba(30, 13, 2, 0.22);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(14px) saturate(150%);
}

.preview-regenerate:hover {
  background: rgba(119, 207, 255, 0.9);
}

.preview-regenerate:disabled {
  cursor: wait;
  opacity: 0.58;
}

.preview-regenerate[hidden] {
  display: none;
}

.preview-nav {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 240, 210, 0.28);
  border-radius: 999px;
  color: var(--lab-cream);
  background: rgba(255, 240, 210, 0.14);
  cursor: pointer;
  font-size: 34px;
  line-height: 1;
}

.preview-nav:disabled {
  opacity: 0.24;
  cursor: default;
}

.preview-strip {
  position: absolute;
  left: 50%;
  top: calc(100% + 24px);
  display: flex;
  gap: 10px;
  transform: translateX(-50%);
}

.preview-thumb {
  display: grid;
  gap: 5px;
  width: 58px;
  border: 0;
  color: rgba(255, 240, 210, 0.68);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}

.preview-thumb img {
  width: 58px;
  height: 58px;
  max-width: none;
  max-height: none;
  border: 2px solid transparent;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: none;
}

.preview-thumb.is-active {
  color: var(--lab-cream);
}

.preview-thumb.is-active img {
  border-color: rgba(255, 240, 210, 0.86);
}

/* Unveil-inspired monochrome UI pass. Keep the generation logic intact while
   moving the visible shell toward a quiet canvas + glass control language. */
:root {
  --ui-font: Arial, sans-serif;
  --cn-font: "Alimama FangYuanTi VF", "PingFang SC", sans-serif;
  --paper: #f8f8f8;
  --ink: #111111;
  --line: rgba(0, 0, 0, 0.13);
  --glass-fill: rgba(248, 248, 248, 0.08);
  --glass-fill-soft: rgba(248, 248, 248, 0.05);
  --glass-line: rgba(17, 17, 17, 0.13);
  --glass-line-strong: rgba(17, 17, 17, 0.22);
  --glass-shadow: 0 1px 7px rgba(0, 0, 0, 0.025), inset 0 1px 0 rgba(255, 255, 255, 0.23);
  --workspace-inset: 14px;
}

html,
body {
  background: var(--paper);
}

body {
  color: var(--ink);
  font-family: var(--ui-font);
  letter-spacing: 0.015em;
}

body.is-launch-open {
  overflow: hidden;
}

body[data-language="zh"] {
  font-family: var(--cn-font);
  letter-spacing: 0;
}

.launch-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  opacity: 1;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.launch-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.launch-wall {
  position: absolute;
  inset: -18% -8%;
  z-index: -1;
  overflow: hidden;
  perspective: 1400px;
  pointer-events: none;
  transform: translate3d(calc(var(--launch-mx, 0) * 0.7px), calc(var(--launch-my, 0) * 0.7px), 0);
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.launch-wall::before,
.launch-wall::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.launch-wall::before {
  z-index: 2;
  background:
    radial-gradient(ellipse at center, rgba(250, 250, 250, 0.96) 0%, rgba(250, 250, 250, 0.8) 27%, rgba(250, 250, 250, 0.28) 53%, rgba(250, 250, 250, 0) 76%),
    linear-gradient(180deg, rgba(250, 250, 250, 0.68), rgba(250, 250, 250, 0) 26%, rgba(250, 250, 250, 0) 72%, rgba(250, 250, 250, 0.64));
}

.launch-wall::after {
  z-index: 3;
  background: linear-gradient(90deg, rgba(250, 250, 250, 0.94), transparent 17%, transparent 83%, rgba(250, 250, 250, 0.94));
}

.launch-tile {
  position: absolute;
  width: clamp(116px, 13vw, 196px);
  aspect-ratio: 0.75;
  overflow: hidden;
  border: 1px solid rgba(17, 17, 17, 0.14);
  background: #e8e8e8;
  box-shadow: 0 24px 54px rgba(17, 17, 17, 0.14);
  opacity: 0.72;
  transform: translate3d(var(--tile-x, 0), var(--tile-y, 0), var(--tile-z, 0)) rotate(var(--tile-r, 0deg)) rotateY(var(--tile-yaw, 0deg));
  transform-style: preserve-3d;
  animation: launch-tile-breathe var(--tile-speed, 10s) ease-in-out var(--tile-delay, 0s) infinite alternate;
}

.launch-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.82) contrast(0.92);
  transform: scale(1.04);
}

.launch-tile:nth-child(1) { left: 3%; top: 34%; --tile-r: -18deg; --tile-y: 5%; --tile-z: -120px; --tile-speed: 11s; }
.launch-tile:nth-child(2) { left: 18%; top: 8%; --tile-r: 12deg; --tile-y: -7%; --tile-z: -40px; --tile-speed: 12s; --tile-delay: -3s; }
.launch-tile:nth-child(3) { left: 30%; top: 61%; --tile-r: -9deg; --tile-y: 10%; --tile-z: 40px; --tile-speed: 13s; --tile-delay: -6s; }
.launch-tile:nth-child(4) { left: 43%; top: 14%; --tile-r: 17deg; --tile-y: -4%; --tile-z: -80px; --tile-speed: 10s; --tile-delay: -2s; }
.launch-tile:nth-child(5) { left: 59%; top: 58%; --tile-r: 11deg; --tile-y: 9%; --tile-z: 70px; --tile-speed: 12s; --tile-delay: -5s; }
.launch-tile:nth-child(6) { left: 72%; top: 6%; --tile-r: -14deg; --tile-y: -8%; --tile-z: -50px; --tile-speed: 11s; --tile-delay: -8s; }
.launch-tile:nth-child(7) { left: 85%; top: 37%; --tile-r: 16deg; --tile-y: 4%; --tile-z: -100px; --tile-speed: 13s; --tile-delay: -1s; }

@keyframes launch-tile-breathe {
  from { margin-top: -4px; }
  to { margin-top: 8px; }
}

.launch-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 58px;
}

.launch-brand {
  padding: 40px 10px 7px;
  font-size: 10.5px;
  line-height: 1;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.brand-mark sup,
.launch-brand sup {
  margin-left: 2px;
  font-size: 0.55em;
  vertical-align: top;
}

.launch-center {
  position: relative;
  z-index: 4;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.launch-kicker,
.launch-footer {
  font-size: 10.5px;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.launch-kicker {
  margin: 0;
  opacity: 0.35;
}

.launch-center h1 {
  max-width: 760px;
  text-shadow: 0 1px 0 rgba(250, 250, 250, 0.5);
  margin: 0;
  font-family: var(--ui-font);
  font-size: clamp(48px, 9vw, 138px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.06em;
  text-wrap: balance;
}

body[data-language="zh"] .launch-center h1 {
  font-family: var(--cn-font);
  letter-spacing: -0.03em;
}

.launch-subtitle {
  max-width: 360px;
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.45;
}

.launch-enter {
  box-shadow: 0 12px 26px rgba(17, 17, 17, 0.08);
}

.launch-footer {
  display: flex;
  justify-content: space-between;
  padding: 0 10px 10px;
  opacity: 0.45;
}

.glass-button {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  font-family: inherit;
  font-size: 10.5px;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  cursor: pointer;
}

.glass-button::before,
.glass-button::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  content: "";
}

.glass-button::before {
  border: 1px solid currentColor;
  opacity: 0.13;
}

.glass-button::after {
  background: currentColor;
  opacity: 0.03;
}

.glass-button > * {
  position: relative;
  z-index: 1;
}

.glass-button span {
  opacity: 0.42;
  transition: opacity 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.glass-button:hover span,
.glass-button:focus-visible span {
  opacity: 1;
}

.glass-button:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.35);
  outline-offset: 2px;
}

.language-toggle {
  margin: 28px 10px 0 0;
}

.launch-enter {
  min-height: 48px;
  gap: 24px;
  padding: 0 18px;
}

.launch-enter span:last-child {
  opacity: 0.35;
}

.app-shell {
  grid-template-columns: minmax(286px, 320px) minmax(0, 1fr);
  min-height: 100svh;
  background: var(--paper);
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow-y: auto;
  gap: 3px;
  padding: 4px;
  border-right: 1px solid var(--line);
  background: var(--paper);
  box-shadow: none;
}

.workspace {
  min-width: 0;
  background: var(--paper);
}

.top-bar {
  min-height: 58px;
  align-items: stretch;
  gap: 3px;
  margin: 4px 4px 3px 3px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.top-bar h2 {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 58px;
  align-items: flex-end;
  margin: 0;
  padding: 0 10px 7px;
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  background: var(--glass-fill);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(1.06);
  -webkit-backdrop-filter: blur(24px) saturate(1.06);
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.top-bar h2,
.empty-state,
.empty-text,
.upload-title,
.reference-dropzone,
.reference-preview span,
.upload-meta,
.reference-head {
  color: var(--ink);
}

.gallery-shell {
  min-height: calc(100svh - 65px);
  padding: var(--workspace-inset);
  background: var(--paper);
  box-shadow: none;
}

.brand-mark {
  font-family: var(--ui-font);
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body[data-language="zh"] .brand-mark,
body[data-language="zh"] .launch-brand {
  font-family: var(--cn-font);
  letter-spacing: 0;
}

.primary-action,
.secondary-action,
.ghost-action,
.clear-action,
.task-pill {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.primary-action,
.secondary-action,
.ghost-action {
  display: flex;
  min-height: 58px;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 10px 7px;
  text-align: left;
}

.primary-action::before,
.primary-action::after,
.secondary-action::before,
.secondary-action::after,
.ghost-action::before,
.ghost-action::after,
.clear-action::before,
.clear-action::after {
  display: none;
}

.primary-action:hover,
.secondary-action:hover,
.ghost-action:hover,
.clear-action:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--ink);
}

.engine-picker,
.ratio-picker {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: none;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.engine-picker {
  min-height: 58px;
  gap: 2px;
  padding: 2px;
}

.engine-option {
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 10px 7px;
  text-align: left;
}

.ratio-option {
  align-items: flex-start;
  justify-content: flex-end;
  padding: 7px 8px;
  text-align: left;
}

.engine-option.is-active,
.ratio-option.is-active {
  border-radius: 4px;
  color: #fff;
  background: var(--ink);
}

.task-dot {
  background: var(--ink);
}

.upload-dropzone,
.reference-dropzone {
  min-height: 160px;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 4px;
  padding: 16px 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.upload-title,
.upload-meta,
#referenceLabel,
.engine-option,
.ratio-option,
.primary-action,
.secondary-action,
.ghost-action {
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.015em;
}

.upload-dropzone:hover,
.reference-dropzone:hover,
.upload-dropzone.is-dragover,
.reference-dropzone.is-dragover {
  transform: none;
  border-color: var(--ink);
  box-shadow: none;
}

.empty-state {
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* Neutral glass state cleanup. The legacy blue/brown states are intentionally
   overridden here so every generated and secondary state shares one language. */
.result-card {
  filter: none;
  background: transparent;
  box-shadow: none;
}

.result-preview {
  border: 1px solid rgba(17, 17, 17, 0.08);
  background: #f3f3f1;
  box-shadow: none;
}

.result-preview:focus-visible {
  outline: 2px solid rgba(17, 17, 17, 0.35);
  outline-offset: 3px;
}

.result-badge,
.variant-count {
  color: var(--ink);
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  background: var(--glass-fill);
  box-shadow: none;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.result-badge::before {
  background: currentColor;
  opacity: 0.42;
}

.card-actions button,
.card-actions button:nth-child(2),
.preview-regenerate {
  color: var(--ink);
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  background: var(--glass-fill);
  box-shadow: none;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.card-actions button {
  display: flex;
  min-height: 58px;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 10px 7px;
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.015em;
  text-align: left;
}

.card-actions button:hover:not(:disabled),
.card-actions button:focus-visible,
.preview-regenerate:hover,
.preview-regenerate:focus-visible {
  border-color: var(--glass-line-strong);
  background: rgba(250, 250, 250, 0.76);
}

.card-actions button:disabled,
.card-actions button:nth-child(2):disabled,
.side-rail button:disabled {
  color: rgba(17, 17, 17, 0.34);
  border-color: rgba(17, 17, 17, 0.08);
  background: rgba(250, 250, 250, 0.3);
}

.reference-list {
  scrollbar-color: rgba(17, 17, 17, 0.18) transparent;
}

.reference-item,
.reference-preview {
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  background: var(--glass-fill-soft);
  box-shadow: none;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.reference-item img {
  border-radius: 6px;
}

.reference-item span,
.reference-preview span {
  color: var(--ink);
}

.reference-item.is-selected,
.reference-preview.is-selected {
  border-color: var(--glass-line-strong);
  background: var(--glass-fill);
  box-shadow: none;
}

.reference-item:focus-visible,
.reference-preview:focus-visible {
  outline: 2px solid rgba(17, 17, 17, 0.35);
  outline-offset: 2px;
}

.reference-remove,
.result-remove {
  color: var(--ink);
  border: 1px solid var(--glass-line);
  background: var(--glass-fill);
  box-shadow: none;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.variant-stack-layer {
  border-color: rgba(17, 17, 17, 0.08);
  background: #f3f3f1;
}

.ratio-gooey-filter::after {
  border-color: var(--glass-line);
  background: rgba(250, 250, 250, 0.7);
  box-shadow: none;
}

.preview-overlay {
  background: rgba(17, 17, 17, 0.76);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.preview-overlay img,
.preview-overlay .preview-main-image {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.preview-close,
.preview-nav {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.preview-thumb {
  color: rgba(255, 255, 255, 0.55);
}

.preview-thumb.is-active {
  color: #fff;
}

.preview-thumb.is-active img {
  border-color: rgba(255, 255, 255, 0.72);
}

/* Stable alignment tokens replace the legacy transform/margin compensation. */
.brand-lockup {
  min-height: 34px;
  margin-bottom: 28px;
  transform: none;
}

.workspace-language-toggle {
  flex: 0 0 auto;
  margin: 0;
}

.side-rail > .upload-dropzone,
.side-rail > .reference-panel,
.side-rail > .control-stack {
  transform: none;
}

.control-stack {
  margin-top: 0;
}

.ratio-option:focus-visible,
.engine-option:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Precision workspace composition, transferred from the approved Unveil
   prototype: 4px outer grid, 58px modules, bottom-left labels, restrained glass. */
.brand-lockup {
  display: grid;
  min-height: 58px;
  grid-template-columns: minmax(0, 1fr) 88px;
  align-items: stretch;
  gap: 3px;
  margin: 0;
}

.brand-mark,
.workspace-language-toggle,
.upload-dropzone,
.reference-dropzone,
.engine-picker,
.ratio-picker,
.primary-action,
.secondary-action,
.ghost-action,
.reference-item,
.reference-preview,
.card-actions button,
.preview-regenerate {
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  background: var(--glass-fill);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(1.06);
  -webkit-backdrop-filter: blur(24px) saturate(1.06);
}

.brand-mark {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  padding: 0 10px 7px;
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.015em;
}

.workspace-language-toggle {
  width: 100%;
  min-height: 58px;
  align-items: flex-end;
  justify-content: flex-start;
  margin: 0;
  padding: 0 10px 7px;
  text-align: left;
}

.workspace-language-toggle::before,
.workspace-language-toggle::after {
  display: none;
}

.upload-dropzone,
.reference-dropzone {
  min-height: 132px;
  padding: 0;
  overflow: hidden;
  text-align: left;
}

.upload-title,
.upload-meta,
#referenceLabel {
  position: absolute;
  left: 10px;
  width: calc(100% - 20px);
  text-align: left;
}

.upload-title {
  bottom: 24px;
}

.upload-meta,
#referenceLabel {
  bottom: 7px;
}

.reference-panel,
.control-stack {
  gap: 3px;
}

.engine-picker,
.ratio-picker {
  gap: 2px;
  padding: 2px;
}

.engine-picker {
  min-height: 58px;
}

.ratio-picker {
  min-height: 66px;
}

.engine-option,
.ratio-option {
  border-radius: 5px;
}

.ratio-option {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.engine-option.is-active,
.ratio-option.is-active {
  color: #111;
  background: #aaa;
}

.button-row {
  gap: 3px;
}

.primary-action,
.secondary-action,
.ghost-action,
.card-actions button {
  min-height: 58px;
  white-space: nowrap;
}

.primary-action:hover:not(:disabled),
.secondary-action:hover:not(:disabled),
.ghost-action:hover:not(:disabled),
.card-actions button:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(17, 17, 17, 0.72);
  background: rgba(17, 17, 17, 0.72);
}

.side-rail button:disabled {
  opacity: 1;
}

.top-actions {
  display: flex;
  min-height: 58px;
  align-items: stretch;
  gap: 3px;
}

.task-pill,
.top-bar .clear-action {
  min-height: 58px;
  height: 58px;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 10px 7px;
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--glass-fill);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(1.06);
  -webkit-backdrop-filter: blur(24px) saturate(1.06);
}

.task-pill {
  min-width: 142px;
  gap: 6px;
}

.task-pill span,
.task-pill strong,
.top-bar .clear-action {
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.015em;
}

.task-dot {
  width: 6px;
  height: 6px;
  margin-bottom: 1px;
  background: currentColor;
  box-shadow: none;
}

.top-bar .clear-action:disabled {
  display: none;
}

.result-preview {
  isolation: isolate;
}

.result-preview::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.38),
    inset -3px 0 5px rgba(215, 231, 238, 0.2),
    inset 0 3px 5px rgba(255, 255, 255, 0.22),
    inset 0 0 22px rgba(255, 255, 255, 0.12);
  content: "";
  pointer-events: none;
}

.result-badge,
.variant-count,
.result-remove,
.processing-overlay {
  z-index: 3;
}

@media (max-width: 980px) {
  :root {
    --workspace-inset: 12px;
  }

  body {
    height: 100svh;
    overflow: hidden;
  }

  .app-shell {
    display: grid;
    grid-template-columns: minmax(260px, 290px) minmax(0, 1fr);
    height: 100svh;
    min-height: 100svh;
  }

  .side-rail {
    position: sticky;
    height: 100svh;
    padding: 4px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .brand-lockup {
    margin-bottom: 0;
  }

  .brand-mark {
    font-size: 10.5px;
  }

  .top-bar {
    flex-direction: row;
    align-items: stretch;
    margin: 4px 4px 3px 3px;
    padding: 0;
  }

  .gallery-shell {
    min-height: 0;
  }

  .result-card {
    width: min(100%, var(--preview-width, 286px));
    max-width: 100%;
  }

  .result-stack {
    width: 100%;
    height: auto;
    aspect-ratio: var(--preview-ratio, 0.75);
  }
}

@media (max-width: 760px) {
  :root {
    --workspace-inset: 16px;
  }

  body {
    height: auto;
    min-height: 100svh;
    overflow: auto;
  }

  .app-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 100svh;
  }

  .side-rail {
    position: relative;
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 3px;
    padding: max(4px, env(safe-area-inset-top)) 4px 4px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-lockup,
  .control-stack,
  .status-panel {
    grid-column: 1 / -1;
  }

  .brand-lockup {
    min-height: 40px;
    margin-bottom: 0;
  }

  .brand-mark {
    font-size: 10.5px;
  }

  .workspace-language-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  .upload-dropzone,
  .reference-dropzone {
    min-height: 120px;
    padding: 0;
  }

  .reference-panel {
    min-width: 0;
  }

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

  .primary-action,
  .secondary-action,
  .ghost-action {
    min-height: 44px;
  }

  .workspace {
    min-height: 100svh;
  }

  .top-bar {
    min-height: 58px;
    align-items: stretch;
    margin: 4px 4px 3px 3px;
    padding: 0;
  }

  .gallery-shell {
    min-height: calc(100svh - 65px);
  }

  .image-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .result-card {
    justify-self: start;
  }

  .launch-center h1 {
    max-width: 92vw;
    font-size: clamp(48px, 15vw, 90px);
  }

  .launch-wall {
    inset: -12% -34%;
    transform: translate3d(calc(var(--launch-mx, 0) * 0.35px), calc(var(--launch-my, 0) * 0.35px), 0) rotate(-5deg) scale(1.02);
  }

  .launch-tile {
    width: clamp(96px, 26vw, 148px);
    opacity: 0.56;
  }

  .launch-tile:nth-child(1) { left: 2%; top: 23%; }
  .launch-tile:nth-child(2) { left: 18%; top: 7%; }
  .launch-tile:nth-child(3) { left: 30%; top: 70%; }
  .launch-tile:nth-child(4) { left: 44%; top: 10%; }
  .launch-tile:nth-child(5) { left: 58%; top: 68%; }
  .launch-tile:nth-child(6) { left: 72%; top: 9%; }
  .launch-tile:nth-child(7) { left: 86%; top: 28%; }

  .launch-footer {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 420px) {
  .button-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (hover: none), (pointer: coarse) {
  .result-body {
    pointer-events: auto;
  }

  .card-actions,
  .result-remove,
  .reference-remove {
    opacity: 1;
    pointer-events: auto;
  }

  .card-actions button {
    min-height: 44px;
  }

  .result-remove,
  .reference-remove {
    width: 36px;
    height: 36px;
  }

  .result-remove::after,
  .reference-remove::after {
    position: absolute;
    inset: -4px;
    content: "";
  }
}

/* GSAP-driven segmented selection. Without GSAP, the existing dark selected
   button remains as the visual fallback. */
.has-gsap .ratio-gooey-effect {
  overflow: hidden;
  border-radius: 5px;
  transition: none;
  will-change: transform, opacity;
}

.has-gsap .ratio-gooey-filter::after {
  border-color: rgba(255, 255, 255, 0.2);
  background: #aaa;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.16),
    0 8px 22px rgba(17, 17, 17, 0.1);
  backdrop-filter: blur(20px) saturate(1.14);
  -webkit-backdrop-filter: blur(20px) saturate(1.14);
}

.has-gsap .ratio-gooey-filter.is-active::after {
  animation: none;
}

.has-gsap .engine-option.is-active,
.has-gsap .ratio-option.is-active {
  color: #111;
  background: transparent;
  box-shadow: none;
}

.selection-glint {
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: 0;
  z-index: 1;
  width: 42%;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.24),
    rgba(255, 255, 255, 0)
  );
  transform: skewX(-16deg);
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .launch-screen,
  .glass-button span,
  .launch-wall,
  .launch-tile,
  .ratio-gooey-effect,
  .selection-glint {
    transition: none;
    animation: none;
  }
}

/* Admin uses the same neutral glass system as the Studio workspace. */
.admin-overlay {
  background: rgba(248, 248, 248, 0.78);
  backdrop-filter: blur(20px) saturate(1);
  -webkit-backdrop-filter: blur(20px) saturate(1);
}

.admin-card {
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(248, 248, 248, 0.96);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(1.02);
  -webkit-backdrop-filter: blur(24px) saturate(1.02);
}

.admin-card:has(#adminLoginView:not([hidden])) {
  width: min(480px, 94vw);
}

#adminLoginView {
  display: grid;
  gap: 12px;
}

#adminLoginView[hidden],
#adminMainView[hidden] {
  display: none !important;
}

#adminLoginView h2,
#adminLoginView .admin-error {
  margin: 0;
}

.admin-card h2 {
  margin: 0 0 16px;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.meta-line {
  margin: 0 0 8px;
  color: rgba(17, 17, 17, 0.42);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.admin-close {
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  color: rgba(17, 17, 17, 0.54);
  background: var(--glass-fill);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  font-family: inherit;
  font-size: 18px;
}

.admin-close:hover,
.admin-close:focus-visible {
  color: #fff;
  border-color: rgba(17, 17, 17, 0.72);
  background: rgba(17, 17, 17, 0.72);
}

.admin-input,
.admin-textarea {
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
  box-shadow: none;
  font-family: inherit;
  font-size: 12px;
}

.admin-input:focus,
.admin-textarea:focus {
  border-color: rgba(17, 17, 17, 0.56);
  outline: 2px solid rgba(17, 17, 17, 0.08);
  outline-offset: 1px;
}

.admin-input::placeholder,
.admin-textarea::placeholder {
  color: rgba(17, 17, 17, 0.38);
}

#adminLoginView .admin-input {
  min-height: 58px;
  padding: 0 10px;
}

#adminLoginView .primary-action {
  min-height: 58px;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 10px 7px;
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  color: var(--ink);
  background: #aaa;
  box-shadow: none;
  text-align: left;
}

.admin-tabs {
  gap: 3px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-tab {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  color: rgba(17, 17, 17, 0.62);
  background: var(--glass-fill);
  box-shadow: none;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 400;
}

.admin-tab.active {
  color: var(--ink);
  background: #aaa;
}

.admin-card label,
.admin-help,
.admin-small-label,
.admin-ref-item div {
  color: rgba(17, 17, 17, 0.62);
}

.admin-card label,
.admin-small-label {
  font-weight: 500;
}

.admin-ref-head strong {
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  color: var(--ink);
  background: #aaa;
}

.admin-ref-item {
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.32);
  box-shadow: none;
}

.admin-ref-item img,
.admin-ref-item button {
  border-radius: 6px;
}

.admin-ref-item button {
  color: rgba(17, 17, 17, 0.54);
  background: var(--glass-fill);
}

.admin-url-row .secondary-action,
.admin-actions .primary-action,
.admin-actions .ghost-action {
  border-radius: 6px;
  color: var(--ink);
  background: var(--glass-fill);
  box-shadow: none;
}

.admin-actions .primary-action {
  background: #aaa;
}

.admin-ref-list {
  scrollbar-gutter: stable;
}
