/* ============================================================
   TACTICS EBROS — Bosque de Ceniza
   Estilos generales, tablero, unidades, panel lateral y modales
   ============================================================ */

:root {
  --bg-0: #090d11;
  --bg-1: #0f161d;
  --panel: #141c25;
  --panel-2: #1a2430;
  --panel-3: #202c3a;
  --linea: #2b3a49;
  --linea-suave: #22303d;
  --texto: #ece8dd;
  --texto-suave: #9aa7b3;
  --texto-tenue: #6c7b88;
  --oro: #e8c879;
  --oro-fuerte: #c99a42;
  --oro-borde: rgba(232, 200, 121, 0.4);
  --verde: #62d98a;
  --rojo: #f06b6b;
  --rojo-oscuro: #a83232;
  --azul: #6cb8ff;
  --violeta: #b98cff;
  --sombra: 0 18px 48px rgba(0, 0, 0, 0.55);
  --radio: 14px;
  --celda: clamp(36px, calc((100vh - 250px) / 10), 58px);
  --fuente-titulo: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --fuente-cuerpo: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(52, 94, 74, 0.22), transparent 45%),
    radial-gradient(circle at 85% 12%, rgba(71, 48, 92, 0.18), transparent 42%),
    radial-gradient(circle at 50% 115%, rgba(176, 124, 48, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  color: var(--texto);
  font-family: var(--fuente-cuerpo);
  font-size: 15px;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.28;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px),
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 46px 46px, 23px 23px;
  background-position: 0 0, 11px 11px;
  mask-image: radial-gradient(circle at 50% 40%, black 0%, transparent 78%);
}

button {
  font-family: inherit;
}

/* ------------------------------ Cabecera ------------------------------ */

.app {
  position: relative;
  z-index: 1;
  padding: 18px 26px 36px;
  max-width: 1320px;
  margin: 0 auto;
}

.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 4px 16px;
}

.marca {
  display: flex;
  align-items: center;
  gap: 13px;
}

.marca-icono {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 22px;
  color: var(--oro);
  background: linear-gradient(160deg, #26333c, #141b22);
  border: 1px solid var(--oro-borde);
  box-shadow: inset 0 0 18px rgba(232, 200, 121, 0.08), 0 8px 18px rgba(0, 0, 0, 0.35);
}

.marca h1 {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #f6e7bb, var(--oro) 55%, #a97c2c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.05;
}

.marca p {
  margin: 4px 0 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--texto-tenue);
}

.pildora-turno {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--linea);
  background: linear-gradient(180deg, rgba(32, 44, 58, 0.9), rgba(18, 25, 33, 0.9));
  color: var(--oro);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.pildora-turno.enemigo {
  color: var(--rojo);
  border-color: rgba(240, 107, 107, 0.4);
}

/* ------------------------------ Layout ------------------------------ */

.contenido {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 22px;
}

.zona-tablero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.marco-tablero {
  position: relative;
  padding: 11px;
  border-radius: 18px;
  background:
    linear-gradient(150deg, rgba(232, 200, 121, 0.16), transparent 30%),
    linear-gradient(180deg, #1c2732, #111820);
  border: 1px solid var(--oro-borde);
  box-shadow: var(--sombra), inset 0 0 40px rgba(0, 0, 0, 0.45);
}

.marco-tablero::before,
.marco-tablero::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(232, 200, 121, 0.5);
  pointer-events: none;
}

.marco-tablero::before {
  top: 4px;
  left: 4px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 8px;
}

.marco-tablero::after {
  bottom: 4px;
  right: 4px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 8px;
}

.tablero {
  display: grid;
  grid-template-columns: repeat(10, var(--celda));
  grid-template-rows: repeat(10, var(--celda));
  gap: 2px;
  border-radius: 10px;
  overflow: hidden;
  background: #0a0f13;
  user-select: none;
}

.pista {
  margin: 0;
  max-width: 560px;
  text-align: center;
  font-size: 12.5px;
  color: var(--texto-tenue);
  line-height: 1.5;
}

/* ------------------------------ Celdas ------------------------------ */

.celda {
  position: relative;
  width: var(--celda);
  height: var(--celda);
  background: linear-gradient(145deg, #3d5a3d, #334b34);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.celda.oscura {
  background: linear-gradient(145deg, #385435, #2f472f);
}

.celda.roca {
  background: linear-gradient(145deg, #4a4a43, #373730);
}

.celda.arbol {
  background: linear-gradient(145deg, #2f4a2e, #263c27);
}

.celda.agua {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 45%),
    linear-gradient(160deg, #1d4d63, #17394c);
}

.celda.agua::after {
  content: "";
  position: absolute;
  inset: 12% 10%;
  border-radius: 40%;
  border-top: 1px solid rgba(160, 220, 255, 0.24);
  border-bottom: 1px solid rgba(0, 0, 0, 0.18);
  opacity: 0.8;
  animation: brilloAgua 5s ease-in-out infinite;
}

@keyframes brilloAgua {
  0%, 100% { transform: translateY(-1px) scaleX(1); opacity: 0.45; }
  50% { transform: translateY(1px) scaleX(0.94); opacity: 0.85; }
}

.decoracion {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  font-size: calc(var(--celda) * 0.62);
  line-height: 1;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.celda.roca .decoracion {
  font-size: calc(var(--celda) * 0.58);
  filter: grayscale(0.2) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.5));
}

.celda.arbol .decoracion {
  font-size: calc(var(--celda) * 0.78);
  transform: translateY(-2px);
}

.celda.movible {
  cursor: pointer;
  box-shadow:
    inset 0 0 0 2px rgba(98, 217, 138, 0.65),
    inset 0 0 16px rgba(98, 217, 138, 0.18);
}

.celda.movible::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(circle, rgba(98, 217, 138, 0.26), rgba(98, 217, 138, 0.08));
  animation: pulsoCasilla 1.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulsoCasilla {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.85; }
}

.celda.movible:hover {
  box-shadow:
    inset 0 0 0 2px var(--verde),
    inset 0 0 22px rgba(98, 217, 138, 0.4);
}

.celda.atacable {
  cursor: crosshair;
  box-shadow:
    inset 0 0 0 2px rgba(240, 107, 107, 0.4),
    inset 0 0 14px rgba(240, 107, 107, 0.1);
}

.celda.atacable:hover {
  box-shadow:
    inset 0 0 0 2px rgba(240, 107, 107, 0.85),
    inset 0 0 20px rgba(240, 107, 107, 0.28);
}

.celda.con-heroe {
  cursor: pointer;
}

.celda.seleccionada {
  box-shadow: inset 0 0 0 2px rgba(232, 200, 121, 0.9), inset 0 0 20px rgba(232, 200, 121, 0.22);
}

.celda.objetivo {
  box-shadow: inset 0 0 0 2px var(--rojo), inset 0 0 24px rgba(240, 107, 107, 0.4);
  animation: pulsoObjetivo 1.1s ease-in-out infinite;
}

@keyframes pulsoObjetivo {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(240, 107, 107, 0.85), inset 0 0 18px rgba(240, 107, 107, 0.3); }
  50% { box-shadow: inset 0 0 0 3px var(--rojo), inset 0 0 26px rgba(240, 107, 107, 0.5); }
}

/* ------------------------------ Unidades ------------------------------ */

.unidad {
  position: absolute;
  inset: 2%;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 5px 4px rgba(0, 0, 0, 0.45));
}

.unidad svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  animation: respirar 3.6s ease-in-out infinite;
}

.unidad.enemigo svg {
  animation-duration: 4.4s;
}

@keyframes respirar {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-1.5px) scale(1.012); }
}

.unidad.en-alcance svg {
  filter: drop-shadow(0 0 5px rgba(240, 107, 107, 0.9));
}

.unidad.en-alcance::after {
  content: "";
  position: absolute;
  inset: 7%;
  z-index: -1;
  border-radius: 50%;
  border: 2px solid rgba(240, 107, 107, 0.6);
  animation: anilloPeligro 1.3s ease-in-out infinite;
}

@keyframes anilloPeligro {
  0%, 100% { transform: scale(0.9); opacity: 0.25; }
  50% { transform: scale(1.04); opacity: 0.85; }
}

.unidad.activa svg {
  filter: drop-shadow(0 0 8px rgba(232, 200, 121, 0.95));
  animation: enemigoActivo 0.7s ease-in-out infinite;
}

@keyframes enemigoActivo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.unidad.golpeado svg {
  animation: flashGolpe 0.32s ease-out;
}

@keyframes flashGolpe {
  0% { filter: brightness(2.6) saturate(0.2); transform: translateX(-2px); }
  35% { filter: brightness(2.2) saturate(0.4); transform: translateX(3px); }
  70% { transform: translateX(-1px); }
  100% { filter: none; transform: translateX(0); }
}

.vida-mini {
  position: absolute;
  left: 13%;
  right: 13%;
  bottom: -2px;
  z-index: 6;
  height: 5px;
  border-radius: 3px;
  background: rgba(5, 8, 10, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.vida-mini i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--verde);
  transition: width 0.25s ease, background 0.25s ease;
}

/* ------------------------------ Panel lateral ------------------------------ */

.lateral {
  flex: 0 0 336px;
  width: 336px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tarjeta {
  position: relative;
  padding: 15px;
  border-radius: var(--radio);
  border: 1px solid var(--linea);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 30%),
    linear-gradient(170deg, var(--panel-2), var(--panel));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.tarjeta-heroe {
  border-color: var(--oro-borde);
  background:
    radial-gradient(circle at 100% 0%, rgba(232, 200, 121, 0.1), transparent 46%),
    linear-gradient(170deg, #1d2731, #131a21);
}

.heroe-cabecera {
  display: flex;
  align-items: center;
  gap: 13px;
}

.retrato {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border-radius: 12px;
  border: 1px solid rgba(232, 200, 121, 0.3);
  background:
    radial-gradient(circle at 50% 110%, rgba(232, 200, 121, 0.15), transparent 60%),
    linear-gradient(160deg, #22303b, #10161d);
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

.retrato svg {
  width: 100%;
  height: 100%;
  padding: 4px;
}

.rol {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--oro-fuerte);
}

.heroe-datos h2 {
  margin: 3px 0 6px;
  font-family: var(--fuente-titulo);
  font-size: 22px;
  line-height: 1;
  color: var(--texto);
}

.etiquetas {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.etiqueta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid var(--linea);
  background: rgba(10, 15, 20, 0.4);
  color: var(--texto-suave);
  white-space: nowrap;
}

.etiqueta.cuerpo {
  color: #ffb27a;
  border-color: rgba(255, 178, 122, 0.35);
  background: rgba(255, 178, 122, 0.08);
}

.etiqueta.distancia {
  color: #7ce0d3;
  border-color: rgba(124, 224, 211, 0.35);
  background: rgba(124, 224, 211, 0.08);
}

.etiqueta.dos-manos {
  color: var(--oro);
  border-color: var(--oro-borde);
  background: rgba(232, 200, 121, 0.08);
}

.vida-grande {
  margin-top: 14px;
}

.fila-vida {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--texto-tenue);
}

.fila-vida strong {
  color: var(--texto);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.barra-grande {
  height: 10px;
  border-radius: 6px;
  background: #0a0f13;
  border: 1px solid rgba(0, 0, 0, 0.45);
  overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6);
}

.barra-grande i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3fb56b, var(--verde));
  border-radius: 5px;
  transition: width 0.35s ease, background 0.35s ease;
  box-shadow: 0 0 8px rgba(98, 217, 138, 0.35);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 4px;
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.45);
  border: 1px solid var(--linea-suave);
}

.stat-chip small {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--texto-tenue);
}

.stat-chip strong {
  font-size: 15px;
  color: var(--texto);
}

.stat-chip strong.bonus {
  color: var(--oro);
}

.arma-linea {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--linea-suave);
  font-size: 12px;
  color: var(--texto-suave);
  display: flex;
  align-items: center;
  gap: 7px;
  line-height: 1.4;
}

.arma-linea b {
  color: var(--texto);
  font-weight: 600;
}

.fila-acciones {
  display: flex;
  gap: 6px;
  margin-top: 11px;
}

.chip-estado {
  flex: 1;
  padding: 6px 9px;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.03em;
  color: var(--verde);
  border: 1px solid rgba(98, 217, 138, 0.3);
  background: rgba(98, 217, 138, 0.08);
  transition: all 0.2s ease;
}

.chip-estado.usado {
  color: var(--texto-tenue);
  border-color: var(--linea-suave);
  background: rgba(10, 14, 18, 0.35);
  text-decoration: line-through;
}

.botones-accion {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 11px;
}

.mini-botones {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  gap: 8px;
}

/* ------------------------------ Botones ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease, border-color 0.18s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.btn:focus-visible,
.btn-texto:focus-visible,
.cerrar-panel:focus-visible,
.tarjeta-clase:focus-visible {
  outline: 2px solid var(--oro);
  outline-offset: 2px;
}

.btn-dorado {
  background: linear-gradient(180deg, #f0d694, #d3a94f 55%, #b3822f);
  color: #241a08;
  border-color: rgba(255, 232, 170, 0.55);
  box-shadow: 0 6px 16px rgba(202, 154, 66, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-dorado:hover:not(:disabled) {
  filter: brightness(1.07);
  box-shadow: 0 8px 22px rgba(202, 154, 66, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-suave {
  background: linear-gradient(180deg, #263442, #1a242e);
  color: var(--texto);
  border-color: var(--linea);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.btn-suave:hover:not(:disabled) {
  border-color: #41566a;
  filter: brightness(1.1);
}

.btn-rojo {
  background: linear-gradient(180deg, #d95858, #a93232);
  color: #fff5f0;
  border-color: rgba(255, 160, 150, 0.4);
  box-shadow: 0 6px 16px rgba(169, 50, 50, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-rojo:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 8px 22px rgba(169, 50, 50, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-grande {
  padding: 14px 34px;
  font-size: 15px;
  border-radius: 11px;
}

.btn-texto {
  padding: 3px 2px;
  border: none;
  background: none;
  color: var(--texto-tenue);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.16s ease;
}

.btn-texto:hover {
  color: var(--oro);
}

.contador {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(9, 14, 18, 0.55);
  font-size: 11px;
  color: var(--oro);
}

/* ------------------------------ Enemigos / registro ------------------------------ */

.titulo-seccion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.titulo-seccion h3 {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--texto);
}

.contador-enemigos {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--texto-tenue);
}

.lista-enemigos {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.enemigo-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(8, 12, 16, 0.32);
  border: 1px solid var(--linea-suave);
  transition: opacity 0.25s ease, border-color 0.2s ease;
}

.enemigo-item.muerto {
  opacity: 0.38;
}

.enemigo-item.muerto .enemigo-nombre {
  text-decoration: line-through;
}

.enemigo-punto {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rojo);
  box-shadow: 0 0 7px rgba(240, 107, 107, 0.7);
}

.enemigo-item.muerto .enemigo-punto {
  background: var(--texto-tenue);
  box-shadow: none;
}

.enemigo-info {
  flex: 1;
  min-width: 0;
}

.enemigo-nombre {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--texto);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.enemigo-nombre small {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--texto-tenue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.barra-enemigo {
  margin-top: 4px;
  height: 4px;
  border-radius: 2px;
  background: rgba(5, 8, 10, 0.75);
  overflow: hidden;
}

.barra-enemigo i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #d24a4a, #f06b6b);
  transition: width 0.25s ease;
}

.enemigo-vida {
  flex: 0 0 auto;
  min-width: 34px;
  text-align: right;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--texto-suave);
}

.tarjeta-log {
  min-height: 130px;
}

.log {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 156px;
  overflow-y: auto;
  padding-right: 4px;
  font-size: 11.5px;
  line-height: 1.45;
}

.log::-webkit-scrollbar {
  width: 5px;
}

.log::-webkit-scrollbar-thumb {
  background: #354757;
  border-radius: 3px;
}

.entrada-log {
  padding: 4px 7px 4px 8px;
  border-left: 2px solid var(--linea);
  border-radius: 0 5px 5px 0;
  color: var(--texto-suave);
  background: rgba(9, 14, 18, 0.22);
}

.entrada-log.jugador {
  border-left-color: var(--verde);
  color: #bfe9cc;
}

.entrada-log.enemigo {
  border-left-color: var(--rojo);
  color: #f0c0bd;
}

.entrada-log.critico {
  border-left-color: var(--oro);
  color: #f5dda2;
  background: rgba(232, 200, 121, 0.07);
}

.entrada-log.sistema {
  border-left-color: #4a6072;
  color: var(--texto-tenue);
  font-style: italic;
}

/* ------------------------------ Banner de turno ------------------------------ */

.banner-turno {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 18px;
  background: radial-gradient(circle, rgba(6, 10, 14, 0.62), rgba(6, 10, 14, 0.2) 70%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.banner-turno.visible {
  opacity: 1;
  visibility: visible;
}

.banner-turno span {
  font-family: var(--fuente-titulo);
  font-size: clamp(22px, 4vw, 38px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--oro);
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.8), 0 0 32px rgba(232, 200, 121, 0.35);
}

.banner-turno small {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--texto-suave);
}

/* ------------------------------ Proyectiles / daño flotante ------------------------------ */

.proyectil {
  position: absolute;
  z-index: 25;
  width: 8px;
  height: 8px;
  pointer-events: none;
}

.proyectil .flecha {
  position: absolute;
  left: -11px;
  top: -1.5px;
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--pc, #f5d68a);
  box-shadow: 0 0 8px var(--pc, #f5d68a);
}

.proyectil .flecha::after {
  content: "";
  position: absolute;
  right: -5px;
  top: -3px;
  border-left: 6px solid var(--pc, #f5d68a);
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
}

.proyectil .orbe {
  position: absolute;
  left: -8px;
  top: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--pc, #b98cff) 45%, rgba(90, 40, 150, 0.2) 75%);
  box-shadow: 0 0 12px 3px var(--pc, #b98cff);
}

.dano-contenedor {
  position: absolute;
  z-index: 35;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.dano-flotante {
  display: block;
  font-family: var(--fuente-titulo);
  font-size: 20px;
  font-weight: 800;
  color: #ff9a8f;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 12px rgba(240, 107, 107, 0.5);
  white-space: nowrap;
  animation: flotarDano 1s ease-out forwards;
}

.dano-flotante.critico {
  font-size: 23px;
  color: var(--oro);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 16px rgba(232, 200, 121, 0.75);
}

.dano-flotante.curacion {
  color: var(--verde);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 12px rgba(98, 217, 138, 0.6);
}

@keyframes flotarDano {
  0% { opacity: 0; transform: translateY(8px) scale(0.65); }
  18% { opacity: 1; transform: translateY(0) scale(1.1); }
  38% { transform: translateY(-5px) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(0.98); }
}

.marco-tablero.sacudida {
  animation: sacudida 0.38s ease-out;
}

@keyframes sacudida {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-5px, 2px); }
  30% { transform: translate(4px, -2px); }
  45% { transform: translate(-3px, 1px); }
  60% { transform: translate(2px, -1px); }
  80% { transform: translate(-1px, 0); }
}

/* ------------------------------ Pantalla de clases ------------------------------ */

.pantalla-clases {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow-y: auto;
  padding: 34px 24px 44px;
  background:
    radial-gradient(circle at 20% 0%, rgba(44, 92, 68, 0.3), transparent 47%),
    radial-gradient(circle at 85% 10%, rgba(88, 55, 110, 0.26), transparent 45%),
    radial-gradient(circle at 50% 120%, rgba(170, 121, 45, 0.16), transparent 55%),
    linear-gradient(180deg, #0a0f14, #0d141b 60%, #0a0f14);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.pantalla-clases.oculta {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.contenido-clases {
  max-width: 1160px;
  margin: 0 auto;
  padding-bottom: 150px;
}

.cabecera-clases {
  text-align: center;
  margin-bottom: 28px;
}

.sobretitulo {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--oro-fuerte);
}

.cabecera-clases h2 {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: clamp(30px, 5.2vw, 52px);
  line-height: 1.05;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #f8edc9, var(--oro) 55%, #a87d31);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 40px rgba(232, 200, 121, 0.12);
}

.subtitulo {
  max-width: 640px;
  margin: 12px auto 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--texto-suave);
}

.grid-clases {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.tarjeta-clase {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--linea);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 32%),
    linear-gradient(170deg, #1a242e, #111820);
  color: var(--texto);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.tarjeta-clase:hover {
  transform: translateY(-4px);
  border-color: #42586c;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4);
}

.tarjeta-clase.elegida {
  border-color: var(--oro);
  box-shadow: 0 0 0 1px rgba(232, 200, 121, 0.55), 0 18px 40px rgba(0, 0, 0, 0.45), inset 0 0 40px rgba(232, 200, 121, 0.05);
  transform: translateY(-4px);
}

.tarjeta-clase.elegida::after {
  content: "✓";
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f0d694, #c8993f);
  color: #241a08;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.clase-sprite {
  position: relative;
  height: 132px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 82%, rgba(232, 200, 121, 0.13), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent);
  border-bottom: 1px solid var(--linea-suave);
}

.clase-sprite::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 100px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  filter: blur(6px);
  transform: translateX(-50%);
}

.clase-sprite svg {
  position: relative;
  z-index: 1;
  width: 112px;
  height: 112px;
  margin-top: 4px;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.4));
}

.clase-cuerpo {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px 15px 16px;
}

.clase-titulo-linea {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.clase-titulo-linea h3 {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: 20px;
  line-height: 1.1;
}

.clase-rol {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--oro-fuerte);
  white-space: nowrap;
}

.clase-etiquetas {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.clase-desc {
  margin: 0;
  min-height: 51px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--texto-suave);
}

.stats-clase {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 0;
  border-top: 1px solid var(--linea-suave);
  border-bottom: 1px solid var(--linea-suave);
}

.stat-fila {
  display: grid;
  grid-template-columns: 56px 1fr 38px;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  color: var(--texto-tenue);
}

.stat-fila b {
  text-align: right;
  font-size: 11.5px;
  color: var(--texto);
}

.stat-pista {
  height: 4px;
  border-radius: 2px;
  background: rgba(7, 11, 15, 0.8);
  overflow: hidden;
}

.stat-pista i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #6b8c5d, #9dc27b);
}

.stat-fila.danio .stat-pista i {
  background: linear-gradient(90deg, #b78c3d, var(--oro));
}

.stat-fila.vida .stat-pista i {
  background: linear-gradient(90deg, #a83b3b, #e26464);
}

.stat-fila.defensa .stat-pista i {
  background: linear-gradient(90deg, #416d8c, #6cb8ff);
}

.clase-perk {
  display: flex;
  gap: 6px;
  margin: 0;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--oro);
}

.pie-clases {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 24px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(10, 15, 20, 0.6), rgba(10, 15, 20, 0.97) 32%);
  border-top: 1px solid rgba(43, 58, 73, 0.8);
  backdrop-filter: blur(10px);
}

.nota-clases {
  margin: 0;
  max-width: 720px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--texto-tenue);
}

/* ------------------------------ Panel de combate ------------------------------ */

.panel-combate {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 70;
  width: min(660px, calc(100vw - 30px));
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--oro-borde);
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 200, 121, 0.08), transparent 45%),
    linear-gradient(170deg, #1e2934, #121920 70%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translate(-50%, 24px) scale(0.98);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.panel-combate.visible {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.combate-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.etiqueta-tipo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.etiqueta-tipo.cuerpo {
  color: #ffb27a;
  border: 1px solid rgba(255, 178, 122, 0.4);
  background: rgba(255, 178, 122, 0.1);
}

.etiqueta-tipo.distancia {
  color: #7ce0d3;
  border: 1px solid rgba(124, 224, 211, 0.4);
  background: rgba(124, 224, 211, 0.1);
}

.cerrar-panel {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--linea);
  background: rgba(9, 14, 18, 0.4);
  color: var(--texto-tenue);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.cerrar-panel:hover {
  color: var(--texto);
  border-color: #4a5f71;
}

.combate-fichas {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}

.ficha-combate {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.ficha-enemigo {
  flex-direction: row-reverse;
  text-align: right;
}

.mini-retrato {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 10px;
  border: 1px solid var(--oro-borde);
  background: linear-gradient(160deg, #22303b, #0f151b);
  overflow: hidden;
}

.ficha-enemigo .mini-retrato {
  border-color: rgba(240, 107, 107, 0.35);
}

.mini-retrato svg {
  width: 100%;
  height: 100%;
  padding: 2px;
}

.ficha-combate strong {
  display: block;
  font-size: 13px;
  color: var(--texto);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ficha-combate small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--texto-tenue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vs {
  font-family: var(--fuente-titulo);
  font-size: 12px;
  font-weight: 700;
  color: var(--oro-fuerte);
  letter-spacing: 0.1em;
}

.combate-datos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 13px;
}

.fila-dato {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 7px;
  background: rgba(8, 12, 16, 0.36);
  border: 1px solid var(--linea-suave);
  font-size: 11px;
  color: var(--texto-tenue);
}

.fila-dato strong {
  font-size: 11.5px;
  color: var(--texto);
  text-align: right;
}

.fila-dato strong.dorado {
  color: var(--oro);
  font-size: 13px;
}

.combate-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-pelear {
  min-width: 148px;
}

/* ------------------------------ Fin de partida ------------------------------ */

.overlay-fin {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 7, 10, 0.78);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.overlay-fin.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-fin {
  width: min(500px, 100%);
  padding: 30px 30px 26px;
  text-align: center;
  border-radius: 18px;
  border: 1px solid var(--oro-borde);
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 200, 121, 0.12), transparent 50%),
    linear-gradient(170deg, #1d2832, #111820);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.35s ease;
}

.overlay-fin.visible .modal-fin {
  transform: translateY(0) scale(1);
}

.icono-fin {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  font-size: 34px;
  border: 1px solid var(--oro-borde);
  background: radial-gradient(circle at 50% 35%, rgba(232, 200, 121, 0.2), rgba(10, 15, 20, 0.5));
  box-shadow: 0 0 30px rgba(232, 200, 121, 0.12);
}

.modal-fin h2 {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: 34px;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #f8edc9, var(--oro) 60%, #a87d31);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.modal-fin h2.derrota {
  background: linear-gradient(180deg, #ffd2c9, #e06a5e 60%, #943c36);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#fin-texto {
  margin: 10px auto 0;
  max-width: 380px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--texto-suave);
}

.stats-fin {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 22px;
}

.stat-fin {
  min-width: 104px;
  padding: 9px 13px;
  border-radius: 9px;
  border: 1px solid var(--linea-suave);
  background: rgba(8, 12, 16, 0.34);
}

.stat-fin small {
  display: block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--texto-tenue);
}

.stat-fin strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  color: var(--texto);
}

.acciones-fin {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
}

/* ------------------------------ Toast ------------------------------ */

.toast {
  position: fixed;
  top: 88px;
  left: 50%;
  z-index: 120;
  transform: translate(-50%, -8px);
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid var(--oro-borde);
  background: rgba(16, 23, 30, 0.96);
  color: var(--oro);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

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

/* ------------------------------ Responsive ------------------------------ */

@media (max-width: 1120px) {
  .app {
    padding: 16px 20px 32px;
  }

  .contenido {
    flex-direction: column;
    align-items: center;
  }

  .lateral {
    flex: none;
    width: min(640px, 100%);
  }

  .zona-tablero {
    max-width: 100%;
  }

  :root {
    --celda: clamp(32px, min(calc((100vw - 100px) / 10), calc((100vh - 220px) / 10)), 58px);
  }

  .grid-clases {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 820px;
    margin: 0 auto;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 12px 12px 26px;
  }

  .cabecera {
    padding-bottom: 12px;
  }

  .marca-icono {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }

  .marca p {
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  .pildora-turno {
    padding: 8px 12px;
    font-size: 11px;
  }

  :root {
    --celda: clamp(26px, min(calc((100vw - 58px) / 10), calc((100vh - 200px) / 10)), 50px);
  }

  .marco-tablero {
    padding: 8px;
    border-radius: 14px;
  }

  .lateral {
    width: 100%;
  }

  .pista {
    font-size: 11.5px;
  }

  .contenido-clases {
    padding-bottom: 190px;
  }

  .grid-clases {
    grid-template-columns: 1fr;
    max-width: 430px;
  }

  .nota-clases {
    font-size: 11px;
    line-height: 1.45;
  }

  .clase-sprite {
    height: 118px;
  }

  .clase-desc {
    min-height: 0;
  }

  .combate-fichas {
    grid-template-columns: 1fr auto 1fr;
  }

  .combate-datos {
    grid-template-columns: 1fr;
  }

  .panel-combate {
    bottom: 10px;
    padding: 13px;
  }

  .combate-acciones {
    justify-content: stretch;
  }

  .combate-acciones .btn {
    flex: 1;
  }

  .modal-fin {
    padding: 24px 20px 22px;
  }

  .modal-fin h2 {
    font-size: 28px;
  }
}

@media (max-width: 430px) {
  .marca h1 {
    font-size: 20px;
  }

  .cabecera {
    gap: 8px;
  }

  .pildora-turno {
    padding: 7px 10px;
    font-size: 10px;
  }

  .retrato {
    width: 64px;
    height: 64px;
  }

  .heroe-datos h2 {
    font-size: 19px;
  }

  .ficha-combate small {
    font-size: 9px;
  }

  .mini-retrato {
    width: 42px;
    height: 42px;
  }

  .vs {
    font-size: 10px;
  }
}
