:root {
  --maroon: #7a1f2b;
  --maroon-dark: #5c1520;
  --maroon-soft: #f3e4e6;
  --gold: #f4b41a;
  --gold-dark: #c98d05;
  --cream: #fbf7f0;
  --ink: #2b1a1d;
  --muted: #6d5a5d;
  --line: #e6dcd3;
  --ok: #1f7a3a;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --radius: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--cream);
}
.wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.hero {
  background: linear-gradient(160deg, var(--maroon) 0%, var(--maroon-dark) 100%);
  color: #fff;
  padding: calc(28px + env(safe-area-inset-top)) 0 32px;
  text-align: center;
  border-bottom: 6px solid var(--gold);
}
.mascot {
  width: 96px; height: 96px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #fff;
  display: block;
  box-shadow: 0 6px 18px rgba(0,0,0,.3), 0 0 0 4px var(--gold);
}
.eyebrow {
  margin: 0;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.hero h1 { margin: 4px 0 8px; font-size: 34px; line-height: 1.1; }
.lede { margin: 0 auto; max-width: 420px; opacity: .92; font-size: 16px; }

/* Cards & fields */
main { padding: 20px 16px 40px; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(43,26,29,.05);
}
.card h2 {
  margin: 0 0 14px;
  font-size: 20px;
  display: flex; align-items: center; gap: 10px;
}
.step {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gold); color: var(--maroon-dark);
  display: inline-grid; place-items: center;
  font-size: 15px; font-weight: 800;
}
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.field small { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  min-height: 50px;
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10'%3E%3Cpath d='M1 1l7 7 7-7' fill='none' stroke='%237a1f2b' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--maroon);
  box-shadow: 0 0 0 3px rgba(122,31,43,.18);
}
.field.invalid input, .field.invalid select { border-color: var(--bad); }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

/* Photo picker */
.picker {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 26px 16px;
  border: 2px dashed var(--maroon);
  border-radius: var(--radius);
  background: var(--maroon-soft);
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.picker:active { background: #ead2d6; }
.picker-icon { font-size: 34px; }
.picker-title { font-size: 20px; font-weight: 800; color: var(--maroon); }
.picker-sub { font-size: 14px; color: var(--muted); }
#file-input {
  position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none;
}
.tips { margin: 14px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.tips li + li { margin-top: 4px; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.grid:empty { display: none; }
@media (min-width: 480px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #efe7dd;
  border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 28px; color: var(--muted); }
.thumb .remove {
  position: absolute; top: 4px; right: 4px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.6); color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer;
}
.thumb .meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3px 6px; font-size: 11px;
  background: rgba(0,0,0,.55); color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb.checking .meta { background: rgba(122,31,43,.7); }
.thumb.rejected { border-color: var(--bad); }
.thumb.rejected img, .thumb.rejected .ph { opacity: .35; }
.thumb.rejected .reason {
  position: absolute; inset: 0;
  padding: 8px; font-size: 13px; line-height: 1.2;
  color: var(--bad); font-weight: 700;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: rgba(251,233,231,.85);
}
.rejected-list { margin: 10px 0 0; padding-left: 18px; font-size: 14px; color: var(--bad); }
.rejected-list li { margin-top: 4px; }
.rejected-list strong { color: var(--ink); }
.grid-summary { margin: 12px 0 0; font-size: 15px; }
.grid-summary .bad { color: var(--bad); font-weight: 600; }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 19px;
  font-weight: 800;
  padding: 16px 18px;
  border-radius: 14px;
  border: 0;
  cursor: pointer;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--maroon); color: #fff; box-shadow: 0 4px 12px rgba(122,31,43,.3); }
.btn-primary:active { background: var(--maroon-dark); }
.btn-primary:disabled { background: #b48a90; box-shadow: none; cursor: default; }
.btn-secondary { background: var(--gold); color: var(--maroon-dark); margin-bottom: 12px; }
.btn-link { background: none; color: var(--maroon); font-weight: 700; font-size: 16px; min-height: 44px; padding: 8px; margin-top: 4px; text-decoration: underline; }
.submit-bar { padding: 4px 0 8px; }
.resume { border: 2px solid var(--gold); }
.resume p { margin: 0 0 14px; }

/* Notice */
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fff7e0;
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 15px;
}
.notice p { margin: 0; }
.notice-icon { font-size: 24px; line-height: 1.2; }

/* Alerts */
.alert {
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid #f1c3bf;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 600;
}
.warn { color: var(--bad); font-weight: 600; }

/* Per-photo progress */
.thumb .ring {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(255,255,255,.55);
}
.thumb .ring svg { width: 52px; height: 52px; transform: rotate(-90deg); }
.thumb .ring circle { fill: none; stroke-width: 6; }
.thumb .ring .track { stroke: rgba(122,31,43,.2); }
.thumb .ring .fill { stroke: var(--maroon); stroke-linecap: round; transition: stroke-dashoffset .2s linear; }
.thumb .ring .pct { position: absolute; font-size: 12px; font-weight: 800; color: var(--maroon-dark); }
.thumb.waiting .ring .fill, .thumb.retry .ring .fill { stroke: var(--gold-dark); }
.thumb .badge {
  position: absolute; left: 6px; top: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 900; color: #fff;
  background: var(--ok); box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.thumb.failed { border-color: var(--bad); cursor: pointer; }
.thumb.failed .ring { background: rgba(251,233,231,.85); color: var(--bad); font-weight: 700; font-size: 13px; text-align: center; padding: 6px; }
.status-text { margin: 0 0 10px; font-weight: 700; text-align: center; }
.status-text.bad { color: var(--bad); }
.submit-bar .hint { text-align: center; margin-top: 10px; }
.card.locked input, .card.locked select, .card.locked textarea.locked-field { background: #f7f2ea; color: var(--muted); }

/* Done */
.done { text-align: center; padding: 30px 18px; }
.done-icon { font-size: 56px; }
.done h2 { justify-content: center; font-size: 26px; }
.done p { margin: 0 0 18px; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.foot p { margin: 4px 0; }

@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }
