/* Chanclazo — hoja de estilo única, sin fuentes ni recursos externos */

:root {
  --fondo: #05060a;
  --panel: #171b28;
  --panel2: #202436;
  --borde: #000000;
  --texto: #e8ecf8;
  --suave: #aab3cc;
  --apagado: #8e98b5;
  --amarillo: #ffd166;
  --amarillo2: #ffc23d;
  --cian: #6fe3ff;
  --verde: #7dff9b;
  --rosa: #ff8bd1;
  --rojo: #ff6b6b;
  --morado: #c39bff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--fondo);
  color: var(--texto);
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", "Courier New", monospace;
  -webkit-tap-highlight-color: transparent;
}

body { overscroll-behavior: none; }

#marco {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 38%, #161a28 0%, #05060a 72%);
}

#marco::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.5) 100%);
}

#lienzo {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  background: #0d0e14;
  box-shadow: 0 0 0 2px #000, 0 0 70px rgba(111, 227, 255, 0.07);
}

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

#hud {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  pointer-events: none;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#hud.oculto { display: none; }

.hud-superior {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 1.15fr) auto;
  gap: 12px;
  align-items: start;
}

.hud-bloque {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.etiqueta {
  font-size: 10px;
  color: var(--suave);
  text-shadow: 0 1px 0 #000, 0 0 6px rgba(0, 0, 0, 0.8);
}

.barra {
  position: relative;
  height: 11px;
  background: #090a10;
  border: 2px solid #000;
  box-shadow: 0 0 0 1px #2b3048 inset;
  overflow: hidden;
}

.barra .relleno {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  background: linear-gradient(180deg, #9dffb6, #2fbf62);
}

.barra-vida.baja .relleno {
  background: linear-gradient(180deg, #ff9c9c, #d92d2d);
}

.barra-exp .relleno {
  background: linear-gradient(180deg, #a6f0ff, #35b7e8);
}

.barra-texto {
  font-size: 10px;
  color: #cfd6ea;
  text-shadow: 0 1px 0 #000;
}

.hud-centro {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.nivel-badge {
  flex: 0 0 auto;
  background: var(--amarillo);
  color: #191b24;
  border: 2px solid #000;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 700;
}

.hud-centro .barra { flex: 1 1 auto; }

.hud-derecha {
  flex-direction: row;
  justify-content: flex-end;
  gap: 12px;
  white-space: nowrap;
  font-size: 13px;
}

.dato {
  color: #e5eaff;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(0, 0, 0, 0.7);
}

.dato b { color: var(--amarillo); }

.hud-jefe {
  width: min(620px, 86%);
  margin: 2px auto 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-jefe.oculto { display: none; }

.jefe-nombre {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #ffb3a7;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 0 #000, 0 0 10px rgba(255, 60, 40, 0.5);
}

.barra-jefe {
  height: 13px;
  border-color: #000;
}

.barra-jefe .relleno {
  background: linear-gradient(180deg, #ff8a7a, #b02121);
}

.hud-botones {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.boton-icono {
  pointer-events: auto;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  width: 42px;
  height: 42px;
  color: var(--texto);
  background: #1d2233;
  border: 3px solid #000;
  border-radius: 8px;
  box-shadow: 0 3px 0 #000;
  cursor: pointer;
}

.boton-icono:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }

/* --------------------------------------------------------- pantallas */

.pantalla {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(35, 40, 62, 0.94), rgba(6, 7, 12, 0.97) 72%);
}

.pantalla.activa { display: flex; }

.pantalla[data-pantalla="nivel"] {
  background: rgba(6, 7, 12, 0.74);
}

.pantalla[data-pantalla="pausa"] {
  background: rgba(6, 7, 12, 0.82);
}

.tarjeta {
  width: min(780px, 100%);
  margin: auto;
  padding: clamp(16px, 3.2vw, 34px);
  background: linear-gradient(180deg, #1a1e2d, #11131d);
  border: 3px solid #000;
  border-radius: 10px;
  box-shadow:
    0 0 0 1px #3a4160 inset,
    0 10px 0 rgba(0, 0, 0, 0.45),
    0 0 90px rgba(111, 227, 255, 0.05);
}

.tarjeta-portada { width: min(700px, 100%); }

.titulo {
  margin: 0 0 6px;
  font-size: clamp(44px, 10vw, 92px);
  line-height: 0.86;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--amarillo);
  text-shadow: 4px 4px 0 #b3452b, 9px 9px 0 #000;
  transform: rotate(-2deg);
  transform-origin: left center;
}

.lema {
  margin: 10px 0 0;
  color: var(--suave);
  font-size: clamp(12px, 1.7vw, 15px);
  line-height: 1.5;
  max-width: 52ch;
}

.subtitulo-pantalla {
  margin: 0 0 6px;
  font-size: clamp(24px, 4.4vw, 38px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--amarillo);
  text-shadow: 3px 3px 0 #000;
}

.pista {
  margin: 0 0 14px;
  color: var(--apagado);
  font-size: 12px;
  line-height: 1.5;
}

.campos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 22px 0 18px;
}

.campos label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9aa4c0;
}

.campos input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  color: #ffffff;
  background: #0b0d16;
  border: 2px solid #3a4160;
  border-radius: 4px;
  outline: none;
}

.campos input::placeholder { color: #5b6482; }

.campos input:focus {
  border-color: var(--amarillo);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.14);
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.acciones.vertical { flex-direction: column; align-items: stretch; }

.boton {
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #161821;
  background: var(--amarillo);
  border: 3px solid #000;
  border-radius: 6px;
  padding: 12px 20px;
  box-shadow: 0 4px 0 #000;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.05s ease, filter 0.1s ease;
}

.boton:hover { filter: brightness(1.07); }

.boton:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #000;
}

.boton-grande {
  font-size: clamp(17px, 2.6vw, 21px);
  padding: 14px 36px;
  background: linear-gradient(180deg, #ffe28f, var(--amarillo2));
}

.boton-secundario {
  background: linear-gradient(180deg, #303751, #232941);
  color: var(--texto);
  box-shadow: 0 4px 0 #000, 0 0 0 1px #4a5378 inset;
  font-size: 13px;
}

.boton-dados {
  background: var(--cian);
  color: #06121a;
  font-size: 22px;
  padding: 9px 16px;
}

.boton:disabled { opacity: 0.55; cursor: progress; }

.enlace {
  display: inline-block;
  margin-top: 18px;
  color: var(--cian);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  border-bottom: 1px dashed rgba(111, 227, 255, 0.5);
  padding-bottom: 2px;
}

.enlace:hover { color: #ffffff; }

/* ------------------------------------------------------- revelación */

.lista-revelacion {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 20px;
}

.fila-revelacion {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px;
  background: #0d101a;
  border: 2px solid #2c3350;
  border-radius: 8px;
}

.marco-sprite {
  flex: 0 0 108px;
  width: 108px;
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #1c2233 0%, #0a0c14 72%);
  border: 2px solid #000;
  border-radius: 6px;
}

.sprite-grande {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.texto-revelacion { min-width: 0; }

.linea-resultado {
  margin: 0;
  font-size: clamp(15px, 2.4vw, 20px);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.linea-en {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--apagado);
  min-height: 1em;
}

.revelacion-1 .linea-resultado { color: var(--verde); }
.revelacion-2 .linea-resultado { color: var(--cian); }
.revelacion-3 .linea-resultado { color: var(--rosa); }

/* ----------------------------------------------------------- cartas */

.cartas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.carta {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  text-align: left;
  font: inherit;
  color: var(--texto);
  background: #141926;
  border: 3px solid #303757;
  border-radius: 8px;
  padding: 16px 14px;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.08s ease, box-shadow 0.08s ease;
}

.carta:hover,
.carta.enfocada {
  border-color: var(--amarillo);
  transform: translateY(-3px);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(255, 209, 102, 0.12);
}

.carta-tecla {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #0d0f16;
  background: var(--amarillo);
  border-radius: 3px;
  padding: 1px 6px;
}

.carta-icono { font-size: 26px; line-height: 1; }

.carta-nombre {
  font-size: 16px;
  font-weight: 700;
  color: #ffe08a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.carta-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #b8c1da;
}

.carta-niveles {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: auto;
  padding-top: 4px;
}

.carta-niveles i {
  display: block;
  width: 14px;
  height: 6px;
  background: #2b3048;
  border: 1px solid #000;
}

.carta-niveles i.lleno { background: var(--cian); }

.carta-niveles em {
  font-style: normal;
  font-size: 10px;
  color: var(--apagado);
  margin-left: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ------------------------------------------------------------- fin */

.marcador {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.marcador div {
  padding: 10px 6px;
  text-align: center;
  background: #0d101a;
  border: 2px solid #2c3350;
  border-radius: 6px;
}

.marcador span {
  display: block;
  font-size: clamp(18px, 3.2vw, 27px);
  font-weight: 700;
  color: var(--cian);
}

.marcador small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--apagado);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.record {
  margin: 0 0 16px;
  text-align: center;
  font-size: 14px;
  color: var(--suave);
}

.record.nuevo {
  color: var(--amarillo);
  font-weight: 700;
  animation: latido 0.9s ease-in-out infinite;
}

@keyframes latido {
  50% { transform: scale(1.04); }
}

/* --------------------------------------------------------- créditos */

.creditos-texto {
  margin: 8px 0 18px;
  padding: 12px 14px;
  background: #0d101a;
  border: 2px solid #2c3350;
  border-left: 5px solid var(--amarillo);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.6;
  color: #dfe5f5;
}

.creditos-audio {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: #0d101a;
  border: 2px solid #2c3350;
  border-left: 5px solid var(--cian);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.6;
  color: #cfd6ea;
}

.creditos-audio ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.creditos-audio li { margin: 2px 0; }

.creditos-audio-titulo { margin: 0; font-weight: 700; color: var(--texto); }

/* ------------------------------------------------------------ aviso */

.aviso {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  max-width: 90vw;
  padding: 10px 16px;
  background: #ffe08a;
  color: #131620;
  border: 3px solid #000;
  border-radius: 6px;
  box-shadow: 0 4px 0 #000;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.aviso.visible { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------- joystick */

.joystick-base,
.joystick-perilla {
  position: fixed;
  display: none;
  z-index: 4;
  border-radius: 50%;
  pointer-events: none;
}

.joystick-base {
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  border: 3px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.joystick-perilla {
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  background: rgba(255, 209, 102, 0.6);
  border: 2px solid rgba(0, 0, 0, 0.55);
}

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

@media (max-width: 720px) {
  #hud { font-size: 10px; padding: 8px; }
  .barra { height: 9px; }
  .hud-superior { gap: 8px; grid-template-columns: minmax(0, 1fr) minmax(84px, 0.9fr) auto; }
  .hud-derecha { gap: 8px; font-size: 11px; }
  .hud-botones { bottom: 10px; right: 10px; }
  .boton-icono { width: 38px; height: 38px; font-size: 14px; }
  .tarjeta { padding: 14px; }
  .acciones { gap: 8px; }
  .boton { padding: 10px 14px; font-size: 13px; }
  .boton-grande { width: 100%; justify-content: center; }
  .boton-dados { width: auto; }
  .marcador { grid-template-columns: repeat(3, 1fr); }
  .fila-revelacion { gap: 10px; }
  .marco-sprite { flex: 0 0 92px; width: 92px; height: 92px; }
}

@media (max-width: 600px) {
  .campos { grid-template-columns: 1fr; gap: 9px; margin: 16px 0 14px; }
  /* 9 letras anchas + sombra + giro: con 12vw cabe en el panel a 360-430 px */
  .titulo { font-size: clamp(34px, 12.5vw, 68px); }
  .pantalla { padding: 10px; }
}

@media (max-width: 700px) {
  .cartas { grid-template-columns: 1fr; gap: 8px; }
  .carta { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .carta-desc { flex-basis: 100%; }
  .carta-niveles { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .record.nuevo { animation: none; }
  .carta, .boton { transition: none; }
}
