:root {
  --ink: #1a1612;
  --ink-soft: #4a433a;
  --paper: #f7f0e8;
  --paper-2: #efe4d6;
  --accent: #c45c26;
  --accent-deep: #9a3f14;
  --mint: #2f6b5a;
  --rose: #d4788c;
  --line: rgba(26, 22, 18, 0.12);
  --shadow: 0 18px 50px rgba(26, 22, 18, 0.12);
  --radius: 18px;
  --font: "Manrope", sans-serif;
  --display: "Playfair Display", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(212, 120, 140, 0.22), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(47, 107, 90, 0.18), transparent 50%),
    linear-gradient(160deg, #fbf6ef 0%, #f0e6d8 45%, #e8dccb 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

#app {
  min-height: 100vh;
}

.home {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  position: relative;
  overflow: hidden;
}

.home-glow {
  position: absolute;
  inset: auto auto 10% -10%;
  width: 70vw;
  height: 70vw;
  max-width: 520px;
  max-height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196, 92, 38, 0.22), transparent 68%);
  filter: blur(8px);
  animation: float 7s ease-in-out infinite;
  pointer-events: none;
}

.home-card {
  width: min(100%, 420px);
  background: rgba(255, 252, 247, 0.88);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 10px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 28px 22px 22px;
  animation: rise 0.5s ease both;
  position: relative;
  z-index: 1;
}

.home-eyebrow {
  margin: 0 0 10px;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}

.home-title {
  font-family: var(--display);
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  line-height: 1;
  margin: 0 0 10px;
}

.home-lead {
  margin: 0 0 22px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.home-menu {
  display: grid;
  gap: 12px;
}

.menu-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fffdf9;
  border-radius: 16px;
  padding: 16px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.menu-item:hover {
  transform: translateY(-1px);
  border-color: rgba(196, 92, 38, 0.35);
  background: #fff8f0;
}

.menu-item:active {
  transform: scale(0.99);
}

.menu-num {
  font-family: var(--display);
  font-size: 1.35rem;
  color: var(--accent);
  min-width: 2ch;
}

.menu-body {
  display: grid;
  gap: 3px;
}

.menu-body strong {
  font-size: 1rem;
}

.menu-body small {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.back-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 600;
  padding: 0;
  margin: 0 0 14px;
  cursor: pointer;
}

.back-btn:hover {
  color: var(--ink);
}

.pages-block {
  margin: 4px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.7);
}

.pages-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.pages-head label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.page-tab {
  min-width: 42px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fffdf9;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  line-height: 1.1;
}

.page-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffaf4;
}

.page-tab.has-photo::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
}

.page-tab.active.has-photo::after {
  background: #fffaf4;
}

.page-photo-editor {
  margin-top: 4px;
}

.add-page-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.add-page-wrap select {
  border: 1px solid var(--line);
  background: #fffdf9;
  border-radius: 10px;
  padding: 8px 10px;
}

.field-hint {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.choice-editor {
  margin: 0 0 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(26, 22, 18, 0.03);
  border: 1px dashed var(--line);
}

.collapse-block {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.9);
  overflow: hidden;
}

.collapse-block.is-open {
  overflow: visible;
}

.collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  font-weight: 700;
}

.collapse-toggle:hover {
  background: rgba(26, 22, 18, 0.03);
}

.collapse-title {
  flex: 1;
  font-size: 0.95rem;
}

.collapse-badge {
  min-width: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(196, 92, 38, 0.12);
  color: var(--accent-deep);
  font-size: 0.75rem;
  text-align: center;
}

.collapse-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  margin-top: 2px;
}

.collapse-block.is-open > .collapse-toggle .collapse-chevron {
  transform: rotate(45deg);
  margin-top: -2px;
}

.collapse-body {
  display: none;
  padding: 0 14px 14px;
  overflow: visible;
}

.collapse-block.is-open > .collapse-body {
  display: block;
}

/* Nested accordion (list inside list) */
.collapse-body .collapse-block {
  margin: 12px 0 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(26, 22, 18, 0.04);
}

.collapse-body .collapse-toggle {
  padding: 12px;
  font-weight: 650;
}

.collapse-body .collapse-title {
  font-size: 0.9rem;
}

.collapse-body .collapse-body {
  padding: 0 12px 12px;
}

.design-editor .page-photo-editor {
  margin-top: 8px;
}

.collapse-body .pages-block {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.builder-form {
  display: grid;
  gap: 0;
}

.choice-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #fffdf9;
  border: 1px solid var(--line);
}

.choice-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.choice-row input,
.choice-row select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 9px 10px;
}

.mini-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.route-line {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--mint);
  font-weight: 600;
}

.route-map {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.route-map ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.route-map li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(47, 107, 90, 0.08);
}

.route-map li span {
  color: var(--ink-soft);
}

.route-map li strong {
  text-align: right;
  font-weight: 700;
  color: var(--mint);
}

.choice-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.choice-btn {
  width: 100%;
  border: 1px solid var(--choice-border);
  background: var(--choice-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
  backdrop-filter: blur(6px);
  text-shadow: var(--body-shadow);
}

.choice-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.invite.tap-advance {
  cursor: pointer;
}

.invite.tap-advance .invite-card {
  user-select: none;
}

.tap-hint {
  margin: 18px 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  text-shadow: var(--body-shadow);
  animation: pulseHint 1.8s ease-in-out infinite;
}

.outcome-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(8, 10, 14, 0.55);
  backdrop-filter: blur(6px);
  z-index: 5;
  animation: rise 0.3s ease both;
}

.outcome-window {
  width: min(100%, 300px);
  border-radius: 20px;
  padding: 22px 18px;
  text-align: center;
  border: 1px solid rgba(255, 244, 232, 0.2);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.outcome-window.tone-success {
  background: linear-gradient(165deg, #2f5a48 0%, #1a3028 100%);
}

.outcome-window.tone-neutral {
  background: linear-gradient(165deg, #3a342c 0%, #211c18 100%);
}

.outcome-window.tone-sad {
  background: linear-gradient(165deg, #4a3038 0%, #24161c 100%);
}

.outcome-label {
  margin: 0 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
}

.outcome-window h2 {
  font-family: var(--display);
  font-size: 1.7rem;
  margin: 0 0 10px;
}

.outcome-window p {
  margin: 0 0 18px;
  line-height: 1.45;
  opacity: 0.92;
}

.outcomes-editor {
  margin-bottom: 16px;
}

.empty-choices {
  padding: 14px;
  border-radius: 12px;
  background: rgba(196, 92, 38, 0.06);
  border: 1px dashed rgba(196, 92, 38, 0.28);
}

.empty-choices p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.4;
}

@keyframes pulseHint {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.85;
  }
}

.page-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: 999px;
}

.btn-ghost.danger {
  color: #9a3f14;
}

.btn-ghost:disabled,
.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
}

.page-progress .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 244, 232, 0.28);
}

.page-progress .dot.active {
  background: #fff4e8;
  transform: scale(1.15);
}

@media (max-width: 700px) {
  .add-page-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .route-map li {
    flex-direction: column;
    align-items: flex-start;
  }

  .route-map li strong {
    text-align: left;
  }
}

.sent-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.sent-panel h1 {
  margin-bottom: 6px;
}

.sent-list {
  display: grid;
  gap: 12px;
}

.sent-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf9;
  padding: 14px;
}

.sent-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.sent-top h2 {
  margin: 0;
  font-size: 1.05rem;
}

.sent-top time {
  font-size: 0.78rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.sent-title {
  margin: 8px 0 4px;
  font-weight: 600;
}

.sent-meta {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.sent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sent-actions .btn {
  padding: 9px 14px;
  font-size: 0.9rem;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  border-color: var(--line);
  color: var(--ink);
}

.empty-state {
  text-align: center;
  padding: 28px 12px;
}

.empty-state h2 {
  font-family: var(--display);
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--ink-soft);
}

.builder {
  display: block;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.builder-shell {
  width: 100%;
  padding: 16px;
}

.builder-sticky {
  position: sticky;
  top: 0;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  margin: -16px -16px 12px;
  padding: 12px 16px 12px;
  background: rgba(255, 252, 247, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px) calc(var(--radius) + 6px) 0 0;
}

.builder-sticky .back-btn {
  margin: 0 0 4px;
  font-size: 0.88rem;
  padding: 2px 0;
}

.builder-sticky h1 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  line-height: 1.15;
}

.builder-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.builder-stage-btn {
  border: 1px solid var(--line);
  background: #fffdf9;
  color: var(--ink-soft);
  border-radius: 12px;
  padding: 10px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.builder-stage-btn:hover {
  background: rgba(26, 22, 18, 0.04);
  color: var(--ink);
}

.builder-stage-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fffaf4;
}

.builder-stage {
  display: none;
}

.builder-stage.is-active {
  display: block;
}

.preview-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.preview-phone {
  width: min(100%, 390px);
}

.preview-phone .phone-screen {
  min-height: 0;
}

.preview-phone .invite.embedded {
  min-height: 100%;
  height: 100%;
}

.preview-restart {
  flex-shrink: 0;
  min-width: 140px;
}

/* Preview / Send: lock page scroll to the viewport */
body.is-stage-locked {
  overflow: hidden;
  height: 100dvh;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body.is-stage-locked .builder {
  height: 100dvh;
  max-height: 100dvh;
  padding: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.is-stage-locked .builder-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  padding: 12px;
}

body.is-stage-locked .builder-sticky {
  flex-shrink: 0;
  margin: -12px -12px 8px;
}

body.is-stage-locked .builder-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
}

body.is-stage-locked .builder-stage[data-stage-panel="preview"].is-active,
body.is-stage-locked .builder-stage[data-stage-panel="send"].is-active {
  flex: 1;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
}

body.is-preview-stage .preview-stage {
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 0;
  gap: 10px;
  justify-content: stretch;
  overflow: hidden;
}

body.is-preview-stage .preview-phone-slot {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

body.is-preview-stage .preview-phone-scaler {
  --preview-scale: 0.72;
  position: relative;
  width: 240px;
  height: 520px;
  flex-shrink: 0;
}

body.is-preview-stage .preview-phone {
  position: absolute;
  top: 0;
  left: 0;
  width: 240px;
  height: 520px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 10px 9px 11px;
  border-radius: 34px;
  margin: 0;
  transform: scale(var(--preview-scale));
  transform-origin: top left;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 14px 36px rgba(26, 22, 18, 0.28);
}

body.is-preview-stage .preview-phone::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 7px;
  border-radius: 999px;
  background: #000;
  z-index: 2;
  pointer-events: none;
}

body.is-preview-stage .preview-phone .phone-screen {
  flex: 1;
  min-height: 0 !important;
  height: 100%;
  border-radius: 26px;
  overflow: hidden;
}

body.is-preview-stage .preview-phone .invite.embedded {
  min-height: 100%;
  height: 100%;
  max-height: 100%;
  padding: 22px 16px 18px;
  overflow: hidden;
  place-items: stretch;
  align-content: center;
}

body.is-preview-stage .preview-phone .invite-card {
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

body.is-preview-stage .preview-phone .invite-title {
  font-size: 1.55rem;
  margin-bottom: 8px;
}

body.is-preview-stage .preview-phone .invite-text {
  font-size: 0.86rem;
  line-height: 1.35;
}

body.is-preview-stage .preview-phone .invite-eyebrow {
  margin-bottom: 10px;
  font-size: 0.68rem;
}

body.is-preview-stage .preview-phone .invite-cover {
  max-height: 120px;
  flex-shrink: 1;
  min-height: 0;
  margin-bottom: 10px;
}

body.is-preview-stage .preview-phone .invite-cover img {
  height: 120px;
  max-height: 120px;
  width: 100%;
  object-fit: cover;
}

body.is-preview-stage .preview-phone .tap-hint {
  font-size: 0.78rem;
}

body.is-preview-stage .preview-phone .yes-btn,
body.is-preview-stage .preview-phone .no-btn,
body.is-preview-stage .preview-phone .choice-btn {
  padding: 11px 12px;
  font-size: 0.88rem;
}

.send-stage {
  display: grid;
  gap: 16px;
  max-width: 420px;
  margin: 0 auto;
  padding: 4px 0 12px;
}

body.is-send-stage .send-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 0;
  gap: 10px;
  align-content: start;
  overflow: hidden;
}

body.is-send-stage .send-hero {
  min-height: 0;
}

body.is-send-stage .send-hero-card {
  padding: 16px 16px 14px;
}

body.is-send-stage .send-hero-title {
  font-size: 1.35rem;
}

body.is-send-stage .send-hero-text,
body.is-send-stage .send-lead,
body.is-send-stage .send-feedback-hint {
  font-size: 0.82rem;
}

body.is-send-stage .stage-heading {
  font-size: 1.2rem;
}

body.is-send-stage .send-steps {
  gap: 6px;
  padding: 10px;
}

body.is-send-stage .send-step {
  font-size: 0.8rem;
}

body.is-send-stage .send-main-btn {
  padding: 13px 16px;
}

body.is-send-stage .send-status {
  max-height: 4.5em;
  overflow: hidden;
}

.stage-heading {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.35rem;
}

.send-hero {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  min-height: 148px;
  background:
    linear-gradient(145deg, rgba(196, 92, 38, 0.16), transparent 55%),
    linear-gradient(210deg, rgba(47, 107, 90, 0.14), transparent 50%),
    linear-gradient(180deg, #fff8f0 0%, #f3e7d8 100%);
  border: 1px solid var(--line);
}

.send-hero-glow {
  position: absolute;
  inset: auto -20% -40% 20%;
  height: 140px;
  background: radial-gradient(circle, rgba(212, 120, 140, 0.35), transparent 70%);
  pointer-events: none;
}

.send-hero-card {
  position: relative;
  padding: 22px 20px 20px;
}

.send-hero-mark {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: rgba(196, 92, 38, 0.12);
}

.send-hero-title {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.55rem;
  line-height: 1.15;
  color: var(--ink);
}

.send-hero-text {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.send-copy {
  display: grid;
  gap: 6px;
}

.send-lead {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.send-main-btn {
  width: 100%;
  padding: 15px 18px;
  font-size: 1rem;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(196, 92, 38, 0.28);
}

.send-feedback-hint {
  margin: -4px 0 0;
  text-align: center;
}

.send-steps {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(26, 22, 18, 0.03);
  border: 1px dashed var(--line);
}

.send-step {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.send-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fffaf4;
  background: var(--ink);
}

.send-status {
  margin-top: 0;
}

.send-status-text {
  margin: 0 0 10px;
  white-space: pre-wrap;
}

.send-link {
  display: block;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 0.82rem;
  line-height: 1.35;
  word-break: break-all;
  white-space: normal;
}

.link-box.is-error {
  background: rgba(196, 92, 38, 0.1);
  border-color: rgba(196, 92, 38, 0.35);
  color: var(--accent-deep);
}

.panel {
  background: rgba(255, 252, 247, 0.82);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 22px;
}

.panel h1 {
  font-family: var(--display);
  font-size: 1.85rem;
  line-height: 1.15;
  margin: 0 0 6px;
}

.panel .lead {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffdf9;
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(196, 92, 38, 0.55);
  box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.12);
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

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

.actions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fffaf4;
}

.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: rgba(26, 22, 18, 0.04);
}

.link-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(47, 107, 90, 0.08);
  border: 1px dashed rgba(47, 107, 90, 0.35);
  word-break: break-all;
  font-size: 0.82rem;
  color: var(--mint);
  display: none;
}

.link-box.visible {
  display: block;
}

.preview-label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
}

.phone {
  width: min(100%, 390px);
  margin: 0 auto;
  border-radius: 34px;
  border: 1px solid rgba(26, 22, 18, 0.16);
  background: #111;
  padding: 12px;
  box-shadow: var(--shadow);
}

.phone-screen {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  min-height: 680px;
  background: var(--invite-bg, #1d2430);
}

/* Invite view */
.invite {
  --text: #fff8f0;
  --text-soft: rgba(255, 248, 240, 0.72);
  --title-shadow: 0 2px 18px rgba(0, 0, 0, 0.25);
  --body-shadow: none;
  --chip-bg: rgba(255, 255, 255, 0.08);
  --chip-border: rgba(255, 244, 232, 0.28);
  --meta-bg: rgba(255, 255, 255, 0.08);
  --meta-border: rgba(255, 255, 255, 0.12);
  --btn-primary-bg: #fff4e8;
  --btn-primary-text: #2a1d14;
  --btn-ghost-border: rgba(255, 244, 232, 0.35);
  --choice-bg: rgba(255, 255, 255, 0.08);
  --choice-border: rgba(255, 244, 232, 0.35);
  --title-weight: 700;
  --title-tracking: -0.01em;
  --text-weight: 400;

  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--invite-bg, #1d2430);
  color: var(--text);
}

.invite.embedded {
  min-height: 680px;
  padding: 28px 22px;
}

.invite-card {
  width: min(100%, 360px);
  text-align: center;
  animation: rise 0.55s ease both;
}

.invite-eyebrow {
  margin: 0 0 14px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
  text-shadow: var(--body-shadow);
}

.invite-title {
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 2.6rem);
  font-weight: var(--title-weight);
  letter-spacing: var(--title-tracking);
  line-height: 1.1;
  margin: 0 0 12px;
  color: var(--text);
  text-shadow: var(--title-shadow);
}

.invite-text {
  margin: 0 auto 22px;
  max-width: 30ch;
  line-height: 1.5;
  font-weight: var(--text-weight);
  color: var(--text);
  opacity: 0.92;
  text-shadow: var(--body-shadow);
}

.invite-meta {
  display: grid;
  gap: 8px;
  margin: 0 0 26px;
  padding: 14px;
  border-radius: 16px;
  background: var(--meta-bg);
  border: 1px solid var(--meta-border);
  text-align: left;
  color: var(--text);
  backdrop-filter: blur(8px);
}

.invite-meta p {
  margin: 0;
  font-size: 0.92rem;
}

.invite-meta strong {
  display: inline-block;
  min-width: 72px;
  color: var(--text-soft);
  font-weight: 600;
}

.invite-actions {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.yes-btn,
.no-btn {
  min-width: 180px;
  border: none;
  border-radius: 999px;
  padding: 13px 22px;
  font-weight: 700;
  cursor: pointer;
}

.yes-btn {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

.no-btn {
  position: relative;
  z-index: 3;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--btn-ghost-border);
  transition: transform 0.12s ease;
  will-change: transform;
}

.invite.embedded .invite-actions {
  position: relative;
  overflow: visible;
  width: 100%;
}

.success {
  display: none;
  animation: pop 0.45s ease both;
  color: var(--text);
  text-shadow: var(--title-shadow);
}

.success.visible {
  display: block;
}

.success h2 {
  font-family: var(--display);
  font-size: 2.1rem;
  margin: 0 0 10px;
  color: var(--text);
}

.success p {
  margin: 0;
  opacity: 0.9;
  line-height: 1.5;
}

.confetti {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti i {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0.9;
  animation: fall linear forwards;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 16px;
}

.theme-card {
  border: 1px solid var(--line);
  background: #fffdf9;
  border-radius: 12px;
  padding: 8px 6px;
  display: grid;
  gap: 6px;
  justify-items: center;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
}

.theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196, 92, 38, 0.18);
}

.theme-swatch {
  width: 100%;
  aspect-ratio: 1.4;
  border-radius: 8px;
  display: block;
}

.photo-grid {
  display: grid;
  gap: 12px;
}

.photo-slot {
  display: grid;
  gap: 8px;
}

.photo-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.photo-placeholder {
  height: 120px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
  background: rgba(26, 22, 18, 0.02);
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.invite-cover {
  margin: 0 0 14px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 244, 232, 0.16);
}

.invite-cover img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.invite.has-photo-bg {
  --text: #fffdf8;
  --text-soft: rgba(255, 253, 248, 0.82);
  --title-shadow: 0 3px 22px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(0, 0, 0, 0.35);
  --body-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
  --chip-bg: rgba(0, 0, 0, 0.28);
  --chip-border: rgba(255, 255, 255, 0.28);
  --meta-bg: rgba(0, 0, 0, 0.34);
  --meta-border: rgba(255, 255, 255, 0.18);
  --btn-primary-bg: #fff7ec;
  --btn-primary-text: #24170f;
  --btn-ghost-border: rgba(255, 255, 255, 0.42);
  --choice-bg: rgba(0, 0, 0, 0.32);
  --choice-border: rgba(255, 255, 255, 0.35);
  --title-weight: 700;
  background:
    linear-gradient(180deg, rgba(10, 10, 12, 0.52), rgba(10, 10, 12, 0.8)),
    var(--photo-bg) center / cover no-repeat;
}

.theme-midnight {
  --invite-bg:
    radial-gradient(700px 420px at 20% 0%, rgba(212, 120, 140, 0.35), transparent 55%),
    radial-gradient(600px 380px at 90% 20%, rgba(47, 107, 90, 0.35), transparent 50%),
    linear-gradient(165deg, #1c2433 0%, #121820 100%);
  --text: #f3f6ff;
  --text-soft: rgba(220, 230, 255, 0.72);
  --btn-primary-bg: #e8eefc;
  --btn-primary-text: #182033;
  --title-tracking: 0;
}

.theme-sunset {
  --invite-bg:
    radial-gradient(700px 420px at 15% 10%, rgba(255, 170, 110, 0.4), transparent 55%),
    radial-gradient(500px 360px at 90% 0%, rgba(196, 92, 38, 0.35), transparent 50%),
    linear-gradient(165deg, #3a2218 0%, #1d1410 100%);
  --text: #fff1e4;
  --text-soft: rgba(255, 220, 190, 0.78);
  --title-shadow: 0 2px 20px rgba(80, 30, 10, 0.45);
  --btn-primary-bg: #ffd7b0;
  --btn-primary-text: #3a1d0f;
  --choice-bg: rgba(255, 180, 120, 0.12);
}

.theme-forest {
  --invite-bg:
    radial-gradient(700px 420px at 20% 0%, rgba(120, 190, 160, 0.28), transparent 55%),
    radial-gradient(500px 360px at 100% 30%, rgba(70, 120, 90, 0.3), transparent 50%),
    linear-gradient(165deg, #14241f 0%, #0e1714 100%);
  --text: #e7fff4;
  --text-soft: rgba(190, 230, 210, 0.75);
  --btn-primary-bg: #d8f5e8;
  --btn-primary-text: #143028;
  --choice-bg: rgba(140, 210, 170, 0.12);
}

.theme-blush {
  --invite-bg:
    radial-gradient(700px 420px at 20% 0%, rgba(230, 140, 160, 0.35), transparent 55%),
    radial-gradient(500px 360px at 100% 20%, rgba(120, 70, 90, 0.35), transparent 50%),
    linear-gradient(165deg, #3a1f2a 0%, #1a1014 100%);
  --text: #ffe8ef;
  --text-soft: rgba(255, 200, 214, 0.78);
  --btn-primary-bg: #ffd0dc;
  --btn-primary-text: #4a1828;
  --title-tracking: 0.01em;
}

.theme-ocean {
  --invite-bg:
    radial-gradient(700px 420px at 15% 0%, rgba(80, 170, 210, 0.3), transparent 55%),
    radial-gradient(500px 360px at 90% 30%, rgba(40, 90, 130, 0.35), transparent 50%),
    linear-gradient(165deg, #102433 0%, #0b141c 100%);
  --text: #e7f7ff;
  --text-soft: rgba(180, 220, 240, 0.75);
  --btn-primary-bg: #d7f0ff;
  --btn-primary-text: #123040;
  --choice-bg: rgba(100, 180, 220, 0.14);
}

.theme-noir {
  --invite-bg:
    radial-gradient(700px 420px at 20% 0%, rgba(180, 180, 180, 0.15), transparent 55%),
    linear-gradient(165deg, #1a1a1a 0%, #0a0a0a 100%);
  --text: #f2f2f2;
  --text-soft: rgba(210, 210, 210, 0.7);
  --title-tracking: 0.04em;
  --title-weight: 600;
  --btn-primary-bg: #f0f0f0;
  --btn-primary-text: #111;
  --choice-bg: rgba(255, 255, 255, 0.06);
  --chip-border: rgba(255, 255, 255, 0.22);
}

.theme-honey {
  --invite-bg:
    radial-gradient(700px 420px at 20% 0%, rgba(230, 180, 70, 0.3), transparent 55%),
    radial-gradient(500px 360px at 100% 10%, rgba(160, 90, 30, 0.28), transparent 50%),
    linear-gradient(165deg, #3a2a12 0%, #1a1408 100%);
  --text: #fff3d6;
  --text-soft: rgba(255, 220, 150, 0.78);
  --title-shadow: 0 2px 18px rgba(90, 50, 0, 0.4);
  --btn-primary-bg: #ffd978;
  --btn-primary-text: #3a2808;
  --choice-bg: rgba(255, 200, 80, 0.12);
}

.theme-lilac {
  --invite-bg:
    radial-gradient(700px 420px at 20% 0%, rgba(170, 130, 220, 0.3), transparent 55%),
    radial-gradient(500px 360px at 95% 25%, rgba(90, 70, 140, 0.3), transparent 50%),
    linear-gradient(165deg, #2a2038 0%, #14101c 100%);
  --text: #f3e9ff;
  --text-soft: rgba(220, 200, 255, 0.76);
  --btn-primary-bg: #e8d7ff;
  --btn-primary-text: #2c1848;
  --choice-bg: rgba(180, 140, 230, 0.14);
  --title-tracking: 0.02em;
}

@media (max-width: 700px) {
  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(540deg);
    opacity: 0;
  }
}

@media (max-width: 560px) {
  .builder {
    padding: 12px 12px 28px;
  }

  .builder-shell {
    padding: 12px;
  }

  .builder-sticky {
    margin: -12px -12px 12px;
    padding: 10px 12px 12px;
  }

  .builder-sticky h1 {
    font-size: 1.42rem;
    margin-bottom: 9px;
  }

  .builder-stages {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .builder-stage-btn {
    font-size: 0.68rem;
    padding: 9px 3px;
  }

  .phone {
    width: min(100%, 390px);
  }
}
