/* =====================================================
   RUN MAHONNIE'S RUN – style.css  v5.0
   Paleta: oscuro premium + rojo Mahonnie's + dorado
   ===================================================== */

:root {
  /* Paleta Mahonnie's */
  --red:      #CC1010;
  --red2:     #FF2020;
  --orange:   #FF6B00;
  --gold:     #FFB800;
  --gold2:    #FFE566;
  --dark:     #08040E;
  --dark2:    #110820;
  --dark3:    #1C0D2E;
  --surface:  rgba(255,255,255,.04);
  --border:   rgba(204,16,16,.35);
  --cream:    #F0EDE8;
  --muted:    rgba(240,237,232,.45);
  --green:    #00E676;

  --font-pixel: 'Press Start 2P', monospace;
  --font-brand: 'Fredoka One', cursive;
  --font-body:  'Nunito', sans-serif;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;              /* sin pull-to-refresh ni rebote que interfiera el gesto */
  background: var(--dark);
  font-family: var(--font-body);
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
}

/* ── BACKGROUND SYSTEM ───────────────────────────── */
.bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Grid perspectiva estilo arcade */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(204,16,16,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(204,16,16,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

/* Glow ambiental */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .22;
}
.bg-glow--red {
  width: 70vw; height: 70vw;
  max-width: 500px; max-height: 500px;
  background: var(--red);
  top: -10%; left: 50%;
  transform: translateX(-50%);
}
.bg-glow--orange {
  width: 50vw; height: 50vw;
  max-width: 360px; max-height: 360px;
  background: var(--orange);
  bottom: 5%; right: -10%;
  opacity: .12;
}
.bg-glow--gold {
  width: 70vw; height: 70vw;
  max-width: 500px; max-height: 500px;
  background: var(--gold);
  top: -10%; left: 50%;
  transform: translateX(-50%);
  opacity: .18;
}

/* Scanlines CRT sutil */
.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.08) 2px,
    rgba(0,0,0,.08) 4px
  );
  pointer-events: none;
}

/* ── SCREENS ─────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 28px 20px 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
  overflow-y: auto;
  z-index: 10;
  -webkit-overflow-scrolling: touch;
}
.screen.active { opacity: 1; pointer-events: all; }

/* En pantallas muy pequeñas alinear desde arriba */
@media (max-height: 620px) {
  .screen { justify-content: flex-start; gap: 12px; padding: 16px 16px 20px; }
}

/* ── BRAND EYEBROW ───────────────────────────────── */
.brand-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.brand-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  animation: dot-pulse 2s ease-in-out infinite;
}
.brand-dot--gold {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}
@keyframes dot-pulse {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}
.brand-name {
  font-family: var(--font-pixel);
  font-size: 8px;
  letter-spacing: 4px;
  color: var(--red);
  text-shadow: 0 0 12px rgba(204,16,16,.6);
}
.brand-name--gold {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255,184,0,.6);
}

/* ── TITLE BLOCK ─────────────────────────────────── */
.title-block {
  text-align: center;
  position: relative;
  z-index: 1;
}

.game-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1;
}

.title-word {
  font-family: var(--font-pixel);
  font-size: clamp(12px, 3.5vw, 18px);
  letter-spacing: 6px;
  color: var(--gold2);
  text-shadow:
    2px 2px 0 var(--orange),
    4px 4px 0 rgba(0,0,0,.5);
}

.title-main {
  font-family: var(--font-brand);
  font-size: clamp(42px, 11vw, 72px);
  color: #fff;
  letter-spacing: -1px;
  text-shadow:
    0 0 40px rgba(204,16,16,.7),
    0 2px 0 rgba(0,0,0,.5),
    3px 3px 0 var(--red);
  display: block;
  line-height: 1.0;
}

.game-tagline {
  margin-top: 8px;
  font-family: var(--font-brand);
  font-size: clamp(14px, 3.8vw, 19px);
  color: var(--orange);
  letter-spacing: .5px;
  opacity: .9;
}

/* ── MISSION HUD ─────────────────────────────────── */
.mission-hud {
  width: 100%;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(4px);
}

.hud-label {
  font-family: var(--font-pixel);
  font-size: 8px;
  letter-spacing: 3px;
  color: var(--red);
  background: rgba(204,16,16,.12);
  border-bottom: 1px solid var(--border);
  padding: 6px 14px;
  text-align: center;
}

.hud-body {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  gap: 0;
}

.hud-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 2px 0;
}

.hud-icon { font-size: 16px; flex-shrink: 0; }

.hud-text {
  font-size: 13px;
  color: var(--cream);
  line-height: 1.3;
}
.hud-text strong {
  color: var(--gold);
  font-weight: 900;
}

.hud-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 12px;
  flex-shrink: 0;
}

/* ── BTN START (principal) ───────────────────────── */
.btn-start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 280px;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--red) 0%, #8B0000 100%);
  border: 2px solid rgba(255,255,255,.15);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  overflow: hidden;
  transition: transform .12s, box-shadow .12s;

  /* Sombra estilo botón arcade 3D */
  box-shadow:
    0 6px 0 #5a0000,
    0 8px 24px rgba(204,16,16,.5),
    inset 0 1px 0 rgba(255,255,255,.15);

  animation: btn-idle 2.4s ease-in-out infinite;
}

@keyframes btn-idle {
  0%,100% {
    box-shadow: 0 6px 0 #5a0000, 0 8px 24px rgba(204,16,16,.5), inset 0 1px 0 rgba(255,255,255,.15);
  }
  50% {
    box-shadow: 0 6px 0 #5a0000, 0 14px 40px rgba(204,16,16,.75), inset 0 1px 0 rgba(255,255,255,.15);
  }
}

/* Brillo interior animado */
.btn-start::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
  animation: btn-shine 3s ease-in-out infinite;
}
@keyframes btn-shine {
  0%   { left: -100%; }
  40%  { left: 120%; }
  100% { left: 120%; }
}

.btn-start:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #5a0000, 0 4px 8px rgba(204,16,16,.3), inset 0 1px 0 rgba(255,255,255,.1);
  animation: none;
}

.btn-start__icon {
  font-size: 14px;
  flex-shrink: 0;
}

.btn-start__text {
  font-family: var(--font-pixel);
  font-size: clamp(10px, 2.8vw, 13px);
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,.4);
}

/* Variante reintentar / nueva partida */
.btn-start--retry {
  background: linear-gradient(135deg, rgba(255,107,0,.25) 0%, rgba(204,16,16,.15) 100%);
  border-color: rgba(255,107,0,.45);
  box-shadow:
    0 4px 0 rgba(255,107,0,.25),
    0 6px 16px rgba(255,107,0,.2);
  animation: none;
  max-width: 260px;
  padding: 13px 28px;
}
.btn-start--retry::before { display: none; }
.btn-start--retry:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(255,107,0,.2);
}
.btn-start--retry .btn-start__text {
  font-size: clamp(9px, 2.4vw, 11px);
  color: var(--cream);
}

/* ── PLAYERS HUD ─────────────────────────────────── */
.players-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 1;
}

.players-hud__label {
  font-family: var(--font-pixel);
  font-size: 7px;
  letter-spacing: 3px;
  color: var(--muted);
}

.players-hud__count {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50px;
  padding: 7px 18px;
}

.players-hud__icon { font-size: 14px; }

.players-hud__num {
  font-family: var(--font-pixel);
  font-size: 13px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255,184,0,.5);
  min-width: 40px;
  text-align: center;
}

/* ── CONTROL HINT ────────────────────────────────── */
.control-hint {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: rgba(240,237,232,.2);
  letter-spacing: 2px;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* ── CANVAS ──────────────────────────────────────── */
#game-canvas {
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  touch-action: none;                 /* el navegador no captura scroll/zoom sobre el canvas */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;        /* sin menú contextual por pulsación larga en iOS */
  -webkit-tap-highlight-color: transparent;
}

/* ── JUMP HINT ───────────────────────────────────── */
.jump-hint {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-pixel);
  font-size: 9px;
  color: rgba(255,255,255,.45);
  letter-spacing: 1px;
  pointer-events: none;
  white-space: nowrap;
  animation: fadeHint 3.5s forwards;
}
@keyframes fadeHint { 0%,55%{opacity:1} 100%{opacity:0} }

/* ── GAME OVER ───────────────────────────────────── */
.go-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.go-icon {
  font-size: 52px;
  animation: shake .45s ease;
  display: block;
}
@keyframes shake {
  0%,100%{transform:translateX(0) rotate(0deg)}
  20%{transform:translateX(-8px) rotate(-4deg)}
  40%{transform:translateX(8px) rotate(4deg)}
  60%{transform:translateX(-5px) rotate(-2deg)}
  80%{transform:translateX(5px) rotate(2deg)}
}

.go-title {
  font-family: var(--font-pixel);
  font-size: clamp(16px, 4.5vw, 24px);
  color: var(--red2);
  text-shadow: 3px 3px 0 #5a0000, 0 0 20px rgba(204,16,16,.6);
  text-align: center;
  letter-spacing: 2px;
}

.go-sub {
  font-size: 14px;
  color: var(--orange);
  text-align: center;
  opacity: .85;
}

.go-encourage {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

/* ── RESULT CARD ─────────────────────────────────── */
.result-card {
  width: 100%;
  max-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(4px);
}

.result-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 18px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.result-card__row:last-child { border-bottom: none; }
.result-card__row--goal { color: var(--gold); }

.result-card__key { color: var(--muted); font-size: 13px; }

.result-card__val {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255,184,0,.4);
}

.result-card__bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 14px;
}

.result-card__bar {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,.08);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(204,16,16,.2);
}

.result-card__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold));
  border-radius: 5px;
  transition: width .7s cubic-bezier(.4,0,.2,1);
  width: 0%;
  box-shadow: 0 0 8px rgba(204,16,16,.5);
}

.result-card__pct {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--gold);
  min-width: 36px;
  text-align: right;
}

/* ── WIN ─────────────────────────────────────────── */
.win-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.win-icon {
  font-size: 60px;
  display: block;
  animation: bounceIn .7s cubic-bezier(.36,.07,.19,.97);
  filter: drop-shadow(0 0 20px rgba(255,184,0,.5));
}
@keyframes bounceIn {
  0%   { transform: scale(.3); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  80%  { transform: scale(.95); }
  100% { transform: scale(1); }
}

.win-title {
  font-family: var(--font-pixel);
  font-size: clamp(17px, 5vw, 26px);
  color: var(--gold2);
  text-shadow:
    3px 3px 0 var(--orange),
    0 0 30px rgba(255,184,0,.6);
  text-align: center;
  letter-spacing: 3px;
}

.win-sub {
  font-size: 15px;
  color: var(--cream);
  text-align: center;
}
.win-sub strong { color: var(--gold); }

/* Result card variante win */
.result-card--win {
  border-color: rgba(255,184,0,.45);
  background: linear-gradient(135deg, rgba(255,184,0,.08), rgba(255,107,0,.05));
  text-align: center;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.result-card__label {
  font-family: var(--font-pixel);
  font-size: 7px;
  letter-spacing: 3px;
  color: var(--muted);
}

.result-card__value {
  font-family: var(--font-pixel);
  font-size: clamp(22px, 6vw, 30px);
  color: var(--gold2);
  letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(255,230,102,.6);
  padding: 10px 20px;
  background: rgba(0,0,0,.3);
  border-radius: 8px;
  border: 1px dashed rgba(255,184,0,.35);
}

.result-card__credit {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ── BTN GHOST ───────────────────────────────────── */
.btn-ghost {
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--gold);
  background: transparent;
  border: 1px solid rgba(255,184,0,.35);
  border-radius: 6px;
  padding: 11px 24px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  position: relative;
  z-index: 1;
  animation: ghost-pulse 2.5s ease-in-out infinite;
}
@keyframes ghost-pulse {
  0%,100% { box-shadow: 0 0 4px rgba(255,184,0,.2); }
  50%      { box-shadow: 0 0 14px rgba(255,184,0,.45); }
}
.btn-ghost:hover { background: rgba(255,184,0,.08); border-color: rgba(255,184,0,.6); }
.btn-ghost:active { transform: scale(.97); }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-height: 640px) {
  .screen { gap: 10px; padding: 12px 16px 16px; }
  .go-icon, .win-icon { font-size: 38px; }
  .title-main { font-size: clamp(32px, 9vw, 52px); }
  .mission-hud { max-width: 290px; }
  .btn-start { padding: 13px 24px; }
}

@media (min-height: 750px) {
  .screen { gap: 22px; }
}

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

/* ═══ v5 VERSE: stats, skins y extras ═══ */
.start-stats{
  font-family:'Fredoka One',cursive;
  font-size:.82rem;color:var(--muted);
  background:var(--surface);border:1px solid var(--border);
  border-radius:12px;padding:.5rem .9rem;margin:.2rem 0 .1rem;
  text-align:center;
}
.start-stats b{color:var(--gold)}
.skin-row{
  display:flex;gap:.4rem;flex-wrap:wrap;justify-content:center;
  margin-bottom:.3rem;
}
.skin-btn{
  font-family:'Fredoka One',cursive;font-size:.72rem;
  padding:.32rem .7rem;border-radius:999px;cursor:pointer;
  background:var(--surface);color:var(--cream);
  border:1px solid var(--border);
  transition:transform .12s, border-color .12s;
}
.skin-btn:active{transform:sc