:root {
  color-scheme: light;
  --ink: #171714;
  --muted: #6f6e67;
  --paper: #f6f3ee;
  --surface: #fffdf9;
  --line: rgba(23, 23, 20, 0.12);
  --accent: #c8ff5b;
  --accent-ink: #172000;
  --danger: #b53a2f;
  --shadow: 0 20px 60px rgba(44, 38, 24, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  min-height: 100dvh;
  overscroll-behavior: none;
}

button {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(80, 112, 5, 0.32);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

#app,
.view {
  min-height: 100dvh;
}

.view {
  width: min(100%, 760px);
  margin: 0 auto;
}

.centered-view {
  display: grid;
  place-content: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  text-align: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--accent);
  font: 700 24px/1 Georgia, serif;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 10vw, 56px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

h2 {
  font-size: 22px;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.supporting-copy {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.spinner {
  width: 24px;
  height: 24px;
  margin: 14px auto 0;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.setup-card {
  width: min(100%, 430px);
  padding: 30px 24px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 253, 249, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.form-error {
  margin: 18px 0 0;
  font-size: 13px;
  line-height: 1.4;
}

.form-error { color: var(--danger); }

.button {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  padding: 0 20px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.button:active:not(:disabled) {
  transform: scale(0.98);
}

.button:disabled {
  cursor: default;
  opacity: 0.38;
}

.primary-button {
  background: var(--ink);
  color: white;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
}

.auth-view {
  display: grid;
  grid-template-rows: minmax(280px, 46dvh) 1fr;
  overflow: hidden;
}

.auth-art {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 75% 30%, rgba(200, 255, 91, 0.8), transparent 34%),
    linear-gradient(145deg, #ded8cb, #f5f0e6 70%);
}

.fabric-card {
  position: absolute;
  width: 180px;
  aspect-ratio: 0.78;
  border-radius: 28px;
  box-shadow: 0 28px 50px rgba(38, 32, 20, 0.2);
}

.fabric-card::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 21px;
}

.fabric-card-one {
  left: 7%;
  bottom: -58px;
  background: repeating-linear-gradient(90deg, #252b2b 0 5px, #343b3a 5px 7px);
  transform: rotate(-11deg);
}

.fabric-card-two {
  left: 39%;
  bottom: -80px;
  background: #9c361f;
  transform: rotate(6deg);
}

.fabric-card-three {
  right: -55px;
  bottom: -44px;
  background: linear-gradient(120deg, #416895, #7895b7);
  transform: rotate(17deg);
}

.auth-panel {
  align-self: end;
  padding: 38px 24px max(30px, env(safe-area-inset-bottom));
}

.auth-panel .supporting-copy {
  max-width: 430px;
  margin-bottom: 26px;
}

.google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  background: white;
}

.google-g {
  color: #4285f4;
  font-size: 20px;
  font-weight: 800;
}

.wardrobe-view {
  position: relative;
  min-height: 100dvh;
  padding: max(22px, env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom));
}

.app-header,
.capture-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-header h1,
.capture-header h1 {
  margin: 0;
  font-size: 38px;
}

.avatar-button {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.avatar-button img,
.dialog-account img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wardrobe-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 30px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.wardrobe-meta p { margin: 0; }

.text-button {
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
}

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

.item-card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 0.84;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #ece8e0;
  padding: 0;
  text-align: left;
}

.item-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-card-footer {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  background: rgba(250, 248, 243, 0.8);
  font-size: 11px;
  font-weight: 750;
  backdrop-filter: blur(12px);
}

.item-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  display: grid;
  justify-items: center;
  padding: 54px 20px 0;
  text-align: center;
}

.empty-state p {
  max-width: 330px;
  color: var(--muted);
  line-height: 1.5;
}

.empty-state .button { margin-top: 8px; }

.empty-icon {
  position: relative;
  width: 92px;
  height: 92px;
  margin-bottom: 24px;
  border-radius: 29px;
  background: var(--accent);
  transform: rotate(-5deg);
}

.empty-icon span,
.empty-icon span::after {
  position: absolute;
  content: "";
  background: var(--accent-ink);
}

.empty-icon span {
  top: 44px;
  left: 26px;
  width: 40px;
  height: 3px;
}

.empty-icon span::after {
  top: -18px;
  left: 18px;
  width: 3px;
  height: 40px;
}

.floating-add {
  position: fixed;
  right: max(22px, calc((100vw - 724px) / 2));
  bottom: max(22px, calc(18px + env(safe-area-inset-bottom)));
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 22px;
  background: var(--ink);
  box-shadow: 0 16px 32px rgba(23, 23, 20, 0.3);
}

.floating-add span,
.floating-add span::after {
  width: 24px;
  height: 2px;
  content: "";
  background: white;
}

.floating-add span::after {
  display: block;
  transform: rotate(90deg);
}

.detail-view {
  min-height: 100dvh;
  background: var(--surface);
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(18px);
}

.back-icon {
  width: 11px;
  height: 11px;
  border-bottom: 2px solid var(--ink);
  border-left: 2px solid var(--ink);
  transform: translateX(2px) rotate(45deg);
}

.detail-content {
  padding: 18px 18px max(36px, env(safe-area-inset-bottom));
}

.detail-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  border-radius: 999px;
  background: #eeeae2;
  color: var(--ink);
  padding: 7px 10px;
  font-weight: 750;
}

.status-pill[data-status="completed"] { background: var(--accent); color: var(--accent-ink); }
.status-pill[data-status="processing"] { background: #e6edf8; color: #284d78; }
.status-pill[data-status="failed"] { background: #f7dfdb; color: var(--danger); }

.detail-section + .detail-section {
  margin-top: 34px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
}

.section-heading > span {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.default-image-frame {
  display: grid;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #f0ede7;
}

.default-image-frame > * {
  grid-area: 1 / 1;
}

.default-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
}

.section-empty {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f5f2ec;
  color: var(--muted);
  padding: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.generated-grid {
  display: grid;
  gap: 16px;
}

.generated-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: white;
}

.generated-image-frame {
  aspect-ratio: 1;
  background: #f4f2ed;
}

.generated-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.generated-card-body {
  padding: 15px;
}

.generated-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.generated-card-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.score-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.score-picker button {
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 0;
  font-size: 11px;
  font-weight: 750;
}

.score-picker button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

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

.original-photo {
  position: relative;
  overflow: hidden;
  aspect-ratio: 0.82;
  margin: 0;
  border-radius: 18px;
  background: #ece8e0;
}

.original-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.original-photo figcaption {
  position: absolute;
  right: 7px;
  bottom: 7px;
  left: 7px;
  border-radius: 10px;
  background: rgba(255, 253, 249, 0.82);
  padding: 7px 9px;
  font-size: 10px;
  font-weight: 750;
  backdrop-filter: blur(10px);
}

.capture-view {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--surface);
}

.capture-header {
  padding: max(18px, env(safe-area-inset-top)) 18px 16px;
  border-bottom: 1px solid var(--line);
}

.capture-header h1 { font-size: 27px; }
.capture-header .eyebrow { margin-bottom: 4px; }

.icon-button,
.header-spacer {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
}

.icon-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
}

.close-icon,
.close-icon::after {
  width: 18px;
  height: 2px;
  content: "";
  background: var(--ink);
  transform: rotate(45deg);
}

.close-icon::after {
  display: block;
  transform: rotate(90deg);
}

.capture-content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px 150px;
}

.capture-guidance {
  max-width: 520px;
  margin: 0 auto 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.camera-card {
  display: grid;
  justify-items: center;
  width: 100%;
  min-height: 230px;
  border: 1px dashed rgba(23, 23, 20, 0.28);
  border-radius: 26px;
  background: linear-gradient(145deg, #eeebe4, #faf8f3);
  color: var(--ink);
}

.camera-card strong { margin-top: 14px; font-size: 17px; }
.camera-card small { margin-top: 4px; color: var(--muted); }

.camera-icon {
  position: relative;
  width: 56px;
  height: 42px;
  margin-top: 20px;
  border: 3px solid var(--ink);
  border-radius: 13px;
}

.camera-icon::before {
  position: absolute;
  top: -10px;
  left: 14px;
  width: 22px;
  height: 10px;
  border-radius: 5px 5px 0 0;
  background: var(--ink);
  content: "";
}

.camera-icon::after {
  position: absolute;
  top: 9px;
  left: 16px;
  width: 16px;
  height: 16px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  content: "";
}

.draft-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 2px 12px;
}

.draft-summary div {
  display: grid;
  gap: 3px;
}

.draft-summary span {
  color: var(--muted);
  font-size: 11px;
}

.small-add-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 750;
}

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

.draft-photo {
  position: relative;
  overflow: hidden;
  aspect-ratio: 0.82;
  border: 0;
  border-radius: 16px;
  background: #e6e2da;
  padding: 0;
}

.draft-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.draft-photo::after {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(15, 15, 14, 0.72);
  color: white;
  content: "×";
  font-size: 17px;
}

.upload-state {
  margin-top: 22px;
  text-align: center;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #e4e1da;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width 220ms ease;
}

.upload-state p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.capture-actions {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 12px 14px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.91);
  backdrop-filter: blur(18px);
}

.capture-actions .button {
  min-height: 58px;
  padding: 0 12px;
  font-size: 13px;
}

.account-dialog {
  width: min(calc(100% - 24px), 520px);
  margin: auto auto max(8px, env(safe-area-inset-bottom));
  border: 0;
  border-radius: 28px;
  background: var(--surface);
  padding: 12px 16px 16px;
  box-shadow: var(--shadow);
}

.account-dialog::backdrop {
  background: rgba(23, 23, 20, 0.38);
  backdrop-filter: blur(4px);
}

.dialog-handle {
  width: 42px;
  height: 4px;
  margin: 2px auto 18px;
  border-radius: 99px;
  background: #d7d3cb;
}

.dialog-account {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 20px;
}

.dialog-account img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
}

.dialog-account div { display: grid; gap: 3px; }
.dialog-account span { color: var(--muted); font-size: 12px; }

.dialog-action {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  font-weight: 700;
}

.danger-action { color: var(--danger); }
.account-dialog .button { width: 100%; margin-top: 10px; }

.toast {
  position: fixed;
  right: 18px;
  bottom: max(22px, calc(18px + env(safe-area-inset-bottom)));
  left: 18px;
  z-index: 20;
  width: fit-content;
  max-width: calc(100% - 36px);
  margin: 0 auto;
  border-radius: 14px;
  background: var(--ink);
  color: white;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 650;
  box-shadow: var(--shadow);
}

@media (min-width: 600px) {
  body { padding: 18px 0; }
  .view { min-height: calc(100dvh - 36px); border-radius: 30px; overflow: hidden; box-shadow: var(--shadow); }
  .item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .generated-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .original-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .floating-add { right: max(32px, calc((100vw - 690px) / 2)); bottom: 38px; }
  .capture-actions { bottom: 18px; border-radius: 0 0 30px 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
