/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:      #c0392b;
  --red-dark: #962d22;
  --green:    #2d6a4f;
  --green-lt: #40916c;
  --gold:     #f4c430;
  --gold-dk:  #d4a017;
  --white:    #fff;
  --cream:    #fff8f0;
  --bg1:      #0d1b2a;
  --bg2:      #1a3a2a;
  --bg3:      #2d1b0e;
  --text:     #1a1a2e;
  --muted:    #6b6b7b;
  --radius:   18px;
  --shadow:   0 8px 40px rgba(0,0,0,.2);
}

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 50%, var(--bg3) 100%);
  background-attachment: fixed;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 60px;
  overflow-x: hidden;
}

/* ── Snowflakes ───────────────────────────────────────── */
.snow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.snow span {
  position: absolute; top: -40px;
  color: rgba(255,255,255,.7);
  font-size: clamp(12px, 2vw, 22px);
  animation: fall linear infinite;
}
.snow span:nth-child(1)  { left:5%;  animation-duration:8s;  animation-delay:0s;   font-size:18px; }
.snow span:nth-child(2)  { left:12%; animation-duration:11s; animation-delay:1s; }
.snow span:nth-child(3)  { left:20%; animation-duration:9s;  animation-delay:2s;   font-size:14px; }
.snow span:nth-child(4)  { left:28%; animation-duration:13s; animation-delay:.5s; }
.snow span:nth-child(5)  { left:35%; animation-duration:7s;  animation-delay:3s;   font-size:22px; }
.snow span:nth-child(6)  { left:45%; animation-duration:10s; animation-delay:1.5s; }
.snow span:nth-child(7)  { left:55%; animation-duration:12s; animation-delay:0s;   font-size:16px; }
.snow span:nth-child(8)  { left:62%; animation-duration:8s;  animation-delay:2.5s; }
.snow span:nth-child(9)  { left:70%; animation-duration:11s; animation-delay:.8s;  font-size:20px; }
.snow span:nth-child(10) { left:78%; animation-duration:9s;  animation-delay:1.2s; }
.snow span:nth-child(11) { left:85%; animation-duration:14s; animation-delay:0s; }
.snow span:nth-child(12) { left:90%; animation-duration:7s;  animation-delay:3.5s; font-size:12px; }
.snow span:nth-child(13) { left:95%; animation-duration:10s; animation-delay:2s; }
.snow span:nth-child(14) { left:8%;  animation-duration:13s; animation-delay:4s; }
.snow span:nth-child(15) { left:50%; animation-duration:9s;  animation-delay:1.8s; font-size:24px; }

@keyframes fall {
  0%   { transform: translateY(0) rotate(0deg);      opacity: 1; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: .15; }
}

/* ── Shared container width ───────────────────────────── */
.hero, .how-it-works, .example-section, .card, .trust-bar, footer {
  position: relative; z-index: 1;
  width: 100%; max-width: 600px;
}

/* ── HERO ─────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 60px 24px 48px;
  color: var(--white);
}
.hero-badge {
  display: inline-block;
  background: rgba(244,196,48,.18);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(28px, 6vw, 42px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -.5px;
  margin-bottom: 16px;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.hero h1 span { color: var(--gold); }
.hero-sub {
  font-size: 16px;
  color: rgba(255,255,255,.8);
  line-height: 1.6;
  max-width: 460px;
  margin: 0 auto 28px;
}
.hero-cta {
  display: inline-block;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: var(--white);
  font-size: 17px;
  font-weight: 700;
  padding: 15px 32px;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(192,57,43,.5);
  transition: transform .15s, box-shadow .15s;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(192,57,43,.6); }

/* ── HOW IT WORKS ─────────────────────────────────────── */
.how-it-works {
  padding: 0 24px 40px;
  text-align: center;
}
.how-it-works h2 {
  font-size: 20px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  margin-bottom: 24px;
  letter-spacing: .3px;
}
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.step {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 18px 14px;
  width: 148px;
  text-align: center;
  color: rgba(255,255,255,.85);
  font-size: 13px;
  line-height: 1.4;
  position: relative;
}
.step-num {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #000;
  font-weight: 800;
  font-size: 11px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.step-icon { font-size: 28px; margin-bottom: 8px; }
.step-arrow { font-size: 20px; color: var(--gold); font-weight: 700; }

/* ── EXAMPLE SECTION ──────────────────────────────────── */
.example-section { padding: 0 0 32px; }

.example-card {
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.example-label {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-lt) 100%);
  color: var(--white);
  padding: 24px 28px 20px;
  text-align: center;
}
.label-badge {
  display: inline-block;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.35);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.example-label h2 {
  font-size: clamp(18px, 4vw, 22px);
  font-weight: 800;
  margin-bottom: 6px;
}
.example-label p {
  font-size: 13px;
  opacity: .88;
  line-height: 1.5;
}

/* Video container */
.example-video-wrap {
  position: relative;
  background: #000;
  cursor: pointer;
}
.example-video-wrap video {
  width: 100%;
  display: block;
  max-height: 420px;
  object-fit: contain;
}

/* Play overlay */
.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0,0,0,.45);
  border: none;
  cursor: pointer;
  transition: background .2s;
}
.play-overlay:hover { background: rgba(0,0,0,.3); }
.play-overlay.hidden { display: none; }
.play-icon {
  width: 68px; height: 68px;
  background: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: white;
  box-shadow: 0 4px 20px rgba(192,57,43,.6);
  padding-left: 4px;  /* optical centre for ▶ */
  transition: transform .15s;
}
.play-overlay:hover .play-icon { transform: scale(1.08); }
.play-text {
  color: white;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .3px;
}

/* Pause button — bottom-right corner while video plays */
.pause-btn {
  position: absolute;
  bottom: 12px; right: 12px;
  width: 44px; height: 44px;
  background: rgba(0,0,0,.72);
  color: #fff;
  border: 2px solid rgba(255,255,255,.75);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .15s;
  z-index: 5;
}
.pause-btn:hover { background: rgba(192,57,43,.92); transform: scale(1.08); }

/* Chips below video */
.example-caption {
  padding: 16px 20px 4px;
  background: #fff;
}
.caption-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.caption-chips span {
  background: #f0f7f4;
  border: 1px solid #c8e6d8;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
}

.example-cta {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  padding: 16px 20px;
  text-decoration: none;
  transition: opacity .15s;
  letter-spacing: .2px;
}
.example-cta:hover { opacity: .92; }

/* ── GENERATE CARD ────────────────────────────────────── */
.card {
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

header {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: var(--white);
  text-align: center;
  padding: 32px 24px 24px;
  border-bottom: 4px solid var(--gold);
}
.santa-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.3));
  animation: bounce 2.5s ease-in-out infinite;
}
@keyframes bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
header h1 {
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 6px;
}
.subtitle { font-size: 13px; opacity: .88; }

/* ── Form ─────────────────────────────────────────────── */
.form-section { padding: 24px 28px 28px; }
.field { display: flex; flex-direction: column; margin-bottom: 16px; }
.field label {
  font-size: 12px; font-weight: 700;
  color: var(--green); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .5px;
}
.required { color: var(--red); }
.hint { font-weight: 400; color: var(--muted); text-transform: none; }
.field input, .field textarea {
  border: 2px solid #d4c5b5; border-radius: 10px;
  padding: 11px 14px; font-size: 15px; color: var(--text);
  background: #fff; outline: none; font-family: inherit; resize: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(192,57,43,.1);
}
.row { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }

button[type="submit"] {
  width: 100%; padding: 15px 20px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: var(--white); border: none; border-radius: 12px;
  font-size: 17px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 4px 16px rgba(192,57,43,.35);
  transition: transform .15s, box-shadow .15s;
  margin-top: 4px;
}
button[type="submit"]:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(192,57,43,.45); }
button[type="submit"]:active { transform: none; }
button[type="submit"]:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ── Loading ───────────────────────────────────────────── */
.loading-section { padding: 48px 28px; text-align: center; }
.loader-wrap {
  position: relative; width: 90px; height: 90px;
  margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
}
.sleigh { font-size: 36px; animation: rock 2s ease-in-out infinite; }
@keyframes rock {
  0%,100% { transform: rotate(-10deg); }
  50%      { transform: rotate(10deg); }
}
.loader-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 4px solid #f0ddd0; border-top-color: var(--red);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 18px; font-weight: 700; color: var(--red-dark); margin-bottom: 6px; }
.loading-sub { font-size: 20px; font-weight: 800; color: var(--green); margin-bottom: 10px; }
.loading-hint { font-size: 13px; color: var(--muted); }

/* ── Result ───────────────────────────────────────────── */
.result-section { padding: 28px; text-align: center; }
.result-header {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 20px;
}
.result-header span { font-size: 26px; }
.result-header h2 { font-size: clamp(16px,4vw,20px); color: var(--green); font-weight: 700; }
.result-header h2 span { color: var(--red); }
.video-wrap {
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  background: #000; margin-bottom: 20px;
}
.video-wrap video { width: 100%; display: block; max-height: 480px; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-download {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--green); color: #fff;
  padding: 11px 22px; border-radius: 10px;
  font-weight: 700; font-size: 14px; text-decoration: none;
  transition: opacity .15s;
}
.btn-download:hover { opacity: .88; }
.btn-again {
  background: #fff; border: 2px solid var(--red); color: var(--red);
  padding: 11px 22px; border-radius: 10px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-again:hover { background: var(--red); color: #fff; }

/* ── Error ────────────────────────────────────────────── */
.error-section { padding: 40px 28px; text-align: center; }
.error-icon { font-size: 48px; margin-bottom: 14px; }
.error-msg { font-size: 15px; color: var(--red-dark); margin-bottom: 20px; line-height: 1.5; }

/* ── Trust bar ────────────────────────────────────────── */
.trust-bar {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px 20px;
  padding: 20px 16px 8px;
}
.trust-item {
  color: rgba(255,255,255,.75);
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 5px;
}

/* ── Footer ───────────────────────────────────────────── */
footer {
  position: relative; z-index: 1;
  padding: 16px 0 8px;
  font-size: 12px;
  color: rgba(255,255,255,.4);
  text-align: center;
}

/* ── Utility ──────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Form step labels ─────────────────────────────────── */
.form-step-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--red);
  margin: 22px 0 12px;
  padding-left: 2px;
  border-left: 3px solid var(--gold);
  padding-left: 8px;
}

/* ── Character grid ───────────────────────────────────── */
.character-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}
.char-loading { grid-column: 1/-1; color: var(--muted); font-size: 13px; }

.char-card {
  border: 2px solid #e0d5c8;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s, transform .15s, box-shadow .15s;
  background: #fff;
  text-align: center;
}
.char-card:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.char-card.selected { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,.18); }

.char-img-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f5f0eb;
}
.char-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

.char-check {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px;
  background: var(--red); color: #fff;
  border-radius: 50%;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}
.char-card.selected .char-check { opacity: 1; }

.char-label { font-size: 12px; font-weight: 700; color: var(--text); padding: 6px 4px 2px; }
.char-desc  { font-size: 10px; color: var(--muted); padding-bottom: 7px; }

/* Upload slot inside character grid */
.upload-slot { cursor: pointer; }
.upload-slot:hover .upload-placeholder { background: #f0f7f4; border-color: var(--green); }
.upload-placeholder {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 1;
  border: 2px dashed #c5b8a8;
  border-radius: 8px;
  background: #faf7f4;
  transition: background .2s, border-color .2s;
}
.upload-plus {
  font-size: 28px;
  color: #b0a090;
  line-height: 1;
}

/* ── Upload avatar ────────────────────────────────────── */
.upload-wrap { margin: 8px 0 4px; }
.upload-hint { font-size: 12px; color: var(--muted); text-align: center; }
.upload-status { font-size: 13px; margin-top: 7px; padding: 8px 12px; border-radius: 8px; }
.upload-status.success { background: #f0f7f4; color: var(--green); }
.upload-status.error   { background: #fdf0ef; color: var(--red-dark); }

/* ── Aspect ratio grid ────────────────────────────────── */
.ratio-grid {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.ratio-btn {
  flex: 1; min-width: 100px;
  border: 2px solid #e0d5c8;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: border-color .2s, transform .15s;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.ratio-btn:hover  { border-color: var(--red); transform: translateY(-1px); }
.ratio-btn.selected { border-color: var(--red); background: #fff5f4; box-shadow: 0 0 0 3px rgba(192,57,43,.12); }

.ratio-preview {
  background: linear-gradient(135deg, #2d6a4f 0%, #40916c 100%);
  border-radius: 4px;
  min-width: 16px; min-height: 16px;
}
.ratio-label { font-size: 12px; font-weight: 700; color: var(--text); }
.ratio-hint  { font-size: 10px; color: var(--muted); line-height: 1.3; }

/* ── Video controls (result) ──────────────────────────── */
.video-wrap {
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  background: #000; margin-bottom: 20px;
  position: relative;
}
.video-wrap video {
  width: 100%; display: block; max-height: 480px;
}
/* Native controls are always shown — no overlay needed */

/* ── Resolution cards ─────────────────────────────────── */
.resolution-wrap { margin-bottom: 20px; }
.resolution-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 8px; }
.res-btn {
  position: relative; font: inherit; color: inherit;
  border: 2px solid #e0d5c8; border-radius: 12px; padding: 14px 8px 12px;
  background: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: border-color .2s, transform .15s, background .2s, box-shadow .2s;
}
.res-btn:hover { border-color: var(--red); transform: translateY(-1px); }
.res-btn:focus-visible { outline: 3px solid rgba(192,57,43,.35); outline-offset: 2px; }
.res-btn.selected { border-color: var(--red); background: #fff5f4; box-shadow: 0 0 0 3px rgba(192,57,43,.12); }
.res-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.res-bars { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.res-bars i { width: 6px; border-radius: 2px; background: #e0d5c8; transition: background .2s; }
.res-bars i:nth-child(1) { height: 8px; }
.res-bars i:nth-child(2) { height: 13px; }
.res-bars i:nth-child(3) { height: 18px; }
.res-bars i.on { background: var(--green-lt); }
.res-label { font-size: 15px; font-weight: 800; color: var(--text); }
.res-note  { font-size: 10px; color: var(--muted); line-height: 1.3; text-align: center; }
.res-tag {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  background: var(--gold); color: #000; font-size: 9px; font-weight: 800;
  padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}
.resolution-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  padding-left: 2px;
}

@media (max-width: 420px) {
  .character-grid { grid-template-columns: repeat(2, 1fr); }
  .ratio-grid { gap: 8px; }
  .ratio-btn { min-width: 80px; }
  .row { grid-template-columns: 1fr; }
  .form-section { padding: 18px 16px 22px; }
  .resolution-grid { gap: 8px; }
  .res-btn { padding: 14px 4px 12px; }
  .step-arrow { display: none; }
  .steps { gap: 12px; }
  .step { width: 100%; max-width: 240px; }
}
