/* Nuestro hogar — página de inicio de sesión */
:root {
  --plum-900: #2d1533;
  --plum-800: #43204a;
  --plum-700: #5a2c61;
  --plum-600: #7a3e78;
  --plum-500: #9a5592;
  --rose-500: #d6688e;
  --rose-400: #e58aa8;
  --rose-300: #f1b2c6;
  --rose-100: #fbe8ef;
  --lilac-400: #b5a1e3;
  --champagne: #e9c99a;
  --ivory: #fffafc;
  --text-2: #6f5873;
  --text-3: #9b879d;
  --due: #c44f74;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  font-family: var(--font-body); color: var(--plum-900);
  background:
    radial-gradient(900px 600px at 10% -10%, #fbe0ea 0%, transparent 60%),
    radial-gradient(800px 600px at 110% 10%, #e9e0fb 0%, transparent 55%),
    radial-gradient(900px 700px at 50% 120%, #f6d6e4 0%, transparent 60%),
    linear-gradient(180deg, #fdf3f7 0%, #f8eef6 50%, #f3eaf7 100%);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }

/* ================= corazones flotando ================= */
.float-hearts { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.float-hearts svg {
  position: absolute; bottom: -40px; fill: currentColor; opacity: 0;
  animation: rise var(--dur, 12s) linear var(--delay, 0s) infinite;
}
@keyframes rise {
  0%   { transform: translate3d(0, 0, 0) rotate(var(--r0, -10deg)) scale(var(--s, 1)); opacity: 0; }
  10%  { opacity: var(--o, 0.5); }
  50%  { transform: translate3d(var(--sway, 30px), -55vh, 0) rotate(var(--r1, 10deg)) scale(var(--s, 1)); }
  90%  { opacity: var(--o, 0.5); }
  100% { transform: translate3d(0, -112vh, 0) rotate(var(--r0, -10deg)) scale(var(--s, 1)); opacity: 0; }
}

/* ================= intro ================= */
.intro {
  position: fixed; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  transition: opacity 0.6s ease 0.35s;
}
.scene-fit { flex: none; transform-origin: 50% 100%; }
.scene {
  position: relative; width: 260px; height: 270px;
  opacity: 0; transform: translateY(26px) scale(0.92);
  transition: opacity 0.8s var(--ease), transform 1s var(--ease);
  will-change: transform;
}
.stage-1 .scene { opacity: 1; transform: none; }

.house { position: absolute; left: 0; right: 0; bottom: 18px; height: 252px; }
.roof { position: absolute; left: 0; top: 0; width: 260px; height: 128px; z-index: 2; filter: drop-shadow(0 6px 8px rgba(90, 44, 97, 0.18)); }

.walls {
  position: absolute; left: 30px; right: 30px; top: 106px; bottom: 10px; z-index: 1;
  border-radius: 6px 6px 10px 10px;
  background: linear-gradient(180deg, #fffdfd 0%, #fbeef4 100%);
  box-shadow: inset 0 0 0 2px rgba(122, 62, 120, 0.12), 0 18px 30px -18px rgba(90, 44, 97, 0.45);
}
.window {
  position: absolute; top: 26px; width: 40px; height: 40px; border-radius: 10px;
  background: #e9dcef; box-shadow: inset 0 0 0 3px #fff, 0 0 0 2px rgba(122, 62, 120, 0.25);
  overflow: hidden;
}
.window.left { left: 18px; }
.window.right { right: 18px; }
.window::before, .window::after { content: ''; position: absolute; background: rgba(122, 62, 120, 0.25); z-index: 1; }
.window::before { left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.window::after { top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; }
.window i {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(circle at 50% 60%, #fff6d8, #ffd99a 55%, #f5b884);
  transition: opacity 0.6s ease;
}
.stage-2 .window i { opacity: 1; }
.stage-2 .window.right i { transition-delay: 0.18s; }

/* puerta */
.doorway {
  position: absolute; left: 50%; bottom: 0; width: 62px; height: 92px; margin-left: -31px;
  border-radius: 31px 31px 4px 4px; perspective: 520px;
  background: #4a2350; box-shadow: 0 0 0 4px #fff, 0 0 0 6px rgba(122, 62, 120, 0.3);
}
.inside {
  position: absolute; inset: 3px; border-radius: 28px 28px 2px 2px; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 65%, #fff8e6 0%, #ffd9a0 45%, #f0a37e 100%);
}
.inside-heart { width: 26px; height: 26px; fill: var(--rose-500); transform: scale(0.4); opacity: 0; transition: transform 0.6s var(--ease) 0.35s, opacity 0.4s ease 0.35s; }
.stage-3 .inside-heart { transform: scale(1); opacity: 1; animation: beat 1.1s ease-in-out 1s infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.22); } 30% { transform: scale(0.96); } 45% { transform: scale(1.12); } }

.door {
  position: absolute; inset: 3px; border-radius: 28px 28px 2px 2px; transform-origin: 0 50%;
  background: linear-gradient(160deg, #b0578e 0%, #8a3f7f 55%, #64306a 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
  transition: transform 1.05s cubic-bezier(0.6, 0.05, 0.25, 1), filter 1.05s ease;
  backface-visibility: hidden;
}
.stage-3 .door { transform: rotateY(-108deg); filter: brightness(0.75); }
.door-panel { position: absolute; left: 10px; right: 10px; top: 14px; height: 30px; border-radius: 18px 18px 3px 3px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18); }
.door-panel.lower { top: 52px; height: 26px; border-radius: 3px; }
.knob { position: absolute; right: 9px; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--champagne); box-shadow: 0 0 6px rgba(233, 201, 154, 0.9); }

.step { position: absolute; left: 50%; bottom: 0; width: 92px; height: 10px; margin-left: -46px; border-radius: 4px; background: #e8d3e3; }
.ground {
  position: absolute; left: 50%; bottom: 0; width: 300px; height: 30px; margin-left: -150px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(122, 62, 120, 0.22), transparent);
}

/* humito de corazones */
.chimney-smoke { position: absolute; left: 182px; top: -6px; width: 30px; height: 40px; z-index: 3; }
.chimney-smoke svg { position: absolute; left: 4px; bottom: 0; width: 14px; height: 14px; fill: var(--rose-400); opacity: 0; }
.stage-2 .chimney-smoke svg { animation: puff 2.6s ease-out infinite; }
.stage-2 .chimney-smoke svg:nth-child(2) { animation-delay: 0.85s; }
.stage-2 .chimney-smoke svg:nth-child(3) { animation-delay: 1.7s; }
@keyframes puff {
  0% { transform: translate(0, 0) scale(0.5); opacity: 0; }
  20% { opacity: 0.9; }
  100% { transform: translate(18px, -64px) scale(1.25) rotate(14deg); opacity: 0; }
}

/* destellos */
.sparkles i {
  position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: 0;
  box-shadow: 0 0 10px 3px rgba(255, 255, 255, 0.9), 0 0 18px 6px rgba(241, 178, 198, 0.6);
}
.stage-1 .sparkles i { animation: twinkle 2.4s ease-in-out infinite; }
.sparkles i:nth-child(1) { left: 22%; top: 28%; animation-delay: 0.1s; }
.sparkles i:nth-child(2) { left: 74%; top: 22%; animation-delay: 0.6s; }
.sparkles i:nth-child(3) { left: 82%; top: 56%; animation-delay: 1.1s; }
.sparkles i:nth-child(4) { left: 16%; top: 62%; animation-delay: 0.9s; }
.sparkles i:nth-child(5) { left: 60%; top: 14%; animation-delay: 1.5s; }
.sparkles i:nth-child(6) { left: 34%; top: 16%; animation-delay: 0.3s; }
.sparkles i:nth-child(7) { left: 88%; top: 36%; animation-delay: 1.9s; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.4); } 50% { opacity: 1; transform: scale(1); } }

.intro-caption {
  margin: 0; font-family: var(--font-display); font-style: italic; font-size: 24px; color: var(--plum-700);
  opacity: 0; transform: translateY(8px); transition: opacity 0.7s ease, transform 0.7s var(--ease);
}
.stage-2 .intro-caption { opacity: 1; transform: none; }

/* entrar por la puerta */
.stage-4 .scene { transform: scale(7.5); opacity: 0; transition: transform 1.15s cubic-bezier(0.55, 0, 0.2, 1), opacity 0.5s ease 0.7s; }
.stage-4 .intro-caption { opacity: 0; transition-duration: 0.3s; }
.stage-4 .sparkles { opacity: 0; transition: opacity 0.3s; }
.glow {
  position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 55%, #fff9ee 0%, #ffe6c7 35%, rgba(253, 230, 238, 0.95) 70%, rgba(250, 236, 244, 0.9) 100%);
}
.stage-4 .glow { animation: glow 1.5s ease 0.45s forwards; }
@keyframes glow { 0% { opacity: 0; } 45% { opacity: 1; } 100% { opacity: 0; } }
.stage-5 .intro { opacity: 0; visibility: hidden; transition: opacity 0.4s, visibility 0s 0.4s; }

/* ================= login ================= */
.login {
  position: fixed; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center;
  padding: max(52px, calc(env(safe-area-inset-top) + 44px)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  opacity: 0; visibility: hidden;
}
.stage-5 .login { opacity: 1; visibility: visible; transition: opacity 0.5s ease; }

.card {
  position: relative; width: min(400px, 100%); margin: auto; flex: none; padding: 34px 30px 26px; border-radius: 30px; text-align: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.86), rgba(255, 248, 251, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 24px 50px -24px rgba(90, 44, 97, 0.38);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  transform: translateY(18px) scale(0.98);
  transition: transform 0.8s var(--ease);
}
.stage-5 .card { transform: none; }
.card > * { opacity: 0; transform: translateY(10px); transition: opacity 0.6s ease, transform 0.7s var(--ease); }
.stage-5 .card > * { opacity: 1; transform: none; }
.stage-5 .card > :nth-child(2) { transition-delay: 0.08s; }
.stage-5 .card > :nth-child(3) { transition-delay: 0.14s; }
.stage-5 .card > :nth-child(4) { transition-delay: 0.2s; }
.stage-5 .card > :nth-child(5) { transition-delay: 0.28s; }
.stage-5 .card > :nth-child(6) { transition-delay: 0.36s; }

.mark {
  width: 58px; height: 58px; margin: -64px auto 14px; border-radius: 19px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, var(--rose-400), var(--plum-600) 70%);
  box-shadow: 0 12px 26px -10px rgba(122, 62, 120, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.mark svg { width: 32px; height: 32px; }
.eyebrow { margin: 0; font-size: 11.5px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700; color: var(--plum-500); }
h1 { margin: 6px 0 4px; font-family: var(--font-display); font-weight: 500; font-size: 34px; line-height: 1.1; letter-spacing: -0.01em; }
h1 em { color: var(--plum-600); }
.couple { margin: 0 0 22px; color: var(--text-2); font-size: 15px; }
.couple span { color: var(--rose-500); display: inline-block; animation: beat 1.6s ease-in-out infinite; margin: 0 2px; }

form { display: grid; gap: 10px; text-align: left; }
.field { display: grid; gap: 7px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--plum-800); padding-left: 4px; }
.input-wrap { position: relative; display: block; }
.input-wrap input {
  width: 100%; height: 54px; padding: 0 52px 0 46px; border-radius: 16px;
  border: 1.5px solid rgba(122, 62, 120, 0.2); background: rgba(255, 255, 255, 0.92);
  font-size: 16px; font-weight: 500; letter-spacing: 0.02em;
  transition: border-color 0.2s, box-shadow 0.25s;
}
.input-wrap input::placeholder { color: var(--text-3); font-weight: 400; letter-spacing: 0; }
.input-wrap input:focus { outline: none; border-color: var(--plum-500); box-shadow: 0 0 0 5px rgba(229, 138, 168, 0.22); }
.field-heart { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; margin-top: -10px; fill: var(--rose-300); transition: fill 0.25s; pointer-events: none; }
.input-wrap:focus-within .field-heart { fill: var(--rose-500); animation: beat 1.3s ease-in-out infinite; }
.typing .field-heart { animation: beat 0.5s ease-in-out; }
.peek {
  position: absolute; right: 6px; top: 50%; width: 42px; height: 42px; margin-top: -21px; border: 0; border-radius: 12px;
  background: none; color: var(--text-3); cursor: pointer; display: grid; place-items: center;
}
.peek:hover, .peek[aria-pressed='true'] { color: var(--plum-600); background: rgba(122, 62, 120, 0.07); }
.peek:focus-visible { outline: 2px solid var(--plum-500); outline-offset: 1px; }
.eye { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.msg { min-height: 20px; margin: 0; padding-left: 4px; font-size: 13.5px; font-weight: 600; color: var(--due); }
.msg.ok { color: var(--plum-600); }

.enter {
  position: relative; height: 54px; border: 0; border-radius: 999px; cursor: pointer; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: #fff; font-weight: 700; font-size: 15.5px;
  background: linear-gradient(135deg, var(--rose-500), var(--plum-600) 55%, var(--plum-800));
  box-shadow: 0 12px 24px -12px rgba(90, 44, 97, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s, filter 0.2s;
}
.enter:hover { filter: brightness(1.07); }
.enter:active { transform: scale(0.97); }
.enter:focus-visible { outline: 3px solid var(--rose-300); outline-offset: 3px; }
.enter-heart { width: 19px; height: 19px; fill: #fff; transition: transform 0.3s var(--ease); }
.enter:hover .enter-heart { transform: scale(1.18); }
.enter[aria-busy='true'] .enter-heart { animation: beat 0.8s ease-in-out infinite; }
.enter[aria-busy='true'] { pointer-events: none; }

.foot { margin: 18px 0 0; font-size: 12.5px; color: var(--text-3); font-family: var(--font-display); font-style: italic; }

/* error: la tarjeta tiembla */
.card.shake { animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}
.broken { display: inline-block; animation: breakHeart 0.6s ease; }
@keyframes breakHeart { 0% { transform: scale(1); } 40% { transform: scale(1.3) rotate(-8deg); } 100% { transform: scale(1); } }

/* éxito: explosión de corazones y la tarjeta se despide */
.burst { position: fixed; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 6; }
.burst svg {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; fill: var(--c, var(--rose-400));
  animation: burst 1s cubic-bezier(0.15, 0.7, 0.3, 1) forwards;
}
@keyframes burst {
  0% { transform: translate(0, 0) scale(0.3) rotate(0deg); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(var(--s, 1.1)) rotate(var(--rot, 20deg)); opacity: 0; }
}
.welcome .card { transform: scale(0.96); opacity: 0; transition: transform 0.6s var(--ease) 0.35s, opacity 0.5s ease 0.45s; }

/* ================= responsive ================= */
@media (max-width: 480px) {
  .scene { transform-origin: 50% 80%; }
  .stage-4 .scene { transform: scale(7); }
  .card { padding: 30px 20px 22px; border-radius: 26px; }
  h1 { font-size: 30px; }
  .intro-caption { font-size: 21px; }
}
@media (max-width: 360px) {
  h1 { font-size: 26px; }
  .couple { margin-bottom: 18px; }
  .scene-fit { transform: scale(0.88); }
}
/* Pantallas bajas (celular en horizontal): casa más pequeña y tarjeta compacta */
@media (max-height: 620px) {
  .scene-fit { transform: scale(0.8); margin-top: -40px; }
  .intro { gap: 6px; }
}
@media (max-height: 480px) {
  .scene-fit { transform: scale(0.58); margin-top: -100px; margin-bottom: -6px; }
  .intro-caption { font-size: 19px; }
  .login { padding-top: max(40px, calc(env(safe-area-inset-top) + 34px)); padding-bottom: 12px; }
  .card { width: min(440px, 100%); padding: 22px 22px 16px; border-radius: 22px; }
  .mark { width: 46px; height: 46px; margin: -46px auto 8px; border-radius: 15px; }
  .mark svg { width: 26px; height: 26px; }
  h1 { font-size: 24px; margin: 2px 0; }
  .couple { margin-bottom: 12px; font-size: 14px; }
  form { gap: 6px; }
  .input-wrap input, .enter { height: 48px; }
  .msg { min-height: 18px; }
  .foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .float-hearts svg { animation-duration: 30s !important; }
}
