:root {
  --bg: #0c0b1d;
  --bg-elevated: #17162f;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(196, 181, 253, 0.32);
  --text: #f4f3ff;
  --text-muted: #b4b1d0;
  --grad-brand: linear-gradient(135deg, #7c3aed 0%, #a21caf 55%, #db2777 100%);
  --grad-cta: linear-gradient(120deg, #67e8f9 0%, #22d3ee 45%, #a5b4fc 100%);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.18);
  --accent-glow: rgba(139, 92, 246, 0.35);
  /* Photo-editor CTA accent (ui-ux-pro-max: violet chrome + cyan generate) */
  --cta: #22d3ee;
  --cta-strong: #06b6d4;
  --cta-text: #042f2e;
  --cta-glow: rgba(34, 211, 238, 0.42);
  --info: #22d3ee;
  --info-soft: rgba(34, 211, 238, 0.14);
  --info-border: rgba(34, 211, 238, 0.38);
  --danger: #f87171;
  --radius: 16px;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  --page-max: 1280px;
  --coin-yellow: #facc15;
  --chrome-bg: rgba(19, 20, 43, 0.92);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.22), transparent),
    var(--bg);
}

.photo-app.page {
  position: relative;
  z-index: 1;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.app-chrome-fixed {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0 -1.5rem;
  padding: 0.85rem 1.5rem 0.65rem;
  background:
    linear-gradient(180deg, rgba(12, 11, 29, 0.92) 0%, rgba(12, 11, 29, 0.72) 100%);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1 1 auto;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.coin-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.12);
  color: var(--coin-yellow);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
}

.ongoing-tasks-badge {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: var(--bg-elevated, #232445);
  color: var(--text-muted, #9394b0);
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 0;
}

.ongoing-tasks-badge.is-active {
  border-color: var(--info-border, rgba(34, 211, 238, 0.38));
  background: var(--info-soft, rgba(34, 211, 238, 0.14));
  color: var(--info, #22d3ee);
}

.coin-chip-icon {
  flex-shrink: 0;
  color: var(--coin-yellow);
}

.coin-chip-value {
  font-variant-numeric: tabular-nums;
  color: var(--coin-yellow);
}

.coin-cost-num {
  color: var(--coin-yellow);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.account-block {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0.15rem 0.25rem;
  min-width: 2.75rem;
  max-width: 7.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
}

.account-block--avatar-only {
  min-width: 0;
  max-width: none;
  padding: 0.2rem;
}

.account-block:hover,
.account-block:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.account-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.account-avatar--icon {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  overflow: hidden;
}

.account-avatar--icon svg {
  width: 20px;
  height: 20px;
}

.account-email {
  max-width: 100%;
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-up-btn {
  white-space: nowrap;
}

.faceswap-generate-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  margin-top: 0.75rem;
}

.faceswap-generate-btn,
.generate-btn {
  flex: 0 1 auto;
  min-width: 11rem;
  min-height: 2.85rem;
  padding-inline: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--cta-text);
  background: linear-gradient(180deg, #67e8f9 0%, var(--cta-strong) 100%);
  border-color: transparent;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 10px 28px var(--cta-glow);
  /* No translateY on hover — it moves the hit box and causes hover flicker. */
  transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.faceswap-generate-btn:hover:not(:disabled),
.generate-btn:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 14px 34px var(--cta-glow);
}

.faceswap-generate-btn:focus-visible,
.generate-btn:focus-visible {
  outline: 3px solid var(--cta);
  outline-offset: 3px;
}

.faceswap-generate-btn:disabled,
.generate-btn:disabled {
  filter: grayscale(0.25);
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .faceswap-generate-btn,
  .generate-btn {
    transition: none;
  }
}

.quality-radios {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.15rem;
  margin-left: auto;
}

.quality-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.quality-radio input[type="radio"] {
  accent-color: var(--accent);
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
}

.quality-radio:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.result-media-wrap {
  position: relative;
}

.result-save-chip {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(12, 12, 16, 0.82);
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.result-save-chip:hover {
  background: rgba(20, 20, 28, 0.92);
}

.result-save-chip svg {
  display: block;
  flex-shrink: 0;
}

.preview-wrap-light {
  background: rgba(255, 255, 255, 0.04);
}

.media-badge {
  position: absolute;
  left: 0.55rem;
  top: 0.55rem;
  z-index: 1;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.faceswap-video-placeholder {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.back-portfolio {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.site-hero {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.site-hero--inline {
  gap: 0.75rem;
  margin-bottom: 0;
  min-width: 0;
}

.site-hero--settings {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.site-hero--settings:focus-visible {
  outline: 2px solid var(--info, #22d3ee);
  outline-offset: 3px;
  border-radius: 0.5rem;
}

.site-hero-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 12px 32px var(--accent-glow);
  flex-shrink: 0;
}

.site-hero--inline .site-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  box-shadow: 0 8px 20px var(--accent-glow);
}

.site-hero h1 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
}

.site-hero--inline h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-hero-text {
  min-width: 0;
}

.site-hero-lead {
  margin: 0;
  color: var(--text-muted);
}

.site-hero--inline .site-hero-lead {
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}

.app-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  margin-top: 1rem;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.slot-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.result-pane {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.workspace-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Card gap owns vertical rhythm — zero legacy top margins on direct children. */
.card.workspace-panel > .field,
.card.workspace-panel > .keep-face-model-row,
.card.workspace-panel > .background-row,
.card.workspace-panel > .style-hint,
.card.workspace-panel > .actions-bar,
.card.workspace-panel > .progress-block {
  margin-top: 0;
  margin-bottom: 0;
}

.card.workspace-panel > .background-row {
  margin: 0;
}

.controls-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.controls-footer .actions-bar,
.controls-footer .progress-block,
.style-card [data-style-footer] .actions-bar,
.style-card [data-style-footer] .progress-block {
  margin-top: 0;
}

.controls-footer .generate-btn,
.style-card [data-style-footer] .generate-btn {
  width: 100%;
  min-width: 0;
}

.controls-footer,
.style-card [data-style-footer] {
  overflow: visible;
}

.actions-bar--model-generate {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.5rem;
  overflow: visible;
}

.actions-bar--model-generate > .model-dropup,
.actions-bar--model-generate > .generate-btn {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

.model-dropup {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 2.85rem;
}

.model-dropup-trigger {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 2.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.model-dropup-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.model-dropup-trigger:focus-visible {
  outline: 3px solid var(--cta);
  outline-offset: 2px;
}

.model-dropup-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-dropup-chevron {
  flex: 0 0 auto;
  opacity: 0.7;
  line-height: 1;
}

.model-dropup-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 0.35rem);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: min(16rem, 45vh);
  overflow-y: auto;
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(18, 18, 24, 0.96);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.model-dropup-item {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.model-dropup-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.model-dropup-item.is-selected {
  background: rgba(103, 232, 249, 0.14);
  color: #a5f3fc;
  font-weight: 600;
}

.style-card [data-style-footer] {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.workspace-col {
  min-width: 0;
}

.workspace + .compare-card,
.workspace + .actions-bar,
.workspace ~ .cost-note {
  margin-top: 1rem;
}

@media (min-width: 960px) {
  /* Match Edit empty-state height across tabs; give prompt + CTA room to breathe. */
  .workspace--split,
  .workspace--triple {
    --photo-workspace-min-h: 28rem;
    min-height: var(--photo-workspace-min-h);
    height: var(--photo-workspace-min-h);
    align-items: stretch;
  }

  .workspace--split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem;
  }

  .workspace--triple {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 1rem;
  }

  .workspace-col {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
  }

  .workspace-col > .card,
  .workspace-col > .compare-grid {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
  }

  .workspace-col--photo .compare-grid {
    grid-template-columns: 1fr;
  }

  /* Contain tall uploads inside the fixed workspace height (mirror triple slots). */
  .workspace-col--photo > .card.slot-pick-card,
  .workspace-col--photo > .ba-compare {
    min-height: 0;
    overflow: hidden;
  }

  .workspace-col--photo .slot-preview {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .workspace-col--photo .pick-zone,
  .workspace-col--photo .preview-wrap {
    flex: 1 1 auto;
    min-height: 0;
  }

  .workspace-col--photo .pick-zone {
    min-height: 220px;
  }

  .workspace-col--photo .preview-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .workspace-col--photo .preview-wrap img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .workspace-col--controls > .card,
  .workspace--triple > .card.workspace-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    min-height: 0;
    /* Visible so Model dropup can open above Generate without clipping. */
    overflow: visible;
    /* Extra room under Generate — was flush against the card edge. */
    padding-bottom: 1.65rem;
  }

  .workspace--triple {
    padding-bottom: 0.35rem;
  }

  /* Prompt grows into leftover space; never paint over Generate. */
  .workspace-col--controls .field,
  .workspace--triple > .card.workspace-panel .field {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: 0;
  }

  .workspace-col--controls .field textarea,
  .workspace--triple .field textarea {
    flex: 1 1 auto;
    min-height: 5rem;
    max-height: 100%;
    resize: none;
    overflow-y: auto;
  }

  .workspace-col--controls .controls-footer,
  .workspace--triple > .card.workspace-panel .controls-footer,
  .style-card [data-style-footer] {
    margin-top: auto;
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    /* Opaque so progress never paints through category pills above. */
    background: var(--bg-elevated, #1a1228);
    padding-top: 0.15rem;
  }

  /* Chips scroll inside the body; categories stay above the Generate/progress footer. */
  .style-card [data-style-body] {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .style-card .style-chips {
    flex: 1 1 auto;
    min-height: 122px;
    overflow-x: auto;
    overflow-y: auto;
  }

  .style-card .style-categories {
    flex: 0 0 auto;
    margin-top: 0.55rem;
  }

  .style-card .sub-tabs,
  .style-card .accessory-subtabs {
    flex: 0 0 auto;
  }

  .workspace--triple > .card,
  .workspace--triple > .slot-pick-card {
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
  }

  .workspace--triple .slot-preview {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .workspace--triple .slot-pick-card .pick-zone-compact,
  .workspace--triple .slot-preview .preview-wrap {
    flex: 1 1 auto;
    min-height: 180px;
  }

  .workspace--triple .preview-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .workspace--triple .preview-wrap img,
  .workspace--triple .preview-wrap video {
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /*
   * Combine / Clothes after result — still 3 columns:
   * stacked compact inputs | tall result (~2× one input) | config (unchanged).
   * Stay within the fixed workspace height so the page does not grow/scroll.
   */
  .workspace--triple.workspace--triple-result {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.35fr) minmax(0, 1.1fr);
  }

  .workspace--triple-result > .slot-stack {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
  }

  .workspace--triple-result .slot-stack > .slot-pick-card {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    max-height: 50%;
    margin: 0;
    padding: 0.55rem 0.65rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .workspace--triple-result .slot-stack figcaption {
    flex: 0 0 auto;
    margin-bottom: 0.3rem;
    font-size: 0.72rem;
  }

  .workspace--triple-result .slot-stack .slot-preview {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
  }

  .workspace--triple-result .slot-stack .pick-zone-compact,
  .workspace--triple-result .slot-stack .preview-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: relative;
  }

  .workspace--triple-result .slot-stack .preview-wrap {
    display: block;
  }

  /* Force fit inside the compact box — do not let natural image height expand the card. */
  .workspace--triple-result .slot-stack .preview-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
    object-position: center;
  }

  .workspace--triple-result .slot-stack .slot-action-bar {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    z-index: 2;
  }

  .workspace--triple-result > .result-pane {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .workspace--triple-result .result-pane > .compare-card {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
  }

  .workspace--triple-result .result-pane .result-media-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .workspace--triple-result .result-pane .preview-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .workspace--triple-result .result-pane .preview-wrap img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .workspace--triple-result .result-pane .actions-bar {
    margin-top: 0.35rem;
    flex: 0 0 auto;
  }

  .workspace--triple-result .result-pane .cost-note {
    margin: 0;
    flex: 0 0 auto;
  }

  /* Config column: same sizing as empty-state triple (do not shrink/grow). */
  .workspace--triple-result > .card.workspace-panel {
    height: 100%;
    min-height: 100%;
  }

  .style-card {
    margin-top: 0;
  }
}

.card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.pick-zone {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed rgba(139, 92, 246, 0.45);
  border-radius: var(--radius);
  background: rgba(139, 92, 246, 0.06);
  cursor: pointer;
  text-align: center;
  padding: 1.5rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pick-zone:hover {
  border-color: rgba(139, 92, 246, 0.7);
  background: rgba(139, 92, 246, 0.1);
}

.pick-zone p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
}

.pick-zone-compact {
  min-height: 140px;
  padding: 1rem;
}

.field-label {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.background-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.field-label-inline {
  margin: 0;
  flex: 0 0 auto;
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-height: 40px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  accent-color: var(--accent);
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
}

.preview-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  display: flex;
  justify-content: center;
}

button.preview-wrap {
  width: 100%;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
  appearance: none;
}

button.preview-wrap:disabled {
  cursor: default;
}

.preview-wrap-clickable:not(:disabled):hover {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.preview-wrap img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  width: auto;
  height: auto;
}

.preview-wrap video {
  display: block;
  max-width: 100%;
  max-height: 420px;
  width: auto;
  height: auto;
  background: #000;
}

.preview-wrap.is-generating img,
.preview-wrap.is-generating video { opacity: 0.45; }

.preview-progress {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1rem;
}

.field label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.field textarea {
  width: 100%;
  min-height: 5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.keep-face-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.keep-face-checks {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 0.2rem;
}

/* Edit / Style: keep-face is the first block — match left card top padding (no extra offset). */
.card > .keep-face-model-row:first-child {
  margin-top: 0;
}

.keep-face-model-row-end {
  justify-content: flex-end;
}

.keep-face-model-row .check-row-inline {
  margin-top: 0;
  flex: 1;
  min-width: 0;
}

.keep-face-checks .check-row-inline {
  flex: 0 0 auto;
}

.model-select-inline {
  flex: 0 1 10.5rem;
  max-width: 42%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.65rem;
}

.model-picker-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.model-picker-row select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  padding: 0.65rem 0.75rem;
}

.model-picker-label {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.85;
}

.compare-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .compare-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Before / After drag slider (Edit + Style results) */
.ba-compare {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.ba-slider {
  position: relative;
  width: 100%;
  min-height: 220px;
  aspect-ratio: 3 / 4;
  max-height: min(70vh, 36rem);
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  background: #0a0a12;
  --ba-pos: 50%;
  touch-action: none;
  user-select: none;
  cursor: ew-resize;
}

.ba-slider-layer {
  position: absolute;
  inset: 0;
}

.ba-slider-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.ba-slider-before {
  clip-path: inset(0 calc(100% - var(--ba-pos)) 0 0);
}

.ba-slider-scrub {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--ba-pos);
  width: 2px;
  transform: translateX(-50%);
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 2;
}

.ba-slider-knob {
  position: absolute;
  top: 50%;
  left: var(--ba-pos);
  z-index: 3;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  color: #111827;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  cursor: ew-resize;
  touch-action: none;
}

.ba-slider-knob:focus-visible {
  outline: 3px solid var(--cta);
  outline-offset: 3px;
}

.ba-slider-arrows {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.ba-badge {
  position: absolute;
  z-index: 2;
  top: 0.65rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(10, 10, 18, 0.55);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.ba-badge-before {
  left: 0.65rem;
}

.ba-badge-after {
  right: 0.65rem;
}

.ba-compare-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ba-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (min-width: 960px) {
  .workspace-col--photo .ba-compare {
    flex: 1 1 auto;
    min-height: 100%;
    height: 100%;
  }

  .workspace-col--photo .ba-slider {
    flex: 1 1 auto;
    aspect-ratio: auto;
    height: 100%;
    max-height: none;
    min-height: 220px;
  }
}

.compare-card figcaption {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.slot-pick-card {
  position: relative;
}

.slot-preview {
  display: block;
  cursor: pointer;
}

.slot-camera-btn,
.slot-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border);
  background: rgba(19, 20, 43, 0.82);
  color: var(--text);
  cursor: pointer;
}

.slot-action-btn svg,
.slot-camera-btn svg {
  width: 1.75rem;
  height: 1.75rem;
}

.slot-action-bar {
  position: absolute;
  top: 2.35rem;
  right: 0.75rem;
  z-index: 2;
  display: flex;
  gap: 0.45rem;
}

.preview-wrap .slot-action-bar {
  top: 0.65rem;
  right: 0.65rem;
}

.slot-camera-btn:hover,
.slot-action-btn:hover {
  color: var(--accent, #8b5cf6);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.progress-block {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.progress-background {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 1rem 0.6rem 0.85rem;
  background: var(--info-soft);
  border-top: 1px solid var(--info-border);
  border-bottom: 1px solid var(--info-border);
  border-left: 3px solid var(--info);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
}

.progress-background .btn-danger {
  border-color: var(--info-border);
  color: var(--info);
  background: transparent;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  transition: width 0.25s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn, .icon-btn {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.btn {
  padding: 0.55rem 0.9rem;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(180deg, #a78bfa 0%, #7c3aed 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 22px var(--accent-glow);
  transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-primary:focus-visible {
  outline: 3px solid #c4b5fd;
  outline-offset: 3px;
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
}

/* Swap / Photo Generate — cyan CTA accent */
.btn-primary.faceswap-generate-btn,
.btn-primary.generate-btn {
  color: var(--cta-text);
  background: linear-gradient(180deg, #67e8f9 0%, var(--cta-strong) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 10px 28px var(--cta-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.actions-bar {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.error-banner {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  margin-top: 0.75rem;
}

.error-banner--staff {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
}

.staff-log-tag {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #e9d5ff;
  background: rgba(120, 31, 243, 0.28);
}

.staff-log-body {
  margin: 0;
  width: 100%;
  max-height: 16rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #fecaca;
}

.cost-note {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hidden-input {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: #111827;
  border: 1px solid var(--border);
  padding: 0.65rem 1rem;
  border-radius: 999px;
  z-index: 40;
}

.site-footer {
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer a {
  color: inherit;
}

.photo-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  border: none;
}

.photo-tab {
  flex: 1 1 0;
  min-width: 0;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  min-height: 44px;
  padding: 0 0.45rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-tab.is-on {
  background: var(--accent-soft);
  border-color: rgba(139, 92, 246, 0.5);
  color: var(--text);
}

.style-card {
  margin-top: 0;
}

.style-hint {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.style-hint.is-single-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0 0 0.75rem;
  padding: 0;
  min-height: 2.125rem;
  height: 2.125rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  box-sizing: border-box;
}

/* Same box as .sub-tabs — Accessory must not add extra padding (that caused a top-offset flicker). */
.sub-tabs-scroll {
  flex-wrap: nowrap;
}

.sub-tab {
  font: inherit;
  background: none;
  border: none;
  padding: 0.35rem 0;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.sub-tab.is-on {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.style-chips {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0 0 0.65rem;
  min-height: 122px;
  /* Reserve chip row so tab switches do not jump the category pills / Generate. */
  height: 122px;
  box-sizing: content-box;
}

.style-chips-loading {
  position: sticky;
  left: 0;
  z-index: 2;
  flex: 0 0 auto;
  align-self: center;
  margin-right: 0.25rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(11, 11, 24, 0.82);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.style-chip {
  flex: 0 0 76px;
  width: 76px;
  height: 122px;
  min-height: 122px;
  max-height: 122px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.style-chip.is-on {
  border-color: #c4b5fd;
  box-shadow: inset 0 0 0 1px #c4b5fd;
}

.style-chip-art {
  position: relative;
  flex: 0 0 96px;
  width: 100%;
  height: 96px;
  min-height: 96px;
  max-height: 96px;
  overflow: hidden;
  border-radius: 11px 11px 0 0;
  background: #0b0b18;
}

.style-chip-art.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  background-size: 200% 100%;
  animation: style-chip-shimmer 1.1s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .style-chip-art.is-loading::after {
    animation: none;
  }
}

@keyframes style-chip-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.style-chip-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.style-chip-check {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.1rem;
  background: rgba(124, 58, 237, 0.45);
}

.style-chip-label {
  flex: 0 0 26px;
  margin: 0;
  padding: 0.25rem 0;
  height: 26px;
  width: 100%;
  font-size: 11px;
  line-height: 18px;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
  box-sizing: border-box;
  display: block;
}

.style-chip-label-text {
  display: inline-block;
  padding: 0 4px;
  white-space: nowrap;
  vertical-align: middle;
}

.style-chip-label.is-marquee {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 16px;
  width: max-content;
  animation: style-chip-marquee var(--marquee-duration, 8s) linear infinite;
}

.style-chip-label.is-marquee .style-chip-label-text {
  flex: 0 0 auto;
  padding: 0;
}

@keyframes style-chip-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-1 * var(--marquee-distance, 50%))); }
}

@media (prefers-reduced-motion: reduce) {
  .style-chip-label.is-marquee {
    animation: none;
    width: 100%;
    justify-content: center;
  }
}

.style-categories {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.55rem;
}

.style-pills {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
}

.style-pill {
  flex: 0 0 auto;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
}

.style-pill.is-on {
  background: var(--accent-soft);
  border-color: rgba(139, 92, 246, 0.5);
  color: var(--text);
}

.apply-fab {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  cursor: pointer;
}

.apply-fab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .site-hero--inline .site-hero-lead {
    display: none;
  }

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

  .top-bar-actions {
    margin-left: auto;
  }

  .account-email {
    max-width: 4.5rem;
  }
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.62);
}

.confirm-panel {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}

.confirm-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.confirm-panel p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.result-preview-fs {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  flex-direction: column;
}

.result-preview-close {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 2;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  box-shadow: none;
  padding: 0;
}

.result-preview-close:hover {
  background: transparent;
  opacity: 0.85;
}

.result-preview-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: zoom-in;
  padding: 3.5rem 1rem 4.5rem;
  box-sizing: border-box;
}

.result-preview-stage.is-zoomed {
  cursor: zoom-out;
}

.result-preview-stage.is-dragging {
  cursor: grabbing !important;
}

.result-preview-stage img {
  display: block;
  /* Fit the full photo inside the stage — no crop / default zoom. */
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  transform-origin: center center;
  transition: transform 0.12s ease-out;
  pointer-events: none;
}

.result-preview-stage.is-dragging img {
  transition: none;
}

.result-preview-stage.is-video {
  cursor: default;
  touch-action: auto;
}

.result-preview-stage video {
  display: block;
  max-width: min(96vw, 1100px);
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
  background: #000;
}

.result-preview-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(0.85rem, env(safe-area-inset-bottom));
  z-index: 2;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.result-preview-footer .btn {
  pointer-events: auto;
}

.compare-card .btn,
.compare-card .file-btn {
  margin-top: 0.65rem;
}

/* Settings popup (Workout-style) */
.settings-panel {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.8);
}

.settings-sheet {
  width: 100%;
  max-width: 28rem;
  max-height: min(90vh, 40rem);
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.35rem;
  box-shadow: var(--shadow);
}

.app-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 60px;
  margin-bottom: 0.35rem;
}

.app-popup-title {
  margin: 0;
  flex: 1;
  font-size: 1.0625rem;
  line-height: 1.375rem;
  font-weight: 600;
  color: var(--text-muted);
}

.app-popup-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.app-popup-close:hover {
  background: rgba(255, 255, 255, 0.06);
}

.settings-signed-as,
.card-muted {
  margin: 0.35rem 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ongoing-tasks-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}

.ongoing-tasks-sheet {
  width: min(560px, 100%);
  margin: 0 auto;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  padding: 1rem 1.1rem 1.25rem;
  box-sizing: border-box;
}

.ongoing-tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ongoing-tasks-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.ongoing-tasks-summary {
  margin: 0.35rem 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ongoing-tasks-empty {
  margin: 2rem 0;
  text-align: center;
  color: var(--text-muted);
}

.ongoing-tasks-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ongoing-task-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.65rem;
  align-items: start;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
}

.ongoing-task-main {
  grid-column: 1 / -1;
}

.ongoing-task-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.ongoing-task-sub {
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.ongoing-task-progress {
  margin-top: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.ongoing-task-progress .progress-track {
  flex: 1;
  margin: 0;
}

.ongoing-task-phase {
  justify-self: start;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.16);
  color: var(--info);
}

.ongoing-task-phase.is-queued {
  background: rgba(147, 148, 176, 0.18);
  color: var(--text-muted);
}

.ongoing-task-row > .btn {
  justify-self: end;
}

/* ==========================================================================
 * Visual layer — calm, professional surfaces shared by all four tabs.
 * Layout (grid heights, slot sizing) stays in the rules above; this block only
 * restyles surfaces and states. One accent (violet), solid surfaces, 12px radii,
 * color-only transitions (no hit-box movement), visible focus rings.
 * ========================================================================== */

/* Dark (default) — midnight indigo, violet → magenta generation accent. */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0914;
  --bg-elevated: #12101f;
  --surface: #1a1729;
  --surface-hover: #231f37;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(196, 181, 253, 0.2);
  --text: #f5f3ff;
  --text-muted: #a9a3c7;
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-text: #c4b5fd;
  --accent-soft: rgba(139, 92, 246, 0.16);
  --accent-border: rgba(167, 139, 250, 0.45);
  --focus-ring: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.35);
  --grad-brand: linear-gradient(135deg, #7c3aed 0%, #9333ea 50%, #c026d3 100%);
  --grad-brand-hover: linear-gradient(135deg, #6d28d9 0%, #7e22ce 50%, #a21caf 100%);
  --grad-text: linear-gradient(120deg, #e9d5ff 0%, #c4b5fd 45%, #f0abfc 100%);
  --grad-cta: var(--grad-brand);
  --cta: #a78bfa;
  --cta-strong: #7c3aed;
  --cta-text: #fff;
  --cta-glow: rgba(147, 51, 234, 0.4);
  --info: #a78bfa;
  --info-soft: rgba(139, 92, 246, 0.14);
  --info-border: rgba(139, 92, 246, 0.45);
  --danger: #f87171;
  --danger-text: #fecaca;
  --coin-yellow: #facc15;
  --tint-1: rgba(255, 255, 255, 0.03);
  --tint-2: rgba(255, 255, 255, 0.06);
  --tint-3: rgba(255, 255, 255, 0.1);
  --media-bg: #07060e;
  --placeholder: #7a7596;
  --scrim: rgba(4, 3, 10, 0.72);
  --aurora-1: rgba(124, 58, 237, 0.2);
  --aurora-2: rgba(192, 38, 211, 0.1);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.5);
  --chrome-bg: rgba(10, 9, 20, 0.82);
}

/* Light — lavender paper, white cards, deeper violet for AA text contrast. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #faf7ff;
  --bg-elevated: #ffffff;
  --surface: #f6f2fe;
  --surface-hover: #eee7fd;
  --border: #ece5fb;
  --border-strong: #dcd0f7;
  --text: #1e1b4b;
  --text-muted: #5b5680;
  --accent: #7c3aed;
  --accent-strong: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-text: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.1);
  --accent-border: rgba(124, 58, 237, 0.4);
  --focus-ring: #7c3aed;
  --accent-glow: rgba(124, 58, 237, 0.28);
  --grad-text: linear-gradient(120deg, #6d28d9 0%, #7c3aed 45%, #c026d3 100%);
  --cta: #7c3aed;
  --cta-glow: rgba(124, 58, 237, 0.3);
  --info: #6d28d9;
  --info-soft: rgba(124, 58, 237, 0.08);
  --info-border: rgba(124, 58, 237, 0.35);
  --danger: #dc2626;
  --danger-text: #b91c1c;
  --coin-yellow: #b45309;
  --tint-1: rgba(76, 29, 149, 0.03);
  --tint-2: rgba(76, 29, 149, 0.06);
  --tint-3: rgba(76, 29, 149, 0.1);
  --media-bg: #f1ecfc;
  --placeholder: #8a85a8;
  --scrim: rgba(30, 27, 75, 0.38);
  --aurora-1: rgba(167, 139, 250, 0.28);
  --aurora-2: rgba(240, 171, 252, 0.22);
  --shadow: 0 1px 2px rgba(76, 29, 149, 0.06), 0 12px 32px rgba(76, 29, 149, 0.08);
  --shadow-pop: 0 16px 40px rgba(76, 29, 149, 0.16);
  --chrome-bg: rgba(250, 247, 255, 0.82);
}

body {
  font-family: "Inter", "DM Sans", system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  color: var(--text);
  background:
    radial-gradient(ellipse 60% 45% at 15% -10%, var(--aurora-1), transparent 70%),
    radial-gradient(ellipse 50% 40% at 100% 0%, var(--aurora-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

.photo-aurora { display: none; }

.ui-icon { flex-shrink: 0; display: block; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  border-radius: 10px;
  font-size: 0.9rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn-primary,
.btn-primary.generate-btn,
.btn-primary.faceswap-generate-btn {
  color: #fff;
  background: var(--grad-brand);
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 6px 18px var(--cta-glow);
  filter: none;
  transition: box-shadow 0.2s ease, opacity 0.15s ease;
}

.btn-primary:hover:not(:disabled),
.btn-primary.generate-btn:hover:not(:disabled) {
  background: var(--grad-brand-hover);
  filter: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 8px 26px var(--cta-glow);
}

.btn-primary:disabled,
.btn-primary.generate-btn:disabled {
  opacity: 0.45;
  filter: none;
  box-shadow: none;
}

.btn-primary.generate-btn {
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0;
}

.generate-btn-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generate-btn .coin-cost-num { color: #fde68a; }

.btn-secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled),
.btn-outline:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn:disabled { cursor: not-allowed; }

/* Header */
.app-chrome-fixed {
  background: var(--chrome-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
}

.top-bar { min-height: 3rem; }

.top-bar-home {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  height: 2.5rem;
  padding: 0 0.5rem 0 0.3rem;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.top-bar-home img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.top-bar-home:hover {
  color: var(--text);
  background: var(--surface);
}

.top-bar-home:focus-visible,
.site-hero--settings:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 10px;
}

.top-bar-divider {
  width: 1px;
  height: 1.5rem;
  background: var(--border-strong);
  flex-shrink: 0;
}

.site-hero--inline { gap: 0.65rem; }

.site-hero--inline .site-hero-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: none;
}

.site-hero--inline h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.site-hero--inline .site-hero-lead {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.top-bar-actions { gap: 0.5rem; }

.ongoing-tasks-badge {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ongoing-tasks-badge:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.ongoing-tasks-badge:focus-visible,
.account-block:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.ongoing-tasks-badge.is-active {
  color: var(--text);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.ongoing-tasks-count {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.coin-chip {
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(250, 204, 21, 0.22);
  background: rgba(250, 204, 21, 0.08);
  box-shadow: none;
}

.account-avatar { width: 34px; height: 34px; }

/* Tabs — quiet segmented control */
.photo-tabs {
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.photo-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.photo-tab:hover:not(.is-on) {
  color: var(--text);
  background: var(--surface);
}

.photo-tab:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.photo-tab.is-on {
  color: var(--text);
  font-weight: 600;
  background: var(--surface-hover);
  border-color: var(--border-strong);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.photo-tab.is-on .ui-icon { color: var(--accent); }

.photo-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main panel + cards */
.app-panel {
  position: relative;
  background: var(--bg-elevated);
  border-color: var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.app-panel.is-entering .workspace > * {
  animation: photo-fade 0.2s ease-out both;
}

@keyframes photo-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.card {
  background: var(--surface);
  border-color: var(--border);
  border-radius: var(--radius);
}

.card h2,
.compare-card figcaption {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.slot-step {
  display: inline-grid;
  place-items: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  font-size: 0.7rem;
  letter-spacing: 0;
  color: var(--text);
  background: var(--surface-hover);
  border: 1px solid var(--border-strong);
}

.slot-pick-card.is-filled .slot-step {
  background: var(--accent-strong);
  border-color: transparent;
  color: #fff;
}

/* Upload zones */
.pick-zone {
  position: relative;
  gap: 0.35rem;
  border: 1.5px dashed var(--border-strong);
  background: var(--tint-1);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pick-zone-body,
.pick-zone-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.pick-zone-compact {
  justify-content: center;
  text-align: center;
}

.pick-zone strong {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.pick-zone-compact strong { font-size: 0.9rem; }

.pick-zone p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pick-zone-icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 0.4rem;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  box-shadow: none;
}

.pick-zone-compact .pick-zone-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
}

.pick-zone:hover,
.slot-preview:focus-within .pick-zone {
  border-color: var(--accent-border);
  background: rgba(139, 92, 246, 0.05);
}

[data-drop].is-dragover .pick-zone,
.pick-zone[data-drop].is-dragover,
[data-drop].is-dragover .preview-wrap,
.ba-slider.is-dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3);
}

/* Filled slot — "Change" pill on hover / focus (always visible on touch) */
.slot-preview .preview-wrap { transition: border-color 0.15s ease; }

.slot-preview:hover .preview-wrap { border-color: var(--border-strong); }

.slot-change-overlay {
  position: absolute;
  left: 50%;
  bottom: 0.7rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(11, 11, 18, 0.85);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.slot-preview:hover .slot-change-overlay,
.slot-preview:focus-within .slot-change-overlay { opacity: 1; }

@media (hover: none) {
  .slot-change-overlay { opacity: 0.92; }
}

/* Prompt fields */
.field label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.field textarea {
  border-radius: 10px;
  border-color: var(--border-strong);
  background: var(--bg);
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea::placeholder { color: var(--placeholder); }

.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.style-hint { color: var(--text-muted); }

/* Combine background choice — segmented options */
.background-row {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-option {
  flex: 1 1 auto;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 0.85rem;
  white-space: nowrap;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.radio-option:hover { background: var(--surface-hover); }

.radio-option:has(input:checked) {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.radio-option:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.model-dropup-trigger { border-radius: 10px; }

/* Progress */
.progress-fill {
  background: var(--grad-brand);
  box-shadow: 0 0 12px var(--cta-glow);
}

.preview-wrap.is-generating::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(11, 11, 18, 0.35);
  pointer-events: none;
}

.preview-progress {
  z-index: 2;
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  background: transparent;
}

/* Result + before/after */
.preview-wrap { background: var(--media-bg); }

.preview-wrap-clickable:not(:disabled):hover { outline-color: var(--focus-ring); }

.ba-slider { border: 1px solid var(--border); }

.ba-slider-knob {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.ba-badge-after { background: var(--accent-strong); }

.ba-compare-actions .btn { flex: 1 1 auto; }

.result-save-chip { background: rgba(11, 11, 18, 0.85); }

/* Style tab — categories, sub-tabs, look chips */
.style-pill {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.style-pill:hover:not(.is-on) {
  color: var(--text);
  background: var(--surface-hover);
}

.style-pill.is-on {
  color: var(--text);
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: none;
}

.sub-tabs { gap: 0.35rem; }

.sub-tab {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sub-tab:hover:not(.is-on):not(:disabled) { color: var(--text); }

.sub-tab.is-on {
  box-shadow: none;
  color: var(--text);
  background: var(--accent-soft);
}

.style-chip {
  border-color: var(--border);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.style-chip:hover:not(:disabled) { border-color: var(--border-strong); }

.style-chip:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.style-chip.is-on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.style-chip-check {
  inset: auto 0.3rem auto auto;
  top: 0.3rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.style-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.style-chips,
.style-pills,
.sub-tabs {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* Popups + toast */
.settings-sheet,
.confirm-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.toast {
  background: var(--surface);
  border-color: var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  box-shadow: var(--shadow-pop);
  animation: photo-fade 0.2s ease-out both;
}

.error-banner { border-radius: 10px; }

/* Small screens — icon-over-label tabs, compact header */
@media (max-width: 720px) {
  .top-bar { flex-wrap: nowrap; align-items: center; }
  .top-bar-divider { display: none; }
  .top-bar-home img { display: none; }
}

@media (max-width: 560px) {
  .photo-app.page { padding: 0 0.85rem 2.5rem; }
  .app-chrome-fixed { margin: 0 -0.85rem; padding: 0.6rem 0.85rem 0.55rem; }
  .app-panel { padding: 0.9rem; border-radius: 14px; }
  .top-bar-actions { gap: 0.35rem; }
  .site-hero--inline .site-hero-icon { width: 32px; height: 32px; }
  .coin-chip { padding: 0 0.55rem; }

  .photo-tab {
    flex-direction: column;
    gap: 0.2rem;
    min-height: 3.25rem;
    font-size: 0.72rem;
  }

  .ba-compare-actions .btn { flex: 1 1 calc(50% - 0.5rem); }
}

@media (prefers-reduced-motion: reduce) {
  .app-panel.is-entering .workspace > *,
  .toast {
    animation: none;
  }

  .btn,
  .photo-tab,
  .pick-zone,
  .slot-change-overlay,
  .top-bar-home,
  .ongoing-tasks-badge {
    transition: none;
  }
}

/* ==========================================================================
 * Shell — BandUp 9 layout: sticky left panel (≥960px) + main column.
 * Below 960px the panel is hidden and the top bar + segmented tabs take over.
 * ========================================================================== */

.photo-app.page.is-shell {
  max-width: none;
  padding: 0;
}

.photo-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.photo-main {
  flex: 1;
  min-width: 0;
  padding: 0 1.5rem 3rem;
}

.photo-main-inner {
  max-width: var(--page-max);
  margin: 0 auto;
}

.side-nav { display: none; }

.top-bar-title { display: none; }

/* Brand */
.side-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin: 0 0 1.5rem;
  padding: 0.25rem 0.5rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.side-brand img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
}

.side-brand > span { min-width: 0; }

.side-brand strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.side-brand span span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Links */
.side-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.side-link:hover {
  background: var(--surface);
  color: var(--text);
}

.side-link.is-active {
  position: relative;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.side-link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--grad-brand);
}

/* Footer of the panel: coins, account, back to studio */
.side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.side-coins {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.875rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.side-coins-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.side-coins-value {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--coin-yellow);
}

.side-coins-value strong {
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.side-coins-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.side-coins-topup {
  min-height: 2rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
}

.side-account {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

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

.side-account-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.side-account-text strong,
.side-account-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-account-text strong { font-size: 0.9rem; }

.side-account-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.side-home {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0 0.5rem;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.side-home:hover {
  color: var(--text);
  background: var(--surface);
}

.side-brand:focus-visible,
.side-link:focus-visible,
.side-account:focus-visible,
.side-home:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (min-width: 960px) {
  .side-nav {
    display: flex;
    flex-direction: column;
    width: 256px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    padding: 1.25rem 0.875rem;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
  }

  .photo-main { padding: 0 2rem 2.5rem; }

  .app-chrome-fixed {
    margin: 0 -2rem;
    padding: 1rem 2rem 0.85rem;
  }

  /* Panel owns brand, tabs, coins, and account on desktop. */
  .top-bar { margin-bottom: 0; min-height: 2.5rem; }
  .top-bar-home,
  .top-bar-divider,
  .site-hero--settings,
  .photo-tabs,
  .top-bar .coin-chip,
  .top-bar .account-block,
  .top-bar .top-up-btn { display: none; }

  .top-bar-title {
    display: block;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
  }
}

@media (max-width: 560px) {
  .photo-app.page.is-shell { padding: 0; }
  .photo-main { padding: 0 0.85rem 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .side-link,
  .side-account,
  .side-home { transition: none; }
}

/*
 * Footer: a flush bar spanning the whole main column, pinned to the bottom when content is short.
 * It bleeds over .photo-main's side gutter (--photo-gutter) while its text lines up with the
 * centered content column (--page-max).
 */
.photo-main {
  --photo-gutter: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.photo-main-inner { width: 100%; }

.photo-main-inner > .app-panel { margin-bottom: 2.5rem; }

.photo-main,
.photo-app.page.is-shell .photo-main { padding-bottom: 0; }

.photo-main > .company-footer {
  margin: auto calc(-1 * var(--photo-gutter)) 0;
  padding-left: max(var(--photo-gutter), calc((100% + 2 * var(--photo-gutter) - var(--page-max)) / 2));
  padding-right: max(var(--photo-gutter), calc((100% + 2 * var(--photo-gutter) - var(--page-max)) / 2));
}

@media (min-width: 960px) {
  .photo-main { --photo-gutter: 2rem; }
}

@media (max-width: 560px) {
  .photo-main { --photo-gutter: 0.85rem; }
}

/* ==========================================================================
 * Themes — toggle, gradient accents, and light overrides for legacy rules
 * above that hard-code dark tints. Overlays that sit on photos (save chip,
 * badges, "Change" pill, progress veil) stay dark in both themes on purpose.
 * ========================================================================== */

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--accent-text);
  border-color: var(--accent-border);
  background: var(--surface-hover);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.theme-icon-sun { display: block; }
.theme-icon-moon { display: none; }
:root[data-theme="light"] .theme-icon-sun { display: none; }
:root[data-theme="light"] .theme-icon-moon { display: block; }

/* Gradient accents */
.side-brand strong,
.top-bar-title,
.site-hero--inline h1 {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.slot-pick-card.is-filled .slot-step,
.ongoing-tasks-count,
.style-chip-check,
.ba-badge-after { background: var(--grad-brand); }

.photo-tab.is-on { box-shadow: inset 0 -2px 0 var(--accent), 0 1px 8px var(--accent-soft); }

.pick-zone-icon {
  background: linear-gradient(135deg, var(--accent-soft), rgba(192, 38, 211, 0.12));
}

.app-panel {
  background:
    linear-gradient(180deg, var(--tint-1), transparent 120px),
    var(--bg-elevated);
}

.side-nav {
  background:
    radial-gradient(ellipse 120% 40% at 0% 0%, var(--accent-soft), transparent 70%),
    var(--bg-elevated);
}

.style-chip.is-on { box-shadow: 0 0 0 1px var(--accent), 0 6px 18px var(--accent-soft); }

.ongoing-task-row { background: var(--surface); }
.ongoing-task-phase:not(.is-queued) { background: var(--info-soft); }
.ongoing-task-phase.is-queued { background: var(--tint-2); }

/* Shared scrims */
.settings-panel,
.confirm-backdrop,
.ongoing-tasks-backdrop,
.lang-dialog-backdrop { background: var(--scrim); }

/* Light overrides for legacy dark-tinted rules */
:root[data-theme="light"] .account-avatar--icon,
:root[data-theme="light"] .progress-track { background: var(--tint-3); }

:root[data-theme="light"] .model-dropup-trigger,
:root[data-theme="light"] .model-select-inline,
:root[data-theme="light"] .model-picker-row select {
  color: var(--text);
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

:root[data-theme="light"] .model-dropup-trigger:hover {
  background: var(--surface);
  border-color: var(--accent-border);
}

:root[data-theme="light"] .model-dropup-menu {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-pop);
}

:root[data-theme="light"] .model-dropup-item:hover,
:root[data-theme="light"] .app-popup-close:hover,
:root[data-theme="light"] .btn-outline:hover,
:root[data-theme="light"] .lang-dialog-option:hover,
:root[data-theme="light"] .lang-dialog-option:focus-visible { background: var(--tint-2); }

:root[data-theme="light"] .model-dropup-item.is-selected,
:root[data-theme="light"] .lang-dialog-option--active {
  color: var(--accent-text);
  background: var(--accent-soft);
}

:root[data-theme="light"] .settings-language-row { background: var(--bg-elevated); }

:root[data-theme="light"] .settings-language-row:hover,
:root[data-theme="light"] .settings-language-row:focus-visible {
  background: var(--surface);
  border-color: var(--accent-border);
}

:root[data-theme="light"] .ba-slider,
:root[data-theme="light"] .style-chip-art { background: var(--media-bg); }

:root[data-theme="light"] .style-chip-art.is-loading::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
}

:root[data-theme="light"] .style-chips-loading { background: rgba(250, 247, 255, 0.85); }

:root[data-theme="light"] .btn-danger,
:root[data-theme="light"] .error-banner,
:root[data-theme="light"] .staff-log-body { color: var(--danger-text); }

:root[data-theme="light"] .staff-log-tag { color: var(--accent-text); }

:root[data-theme="light"] .coin-chip {
  border-color: rgba(180, 83, 9, 0.25);
  background: rgba(250, 204, 21, 0.14);
}

:root[data-theme="light"] .style-chip-check,
:root[data-theme="light"] .ba-slider-knob { box-shadow: 0 2px 8px rgba(76, 29, 149, 0.25); }

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .btn-primary { transition: none; }
}

/* ==========================================================================
 * Aurora glass — slow-drifting color mesh behind frosted surfaces with
 * gradient hairline borders. Glass stays ≥72% opaque so body text keeps
 * 4.5:1 contrast; motion is disabled under prefers-reduced-motion.
 * ========================================================================== */

:root,
:root[data-theme="dark"] {
  --mesh-a: rgba(124, 58, 237, 0.34);
  --mesh-b: rgba(192, 38, 211, 0.2);
  --mesh-c: rgba(56, 189, 248, 0.12);
  --glass: rgba(20, 17, 36, 0.72);
  --glass-strong: rgba(24, 21, 42, 0.9);
  --glass-highlight: rgba(255, 255, 255, 0.05);
  --card-bg: rgba(255, 255, 255, 0.035);
  --grad-border: linear-gradient(135deg, rgba(167, 139, 250, 0.55), rgba(255, 255, 255, 0.05) 40%, rgba(255, 255, 255, 0.05) 60%, rgba(240, 171, 252, 0.4));
}

:root[data-theme="light"] {
  --mesh-a: rgba(167, 139, 250, 0.42);
  --mesh-b: rgba(244, 114, 182, 0.26);
  --mesh-c: rgba(125, 211, 252, 0.3);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --glass-highlight: rgba(255, 255, 255, 0.9);
  --card-bg: rgba(255, 255, 255, 0.78);
  --grad-border: linear-gradient(135deg, rgba(124, 58, 237, 0.38), rgba(124, 58, 237, 0.07) 40%, rgba(124, 58, 237, 0.07) 60%, rgba(192, 38, 211, 0.3));
}

::selection { background: var(--accent-soft); color: var(--text); }

body { background: var(--bg); }

body::before {
  content: "";
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(32vmax 32vmax at 18% 12%, var(--mesh-a), transparent 70%),
    radial-gradient(28vmax 28vmax at 88% 18%, var(--mesh-b), transparent 70%),
    radial-gradient(34vmax 30vmax at 70% 92%, var(--mesh-c), transparent 70%);
  animation: photo-aurora-drift 36s ease-in-out infinite alternate;
}

@keyframes photo-aurora-drift {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(-3vmax, 2vmax, 0) rotate(4deg); }
  100% { transform: translate3d(2vmax, -2vmax, 0) rotate(-3deg); }
}

/* Frosted surfaces */
.app-panel,
.side-nav,
.toast,
.model-dropup-menu {
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}

.app-panel {
  background:
    linear-gradient(180deg, var(--glass-highlight), transparent 140px),
    var(--glass);
  border-color: transparent;
}

.app-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: var(--grad-border);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.settings-sheet,
.confirm-panel,
.ongoing-tasks-sheet {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: var(--shadow-pop);
}

.toast,
.model-dropup-menu { background: var(--glass-strong); }

.card {
  background: var(--card-bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover { border-color: var(--border-strong); }

@media (min-width: 960px) {
  .side-nav {
    background:
      radial-gradient(ellipse 140% 35% at 0% 0%, var(--accent-soft), transparent 70%),
      var(--glass);
    border-right-color: var(--border);
  }
}

.app-chrome-fixed {
  background: var(--chrome-bg);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
}

/* Brand glow */
.side-brand img,
.site-hero--inline .site-hero-icon { box-shadow: 0 6px 20px var(--cta-glow); }

/* Active navigation — gradient wash */
.side-link.is-active {
  background: linear-gradient(90deg, var(--accent-soft), transparent 95%);
}

.photo-tab.is-on {
  color: var(--accent-text);
  background: linear-gradient(135deg, var(--accent-soft), rgba(192, 38, 211, 0.1));
  border-color: var(--accent-border);
  box-shadow: 0 4px 14px var(--accent-soft);
}

.style-pill.is-on,
.sub-tab.is-on,
.radio-option:has(input:checked) {
  background: linear-gradient(135deg, var(--accent-soft), rgba(192, 38, 211, 0.1));
}

/* Upload zones — glow on hover / drag */
.pick-zone:hover,
.slot-preview:focus-within .pick-zone {
  box-shadow: inset 0 0 0 1px var(--accent-soft), 0 0 28px var(--accent-soft);
}

/* Primary CTA — one-shot sheen on hover */
.btn-primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  transform: translateX(-120%);
  pointer-events: none;
}

.btn-primary:hover:not(:disabled)::after {
  transform: translateX(120%);
  transition: transform 0.7s var(--ease-out);
}

/* Coin balance — gold gradient */
.side-coins {
  background:
    linear-gradient(135deg, rgba(250, 204, 21, 0.1), transparent 60%),
    var(--card-bg);
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .btn-primary::after { display: none; }
  .card { transition: none; }
}

/* Staff-only debug options (keep face / Insight face / original quality) */
:root,
:root[data-theme="dark"] {
  --staff-text: #fcd34d;
  --staff-bg: rgba(245, 158, 11, 0.12);
  --staff-border: rgba(245, 158, 11, 0.4);
}

:root[data-theme="light"] {
  --staff-text: #92400e;
  --staff-bg: rgba(245, 158, 11, 0.12);
  --staff-border: rgba(217, 119, 6, 0.45);
}

.keep-face-model-row.is-staff-only {
  padding: 0.625rem 0.75rem 0.7rem;
  border: 1px dashed var(--staff-border);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--staff-bg), transparent 70%);
}

.staff-only-tag {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--staff-border);
  background: var(--staff-bg);
  color: var(--staff-text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ==========================================================================
 * Premium History — side-nav entry, mobile header button, results grid.
 * ========================================================================== */

.side-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.side-section-label {
  padding: 0 0.75rem 0.15rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.side-pro-badge {
  margin-left: auto;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--grad-brand);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

.history-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.history-btn:hover,
.history-btn.is-active {
  color: var(--accent-text);
  border-color: var(--accent-border);
  background: var(--surface-hover);
}

.history-btn:focus-visible,
.history-action:focus-visible,
.history-thumb:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (min-width: 960px) {
  .history-btn { display: none; }
}

.history-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.history-head h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.history-head h2 .ui-icon { color: var(--accent-text); }
.history-head h2 .side-pro-badge { margin-left: 0.15rem; }

.history-head p {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.history-clear { gap: 0.4rem; }

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--glass, var(--surface));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.history-item:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-pop, 0 12px 32px rgba(0, 0, 0, 0.25));
}

.history-item.is-skeleton {
  aspect-ratio: 4 / 5;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-hover) 50%, var(--surface) 70%);
  background-size: 200% 100%;
  animation: history-shimmer 1.4s linear infinite;
}

@keyframes history-shimmer {
  to { background-position: -200% 0; }
}

.history-thumb {
  display: block;
  aspect-ratio: 1;
  background: var(--media-bg, var(--surface));
}

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

.history-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem 0.6rem 0.75rem;
}

.history-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.history-meta strong {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 650;
}

.history-meta time {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.74rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-actions {
  display: flex;
  flex-shrink: 0;
}

.history-action {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.history-action:hover {
  background: var(--surface-hover);
  color: var(--accent-text);
}

.history-action.is-danger:hover { color: var(--danger-text, var(--danger)); }

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 3rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 18px;
  text-align: center;
}

.history-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 0.25rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.history-empty strong { color: var(--text); font-size: 1rem; }

.history-empty p {
  max-width: 28ch;
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

@media (max-width: 560px) {
  .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
  .history-info { flex-direction: column; align-items: stretch; padding: 0.5rem; }
  .history-actions { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  .history-item,
  .history-btn,
  .history-action { transition: none; }
  .history-item.is-skeleton { animation: none; }
}

/* ==========================================================================
 * Home landing — hero + live style mosaic, tool bento, Style shortcuts,
 * how-it-works, final CTA. Every card deep-links into its tab.
 * ========================================================================== */

.app-panel.is-home {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.app-panel.is-home::before { display: none; }

.photo-tab.is-home { flex: 0 0 auto; padding-inline: 0.8rem; }

.home-view {
  --home-radius: 24px;
  display: flex;
  flex-direction: column;
  gap: clamp(2.75rem, 6vw, 4.5rem);
  padding-top: 0.25rem;
}

.app-panel.is-entering .home-view > * { animation: home-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.app-panel.is-entering .home-view > *:nth-child(2) { animation-delay: 0.06s; }
.app-panel.is-entering .home-view > *:nth-child(3) { animation-delay: 0.12s; }

@keyframes home-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Hero */
.home-hero {
  position: relative;
  display: grid;
  gap: 2rem;
  align-items: center;
  overflow: hidden;
  padding: clamp(1.5rem, 4vw, 3rem);
  border-radius: calc(var(--home-radius) + 6px);
  background:
    radial-gradient(60% 80% at 0% 0%, var(--mesh-a), transparent 70%),
    radial-gradient(55% 70% at 100% 100%, var(--mesh-b), transparent 70%),
    radial-gradient(40% 50% at 70% 10%, var(--mesh-c), transparent 70%),
    var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-pop);
}

.home-hero::before,
.home-final::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: var(--grad-border);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.home-hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.15rem;
}

.home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.8rem;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.home-hero-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(2.2rem, 5vw, 3.75rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.home-hero-gradient {
  display: block;
  padding-bottom: 0.06em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-hero-sub {
  max-width: 34rem;
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 1.6;
}

.home-hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.home-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 1.35rem;
  border-radius: 14px;
  font-size: 0.98rem;
  font-weight: 650;
}

.home-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.25rem;
  margin: 0.6rem 0 0;
  padding: 1.1rem 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.home-stats li { display: flex; flex-direction: column; gap: 0.1rem; }

.home-stats strong {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.home-stats span { color: var(--text-muted); font-size: 0.82rem; }

/* Hero art: tilted, auto-scrolling portrait mosaic */
.home-hero-art {
  position: relative;
  height: 340px;
}

.home-mosaic {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  height: 100%;
  overflow: hidden;
  transform: rotate(-5deg) scale(1.06);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent);
}

.home-mosaic-col:nth-child(2) { margin-top: -3.5rem; }

.home-mosaic-track {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: home-scroll 34s linear infinite;
}

.home-mosaic-col:nth-child(2) .home-mosaic-track { animation-duration: 40s; animation-direction: reverse; }
.home-mosaic-col:nth-child(3) .home-mosaic-track { animation-duration: 30s; }

@keyframes home-scroll {
  to { transform: translateY(calc(-50% - 0.375rem)); }
}

.home-mosaic-tile {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.home-mosaic-tile img,
.home-category img,
.home-feature-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-float {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 70%;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
  animation: home-bob 6s ease-in-out infinite;
}

.home-float span { overflow: hidden; text-overflow: ellipsis; }
.home-float .ui-icon { flex-shrink: 0; color: var(--accent-text); }
.home-float.is-a { top: 10%; left: 2%; }
.home-float.is-b { bottom: 12%; left: 6%; animation-delay: -2s; }
.home-float.is-c { top: 44%; right: 2%; animation-delay: -4s; }
.home-float.is-c .ui-icon { color: #34d399; }

@keyframes home-bob {
  50% { transform: translateY(-8px); }
}

/* Section heads */
.home-section { display: flex; flex-direction: column; gap: 1.5rem; }

.home-section-head { display: flex; flex-direction: column; gap: 0.45rem; max-width: 40rem; }

.home-kicker {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  justify-self: start;
  width: fit-content;
}

.home-section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.45rem, 2.8vw, 2.05rem);
  font-weight: 780;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.home-section-head p { margin: 0; color: var(--text-muted); font-size: 0.98rem; line-height: 1.55; }

/* Feature bento */
.home-features,
.home-categories,
.home-steps {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-features { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.home-feature {
  --feat: #a78bfa;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--home-radius);
  background: var(--card-bg);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.2s ease, box-shadow 0.25s ease;
}

.home-feature[data-accent="pink"] { --feat: #f472b6; }
.home-feature[data-accent="cyan"] { --feat: #22d3ee; }
.home-feature[data-accent="amber"] { --feat: #fbbf24; }
:root[data-theme="light"] .home-feature { --feat: #7c3aed; }
:root[data-theme="light"] .home-feature[data-accent="pink"] { --feat: #db2777; }
:root[data-theme="light"] .home-feature[data-accent="cyan"] { --feat: #0891b2; }
:root[data-theme="light"] .home-feature[data-accent="amber"] { --feat: #d97706; }

.home-feature:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--feat) 55%, transparent);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--feat) 22%, transparent);
}

.home-feature:focus-visible,
.home-category:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.home-feature-visual {
  position: relative;
  display: grid;
  place-items: center;
  height: 172px;
  overflow: hidden;
  background:
    radial-gradient(80% 90% at 50% 110%, color-mix(in srgb, var(--feat) 42%, transparent), transparent 70%),
    var(--surface);
  border-bottom: 1px solid var(--border);
}

.home-feature-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
  padding: 1.1rem 1.2rem 1.25rem;
}

.home-feature-icon {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  margin-bottom: 0.2rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--feat) 16%, transparent);
  color: var(--feat);
}

.home-feature-body strong { color: var(--text); font-size: 1.06rem; font-weight: 700; }
.home-feature-body > span:not([class]) { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }

.home-feature-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--feat);
  font-size: 0.88rem;
  font-weight: 700;
}

.home-feature-link .ui-icon { transition: transform 0.2s ease; }
.home-feature:hover .home-feature-link .ui-icon { transform: translateX(4px); }

/* Edit visual: blurred portrait + prompt bar */
.home-visual-backdrop { position: absolute; inset: 0; opacity: 0.55; filter: saturate(1.1); }
.home-visual-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(10, 9, 20, 0.6)); }

.home-prompt-mock {
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(16, 14, 30, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #f5f3ff;
  font-size: 0.82rem;
  font-weight: 600;
}

.home-prompt-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.home-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  background: currentColor;
  animation: home-caret 1s steps(1) infinite;
}

@keyframes home-caret { 50% { opacity: 0; } }

.home-prompt-go {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--grad-brand);
  color: #fff;
}

/* Style visual: fanned cards */
.home-fan { position: relative; width: 84px; height: 112px; }

.home-fan-card {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  transform: translateX(calc((var(--i) - 1) * 46px)) rotate(calc((var(--i) - 1) * 12deg));
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.home-fan-card:nth-child(2) { z-index: 1; transform: translateY(-6px) scale(1.06); }
.home-feature:hover .home-fan-card { transform: translateX(calc((var(--i) - 1) * 60px)) rotate(calc((var(--i) - 1) * 16deg)); }
.home-feature:hover .home-fan-card:nth-child(2) { transform: translateY(-10px) scale(1.1); }

/* Combine visual: two faces merging */
.home-merge { display: flex; align-items: center; }

.home-merge-face {
  width: 88px;
  height: 88px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.home-merge-face.is-left { transform: translateX(10px); }
.home-merge-face.is-right { transform: translateX(-10px); }

.home-merge-plus {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: var(--grad-brand);
  color: #fff;
}

.home-feature:hover .home-merge-face.is-left { transform: translateX(18px); }
.home-feature:hover .home-merge-face.is-right { transform: translateX(-18px); }

/* Clothes visual: portrait → garment */
.home-tryon { display: flex; align-items: center; gap: 0.6rem; }

.home-tryon-photo,
.home-tryon-garment {
  display: grid;
  place-items: center;
  width: 84px;
  height: 112px;
  overflow: hidden;
  border-radius: 14px;
}

.home-tryon-photo { border: 2px solid rgba(255, 255, 255, 0.85); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3); }
.home-tryon-garment { border: 2px dashed color-mix(in srgb, var(--feat) 70%, transparent); background: color-mix(in srgb, var(--feat) 12%, transparent); color: var(--feat); }
.home-tryon-arrow { color: var(--feat); transition: transform 0.25s ease; }
.home-feature:hover .home-tryon-arrow { transform: translateX(4px); }

/* Style category shortcuts */
.home-categories { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.home-category {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.25s ease;
}

.home-category img { transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.home-category:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.home-category:hover img { transform: scale(1.07); }

.home-category-label {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 2.5rem 0.9rem 0.85rem;
  background: linear-gradient(180deg, transparent, rgba(8, 6, 18, 0.82));
  color: #fff;
  text-align: left;
}

.home-category-label strong { font-size: 0.98rem; font-weight: 700; }
.home-category-label span { color: rgba(255, 255, 255, 0.8); font-size: 0.78rem; }

/* How it works */
.home-steps { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: none; }

.home-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow: hidden;
  padding: 1.35rem 1.3rem;
  border: 1px solid var(--border);
  border-radius: var(--home-radius);
  background: var(--card-bg);
}

.home-step-num {
  position: absolute;
  top: -0.6rem;
  right: 0.8rem;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 4.5rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0.22;
}

.home-step-icon {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.35rem;
  border-radius: 12px;
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
}

.home-step strong { color: var(--text); font-size: 1.02rem; font-weight: 700; }
.home-step > span:last-child { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }

/* Final CTA */
.home-final {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 3.25rem) 1.5rem;
  border-radius: calc(var(--home-radius) + 6px);
  background:
    radial-gradient(50% 120% at 50% 0%, var(--mesh-a), transparent 70%),
    radial-gradient(40% 90% at 100% 100%, var(--mesh-b), transparent 70%),
    var(--glass);
  text-align: center;
}

.home-final h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.home-final p { margin: 0 0 0.6rem; color: var(--text-muted); font-size: 1rem; }

@media (min-width: 960px) {
  .home-hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 2.5rem; }
  .home-hero-art { height: 460px; }
}

@media (max-width: 560px) {
  .home-hero { padding: 1.35rem 1.1rem 0; border-radius: 22px; }
  .home-hero-art { height: 270px; margin: 0 -1.1rem; }
  .home-hero-ctas { width: 100%; }
  .home-hero-ctas .home-cta { flex: 1 1 100%; }
  .home-stats { gap: 0.75rem 1.5rem; }
  .home-stats strong { font-size: 1.4rem; }
  .home-categories { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-float { font-size: 0.74rem; }
}

@media (prefers-reduced-motion: reduce) {
  .home-mosaic-track,
  .home-float,
  .home-caret,
  .app-panel.is-entering .home-view > * { animation: none; }
  .home-feature,
  .home-category,
  .home-category img,
  .home-fan-card,
  .home-merge-face,
  .home-tryon-arrow,
  .home-feature-link .ui-icon { transition: none; }
}
