.template-render-stack {
  display: grid;
  gap: 1.1rem;
}

.template-surface-shell {
  position: relative;
  overflow: hidden;
  border-radius: 34px;
  background: linear-gradient(135deg, var(--pack-start, #fff4fa), var(--pack-end, #fff6df));
  color: var(--pack-text, #2f2435);
  box-shadow: var(--pack-shadow, 0 30px 90px rgba(34,16,44,0.14));
  border: 1px solid var(--pack-border, rgba(255,255,255,0.65));
  isolation: isolate;
}

.template-surface-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top center, var(--pack-overlay, rgba(255,255,255,0.18)), transparent 52%);
  pointer-events: none;
  z-index: 0;
}

.template-surface-shell > * {
  position: relative;
  z-index: 1;
}

.template-surface-shell.panel-midnight {
  border-color: rgba(255,255,255,0.12);
}

.template-surface-picker {
  min-height: 250px;
}

.template-surface-dashboard {
  min-height: 420px;
}

.template-surface-gate,
.template-surface-invite {
  min-height: 620px;
}

.template-surface-shell.layout-celebration-center .template-inner,
.template-surface-shell.layout-romance-portrait .template-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  padding: 2.3rem;
}

.template-surface-shell.layout-split-showcase .template-inner,
.template-surface-shell.layout-modern-stage .template-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
  gap: 1.4rem;
  padding: 2.3rem;
}

.template-content-panel {
  position: relative;
  border-radius: 28px;
  padding: 1.55rem 1.55rem 1.35rem;
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
  border: 1px solid var(--pack-surface-outline, rgba(255,255,255,0.5));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.48), 0 24px 54px rgba(22, 16, 28, 0.12);
}

.panel-glass .template-content-panel,
.panel-glass.template-content-panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.42), rgba(255,255,255,0.2)),
    var(--pack-surface, rgba(255,255,255,0.28));
}

.panel-cream .template-content-panel,
.panel-cream.template-content-panel,
.panel-ivory .template-content-panel,
.panel-ivory.template-content-panel,
.panel-paper .template-content-panel,
.panel-paper.template-content-panel {
  background: var(--pack-surface-strong, rgba(255,255,255,0.92));
}

.panel-midnight .template-content-panel,
.panel-midnight.template-content-panel {
  background: var(--pack-surface, rgba(17,24,39,0.56));
}

.panel-paper .template-content-panel,
.panel-paper.template-content-panel {
  background-image:
    linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,255,255,0.86)),
    linear-gradient(0deg, rgba(230, 217, 221, 0.16) 1px, transparent 1px);
  background-size: auto, 100% 14px;
}

.template-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.template-chip,
.template-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  background: var(--pack-chip-bg, rgba(255,255,255,0.84));
  color: var(--pack-chip-text, var(--pack-text, #2f2435));
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.template-eyebrow {
  margin: 0 0 0.5rem;
  color: var(--pack-text-soft, #6f6073);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.template-title {
  margin: 0;
  color: var(--pack-text, #2f2435);
  font-family: var(--pack-display-font, "Inter", Arial, sans-serif);
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.95;
}

.template-surface-picker .template-title {
  font-size: clamp(1.45rem, 2.6vw, 2.2rem);
}

.template-message {
  margin: 0.9rem 0 0;
  font-family: var(--pack-body-font, "Inter", Arial, sans-serif);
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--pack-text-soft, #6f6073);
}

.template-facts {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.15rem;
}

.template-fact {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.8rem 0.95rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.38), rgba(255,255,255,0.16));
  border: 1px solid rgba(255,255,255,0.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.42);
  color: var(--pack-text, #2f2435);
}

.panel-midnight .template-fact,
.template-pack-midnight-luxe .template-fact {
  background: rgba(255,255,255,0.08);
}

.template-fact-icon {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--pack-accent-soft, #ffd7ea);
  color: var(--pack-accent, #db2777);
  font-size: 0.95rem;
  flex: 0 0 auto;
}

.template-fact strong {
  display: block;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pack-text-soft, #6f6073);
  margin-bottom: 0.1rem;
}

.template-fact span,
.template-fact a {
  color: inherit;
  font-size: 0.98rem;
  line-height: 1.45;
}

.template-side {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.template-photo-frame {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  min-height: 280px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.32), 0 18px 40px rgba(28, 18, 32, 0.12);
}

.template-photo-frame.masked-frame {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  overflow: visible;
}

.template-photo-mask-shell {
  width: 100%;
  height: 100%;
  overflow: hidden;
  filter: drop-shadow(0 18px 32px rgba(24, 16, 28, 0.18));
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-position: center;
  mask-position: center;
}

.template-photo-mask-shell.mask-shape-circle {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='48' fill='white'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='48' fill='white'/%3E%3C/svg%3E");
}

.template-photo-mask-shell.mask-shape-heart {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 86'%3E%3Cpath fill='white' d='M50 86C14 60 0 42 0 27C0 11 13 0 27 0C37 0 45 7 50 16C55 7 63 0 73 0C87 0 100 11 100 27C100 42 86 60 50 86Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 86'%3E%3Cpath fill='white' d='M50 86C14 60 0 42 0 27C0 11 13 0 27 0C37 0 45 7 50 16C55 7 63 0 73 0C87 0 100 11 100 27C100 42 86 60 50 86Z'/%3E%3C/svg%3E");
}

.template-photo-mask-shell.mask-shape-star {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 92'%3E%3Cpath fill='white' d='M50 4L61 36H96L68 56L79 88L50 68L21 88L32 56L4 36H39L50 4Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 92'%3E%3Cpath fill='white' d='M50 4L61 36H96L68 56L79 88L50 68L21 88L32 56L4 36H39L50 4Z'/%3E%3C/svg%3E");
}

.template-photo-mask-shell.mask-shape-balloon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M50 2C78 2 95 20 95 42C95 64 80 80 59 84L55 93L50 100L45 93L41 84C20 80 5 64 5 42C5 20 22 2 50 2Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M50 2C78 2 95 20 95 42C95 64 80 80 59 84L55 93L50 100L45 93L41 84C20 80 5 64 5 42C5 20 22 2 50 2Z'/%3E%3C/svg%3E");
}

.template-photo-mask-shell.mask-shape-crown {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 90'%3E%3Cpath fill='white' d='M5 90V46L22 64L50 10L78 64L95 46V90Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 90'%3E%3Cpath fill='white' d='M5 90V46L22 64L50 10L78 64L95 46V90Z'/%3E%3C/svg%3E");
}

.template-photo-mask-shell.mask-shape-arch {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M10 98V38Q10 2 50 2Q90 2 90 38V98Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M10 98V38Q10 2 50 2Q90 2 90 38V98Z'/%3E%3C/svg%3E");
}

.template-photo-mask-shell.mask-shape-party-hat {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M50 2L97 90Q97 98 89 98H11Q3 98 3 90Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M50 2L97 90Q97 98 89 98H11Q3 98 3 90Z'/%3E%3C/svg%3E");
}

.template-photo-mask-shell.mask-shape-cake {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M6 98V68H13V42H22V20H78V42H87V68H94V98Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M6 98V68H13V42H22V20H78V42H87V68H94V98Z'/%3E%3C/svg%3E");
}

.template-photo-mask-shell.mask-shape-dino {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 98'%3E%3Cpath fill='white' d='M5 86V52C5 40 12 37 20 37L25 25L30 37L38 16L43 37L52 22L56 37C72 33 88 42 92 58L96 66L92 72V90H77V98H62V90H30V98H15V90H5Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 98'%3E%3Cpath fill='white' d='M5 86V52C5 40 12 37 20 37L25 25L30 37L38 16L43 37L52 22L56 37C72 33 88 42 92 58L96 66L92 72V90H77V98H62V90H30V98H15V90H5Z'/%3E%3C/svg%3E");
}

.template-photo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(32,24,34,0.18), transparent 42%);
  pointer-events: none;
}

.template-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.template-photo-fallback {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.4rem;
  color: var(--pack-text-soft, #6f6073);
  font-family: var(--pack-body-font, "Inter", Arial, sans-serif);
}

.template-note-card,
.template-form-card,
.template-rsvp-card {
  border-radius: 24px;
  padding: 1.2rem 1.25rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.34), rgba(255,255,255,0.18));
  border: 1px solid var(--pack-surface-outline, rgba(255,255,255,0.46));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.48), 0 16px 34px rgba(23, 17, 28, 0.1);
  backdrop-filter: blur(16px) saturate(145%);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
}

.panel-midnight .template-note-card,
.panel-midnight .template-form-card,
.panel-midnight .template-rsvp-card,
.template-pack-midnight-luxe .template-note-card,
.template-pack-midnight-luxe .template-form-card,
.template-pack-midnight-luxe .template-rsvp-card {
  background: rgba(17,24,39,0.56);
}

.template-surface-shell form label {
  display: grid;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--pack-text, #2f2435);
}

.template-surface-shell input[type="text"],
.template-surface-shell select,
.template-surface-shell textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(141, 110, 151, 0.18);
  padding: 0.9rem 1rem;
  font: inherit;
  background: rgba(255,255,255,0.94);
  color: #2f2435;
}

.template-surface-shell textarea {
  min-height: 110px;
  resize: vertical;
}

.template-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.35rem;
  font-size: 0.98rem;
  font-weight: 800;
  background: var(--pack-button, #db2777);
  color: var(--pack-button-text, #fff);
  text-decoration: none;
  box-shadow: 0 16px 30px rgba(26, 14, 32, 0.14);
}

.template-button.secondary {
  background: rgba(255,255,255,0.7);
  color: var(--pack-text, #2f2435);
}

.template-layer {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

.template-layer img,
.template-layer svg {
  display: block;
  width: 100%;
  height: auto;
}

.template-layer.desktop-only {
  display: block;
}

.template-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: space-between;
  align-items: center;
}

.template-pack-preview-wrap {
  position: relative;
  min-height: 100%;
}

.template-surface-picker .template-content-panel {
  min-height: 218px;
  padding: 1.2rem;
}


.template-surface-picker .template-inner {
  grid-template-columns: 1fr !important;
}

.template-layer.desktop-only-hidden {
  display: none;
}

.template-surface-picker .template-facts,
.template-surface-picker .template-photo-frame,
.template-surface-picker .template-note-card,
.template-surface-picker .template-form-card,
.template-surface-picker .template-rsvp-card {
  display: none;
}

.template-surface-dashboard .template-content-panel {
  min-height: 100%;
}

.template-empty-card {
  padding: 1.25rem;
  min-height: 250px;
}

.template-venue-link {
  color: var(--pack-accent, #db2777);
  font-weight: 700;
  text-decoration: none;
}

.template-host-note {
  margin: 0;
  color: var(--pack-text-soft, #6f6073);
  font-size: 0.94rem;
}

.template-pack-midnight-luxe,
.template-pack-midnight-luxe .template-title,
.template-pack-midnight-luxe .template-message,
.template-pack-midnight-luxe .template-host-note,
.template-pack-midnight-luxe .template-fact strong,
.template-pack-midnight-luxe .template-fact span,
.template-pack-midnight-luxe .template-fact a,
.template-pack-midnight-luxe form label {
  color: var(--pack-text, #f8fafc);
}

.template-pack-midnight-luxe .template-message,
.template-pack-midnight-luxe .template-host-note,
.template-pack-midnight-luxe .template-fact strong {
  color: var(--pack-text-soft, #d1d5db);
}

.template-picker-grid .template-option {
  align-self: stretch;
}

.template-picker-grid .template-option input {
  display: none;
}

.template-picker-grid .template-option.selected .template-surface-shell,
.template-picker-grid .template-option input:checked + .template-option-card .template-surface-shell,
.template-picker-grid .template-option:hover .template-surface-shell {
  transform: translateY(-4px);
  box-shadow: 0 26px 64px rgba(24, 18, 30, 0.18);
}

.template-option-card {
  display: block;
}

@media (max-width: 960px) {
  .template-surface-shell.layout-split-showcase .template-inner,
  .template-surface-shell.layout-modern-stage .template-inner {
    grid-template-columns: 1fr;
  }

  .template-layer.desktop-only {
    display: none;
  }
}

@media (max-width: 640px) {
  .template-layer.mobile-hidden {
    display: none;
  }

  .template-surface-shell {
    border-radius: 26px;
  }

  .template-surface-shell.layout-celebration-center .template-inner,
  .template-surface-shell.layout-romance-portrait .template-inner,
  .template-surface-shell.layout-split-showcase .template-inner,
  .template-surface-shell.layout-modern-stage .template-inner {
    padding: 1.35rem;
  }

  .template-content-panel,
  .template-note-card,
  .template-form-card,
  .template-rsvp-card,
  .template-photo-frame {
    border-radius: 22px;
  }

  .template-title {
    font-size: clamp(1.8rem, 8vw, 3rem);
  }

  .template-layer {
    opacity: 0.88;
  }
}


/* build43: picker polish + stable preview proportions */
.template-picker-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.template-option-card {
  position: relative;
  display: block;
  width: 100%;
  border-radius: 34px;
  padding: 6px;
  background: transparent;
  cursor: pointer;
  outline: none;
}

.template-option-card::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 30px;
  border: 2px solid transparent;
  box-shadow: 0 0 0 0 rgba(233,78,138,0);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  pointer-events: none;
}

.template-option-card .template-surface-shell,
.template-surface-picker.template-surface-shell {
  width: 100%;
  min-height: 0;
  aspect-ratio: 1.56 / 1;
}

.template-surface-picker .template-inner {
  height: 100%;
  align-content: stretch;
  padding: 1rem;
}

.template-surface-picker .template-content-panel {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem;
}

.template-surface-picker .template-title {
  font-size: clamp(1.2rem, 1.65vw, 1.8rem);
}

.template-surface-picker .template-message {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.92rem;
  line-height: 1.45;
}

.template-surface-picker .template-chip,
.template-surface-picker .template-badge-pill,
.template-surface-picker .template-eyebrow {
  font-size: 0.68rem;
}

@media (max-width: 760px) {
  .template-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }

  .template-option-card .template-surface-shell,
  .template-surface-picker.template-surface-shell {
    aspect-ratio: 1.16 / 1;
  }

  .template-preview-modal-top {
    flex-direction: column;
    padding-right: 2rem;
  }
}

@media (max-width: 520px) {
  .template-picker-grid {
    grid-template-columns: 1fr;
  }

  .template-surface-picker .template-inner,
  .template-surface-picker .template-content-panel {
    padding: 0.85rem;
  }

  .template-surface-picker .template-title {
    font-size: clamp(1.05rem, 4.6vw, 1.35rem);
  }

  .template-option-card .template-surface-shell,
  .template-surface-picker.template-surface-shell {
    aspect-ratio: 1.45 / 1;
  }

  .template-preview-modal {
    padding: 1rem;
    border-radius: 22px;
  }
}


.template-picker-shell {
  display: grid;
  gap: 1rem;
}

.template-picker-header-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.template-picker-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.template-picker-heading {
  margin: 0;
  font-size: 1.15rem;
}

.template-picker-copy {
  margin: 0.32rem 0 0;
  color: var(--muted);
  max-width: 760px;
}

.template-picker-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(227, 183, 204, 0.62);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(33, 17, 36, 0.08);
}

.template-option {
  overflow: visible;
  background: transparent;
}

.template-option-preview-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.45rem 0.72rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #7a2b56;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.92);
  box-shadow: 0 10px 24px rgba(31, 16, 35, 0.12);
}

.template-picker-grid .template-option.selected .template-option-card::after,
.template-picker-grid .template-option input:checked + .template-option-card::after,
.template-picker-grid .template-option:hover .template-option-card::after,
.template-option-card:focus-visible::after {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(233,78,138,0.16);
}

.template-picker-grid .template-option.selected .template-surface-shell,
.template-picker-grid .template-option input:checked + .template-option-card .template-surface-shell,
.template-picker-grid .template-option:hover .template-surface-shell,
.template-option-card:focus-visible .template-surface-shell {
  transform: translateY(-4px);
  box-shadow: 0 26px 64px rgba(24, 18, 30, 0.18);
}

.template-preview-modal-overlay[hidden] {
  display: none !important;
}

.template-preview-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(17, 13, 23, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.template-preview-modal {
  position: relative;
  width: min(1120px, 100%);
  max-height: calc(100vh - 2.5rem);
  overflow: auto;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.9));
  box-shadow: 0 34px 90px rgba(0,0,0,0.28);
  padding: 1.35rem;
}

.template-preview-modal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-right: 2.4rem;
}

.template-preview-modal-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.template-preview-modal-top h3 {
  margin: 0;
  font-size: 1.4rem;
}

.template-preview-modal-subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 720px;
}

.template-preview-modal-body {
  display: grid;
}

.template-preview-modal-body .template-surface-shell {
  min-height: 0;
}

.template-preview-modal-surface.template-surface-shell {
  min-height: 680px;
}

.template-preview-modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.9rem;
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(23, 17, 29, 0.08);
  color: #241628;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  width: 1.15rem !important;
  min-width: 1.15rem !important;
  max-width: 1.15rem !important;
}

.template-reminder-toggle input.template-reminder-checkbox {
  width: 1.15rem !important;
  min-width: 1.15rem !important;
  max-width: 1.15rem !important;
  flex: 0 0 auto;
}

.template-reminder-toggle span {
  flex: 1 1 auto;
}

body.template-preview-modal-open {
  overflow: hidden;
}


/* build46: layout refinement, better glass, cleaner picker cards, and reliable masked media */
.template-picker-grid .template-option,
.form-grid .template-picker-grid .template-option,
.large-form .template-picker-grid .template-option {
  overflow: visible !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 34px;
}

.template-option-card {
  isolation: isolate;
  background: transparent !important;
  border-radius: 34px;
  box-shadow: none !important;
}

.template-option-card .template-surface-shell,
.template-surface-picker.template-surface-shell {
  aspect-ratio: 1.72 / 1;
}

.template-option-card::after {
  inset: 4px;
  border-radius: 32px;
}

.template-surface-invite.layout-celebration-center .template-inner,
.template-surface-invite.layout-romance-portrait .template-inner,
.template-surface-dashboard.layout-celebration-center .template-inner,
.template-surface-dashboard.layout-romance-portrait .template-inner {
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, 0.98fr);
  align-items: stretch;
  gap: 1.5rem;
}

.template-surface-invite .template-content-panel,
.template-surface-dashboard .template-content-panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.035)),
    rgba(255,255,255,0.075);
  border: 1px solid rgba(255,255,255,0.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.52), 0 24px 52px rgba(22, 16, 28, 0.12);
}

.template-surface-invite .template-fact,
.template-surface-dashboard .template-fact,
.template-surface-invite .template-note-card,
.template-surface-invite .template-form-card,
.template-surface-invite .template-rsvp-card,
.template-surface-dashboard .template-note-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.17), rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.22);
}

.template-surface-invite.panel-midnight .template-content-panel,
.template-surface-invite.panel-midnight .template-note-card,
.template-surface-invite.panel-midnight .template-form-card,
.template-surface-invite.panel-midnight .template-rsvp-card,
.template-surface-invite.panel-midnight .template-fact,
.template-surface-dashboard.panel-midnight .template-content-panel,
.template-surface-dashboard.panel-midnight .template-note-card,
.template-surface-dashboard.panel-midnight .template-fact,
.template-pack-midnight-luxe.template-surface-invite .template-content-panel,
.template-pack-midnight-luxe.template-surface-invite .template-note-card,
.template-pack-midnight-luxe.template-surface-invite .template-form-card,
.template-pack-midnight-luxe.template-surface-invite .template-rsvp-card,
.template-pack-midnight-luxe.template-surface-invite .template-fact,
.template-pack-midnight-luxe.template-surface-dashboard .template-content-panel,
.template-pack-midnight-luxe.template-surface-dashboard .template-note-card,
.template-pack-midnight-luxe.template-surface-dashboard .template-fact {
  background: rgba(10, 14, 28, 0.38);
  border-color: rgba(255,255,255,0.12);
}

.template-surface-invite .template-side,
.template-surface-dashboard .template-side {
  gap: 1.1rem;
}

.template-surface-invite .template-photo-frame,
.template-surface-dashboard .template-photo-frame {
  min-height: 360px;
}

.template-photo-frame.masked-frame::after {
  display: none;
}

.template-photo-frame.masked-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.template-preview-modal-body .template-photo-frame.masked-frame {
  overflow: visible;
}

@media (max-width: 960px) {
  .template-surface-invite.layout-celebration-center .template-inner,
  .template-surface-invite.layout-romance-portrait .template-inner,
  .template-surface-dashboard.layout-celebration-center .template-inner,
  .template-surface-dashboard.layout-romance-portrait .template-inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .template-option-card .template-surface-shell,
  .template-surface-picker.template-surface-shell {
    aspect-ratio: 1.28 / 1;
  }
}

@media (max-width: 520px) {
  .template-option-card .template-surface-shell,
  .template-surface-picker.template-surface-shell {
    aspect-ratio: 1.45 / 1;
  }
}


/* build48: smooth live masks + cleaner mobile template picker */
.template-photo-mask-shell[class*="mask-shape-"] {
  clip-path: none !important;
  -webkit-clip-path: none !important;
}

.template-picker-grid {
  align-items: start;
}

.template-picker-grid .template-option,
.template-picker-grid .template-option-card {
  min-width: 0;
}

.template-picker-grid .template-option-card {
  overflow: visible;
}

.template-picker-grid .template-option-card::after {
  inset: 2px;
  border-radius: 34px;
}

.template-picker-grid .template-option .template-surface-shell,
.template-picker-grid .template-option-card .template-surface-shell,
.template-surface-picker.template-surface-shell {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 760px) {
  .template-picker-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }

  .template-group-label {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
  }

  .template-picker-grid .template-option.selected .template-surface-shell,
  .template-picker-grid .template-option input:checked + .template-option-card .template-surface-shell,
  .template-picker-grid .template-option:hover .template-surface-shell,
  .template-option-card:focus-visible .template-surface-shell {
    transform: none;
  }

  .template-picker-grid .template-option.selected .template-option-card::after,
  .template-picker-grid .template-option input:checked + .template-option-card::after,
  .template-picker-grid .template-option:hover .template-option-card::after,
  .template-option-card:focus-visible::after {
    box-shadow: 0 0 0 3px rgba(233,78,138,0.18);
  }

  .template-option-card .template-surface-shell,
  .template-surface-picker.template-surface-shell {
    aspect-ratio: 1.62 / 1 !important;
  }

  .template-surface-picker .template-inner,
  .template-surface-picker .template-content-panel {
    padding: 0.95rem !important;
  }

  .template-surface-picker .template-title {
    font-size: clamp(1.1rem, 5vw, 1.45rem);
  }

  .template-surface-picker .template-message {
    -webkit-line-clamp: 2;
    font-size: 0.88rem;
  }

  .template-option-preview-hint {
    right: 10px;
    bottom: 10px;
    padding: 0.38rem 0.62rem;
    font-size: 0.68rem;
  }
}


.template-reminder-toggle {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.8rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  color: inherit;
}

.template-reminder-toggle span {
  display: inline-block;
  line-height: 1.2;
}

.template-reminder-toggle strong {
  font-size: 0.98rem;
  font-weight: 700;
}

.template-reminder-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.15rem !important;
  height: 1.15rem !important;
  min-width: 1.15rem;
  border-radius: 0.28rem !important;
  border: 2px solid rgba(233,78,138,0.95) !important;
  background: rgba(255,255,255,0.88) !important;
  box-shadow: none !important;
  margin: 0 !important;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.template-reminder-checkbox::after {
  content: '';
  width: 0.34rem;
  height: 0.6rem;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(45deg) scale(0);
  transform-origin: center;
  transition: transform 0.14s ease;
  margin-top: -0.05rem;
}

.template-reminder-checkbox:checked {
  background: #e94e8a !important;
}

.template-reminder-checkbox:checked::after {
  transform: rotate(45deg) scale(1);
}


@media (max-width: 700px) {
  .template-reminder-toggle {
    flex-wrap: nowrap !important;
    align-items: center !important;
  }

  .template-reminder-toggle input.template-reminder-checkbox {
    margin: 0 !important;
  }
}


/* build56: responsive follow-up surface */
.template-surface-followup .template-content-panel,
.template-surface-followup .template-side,
.template-surface-followup .template-photo-frame,
.template-surface-followup .template-note-card,
.template-surface-followup .template-form-card,
.template-surface-followup .template-rsvp-card {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 960px) {
  .template-surface-followup.layout-split-showcase .template-inner,
  .template-surface-followup.layout-modern-stage .template-inner,
  .template-surface-followup.layout-celebration-center .template-inner,
  .template-surface-followup.layout-romance-portrait .template-inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .template-surface-followup .template-inner {
    padding: 1rem;
    gap: 1rem;
  }

  .template-surface-followup .template-photo-frame {
    min-height: 240px;
  }
}
