*, *::before, *::after { touch-action: manipulation; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0a1628;
  --navy-mid: #122040;
  --navy-light: #1e3460;
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --gold-pale: #f5e9c8;
  --cream: #faf8f3;
  --white: #ffffff;
  --text-muted: #8899bb;
  --success: #2ecc71;
  --radius: 16px;
  --shadow: 0 8px 40px rgba(10,22,40,0.2);
}

html, body {
  height: 100dvh;
  max-height: 100dvh;
  background: var(--navy);
  color: var(--white);
  font-family: 'Jost', sans-serif;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -5%, rgba(201,168,76,0.1) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* ── Top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,22,40,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201,168,76,0.2);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.back-btn {
  background: rgba(201,168,76,0.12);
  border: 1px solid rgba(201,168,76,0.3);
  color: var(--gold-light);
  font-size: 20px;
  width: 42px; height: 42px;
  border-radius: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.back-btn:active { background: rgba(201,168,76,0.25); }

.topbar-info { flex: 1; }
.topbar-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
}
.topbar-step { font-size: 11px; color: var(--text-muted); font-weight: 300; margin-top: 1px; }

/* ── Progress bar ── */
.progress-bar-wrap {
  height: 3px;
  background: rgba(201,168,76,0.15);
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
  border-radius: 0 2px 2px 0;
}

/* ── Slide container ── */
.slide-container {
  position: relative;
  z-index: 1;
  height: calc(100dvh - 73px);
  overflow: hidden;
}

.slide {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 20px 20px 96px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  /* Match container exactly - this IS the full height box */
  height: calc(100dvh - 73px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  animation: slideIn 0.28s ease;
}
.slide.active { display: flex; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInBack {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
.slide.back-anim { animation: slideInBack 0.3s ease; }

.slide-section-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 6px;
}

.slide-question {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(20px, 4.5vw, 28px);
  font-weight: 500;
  color: var(--white);
  line-height: 1.3;
  margin-bottom: 4px;
}

.slide-hint {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ── Option buttons ── */
.options-grid {
  display: grid;
  gap: 10px;
}
.options-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.options-grid.cols-1 { grid-template-columns: 1fr; }

.option-btn {
  background: linear-gradient(145deg, var(--navy-mid), var(--navy-light));
  border: 1.5px solid rgba(201,168,76,0.2);
  border-radius: var(--radius);
  padding: 15px 16px;
  cursor: pointer;
  text-align: left;
  color: var(--white);
  font-family: 'Jost', sans-serif;
  font-size: 15px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.option-btn .opt-icon { font-size: 26px; flex-shrink: 0; }
.option-btn .opt-label { flex: 1; line-height: 1.3; }
.option-btn .opt-check {
  width: 22px; height: 22px;
  border: 2px solid rgba(201,168,76,0.3);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  transition: background 0.15s, border-color 0.15s;
}

.option-btn:active { transform: scale(0.97); }
.option-btn.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.2);
  background: linear-gradient(145deg, #1a3060, #254080);
}
.option-btn.selected .opt-check {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
}
.option-btn.selected .opt-check::after { content: '✓'; font-weight: 700; }

/* ── Text inputs ── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.input-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
.input-row.single { grid-template-columns: 1fr; }

.field-wrap { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 500;
}

.field-input, .field-select, .field-textarea {
  background: var(--navy-mid);
  border: 1.5px solid rgba(201,168,76,0.2);
  border-radius: 12px;
  color: var(--white);
  font-family: 'Jost', sans-serif;
  font-size: 15px;
  font-weight: 400;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  -webkit-appearance: none;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}
.field-input::placeholder { color: rgba(136,153,187,0.5); }
.field-select option { background: var(--navy-mid); }
.field-textarea { min-height: 100px; resize: vertical; line-height: 1.5; }

/* ── Counter input ── */
.counter-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--navy-mid);
  border: 1.5px solid rgba(201,168,76,0.2);
  border-radius: 12px;
  overflow: hidden;
  max-width: 180px;
}
.counter-btn {
  background: none;
  border: none;
  color: var(--gold-light);
  font-size: 22px;
  width: 50px; height: 52px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.counter-btn:active { background: rgba(201,168,76,0.1); }
.counter-val {
  flex: 1;
  text-align: center;
  font-size: 20px;
  font-weight: 500;
  color: var(--white);
}

/* ── Repeatable person card ── */
.person-cards { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.person-card {
  background: var(--navy-mid);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: var(--radius);
  padding: 14px;
}
.person-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.person-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  color: var(--gold-light);
}
.remove-btn {
  background: rgba(255,80,80,0.1);
  border: 1px solid rgba(255,80,80,0.3);
  color: #ff8080;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.add-btn {
  background: rgba(201,168,76,0.1);
  border: 1.5px dashed rgba(201,168,76,0.35);
  border-radius: var(--radius);
  color: var(--gold-light);
  font-family: 'Jost', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 13px;
  cursor: pointer;
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.add-btn:active { background: rgba(201,168,76,0.18); }

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10,22,40,0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(201,168,76,0.15);
  padding: 14px 20px env(safe-area-inset-bottom, 20px);
  display: flex;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
}

/* fix sticky footer centering */
@media (min-width: 640px) {
  .bottom-nav { left: 50%; transform: translateX(-50%); width: 640px; border-radius: 0; }
}

.btn-secondary {
  flex: 0 0 auto;
  background: transparent;
  border: 1.5px solid rgba(201,168,76,0.3);
  color: var(--gold-light);
  font-family: 'Jost', sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 0 22px;
  height: 54px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-secondary:active { background: rgba(201,168,76,0.1); }

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  border: none;
  color: var(--navy);
  font-family: 'Jost', sans-serif;
  font-size: 16px;
  font-weight: 600;
  height: 54px;
  border-radius: 14px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.02em;
}
.btn-primary:active { transform: scale(0.98); opacity: 0.9; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Thank you screen ── */
.thankyou-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 28px;
  min-height: calc(100vh - 70px);
  animation: fadeIn 0.5s ease;
}
.thankyou-screen.active { display: flex; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.check-circle {
  width: 90px; height: 90px;
  background: rgba(46,204,113,0.12);
  border: 2px solid rgba(46,204,113,0.5);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  margin-bottom: 28px;
  animation: popIn 0.5s 0.2s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes popIn { from { transform: scale(0); } to { transform: scale(1); } }

.thankyou-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px;
  color: var(--white);
  margin-bottom: 12px;
}
.thankyou-body {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 340px;
  margin-bottom: 36px;
}

.ref-box {
  background: var(--navy-mid);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 14px;
  padding: 18px 28px;
  margin-bottom: 32px;
}
.ref-label { font-size: 11px; letter-spacing: 0.12em; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.ref-num { font-family: 'Cormorant Garamond', serif; font-size: 22px; color: var(--gold-light); font-weight: 600; }

.home-btn {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  border: none;
  color: var(--navy);
  font-family: 'Jost', sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 16px 40px;
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
