:root {
  --bg1: #0b0b14;
  --bg2: #131328;
  --text: #f2f2f7;
  --muted: rgba(242, 242, 247, 0.72);
  --card: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 180, 210, 0.18);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --fontTitle: "Playfair Display", serif;
  --fontBody: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  color: var(--text);
  font-family: var(--fontBody);
  background:
    radial-gradient(900px 700px at 20% 10%, #5b1b4b 0%, transparent 60%),
    radial-gradient(800px 600px at 80% 30%, #7a2a5e 0%, transparent 60%),
    linear-gradient(180deg, #140913, #1c0d18);
  overflow-x: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.grain {
  position: absolute;
  inset: -20%;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
  transform: rotate(5deg);
}
.glow {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.25;
}
.glow-1 {
  left: -120px;
  top: -100px;
  background: #ff4fd8;
}

.glow-2 {
  right: -140px;
  bottom: -120px;
  background: #ff7ac3;
}

.app {
  min-height: 100svh; /* mejor que 100% en mobile/tablet */
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px 30px;
  max-width: 980px;
  margin: 0 auto;
}

.screen.active {
  /* esto hace que el bloque “respire” mejor en iPad */
  margin-top: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  backdrop-filter: blur(10px);
}
.brand {
  font-weight: 600;
}
.brand span {
  opacity: 0.9;
}
.dots {
  display: flex;
  gap: 6px;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}
.dot.active {
  background: rgba(255, 255, 255, 0.85);
}

.screen {
  display: none;
  border: 1px solid var(--stroke);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.03)
  );
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(12px);
  animation: fadeIn 0.35s ease;
}
.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title {
  font-size: clamp(28px, 5vw, 44px);
}
.h2 {
  font-size: clamp(22px, 3.8vw, 32px);
}
.question {
  font-size: clamp(22px, 4vw, 32px);
}
.finalText {
  font-size: clamp(22px, 4vw, 34px);
}
.subtitle {
  margin: 0 0 18px;
  color: var(--muted);
}
.h2 {
  font-family: var(--fontTitle);
  font-size: 30px;
  margin: 6px 0 10px;
}
.h3 {
  margin: 0 0 10px;
  font-size: 16px;
  letter-spacing: 0.2px;
}
.small {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 0;
}

.card {
  margin-top: 16px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.16);
}
.card.big {
  padding: 22px;
}
.cardText {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 860px) {
  .grid {
    grid-template-columns: 320px 1fr;
  }
}

.stat {
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.16);
  border-radius: 18px;
  padding: 18px;
}
.statLabel {
  font-size: 13px;
  color: var(--muted);
}
.statValue {
  font-family: var(--fontTitle);
  font-size: 42px;
  margin-top: 6px;
}
.statHint {
  font-size: 12px;
  color: var(--muted);
  margin-top: -4px;
}

.panel {
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.1);
  border-radius: 18px;
  padding: 18px;
}
.list {
  margin: 0;
  padding-left: 18px;
  color: rgba(242, 242, 247, 0.88);
}
.list li {
  margin: 8px 0;
}

.nav {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.btn {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.08s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}
.btn:active {
  transform: scale(0.98);
}
.btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.btn.primary {
  background: linear-gradient(135deg, #ff6fb7, #ff3e9e);
  border-color: rgba(255, 255, 255, 0.25);
}
.btn.primary:hover {
  background: rgba(255, 79, 216, 0.24);
}
.btn.ghost {
  background: transparent;
}
.btn.danger {
  background: rgba(255, 90, 90, 0.14);
  border-color: rgba(255, 90, 90, 0.34);
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}
kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--stroke);
  border-bottom-color: rgba(255, 255, 255, 0.18);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}

.gallery {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 520px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 900px) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
  }
}
.photo {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.15);
  aspect-ratio: 1 / 1;
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.35s ease;
}
.photo:hover img {
  transform: scale(1.07);
}

.question {
  font-family: var(--fontTitle);
  font-size: 30px;
  margin: 0 0 18px;
  line-height: 1.15;
}
.buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.final {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.finalText {
  font-family: var(--fontTitle);
  font-size: 30px;
  line-height: 1.15;
  margin: 0;
}
.finalText2 {
  margin: 0;
  color: rgba(242, 242, 247, 0.88);
  font-size: 16px;
  line-height: 1.5;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.gift {
  margin-top: 6px;
  border: 1px solid rgba(255, 180, 210, 0.18);
  border-radius: 18px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.1);
}

canvas#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.screen[data-step="4"] {
  background: linear-gradient(
    180deg,
    rgba(255, 120, 190, 0.12),
    rgba(255, 80, 160, 0.06)
  );
}

/* Typewriter */
.typewriter {
  position: relative;
  display: inline-block;
}

.typewriter::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 1.1em;
  margin-left: 6px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  vertical-align: -2px;
  animation: blink 0.9s infinite;
}

.typewriter.done::after {
  display: none;
}

@keyframes blink {
  0%,
  45% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* Floating hearts */
.hearts {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.heart {
  position: absolute;
  bottom: -40px;
  width: 18px;
  height: 18px;
  opacity: 0.14;
  transform: translateX(0) rotate(0deg);
  filter: blur(0.2px);
  animation: floatUp linear forwards;
  pointer-events: none;
}

.heart::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 30% 30%,
      rgba(255, 255, 255, 0.55),
      rgba(255, 100, 190, 0) 55%
    ),
    rgba(255, 120, 190, 0.9);
  clip-path: path("M9 16 C-1 9 3 2 9 6 C15 2 19 9 9 16 Z");
}

@keyframes floatUp {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.18;
  }
  100% {
    transform: translateY(-120vh) translateX(var(--drift)) rotate(260deg);
    opacity: 0;
  }
}

/* Parallax smoothing */
.glow {
  will-change: transform;
  transition: transform 0.08s linear;
}

/* Mobile-first buttons */
.buttons .btn,
.nav .btn,
.actions .btn {
  width: 100%;
  justify-content: center;
}

@media (min-width: 520px) {
  .buttons .btn,
  .nav .btn,
  .actions .btn {
    width: auto;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding: 8px 10px;
  }
  .brand {
    font-size: 14px;
  }
}

/* ===== Carta máquina de escribir ===== */

.typeLetter {
  font-family: "Special Elite", monospace;
  font-size: clamp(15px, 3.4vw, 17px);
  line-height: 1.9;
  letter-spacing: 0.4px;

  color: rgba(255, 235, 245, 0.95);

  background: linear-gradient(
    180deg,
    rgba(255, 210, 230, 0.08),
    rgba(255, 170, 210, 0.05)
  );

  border: 1px solid rgba(255, 180, 210, 0.18);
  border-radius: 18px;

  padding: 22px 20px;
  margin-top: 10px;

  box-shadow:
    0 12px 40px rgba(255, 80, 160, 0.08),
    inset 0 0 20px rgba(255, 255, 255, 0.03);

  backdrop-filter: blur(6px);

  white-space: pre-line; /* RESPETA SALTOS DE LINEA */

  overflow-wrap: anywhere; /* evita desbordes raros */
  word-break: break-word;
  max-width: 100%;
}

/* cursor tipo maquina */
.typeLetter.typing::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 1em;
  margin-left: 6px;
  background: rgba(255, 255, 255, 0.7);
  animation: blink 0.9s infinite;
  border-radius: 2px;
}

@keyframes blink {
  0%,
  45% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* Carta oculta inicialmente */
.letterHidden {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(18px);
  transition:
    max-height 0.7s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.45s ease,
    transform 0.45s ease;
}

/* Carta visible */
.letterShow {
  max-height: 10000px; /* grande para que JAMÁS corte */
  opacity: 1;
  transform: translateY(0);
  overflow: visible; /* clave: ya NO recorta */
}

/* ===== Spotify card ===== */
.songCard {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 180, 210, 0.18);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.03)
  );
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.songIcon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0.06)
  );
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.songInfo {
  flex: 1;
  min-width: 0;
}
.songTitle {
  font-weight: 700;
  letter-spacing: 0.2px;
}
.songMeta {
  font-size: 13px;
  color: rgba(255, 235, 245, 0.78);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.songBtn {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 700;
  color: #08120b;
  background: linear-gradient(135deg, #1ed760, #19b84f);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition:
    transform 0.08s ease,
    filter 0.2s ease;
  white-space: nowrap;
}
.songBtn:hover {
  filter: brightness(1.03);
}
.songBtn:active {
  transform: scale(0.98);
}

@media (max-width: 420px) {
  .songCard {
    align-items: flex-start;
  }
  .songBtn {
    width: 100%;
    text-align: center;
  }
  .songCard {
    flex-direction: column;
  }
  .songInfo {
    width: 100%;
  }
}

/* Tablet portrait/landscape: mejora proporción */
@media (min-width: 700px) and (max-width: 1100px) {
  .app {
    padding: 28px 22px 34px;
    max-width: 860px; /* evita que se vea mini en iPad */
  }

  .screen {
    padding: 28px;
  }

  .title {
    font-size: clamp(34px, 4.2vw, 46px);
  }

  .card {
    padding: 22px;
  }

  .hint {
    font-size: 14px;
  }
}

/* Empuja el contenido activo al centro en pantallas altas (iPad/TV),
   sin usar transform (no se ve “flotando”) */
@media (min-height: 820px) {
  .app {
    justify-content: flex-start;
  }
  .screen.active {
    margin-top: 12px;
  }

  /* crea espacio automático debajo del topbar */
  .screen.active {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
}

/* Intro más protagonista en tablet */
@media (min-width: 700px) {
  section[data-step="0"] .card {
    max-width: 680px;
  }
}

@media (min-width: 700px) and (max-width: 1100px) {
  .glow {
    opacity: 0.32;
  } /* antes .25 */
}

/* ===== iPad/tablet ===== */
@media (min-width: 700px) {
  .app {
    padding: 30px 22px 40px;
  }
  .screen {
    padding: 28px;
  }
  .topbar {
    padding: 12px 14px;
  }
}

/* ===== Laptop/Desktop ===== */
@media (min-width: 1100px) {
  .app {
    width: min(1280px, 100%);
  }
  .screen {
    padding: 32px;
  }
  .title {
    font-size: clamp(40px, 3.2vw, 54px);
  }
  .statValue {
    font-size: 56px;
  }
}

/* ===== TV / pantallas grandes ===== */
@media (min-width: 1600px) {
  .app {
    width: min(1480px, 100%);
  }
  body {
    font-size: 18px;
  } /* lectura cómoda en TV */
  .screen {
    padding: 40px;
    border-radius: 28px;
  }
  .card {
    padding: 26px;
  }
  .title {
    font-size: clamp(52px, 3vw, 68px);
  }
  .finalText {
    font-size: clamp(34px, 2.2vw, 46px);
  }
  .finalText2 {
    font-size: 20px;
    line-height: 1.7;
  }
}

.introHero {
  animation: heroIn 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body.warmMode {
  background:
    radial-gradient(
      900px 700px at 20% 10%,
      rgba(255, 120, 190, 0.35) 0%,
      transparent 60%
    ),
    radial-gradient(
      800px 600px at 80% 30%,
      rgba(255, 120, 190, 0.18) 0%,
      transparent 60%
    ),
    linear-gradient(180deg, #140913, #1c0d18);
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  z-index: 999;
  backdrop-filter: blur(10px);
}
.lightbox.open {
  display: grid;
}
.lbImg {
  max-width: min(92vw, 980px);
  max-height: 82vh;
  border-radius: 18px;
  border: 1px solid rgba(255, 180, 210, 0.25);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}
.lbClose {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
}
.lbNav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 30px;
  cursor: pointer;
}
.lbNav.left {
  left: 14px;
}
.lbNav.right {
  right: 14px;
}

.letterPunch {
  margin-top: 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: 0.5s ease;
  color: rgba(255, 235, 245, 0.85);
  font-size: 14px;
}
.letterPunch.show {
  opacity: 1;
  transform: translateY(0);
}

.spotifyEmbed {
  margin-top: 12px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 180, 210, 0.18);
  background: rgba(0, 0, 0, 0.18);
}
.spotifyEmbed iframe {
  width: 100%;
  height: 152px;
  border: 0;
  display: block;
}

.flipGrid {
  margin-top: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .flipGrid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.flipCard {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 1000px;
  text-align: left;
}

.flipInner {
  display: block;
  position: relative;
  min-height: 132px;
  border-radius: 18px;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.flipCard.isFlipped .flipInner {
  transform: rotateY(180deg);
}

.flipFront,
.flipBack {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  border: 1px solid rgba(255, 180, 210, 0.18);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(0, 0, 0, 0.1)
  );
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  padding: 16px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.flipBack {
  transform: rotateY(180deg);
  color: rgba(255, 235, 245, 0.95);
  line-height: 1.5;
}

.flipSmall {
  font-size: 13px;
  color: rgba(255, 235, 245, 0.75);
}
.flipBig {
  font-family: var(--fontTitle);
  font-size: 26px;
  line-height: 1.1;
}
.flipHint {
  font-size: 12px;
  color: rgba(255, 235, 245, 0.65);
  margin-top: 4px;
}

.timeline {
  margin-top: 10px;
  position: relative;
  display: grid;
  gap: 12px;
}

.tItem {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
}

.tDot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 6px rgba(255, 120, 190, 0.12);
  position: relative;
}

.tItem:not(:last-child) .tDot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  width: 2px;
  height: calc(100% + 12px);
  background: rgba(255, 180, 210, 0.18);
}

.tBox {
  border: 1px solid rgba(255, 180, 210, 0.18);
  border-radius: 18px;
  padding: 14px 14px;
  background: rgba(0, 0, 0, 0.12);
}

.tDate {
  font-weight: 700;
  letter-spacing: 0.2px;
  color: rgba(255, 235, 245, 0.92);
}

.tText {
  margin-top: 4px;
  color: rgba(242, 242, 247, 0.86);
  line-height: 1.5;
}

/* Timeline tipo Stories */
.tStory {
  margin-top: 10px;
  border: 1px solid rgba(255, 180, 210, 0.18);
  border-radius: 18px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.1);
}

.tBars {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.tBar {
  height: 4px;
  flex: 1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
.tBar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.tViewport {
  overflow: hidden;
  border-radius: 16px;
}

.tSlides {
  display: flex;
  gap: 12px;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

/* cada slide ocupa el ancho completo */
.tSlides .tItem {
  min-width: 100%;
  grid-template-columns: 18px 1fr; /* respeta tu layout */
}

/* nav */
.tNav {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
/* Timeline story: layout más ancho en mobile */
.tSlides .tItem {
  min-width: 100%;
  display: grid;
  grid-template-columns: 12px 1fr; /* más compacto */
  gap: 10px;
}

.tBox {
  min-width: 0; /* CLAVE para que no corte raro */
}

.tDate {
  font-size: 14px;
  line-height: 1.2;
}

.tText {
  font-size: 14px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere; /* evita overflow */
  word-break: break-word;
}
