/* ==========================================================================
   birthday-surprise-bash-secret-invitation — "A Secret Invitation" card
   A sealed, elegant surprise-party invitation. Break the seal to reveal.
   Palette: blush cream · deep plum · gold · rose · sage
   ========================================================================== */

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

html, body { margin: 0; padding: 0; }

body.theme-card {
  --plum: #3b2a4d;
  --plum-soft: #543d6e;
  --plum-deep: #281a38;
  --paper: #fbf6ee;
  --paper-2: #f3e9d8;
  --paper-3: #e9dcc3;
  --gold: #c9a24b;
  --rose: #e2647c;
  --sage: #8fae8f;
  --redact: #241731;
  --text: #34263f;
  --text-soft: #6f6280;
  --danger: #b23a4d;
  --shadow: 0 14px 34px rgba(40, 26, 56, 0.2);
  --radius: 16px;
  --photo-bg: none;              /* optional faint photo behind panels; set to url("...") to enable */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--paper);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; }
input, select, textarea { font: inherit; }

/* ==========================================================================
   Single-viewport shell — only the active panel scrolls internally
   ========================================================================== */
.invite-shell {
  position: relative;
  height: 100vh;                 /* fallback for older browsers */
  height: 100dvh;                /* dynamic viewport on mobile */
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% -4%, rgba(201, 162, 75, 0.18), transparent 42%),
    radial-gradient(circle at 90% 6%, rgba(226, 100, 124, 0.12), transparent 40%),
    var(--paper);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(59, 42, 77, 0.08);
}

/* ---------- Header ---------- */
.invite-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  background: var(--plum);
  color: var(--paper);
  flex: 0 0 auto;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 19px;
  background: rgba(251, 246, 238, 0.12);
  border: 1px solid rgba(251, 246, 238, 0.28);
  border-radius: 50%;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong {
  font-family: var(--font-display);
  font-size: 15.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-text small { font-size: 10.5px; opacity: 0.72; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-meta { flex: 0 0 auto; text-align: right; display: flex; align-items: center; gap: 10px; }

.countdown {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}
.countdown-label { font-size: 10px; color: var(--gold); letter-spacing: 0.16em; text-transform: uppercase; font-weight: 800; }
.countdown-digits { font-size: 16px; color: var(--paper); font-variant-numeric: tabular-nums; font-weight: 700; }

.countdown-fallback {
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.panic-btn {
  width: 40px;
  height: 40px;
  border: 1.5px solid rgba(251, 246, 238, 0.35);
  border-radius: 50%;
  background: rgba(226, 100, 124, 0.22);
  color: var(--paper);
  font-size: 19px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, transform 0.12s ease;
}
.panic-btn:hover { background: rgba(226, 100, 124, 0.4); }
.panic-btn:active { transform: scale(0.92); }
.panic-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Panels ---------- */
.invite-panels {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;   /* critical: lets children scroll instead of growing */
}

/* Optional photo background — paint a faint image behind every panel.
   Enabled by setting --photo-bg (a url()) on body.theme-card; the default
   "none" keeps the clean cream-and-glow look. */
.invite-panels::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--photo-bg, none);
  background-size: cover;
  background-position: center;
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}

.panel {
  position: absolute;
  inset: 0;
  z-index: 1;   /* above the optional photo background */
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 42, 77, 0.3) transparent;
}
.panel.is-active { display: block; }

.panel-inner {
  max-width: 520px;
  margin: 0 auto;
  padding: 26px 22px calc(34px + env(safe-area-inset-bottom));
}

/* ==========================================================================
   Reveal panel — the big "Surprise!" page
   ========================================================================== */
.reveal-panel { text-align: center; position: relative; }

.stamp {
  display: inline-block;
  border: 3px solid var(--rose);
  color: var(--rose);
  border-radius: 999px;
  padding: 4px 18px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: rotate(-4deg);
  background: rgba(226, 100, 124, 0.08);
  margin: 2px 0 18px;
}

.reveal-title { margin-bottom: 14px; }

.reveal-big {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(56px, 17vw, 92px);
  line-height: 1;
  font-weight: 700;
  color: var(--plum);
  letter-spacing: -0.01em;
  text-shadow: 0 4px 0 rgba(201, 162, 75, 0.35);
}

.reveal-for {
  display: block;
  margin-top: 8px;
  font-size: clamp(17px, 4.6vw, 22px);
  font-weight: 800;
  color: var(--text-soft);
}
.reveal-for em {
  font-style: normal;
  color: var(--rose);
  white-space: nowrap;
}

.reveal-lead {
  font-size: 15.5px;
  color: var(--text-soft);
  max-width: 38ch;
  margin: 0 auto 20px;
}
.reveal-lead strong { color: var(--plum); }

.fact-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 0 18px;
}
/* Every chip hides its whole row when its value is empty (css_if_empty);
   when ALL chips are gone the list itself must not leave an 18px gap. */
.fact-chips:not(:has(.chip)) { display: none; }
.chip {
  background: var(--paper-2);
  border: 1px solid rgba(59, 42, 77, 0.14);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip-key { font-size: 15px; }

.reveal-note {
  font-size: 14.5px;
  color: var(--text);
  background: rgba(143, 174, 143, 0.18);
  border: 1px dashed rgba(143, 174, 143, 0.9);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 auto 20px;
  max-width: 44ch;
}
.reveal-note strong { color: var(--plum); }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

/* redaction bars (kept for the cheeky "hidden" accents) */
.redact {
  background: var(--redact);
  color: transparent;
  border-radius: 6px;
  padding: 0 0.16em;
  user-select: none;
  cursor: default;
}

/* ---------- decorative ---------- */
.decor { position: relative; height: 84px; margin-top: 6px; }

.mini-env {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 64px;
  filter: drop-shadow(0 8px 10px rgba(40, 26, 56, 0.25));
  animation: env-bob 3.4s ease-in-out infinite;
}
@keyframes env-bob {
  0%, 100% { transform: translateX(-50%) rotate(-3deg); }
  50% { transform: translateX(-50%) translateY(-8px) rotate(3deg); }
}

.confetti-dot {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 3px;
  opacity: 0.85;
  animation: bob 3.6s ease-in-out infinite;
}
.dot--1 { left: 20%; top: 20px; background: var(--gold); transform: rotate(24deg); }
.dot--2 { right: 22%; top: 34px; background: var(--rose); border-radius: 50%; animation-delay: -1.6s; }
.dot--3 { left: 32%; top: 4px; background: var(--sage); border-radius: 50%; animation-delay: -0.8s; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ---------- reveal sneak-peek photos (optional polaroid strip) ---------- */
.reveal-photos {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin: 20px auto 2px;
  max-width: 360px;
}
.peek {
  margin: 0;
  flex: 0 1 96px;
  background: #fffdf8;
  border: 1px solid rgba(59, 42, 77, 0.16);
  border-radius: 8px;
  padding: 5px 5px 0;
  box-shadow: 0 8px 18px rgba(40, 26, 56, 0.18);
  transition: transform 0.18s ease;
}
.peek--mid { flex-basis: 118px; transform: translateY(-4px); }
.peek:nth-child(1) { transform: rotate(-4deg); }
.peek:nth-child(2) { transform: rotate(1.5deg) translateY(-4px); }
.peek:nth-child(3) { transform: rotate(4deg); }
.peek:hover { transform: rotate(0deg) translateY(-3px); }
.peek img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 5px;
  background: var(--paper-2);
}

/* ==========================================================================
   Plan panel
   ========================================================================== */
.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.panel-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 8vw, 42px);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--plum);
  line-height: 1.05;
  margin-bottom: 12px;
}
.panel-lead {
  color: var(--text-soft);
  font-size: 15px;
  margin-bottom: 22px;
  max-width: 46ch;
}

.plan-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

.plan-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fffdf8;
  border: 1px dashed rgba(59, 42, 77, 0.3);
  border-radius: 14px;
  padding: 15px 17px;
  box-shadow: 0 4px 14px rgba(40, 26, 56, 0.06);
}
/* inner dashed frame — reads like a stamped document, not a plain border */
.plan-card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(201, 162, 75, 0.4);
  border-radius: 9px;
  pointer-events: none;
}
/* hand-placed tilt: even cards lean one way, odd cards the other */
.plan-card:nth-child(odd) { transform: rotate(-0.4deg); }
.plan-card:nth-child(even) { transform: rotate(0.5deg); }
/* dog-eared corner so the cards feel like pinned notes, not boxes */
.plan-card::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  background: linear-gradient(225deg, rgba(59, 42, 77, 0.07) 50%, transparent 50%);
  border-bottom-left-radius: 8px;
  border-top-right-radius: 13px;
  pointer-events: none;
}
.plan-ico {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  font-size: 20px;
  line-height: 1;
  background: var(--paper-2);
  border: 1px dashed rgba(59, 42, 77, 0.25);
  border-radius: 9px;
}
.plan-card p { font-size: 15px; color: var(--text); }
.plan-card strong { color: var(--plum); }

.note-card {
  background: var(--plum);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 14px;
  margin-bottom: 4px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.note-card::after {
  content: "🤫";
  position: absolute;
  right: 10px; bottom: -6px;
  font-size: 40px;
  opacity: 0.14;
  transform: rotate(-12deg);
}
.note-card strong { color: var(--gold); }
.note-ps { margin-top: 10px; font-size: 13px; opacity: 0.85; }

/* ==========================================================================
   Moments photo gallery (optional tab — delete the section to hide it)
   ========================================================================== */
.moment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.moment {
  margin: 0;
  background: #fffdf8;
  border: 1px solid rgba(59, 42, 77, 0.12);
  border-radius: 14px;
  padding: 8px 8px 0;
  box-shadow: 0 4px 14px rgba(40, 26, 56, 0.08);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.moment:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(40, 26, 56, 0.14);
}
.moment-grid > .moment:first-child { grid-column: 1 / -1; }
.moment img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 9px;
  background: var(--paper-2);   /* keeps the frame tidy if an image is missing */
}
.moment figcaption {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-soft);
  text-align: center;
  padding: 9px 4px 11px;
}
.moment figcaption strong { color: var(--plum); }

/* ==========================================================================
   RSVP form
   ========================================================================== */
.rsvp-form { display: flex; flex-direction: column; gap: 18px; }

.rsvp-field { display: flex; flex-direction: column; gap: 6px; }
.rsvp-field label,
.rsvp-field legend {
  font-size: 14px;
  font-weight: 800;
  color: var(--plum);
  padding: 0;
}
.rsvp-field label small { font-weight: 600; color: var(--text-soft); }

.rsvp-field input[type="text"],
.rsvp-field input[type="email"],
.rsvp-field input[type="tel"],
.rsvp-field select,
.rsvp-field textarea {
  width: 100%;
  border: 2px solid rgba(59, 42, 77, 0.16);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rsvp-field input:focus,
.rsvp-field select:focus,
.rsvp-field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.25);
}
.rsvp-field textarea { resize: vertical; min-height: 72px; }
.rsvp-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%233b2a4d' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* attending segmented choice */
.rsvp-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.choice-card { position: relative; cursor: pointer; }
.choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice-face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  border: 2px solid rgba(59, 42, 77, 0.16);
  border-radius: 12px;
  padding: 12px 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-soft);
  background: #fffdf8;
  transition: all 0.15s ease;
  min-height: 52px;
}
.choice-card input:checked + .choice-face {
  border-color: var(--sage);
  background: rgba(143, 174, 143, 0.22);
  color: var(--plum);
  box-shadow: 0 0 0 3px rgba(143, 174, 143, 0.3);
}
.choice-card input:focus-visible + .choice-face {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.choice-card:nth-child(2) input:checked + .choice-face {
  border-color: var(--rose);
  background: rgba(226, 100, 124, 0.14);
  box-shadow: 0 0 0 3px rgba(226, 100, 124, 0.2);
}
.choice-card:hover .choice-face { border-color: var(--gold); }

/* platform-injected error messages (hidden until shown) */
.error-message {
  display: none;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

/* platform-controlled loading state */
.loading {
  display: none;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.form-footnote {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--text-soft);
  text-align: center;
}

/* ==========================================================================
   Guestbook (platform mounts content into .guestbook-body)
   ========================================================================== */
.guestbook-section .guestbook-body { margin-top: 4px; }
.guestbook-body { min-height: 60px; }
.guestbook-body:empty::after {
  content: "No whispers yet — be the first. 🤫";
  display: block;
  color: var(--text-soft);
  font-style: italic;
  font-size: 14px;
  text-align: center;
  padding: 26px 0;
  border: 1.5px dashed rgba(59, 42, 77, 0.25);
  border-radius: var(--radius);
}

/* ==========================================================================
   Mission checklist
   ========================================================================== */
.checklist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.check-item {
  background: #fffdf8;
  border: 1px solid rgba(59, 42, 77, 0.1);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.15s ease;
}
.check-item:hover { transform: translateX(3px); }

.check-item label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  cursor: pointer;
}
.check-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.check-box {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  margin-top: 1px;
  border: 2px solid rgba(59, 42, 77, 0.3);
  border-radius: 8px;
  position: relative;
  transition: all 0.15s ease;
}
.check-item input:checked + .check-box {
  background: var(--sage);
  border-color: var(--sage);
}
.check-item input:checked + .check-box::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 15px;
}
.check-item input:focus-visible + .check-box {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.check-text { font-size: 14.5px; color: var(--text); transition: color 0.15s ease; }
.check-item input:checked ~ .check-text {
  color: var(--text-soft);
  text-decoration: line-through;
  text-decoration-color: var(--sage);
}

.progress-card {
  background: var(--plum);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 14px;
}
.progress-meta strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
}
.progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(251, 246, 238, 0.16);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--rose));
  transition: width 0.4s ease;
}
.progress-note {
  margin-top: 10px;
  font-size: 13px;
  color: rgba(251, 246, 238, 0.75);
  font-style: italic;
}

.mission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.mission-tip {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-soft);
  font-style: italic;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  border: none;
  border-radius: 999px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.btn--primary {
  background: var(--plum);
  color: var(--paper);
  box-shadow: 0 8px 20px rgba(59, 42, 77, 0.35);
}
.btn--primary:hover { background: var(--plum-soft); box-shadow: 0 10px 24px rgba(59, 42, 77, 0.42); }

.btn--ghost {
  background: transparent;
  color: var(--plum);
  border: 2px solid var(--plum);
}
.btn--ghost:hover { background: rgba(59, 42, 77, 0.06); }

.btn--warn {
  background: var(--rose);
  color: #fff;
  box-shadow: 0 8px 20px rgba(226, 100, 124, 0.38);
}
.btn--warn:hover { background: #d9546d; }

.btn--block { width: 100%; }

/* ==========================================================================
   Bottom nav tabs
   ========================================================================== */
.invite-nav {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-around;
  gap: 4px;
  background: var(--plum);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(251, 246, 238, 0.12);
}

.nav-btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  border-radius: 12px;
  padding: 7px 2px 6px;
  color: rgba(251, 246, 238, 0.55);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  min-width: 0;
}
.nav-btn .nav-ico { font-size: 19px; line-height: 1; }
.nav-btn .nav-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.nav-btn:hover { color: var(--paper); background: rgba(251, 246, 238, 0.08); }
.nav-btn.is-active { color: var(--paper); background: rgba(201, 162, 75, 0.22); }
.nav-btn.is-active .nav-label { color: var(--gold); }
.nav-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ==========================================================================
   Sealed envelope intro overlay
   ========================================================================== */
.envelope-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background:
    radial-gradient(circle at 20% 15%, rgba(201, 162, 75, 0.16), transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(226, 100, 124, 0.14), transparent 45%),
    var(--plum-deep);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.envelope-overlay.is-hidden { display: none; }

.env-inner {
  max-width: 380px;
  text-align: center;
  margin: auto;
}

.env {
  position: relative;
  width: 210px;
  height: 140px;
  margin: 0 auto 26px;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.4));
}
.env-body {
  position: absolute;
  inset: 0;
  background: var(--paper-2);
  border-radius: 8px;
  z-index: 1;
}
.env-flap {
  position: absolute;
  top: 0; left: 0;
  width: 0; height: 0;
  border-left: 105px solid transparent;
  border-right: 105px solid transparent;
  border-top: 78px solid var(--paper-3);
  z-index: 3;
  transform-origin: top center;
  animation: flap-wiggle 2.6s ease-in-out infinite;
}
@keyframes flap-wiggle {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(2.5deg); }
}
.env-seal {
  position: absolute;
  top: 96px; left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d9b45f, var(--gold) 60%, #a8822f);
  color: var(--plum-deep);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.35);
}

.env-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 14px;
}
.env-text {
  font-size: 15px;
  color: rgba(251, 246, 238, 0.82);
  max-width: 34ch;
  margin: 0 auto 22px;
}
.env-small {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(251, 246, 238, 0.55);
  font-style: italic;
}

/* ==========================================================================
   Quick-cover decoy overlay (looks like a boring notes screen)
   ========================================================================== */
.decoy-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--paper);
  color: var(--text);
  display: none;
  padding: 24px;
  overflow-y: auto;
}
.decoy-overlay.is-active { display: block; }

.decoy-paper {
  max-width: 460px;
  margin: 0 auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(40, 26, 56, 0.12);
  padding: 26px 24px;
}
.decoy-heading {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--paper-3);
  padding-bottom: 12px;
}
.decoy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.decoy-sub {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 8px;
}
.decoy-col li {
  font-size: 14px;
  color: var(--text-soft);
  padding: 3px 0;
}
.decoy-overlay .btn { width: 100%; }

/* ==========================================================================
   Confetti layer (spawned by main.js)
   ========================================================================== */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  overflow: hidden;
}
.confetti-layer span {
  position: absolute;
  top: -3vh;
  border-radius: 2px;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(-3vh) rotate(0deg); opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0; }
}

/* ==========================================================================
   Official party poster / flyer (optional block on the reveal panel)
   ========================================================================== */
.banner-flyer {
  margin: 22px auto 4px;
  max-width: 440px;
  text-align: center;
}
.banner-flyer img {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: var(--paper-2);   /* mat if the file is missing */
  border: 2px solid rgba(201, 162, 75, 0.55);
  box-shadow: 0 10px 24px rgba(40, 26, 56, 0.16);
}
.banner-flyer figcaption {
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-soft);
}

/* ==========================================================================
   Party film — optional video feature (paste a URL into data-video-url)
   ========================================================================== */
.film-card {
  margin-top: 26px;
  text-align: center;
  border-top: 1.5px dashed rgba(59, 42, 77, 0.18);
  padding-top: 22px;
}
.gallery-label {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--plum);
  text-align: center;
}
.film-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--paper-2);   /* mat behind the poster / while loading */
  border: 2px solid rgba(59, 42, 77, 0.12);
  box-shadow: 0 10px 24px rgba(40, 26, 56, 0.16);
}
.film-open {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  padding: 0; border: 0; background: none;
  cursor: pointer;
}
.film-open img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.film-play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(56px, 14vmin, 72px); height: clamp(56px, 14vmin, 72px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--plum);
  background: radial-gradient(circle at 32% 28%, #fffdf8, var(--paper-2) 60%, var(--paper-3));
  border: 1px solid rgba(201, 162, 75, 0.8);
  box-shadow: 0 12px 28px -10px rgba(40, 26, 56, 0.6);
  animation: film-pulse 2.6s ease-in-out infinite;
  transition: transform 0.2s ease;
}
.film-play svg { width: 26px; height: 26px; margin-left: 3px; }
.film-open:hover .film-play { transform: translate(-50%, -50%) scale(1.08); }
.film-open:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.film-hint {
  position: absolute; left: 50%; bottom: 14px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(40, 26, 56, 0.62);
  color: var(--paper);
  font-size: 10px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
  pointer-events: none;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.film-frame iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.film-note {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  margin: 0; padding: 0 18px;
  color: var(--text-soft);
  font-size: 13.5px; font-style: italic; text-align: center;
  background: var(--paper-2);
}
.film-external {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px;
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--plum);
  text-decoration: none;
  border-bottom: 2px solid rgba(201, 162, 75, 0.6);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.film-external:hover { color: var(--gold); border-color: var(--gold); }
.film-external[hidden] { display: none; }
@keyframes film-pulse {
  0%, 100% { box-shadow: 0 12px 28px -10px rgba(40, 26, 56, 0.6), 0 0 0 0 rgba(201, 162, 75, 0.4); }
  50% { box-shadow: 0 12px 28px -10px rgba(40, 26, 56, 0.6), 0 0 0 14px rgba(201, 162, 75, 0); }
}

/* ==========================================================================
   Free page (optional tab — "More"). Repeatable title + text + photo blocks
   ========================================================================== */
.free-blocks {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 22px;
}
.free-block {
  background: var(--paper-2);
  border: 1px solid rgba(201, 162, 75, 0.55);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: 0 8px 20px -12px rgba(40, 26, 56, 0.35);
}
.free-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--plum);
  margin-bottom: 8px;
}
.free-content {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}
.free-figure {
  margin: 14px 0 0;
  text-align: center;
}
.free-figure .free-img {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid #fffdf8;
  box-shadow: 0 10px 22px -12px rgba(40, 26, 56, 0.5);
  background: var(--paper-3);
}
.free-cap {
  margin-top: 8px;
  font-size: 12px;
  font-style: italic;
  color: var(--text-soft);
}

/* ==========================================================================
   Brand footer (placeholder) — tucked into the last panel by main.js
   ========================================================================== */
html:not(.js) .app-footer { display: block; padding: 22px 18px 30px; text-align: center; }
html.js .app-footer { display: none; }
html.js .panel .app-footer {
  display: block;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px dashed rgba(59, 42, 77, 0.2);
}
.footer-brand {
  margin: 0;
  font-size: 11px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-soft);
}
.footer-brand-name {
  font-family: var(--font-display);
  font-size: 1.25em;
  text-transform: none; letter-spacing: 0.02em;
  color: var(--plum);
}

/* ==========================================================================
   Powered-by brand line (full-width footer strip above the tab bar)
   ========================================================================== */
.powered-by {
  flex: 0 0 auto;
  width: 100%;
  text-align: center;
  padding: 7px 16px;
  background: var(--paper);
  border-top: 1px solid rgba(59, 42, 77, 0.1);
}
.powered-by p {
  margin: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.powered-by span { color: var(--plum); }

/* ==========================================================================
   Photo viewer (lightbox) — tap any photo to view it full size
   ========================================================================== */
html.js .peek img, html.js .moment img, html.js .banner-flyer img, html.js .free-figure img { cursor: zoom-in; }
html.js .peek, html.js .moment, html.js .banner-flyer, html.js .free-figure { position: relative; }

/* Small "view full size" badge on hover / keyboard focus — shows the photo
   is tappable. Purely visual; without JS (no viewer) it never appears. */
html.js .peek::after,
html.js .moment::after,
html.js .banner-flyer::after,
html.js .free-figure::after {
  content: "";
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.94)
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23543d6e' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5L21 21'/%3E%3C/svg%3E")
    center / 15px no-repeat;
  border: 1px solid rgba(201, 162, 75, 0.7);
  box-shadow: 0 4px 12px -4px rgba(40, 26, 56, 0.45);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 2;
}
html.js .peek:hover::after, html.js .peek:focus-within::after,
html.js .moment:hover::after, html.js .moment:focus-within::after,
html.js .banner-flyer:hover::after, html.js .banner-flyer:focus-within::after,
html.js .free-figure:hover::after, html.js .free-figure:focus-within::after {
  opacity: 1;
  transform: none;
}

.photo-viewer {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: rgba(40, 26, 56, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.photo-viewer.is-open { display: flex; }
.photo-viewer figure {
  margin: 0;
  max-width: min(92vw, 960px);
  display: flex; flex-direction: column; align-items: center;
  gap: 12px;
  text-align: center;
}
.photo-viewer img {
  display: block;
  max-width: 100%; max-height: 76vh; max-height: 76dvh;
  width: auto; height: auto;
  border: 5px solid #fffdf8;
  border-radius: 12px;
  background: var(--paper-2);   /* mat while loading / if the file is missing */
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.75);
}
.photo-viewer figcaption {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--paper);
}
.photo-viewer .pv-unavailable {
  display: flex; align-items: center; justify-content: center;
  width: min(72vw, 520px); height: min(46vh, 360px);
  border: 5px solid #fffdf8; border-radius: 12px;
  background: var(--paper-2);
  color: var(--text-soft);
  font-size: 14px; font-style: italic;
}

.pv-btn {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(251, 246, 238, 0.5);
  background: rgba(255, 253, 248, 0.94);
  color: var(--plum);
  font-size: 24px; line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.6);
  transition: transform 0.18s ease, background-color 0.18s ease;
}
.pv-btn:hover { transform: scale(1.06); background: #fff; }
.pv-close { top: calc(14px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right)); }
.pv-prev  { left: 12px;  top: 50%; transform: translateY(-50%); }
.pv-next  { right: 12px; top: 50%; transform: translateY(-50%); }
.pv-prev:hover, .pv-next:hover { transform: translateY(-50%) scale(1.06); }
.photo-viewer :focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* Narrow screens: prev/next drop below the photo so they never cover it. */
@media (max-width: 520px) {
  .photo-viewer { flex-direction: column; gap: 10px; }
  .photo-viewer img { max-height: 62vh; max-height: 62dvh; }
  .pv-prev, .pv-next { position: static; transform: none; }
  .pv-prev:hover, .pv-next:hover { transform: scale(1.06); }
  .pv-prev, .pv-next { width: 40px; height: 40px; }
  .photo-viewer figure { flex: 1 1 auto; justify-content: center; }
  .photo-viewer .pv-close { top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
}

/* Very narrow phones: compress the six tab labels so none ever truncates. */
@media (max-width: 380px) {
  .invite-nav { gap: 2px; padding-left: 6px; padding-right: 6px; }
  .nav-btn { padding-left: 1px; padding-right: 1px; }
  .nav-btn .nav-label { font-size: 9px; letter-spacing: 0.01em; }
}

/* ==========================================================================
   Accessibility: prefers-reduced-motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .mini-env, .confetti-dot, .loading, .env-flap { animation: none; }
  .check-item:hover, .btn:active { transform: none; }
}

/* ==========================================================================
   Print — clean, single-flow version; overlays never print
   ========================================================================== */
@media print {
  body.theme-card { background: #fff; color: #111; }
  .invite-shell {
    height: auto;
    max-width: none;
    display: block;
    overflow: visible;
    box-shadow: none;
    background: #fff;
  }
  .invite-header { background: #fff; color: #111; border-bottom: 2px solid #111; }
  .brand-text strong { color: #111; }
  .brand-text small, .countdown, .countdown-label { color: #555; }
  .panic-btn,
  .invite-nav,
  .envelope-overlay,
  .decoy-overlay,
  .decor,
  .btn,
  .mission-actions,
  .mission-tip,
  .powered-by { display: none !important; }
  .invite-panels { overflow: visible; }
  .panel {
    position: static;
    display: block !important;
    overflow: visible;
    height: auto;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .panel-inner { max-width: none; padding: 16px 0; }
  .reveal-big { text-shadow: none; }
  .plan-card, .note-card, .progress-card, .check-item, .choice-face {
    box-shadow: none;
    background: #f6f6f6;
    border-color: #999;
  }
  .rsvp-form, .moment, .peek, .banner-flyer, .film-card { break-inside: avoid; }
  .photo-viewer { display: none !important; }
  .film-frame iframe { display: none; } /* a playing video can't print — the poster prints instead */
}

/* ── Guestbook (platform-injected form + message list) ─────────────── */
#guestbookForm {
  background: #fffdf8;
  border: 1px solid rgba(59, 42, 77, 0.14);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
}
#guestbookForm .form-group { margin-bottom: 1rem; }
#guestbookForm .form-group label {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--plum);
  margin-bottom: 6px;
}
#guestbookForm .form-control {
  width: 100%;
  height: auto;
  border: 2px solid rgba(59, 42, 77, 0.16);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#guestbookForm .form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.25);
}
#guestbookForm textarea.form-control {
  resize: vertical;
  min-height: 76px;
}
#guestbookForm .error {
  display: block;
  min-height: 1.05em;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--danger);
}
#guestbookForm button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  background: var(--plum);
  color: var(--paper);
  box-shadow: 0 8px 20px rgba(59, 42, 77, 0.35);
  margin: 0.5rem auto 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
#guestbookForm button[type="submit"]:hover {
  background: var(--plum-soft);
  box-shadow: 0 10px 24px rgba(59, 42, 77, 0.42);
}
.guestbook-chapta { margin: 0.9rem 0; }
.loading-guestbook {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
}
#comments-container.guestbook-wrap {
  border-top: 1px solid rgba(59, 42, 77, 0.14);
  padding-top: 1.1rem;
}
.guestbook-entry {
  background: #fffdf8;
  border: 1px solid rgba(59, 42, 77, 0.14);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.guestbook-entry h5 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 6px;
  color: var(--plum);
}
.guestbook-entry p {
  margin: 0 0 8px;
  line-height: 1.6;
  font-size: 14.5px;
  color: var(--text);
}
.guestbook-entry small {
  color: var(--text-soft);
  font-size: 12px;
}
.more-guestbook-wrap {
  text-align: center;
  margin-top: 14px;
}
.more-guestbook-wrap #load-more {
  background: transparent;
  border: 2px solid var(--plum);
  border-radius: 999px;
  color: var(--plum);
  font-weight: 800;
  font-size: 14px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.more-guestbook-wrap #load-more:hover { background: rgba(59, 42, 77, 0.06); }
