/* Yo doy estilo a todo lo que ocurre durante la partida. */

/* Yo coloco el canvas detrás de todas las pantallas. */
.game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 1; touch-action: none; visibility: hidden; }
.app.in-game .game-canvas { visibility: visible; }
/* Yo dejo pasar los toques al canvas en la pantalla de juego. */
.screen--game { padding: 0; pointer-events: none; }
.screen--game > * { pointer-events: auto; }

/* ---------- HUD ---------- */
.hud {
  position: absolute; left: 0; right: 0; top: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--sp-3);
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 12px) 0 calc(var(--safe-l) + 12px);
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud__left { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.hud__right { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.icon-btn--hud { width: 44px; height: 44px; background: rgba(26, 20, 51, .75); box-shadow: inset 0 0 0 2px var(--line); }
.hud__level { font-family: var(--font-display); font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 rgba(0,0,0,.5); }
.hud__stat {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .3em .7em; border-radius: var(--r-pill); background: rgba(26, 20, 51, .75);
  font-variant-numeric: tabular-nums; font-weight: 900; font-size: var(--fs-sm);
}
.hud__stat .icon { width: 1em; height: 1em; color: var(--muted); }
.hud__center { display: flex; gap: 6px; padding: .3em .7em; border-radius: var(--r-pill); background: rgba(26, 20, 51, .75); }
.hud__center .icon { width: 18px; height: 18px; color: rgba(255,255,255,.2); transition: color .2s, transform .2s; }
.hud__center .icon.on { color: var(--gold); transform: scale(1.15); }
.hud__center .icon.heart.on { color: var(--coral); }

/* ---------- Controles táctiles ---------- */
.touch {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0 calc(var(--safe-r) + 18px) calc(var(--safe-b) + 18px) calc(var(--safe-l) + 18px);
  pointer-events: none; opacity: var(--touch-opacity);
}
.touch.is-hidden { display: none; }
/* Yo invierto el lado del salto para jugadores zurdos. */
.touch.is-swapped { flex-direction: row-reverse; }
.touch__move, .touch__jump { display: flex; gap: calc(14px * var(--touch-scale)); pointer-events: auto; }
.touch__btn {
  display: grid; place-items: center;
  width: calc(76px * var(--touch-scale)); height: calc(76px * var(--touch-scale));
  border-radius: 22px; background: rgba(244, 238, 223, .14); color: var(--bone);
  box-shadow: inset 0 0 0 2px rgba(244,238,223,.28), 0 4px 0 rgba(0,0,0,.3);
  touch-action: none; transition: transform .05s, background .05s;
}
.touch__btn .icon { width: 40%; height: 40%; }
.touch__btn--flip .icon { transform: scaleX(-1); }
.touch__btn--jump { width: calc(92px * var(--touch-scale)); height: calc(92px * var(--touch-scale)); border-radius: 50%; background: rgba(45, 225, 194, .22); box-shadow: inset 0 0 0 2px rgba(45,225,194,.6), 0 4px 0 rgba(0,0,0,.3); }
.touch__btn.is-down { transform: translateY(3px) scale(.96); background: rgba(244, 238, 223, .32); }
.touch__btn--jump.is-down { background: rgba(45, 225, 194, .5); }

/* ---------- Resultado ---------- */
.panel--result { width: min(480px, 100%); }
.stars-row { display: flex; justify-content: center; gap: var(--sp-2); margin: var(--sp-3) 0; }
.stars-row .icon { width: clamp(44px, 10vmin, 64px); height: clamp(44px, 10vmin, 64px); color: rgba(255,255,255,.12); }
.stars-row .icon.on { color: var(--gold); animation: star-in .45s cubic-bezier(.2, 1.6, .4, 1) both; filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); }
.stars-row .icon:nth-child(2) { transform: translateY(-10px); }
.stars-row .icon.on:nth-child(2) { animation-delay: .18s; }
.stars-row .icon.on:nth-child(3) { animation-delay: .36s; }
@keyframes star-in { from { transform: scale(0) rotate(-40deg); } }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin: 0; }
.result-stats div { padding: var(--sp-3) var(--sp-2); border-radius: var(--r-md); background: rgba(0,0,0,.25); }
.result-stats dt { font-size: var(--fs-xs); color: var(--muted); font-weight: 800; }
.result-stats dd { margin: 0; font-family: var(--font-display); font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.result-stats .is-good dd { color: var(--teal); }
.reward { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); min-height: 1px; }
.reward span { display: inline-flex; align-items: center; gap: .35em; padding: .3em .8em; border-radius: var(--r-pill); background: rgba(255,194,61,.14); color: var(--gold); font-weight: 900; font-size: var(--fs-sm); }
.reward span.record { background: rgba(45,225,194,.14); color: var(--teal); }

/* ---------- Tutorial ---------- */
.panel--tutorial { width: min(460px, 100%); }
.tut-dots { display: flex; justify-content: center; gap: 6px; }
.tut-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tut-dots i.on { background: var(--gold); width: 22px; border-radius: 8px; }

/* ---------- Aviso de rotación ---------- */
.rotate-hint {
  position: absolute; z-index: 15; left: 50%; transform: translateX(-50%);
  top: calc(var(--safe-t) + 96px);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: .5em .6em .5em 1.1em; border-radius: var(--r-pill);
  background: rgba(20, 15, 42, .92); box-shadow: inset 0 0 0 2px var(--line);
  font-size: var(--fs-sm); font-weight: 800; width: max-content; max-width: 92vw;
}
.rotate-hint .icon-btn { width: 36px; height: 36px; }
