/* ====== guards so letter always shows ====== */
#sheet-content{display:grid;place-items:center;width:100%;}
#sheet-overlay .sheet-card{min-height:140px;}
#sheet-overlay.is-letter .sheet-card{background:transparent!important;box-shadow:none!important;padding:0!important;}

/* ===== overlay + dust layer placement ===== */
#sheet-overlay{position:fixed; inset:0; z-index:20; pointer-events:none;}
#sheet-overlay .sheet-scrim,
#sheet-overlay .sheet-card{ pointer-events:auto; }
#sheet-overlay .sheet-scrim{
  position:absolute; inset:0;
  background: radial-gradient(90% 70% at 50% 50%, rgba(15,6,26,.35), rgba(10,4,18,.65));
  cursor:pointer;
  z-index:0;
}
.sheet-dust{ position:absolute; inset:0; z-index:1; pointer-events:none; }

/* Letter stage (bigger) */
#sheet-overlay .sheet-card{
  position:absolute; left:50%; top:50%;
  transform:translate(-50%,-50%) scale(.96);
  width:min(680px,92%); /* was 560px */
  outline:none;
  transition:transform .28s ease, opacity .28s ease;
  opacity:0; perspective:1000px; z-index:2;
  border-radius:20px; padding:0;
}
#sheet-overlay:not([hidden]) .sheet-card{
  transform:translate(-50%,-50%) scale(1); opacity:1;
}

/* ===== dust model-viewer visuals ===== */
#dustMV{
  position:absolute; inset:0; pointer-events:none;
  mix-blend-mode:screen; opacity:.0; filter:saturate(120%);
}
#heroGlass #dustMV{ opacity:.0; } /* will be faded by JS */

/* ===== theme vars ===== */
:root{ --pink:#ff9ce3; --violet:#8a5bff; }

.hero { position: relative; min-height: 100svh; }

.hero-glass{
  position:absolute; inset:0; height:100%; z-index:3;
  perspective:1200px; border-radius:0; overflow: visible;
}
.hero-glass::before{
  content:""; position:absolute; inset:0; border-radius:0;
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(255,122,217,.35), rgba(255,122,217,0) 60%),
    radial-gradient(50% 60% at 50% 100%, rgba(138,91,255,.35), rgba(138,91,255,0) 70%),
    rgba(40,10,60,.45);
  -webkit-backdrop-filter:saturate(120%) blur(18px);
  backdrop-filter:saturate(120%) blur(18px);
  box-shadow:0 40px 120px rgba(255,122,217,.25), inset 0 0 160px rgba(138,91,255,.25);
  z-index:0;
}
.raise-chest #chest-hero-wrap { --chest-offset: -8vh; }

#chest-hero-wrap{
  isolation:isolate;
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  z-index:4; pointer-events:none; box-sizing:border-box; transform-style:preserve-3d;
  overflow: visible;
  --chest-offset: 6vh;
  transform: translateY(var(--chest-offset));
}

/* Chest model-viewer */
#chestMV{
  position: relative;
  z-index: 2;
  width:100%; height:100%;
  max-width:860px;
  max-height:86vh;
  --poster-color:transparent; outline:none;
  animation:chestEnter 1.2s ease-out forwards;
  pointer-events:auto;
}
#chestMV.hidden{ opacity:0; visibility:hidden; }
#chestMV.show  { opacity:1; visibility:visible; transition:opacity .5s ease; }

@keyframes chestEnter{
  0%{   opacity:0; transform:scale(.8) translateY(-60px) rotateX(8deg); }
  50%{  opacity:1; transform:scale(1.05) translateY(10px) rotateX(0deg); }
  100%{ opacity:1; transform:scale(1) translateY(0) rotateX(0deg); }
}

/* Keep hero text/buttons above everything */
.hero .heading-wrap{ position:relative; z-index:5; }

/* === NEW: starfield canvas behind chest/key while open === */
#heroGlass {
  position: fixed; inset:0; height:100%; z-index:3;
  perspective:1200px; border-radius:0; overflow: visible;
  transition:opacity .35s ease, transform .35s ease;

  /* NEW: soft base blur on the glass itself */
  background: rgba(18, 6, 28, .035);           /* practically invisible, enables blur */
  -webkit-backdrop-filter: saturate(120%) blur(12px);
          backdrop-filter: saturate(120%) blur(12px);
  will-change: backdrop-filter;
}

/* --- hero glass blur/vignette --- */
#heroGlass::before{
  content:""; position:absolute; inset:0; border-radius:0;
  background:
    radial-gradient(60% 40% at 50% 0%,   rgba(255,122,217,.35), rgba(255,122,217,0) 60%),
    radial-gradient(50% 60% at 50% 100%, rgba(138,91,255,.35), rgba(138,91,255,0) 70%),
    rgba(40,10,60,.45);
  -webkit-backdrop-filter: saturate(130%) blur(28px);
          backdrop-filter: saturate(130%) blur(28px);
  box-shadow: 0 40px 120px rgba(255,122,217,.25), inset 0 0 160px rgba(138,91,255,.25);
  z-index:0; pointer-events:none;
}

/* star canvas layer */
#starLayer {
  position:absolute;
  inset:0;
  z-index:1; /* above blur, below models */
  pointer-events:none;
  mix-blend-mode:screen;
  opacity:0;
  transition:opacity .35s ease;
}
#heroGlass.stars-on #starLayer { opacity:.95; }

#heroGlass[hidden], #chest-hero-wrap[hidden]{ display:none !important; }

@media (max-width: 767px){
  #chest-hero-wrap{ --chest-offset: 4vh; }
}

/* ===== KEY (always in front, clickable) ===== */
#keyMV{
  --poster-color: transparent;
  position: fixed !important;
  z-index: 9 !important;
  pointer-events: auto;
  overflow: visible !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
}
#keyMV.key3d{
  inset: -40vh -16vw -160vh -16vw !important;
  margin: auto;
  overflow: visible;
  --key-scale: 0.68;
  --key-shift: -6vh;
  --key-x: 0vw;
  transform-origin: 50% 85%;
  transform: translate(var(--key-x), var(--key-shift)) scale(var(--key-scale));
  opacity: 0; visibility: hidden;
  transition: opacity .45s ease, transform .45s ease, filter .45s ease;
  filter: drop-shadow(0 10px 24px rgba(138,91,255,.35));
}
@media (max-width: 1024px){
  #keyMV.key3d{
    inset: -34vh -14vw -140vh -14vw !important;
    --key-scale: 0.62; --key-shift: -4vh;
  }
}
@media (max-width: 767px){
  #keyMV.key3d{
    inset: -28vh -10vw -120vh -10vw !important;
    --key-scale: 0.58; --key-shift: -2vh;
  }
}
@media (max-height: 640px){
  #keyMV.key3d{
    inset: -20vh -10vw -100vh -10vw !important;
    --key-shift: 0vh;
  }
}
#keyMV.key3d.show{ opacity: 1; visibility: visible; }
@keyframes keyFloat {
  0%   { transform: translateY(calc(var(--key-shift)))       scale(var(--key-scale)); }
  50%  { transform: translateY(calc(var(--key-shift) - 6px)) scale(var(--key-scale)); }
  100% { transform: translateY(calc(var(--key-shift)))       scale(var(--key-scale)); }
}
#keyMV.key3d.floaty { animation: keyFloat 2.2s ease-in-out infinite; }

/* ===== FX LAYER + STARS ===== */
#fx-layer{ position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.fx-star{
  position: absolute; left: 0; top: 0; width: 12px; height: 12px;
  transform: translate(-50%, -50%) scale(0.2); opacity: 0;
  will-change: transform, opacity; filter: drop-shadow(0 2px 6px rgba(255,255,255,.35));
}
.fx-star::before, .fx-star::after{
  content: ""; position: absolute; left: 50%; top: 50%; width: 100%; height: 1px;
  transform: translate(-50%, -50%); border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--glow, #fff), transparent);
  filter: blur(.25px);
}
.fx-star::after{ transform: translate(-50%, -50%) rotate(90deg); }
.fx-star > span{
  position:absolute; left:50%; top:50%; width:45%; height:45%;
  transform:translate(-50%,-50%);
  background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,255,255,0) 70%);
  filter: blur(.2px);
}

/* ===== Shine sweep across the LETTER once ===== */
.letter-sheet.shine-once::after{
  content:""; position:absolute; inset:-28%;
  pointer-events:none; mix-blend-mode: screen;
  background: linear-gradient(120deg, rgba(255,255,255,0) 44%, rgba(255,255,255,.7) 50%, rgba(255,255,255,0) 56%);
  transform: translateX(-120%) rotate(12deg);
  animation: letterShine .85s ease-out .15s forwards;
}
@keyframes letterShine{ to{ transform: translateX(120%) rotate(12deg); } }

/* ===== IN-PANEL SHEET (LETTER / RSVP) ===== */
#sheet-overlay[hidden] { display: none !important; }
#sheet-overlay{ position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#sheet-overlay .sheet-scrim,
#sheet-overlay .sheet-card{ pointer-events: auto; }

#sheet-overlay .sheet-scrim{
  position: absolute; inset: 0;
  background: radial-gradient(80% 60% at 50% 50%, rgba(0,0,0,.35), rgba(0,0,0,.55));
  cursor: pointer;
}

/* 3D stage for the letter (bigger) */
#sheet-overlay .sheet-card{
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.96);
  width: min(680px, 92%); /* was 560px */
  border-radius: 20px;
  padding: 0; outline: none;
  transition: transform .28s ease, opacity .28s ease;
  opacity: 0; perspective: 1000px;
}
#sheet-overlay:not([hidden]) .sheet-card{
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* ===== PINK + PURPLE LETTER (glow) ===== */
@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=DM+Sans:wght@400;600;700&display=swap');

@keyframes letterAura{
  0%,100%{
    box-shadow:
      0 36px 160px rgba(138,91,255,.80),
      0 0 0 4px rgba(255,122,217,.60) inset,
      0 0 96px rgba(255,122,217,.90) inset;
  }
  50%{
    box-shadow:
      0 48px 200px rgba(138,91,255,1),
      0 0 0 5px rgba(255,122,217,.75) inset,
      0 0 128px rgba(255,122,217,1) inset;
  }
}

.letter-sheet{
  position:relative;
  width:min(640px,94vw); /* bigger letter */
  border-radius:20px; overflow:hidden; transform-style:preserve-3d;
  background:
    radial-gradient(120% 140% at 50% -10%, rgba(255,255,255,.9) 0%, rgba(255,255,255,.98) 55%, #fff 80%),
    linear-gradient(145deg, color-mix(in oklab, var(--pink), #ffffff 70%), color-mix(in oklab, var(--violet), #ffffff 70%));
  border:2px solid rgba(255,255,255,.7);
  box-shadow:
    0 36px 160px rgba(138,91,255,.80),
    0 0 0 4px rgba(255,122,217,.60) inset,
    0 0 96px rgba(255,122,217,.90) inset;

  font-family:'DM Sans', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:#2a1037;

  opacity:0; transform: rotateX(0) rotateY(0) translateZ(0) scale(.985);
  transition: opacity .5s ease, transform .5s ease, box-shadow .2s ease;
}
#sheet-overlay:not([hidden]) .letter-sheet{
  opacity:1; transform: rotateX(0) rotateY(0) translateZ(0) scale(1);
}
.letter-sheet::before{
  content:""; position:absolute; inset:-3%;
  border-radius:inherit; pointer-events:none;
  background: conic-gradient(from 0deg, var(--pink), var(--violet), var(--pink));
  filter: blur(18px) saturate(120%); opacity:.65; z-index:-1;
}

/* top fold ribbon (pink→purple) */
.letter-fold{
  height:92px; /* a bit taller */
  background: linear-gradient(90deg, var(--pink), var(--violet));
  clip-path: polygon(0 0,100% 0,100% 65%,50% 100%,0 65%);
  box-shadow: 0 8px 24px rgba(138,91,255,.45) inset; transform:translateZ(6px);
  border-bottom:0;
}

/* content */
.letter-content{ padding:28px 30px 30px; color:#2a1037; transform:translateZ(8px); }
.letter-content h3{
  margin:0 0 12px; font-family:"Great Vibes",cursive; font-size:44px;
  color:var(--violet); text-align:center;
  text-shadow:0 2px 20px rgba(138,91,255,.55), 0 0 32px rgba(255,122,217,.45);
}
.letter-actions{ display:flex; gap:12px; margin-top:14px; justify-content:center; }

/* RSVP (unchanged palette, tuned to theme) */
.rsvp-sheet{
  width:min(640px, 94vw);
  background:#fff; color:#2a1037;
  border-radius:16px;
  box-shadow: 0 30px 80px rgba(138, 91, 255, .35);
  padding: 24px 24px 20px;
}
.rsvp-sheet h4{ margin:0 0 12px; color:#8a5bff; font-weight:700; }
.rsvp-sheet label{ display:block; font-size:14px; margin:10px 0 6px; }
.rsvp-sheet input, .rsvp-sheet textarea{
  width:100%; padding:12px 12px; border-radius:10px; border:1px solid #ece6ff; background:#faf7ff; outline:none; font:inherit;
}
.rsvp-actions{ display:flex; gap:10px; margin-top:14px; }
.rsvp-actions .btn.yes{ min-width:120px; }
.rsvp-actions .btn.no{ background:#fff; color:#000; }
.rsvp-actions .btn.no:hover{ background:rgb(215, 215, 215); }

/* Buttons */
.btn{ padding:10px 16px; border:0; border-radius:10px; font-weight:700; cursor:pointer; }
.btn.yes{
  background:linear-gradient(90deg,var(--pink),var(--violet)); color:#fff;
  box-shadow:0 12px 28px rgba(138,91,255,.55), 0 0 24px rgba(255,122,217,.55) inset;
  border: #fff solid 2px;
}
.btn.yes:hover{ filter:brightness(1.05); }
.btn.no{ background:#fff; color:#000;
 }
.btn.no:hover{ background:rgb(215, 215, 215); }

/* Make sure letter is above any internal stacking quirks */
#sheet-overlay .letter-sheet{ position: relative; z-index: 1; }
/* dust inside heroGlass */

/* --- spacing & typography --- */
.letter-content { padding: 30px 32px 28px; }
.magic-text { margin: 10px 0 18px; font-size: 48px; line-height: 1; }
@media (max-width: 767px){ .magic-text{ font-size: 40px; } }
.letter-crown { width:120px; height:36px; display:block; margin: 0 auto 12px; opacity:.9; }
.letter-divider{
  height: 10px; margin: 2px auto 22px; width: 76%;
  background: linear-gradient(90deg, transparent, rgba(255,122,217,.8), rgba(138,91,255,.8), transparent);
  -webkit-mask: radial-gradient(12px 8px at 0 50%, #0000 98%, #000 100%) 0/16px 100% repeat-x;
          mask: radial-gradient(12px 8px at 0 50%, #0000 98%, #000 100%) 0/16px 100% repeat-x;
  filter: blur(.2px);
}
.letter-content .intro{ margin: 0 0 18px; text-align:center; }
.letter-content .ask{ margin: 10px 0 16px; font-weight: 600; }

/* --- princess frame + floating card --- */
.letter-sheet.princess{
  position: relative; overflow: hidden;
  background:
    radial-gradient(140% 140% at 50% -20%, rgba(255,255,255,.96) 0%, #fff 60%),
    linear-gradient(145deg, color-mix(in oklab, #ff9ce3, #fff 70%), color-mix(in oklab, #8a5bff, #fff 70%));
  border-radius: 22px;
  border: 2px solid rgba(255,255,255,.85);
  box-shadow:
    0 50px 140px rgba(138,91,255,.40),
    0 0 0 5px rgba(255,122,217,.55) inset,
    0 0 130px rgba(255,122,217,.75) inset;
  animation: letterFloat 5.8s ease-in-out infinite, letterAura 3s ease-in-out infinite;
}
@keyframes letterFloat{
  0%,100%{ transform: translateZ(0) translateY(0); }
  50%    { transform: translateZ(0) translateY(-6px); }
}

/* subtle aura pulse (reuse existing if present) */
@keyframes letterAura{
  0%,100%{ box-shadow:
    0 50px 140px rgba(138,91,255,.40),
    0 0 0 5px rgba(255,122,217,.55) inset,
    0 0 130px rgba(255,122,217,.75) inset; }
  50%{ box-shadow:
    0 60px 170px rgba(138,91,255,.55),
    0 0 0 6px rgba(255,122,217,.75) inset,
    0 0 160px rgba(255,122,217,.95) inset; }
}

/* --- animated glitter on edges --- */
.letter-sheet.princess::before,
.letter-sheet.princess::after{
  content:""; position:absolute; inset:-2px; border-radius:inherit; pointer-events:none;
}
.letter-sheet.princess::before{
  background: conic-gradient(from 0deg,
    #ff9ce3 0% 15%, #8a5bff 25% 40%,
    #ff9ce3 55% 70%, #8a5bff 85% 100%);
  filter: blur(14px) saturate(120%); opacity:.55;
  animation: ringSpin 6s linear infinite;
}
.letter-sheet.princess::after{
  /* sparkly dust dots along border */
  background:
    radial-gradient(2px 2px at 10% 20%, #fff, #fff0 65%),
    radial-gradient(2px 2px at 35% 80%, #fff, #fff0 65%),
    radial-gradient(1.6px 1.6px at 70% 30%, #fff, #fff0 65%),
    radial-gradient(2px 2px at 85% 60%, #fff, #fff0 65%);
  opacity:.35; mix-blend-mode: screen;
  animation: glitterDrift 4.5s ease-in-out infinite;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
@keyframes glitterDrift{ 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-4px); } }

/* --- magical title shimmer (stronger) --- */
.magic-text {
  background: linear-gradient(270deg,#ff9ce3,#8a5bff,#ff9ce3);
  background-size: 600% 600%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 12px rgba(255,122,217,.55),
               0 0 26px rgba(138,91,255,.5);
  animation: magicGradient 7.5s ease infinite, titleGlow 2.4s ease-in-out infinite;

  /* fix: prevent top clipping */
  padding-top: 4px;   /* adjust to 2–6px if needed */
}

@keyframes magicGradient{ 0%{background-position:0% 50%} 50%{background-position:100% 50%} 100%{background-position:0% 50%} }
@keyframes titleGlow{ 0%,100%{ filter: drop-shadow(0 0 0 rgba(255,122,217,0)); } 50%{ filter: drop-shadow(0 6px 16px rgba(255,122,217,.45)); } }

/* --- make the question twinkle gently --- */
.magic-ask{
  position: relative;
  text-align: center;
  color:#2a1037;
  text-shadow: 0 0 10px rgba(255,122,217,.25);
  animation: askPulse 3.2s ease-in-out infinite;
}
@keyframes askPulse{ 0%,100%{ opacity:.88 } 50%{ opacity:1 } }

/* Butterfly divider styles */
.letter-butterfly{
  display:block;
  width:110px;          /* tweak if you want it larger/smaller */
  height:auto;
  margin: 6px auto 22px;
  filter: drop-shadow(0 2px 10px rgba(138,91,255,.35));
}

/* draw-in & gentle float */
.letter-butterfly .wings{
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
}

@keyframes bflyDraw{
  to { stroke-dashoffset: 0; }
}
@keyframes bflyFloat{
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-2px); }
}


.dust-burst {
  position: absolute;
  pointer-events: none;
  left: 50%;
  top: 50%;
  width: 200px;
  height: 200px;
  transform: translate(-50%, -50%);
  z-index: 999; /* above chest, behind letter content */
}

.dust-burst .particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: pink;
  opacity: 0;
}

#rsvp-title { margin-top: 12px; text-align: center; } 

#rsvp-form.msf { --msf-accent:#8a5bff; --msf-accent2:#ff9ce3; }
#rsvp-form.msf fieldset { border:0; padding:0; margin:0; min-width:0; }

/* Visibility is driven ONLY by [hidden] (script toggles this) */
#rsvp-form.msf .msf-step{
  display:none; opacity:0; transform:translateY(8px);
  transition:opacity .28s ease, transform .28s ease;
}
#rsvp-form.msf .msf-step:not([hidden]){ display:block; opacity:1; transform:translateY(0); }

/* Hard-hide hidden steps so they never take space */
#rsvp-form.msf .msf-step[hidden]{
  display:none !important; height:0 !important;
  margin:0 !important; padding:0 !important; overflow:hidden !important;
}

/* Hide intro while form is visible */
.letter-sheet:has(#rsvp-form:not([hidden])) .js-letter-intro,
.letter-sheet:has(#rsvp-form:not([hidden])) .letter-actions{ display:none !important; }

#rsvp-form.msf label { display:block; font-weight:600; margin:12px 0 6px; }
#rsvp-form.msf input, #rsvp-form.msf textarea {
  width:100%; padding:12px 14px; border-radius:10px; border:1px solid #ddd;
  outline:none; background:#fff; box-shadow:0 6px 24px rgba(0,0,0,.05);
}
#rsvp-form.msf textarea { resize:vertical; min-height:96px; }

/* Buttons spacing (global) */
#rsvp-form.msf .btn { margin-top:14px; }

/* Actions row: center buttons on ALL steps */
#rsvp-form.msf .msf-actions{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  margin-top:14px;
  flex-wrap:wrap;
}
/* neutralize the generic sibling margin so gap controls spacing */
#rsvp-form.msf .msf-actions .btn + .btn{ margin-left:0; }

/* Progress dots */
#rsvp-form.msf .msf-steps{
  list-style:none; display:flex; gap:8px; padding:0; margin:14px 0 8px; justify-content:center;
}
#rsvp-form.msf .msf-steps li{
  width:10px; height:10px; border-radius:999px; background:linear-gradient(90deg,var(--msf-accent2),var(--msf-accent));
  opacity:.35; transform:scale(.9); transition:opacity .25s ease, transform .25s ease;
}
#rsvp-form.msf[data-step="1"] .msf-steps li:nth-child(1),
#rsvp-form.msf[data-step="2"] .msf-steps li:nth-child(2),
#rsvp-form.msf[data-step="3"] .msf-steps li:nth-child(3){ opacity:1; transform:scale(1.1); }

/* Nav buttons visibility */
#rsvp-form.msf .msf-prev { display:none; }
#rsvp-form.msf[data-step="2"] .msf-prev,
#rsvp-form.msf[data-step="3"] .msf-prev { display:inline-flex; }
#rsvp-form.msf .msf-next { display:inline-flex; }
#rsvp-form.msf[data-step="3"] .msf-next { display:none; }
#rsvp-form.msf .msf-finish { display:none; }
#rsvp-form.msf[data-step="3"] .msf-finish { display:inline-flex; }

/* ---------- STEP 1 (perfil radios) ---------- */
.msf-step[data-step="1"] .profile-list{ display:grid; gap:10px; margin:6px 0 0; }
.msf-step[data-step="1"] .profile-item{ display:flex; align-items:center; gap:10px; }
.msf-step[data-step="1"] input[type="radio"]{ accent-color: var(--msf-accent); }

/* Step 1: order buttons -> Cancelar first, Siguiente second (still centered) */
#rsvp-form.msf .msf-step[data-step="1"] .msf-actions .btn.ghost{ order:1; }  /* Cancelar */
#rsvp-form.msf .msf-step[data-step="1"] .msf-actions .btn.yes{   order:2; }  /* Siguiente */

/* ---------- STEP 2 — FIXED LAYOUT ---------- */
#rsvp-form.msf .msf-step[data-step="2"]:not([hidden]){ display:block !important; }
#rsvp-form.msf .msf-step[data-step="2"]{ grid-template-columns:none !important; }

/* Row helpers used inside Step 2 */
.msf-row.two{ display:grid; gap:12px; grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
.msf-row.three{ display:grid; gap:12px; grid-template-columns:repeat(3, minmax(0,1fr)); }
.msf-row.two label, .msf-row.three label{ min-width:0; }
@media (max-width:759px){
  .msf-row.two, .msf-row.three{ grid-template-columns:1fr; }
}

/* ---------- STEP 3 (menús grid) ---------- */
.letter-sheet .msf-step[data-step="3"]{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap:12px;
  align-content:start;
}
.letter-sheet .msf-step[data-step="3"] > label,
.letter-sheet .msf-step[data-step="3"] .menu-note,
.letter-sheet .msf-step[data-step="3"] .msf-actions{ grid-column:1 / -1; }
@media (min-width:900px){
  .letter-sheet .msf-step[data-step="3"]{ grid-template-columns:repeat(3, minmax(240px,1fr)); }
}

/* Center the note text */
.letter-sheet .menu-note{
  display:block;          /* make it a block container */
  text-align:center;      /* center the text */
  margin:.25rem auto .5rem;
  font-weight:600;
  letter-spacing:.2px;
}

.letter-sheet .msf-step[data-step="3"] .msf-actions{ margin-top:.5rem; justify-content:center; }

/* Menu cards (global look that Step 1 can still reuse) */
.letter-sheet .menu-card{
  position:relative; display:block; text-align:center;
  padding:14px 40px 14px 14px; border-radius:12px;
  border:1.5px solid rgba(0,0,0,.18); background:rgba(255,255,255,.22);
  backdrop-filter:saturate(120%) blur(2px); cursor:pointer;
  transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.letter-sheet .menu-card:hover{
  background:#5f34ca;
  color:#fff;
}
.letter-sheet .menu-card.selected{
  border-color:#8a5bff;
  background:#8a5bff;
  color:#fff;
  /* FIX: ring draws inside the card so it doesn't overflow */
  box-shadow: inset 0 0 0 3px rgba(138, 91, 255, .15);
}

/* Title (global) */
.letter-sheet .menu-title{
  font-weight:700;
  line-height:1.25;
}
/* Top-right info chip anchored to the corner */
.letter-sheet .menu-info-btn{
  position:absolute;
  top:0;
  right:0;
  transform: translate(50%, -50%);   /* sits on the border corner */
  width:22px;
  height:22px;
  border-radius:50%;
  border:1px solid rgba(0,0,0,.25);
  background:#fff;
  color:#333;
  font-style:normal;
  font-weight:700;
  line-height:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  pointer-events:auto;
  z-index:3;
  box-shadow:0 1px 3px rgba(0,0,0,.12);
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  transition:transform .12s ease, box-shadow .12s ease, color .12s ease, background .12s ease, border-color .12s ease;
}
.letter-sheet .menu-info-btn:hover{
  transform: translate(50%, -50%) translateY(-1px);
  box-shadow:0 3px 6px rgba(0,0,0,.16);
}
.letter-sheet .menu-info-btn:active{
  transform: translate(50%, -50%) scale(.96);
}
.letter-sheet .menu-info-btn:focus-visible{
  outline:2px solid #8a5bff;
  outline-offset:2px;
}

/* Keep the chip readable on hover/selected */
.letter-sheet .menu-card:hover .menu-info-btn,
.letter-sheet .menu-card.selected .menu-info-btn{
  background:#fff;
  color:#5f34ca;
  border-color:rgba(0,0,0,.2);
}

/* STEP 3 — center the card content again and allow chip to overflow */
.letter-sheet .msf-step[data-step="3"] .menu-card{
  overflow:visible;             /* so the corner chip can hang out */
  display:flex;                 /* center the whole block */
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:16px;                 /* symmetric padding for true center */
  min-height:130px;
}

/* Center the two-line title stack */
.letter-sheet .msf-step[data-step="3"] .menu-card .menu-title{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  line-height:1.25;
  min-height:72px;
}
.letter-sheet .msf-step[data-step="3"] .menu-card .menu-title hr{
  width:48px;
  max-width:60%;
  margin:4px auto 6px;
  height:0;
  border:0;
  border-top:2px solid currentColor;
  opacity:.35;
}

/* Legacy safe default */
.letter-sheet .msf-step[data-step="1"] .msf-actions{
  grid-column:1 / -1; margin-top:.5rem; justify-content:center;
}

/* STEP 3 — scale text down (no forced breaking) */
.letter-sheet .msf-step[data-step="3"] .menu-card .menu-title{
  overflow-wrap: normal !important;
  word-break: normal !important;
  hyphens: manual !important;
  white-space: normal;
}

/* fluid downscale of all text inside the card */
.letter-sheet .msf-step[data-step="3"] .menu-card{
  font-size: clamp(10px, 0.9rem + 0.2vw, 14px);
  line-height: 1.2;
}

/* tighten a bit more on small phones */
@media (max-width: 420px){
  .letter-sheet .msf-step[data-step="3"] .menu-card{ font-size: 12px; }
}
@media (max-width: 360px){
  .letter-sheet .msf-step[data-step="3"] .menu-card{ font-size: 12px; }
}

/* ---------- NEW: Step 1 — two per row, COMPACT tiles (independent of Step 3) ---------- */
.letter-sheet .msf-step[data-step="1"] .profile-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));   /* two per row */
  gap:12px;
}
/* Works whether labels use only .profile-card or "menu-card profile-card" */
.letter-sheet .msf-step[data-step="1"] .profile-card,
.letter-sheet .msf-step[data-step="1"] .menu-card.profile-card{
  display:flex;
  align-items:center;          /* vertical centering */
  justify-content:center;      /* horizontal centering */
  text-align:center;
  padding:18px 15px;            /* tighter than menu cards */
  min-height:50px;             /* smaller tile height */
  font-size:clamp(.88rem, .86rem + .08vw, .98rem);
  line-height:1.1;             /* snug text */
}

/* Extra small phones */
@media (max-width:480px){
  .letter-sheet .msf-step[data-step="1"] .profile-card,
  .letter-sheet .msf-step[data-step="1"] .menu-card.profile-card{
    min-height:56px;
    padding:18px 15px;
  }
}


/* Tooltip bubble */
#menu-tip{
  position:fixed; z-index:1000; max-width:min(36rem, 92vw);
  padding:.85rem 1rem; border-radius:10px; font-size:.95rem; line-height:1.35; color:#fff;
  background:rgba(26,24,36,.9); box-shadow:0 8px 26px rgba(0,0,0,.35);
  pointer-events:none; opacity:0; transform:translateY(6px); transition:opacity .16s ease, transform .16s ease;
}
#menu-tip.show{ opacity:1; transform:translateY(0); }

/* ----- Modal sizing ----- */
#sheet-overlay .sheet-card{
  height:auto !important; min-height:auto !important;
  max-height:min(92vh, 820px); overflow:auto;
}
@supports (height:fit-content){
  #sheet-overlay .sheet-card{ height:fit-content !important; }
}
.letter-sheet{ height:auto !important; min-height:auto !important; }
.letter-sheet .letter-content{ padding-bottom:16px; }

/* Safety */
.letter-sheet.steps-mode .js-letter-intro{ display:none !important; }

/* highlight checked profile card (uses :has, same browsers you already target) */
.profile-card:has(input:checked){
  border-color:#8a5bff;
  box-shadow:0 0 0 3px rgba(138,91,255,.15);
  background:#8a5bff;
  color: #fff;
}


/* Lock the page when treasure overlay is open (no body scroll) */
body.treasure-open {
  overflow: hidden;
  height: 100vh;                 /* avoid rounding overflow */
  padding-right: var(--sbw, 0);  /* scrollbar compensation */
  overscroll-behavior: none;
}

/* The overlay is a fixed full-screen layer that does not scroll */
#sheet-overlay {
  position: fixed;
  inset: 0;
  overflow: hidden;              /* or clip if supported */
  display: grid;
  place-items: center;
}
@supports (overflow: clip) {
  #sheet-overlay { overflow: clip; }
}

/* The dialog card itself must not create its own scrollbar */
#sheet-overlay .sheet-card {
  max-height: min(92vh, 880px);
  overflow: hidden;              /* prevent inner scrollbars */
  overscroll-behavior: contain;
  contain: layout paint;         /* keep box-shadows/transforms from affecting page */
}

/* Optional: if some inner panel has overflow:auto, hide its scrollbar */
#sheet-overlay .sheet-card ::-webkit-scrollbar { width: 0; height: 0; }
#sheet-overlay .sheet-card { scrollbar-width: none; } /* Firefox */

/* ===== Venue title stack (scoped to the grid so nothing else is affected) ===== */
.grid .venue-block{
  text-align:center;
  margin-bottom:28px;
  padding: 8px 12px;
}

.grid .venue-title{
  /* Huge on desktop, safe on phones */
  font-size: clamp(42px, 10vw, 140px);
  line-height: .95;
  margin: 0 0 10px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.grid .venue-name{
  font-family: "Great Vibes", cursive;
  font-size: clamp(28px, 7vw, 64px);  /* bigger & responsive */
  line-height: 1.05;
  margin: 6px 0 8px;
}

.grid .venue-location{
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans";
  font-size: clamp(14px, 4vw, 20px);  /* readable on mobile */
  opacity: .95;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;           /* allows two lines if needed */
  justify-content: center;
}

.grid .venue-location i{
  font-size: 0.95em;
  opacity: .95;
}

/* Tighten up on very narrow screens */
@media (max-width: 420px){
  .grid .venue-title{ letter-spacing: 0; }
  .grid .venue-name{ margin-top: 4px; }
}

/* --- Toast (already bottom) + optional top variation --- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  display: inline-block;
  max-width: min(92vw, 520px);
  padding: 10px 14px;
  border-radius: 10px;
  font: 600 14px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: #111;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  transition: .25s;
  white-space: normal;
  pointer-events: none;
  z-index: 9999;
}
.toast.ok  { background: #16a34a; }
.toast.err { background: #dc2626; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Top-positioned toast (used for "Confirmando…") */
.toast.top {
  top: 16px;
  bottom: auto;
  transform: translateX(-50%) translateY(-16px);
}
.toast.top.show {
  transform: translateX(-50%) translateY(0);
}

/* Spinner inline for top toast */
.toast .loader-inline {
  width: 16px; height: 16px; margin-right: 8px;
  display: inline-block; vertical-align: -2px;
  border-radius: 50%;
  background:
    conic-gradient(var(--pink, #ff9ce3), transparent 40%),
    conic-gradient(from 180deg, var(--violet, #8a5bff), transparent 40%);
  -webkit-mask: radial-gradient(circle, transparent 55%, #000 56%);
          mask: radial-gradient(circle, transparent 55%, #000 56%);
  animation: spin .9s linear infinite;
}

/* Full-screen blocker over the letter/modal */
#sheet-blocker {
  position: fixed; inset: 0; z-index: 9998;
  display: grid; place-items: center;
  background: rgba(8, 4, 14, .35);
  -webkit-backdrop-filter: blur(2px) saturate(120%);
          backdrop-filter: blur(2px) saturate(120%);
  pointer-events: auto;
}

/* Big center loader inside the blocker */
#sheet-blocker .loader-ring {
  width: 52px; height: 52px; border-radius: 50%;
  background:
    conic-gradient(var(--pink, #ff9ce3), transparent 40%),
    conic-gradient(from 180deg, var(--violet, #8a5bff), transparent 40%);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%);
          mask: radial-gradient(circle, transparent 60%, #000 61%);
  animation: spin .9s linear infinite;
  filter: drop-shadow(0 8px 22px rgba(138,91,255,.45));
}

@keyframes spin { to { transform: rotate(360deg); } }


/* keep the letter perfectly flat */
#sheet-overlay .letter-sheet,
#sheet-overlay .letter-sheet.is-live {
  transform: none !important;
}

/* if any child got 3D translateZ, flatten it too (safe) */
#sheet-overlay .letter-sheet .letter-content,
#sheet-overlay .letter-sheet .letter-fold {
  transform: none !important;
}
