:root {
  --bg-deep: #0e1128;
  --bg-deep-2: #171b3a;
  --card: #1c2145;
  --card-2: #232a55;
  --gold: #e8b86d;
  --rose: #ff8fab;
  --cream: #f7f1e6;
  --muted: #9aa0c9;
  --error: #ff5470;
  --success: #8fdcae;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
}

* { 
  box-sizing: border-box; 
  -webkit-tap-highlight-color: transparent; 
}

html, body {
  margin: 0; 
  min-height: 100%;
  background: var(--bg-deep);
  font-family: 'Outfit', sans-serif;
  color: var(--cream);
  overflow-x: hidden;
}

#sky {
  position: fixed; 
  inset: 0; 
  z-index: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,143,171,.10), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(232,184,109,.10), transparent 45%),
    linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-deep-2) 100%);
}
#sky canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.hidden { display: none !important; }

/* Pantalla de bloqueo */
#lockView {
  position: relative; 
  z-index: 1;
  min-height: 100dvh; 
  width: 100%;
  display: flex; 
  align-items: center; 
  justify-content: center;
  padding: 0;
}

.phone-shell {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex; 
  flex-direction: column;
  align-items: center; 
  justify-content: space-between;
  text-align: center;
  padding: max(32px, env(safe-area-inset-top)) 26px max(22px, env(safe-area-inset-bottom));
  background: transparent;
}

@media (min-width: 640px) {
  #lockView { padding: 40px 20px; }
  .phone-shell {
    max-width: 400px;
    min-height: min(820px, 90dvh); 
    height: min(820px, 90dvh);
    border-radius: 46px;
    border: 8px solid #05061a;
    box-shadow: var(--shadow), 0 0 0 2px rgba(255,255,255,.04) inset;
    background: var(--bg-deep);
    overflow: hidden;
  }
  .phone-shell::before {
    content: '';
    position: absolute; 
    top: 14px; 
    left: 50%; 
    transform: translateX(-50%);
    width: 110px; 
    height: 22px; 
    background: #05061a; 
    border-radius: 14px;
    z-index: 5;
  }
}

.lock-top { display: flex; flex-direction: column; align-items: center; width: 100%; }

.clock-time {
  font-family: 'Fraunces', serif; 
  font-weight: 300;
  font-size: clamp(34px, 10vw, 52px);
  letter-spacing: 1px; 
  line-height: 1.2;
  color: var(--cream);
}

.clock-date {
  margin-top: 4px; 
  font-size: 13px; 
  color: var(--muted);
  text-transform: capitalize; 
  letter-spacing: .5px;
}

.lock-title {
  margin-top: 20px;
  font-family: 'Caveat', cursive; 
  font-weight: 600;
  font-size: 24px; 
  color: var(--rose); 
  line-height: 1.3;
}

.dots { display: flex; gap: 12px; margin-top: 18px; }

.dot {
  width: 13px; 
  height: 13px; 
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  background: transparent;
  transition: background .15s, border-color .15s, transform .15s;
}

.dot.filled { background: var(--gold); border-color: var(--gold); transform: scale(1.1); }
.dot.error { background: var(--error); border-color: var(--error); }
.dot.success { background: var(--success); border-color: var(--success); }

.lock-hint { margin-top: 14px; font-size: 12.5px; color: var(--muted); min-height: 16px; }

.lock-fail {
  margin-top: 6px; 
  font-size: 13.5px; 
  font-weight: 600; 
  color: var(--error);
  min-height: 18px; 
  opacity: 0; 
  transition: opacity .2s;
}
.lock-fail.show { opacity: 1; }

.shake { animation: shake .38s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px) }
  20%, 80% { transform: translateX(4px) }
  30%, 50%, 70% { transform: translateX(-8px) }
  40%, 60% { transform: translateX(8px) }
}

.keypad {
  margin-bottom: 4px;
  display: grid; 
  grid-template-columns: repeat(3, 1fr);
  gap: 10px; 
  width: 100%; 
  max-width: 260px; 
  align-self: center;
  flex-shrink: 0;
}

.key {
  aspect-ratio: 1/1; 
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--cream);
  font-family: 'Outfit', sans-serif; 
  font-size: clamp(16px, 4.5vw, 22px); 
  font-weight: 500;
  display: flex; 
  align-items: center; 
  justify-content: center;
  user-select: none; 
  cursor: pointer;
  transition: background .12s, transform .08s;
}
.key:active { background: rgba(255,255,255,.16); transform: scale(.94); }
.key.ghost { background: transparent; border: none; cursor: default; }

/* Contenedor Vistas App */
#appView { position: relative; z-index: 1; width: 100%; }

.page {
  display: none;
  min-height: 100dvh; 
  width: 100%;
  flex-direction: column; 
  align-items: center; 
  justify-content: flex-start;
  position: relative;
  padding: 32px 24px calc(28px + env(safe-area-inset-bottom));
  opacity: 0; 
  transform: translateY(10px);
}
.page.active { display: flex; animation: pageIn .4s ease forwards; }
@keyframes pageIn { to { opacity: 1; transform: translateY(0); } }

.page-inner {
  width: 100%; 
  max-width: 420px;
  display: flex; 
  flex-direction: column; 
  align-items: center;
}

.back-btn {
  position: absolute; 
  top: max(18px, env(safe-area-inset-top)); 
  left: 20px; 
  z-index: 10;
  width: 38px; 
  height: 38px; 
  border-radius: 50%;
  background: rgba(255,255,255,.08); 
  border: none; 
  color: var(--cream);
  font-size: 18px; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  cursor: pointer;
}

/* Menú */
#menu { padding-top: 56px; }
.menu-eyebrow { font-size: 13px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.menu-title {
  font-family: 'Fraunces', serif; 
  font-weight: 600; 
  font-size: 28px;
  margin-top: 6px; 
  color: var(--cream); 
  text-align: center;
}
.menu-title span { color: var(--rose); font-family: 'Caveat', cursive; font-size: 32px; }

.grid {
  margin-top: 32px; 
  display: grid; 
  grid-template-columns: 1fr 1fr;
  gap: 16px; 
  width: 100%;
}
.tile {
  position: relative; 
  aspect-ratio: 1/1; 
  border-radius: 24px;
  background: linear-gradient(160deg, var(--card), var(--card-2));
  border: 1px solid rgba(255,255,255,.06);
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center;
  gap: 10px; 
  cursor: pointer; 
  text-align: center; 
  padding: 14px;
  transition: transform .15s, box-shadow .15s;
}
.tile:active { transform: scale(.96); }
.tile .icon { font-size: 34px; }
.tile .label { font-size: 13.5px; font-weight: 500; color: var(--cream); line-height: 1.25; }
.tile.mystery .icon { font-family: 'Fraunces', serif; color: var(--gold); font-size: 40px; }
.tile.reasons .icon { color: var(--rose); }
.tile.gallery .icon { font-size: 32px; }
.tile.music .icon { font-size: 32px; }

/* Apartado ¿Me amas? estilo Ventana Retro Pixelada Exacta */
#question {
  justify-content: center;
  align-items: center;
  background: #000;
  overflow: hidden;
}

.retro-window {
  width: 90%;
  max-width: 360px;
  background: #000;
  border: 2px solid #fff;
  border-radius: 0px;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 2;
}

.retro-titlebar {
  padding: 8px 12px;
  border-bottom: 2px solid #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.retro-dots {
  display: flex;
  gap: 6px;
}

.retro-dots span {
  width: 8px;
  height: 8px;
  border: 1px solid #fff;
  border-radius: 0;
  display: inline-block;
  background: #000;
}

.retro-win-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #fff;
}

.retro-body {
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.retro-q-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: #fff;
  margin-bottom: 32px;
  line-height: 1.6;
  text-transform: uppercase;
}

.retro-q-btns {
  display: flex;
  gap: 16px;
  justify-content: center;
  width: 100%;
}

.retro-action-btn {
  background: #000;
  color: #fff;
  border: 2px solid #fff;
  padding: 10px 26px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.1s, color 0.1s, transform 0.2s;
}

.retro-action-btn:hover, .retro-action-btn:active {
  background: #fff;
  color: #000;
}

.retro-action-btn.yes-grown {
  transform: scale(1.2);
}

.hide { display: none !important; }

.q-error {
  margin-top: 20px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--error);
  opacity: 0;
  transition: opacity 0.25s ease;
  line-height: 1.5;
}
.q-error.show { opacity: 1; }

/* Celebración Estilo Foto con Lluvia de TE AMO Pixelada */
#celebration { justify-content: center; text-align: center; background: #000; overflow: hidden; }
.rain { position: absolute; inset: 0; display: flex; z-index: 0; }
.rain-col { flex: 1; overflow: hidden; position: relative; }
.rain-col-inner {
  position: absolute; 
  top: 0; 
  left: 0; 
  right: 0;
  font-family: 'Press Start 2P', monospace; 
  font-size: 9px; 
  font-weight: 700;
  line-height: 2; 
  color: rgba(255, 120, 160, 0.35); 
  white-space: pre; 
  text-align: center;
  animation-name: rainScroll; 
  animation-timing-function: linear; 
  animation-iteration-count: infinite;
}
@keyframes rainScroll { from { transform: translateY(0); } to { transform: translateY(-50%); } }

.cel-center { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; padding: 26px 20px; }
.cel-center::before {
  content: ''; 
  position: absolute; 
  inset: -40px -30px; 
  z-index: -1; 
  border-radius: 0px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.7) 60%, transparent 100%);
}
.cel-heart {
  font-size: 52px; 
  color: #fff; 
  line-height: 1;
  text-shadow: 0 0 10px #fff, 0 0 25px #ff5fa2, 0 0 50px #ff2f8f;
  margin-bottom: 14px;
}
.cel-neon {
  font-family: 'Press Start 2P', monospace; 
  font-size: 18px; 
  letter-spacing: 2px; 
  color: #ff8fab;
  text-shadow: 0 0 8px #ff2f8f, 0 0 20px #ff2f8f, 0 0 40px #ff2f8f;
  margin-bottom: 22px;
}
.cel-msg {
  font-family: 'Outfit', sans-serif; 
  font-weight: 400;
  font-size: 15px; 
  color: #fdeef4; 
  max-width: 270px;
  line-height: 1.5; 
  margin-bottom: 28px;
}

.modern-btn {
  background: #000;
  color: #fff;
  border: 2px solid #fff;
  padding: 10px 20px;
  border-radius: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(255,255,255,0.2);
  transition: transform 0.1s ease, background 0.1s, color 0.1s;
}
.modern-btn:hover, .modern-btn:active { background: #fff; color: #000; transform: scale(0.95); }

/* Razones */
#reasons { text-align: center; }
.r-title { font-family: 'Fraunces', serif; font-weight: 600; font-size: 22px; margin-bottom: 26px; }

.card-stack { position: relative; width: 100%; max-width: 300px; height: 320px; }

.letter-card {
  position: absolute; 
  inset: 0; 
  border-radius: 20px;
  background: linear-gradient(170deg, var(--cream), #efe6d3);
  color: #241a12; 
  padding: 28px 24px; 
  display: flex; 
  flex-direction: column;
  align-items: center; 
  justify-content: center; 
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .5s ease, opacity .5s ease;
}
.letter-card .stamp { font-size: 26px; margin-bottom: 14px; }
.letter-card .txt { font-family: 'Caveat', cursive; font-size: 25px; line-height: 1.35; }
.letter-card .num { font-size: 12px; letter-spacing: 2px; color: #8a7350; margin-bottom: 10px; text-transform: uppercase; }

#cardTop { z-index: 10; }

.letter-card.behind1 { 
  transform: translateY(10px) scale(.96) rotate(-3deg); 
  z-index: 1; 
  filter: brightness(.92); 
}
.letter-card.behind2 { 
  transform: translateY(18px) scale(.92) rotate(3deg); 
  z-index: 0; 
  filter: brightness(.84); 
}
.letter-card.gone { 
  transform: translateY(-40px) scale(.9) rotate(-8deg); 
  opacity: 0; 
  pointer-events: none; 
}

.next-btn {
  margin-top: 22px; 
  padding: 14px 28px; 
  border-radius: 14px; 
  border: none;
  background: linear-gradient(135deg, var(--rose), var(--gold)); 
  color: #1a1330;
  font-family: 'Outfit', sans-serif; 
  font-weight: 600; 
  font-size: 15px; 
  cursor: pointer;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--muted);
  margin-top: 12px;
  box-shadow: none;
}

/* Galería */
#gallery { text-align: center; overflow-y: auto; max-height: 100dvh; }
.gallery-inner { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 50px 16px 50px; width: 100%; max-width: 440px; margin: 0 auto; }
.gallery-center-card { background: rgba(28, 33, 69, 0.95); border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; padding: 18px 22px; width: 100%; box-shadow: var(--shadow); z-index: 5; }
.gal-heart { font-size: 30px; margin-bottom: 4px; }
.gal-text { font-family: 'Caveat', cursive; font-size: 24px; color: var(--cream); line-height: 1.2; }
.gallery-photos-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; width: 100%; }
.polaroid { background: #fdfbf7; padding: 8px 8px 24px 8px; border-radius: 4px; box-shadow: 0 10px 25px rgba(0,0,0,0.35); transition: transform 0.3s ease, z-index 0.3s ease; }
.polaroid:nth-child(1) { transform: rotate(-5deg) translateY(0px); }
.polaroid:nth-child(2) { transform: rotate(6deg) translateY(12px); }
.polaroid:nth-child(3) { transform: rotate(-7deg) translateY(-6px); }
.polaroid:nth-child(4) { transform: rotate(4deg) translateY(16px); }
.polaroid:nth-child(5) { transform: rotate(-4deg) translateY(-8px); }
.polaroid:nth-child(6) { transform: rotate(8deg) translateY(6px); }
.polaroid:nth-child(7) { transform: rotate(-2deg) translateY(10px); grid-column: span 2; max-width: 55%; margin: 0 auto; }
.polaroid:hover { transform: scale(1.06) rotate(0deg) !important; z-index: 10; }
.polaroid img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 2px; display: block; }

/* Música */
#music { text-align: center; overflow-y: auto; max-height: 100dvh; }
.music-inner { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 50px 16px 50px; width: 100%; max-width: 440px; margin: 0 auto; }

.music-header { text-align: center; width: 100%; }
.music-eyebrow { font-size: 12px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.music-title { font-family: 'Fraunces', serif; font-weight: 600; font-size: 24px; color: var(--cream); margin-top: 4px; }

.vinyl-player-card {
  background: rgba(28, 33, 69, 0.95);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.vinyl-container {
  position: relative;
  width: 160px;
  height: 160px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vinyl-disc {
  width: 160px;
  height: 160px;
  background: #111;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5), inset 0 0 0 3px rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vinyl-disc.spin { animation: spinVinyl 3s linear infinite; }
@keyframes spinVinyl { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.vinyl-grooves {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 0 0 10px rgba(255,255,255,0.03), inset 0 0 0 20px rgba(255,255,255,0.05), inset 0 0 0 30px rgba(255,255,255,0.03);
}

.vinyl-label {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1330;
  font-size: 20px;
  box-shadow: 0 0 0 4px #111;
  z-index: 2;
}

.vinyl-arm {
  position: absolute;
  top: -10px;
  right: -5px;
  width: 60px;
  height: 80px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23aaa'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z'/%3E%3C/svg%3E") no-repeat center;
  transform-origin: top right;
  transform: rotate(-25deg);
  transition: transform 0.4s ease;
  pointer-events: none;
}
.vinyl-arm.play { transform: rotate(5deg); }

.player-info { text-align: center; margin-bottom: 14px; }
.player-song-title { font-family: 'Fraunces', serif; font-size: 18px; color: var(--cream); font-weight: 600; }
.player-song-artist { font-size: 13px; color: var(--muted); margin-top: 2px; }

.player-toggle-btn {
  background: linear-gradient(135deg, var(--rose), var(--gold));
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  color: #1a1330;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.player-toggle-btn:active { transform: scale(0.95); }

.playlist { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.song-item {
  background: rgba(28, 33, 69, 0.6);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px;
  overflow: hidden;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}
.song-item:hover { background: rgba(35, 42, 85, 0.9); }
.song-item.active { border-color: var(--rose); background: rgba(255, 143, 171, 0.1); }
.song-row { padding: 12px 14px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.song-number { font-size: 13px; font-weight: 600; color: var(--muted); width: 20px; text-align: center; }
.song-meta { flex: 1; display: flex; flex-direction: column; }
.s-name { font-size: 14px; font-weight: 500; color: var(--cream); }
.s-band { font-size: 12px; color: var(--muted); }

/* Estilo para el botón de Spotify */
.spotify-btn {
  background: rgba(30, 215, 96, 0.15);
  border: 1px solid rgba(30, 215, 96, 0.4);
  color: #1ed760;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}
.spotify-btn:hover { background: rgba(30, 215, 96, 0.3); transform: scale(1.05); }
.spotify-btn:active { transform: scale(0.95); }

.lyrics-dropdown { padding: 0 14px 14px 14px; border-top: 1px solid rgba(255,255,255,0.05); }
.lyrics-dropdown summary { font-size: 12px; color: var(--rose); cursor: pointer; padding-top: 10px; font-weight: 500; }
.lyrics-dropdown summary:hover { color: var(--gold); }
.lyrics-text {
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: var(--cream);
  line-height: 1.45;
  margin: 10px 0 0 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  max-height: 150px;
  overflow-y: auto;
  white-space: pre-line;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: rgba(255, 143, 171, 0.3); border-radius: 10px; }