:root {
  --ink: #1c1612;
  --paper: #f4ecdf;
  --paper-deep: #e7dccb;
  --amber: #c65a24;
  --amber-ink: #fff8f2;
  --line: rgba(28, 22, 18, 0.16);
  --danger: #8d2b2b;
  --shadow: 0 24px 60px rgba(48, 28, 12, 0.12);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(198, 90, 36, 0.16), transparent 32%),
    linear-gradient(180deg, #f7f1e7 0%, var(--paper) 40%, #efe4d4 100%);
  font-family: "Outfit", sans-serif;
  font-weight: 380;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

button, textarea, input { font: inherit; color: inherit; }

.stage {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(3rem, 7vw, 5.6rem);
  font-weight: 560;
  letter-spacing: -0.045em;
  line-height: 0.92;
  max-width: 11ch;
}

.sheet {
  margin-top: 36px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
}

.frame, .controls, .progress, .result {
  background: rgba(255, 250, 244, 0.78);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.frame { padding: 16px; }

.drop {
  position: relative;
  display: grid;
  min-height: 420px;
  place-items: center;
  border: 1.5px dashed rgba(28, 22, 18, 0.28);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.4), transparent 40%),
    var(--paper-deep);
  cursor: pointer;
  overflow: hidden;
}

.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.drop img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #14110f;
  display: none;
}

.drop.has-photo img { display: block; }
.drop.has-photo .drop-copy { display: none; }

.drop-copy {
  display: grid;
  gap: 6px;
  text-align: center;
  padding: 24px;
}

.drop-copy strong {
  font-family: "Fraunces", serif;
  font-size: 2rem;
  font-weight: 560;
}

.frame-actions, .result-actions, .examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.frame-actions { margin-top: 12px; }

.text-button, .examples button, .generate {
  border: 0;
  cursor: pointer;
}

.text-button, .examples button {
  background: transparent;
  border-bottom: 1px solid var(--ink);
  padding: 4px 0;
}

.examples { margin: 12px 0 18px; }
.examples button {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  background: rgba(255,255,255,0.45);
}

.controls { padding: 22px; }

.field {
  display: block;
  font-family: "Fraunces", serif;
  font-size: 1.45rem;
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
}

.generate, .download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  background: var(--amber);
  color: var(--amber-ink);
  text-decoration: none;
  font-weight: 520;
  letter-spacing: 0.01em;
}

.generate:disabled { opacity: 0.45; cursor: not-allowed; }

.hint, .cost { min-height: 1.2em; color: var(--danger); }
.cost { color: var(--ink); }

.progress, .result { margin-top: 22px; padding: 22px; }

ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

ol li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: rgba(28, 22, 18, 0.45);
}

ol li.done { color: var(--ink); }
ol li.current { color: var(--ink); font-weight: 520; }

video {
  width: 100%;
  max-height: 70vh;
  background: #14110f;
}

.result-actions { margin-top: 14px; }
.download { width: auto; padding-inline: 22px; }

@media (max-width: 800px) {
  .stage {
    width: min(1080px, calc(100% - 20px));
    padding: calc(20px + env(safe-area-inset-top)) 0 calc(28px + env(safe-area-inset-bottom));
  }
  .sheet { grid-template-columns: 1fr; gap: 16px; margin-top: 24px; }
  .drop { min-height: 240px; }
  h1 { font-size: clamp(2.4rem, 12vw, 3.2rem); max-width: none; }
  .drop-copy strong, .field { font-size: 1.35rem; }
  .controls, .progress, .result, .frame { padding: 16px; }
  textarea, input { font-size: 16px; }
  .examples button, .text-button, .generate, .download {
    min-height: 44px;
  }
  .examples button { flex: 1 1 100%; }
  .result-actions { display: grid; }
  .download { width: 100%; }
  video { max-height: 62vh; }
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 22, 18, 0.46);
}

.gate[hidden] { display: none; }

.gate-card {
  width: min(420px, 100%);
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.gate-card h2 {
  margin: 0 0 16px;
  font-family: "Fraunces", serif;
  font-size: 2.4rem;
  font-weight: 560;
}

.login-field { display: block; margin: 12px 0 6px; }

.gate-card input {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--line);
  background: white;
}

.gate-card .generate { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
