:root {
  --gold: #f2b733;
  --gold-2: #ffd977;
  --bg: #0b0b0b;
  --card: #161616;
  --text: #f5f5f5;
  --muted: #a9a9a9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top, #2a1f05 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3, .btn, .eyebrow, .foot em {
  font-family: "Montserrat", "Inter", system-ui, sans-serif;
}

.top {
  text-align: center;
  padding: 28px 16px 8px;
}
.eyebrow {
  margin: 0;
  letter-spacing: .2em;
  font-size: .72rem;
  text-transform: uppercase;
  color: var(--muted);
}
.top h1 {
  margin: 6px 0 4px;
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 800;
  background: linear-gradient(90deg, var(--gold), var(--gold-2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sub { margin: 0; color: var(--muted); font-size: .9rem; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px 24px;
}

.steps ol {
  list-style: none;
  padding: 0;
  margin: 8px 0 16px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: .8rem;
  color: var(--muted);
}
.steps li { display: flex; align-items: center; gap: 6px; }
.steps span {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: #000;
  font-weight: 700;
  font-size: .75rem;
}

.preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(242, 183, 51, .18), 0 0 0 1px rgba(242, 183, 51, .25);
  background: #000;
  aspect-ratio: 1728 / 2444;
}
#flyer { display: block; width: 100%; height: auto; cursor: pointer; }
.loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted);
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.ic {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Keeps the file input clickable on mobile (display:none can block it) */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s ease, opacity .2s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn[hidden] { display: none; }

.btn.primary { background: #fff; color: #000; }
.btn.gold {
  background: linear-gradient(135deg, var(--gold-2), var(--gold) 60%, #c98a10);
  color: #1a1100;
}
.btn.ghost {
  background: transparent;
  color: var(--gold-2);
  border-color: rgba(242, 183, 51, .5);
}
.btn.small { padding: 11px 14px; font-size: .9rem; }

.hint { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 14px; }

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .85);
  display: grid; place-items: center;
  padding: 16px;
  z-index: 10;
}
.modal[hidden] { display: none; }
.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid rgba(242, 183, 51, .3);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}
.modal-card h2 { margin: 0; color: var(--gold-2); font-size: 1.2rem; }
.muted { color: var(--muted); font-size: .82rem; margin: 4px 0 12px; }

.crop-box {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  touch-action: none;
}
#cropCanvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#cropCanvas:active { cursor: grabbing; }

.controls {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 4px;
  color: var(--gold-2);
  font-weight: 700;
}
.controls input { flex: 1; accent-color: var(--gold); }

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 8px;
}

.foot {
  text-align: center;
  padding: 10px 16px 30px;
  color: var(--muted);
  display: grid;
  gap: 4px;
}
.foot em { color: var(--gold-2); font-size: 1.1rem; }
.foot small { font-size: .72rem; }
.foot .credit { margin-top: 10px; opacity: .7; letter-spacing: .03em; }
