:root{
  --primary: #ff4d6d;
  --primary-light: #ff758f;
  --primary-dark: #c9184a;
  --secondary: #ffb3c1;
  --accent: #ff0054;
  --text: #1a1a1a;
  --text-muted: #595959;
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(255, 255, 255, 0.4);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-premium: 0 22px 60px rgba(255, 77, 109, 0.15);
}

*{ box-sizing:border-box; margin:0; padding:0; }

body{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  overflow: hidden;
  background: 
    radial-gradient(at 0% 0%, hsla(338,100%,94%,1) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(338,100%,98%,1) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(338,100%,94%,1) 0, transparent 50%), 
    radial-gradient(at 0% 50%, hsla(338,100%,96%,1) 0, transparent 50%), 
    radial-gradient(at 50% 50%, hsla(338,100%,98%,1) 0, transparent 50%), 
    radial-gradient(at 100% 50%, hsla(338,100%,96%,1) 0, transparent 50%), 
    radial-gradient(at 0% 100%, hsla(338,100%,94%,1) 0, transparent 50%), 
    radial-gradient(at 50% 100%, hsla(338,100%,98%,1) 0, transparent 50%), 
    radial-gradient(at 100% 100%, hsla(338,100%,94%,1) 0, transparent 50%);
  background-attachment: fixed;
}

/* Fondo animado */
.bg-glow{
  position:fixed;
  inset:-50%;
  background:
    radial-gradient(closest-side, rgba(214,51,108,.20), transparent 60%),
    radial-gradient(closest-side, rgba(255,90,165,.18), transparent 60%),
    radial-gradient(closest-side, rgba(255,180,210,.18), transparent 60%);
  filter: blur(35px);
  animation: bgMove 10s ease-in-out infinite;
  z-index:0;
}

@keyframes bgMove{
  0%{ transform: translate(-2%, -1%) scale(1.02); }
  50%{ transform: translate(2%, 1%) scale(1.05); }
  100%{ transform: translate(-2%, -1%) scale(1.02); }
}

/* Card */
.card{
  position:relative;
  z-index:2;
  width: min(94vw, 520px); /* Reducido de 600px a 520px para mejor balance */
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  padding: 30px 24px;
  box-shadow: var(--shadow-premium);
  transform: translateY(20px) scale(.95);
  opacity:0;
  animation: cardIn 1.2s cubic-bezier(.16, 1, .3, 1) forwards;
}

@keyframes cardIn{
  to{ opacity:1; transform: translateY(0) scale(1); }
}

/* Pantallas con transiciones */
.screen{
  display:none;
  opacity:0;
  transform: translateY(14px) scale(.98);
}

.screen.active{
  display:block;
  animation: screenIn .55s cubic-bezier(.2,.9,.2,1) forwards;
}

@keyframes screenIn{
  to{ opacity:1; transform: translateY(0) scale(1); }
}

.title, .subtitle{
  font-family:'Playfair Display', serif;
  color: var(--primary);
  letter-spacing:.2px;
  margin-bottom: 12px;
}

.title{ font-size: 1.85rem; } /* Ligeramente más pequeño */
.subtitle{ font-size: 1.45rem; }

.mini{
  margin-top: 14px;
  font-size:.92rem;
  color: var(--muted);
}

.typed{
  min-height: 54px;
  line-height:1.6;
  margin-bottom: 18px;
  color: rgba(0,0,0,.72);
  font-size: 1rem;
}

/* Botones */
.btn{
  width: 100%;
  border:0;
  border-radius: 999px;
  padding: 14px 16px;
  font-size: 1rem;
  cursor:pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  user-select:none;
}

.btn:active{ transform: translateY(1px) scale(.99); }

.btn-primary{
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 10px 20px rgba(255, 77, 109, 0.2);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.btn-primary:hover{
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 30px rgba(255, 77, 109, 0.3);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.btn-ghost{
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--text-muted);
}

.btn-ghost:hover{
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.btn-dark{
  background:#141414;
  color:#fff;
}

/* Pulse */
.pulse{ position:relative; }

.pulse::after{
  content:"";
  position:absolute;
  inset:-4px;
  border-radius:999px;
  background: radial-gradient(circle, rgba(214,51,108,.25), transparent 60%);
  opacity:.0;
  animation: pulseGlow 1.8s ease-in-out infinite;
  z-index:-1;
}

@keyframes pulseGlow{
  0%{ transform: scale(.98); opacity:.0; }
  45%{ transform: scale(1.05); opacity:.9; }
  100%{ transform: scale(1.10); opacity:0; }
}

.buttons{
  display:flex;
  gap:12px;
  margin-top: 6px;
  flex-wrap:wrap;
}

.buttons .btn{ flex:1 1 160px; }

/* Espacio para Mensaje / Dedicatoria */
.messageBox{
  margin: 12px 0 22px;
  padding: 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.messageTitle{
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.messageContent{
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  font-style: italic;
  position: relative;
}

.messageContent::before{
  content: "“";
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  position: absolute;
  top: -15px;
  left: -10px;
  opacity: 0.15;
  color: var(--primary);
}

/* Foto principal */
.photo{
  margin-top: 12px;
  border-radius: 18px;
  overflow:hidden;
  box-shadow: 0 18px 40px rgba(0,0,0,.12);
  margin-bottom: 14px;
  background: rgba(0,0,0,0.03); /* Fondo sutil si la foto no llena todo */
  display: flex;
  justify-content: center;
}

.photo img{
  width:100%;
  max-height: 480px; /* Permitir más altura para verticales */
  object-fit: contain; /* Mostrar toda la foto sin recortes */
  display:block;
}

/* Corazones */
.hearts{
  position: fixed;
  inset: 0;
  pointer-events:none;
  z-index:1;
}

.heart{
  position:absolute;
  opacity:.35;
  animation: floatUp linear forwards;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.10));
}

@keyframes floatUp{
  from{ transform: translateY(30px) scale(.9); opacity:.20; }
  20%{ opacity:.45; }
  to{ transform: translateY(-120vh) scale(1.2); opacity:0; }
}

/* Chispas / Sparkles */
.sparkle {
  position: fixed;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 0 10px white, 0 0 20px white;
  animation: sparkleAnim 3s linear infinite;
  opacity: 0;
}

@keyframes sparkleAnim {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.5); opacity: 0.8; }
  100% { transform: scale(0); opacity: 0; }
}

/* Responsive base */
@media (max-width: 380px){
  .title{ font-size: 1.8rem; }
  .subtitle{ font-size: 1.4rem; }
  .photo img{ height: 230px; }
}

/* =========================
   PANTALLA 4: GALERÍA MODERNA
========================= */
.modernGallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
  padding: 5px;
  max-height: 480px; /* Reducido para mejor control vertical */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  scroll-behavior: smooth;
}

/* Ocultar scrollbar si se prefiere un look más limpio, o estilizarlo */
.modernGallery::-webkit-scrollbar {
  width: 6px;
}
.modernGallery::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 10px;
}

/* Estilo Polaroid Premium */
.photoItem {
  background: white;
  padding: 8px 8px 12px;
  border-radius: 15px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: zoom-in;
}

.photoItem img {
  width: 100%;
  aspect-ratio: 1; /* Cuadradas para orden */
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.photoItem:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow-lg);
  z-index: 10;
}

/* Mobile Adjustments for Gallery */
@media (max-width: 520px) {
  .modernGallery {
    grid-template-columns: repeat(2, 1fr);
    max-height: 480px;
    gap: 10px;
  }
  .photoItem {
    padding: 6px 6px 10px;
  }
}

.rowBtns{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}
.rowBtns .btn{
  flex: 1 1 160px;
}

/* =========================
   LIGHTBOX FULLSCREEN (SWIPE + ZOOM)
========================= */
.lightbox{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  background: rgba(10,10,12,.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 14px;
}

.lightbox.open{
  display: block;
  animation: lbIn .18s ease both;
}

@keyframes lbIn{
  from{ opacity:0; }
  to{ opacity:1; }
}

.lbTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin: 0 auto 10px;
  max-width: 1100px;
}

.lbHint{
  color: rgba(255,255,255,.80);
  font-size: .9rem;
}

.lbClose{
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  cursor:pointer;
  background: rgba(255,255,255,.92);
  box-shadow: 0 16px 30px rgba(0,0,0,.25);
}

.lbStage{
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  height: calc(100vh - 150px);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  border-radius: 18px;
}

.lbImg{
  max-width: 100%;
  max-height: 100%;
  border-radius: 16px;
  box-shadow: 0 22px 70px rgba(0,0,0,.40);
  transform: translate3d(0,0,0) scale(1);
  transition: transform .18s ease;
  user-select:none;
  -webkit-user-drag: none;
  cursor: zoom-in;
}

.lbImg.zoom{
  transform: translate3d(0,0,0) scale(2);
  cursor: grab;
}

.lbNav{
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  cursor:pointer;
  background: rgba(255,255,255,.92);
  box-shadow: 0 16px 30px rgba(0,0,0,.25);
  font-size: 28px;
  line-height: 44px;
  text-align:center;
}

.lbPrev{ left: 14px; }
.lbNext{ right: 14px; }

.lbBottom{
  max-width: 1100px;
  margin: 10px auto 0;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
}

.lbCaption{
  color: rgba(255,255,255,.85);
  font-size: .95rem;
}

.lbDots{
  display:flex;
  gap: 7px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.lbDot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.35);
}
.lbDot.active{
  background: rgba(255,255,255,.95);
}

@media (max-width: 520px){
  .lbHint{ display:none; }
  .lbStage{ height: calc(100vh - 120px); }
  .lbPrev{ left: 8px; }
  .lbNext{ right: 8px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  .bg-glow, .heart, .pulse::after { animation: none !important; }
  .lightbox.open{ animation: none !important; }
}
