/* Pulso — prototipo. Paleta: negro azulado + cian eléctrico + ámbar.
   Nada de morado genérico: el acento cálido es el que marca "vas en racha". */

:root {
  --bg: #04070d;
  --panel: rgba(10, 20, 34, 0.86);
  --neon: #2ff3d0;
  --warm: #ffc75a;
  --danger: #ff3d6e;
  --text: #e8f6f6;
  --dim: #7f9aa8;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;              /* sin zoom por doble toque ni jalón para recargar */
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.stage {
  height: 100dvh;                  /* dvh y no vh: en celular la barra de direcciones se mueve */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
}

/*
 * El marco crece hasta llenar lo que la pantalla dé, manteniendo 16:9. El
 * `max-width` calculado sobre la altura es lo que evita que en una pantalla
 * baja el juego se desborde: sin él, en horizontal el celular cortaba el
 * suelo y el techo.
 */
.frame {
  position: relative;
  width: min(100%, 1100px, calc(100dvh - 32px) * 16 / 9);
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(47, 243, 208, 0.22);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), 0 0 60px rgba(47, 243, 208, 0.06);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
}

/* ------------------------------------------------------------------- HUD */

.hud {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  pointer-events: none;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat { display: flex; align-items: baseline; gap: 6px; }

.label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--neon);
  transition: color 0.2s;
}

.value.hot { color: var(--warm); text-shadow: 0 0 14px rgba(255, 199, 90, 0.5); }

.icon-btn {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(47, 243, 208, 0.28);
  background: rgba(6, 14, 24, 0.6);
  color: var(--neon);
  cursor: pointer;
  transition: opacity 0.2s, border-color 0.2s;
}

.icon-btn:hover { border-color: var(--neon); }
.icon-btn.off { opacity: 0.35; color: var(--dim); border-color: rgba(127, 154, 168, 0.3); }

/* -------------------------------------------------------------- progreso */

.progress {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(60%, 460px);
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(47, 243, 208, 0.18);
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--neon), var(--warm));
  box-shadow: 0 0 16px rgba(47, 243, 208, 0.5);
  transition: width 0.06s linear;
}

.progress-text {
  position: absolute;
  right: -46px;
  top: -6px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
}

/* -------------------------------------------------------------- overlays */

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 100% at 50% 40%, rgba(4, 8, 14, 0.72), rgba(4, 8, 14, 0.94));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade 0.28s ease both;
}

.overlay.hidden { display: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.panel {
  width: min(90%, 520px);
  padding: 30px 32px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid rgba(47, 243, 208, 0.22);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.kicker {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 10px;
}

h1 {
  font-size: clamp(38px, 6vw, 62px);
  letter-spacing: 0.14em;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 16px;
  background: linear-gradient(180deg, #ffffff, var(--neon));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(47, 243, 208, 0.25);
}

h2 {
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.lead {
  font-size: 15px;
  line-height: 1.6;
  color: #c6dde3;
  margin-bottom: 10px;
}

.lead.dim { color: var(--dim); font-size: 14px; }
.lead b { color: var(--neon); }

.cta {
  margin-top: 18px;
  display: block;
  width: 100%;
  padding: 16px 24px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--neon), #12c9ab);
  color: #04131a;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(47, 243, 208, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.cta:hover { transform: translateY(-2px); box-shadow: 0 0 44px rgba(47, 243, 208, 0.5); }
.cta:active { transform: translateY(0); }

.ghost {
  margin-top: 10px;
  display: block;
  width: 100%;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid rgba(255, 199, 90, 0.4);
  background: transparent;
  color: var(--warm);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.ghost:hover:not(:disabled) { background: rgba(255, 199, 90, 0.1); }
.ghost:disabled { opacity: 0.3; cursor: not-allowed; }

.hint {
  margin-top: 12px;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--dim);
}

.source {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--dim);
}

/* ------------------------------------------------------------------ móvil */

/*
 * "Gira el teléfono": un juego de scroll horizontal en una pantalla vertical no
 * tiene arreglo bueno — o se ve como una tirita, o se ve tan poco camino
 * adelante que se vuelve injusto. Se pide girar, como cualquier juego del
 * género.
 */
.rotate {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
  background: var(--bg);
  color: var(--neon);
  z-index: 50;
}

.rotate p {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}

.rotate span {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

@media (orientation: portrait) and (max-height: 950px) and (pointer: coarse) {
  .rotate { display: flex; }
}

@media (max-width: 640px) {
  .value { font-size: 16px; }
  .panel { padding: 24px 20px; }
  .label { font-size: 10px; }
}

/* en celular acostado se aprovecha hasta la última franja de pantalla */
@media (orientation: landscape) and (max-height: 560px) and (pointer: coarse) {
  .stage { padding: 0; gap: 0; }
  .frame {
    width: min(100%, calc(100dvh * 16 / 9));
    border-radius: 0;
    border: 0;
  }
  .source { display: none; }
  .hud { padding: 8px 12px; }
  .progress { bottom: 8px; height: 6px; }
  .cta { padding: 14px 20px; font-size: 16px; }
}
