/* ==========================================================================
   Hydrowick® — Transporte capilar (el juego)
   Estilos propios de /juego/. Hereda las variables de assets/css/styles.css.
   ========================================================================== */

:root {
  --juego-agua: var(--series-1);
  --juego-algodon: var(--series-2);
  --juego-piel: #e0a487;
  --juego-max: 520px;
}

/* ------------------------------------------------------------ intro -- */

.juego-intro {
  padding: clamp(40px, 7vw, 76px) 0 clamp(20px, 3vw, 30px);
  background: linear-gradient(180deg, var(--brand-soft), transparent 85%);
}

.juego-intro h1 {
  font-size: clamp(2rem, 5.4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -.022em;
  margin: .18em 0 .5em;
}

.juego-intro .lead { max-width: 58ch; }

.juego-seccion { padding: clamp(24px, 4vw, 44px) 0 clamp(40px, 6vw, 72px); }
.juego-seccion.alt { background: var(--surface-1); border-top: 1px solid var(--border); }

/* ------------------------------------------------------------ shell -- */

.juego-shell {
  max-width: var(--juego-max);
  margin: 0 auto;
}

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

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.hud-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  min-width: 0;
}

.hud-label {
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.3;
}

.hud-valor {
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.hud-valor-tenue { color: var(--text-secondary); font-weight: 600; }

.hud-vidas { justify-content: space-between; }

.vidas { display: flex; gap: 5px; padding-top: 4px; }

.vidas i {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  background: var(--brand);
  border: 1px solid var(--brand-strong);
  display: block;
}

.vidas i.gastada { background: transparent; border-color: var(--border-strong); }

/* ------------------------------------------------------- carga bar -- */

.carga-fila {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.carga-fila .hud-label { flex: none; }

.carga-pista {
  position: relative;
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.carga-nivel {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--juego-agua);
  transition: width .12s linear, background-color .25s ease;
}

.carga-pista.tibia .carga-nivel { background: #d8a01f; }
.carga-pista.critica .carga-nivel { background: var(--juego-algodon); }

/* La marca del 40 %: por debajo de ahí cada gota vale doble. */
.carga-marca {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 40%;
  width: 2px;
  background: var(--surface-0);
  opacity: .75;
}

.carga-num {
  flex: none;
  min-width: 4ch;
  text-align: right;
  font-size: .84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------- lienzo -- */

.lienzo-caja {
  position: relative;
  border-radius: var(--radius-m);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-m);
  background: var(--surface-inv);
  aspect-ratio: 4 / 5;
}

#lienzo {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* ------------------------------------------------------------ capas -- */

.capa {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 11, 16, .82);
  backdrop-filter: blur(3px);
  text-align: center;
}

/* Aviso de frenesí, encima del lienzo: no empuja el layout al aparecer. */
.frenesi {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(235, 104, 52, .92);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  box-shadow: 0 3px 14px rgba(0, 0, 0, .45);
  pointer-events: none;
}

/* Mismo motivo que .capa[hidden]: display:flex le gana al [hidden]. */
.frenesi[hidden] { display: none; }

.frenesi-pista {
  width: 70px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .35);
  overflow: hidden;
}

.frenesi-pista i { display: block; height: 100%; width: 100%; background: #fff; }

/* `display: grid` de .capa le gana al [hidden] del navegador (misma
   especificidad, gana el que va después), así que hay que apagarlo a mano:
   si no, las capas de pausa y de fin quedan tapando el lienzo siempre. */
.capa[hidden] { display: none; }

.capa-tenue { background: rgba(6, 11, 16, .62); }

.capa-caja { max-width: 34ch; }

.capa-caja h2 {
  color: #fff;
  font-size: clamp(1.3rem, 4.4vw, 1.72rem);
  letter-spacing: -.018em;
  margin: 0 0 .5em;
}

.capa-caja p {
  color: #c8d5e0;
  font-size: .92rem;
  line-height: 1.55;
  margin: 0 0 1.2em;
}

.capa-caja .btn { min-width: 170px; justify-content: center; }

.capa-pie {
  margin: 1em 0 0 !important;
  font-size: .78rem !important;
  color: #7f93a3 !important;
}

.fin-record {
  color: var(--brand-strong) !important;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: .76rem !important;
}

.capa kbd, .teclas kbd, .capa-caja kbd, .regla kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font: 600 .82em var(--font);
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #e6eef5;
}

.teclas kbd, .regla kbd {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ----------------------------------------------------------- mandos -- */

.mandos {
  display: none;
  gap: 10px;
  margin-top: 12px;
}

.mando {
  flex: 1;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mando:active { background: var(--brand-soft); border-color: var(--brand); }
.mando-pausa { flex: 0 0 56px; color: var(--text-secondary); }

.mando-ventilar {
  flex: 1.5;
  flex-direction: row;
  gap: 7px;
  grid-auto-flow: column;
  font-weight: 700;
  font-size: .84rem;
  color: var(--brand-strong);
  border-color: var(--brand);
  background: var(--brand-soft);
}

.mando-ventilar:active { background: var(--brand); color: #fff; }

/* En pantallas táctiles sin teclado, botones grandes debajo del lienzo. */
@media (hover: none) and (pointer: coarse) {
  .mandos { display: flex; }
}

.estado-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ----------------------------------------------------------- reglas -- */

.reglas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.regla { padding: 20px; }

.regla h3 { margin: 12px 0 .4em; font-size: 1.04rem; letter-spacing: -.01em; }
.regla p { margin: 0; font-size: .92rem; color: var(--text-secondary); line-height: 1.6; }

.regla-icono {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.regla-gota { background: var(--series-1-soft); box-shadow: inset 0 0 0 2px var(--juego-agua); }
.regla-carga { background: linear-gradient(90deg, var(--juego-agua) 55%, var(--surface-2) 55%); }
.regla-algodon { background: var(--series-2-soft); box-shadow: inset 0 0 0 2px var(--juego-algodon); }
.regla-frenesi { background: var(--juego-algodon); box-shadow: inset 0 0 0 2px var(--juego-algodon); }

.nota {
  margin: 0;
  max-width: 62ch;
  font-size: .85rem;
  line-height: 1.6;
  color: var(--text-muted);
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.teclas { margin-bottom: 22px; }
.teclas h3 { font-size: 1rem; margin: 0 0 .7em; }
.teclas ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.teclas li { font-size: .9rem; color: var(--text-secondary); }

/* ------------------------------------------------------- responsive -- */

@media (max-width: 520px) {
  .hud { grid-template-columns: repeat(2, 1fr); }
  .carga-fila .hud-label { display: none; }
}

/* El hilo marcado: aparece en la pantalla de fin sólo cuando la partida lo
   ganó. No dice para qué sirve porque no sirve para nada acá. */
.fin-secreto {
  margin: .8rem 0 0; padding: .7rem .8rem;
  border: 1px solid rgba(232,194,74,.5); border-radius: 10px;
  background: rgba(232,194,74,.10); text-align: center;
}
.fin-secreto[hidden] { display: none; }
.fin-secreto p { margin: 0 0 .3rem; font-size: .84rem; }
