:root {
  color-scheme: dark;
  --bg: #171717;
  --panel: #20201f;
  --text: #f7f2e8;
  --muted: #b9afa0;
  --line: rgba(247, 242, 232, 0.16);
  --accent: #d8b35f;
  --accent-strong: #f0ca70;
  --green: #73816d;
  --red: #a95e4f;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(115, 129, 109, 0.2), transparent 35%),
    linear-gradient(315deg, rgba(169, 94, 79, 0.17), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100svh;
  padding: max(16px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
}

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

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 4.3rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.privacy-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  background: rgba(32, 32, 31, 0.72);
}

.picker {
  border: 1px solid var(--line);
  background: rgba(32, 32, 31, 0.82);
  box-shadow: 0 18px 44px var(--shadow);
  padding: 12px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.picker.dragging {
  border-color: var(--accent-strong);
}

.picker p {
  margin: 0 0 4px;
  font-weight: 700;
}

.picker small {
  color: var(--muted);
  line-height: 1.45;
}

.file-button,
.download-button {
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-weight: 700;
}

.file-button {
  min-width: 144px;
  padding: 0 16px;
  background: var(--accent);
  color: #17130b;
}

.file-button input {
  display: none;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.look-card {
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(32, 32, 31, 0.78);
  box-shadow: 0 18px 44px var(--shadow);
}

.image-frame {
  position: relative;
  overflow: hidden;
  background: #101010;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
}

canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.placeholder,
.card-processing {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  background: linear-gradient(145deg, rgba(32, 32, 31, 0.96), rgba(16, 16, 16, 0.96));
}

.placeholder span {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-weight: 800;
}

.card-processing span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(247, 242, 232, 0.22);
  border-top-color: var(--accent-strong);
  animation: spin 0.82s linear infinite;
}

.card-processing p {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
}

.card-copy {
  padding: 12px 12px 10px;
}

.card-copy h2 {
  margin: 0 0 6px;
  font-size: 1rem;
  letter-spacing: 0;
}

.card-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.download-button {
  width: calc(100% - 24px);
  margin: 0 12px 12px;
  background: var(--green);
  color: #fbfbf6;
}

.download-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

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

@media (max-width: 900px) {
  .result-grid {
    grid-template-columns: 1fr;
  }

  .image-frame {
    aspect-ratio: 4 / 5;
    max-height: 72svh;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: start;
  }

  .picker {
    grid-template-columns: 1fr;
  }

  .file-button {
    width: 100%;
  }

  .download-button {
    min-height: 52px;
  }
}
