/*
  VOICE: tierno, íntimo, sin estridencias.
  IDEA: una carta que se abre al ingresar el código.
  PICTURE: lluvia de pétalos rojos sobre un fondo vino.
  COLOUR and TYPE: vino profundo, rosa suave, acento rosa intenso; Great Vibes para el nombre, Cormorant Garamond para el texto.
  LAYOUT: una sola tarjeta centrada; en la dedicatoria, nombre arriba y el video grande.
*/

:root {
  --fondo-1: #2b0b1c;
  --fondo-2: #4a1430;
  --tarjeta: rgba(255, 240, 244, 0.06);
  --borde: rgba(255, 200, 214, 0.22);
  --tinta: #fff3f6;
  --tinta-suave: #f1c9d4;
  --rosa: #e8475f;
  --rosa-fuerte: #b5122c;
  --error: #ffb3c1;
  --sombra: 0 30px 80px rgba(10, 0, 6, 0.55);
}

* { box-sizing: border-box; min-width: 0; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--tinta);
  font: 400 18px/1.6 "Cormorant Garamond", Georgia, "Times New Roman", serif;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(200, 30, 60, 0.30), transparent 60%),
    radial-gradient(900px 600px at 100% 110%, rgba(180, 20, 50, 0.25), transparent 60%),
    linear-gradient(160deg, var(--fondo-2), var(--fondo-1) 65%);
  background-attachment: fixed;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Lluvia de pétalos ---------- */
.petalos { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.petalos span {
  position: absolute;
  top: -40px;
  border-radius: 80% 10% 80% 10%;
  background: radial-gradient(circle at 30% 30%, #ff5466, #c3112b 55%, #7a0616);
  box-shadow: inset -2px -2px 4px rgba(60, 0, 10, .35);
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes caer {
  0%   { transform: translate(0, 0) rotate(0deg); }
  50%  { transform: translate(40px, 55vh) rotate(200deg); }
  100% { transform: translate(-20px, 115vh) rotate(380deg); }
}
@keyframes caer2 {
  0%   { transform: translate(0, 0) rotate(40deg) scaleX(-1); }
  50%  { transform: translate(-36px, 55vh) rotate(-140deg) scaleX(-1); }
  100% { transform: translate(24px, 115vh) rotate(-320deg) scaleX(-1); }
}

/* ---------- Estructura ---------- */
.escena {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 64px) max(5vw, 16px);
}

/* ---------- Login: la carta ---------- */
.carta {
  width: min(460px, 100%);
  text-align: center;
  padding: 48px clamp(22px, 6vw, 48px) 40px;
  border-radius: 28px;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  box-shadow: var(--sombra);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: relative;
  transition: transform .9s cubic-bezier(.2, .8, .2, 1), opacity .9s ease;
}
.carta.abierta { transform: translateY(-14px) scale(.97); opacity: 0; }

.saludo-chico {
  margin: 0;
  font-size: 20px;
  font-style: italic;
  color: var(--tinta-suave);
  letter-spacing: .02em;
}
.nombre {
  margin: 0 0 28px;
  font-family: "Great Vibes", "Brush Script MT", cursive;
  font-weight: 400;
  font-size: clamp(56px, 14vw, 84px);
  line-height: 1.05;
  color: #ffe3ea;
  text-shadow: 0 4px 30px rgba(244, 138, 162, .45);
}
.intro {
  margin: 0 auto 28px;
  max-width: 34ch;
  color: var(--tinta-suave);
  font-size: 19px;
  text-wrap: balance;
}

.etiqueta {
  display: block;
  margin-bottom: 12px;
  font-size: 15px;
  letter-spacing: .04em;
  color: var(--tinta-suave);
}
.digitos {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 3vw, 14px);
}
.digito {
  width: clamp(52px, 15vw, 62px);
  height: clamp(62px, 18vw, 72px);
  text-align: center;
  font: 600 30px/1 "Cormorant Garamond", Georgia, serif;
  color: var(--tinta);
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--borde);
  border-radius: 16px;
  outline: none;
  caret-color: var(--rosa);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.digito:focus {
  border-color: var(--rosa);
  background: rgba(255, 255, 255, .11);
  box-shadow: 0 0 0 4px rgba(244, 138, 162, .25);
}
.digitos.error .digito { border-color: var(--error); }
.digitos.error { animation: temblor .45s ease; }
@keyframes temblor {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

.mensaje {
  min-height: 26px;
  margin: 14px 0 6px;
  font-size: 17px;
  font-style: italic;
  color: var(--tinta-suave);
}
.mensaje.es-error { color: var(--error); }

.boton {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  font: 600 19px/1 "Cormorant Garamond", Georgia, serif;
  letter-spacing: .03em;
  color: #fff;
  background: linear-gradient(135deg, var(--rosa), var(--rosa-fuerte));
  box-shadow: 0 12px 30px rgba(226, 85, 122, .4);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease;
}
.boton:hover { transform: translateY(-1px); box-shadow: 0 16px 36px rgba(226, 85, 122, .5); }
.boton:active { transform: translateY(1px); }
.boton:focus-visible { outline: 3px solid #ffd3dd; outline-offset: 3px; }

/* ---------- Dedicatoria ---------- */
.escena-ancha {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(22px, 4vw, 36px);
  text-align: center;
  animation: aparecer 1.1s ease both;
}
@keyframes aparecer { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.encabezado { width: 100%; }
.nombre-grande { font-size: clamp(68px, 16vw, 120px); }
.adorno {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--rosa);
}
.adorno-petalo { width: 14px; height: 18px; border-radius: 80% 10% 80% 10%; transform: rotate(45deg); background: radial-gradient(circle at 30% 30%, #ff5466, #c3112b 55%, #7a0616); }
.adorno span {
  width: min(120px, 22vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rosa));
}
.adorno span:last-child { background: linear-gradient(90deg, var(--rosa), transparent); }

.reproductor { width: min(860px, 100%); }
.marco-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 24px;
  overflow: hidden;
  background: #1a0610;
  border: 1px solid var(--borde);
  box-shadow: var(--sombra), 0 0 0 8px rgba(255, 220, 230, .05);
}
.marco-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.marco-video.vacio {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(244, 138, 162, .18), transparent 60%),
    #1f0814;
}
.aviso-vacio { padding: 24px; color: var(--tinta-suave); }
.aviso-vacio svg { width: 64px; height: 64px; color: var(--rosa); margin-bottom: 8px; }
.aviso-vacio p { margin: 0 0 4px; font-size: 22px; color: var(--tinta); }
.aviso-vacio small { font-size: 15px; }
.aviso-vacio code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: #ffd3dd; }

.indicacion { margin: 14px 0 0; font-style: italic; color: var(--tinta-suave); font-size: 17px; }

.pie { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-bottom: 12px; }
.salir {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--borde);
  color: var(--tinta-suave);
  text-decoration: none;
  font-size: 16px;
}
.salir:hover { color: var(--tinta); border-color: var(--rosa); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

[hidden] { display: none !important; }
button.salir { background: transparent; font-family: inherit; cursor: pointer; }
