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

/* ── Design Tokens ── */
:root {
  --bg:          #FBF5EF;
  --card-bg:     #FFFFFF;
  --rose:        #B76E79;
  --rose-light:  #D4909A;
  --rose-dark:   #8E4E58;
  --gold:        #C4943A;
  --gold-light:  #E8C97A;
  --text:        #2B1A14;
  --text-muted:  #8B7060;
  --border:      #EDE3DC;
  --success:     #4A8C6A;
  --error:       #C0392B;
  --shadow-sm:   0 2px 12px rgba(43,26,20,0.06);
  --shadow-md:   0 8px 40px rgba(43,26,20,0.10);
  --radius:      20px;
  --blob-rose:   183,110,121;
  --blob-gold:   196,148,58;
  --font-heading: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Jost', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Base ── */
html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ── Background Decoration ── */
.bg-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-deco::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(var(--blob-rose),0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(var(--blob-gold),0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 60% 40%, rgba(var(--blob-rose),0.04) 0%, transparent 50%);
}

.bg-deco span {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--blob-rose, 183,110,121), 0.13), transparent 70%);
  animation: floatBlob 18s ease-in-out infinite;
}
.bg-deco span:nth-child(1)  { width: 320px; height: 320px; top: -90px; left: -90px; animation-duration: 20s; }
.bg-deco span:nth-child(2)  { width: 220px; height: 220px; top: 38%; right: -70px; animation-duration: 25s; animation-delay: -8s; background: radial-gradient(circle, rgba(var(--blob-gold, 196,148,58), 0.11), transparent 70%); }
.bg-deco span:nth-child(3)  { width: 160px; height: 160px; bottom: 12%; left: 8%; animation-duration: 22s; animation-delay: -4s; }
.bg-deco span:nth-child(4)  { width: 110px; height: 110px; top: 58%; right: 22%; animation-duration: 28s; animation-delay: -12s; background: radial-gradient(circle, rgba(var(--blob-gold, 196,148,58), 0.09), transparent 70%); }
.bg-deco span:nth-child(5)  { width: 260px; height: 260px; bottom: -70px; right: -50px; animation-duration: 30s; animation-delay: -6s; background: radial-gradient(circle, rgba(var(--blob-gold, 196,148,58), 0.09), transparent 70%); }
.bg-deco span:nth-child(6)  { width: 80px;  height: 80px;  top: 20%; left: 30%; animation-duration: 24s; animation-delay: -16s; }
.bg-deco span:nth-child(7)  { width: 130px; height: 130px; top: 75%; left: 55%; animation-duration: 32s; animation-delay: -3s; background: radial-gradient(circle, rgba(var(--blob-gold, 196,148,58), 0.10), transparent 70%); }
.bg-deco span:nth-child(8)  { width: 90px;  height: 90px;  top: 10%; right: 30%; animation-duration: 19s; animation-delay: -9s; }
.bg-deco span:nth-child(9)  { width: 180px; height: 180px; bottom: 35%; left: -50px; animation-duration: 26s; animation-delay: -14s; background: radial-gradient(circle, rgba(var(--blob-rose, 183,110,121), 0.08), transparent 70%); }

@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(22px, -32px) scale(1.06); }
  66%       { transform: translate(-16px, 22px) scale(0.94); }
}

/* ── Screen ── */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 48px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.screen.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* ── Card ── */
.card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}

/* ── Welcome Card ── */
.card-welcome {
  padding: 0;
}

.couple-photo-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, rgba(var(--blob-rose),0.18) 0%, rgba(var(--blob-gold),0.12) 100%);
  position: relative;
  overflow: hidden;
}

.couple-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.couple-photo-wrap:hover img { transform: scale(1.02); }

.photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(43,26,20,0.25) 100%);
}

.couple-photo-wrap.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.couple-photo-wrap.no-photo::after {
  content: '';
}

.welcome-body {
  padding: 28px 28px 32px;
  text-align: center;
}

/* Ornament top */
.ornament {
  color: var(--gold);
  font-size: 1rem;
  letter-spacing: 0.2em;
  margin-bottom: 12px;
  opacity: 0.7;
}

/* Couple name */
.couple-name {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 14px;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 14px;
  max-width: 200px;
}
.divider span:first-child,
.divider span:last-child {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-light), transparent);
}
.divider-gem {
  color: var(--gold);
  font-size: 0.55rem;
  opacity: 0.8;
  flex-shrink: 0;
}

/* Date */
.date {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}

/* Message */
.message {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ── Card Header (screens 2 & 3) ── */
.card {
  padding: 32px 26px 30px;
}

.card-welcome {
  padding: 0;
}

.card-header {
  text-align: center;
  margin-bottom: 22px;
  padding-top: 8px;
}

.card-icon {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, rgba(var(--blob-rose),0.10), rgba(var(--blob-gold),0.08));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  color: var(--rose);
}

h2 {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.2;
}

.subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* ── Back Button ── */
.back-btn {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 36px;
  height: 36px;
  background: rgba(43,26,20,0.05);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
}

.back-btn:hover { background: rgba(var(--blob-rose),0.12); color: var(--rose); }

/* ── Form Fields ── */
.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  height: 52px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0 16px;
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text);
  background: #FDFAF8;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.field input:focus {
  border-color: var(--rose-light);
  box-shadow: 0 0 0 3px rgba(var(--blob-rose),0.10);
}

.field input::placeholder { color: #C8B5AA; }

/* ── Buttons ── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 54px;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-dark) 100%);
  color: #FFF;
  border: none;
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  margin-top: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(var(--blob-rose),0.30);
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  pointer-events: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(var(--blob-rose),0.38);
}

.btn-primary:active {
  transform: scale(0.98) translateY(0);
  box-shadow: 0 2px 10px rgba(var(--blob-rose),0.25);
}

.btn-primary:disabled {
  background: linear-gradient(135deg, #C8ABA8, #B09090);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  background: transparent;
  color: var(--rose);
  border: 1.5px solid rgba(var(--blob-rose),0.40);
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: border-color 0.2s, background 0.2s;
}

.btn-secondary:hover { background: rgba(var(--blob-rose),0.06); border-color: var(--rose); }

/* ── Upload Area ── */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed rgba(var(--blob-rose),0.35);
  border-radius: 16px;
  padding: 32px 20px;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
  text-align: center;
  background: rgba(var(--blob-rose),0.02);
}

.upload-area:hover,
.upload-area:focus-within {
  border-color: var(--rose);
  background: rgba(var(--blob-rose),0.05);
}

.upload-area svg { color: var(--rose); margin-bottom: 2px; }
.upload-area-label { font-weight: 600; font-size: 0.95rem; color: var(--rose); }
.upload-area-hint { font-size: 0.78rem; color: var(--text-muted); font-weight: 300; }

/* ── Preview Grid ── */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--border);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-item .file-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.2s;
}

.preview-item.uploading .file-status,
.preview-item.success .file-status,
.preview-item.error .file-status { opacity: 1; }

.preview-item .file-status svg {
  width: 36px; height: 36px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
}

.status-spinner {
  width: 30px; height: 30px;
  border: 3px solid rgba(var(--blob-rose),0.25);
  border-top-color: var(--rose);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.preview-item .retry-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: var(--error);
  color: #FFF;
  border: none;
  border-radius: 6px;
  font-size: 0.65rem;
  font-family: var(--font-body);
  padding: 3px 7px;
  cursor: pointer;
  display: none;
}

.preview-item.error .retry-btn { display: block; }

/* ── Error Messages ── */
.form-error {
  color: var(--error);
  font-size: 0.83rem;
  text-align: center;
  margin-top: 10px;
  padding: 9px 14px;
  background: rgba(192,57,43,0.07);
  border-radius: 10px;
  font-weight: 400;
}

/* ── Done Section ── */
.done-section {
  text-align: center;
  padding-top: 10px;
}

.done-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, rgba(74,140,106,0.12), rgba(74,140,106,0.06));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--success);
}

.done-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-style: italic;
  color: var(--text);
  margin-bottom: 8px;
}

.done-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  font-weight: 300;
  margin-bottom: 4px;
}

/* ── Upload Progress ── */
.upload-progress {
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  margin-top: 14px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--rose-light), var(--rose));
  border-radius: 99px;
  width: 0%;
  transition: width 0.35s ease;
}

/* ── Not-me Button ── */
.not-me-btn {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 0.75rem;
  color: var(--text-muted); margin-top: 4px;
  padding: 2px 0; text-decoration: underline;
  text-underline-offset: 3px; opacity: 0.7;
  transition: opacity 0.2s;
}
.not-me-btn:hover { opacity: 1; }

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