:root {
  color-scheme: light;
  --ink: #2c2430;
  --muted: #766d78;
  --paper: #fffaf7;
  --surface: #ffffff;
  --surface-soft: #f8f1ed;
  --coral: #f36c78;
  --coral-dark: #d94f60;
  --rose: #ffdfe1;
  --lilac: #eae0ff;
  --sage: #dcebdc;
  --line: #eadfda;
  --shadow: 0 16px 45px rgba(77, 49, 57, 0.1);
  --radius: 24px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 2%, rgba(255, 219, 222, 0.72), transparent 25rem),
    radial-gradient(circle at 95% 18%, rgba(229, 219, 255, 0.58), transparent 24rem), var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}
button {
  color: inherit;
}
img {
  display: block;
  max-width: 100%;
}

#app:focus {
  outline: none;
}

.app-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 0 18px 48px;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  width: calc(100% + 36px);
  margin-inline: -18px;
  padding: env(safe-area-inset-top) 20px 0;
  background: transparent;
  backdrop-filter: none;
}

.brand {
  position: absolute;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 120px);
  padding: 4px 0;
  border: 0;
  background: transparent;
  text-align: left;
  transform: translateX(-50%);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  max-width: 32px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.02;
}
.brand strong {
  font:
    700 20px/1 Georgia,
    serif;
}
.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  font-size: 23px;
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.hero {
  padding: 34px 2px 22px;
}
.eyebrow {
  margin: 0 0 7px;
  color: var(--coral-dark);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  max-width: 720px;
  margin-bottom: 11px;
  font:
    700 clamp(36px, 9vw, 68px)/0.98 Georgia,
    serif;
  letter-spacing: -0.035em;
}
.hero-copy {
  max-width: 580px;
  margin-bottom: 25px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 16px;
  border: 0;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.primary-button {
  background: var(--coral);
  color: white;
  box-shadow: 0 10px 24px rgba(243, 108, 120, 0.28);
}
.laboratory-entry {
  margin-left: 8px;
}
.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
}
.danger-button {
  background: #ffe5e5;
  color: #a92d3a;
}
.text-button {
  min-height: 40px;
  padding: 0 8px;
  background: transparent;
  color: var(--coral-dark);
}
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(243, 108, 120, 0.28);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.filter-row {
  display: flex;
  gap: 8px;
  margin: 4px -18px 20px;
  padding: 4px 18px 7px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar {
  display: none;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.filter-chip.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.wardrobe-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.garment-card {
  display: block;
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(68, 43, 51, 0.08);
  text-align: left;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.garment-photo {
  aspect-ratio: 0.82;
  overflow: hidden;
  background: var(--surface-soft);
}
.garment-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.garment-card:hover .garment-photo img {
  transform: scale(1.025);
}
.garment-copy {
  padding: 13px 14px 15px;
}
.garment-copy h3 {
  overflow: hidden;
  margin-bottom: 5px;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.garment-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.availability-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: 3px solid white;
  border-radius: 50%;
  background: #4ea76c;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.availability-dot.is-off {
  background: #a69da4;
}

.empty-state {
  padding: 44px 24px;
  border: 1px dashed #dbcac5;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
}
.empty-illustration {
  width: 92px;
  height: 92px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 35px 35px 35px 12px;
  background: var(--rose);
  font-size: 42px;
}
.empty-state h2 {
  margin-bottom: 9px;
  font:
    700 28px/1.1 Georgia,
    serif;
}
.empty-state p {
  max-width: 400px;
  margin: 0 auto 23px;
  color: var(--muted);
  line-height: 1.5;
}

.page-header {
  padding: 24px 2px 22px;
}
.page-header h1 {
  font-size: clamp(34px, 9vw, 54px);
}
.page-header p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.55;
}

.upload-panel,
.form-panel,
.detail-panel {
  overflow: hidden;
  border: 1px solid rgba(232, 218, 213, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}
.upload-panel {
  padding: 18px;
}
.photo-picker {
  position: relative;
  display: grid;
  min-height: min(60vh, 510px);
  place-items: center;
  overflow: hidden;
  border: 2px dashed #dbcac5;
  border-radius: 22px;
  background: var(--surface-soft);
  text-align: center;
}
.photo-picker.has-photo {
  border-style: solid;
}
.photo-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.photo-placeholder {
  padding: 30px;
}
.photo-placeholder strong {
  display: block;
  margin: 12px 0 5px;
  font-size: 19px;
}
.photo-placeholder span {
  color: var(--muted);
  font-size: 14px;
}
.camera-icon {
  font-size: 46px;
}
.photo-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f5eeea;
}
.change-photo {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 13px;
  background: rgba(44, 36, 48, 0.85);
  color: white;
  font-weight: 700;
  cursor: pointer;
}
.upload-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.style-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: start;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  cursor: pointer;
}
.style-option input {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  accent-color: var(--coral);
}
.style-option strong,
.style-option small {
  display: block;
}
.style-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.style-option em {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--lilac);
  color: #5a4780;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.loading-card {
  display: grid;
  min-height: 50vh;
  place-items: center;
  padding: 40px;
  text-align: center;
}
.spinner {
  display: inline-block;
  width: 34px;
  height: 34px;
  border: 4px solid var(--rose);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-card h2 {
  margin: 18px 0 7px;
  font:
    700 28px/1.1 Georgia,
    serif;
}
.loading-card p {
  color: var(--muted);
}

.review-layout {
  display: grid;
  gap: 18px;
}
.review-images {
  display: grid;
  gap: 12px;
}
.review-image,
.detail-image {
  overflow: hidden;
  border-radius: 25px;
  background: var(--surface-soft);
}
.review-image {
  aspect-ratio: 1;
}
.review-image img,
.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.review-image figcaption {
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.form-panel {
  padding: 20px;
}
.notice {
  margin-bottom: 18px;
  padding: 13px 15px;
  border-radius: 15px;
  background: #fff1cf;
  color: #74551c;
  font-size: 14px;
  line-height: 1.4;
}
.field-grid {
  display: grid;
  gap: 16px;
}
.field {
  display: grid;
  gap: 7px;
}
.field label,
.field > span {
  font-size: 13px;
  font-weight: 700;
}
.field small {
  color: var(--muted);
  font-size: 11px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 47px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
}
.field textarea {
  min-height: 76px;
  padding-top: 12px;
  resize: vertical;
}
.range-field {
  grid-template-columns: 1fr auto;
  align-items: center;
}
.range-field input {
  grid-column: 1 / -1;
  min-height: auto;
  padding: 0;
  accent-color: var(--coral);
}
.range-value {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--rose);
  font-weight: 700;
}
.form-actions,
.detail-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.detail-panel {
  padding-bottom: 22px;
}
.detail-image {
  aspect-ratio: 1;
  border-radius: 0;
}
.detail-content {
  padding: 22px 20px 0;
}
.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.detail-title-row h1 {
  margin-bottom: 6px;
  font-size: 34px;
}
.detail-subtitle {
  color: var(--muted);
  text-transform: capitalize;
}
.status-pill {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 999px;
  background: var(--sage);
  color: #28613a;
  font-size: 12px;
  font-weight: 700;
}
.status-pill.is-off {
  background: #eee9ec;
  color: var(--muted);
}
.attribute-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}
.attribute {
  min-width: 0;
  padding: 13px;
  border-radius: 15px;
  background: var(--surface-soft);
}
.attribute dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.attribute dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 600;
}
.image-versions {
  margin-top: 24px;
}
.image-versions h2 {
  margin-bottom: 10px;
  font:
    700 21px/1.1 Georgia,
    serif;
}
.image-versions > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.image-versions figure {
  margin: 0;
  overflow: hidden;
  border-radius: 15px;
  background: var(--surface-soft);
}
.image-versions img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}
.image-versions figcaption {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 17px;
  border-radius: 14px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 0.22s ease;
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.page-loading {
  display: grid;
  min-height: 55vh;
  place-items: center;
  align-content: center;
  gap: 13px;
  color: var(--muted);
}
.account-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
}
.account-menu.is-hidden {
  display: none;
}
.account-menu .text-button {
  min-height: 38px;
}
.auth-panel {
  width: min(100%, 430px);
  margin: 8vh auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: white;
  box-shadow: var(--shadow);
}
.auth-panel h1 {
  margin-bottom: 24px;
}
.auth-panel form {
  display: grid;
  gap: 16px;
}
.auth-switch {
  width: 100%;
  margin-top: 12px;
}

.outfit-controls,
.outfit-card {
  border: 1px solid rgba(232, 218, 213, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}
.outfit-controls {
  display: grid;
  gap: 16px;
  padding: 20px;
}
.outfit-generate {
  width: 100%;
}
.outfit-results {
  margin-top: 34px;
}
.outfit-results > h2 {
  font:
    700 30px/1.1 Georgia,
    serif;
}
.outfit-card {
  margin-top: 17px;
  padding: 21px;
}
.outfit-heading h3 {
  margin-bottom: 8px;
  font:
    700 27px/1.1 Georgia,
    serif;
}
.outfit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}
.outfit-meta span {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.outfit-composition {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  align-items: start;
}
.outfit-piece {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface-soft);
}
.outfit-piece img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}
.outfit-piece figcaption {
  overflow: hidden;
  padding: 8px 10px 10px;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.outfit-piece.top,
.outfit-piece.outerwear {
  grid-column: 1 / -1;
  max-width: 52%;
  justify-self: center;
}
.outfit-piece.accessory {
  max-width: 64%;
}
.outfit-reason {
  margin: 17px 0;
  color: var(--muted);
  line-height: 1.5;
}
.outfit-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.outfit-feedback span {
  width: 100%;
  font-size: 13px;
  font-weight: 700;
}
.outfit-feedback .secondary-button {
  min-height: 42px;
  padding-inline: 14px;
}
.outfit-loading {
  min-height: 30vh;
}

@media (min-width: 620px) {
  .app-shell {
    padding-inline: 28px;
  }
  .topbar {
    width: calc(100% + 56px);
    margin-inline: -28px;
    padding-inline: 30px;
  }
  .filter-row {
    margin-inline: -28px;
    padding-inline: 28px;
  }
  .wardrobe-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }
  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .field.is-wide {
    grid-column: 1 / -1;
  }
  .form-actions,
  .detail-actions,
  .upload-actions {
    grid-template-columns: 1fr 1fr;
  }
  .outfit-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .outfit-controls .outfit-generate {
    grid-column: 1 / -1;
  }
}

@media (min-width: 900px) {
  .topbar {
    min-height: 88px;
  }
  .hero {
    padding-top: 58px;
  }
  .wardrobe-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
  }
  .review-layout {
    grid-template-columns: minmax(320px, 0.82fr) minmax(460px, 1.18fr);
    align-items: start;
  }
  .review-images {
    position: sticky;
    top: 106px;
  }
  .detail-panel {
    display: grid;
    grid-template-columns: minmax(380px, 0.95fr) minmax(420px, 1.05fr);
    padding-bottom: 0;
  }
  .detail-image {
    min-height: 640px;
  }
  .detail-content {
    padding: 42px;
  }
  .outfit-composition {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .outfit-piece.top,
  .outfit-piece.outerwear {
    grid-column: auto;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
