/* ============================================================
   EL COFRE DE LA MAGIA — styles.css
   Portal romántico para Britney · Sección 4 meses
   Paleta: verde suave · crema · dorado · rosa pastel
============================================================ */

/* ══════════════════════════════════════════════════════════
   VARIABLES
══════════════════════════════════════════════════════════ */
:root {
  /* Verde principal */
  --tf:     #5DC4A8;
  --tf-l:   #9DDECA;
  --tf-d:   #3A9A80;
  --tf-p:   #E0F5EF;
  --tf-2:   #C8EDE4;

  /* Cálido terracota */
  --tc:     #C4754A;
  --tc-l:   #E8A07A;
  --tc-p:   #FAE8DC;
  --tc-d:   #9A4F2A;

  /* Dorado suave */
  --gd:     #D4AF6A;
  --gd-l:   #EDD89A;
  --gd-p:   #FBF3DF;
  --gd-d:   #B8903C;

  /* Rosa pastel */
  --pk:     #E8909A;
  --pk-l:   #F4C0C8;
  --pk-p:   #FDF0F2;

  /* Texto */
  --tx:     #3A2520;
  --tx-m:   #7A5048;
  --tx-l:   #AA8070;
  --tx-s:   #C8A898;

  /* Fondos */
  --wh:     #FFFDF9;
  --cr:     #FDF6EE;
  --cr-d:   #F7EBE0;

  /* Sombras */
  --sd:     0 4px 20px rgba(60,30,20,.09), 0 1px 4px rgba(60,30,20,.06);
  --sd2:    0 8px 32px rgba(60,30,20,.13), 0 2px 8px rgba(60,30,20,.07);
  --sd3:    0 16px 48px rgba(60,30,20,.17), 0 4px 12px rgba(60,30,20,.08);
  --sd-gn:  0 4px 20px rgba(93,196,168,.22);
  --sd-gd:  0 4px 20px rgba(212,175,106,.3);

  /* Radios */
  --r:      14px;
  --r-l:    22px;
  --r-xl:   28px;

  /* Tipografía */
  --serif:  'Cormorant Garamond', Georgia, serif;
  --sans:   'Nunito', 'Helvetica Neue', sans-serif;

  /* Curvas de animación */
  --ease:   cubic-bezier(.4, 0, .2, 1);
  --spring: cubic-bezier(.34, 1.35, .64, 1);
  --snap:   cubic-bezier(.175, .885, .32, 1.275);
}

/* ══════════════════════════════════════════════════════════
   RESET Y BASE
══════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  color: var(--tx);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100svh;
  /* Fondo con tres luces suaves superpuestas */
  background:
    radial-gradient(ellipse 60% 40% at 12% 18%,  rgba(93,196,168,.07) 0%, transparent 100%),
    radial-gradient(ellipse 55% 35% at 88% 82%,  rgba(232,144,154,.06) 0%, transparent 100%),
    radial-gradient(ellipse 70% 50% at 50% 100%,  rgba(212,175,106,.05) 0%, transparent 100%),
    var(--cr);
}

/* ══════════════════════════════════════════════════════════
   PARTÍCULAS AMBIENTALES
══════════════════════════════════════════════════════════ */
.particles-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Keyframe usado por JS para las partículas flotantes */
@keyframes petal-float {
  0%   { transform: translateY(0)     rotate(0deg)   scale(.7);  opacity: 0; }
  12%  { opacity: .55; }
  85%  { opacity: .22; }
  100% { transform: translateY(-80px) rotate(25deg)  scale(.95); opacity: 0; }
}

/* ══════════════════════════════════════════════════════════
   BOTÓN DE MÚSICA — esquina superior derecha
══════════════════════════════════════════════════════════ */
.btn-music {
  position: fixed;
  top: 13px;
  right: 14px;
  z-index: 9999;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,253,249,.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(93,196,168,.25);
  box-shadow: 0 2px 10px rgba(60,30,20,.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: opacity .2s, box-shadow .2s, transform .18s;
  -webkit-appearance: none;
}
.btn-music:hover  {
  opacity: .82;
  box-shadow: 0 3px 14px rgba(60,30,20,.13);
  transform: scale(1.07);
}
.btn-music:active { transform: scale(.92); }

.music-icon {
  font-size: 16px;
  line-height: 1;
  display: block;
  transition: transform .3s cubic-bezier(.34,1.35,.64,1);
  will-change: transform;
}

/* Estado: pausado — icono ligeramente desvanecido */
.btn-music.is-paused .music-icon {
  opacity: .45;
  transform: scale(.88);
}

/* Animación de pulso suave cuando reproduce */
@keyframes music-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); }
}
.btn-music:not(.is-paused) .music-icon {
  animation: music-pulse 2.4s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════
   BOTÓN DE REGRESO AL MENÚ
══════════════════════════════════════════════════════════ */
.btn-back {
  position: fixed;
  top: 13px;
  left: 14px;
  z-index: 9999;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  color: rgba(90,60,40,.6);
  text-decoration: none;
  background: rgba(255,253,249,.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(93,196,168,.25);
  border-radius: 20px;
  padding: 6px 14px;
  letter-spacing: .5px;
  transition: opacity .2s, box-shadow .2s;
  box-shadow: 0 2px 10px rgba(60,30,20,.08);
}
.btn-back:hover  { opacity: .72; box-shadow: 0 3px 14px rgba(60,30,20,.12); }
.btn-back:active { opacity: .55; }

/* ══════════════════════════════════════════════════════════
   PANTALLAS — sistema de transición
══════════════════════════════════════════════════════════ */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  min-height: 100svh;
  padding: 64px 20px 88px;
  position: relative;
  z-index: 1;
}

.screen.active {
  display: flex;
  animation: screen-enter .42s var(--ease) both;
}

@keyframes screen-enter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   ELEMENTOS TIPOGRÁFICOS COMPARTIDOS
══════════════════════════════════════════════════════════ */
.eyebrow-tag {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--tc);
  margin-bottom: 14px;
}

/* ══════════════════════════════════════════════════════════
   FLORES DECORATIVAS
══════════════════════════════════════════════════════════ */
.deco-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  position: absolute;
  left: 0;
  right: 0;
  padding: 0 16px;
}
.deco-row--top    { top: 14px; }
.deco-row--bottom { bottom: 14px; }

.deco-flower {
  font-size: 19px;
  display: inline-block;
  animation: deco-sway 3.8s ease-in-out infinite;
  will-change: transform;
}
.deco-flower:nth-child(1) { animation-delay:   0s; }
.deco-flower:nth-child(2) { animation-delay:  .5s; font-size: 15px; }
.deco-flower:nth-child(3) { animation-delay:  .9s; }
.deco-flower:nth-child(4) { animation-delay: 1.4s; font-size: 15px; }
.deco-flower:nth-child(5) { animation-delay: 1.8s; }
.deco-flower:nth-child(6) { animation-delay: 2.3s; font-size: 15px; }

@keyframes deco-sway {
  0%, 100% { transform: translateY(0)    rotate(-4deg); }
  50%       { transform: translateY(-6px) rotate(4deg); }
}

/* ══════════════════════════════════════════════════════════
   SCREEN 1 — INTRO / BIENVENIDA
══════════════════════════════════════════════════════════ */
#screen-intro {
  /* Suave spotlight centrado */
  background:
    radial-gradient(ellipse 65% 55% at 50% 42%,
      rgba(224,245,239,.45) 0%,
      transparent 100%);
  justify-content: center;
}

.intro-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

/* Ícono de llave estático */
.cofre-icon-static {
  font-size: 54px;
  margin-bottom: 22px;
  filter:
    drop-shadow(0 5px 14px rgba(212,175,106,.38))
    drop-shadow(0 2px 5px rgba(212,175,106,.22));
  animation: key-pulse 3s ease-in-out infinite;
  will-change: transform, filter;
}

@keyframes key-pulse {
  0%, 100% { transform: scale(1)    rotate(-3deg); }
  50%       { transform: scale(1.06) rotate(3deg);
              filter:
                drop-shadow(0 8px 20px rgba(212,175,106,.5))
                drop-shadow(0 2px 6px rgba(212,175,106,.3)); }
}

/* Título principal */
.intro-title {
  font-family: var(--serif);
  font-size: clamp(38px, 11vw, 54px);
  font-weight: 600;
  line-height: 1.05;
  color: var(--tx);
  margin-bottom: 6px;
  letter-spacing: -.5px;
}
.intro-title em {
  color: var(--tf-d);
  font-style: italic;
  font-weight: 500;
}

/* Divisor decorativo */
.intro-divider {
  width: 52px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gd), transparent);
  margin: 14px auto 20px;
  border: none;
  opacity: .8;
}

/* Textos poéticos */
.intro-text {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.8;
  color: var(--tx-m);
  margin-bottom: 12px;
}
.intro-text--secondary {
  font-size: 15px;
  color: var(--tx-l);
  margin-bottom: 26px;
  line-height: 1.7;
}

/* Insignia de progreso en la pantalla inicial */
.progress-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(212,175,106,.28);
  border-radius: 16px;
  padding: 12px 28px;
  margin-bottom: 26px;
  box-shadow: 0 2px 12px rgba(212,175,106,.12);
  backdrop-filter: blur(4px);
}
.progress-badge__label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--tx-s);
}
.progress-badge__count {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--tf-d);
  letter-spacing: 1px;
  line-height: 1;
}

/* ══════════════════════════════════════════════════════════
   SCREEN 2 — MISIÓN / GRID DE FRAGMENTOS
══════════════════════════════════════════════════════════ */
#screen-mission {
  padding-top: 54px;
  padding-bottom: 60px;
}

/* Header de la misión */
.mission-header {
  width: 100%;
  max-width: 460px;
  text-align: center;
  margin-bottom: 22px;
  padding-top: 8px;
}
.mission-eyebrow {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--tc);
  margin-bottom: 16px;
}

/* Barra de progreso */
.progress-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}

.progress-track {
  width: 100%;
  max-width: 300px;
  height: 7px;
  background: rgba(93,196,168,.12);
  border-radius: 8px;
  overflow: visible;
  border: 1px solid rgba(93,196,168,.2);
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to right, var(--tf-l), var(--tf), var(--gd));
  border-radius: 8px;
  transition: width .55s var(--ease);
  position: relative;
  /* Brillo deslizante en la barra */
  overflow: hidden;
}
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 55%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,.5), transparent);
  animation: bar-shine 2.4s ease-in-out infinite;
}

@keyframes bar-shine {
  0%   { left: -60%; }
  100% { left: 120%; }
}

.progress-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  color: var(--tx-l);
  letter-spacing: .5px;
}

/* ── GRID DE FRAGMENTOS ──────────────────────────────────── */
.fragments-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 432px;
  padding: 2px;
}

/* Celda individual */
.fragment-cell {
  aspect-ratio: 1;
  border-radius: var(--r);
  background:
    linear-gradient(148deg, rgba(255,255,255,.97) 0%, rgba(253,246,238,.9) 100%);
  border: 1.5px solid rgba(212,175,106,.2);
  box-shadow: var(--sd), inset 0 1px 0 rgba(255,255,255,.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition:
    transform .18s var(--ease),
    box-shadow .18s var(--ease),
    background .22s var(--ease),
    border-color .22s var(--ease);
  user-select: none;
  -webkit-user-select: none;
  padding: 0;
  font-family: inherit;
}

.fragment-cell:hover:not(.is-done):not(:disabled) {
  background:
    linear-gradient(148deg, rgba(255,255,255,1) 0%, rgba(253,250,244,.97) 100%);
  border-color: rgba(212,175,106,.38);
  box-shadow: 0 6px 22px rgba(60,30,20,.13), inset 0 1px 0 rgba(255,255,255,.9);
  transform: translateY(-2px) scale(1.02);
}

.fragment-cell:active {
  transform: scale(.93);
  box-shadow: 0 2px 8px rgba(60,30,20,.08);
  transition-duration: .08s;
}

/* Número del fragmento */
.fragment-cell__number {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 800;
  color: var(--tx-s);
  letter-spacing: 1.5px;
  line-height: 1;
}

/* Ícono del fragmento */
.fragment-cell__icon {
  font-size: 21px;
  line-height: 1;
  transition: transform .2s var(--spring);
}

.fragment-cell:hover .fragment-cell__icon {
  transform: scale(1.1);
}

/* Estado: completado */
.fragment-cell.is-done {
  background:
    linear-gradient(148deg, rgba(208,242,234,.95) 0%, rgba(192,232,222,.9) 100%);
  border-color: rgba(93,196,168,.42);
  box-shadow:
    0 3px 14px rgba(93,196,168,.18),
    inset 0 1px 0 rgba(255,255,255,.7),
    inset 0 0 0 1px rgba(93,196,168,.1);
  cursor: default;
}

.fragment-cell.is-done .fragment-cell__number {
  color: var(--tf-d);
  opacity: .7;
}

.fragment-cell.is-done .fragment-cell__icon {
  filter: drop-shadow(0 2px 5px rgba(93,196,168,.35));
}

/* Mensaje de estado de la misión */
.mission-msg {
  width: 100%;
  max-width: 360px;
  margin-top: 18px;
  padding: 13px 20px;
  border-radius: 14px;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
  background: var(--gd-p);
  border: 1px solid rgba(212,175,106,.3);
  color: var(--tx-m);
  box-shadow: 0 2px 10px rgba(212,175,106,.12);
  animation: fade-up .3s var(--ease) both;
}
.mission-msg.hidden { display: none; }

/* Botón discreto de reinicio */
.btn-reset {
  margin-top: 32px;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--tx-s);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  padding: 7px 14px;
  border-radius: 10px;
  transition: color .22s, background .22s;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  text-decoration-color: rgba(170,128,112,.3);
}
.btn-reset:hover {
  color: var(--tc-l);
  background: rgba(196,117,74,.06);
  text-decoration-color: rgba(196,117,74,.35);
}

/* ══════════════════════════════════════════════════════════
   OVERLAY — PANEL DE FRAGMENTO ACTIVO
══════════════════════════════════════════════════════════ */
.fragment-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}
.fragment-overlay.hidden { display: none; }

/* Telón oscuro */
.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35,17,10,.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: backdrop-in .22s var(--ease) both;
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Panel de fragmento */
.fragment-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 352px;
  background:
    linear-gradient(160deg, var(--wh) 0%, rgba(253,246,238,.98) 100%);
  border-radius: var(--r-xl);
  padding: 26px 22px 22px;
  box-shadow: var(--sd3), 0 0 0 1px rgba(255,255,255,.8) inset;
  border: 1px solid rgba(212,175,106,.22);
  animation: panel-spring .28s var(--spring) both;
  overflow: hidden;
}

/* Línea decorativa superior del panel */
.fragment-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--tf-l), var(--gd), var(--pk-l), var(--tf-l));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}

@keyframes panel-spring {
  from { transform: scale(.84) translateY(24px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

/* Cabecera del fragmento */
.fragment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-top: 4px;
}

.frag-number {
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: var(--tx-s);
}

.frag-icon {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(93,196,168,.3));
}

/* Título y pregunta */
.frag-title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  color: var(--tx);
  line-height: 1.2;
  margin-bottom: 9px;
  letter-spacing: -.2px;
}

.frag-question {
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--tx-m);
  line-height: 1.6;
  margin-bottom: 18px;
  font-weight: 400;
}

/* Zona de respuesta */
.frag-answer-zone {
  margin-bottom: 14px;
}

/* ── OPCIONES MÚLTIPLE ───────────────────────────────────── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.option-btn {
  background: rgba(255,255,255,.92);
  border: 1.5px solid rgba(212,175,106,.25);
  border-radius: 13px;
  padding: 11px 8px;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tx);
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color .15s,
    background .15s,
    transform .1s,
    box-shadow .15s;
  box-shadow: 0 2px 8px rgba(60,30,20,.06);
}

.option-btn:hover:not(:disabled) {
  background: rgba(253,246,238,.97);
  border-color: rgba(93,196,168,.4);
  box-shadow: 0 3px 12px rgba(93,196,168,.15);
}

.option-btn:active:not(:disabled) {
  transform: scale(.95);
  transition-duration: .08s;
}

.option-btn.selected {
  background: var(--tf-p);
  border-color: var(--tf);
  color: var(--tf-d);
  box-shadow: 0 3px 12px rgba(93,196,168,.22);
}

.option-btn.correct {
  background: linear-gradient(135deg, rgba(208,242,234,.92), rgba(192,232,222,.85));
  border-color: var(--tf-d);
  color: var(--tf-d);
  box-shadow: 0 3px 12px rgba(93,196,168,.2);
  cursor: default;
}

.option-btn.wrong {
  background: linear-gradient(135deg, rgba(250,232,220,.92), rgba(245,220,205,.85));
  border-color: rgba(196,117,74,.5);
  color: var(--tc-d);
  box-shadow: none;
  animation: shake .35s var(--ease);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  40%       { transform: translateX(4px); }
  60%       { transform: translateX(-3px); }
  80%       { transform: translateX(2px); }
}

.option-btn:disabled { cursor: default; }

/* ── INPUT DE TEXTO ──────────────────────────────────────── */
.frag-text-input {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255,255,255,.92);
  border: 1.5px solid rgba(212,175,106,.3);
  border-radius: 13px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--tx);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(60,30,20,.05);
  -webkit-appearance: none;
}

.frag-text-input::placeholder { color: var(--tx-s); }

.frag-text-input:focus {
  border-color: var(--tf);
  box-shadow: 0 0 0 3px rgba(93,196,168,.16), 0 2px 8px rgba(60,30,20,.05);
}

.frag-text-input:disabled {
  background: rgba(208,242,234,.4);
  color: var(--tf-d);
  border-color: rgba(93,196,168,.3);
  cursor: default;
}

/* ── FEEDBACK INLINE ─────────────────────────────────────── */
.frag-feedback {
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  margin-bottom: 10px;
  animation: fade-up .25s var(--ease) both;
}
.frag-feedback.hidden { display: none !important; }

.frag-feedback.correct {
  background: linear-gradient(135deg, rgba(208,242,234,.9), rgba(192,232,222,.8));
  color: var(--tf-d);
  border: 1px solid rgba(93,196,168,.28);
}

.frag-feedback.wrong {
  background: linear-gradient(135deg, rgba(250,232,220,.9), rgba(248,222,208,.8));
  color: var(--tc-d);
  border: 1px solid rgba(196,117,74,.25);
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Acciones del fragmento */
.frag-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ══════════════════════════════════════════════════════════
   SCREEN 3 — DESBLOQUEO / FRASE SECRETA
══════════════════════════════════════════════════════════ */
#screen-unlock {
  background:
    radial-gradient(ellipse 60% 45% at 50% 50%,
      rgba(251,243,223,.6) 0%, transparent 100%),
    radial-gradient(ellipse 40% 30% at 50% 50%,
      rgba(212,175,106,.1) 0%, transparent 100%);
  justify-content: center;
}

.unlock-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

/* ── CSS DEL COFRE ───────────────────────────────────────── */
.cofre-wrapper {
  position: relative;
  width: 130px;
  height: 112px;
  margin: 16px auto 30px;
  perspective: 600px;
}

.cofre-body {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Tapa del cofre */
.cofre-lid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(160deg, var(--gd-l) 0%, var(--gd) 60%, var(--gd-d) 100%);
  border-radius: 14px 14px 0 0;
  border: 2px solid rgba(184,144,60,.6);
  border-bottom: none;
  transform-origin: center bottom;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.4,0,.2,1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,.5),
    inset 0 -2px 4px rgba(0,0,0,.1),
    0 -3px 12px rgba(212,175,106,.3);
}

/* Detalle metálico de la tapa */
.cofre-lid::before {
  content: '';
  position: absolute;
  inset: 5px 8px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 9px 9px 0 0;
  pointer-events: none;
}

/* Broche de la tapa */
.cofre-lid__clasp {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--tc-l), var(--tc-d));
  border: 1.5px solid rgba(154,79,42,.7);
  box-shadow: 0 2px 5px rgba(0,0,0,.2), inset 0 1px 2px rgba(255,255,255,.4);
}

/* Tapa abierta */
.cofre-lid.open {
  transform: rotateX(-145deg);
}

/* Base del cofre */
.cofre-base {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: linear-gradient(160deg, var(--gd) 0%, var(--gd-d) 60%, #9A7030 100%);
  border-radius: 3px 3px 12px 12px;
  border: 2px solid rgba(184,144,60,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,.2),
    inset 0 -3px 6px rgba(0,0,0,.15),
    0 4px 16px rgba(184,144,60,.35);
}

/* Detalle de tablón de madera */
.cofre-base::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 18px,
    rgba(0,0,0,.06) 18px,
    rgba(0,0,0,.06) 20px
  );
  pointer-events: none;
}

/* Candado */
.cofre-base__lock {
  font-size: 24px;
  position: relative;
  z-index: 1;
  transition: transform .4s var(--spring), opacity .3s;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}

/* Franja inferior */
.cofre-base__stripe {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: rgba(0,0,0,.12);
}

/* Resplandor del cofre */
.cofre-glow {
  position: absolute;
  inset: -28px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,175,106,.45) 0%, rgba(237,216,154,.25) 40%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s;
}

.cofre-glow.active {
  opacity: 1;
  animation: glow-pulse 1.8s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { transform: scale(1);    opacity: .6; }
  50%       { transform: scale(1.18); opacity: 1; }
}

/* Textos de la pantalla de desbloqueo */
.unlock-title {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 8px;
  letter-spacing: -.3px;
}

.unlock-hint {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--tx-l);
  margin-bottom: 26px;
  line-height: 1.5;
}

/* Wrapper del input de frase */
.unlock-input-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  width: 100%;
}

/* Input de frase secreta */
.phrase-input {
  width: 100%;
  max-width: 310px;
  padding: 15px 20px;
  background: rgba(255,255,255,.94);
  border: 2px solid rgba(212,175,106,.38);
  border-radius: 16px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--tx);
  text-align: center;
  outline: none;
  letter-spacing: .3px;
  box-shadow: 0 3px 14px rgba(212,175,106,.1), inset 0 1px 0 rgba(255,255,255,.8);
  transition: border-color .22s, box-shadow .22s;
  -webkit-appearance: none;
}

.phrase-input::placeholder {
  color: var(--tx-s);
  font-weight: 400;
}

.phrase-input:focus {
  border-color: var(--gd);
  box-shadow: 0 0 0 3px rgba(212,175,106,.18), 0 3px 14px rgba(212,175,106,.12);
}

/* ══════════════════════════════════════════════════════════
   SCREEN 4 — CARTA ANIMADA
══════════════════════════════════════════════════════════ */
#screen-letter {
  justify-content: flex-start;
  padding-top: 70px;
}

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

/* Sello previo */
.letter-seal-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 20px;
  animation: fade-up .5s var(--ease) both;
}

.letter-seal {
  font-size: 68px;
  line-height: 1;
  animation: seal-float 2.8s ease-in-out infinite;
  filter: drop-shadow(0 8px 20px rgba(93,196,168,.4));
}

@keyframes seal-float {
  0%, 100% { transform: translateY(0)    scale(1);    }
  50%       { transform: translateY(-12px) scale(1.05); }
}

.letter-seal__text {
  font-family: var(--serif);
  font-size: 19px;
  font-style: italic;
  color: var(--tx-m);
  text-align: center;
  line-height: 1.5;
}

/* Carta desplegada */
.letter-card {
  width: 100%;
  background:
    /* Líneas tenues de renglón */
    repeating-linear-gradient(
      0deg,
      transparent    0px,
      transparent    28px,
      rgba(212,175,106,.055) 29px
    ),
    /* Base cálida */
    linear-gradient(165deg, #FFFDF9 0%, #FDF8F0 50%, #FBF4E8 100%);
  border: 1px solid rgba(212,175,106,.28);
  border-radius: 20px;
  padding: 34px 28px 28px;
  box-shadow:
    var(--sd3),
    0  0  0 1px rgba(255,255,255,.7) inset,
    0  1px 0 rgba(255,255,255,.9)   inset;
  animation: letter-unfold .65s var(--spring) both;
}
.letter-card.hidden { display: none; }

@keyframes letter-unfold {
  from { transform: scale(.88) translateY(36px) rotateX(4deg); opacity: 0; }
  to   { transform: scale(1)   translateY(0)    rotateX(0deg); opacity: 1; }
}

/* Cabecera de la carta */
.letter-card__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(212,175,106,.22);
  position: relative;
}

/* Línea decorativa dorada bajo el header */
.letter-card__header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gd), transparent);
  opacity: .6;
}

.letter-card__deco {
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--tc-l);
  opacity: .75;
}

.letter-card__title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--tx);
  text-align: center;
  line-height: 1.2;
  letter-spacing: -.2px;
}

/* Cuerpo de la carta */
.letter-card__body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.9;
  color: var(--tx-m);
  margin-bottom: 24px;
  text-align: center;
}

.letter-card__body p {
  margin-bottom: 16px;
}
.letter-card__body p:last-child {
  margin-bottom: 0;
}

/* Pie de la carta */
.letter-card__footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(212,175,106,.18);
  margin-bottom: 22px;
}

.letter-signature {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--tx-l);
  letter-spacing: .3px;
}

.letter-flowers {
  font-size: 15px;
  letter-spacing: 5px;
  opacity: .8;
}

/* Zona del botón de cofre del futuro */
.letter-card__extra {
  display: flex;
  justify-content: center;
}

/* ══════════════════════════════════════════════════════════
   SCREEN 5 — COFRE DEL FUTURO
══════════════════════════════════════════════════════════ */
#screen-future {
  background:
    radial-gradient(ellipse 55% 40% at 50% 50%,
      rgba(237,216,154,.2) 0%, transparent 100%),
    radial-gradient(ellipse 40% 30% at 30% 20%,
      rgba(208,242,234,.2) 0%, transparent 100%);
  justify-content: center;
}

.future-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.future-icon {
  font-size: 58px;
  margin-bottom: 20px;
  animation: seal-float 3s ease-in-out infinite;
  filter: drop-shadow(0 6px 16px rgba(212,175,106,.4));
}

.future-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 22px;
  letter-spacing: -.3px;
}

.future-body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.9;
  color: var(--tx-m);
  margin-bottom: 30px;
  text-align: center;
}

.future-body p {
  margin-bottom: 14px;
}
.future-body p:last-child {
  margin-bottom: 0;
}

/* ══════════════════════════════════════════════════════════
   BOTONES GLOBALES
══════════════════════════════════════════════════════════ */

/* Botón primario verde */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--tf-l) 0%, var(--tf) 55%, var(--tf-d) 100%);
  color: #fff;
  border: none;
  border-radius: 22px;
  padding: 14px 30px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: .4px;
  white-space: nowrap;
  width: 100%;
  max-width: 280px;
  box-shadow:
    0 4px 18px rgba(93,196,168,.4),
    0 1px 4px rgba(93,196,168,.25),
    inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), opacity .16s;
  position: relative;
  overflow: hidden;
  -webkit-appearance: none;
}

/* Brillo al hover */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 60%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,.22), transparent);
  transition: left .35s var(--ease);
}
.btn-primary:hover::after  { left: 120%; }

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 24px rgba(93,196,168,.45), 0 2px 6px rgba(93,196,168,.3);
}
.btn-primary:active {
  transform: scale(.96) translateY(0);
  box-shadow: 0 2px 8px rgba(93,196,168,.25);
  transition-duration: .08s;
}

/* Variantes del botón primario */
.btn-primary--large { padding: 16px 36px; font-size: 16px; max-width: 300px; }

.btn-primary--gold {
  background: linear-gradient(135deg, var(--gd-l) 0%, var(--gd) 55%, var(--gd-d) 100%);
  box-shadow: 0 4px 18px rgba(212,175,106,.45), inset 0 1px 0 rgba(255,255,255,.3);
  color: var(--tx);
}
.btn-primary--gold:hover {
  box-shadow: 0 7px 24px rgba(212,175,106,.5), 0 2px 6px rgba(212,175,106,.3);
}

.btn-primary--soft {
  background: linear-gradient(135deg, rgba(157,222,202,.9), var(--tf));
  box-shadow: 0 4px 16px rgba(93,196,168,.32), inset 0 1px 0 rgba(255,255,255,.25);
}

/* Botón ghost */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1.5px solid rgba(93,196,168,.32);
  border-radius: 22px;
  padding: 12px 24px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--tx-m);
  cursor: pointer;
  width: 100%;
  max-width: 280px;
  letter-spacing: .3px;
  transition: background .18s, border-color .18s, color .18s, transform .12s;
  -webkit-appearance: none;
}

.btn-ghost:hover {
  background: rgba(93,196,168,.07);
  border-color: var(--tf);
  color: var(--tf-d);
  transform: translateY(-1px);
}
.btn-ghost:active {
  transform: scale(.97);
  transition-duration: .07s;
}

.btn-ghost--close {
  border-color: rgba(170,128,112,.25);
  color: var(--tx-l);
  font-size: 13px;
  padding: 10px 22px;
}
.btn-ghost--close:hover {
  background: rgba(196,117,74,.06);
  border-color: rgba(196,117,74,.35);
  color: var(--tc);
}

.btn-ghost--centered {
  display: flex;
  margin: 0 auto;
}

/* ══════════════════════════════════════════════════════════
   UTILIDADES
══════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════
   ANIMACIONES EXTRA
══════════════════════════════════════════════════════════ */

/* Pop de aparición para elementos de UI */
@keyframes pop-in {
  from { transform: scale(.8);  opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Parpadeo suave para destacar algo completado */
@keyframes blink-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(93,196,168,0); }
  50%       { box-shadow: 0 0 20px rgba(93,196,168,.5); }
}

/* Confeti burst — se activa por JS al completar los 24 */
@keyframes confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(100vh) rotate(540deg); opacity: 0; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  .fragments-grid  { gap: 8px; max-width: 100%; }
  .fragment-cell__icon { font-size: 18px; }
  .fragment-panel  { padding: 22px 17px 19px; border-radius: 22px; }
  .letter-card     { padding: 26px 18px 22px; }
  .intro-title     { font-size: 34px; }
  .unlock-title    { font-size: 24px; }
  .btn-primary     { font-size: 14px; padding: 13px 22px; }
  .cofre-wrapper   { width: 110px; height: 96px; }
}

@media (max-width: 360px) {
  .fragments-grid  { grid-template-columns: repeat(4, 1fr); gap: 7px; }
  .deco-flower     { font-size: 16px; }
  .intro-title     { font-size: 30px; }
}

/* Preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ══════════════════════════════════════════════════════════
   RESUMEN DE DESBLOQUEO
══════════════════════════════════════════════════════════ */
.unlock-summary {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.85;
  color: var(--tx-m);
  text-align: center;
  max-width: 340px;
  margin-bottom: 22px;
}
.unlock-summary p {
  margin-bottom: 10px;
}
.unlock-summary p:last-child {
  margin-bottom: 0;
  font-weight: 600;
  color: var(--tx);
}

/* ══════════════════════════════════════════════════════════
   VIDEO ESPECIAL — BROCHE DE ORO DE LA CARTA
══════════════════════════════════════════════════════════ */
.letter-video-section {
  margin-top: 28px;
}

.letter-video-divider {
  text-align: center;
  font-size: 13px;
  letter-spacing: 5px;
  color: var(--tc-l);
  opacity: .75;
  margin-bottom: 22px;
}

.letter-video-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.letter-video-teaser {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--tx-l);
  text-align: center;
  line-height: 1.5;
}

/* Variante botón amor/rosa */
.btn-primary--love {
  background: linear-gradient(135deg, #E8909A 0%, #C4754A 100%);
  box-shadow: 0 4px 18px rgba(196,117,74,.38), inset 0 1px 0 rgba(255,255,255,.22);
  color: #fff;
}
.btn-primary--love:hover {
  box-shadow: 0 7px 24px rgba(196,117,74,.48), 0 2px 6px rgba(196,117,74,.28);
}

/* Contenedor del video — revelado con animación */
.letter-video-wrap {
  margin-top: 4px;
  animation: fade-up .45s var(--ease) both;
}

.letter-video-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--tx-s);
  text-align: center;
  margin-bottom: 14px;
}

.video-container {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    var(--sd2),
    0 0 0 1px rgba(212,175,106,.22),
    inset 0 1px 0 rgba(255,255,255,.5);
  background: #000;
}

.special-video {
  width: 100%;
  display: block;
  max-height: 500px;
  object-fit: contain;
  background: #000;
  border-radius: 18px;
}

/* ══════════════════════════════════════════════════════════
   CHIPS DEL COFRE DEL FUTURO
══════════════════════════════════════════════════════════ */
.future-names-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 22px 0 18px;
}

.future-name-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(253,246,238,.88));
  border: 1px solid rgba(212,175,106,.3);
  border-radius: 20px;
  padding: 8px 16px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--tx-m);
  box-shadow: 0 2px 10px rgba(212,175,106,.13);
  animation: chip-appear .4s var(--spring) both;
}

.future-name-chip:nth-child(1) { animation-delay: .05s; }
.future-name-chip:nth-child(2) { animation-delay: .12s; }
.future-name-chip:nth-child(3) { animation-delay: .19s; }
.future-name-chip:nth-child(4) { animation-delay: .26s; }
.future-name-chip:nth-child(5) { animation-delay: .33s; }
.future-name-chip:nth-child(6) { animation-delay: .40s; }

@keyframes chip-appear {
  from { transform: scale(.7) translateY(10px); opacity: 0; }
  to   { transform: scale(1)  translateY(0);    opacity: 1; }
}

.future-video-shortcut {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 22px;
  border-top: 1px solid rgba(212,175,106,.18);
  width: 100%;
}

.future-video-shortcut__label {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--tx-l);
  text-align: center;
}

.future-zoe {
  font-family: var(--serif);
  font-size: 20px;
  font-style: italic;
  color: var(--tf-d);
  letter-spacing: 2px;
  margin-top: 4px;
  animation: chip-appear .4s var(--spring) .5s both;
  filter: drop-shadow(0 2px 8px rgba(93,196,168,.3));
}
