/* =========================================================
   El Camino al Folk Metal Fest — Look GAMER
   Mobile-first, oscuro, neón, fondos videojuego procedurales.
   ========================================================= */

:root {
  --c-bg: #0a0510;
  --c-bg-2: #15091e;
  --c-ink: #ecdcff;
  --c-ink-dim: #b9a4d3;

  --c-neon-pink: #ff3d8e;
  --c-neon-purple: #b14cff;
  --c-neon-cyan: #4fd6ff;
  --c-neon-yellow: #ffd84a;
  --c-neon-green: #6cff8a;
  --c-neon-red: #ff5a3d;

  --c-accent: var(--c-neon-yellow);
  --c-accent-2: var(--c-neon-pink);

  --c-mead: #ffc83d;
  --c-honor: #ff5a3d;
  --c-spirit: #4fd6ff;
  --c-cabra: #ff3d8e;
  --c-riff: #b14cff;

  --font-title: "Cinzel Decorative", "Cinzel", "Uncial Antiqua", serif;
  --font-ui: "Cinzel", "Cinzel Decorative", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 6px;
  --shadow-neon: 0 0 24px rgba(255, 61, 142, 0.45),
                 0 8px 32px rgba(0, 0, 0, 0.55);
  --transition: 480ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font-family: var(--font-ui);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  letter-spacing: 0.04em;
}

.hidden { display: none !important; }

/* =========================================================
   VIDEO BACKGROUND GLOBAL — YouTube embed sin sonido en loop
   Cubre toda la pantalla, escalado para "object-fit: cover".
   ========================================================= */
.video-bg {
  position: fixed; inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #06030a;
}
.video-bg video { display: block; background: #06030a; }
.video-bg video,
.video-bg iframe {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;             /* cubre toda la pantalla recortando lo que sobra */
  object-position: center center;
  border: 0;
  pointer-events: none;
  filter: brightness(0.85) saturate(1.1);
}
/* Sin overlay aquí: lo añadimos sólo donde haga falta legibilidad */

/* =========================================================
   THEMES VIDEOJUEGO (fondos procedurales)
   ========================================================= */
/* El fondo real lo pone el vídeo global. Estos elementos quedan
   transparentes para que el vídeo se vea a través. */
.game__bg, .ending__bg {
  position: absolute; inset: 0;
  z-index: 0;
  background: transparent;
}

/* Theme fallback unificado: solo oscuro neutro mientras carga la imagen.
   No más gradientes rojos/colores chillones que se vean sobresaliendo. */
[data-theme] {
  background: linear-gradient(180deg, #0a0510 0%, #060309 100%);
}

/* Pequeñas partículas/brasas decorativas (sutiles) */
.game__bg::before,
.ending__bg::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255,216,74,0.45), transparent 50%),
    radial-gradient(2px 2px at 62% 32%, rgba(255,216,74,0.55), transparent 50%),
    radial-gradient(1.5px 1.5px at 45% 88%, rgba(255,140,90,0.4), transparent 50%);
  opacity: 0.7;
  animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: 0.25; } }

/* Scanlines superpuestas (look CRT/videojuego) */
.game__scanlines, .ending__scanlines {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0)   0px,
    rgba(0,0,0,0)   3px,
    rgba(0,0,0,0.07) 4px,
    rgba(0,0,0,0)   5px
  );
  opacity: 0.45;
  mix-blend-mode: multiply;
}

/* =========================================================
   LOADING
   ========================================================= */
.loading {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a0a2a 0%, #04020a 80%);
  z-index: 100;
}
.loading__rune {
  width: 64px; height: 64px;
  border: 4px solid var(--c-neon-pink);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 24px rgba(255, 61, 142, 0.7);
}
.loading__text {
  font-family: var(--font-title);
  margin-top: 1.5rem;
  letter-spacing: 0.18em;
  color: var(--c-neon-yellow);
  text-shadow: 0 0 8px rgba(255, 216, 74, 0.6);
  font-size: 0.95rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   SPLASH — cinematográfico/épico
   ========================================================= */
.splash {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 1.5rem;
  z-index: 50;
  animation: fadeIn 900ms ease;
}
.splash__bg {
  position: absolute; inset: 0;
  background: transparent;
  z-index: 0;
}
@keyframes kenBurns {
  0%   { transform: scale(1.0) translate(0, 0); }
  100% { transform: scale(1.12) translate(-2%, -1.5%); }
}
.splash__vignette {
  position: absolute; inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at 50% 60%, transparent 0%, rgba(5,2,8,0.45) 80%);
  pointer-events: none;
}
.splash__content {
  position: relative; z-index: 5;
  max-width: 620px; width: 100%;
}
.splash__overline {
  font-family: var(--font-ui);
  font-size: clamp(0.7rem, 2.6vw, 0.85rem);
  letter-spacing: 0.45em;
  color: var(--c-neon-yellow);
  margin: 0 0 1.5rem;
  opacity: 0.85;
  text-shadow: 0 0 12px rgba(255,216,74,0.5);
}
.splash__title {
  font-family: var(--font-title);
  margin: 0 0 1.2rem;
  display: flex; flex-direction: column;
  gap: 0.15rem;
}
.splash__title-pre {
  font-size: clamp(0.85rem, 3.6vw, 1.2rem);
  letter-spacing: 0.4em;
  color: #cdbfa3;
  font-weight: 700;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}
.splash__title-main {
  font-family: "Cinzel Decorative", "Cinzel", serif;
  font-weight: 900;
  font-size: clamp(2.4rem, 10vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #ffe9a8 0%, #d4a04a 50%, #8a4f10 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 18px rgba(255, 196, 90, 0.45)) drop-shadow(0 0 32px rgba(255, 61, 142, 0.18));
  text-transform: capitalize;
}
.splash__title-game {
  display: inline-block;
  align-self: center;
  margin-top: 0.4rem;
  padding: 0.18rem 1.2rem;
  font-family: "Cinzel Decorative", serif;
  font-weight: 900;
  font-size: clamp(1.4rem, 5.5vw, 2.2rem);
  letter-spacing: 0.4em;
  color: #0a0510;
  background: linear-gradient(180deg, var(--c-neon-yellow) 0%, #ff9a3d 100%);
  border-radius: 4px;
  box-shadow:
    0 0 24px rgba(255,216,74,0.6),
    0 0 40px rgba(255,61,142,0.3),
    inset 0 1px 0 rgba(255,255,255,0.5);
  text-indent: 0.4em;
}
.splash__subtitle {
  font-family: var(--font-ui);
  font-size: clamp(0.85rem, 3vw, 1.05rem);
  color: #f0e3c2;
  margin: 0 0 2rem;
  letter-spacing: 0.18em;
  font-weight: 500;
  text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}
.splash__toggles {
  display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap;
  margin-top: 0.85rem;
}
.splash__hint {
  margin-top: 1.6rem;
  font-family: var(--font-ui);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--c-neon-yellow);
  letter-spacing: 0.06em;
  text-shadow: 0 0 12px rgba(255,216,74,0.4);
}

/* =========================================================
   BOTONES GAMER
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.6rem;
  border-radius: var(--radius);
  font-family: var(--font-title);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: transform 150ms ease, box-shadow 200ms, filter 200ms;
  min-height: 52px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  /* Look gamer: esquina recortada arriba-derecha */
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.btn--primary {
  background: linear-gradient(180deg, var(--c-neon-yellow) 0%, var(--c-neon-pink) 100%);
  color: #0a0510;
  box-shadow:
    0 0 18px rgba(255,61,142,0.55),
    0 0 28px rgba(255,216,74,0.35),
    inset 0 1px 0 rgba(255,255,255,0.55);
  font-weight: 700;
}
.btn--primary:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.1);
  box-shadow: 0 0 28px rgba(255,61,142,0.8), 0 0 40px rgba(255,216,74,0.5);
}
.btn--primary:active { transform: translateY(0) scale(0.98); }

.btn--ghost {
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(177, 76, 255, 0.5);
  color: var(--c-ink);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 12px rgba(177, 76, 255, 0.18);
}
.btn--ghost:hover {
  background: rgba(177, 76, 255, 0.18);
  border-color: var(--c-neon-purple);
  box-shadow: 0 0 16px rgba(177, 76, 255, 0.5);
}
.btn--small { padding: 0.55rem 0.9rem; min-height: 38px; font-size: 0.7rem; }

/* =========================================================
   GAME LAYOUT
   ========================================================= */
.game { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 10; }

.game__overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(10,5,16,0.25) 50%, rgba(10,5,16,0.7) 100%);
  z-index: 2;
  pointer-events: none;
}

/* =========================================================
   HUD GAMER
   ========================================================= */
.hud {
  position: relative; z-index: 5;
  padding: max(env(safe-area-inset-top), 0.85rem) 0.85rem 0.4rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.hud__stats {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  justify-content: center;
}
.hud__controls {
  display: flex; gap: 0.5rem; justify-content: flex-end;
}
.stat {
  display: flex; align-items: center; gap: 0.3rem;
  background: rgba(0,0,0,0.55);
  border: 1.5px solid rgba(177, 76, 255, 0.45);
  border-radius: 4px;
  padding: 0.3rem 0.55rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 8px rgba(177, 76, 255, 0.18);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}
.stat__icon { font-size: 0.95rem; line-height: 1; }
.stat__bar {
  display: inline-block;
  width: 44px; height: 7px;
  background: rgba(255,255,255,0.10);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.stat__fill {
  position: absolute; inset: 0 100% 0 0;
  transition: right 600ms cubic-bezier(0.22, 0.61, 0.36, 1);
  box-shadow: 0 0 6px currentColor;
}
.stat[data-stat="hidromiel"] .stat__fill { background: var(--c-mead);  color: var(--c-mead); }
.stat[data-stat="honor"]     .stat__fill { background: var(--c-honor); color: var(--c-honor); }
.stat[data-stat="espiritu"]  .stat__fill { background: var(--c-spirit);color: var(--c-spirit); }
.stat[data-stat="cabra"]     .stat__fill { background: var(--c-cabra); color: var(--c-cabra); }
.stat[data-stat="riff"]      .stat__fill { background: var(--c-riff);  color: var(--c-riff); }

.hud__btn {
  width: 38px; height: 38px;
  border-radius: 4px;
  background: rgba(0,0,0,0.6);
  border: 1.5px solid rgba(177, 76, 255, 0.5);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: background 200ms, transform 150ms, box-shadow 200ms;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}
.hud__btn:hover { background: rgba(177, 76, 255, 0.25); box-shadow: 0 0 12px rgba(177, 76, 255, 0.6); }
.hud__btn:active { transform: scale(0.92); }
.hud__btn.is-on {
  background: rgba(255, 216, 74, 0.22);
  border-color: var(--c-neon-yellow);
  box-shadow: 0 0 14px rgba(255,216,74,0.6);
}

/* =========================================================
   STORY
   ========================================================= */
.story {
  position: relative; z-index: 5;
  flex: 1;
  display: flex; align-items: flex-end;
  padding: 1rem 1.25rem 0.5rem;
  overflow-y: auto;
}
.story__text {
  font-family: var(--font-body);
  font-size: clamp(1rem, 4.4vw, 1.18rem);
  line-height: 1.6;
  color: var(--c-ink);
  text-shadow: 0 2px 18px rgba(0,0,0,0.95);
  margin: 0;
  max-width: 720px; margin-inline: auto;
  width: 100%;
  background: rgba(10, 5, 16, 0.55);
  border-left: 3px solid var(--c-neon-pink);
  padding: 1rem 1.1rem;
  border-radius: 4px;
  box-shadow: 0 0 22px rgba(0,0,0,0.5), inset 0 0 28px rgba(177,76,255,0.06);
  backdrop-filter: blur(4px);
}
.story__text.typing::after {
  content: "▌";
  display: inline-block;
  margin-left: 2px;
  color: var(--c-neon-yellow);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* =========================================================
   CHOICES
   ========================================================= */
.choices {
  position: relative; z-index: 5;
  display: flex; flex-direction: column; gap: 0.55rem;
  padding: 0.5rem 1rem max(env(safe-area-inset-bottom), 1rem);
  max-width: 720px; margin-inline: auto;
  width: 100%;
}
.choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.95rem 1.1rem;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(20,10,30,0.92), rgba(10,5,16,0.95));
  border: 1.5px solid rgba(177, 76, 255, 0.45);
  color: var(--c-ink);
  font-size: 1rem;
  line-height: 1.4;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.01em;
  min-height: 56px;
  transition: transform 150ms, border-color 200ms, background 200ms, box-shadow 200ms;
  position: relative;
  opacity: 0;
  transform: translateY(10px);
  animation: choiceIn 500ms ease forwards;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
@keyframes choiceIn { to { opacity: 1; transform: translateY(0); } }

.choice:hover {
  border-color: var(--c-neon-pink);
  background: linear-gradient(180deg, rgba(40,12,40,0.95), rgba(20,5,28,0.98));
  box-shadow: 0 0 18px rgba(255, 61, 142, 0.45), inset 0 0 18px rgba(177, 76, 255, 0.12);
  transform: translateY(-1px);
}
.choice:active { transform: scale(0.985); }
.choice[disabled] { opacity: 0.4; pointer-events: none; }

.fade-out { animation: fadeOut 380ms ease forwards; }
.fade-in  { animation: fadeIn 600ms ease forwards; }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }

/* =========================================================
   ENDING
   ========================================================= */
.ending {
  position: fixed; inset: 0;
  z-index: 60;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: max(env(safe-area-inset-top), 1rem) 1.25rem max(env(safe-area-inset-bottom), 1.5rem);
  text-align: center;
  animation: fadeIn 800ms ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Overlay del final: fixed al viewport para que cubra siempre toda la pantalla
   aunque el contenido haga scroll. Más transparente para mejor legibilidad. */
.ending__overlay {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.9) 100%);
  z-index: 1;
  pointer-events: none;
}
.ending__content {
  position: relative; z-index: 5;
  max-width: 600px; width: 100%;
  margin: auto 0;
  padding: 0.5rem 0 1rem;
}
.ending__eyebrow {
  font-family: var(--font-title);
  letter-spacing: 0.2em;
  color: var(--c-neon-yellow);
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
  text-shadow: 0 0 10px rgba(255,216,74,0.6);
}
.ending__avatar {
  font-size: clamp(5rem, 18vw, 9rem);
  margin: 0;
  line-height: 1;
  filter: drop-shadow(0 0 24px rgba(255,216,74,0.55));
  animation: avatarPop 800ms cubic-bezier(.2,1.6,.4,1);
}
@keyframes avatarPop { from { transform: scale(0.4); opacity: 0; } }
.ending__label {
  font-family: var(--font-title);
  font-size: clamp(1rem, 4vw, 1.25rem);
  letter-spacing: 0.08em;
  color: #fff;
  margin: 0.3rem 0 0.5rem;
  text-shadow: 0 0 12px rgba(255,61,142,0.55);
}
.ending__title {
  font-family: var(--font-title);
  font-size: clamp(1.7rem, 6vw, 2.6rem);
  line-height: 1.05;
  margin: 0 0 0.6rem;
  background: linear-gradient(180deg, var(--c-neon-yellow) 0%, var(--c-neon-pink) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(255,61,142,0.4));
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.ending__tagline {
  font-style: italic;
  color: var(--c-neon-cyan);
  font-size: clamp(0.9rem, 3.5vw, 1.05rem);
  margin: 0 0 1rem;
  text-shadow: 0 0 8px rgba(79,214,255,0.5);
}
.ending__text {
  font-size: clamp(0.9rem, 3.4vw, 1.05rem);
  line-height: 1.55;
  color: var(--c-ink);
  margin: 0 0 1.25rem;
}
.ending__stats {
  display: flex; justify-content: center; gap: 0.8rem;
  margin: 0 0 1rem;
  flex-wrap: wrap;
}
.ending__stat {
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--font-ui);
  color: var(--c-ink-dim);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  min-width: 56px;
}
.ending__stat strong {
  font-size: 1.4rem;
  color: var(--c-neon-yellow);
  font-family: var(--font-title);
  text-shadow: 0 0 8px rgba(255,216,74,0.6);
}
.ending__actions {
  display: flex; gap: 0.6rem;
  justify-content: center; flex-wrap: wrap;
  margin-top: 0.5rem;
}
.ending__hint {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--c-ink-dim);
  min-height: 1.2em;
}

/* Photo picker */
.photo-picker {
  background: rgba(10, 5, 16, 0.7);
  border: 1.5px dashed rgba(177, 76, 255, 0.5);
  border-radius: 6px;
  padding: 0.85rem;
  margin: 0 0 1rem;
  backdrop-filter: blur(6px);
}
.photo-picker__title {
  margin: 0 0 0.6rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--c-neon-yellow);
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px rgba(255,216,74,0.4);
}
.photo-picker__buttons {
  display: flex; gap: 0.4rem; justify-content: center; flex-wrap: wrap;
}

/* Preview de la story */
.story-preview {
  margin: 0.5rem auto 1rem;
  max-width: 180px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--c-neon-pink);
  box-shadow: 0 0 22px rgba(255, 61, 142, 0.5), 0 8px 28px rgba(0,0,0,0.6);
  animation: popIn 600ms ease;
}
.story-preview img { display: block; width: 100%; height: auto; }
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* =========================================================
   CONFETI
   ========================================================= */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.confetti span {
  position: absolute;
  top: -10%;
  width: 10px; height: 14px;
  border-radius: 2px;
  animation: confettiFall linear infinite;
  opacity: 0.9;
}
@keyframes confettiFall {
  0%   { transform: translateY(-10vh) rotate(0deg);   opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0.4; }
}

/* =========================================================
   DESKTOP
   ========================================================= */
@media (min-width: 900px) {
  .story { padding: 2rem 2rem 1rem; }
  .story__text { font-size: 1.18rem; line-height: 1.7; padding: 1.2rem 1.4rem; }
  .choices { padding: 1rem 2rem 2rem; gap: 0.7rem; }
  .choice { padding: 1.1rem 1.4rem; font-size: 1.05rem; }
  .hud { padding: 1.25rem 1.5rem 0.5rem; }
  .stat__bar { width: 60px; height: 8px; }
  .story-preview { max-width: 220px; }
}

/* =========================================================
   ACCESIBILIDAD
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .splash__pennant, .game__bg::before, .splash__bg::before, .ending__bg::before { animation: none; }
  .confetti span { display: none; }
  .choice { animation: none; opacity: 1; transform: none; }
}
