:root {
  --background: #ffffff;
  --surface: #f5f7f6;
  --surface-strong: #e9efed;
  --ink: #18201f;
  --muted: #697674;
  --line: #dbe3e0;
  --teal: #0f6f68;
  --teal-dark: #0a4e49;
  --coral: #d97059;
  --shadow: 0 24px 70px rgba(26, 41, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

[hidden] {
  display: none !important;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.app-shell {
  min-height: 100vh;
  padding: 24px clamp(18px, 4vw, 56px) 34px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto 28px;
  max-width: 1320px;
}

.brand {
  align-items: center;
  display: inline-flex;
  font-size: 19px;
  font-weight: 760;
  gap: 10px;
}

.brand__mark {
  align-items: center;
  background: var(--teal);
  border-radius: 8px;
  color: white;
  display: inline-flex;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.brand__mark svg {
  height: 21px;
  width: 21px;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-links a {
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  padding: 10px 13px;
}

.nav-links a:hover {
  background: var(--surface);
  color: var(--ink);
}

.workspace {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.75fr);
  margin: 0 auto;
  max-width: 1320px;
}

.workflow-panel,
.catalog-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.workflow-panel {
  overflow: hidden;
  padding: clamp(20px, 3vw, 34px);
}

.intro {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(260px, 0.72fr) minmax(240px, 0.5fr);
  margin-bottom: 24px;
}

.intro h1 {
  font-size: clamp(36px, 5vw, 72px);
  font-weight: 780;
  line-height: 0.96;
  margin: 0;
  max-width: 650px;
}

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

.tryon-form {
  display: grid;
  gap: 16px;
}

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

.media-stage {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.stage-heading {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 720;
  justify-content: space-between;
}

.upload-zone,
.result-frame {
  align-items: center;
  aspect-ratio: 4 / 5;
  background: linear-gradient(135deg, rgba(15, 111, 104, 0.08), rgba(217, 112, 89, 0.1)), #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 320px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.upload-zone {
  cursor: pointer;
  padding: 18px;
  transition: border-color 180ms ease, transform 180ms ease;
}

.upload-zone:hover {
  border-color: rgba(15, 111, 104, 0.45);
  transform: translateY(-1px);
}

.upload-zone img,
.result-frame img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.upload-zone__empty,
.result-placeholder {
  align-items: center;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  font-weight: 700;
  gap: 12px;
  max-width: 220px;
  text-align: center;
}

.upload-zone__empty svg,
.result-placeholder svg {
  height: 30px;
  width: 30px;
}

.result-frame--loading {
  border-color: rgba(15, 111, 104, 0.42);
}

.selected-summary {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: 74px minmax(0, 1fr) 42px;
  padding: 12px;
}

.selected-summary__copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.selected-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.selected-summary strong {
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-summary small {
  color: var(--muted);
  font-size: 13px;
}

.selected-summary a {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal);
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.action-row {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: max-content minmax(0, 1fr);
}

.primary-button {
  align-items: center;
  background: var(--teal);
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  font-weight: 760;
  gap: 9px;
  min-height: 48px;
  padding: 0 20px;
}

.primary-button:hover:not(:disabled) {
  background: var(--teal-dark);
}

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

.status-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
}

.status-copy--error {
  color: #a33d31;
}

.status-copy--success {
  color: var(--teal-dark);
}

.catalog-panel {
  align-self: start;
  padding: 20px;
}

.catalog-heading {
  margin-bottom: 16px;
}

.catalog-heading h2 {
  font-size: 24px;
  line-height: 1.05;
  margin: 0 0 7px;
}

.catalog-heading p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
}

.filters {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
  padding: 4px;
}

.filter {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 720;
  min-height: 36px;
  padding: 0 8px;
}

.filter--active {
  background: var(--ink);
  color: #ffffff;
}

.catalog-list {
  display: grid;
  gap: 10px;
}

.catalog-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 12px;
  grid-template-columns: 78px minmax(0, 1fr) 28px;
  padding: 10px;
  text-align: left;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.catalog-card:hover,
.catalog-card--selected {
  border-color: rgba(15, 111, 104, 0.5);
  box-shadow: 0 12px 28px rgba(26, 41, 38, 0.08);
  transform: translateY(-1px);
}

.catalog-card__meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.catalog-card__meta strong {
  font-size: 15px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-card__meta span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
}

.catalog-card__meta em {
  color: var(--coral);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.catalog-card__check {
  align-items: center;
  background: var(--teal);
  border-radius: 999px;
  color: white;
  display: inline-flex;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.garment-art {
  aspect-ratio: 1;
  background: var(--surface-strong);
  border-radius: 8px;
  color: var(--teal);
  display: grid;
  font-size: 18px;
  font-weight: 800;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.garment-art--teal {
  background: linear-gradient(135deg, #d9eeeb, #f4fbfa);
}

.garment-art--coral {
  background: linear-gradient(135deg, #f7ddd5, #fff7f4);
  color: var(--coral);
}

.garment-art--ink {
  background: linear-gradient(135deg, #dfe5e4, #f8faf9);
  color: var(--ink);
}

.garment-art--sage {
  background: linear-gradient(135deg, #dfeade, #f7fbf7);
  color: #54735f;
}

.garment-art img {
  height: 100%;
  object-fit: cover;
  position: relative;
  width: 100%;
  z-index: 1;
}

.garment-art img.is-broken {
  display: none;
}

.garment-art__fallback {
  position: relative;
  z-index: 1;
}

.garment-art::after {
  background: linear-gradient(180deg, transparent 42%, rgba(0, 0, 0, 0.22));
  content: "";
  inset: 0;
  position: absolute;
  z-index: 2;
}

.privacy-band {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  line-height: 1.5;
  margin: 18px auto 0;
  max-width: 1320px;
  padding: 14px 16px;
}

.privacy-band > span {
  color: var(--teal);
  font-size: 22px;
}

.privacy-band p {
  font-size: 13px;
  margin: 0;
}

.privacy-band code {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 12px;
  padding: 1px 5px;
}

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

.is-spinning {
  animation: spin 900ms linear infinite;
}

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

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

  .catalog-panel {
    align-self: stretch;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 12px 10px 22px;
  }

  .topbar {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }

  .brand {
    font-size: 17px;
  }

  .brand__mark {
    height: 34px;
    width: 34px;
  }

  .nav-links {
    gap: 2px;
  }

  .nav-links a {
    font-size: 13px;
    padding: 9px 7px;
  }

  .workflow-panel,
  .catalog-panel {
    border-radius: 8px;
    padding: 14px;
  }

  .intro {
    gap: 10px;
    margin-bottom: 16px;
  }

  .intro h1 {
    font-size: clamp(34px, 11vw, 42px);
    line-height: 1;
    max-width: 360px;
  }

  .intro p {
    font-size: 15px;
    line-height: 1.45;
  }

  .preview-grid,
  .action-row {
    grid-template-columns: 1fr;
  }

  .preview-grid {
    gap: 12px;
  }

  .stage-heading {
    font-size: 12px;
  }

  .upload-zone,
  .result-frame {
    aspect-ratio: 1 / 1.05;
    min-height: 0;
  }

  .selected-summary {
    grid-template-columns: 62px minmax(0, 1fr) 38px;
    gap: 10px;
    padding: 10px;
  }

  .selected-summary strong {
    font-size: 15px;
  }

  .selected-summary small {
    font-size: 12px;
  }

  .selected-summary a {
    height: 38px;
    width: 38px;
  }

  .primary-button {
    justify-content: center;
    min-height: 46px;
    width: 100%;
  }

  .status-copy {
    font-size: 13px;
  }

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

  .catalog-card {
    gap: 10px;
    grid-template-columns: 64px minmax(0, 1fr) 26px;
    padding: 9px;
  }

  .catalog-card__meta strong {
    font-size: 14px;
  }

  .catalog-card__meta span,
  .catalog-card__meta em {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-links {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 3px;
  }

  .nav-links a {
    text-align: center;
  }

  .workflow-panel,
  .catalog-panel,
  .privacy-band {
    box-shadow: 0 14px 34px rgba(26, 41, 38, 0.09);
  }

  .upload-zone__empty,
  .result-placeholder {
    font-size: 13px;
    max-width: 190px;
  }

  .catalog-heading h2 {
    font-size: 21px;
  }

  .catalog-heading p {
    font-size: 13px;
  }
}
