/* ═══════════════════════════════════════════════════
   RESET
═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100dvh; }
body {
  width: 100%;
  min-height: 100dvh;
  background: #1c120b;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════
   STAGE — caja con la proporción EXACTA del póster
   (3714 × 5525) para que nunca se recorte texto
═══════════════════════════════════════════════════ */
#stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 100dvh;
  overflow: hidden;
  background: #1c120b;
  display: flex;
  flex-direction: column;
}

.poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3714 / 5525;
  overflow: hidden;
}

.poster-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transform-origin: center center;
  transform: scale(1.06);
  animation: kenBurns 11s ease-in-out infinite alternate,
             posterEntra 1.1s cubic-bezier(.2,.7,.2,1) both;
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

@keyframes posterEntra {
  0%   { opacity: 0; transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1.06); }
}

@keyframes kenBurns {
  0%   { transform: scale(1.06) translate(0%, 0.2%); }
  50%  { transform: scale(1.11) translate(-1%, -0.6%); }
  100% { transform: scale(1.07) translate(0.8%, 0.3%); }
}

.cargando .poster-bg { animation-play-state: paused; }

/* leve viñeta cálida para integrar el borde del stage con la madera + respiración de luz de lámpara */
.poster-vino {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 12vw 1vw rgba(10,6,3,.55);
  animation: lampara 5s ease-in-out infinite;
}
.cargando .poster-vino { animation-play-state: paused; }
@keyframes lampara {
  0%, 100% { box-shadow: inset 0 0 12vw 1vw rgba(10,6,3,.55); }
  50%      { box-shadow: inset 0 0 9vw 1vw rgba(10,6,3,.4), inset 0 0 18vw 3vw rgba(200,140,60,.08); }
}

/* ═══════════════════════════════════════════════════
   BOTÓN DE MÚSICA — respaldo manual, estilo cuero/madera
═══════════════════════════════════════════════════ */
#btn-musica {
  position: absolute;
  z-index: 70;
  top: 3.5%;
  right: 3.5%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid #e0b26b;
  background: linear-gradient(180deg, #a9773f 0%, #7c4f24 100%);
  box-shadow: 0 2px 0 #3d2410, inset 0 1px 0 rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  opacity: 0;
  animation: barraAparece .8s .7s cubic-bezier(.2,.7,.2,1) both;
}
.cargando #btn-musica { animation-play-state: paused; }
#btn-musica:active { transform: scale(.92); }
#btn-musica svg { width: 18px; height: 18px; fill: #f5e6c8; }
#btn-musica .ico-off { display: none; }
#btn-musica[aria-pressed="true"] .ico-on  { display: none; }
#btn-musica[aria-pressed="true"] .ico-off { display: block; }

/* ═══════════════════════════════════════════════════
   TOAST DE AUDIO — invita a tocar la pantalla, llamativo
   y a tono con el cartel "SE BUSCAN"
═══════════════════════════════════════════════════ */
#toast-audio {
  position: absolute;
  z-index: 80;
  left: 50%;
  bottom: 3%;
  transform: translate(-50%, 14px) scale(.9);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 82%;
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #a9773f 0%, #6b4423 100%);
  border: 2px solid #f0c780;
  box-shadow: 0 6px 0 #2e1a0c, 0 10px 22px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
/* JS decide cuándo mostrarlo: solo si el navegador bloqueó el
   autoplay. Si el audio ya sonó solo, nunca aparece. */
#toast-audio.mostrar {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  animation: toastLatido 1.4s .3s ease-in-out infinite;
}

@keyframes toastLatido {
  0%, 100% { box-shadow: 0 6px 0 #2e1a0c, 0 10px 22px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.2), 0 0 0 0 rgba(240,199,128,.55); }
  50%      { box-shadow: 0 6px 0 #2e1a0c, 0 10px 26px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.2), 0 0 0 8px rgba(240,199,128,0); }
}

.toast-emoji {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
#toast-audio.mostrar .toast-emoji {
  animation: toastCampanea 1.4s .3s ease-in-out infinite;
}
@keyframes toastCampanea {
  0%, 100% { transform: rotate(0deg); }
  10%      { transform: rotate(-14deg); }
  20%      { transform: rotate(11deg); }
  30%      { transform: rotate(-8deg); }
  40%      { transform: rotate(0deg); }
}

.toast-texto {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: .2px;
  color: #f5e6c8;
  text-shadow: 0 1px 1px rgba(0,0,0,.4);
}

/* ═══════════════════════════════════════════════════
   BALAZOS — impactos de bala en el póster (destello +
   orificio con grietas + astillas de papel volando)
   Tematizado al cartel "SE BUSCAN" vaquero.
   Posicionados por app.js sobre los márgenes de madera,
   nunca sobre el texto. Disparan UNA vez al cargar
   (escalonados) y el orificio se queda permanente.
═══════════════════════════════════════════════════ */
#particulas {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.balazo {
  position: absolute;
  width: 1px;
  height: 1px;
}
.cargando .balazo * { animation-play-state: paused; }

/* Destello del disparo */
.flash {
  position: absolute;
  left: 50%; top: 50%;
  width: 60px; height: 60px;
  margin-left: -30px; margin-top: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8e0 0%, #ffd873 32%, rgba(255,170,40,0) 70%);
  mix-blend-mode: screen;
  opacity: 0;
  animation: flashPop .45s var(--delay, 0s) ease-out both;
}
@keyframes flashPop {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(.3); }
  25%  { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.8); }
}

/* Orificio de bala — grietas irradiando + hueco oscuro al centro */
.agujero {
  position: absolute;
  left: 50%; top: 50%;
  width: var(--hsize, 40px);
  height: var(--hsize, 40px);
  border-radius: 50%;
  opacity: 0;
  animation: agujeroPunch .6s var(--delay, 0s) cubic-bezier(.3,1.6,.5,1) both;
}
.agujero::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(15,9,5,.75) 0deg 2.5deg, transparent 2.5deg 27deg);
  -webkit-mask-image: radial-gradient(circle, rgba(0,0,0,1) 16%, rgba(0,0,0,.55) 45%, rgba(0,0,0,0) 78%);
          mask-image: radial-gradient(circle, rgba(0,0,0,1) 16%, rgba(0,0,0,.55) 45%, rgba(0,0,0,0) 78%);
}
.agujero::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 32%; height: 32%;
  transform: translate(-50%,-50%);
  border-radius: 50%;
  background: radial-gradient(circle, #050301 0%, #1c120b 70%, rgba(28,18,11,0) 100%);
  box-shadow: 0 0 0 1.5px rgba(0,0,0,.45);
}
@keyframes agujeroPunch {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(0); }
  35%  { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}

/* Astillas de papel que saltan del impacto */
.astilla {
  position: absolute;
  left: 50%; top: 50%;
  width: 3px; height: 9px;
  margin-left: -1.5px; margin-top: -4.5px;
  border-radius: 1px;
  background: linear-gradient(#5a3d24, #2a1810);
  opacity: 0;
  animation: astillaVuela .55s var(--delay, 0s) ease-out both;
}
@keyframes astillaVuela {
  0%   { opacity: 0; transform: translate(-50%,-50%) rotate(var(--ang, 0deg)) translateX(0) scale(1); }
  18%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,-50%) rotate(var(--ang, 0deg)) translateX(30px) scale(.3); }
}

/* ═══════════════════════════════════════════════════
   BARRA DE ACCIONES — cuero + madera, a juego con el póster
═══════════════════════════════════════════════════ */
#botones-layer {
  flex-shrink: 0;
  position: relative;
  z-index: 60;
  display: flex;
  gap: 3.5%;
  justify-content: center;
  align-items: stretch;
  padding: 3.2% 5% calc(3.2% + env(safe-area-inset-bottom, 0px));
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.12) 0 2px, transparent 2px 26px),
    linear-gradient(180deg, #4a2f1c 0%, #2c1a0f 100%);
  border-top: 3px solid #a97a44;
  box-shadow: 0 -6px 14px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(14px);
  animation: barraAparece .8s .55s cubic-bezier(.2,.7,.2,1) both;
}
.cargando #botones-layer { animation-play-state: paused; }

@keyframes barraAparece {
  to { opacity: 1; transform: translateY(0); }
}

.btn-tap {
  flex: 0 1 auto;
  width: 55%;
  max-width: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  text-decoration: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #a9773f 0%, #7c4f24 100%);
  border: 1.5px solid #e0b26b;
  box-shadow: 0 3px 0 #3d2410, inset 0 1px 0 rgba(255,255,255,.18);
  -webkit-tap-highlight-color: transparent;
  outline: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn-tap:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #3d2410, inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-tap svg {
  width: 22px;
  height: 22px;
  fill: #f5e6c8;
  flex-shrink: 0;
}
.btn-tap span {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #f5e6c8;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0,0,0,.4);
}

/* ═══════════════════════════════════════════════════
   LOADER
═══════════════════════════════════════════════════ */
#loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #1c120b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .5s ease;
}
#loader.oculto { opacity: 0; pointer-events: none; }
#loader-puntos { display: flex; gap: 8px; }
.l-punto {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d4a656;
  animation: lPulso .9s ease-in-out infinite;
}
.l-punto:nth-child(2) { animation-delay: .15s; }
.l-punto:nth-child(3) { animation-delay: .3s; }
@keyframes lPulso {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50%      { opacity: 1;  transform: scale(1.2); }
}

/* ═══════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════ */
#footer-inv {
  flex-shrink: 0;
  width: 100%;
  max-width: 480px;
  padding: 6px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: #1c120b;
}
#footer-inv p {
  font-family: 'Oswald', sans-serif;
  font-size: 9px;
  font-weight: 500;
  color: #b08a63;
  line-height: 1.5;
  letter-spacing: .2px;
}
#footer-inv a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-family: 'Oswald', sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: #e0b26b;
  text-decoration: none;
  transition: opacity .2s;
}
#footer-inv a:hover { opacity: .65; }
#footer-inv a svg   { width: 10px; height: 10px; flex-shrink: 0; }
