:root {
  --tinta: #1b1b2f;
  --papel: #fffaf0;
  --fondo: #141428;
  --azul: #4cc9f0;
  --rosa: #f72585;
  --amarillo: #ffd166;
  --verde: #06d6a0;
  --gris: #8d99ae;
  --sombra: 0 6px 0 rgba(0, 0, 0, 0.25);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--fondo);
  color: var(--papel);
}

body { padding-bottom: env(safe-area-inset-bottom); }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; touch-action: manipulation; }

.pantalla {
  min-height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pantalla[hidden] { display: none; }

.pantalla.flotante {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 20, 40, 0.92);
  justify-content: center;
  overflow: auto;
}

h1 {
  font-size: 44px;
  margin: 24px 0 0;
  color: var(--amarillo);
  text-shadow: 4px 4px 0 var(--tinta);
  text-align: center;
  transform: rotate(-2deg);
}

h2 {
  font-size: 20px;
  margin: 8px 0 0;
}

h2 small { font-weight: 400; opacity: 0.7; font-size: 14px; }

.sub { text-align: center; opacity: 0.8; margin: 0; }

.etiqueta {
  display: block;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
  opacity: 0.7;
}

.nota { font-size: 13px; opacity: 0.75; margin: 0; }

.tarjeta {
  background: var(--papel);
  color: var(--tinta);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 4px solid var(--tinta);
  box-shadow: var(--sombra);
}

.tarjeta .nota { opacity: 0.7; }

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 700;
  font-size: 14px;
}

label small { font-weight: 400; opacity: 0.7; }

input, select, textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 3px solid var(--tinta);
  background: #fff;
  color: var(--tinta);
  font-size: 18px;
  width: 100%;
}

#codigo { text-transform: uppercase; letter-spacing: 6px; font-weight: 800; }

.pantalla-batalla select, .panel select, .panel textarea, .panel input {
  background: rgba(255, 255, 255, 0.08);
  color: var(--papel);
  border-color: rgba(255, 255, 255, 0.2);
}

.primario, .secundario {
  padding: 14px 18px;
  border-radius: 14px;
  border: 3px solid var(--tinta);
  font-weight: 800;
  font-size: 18px;
  box-shadow: var(--sombra);
  transition: transform 0.05s;
}

.primario { background: var(--amarillo); color: var(--tinta); }
.secundario { background: #fff; color: var(--tinta); }
.primario:active, .secundario:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
.primario:disabled, .secundario:disabled { opacity: 0.45; box-shadow: none; }
.primario.grande { font-size: 22px; padding: 16px; }

.cabecera, .barra-superior {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.cabecera strong { font-size: 28px; letter-spacing: 4px; }
.derecha { text-align: right; }

.compartir {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 10px;
}

.compartir img { width: 110px; border-radius: 10px; border: 5px solid #fff; }
.compartir p { font-size: 13px; margin: 0; }

.rejilla-personajes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding-bottom: 110px;
}

.personaje-carta {
  background: rgba(255, 255, 255, 0.08);
  border: 3px solid transparent;
  border-radius: 16px;
  padding: 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: inherit;
  position: relative;
}

.personaje-carta canvas { width: 100%; height: 90px; display: block; }
.personaje-carta strong { font-size: 15px; }
.personaje-carta small { font-size: 12px; opacity: 0.8; line-height: 1.3; }
.personaje-carta.elegido { border-color: var(--amarillo); background: rgba(255, 209, 102, 0.15); }
.personaje-carta.bloqueado { opacity: 0.5; }
.personaje-carta .candado {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--tinta);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
}
.personaje-carta .orden {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--amarillo);
  color: var(--tinta);
  font-weight: 900;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.acciones-fijas {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--fondo) 30%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.acciones-fijas .primario { width: 100%; }

.barra-superior {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--fondo);
  padding: 4px 0 8px;
  margin: -16px -16px 0;
  padding-left: 16px;
  padding-right: 16px;
}

.deys strong { font-size: 30px; color: var(--amarillo); }

.turno-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.turno-info strong { font-size: 14px; }
.turno-info span { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.turno-info span.urgente { color: var(--rosa); }
.turno-info.mio strong { color: var(--verde); }

.mapa-contenedor {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid var(--tinta);
  background: #7fc8f8;
  box-shadow: var(--sombra);
}

#mapa { display: block; width: 100%; height: auto; touch-action: none; }

.mapa-aviso {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 20, 40, 0.55);
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  padding: 12px;
}

.mapa-aviso[hidden] { display: none; }

.controles { display: flex; flex-direction: column; gap: 8px; }
.controles[hidden] { display: none; }

.movimiento {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 8px;
  align-items: center;
}

.movimiento .barra-mov { grid-column: 1 / -1; }

.movimiento .poder {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 3px solid var(--tinta);
  background: linear-gradient(135deg, #c77dff, #7b2cbf);
  color: #fff;
  box-shadow: var(--sombra);
}

.movimiento .poder strong { font-size: 17px; }
.movimiento .poder small { font-size: 12px; opacity: 0.9; }
.movimiento .poder:disabled { background: rgba(255, 255, 255, 0.12); color: var(--papel); opacity: 0.7; box-shadow: none; }
.movimiento .poder:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }

.redondo {
  padding: 12px;
  border-radius: 14px;
  border: 3px solid var(--tinta);
  background: #fff;
  color: var(--tinta);
  font-weight: 900;
  font-size: 20px;
  box-shadow: var(--sombra);
}

.redondo:active { transform: translateY(3px); box-shadow: none; }
.redondo.salto { background: var(--verde); }
.redondo.activa { background: var(--amarillo); }

.barra-mov {
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  overflow: hidden;
}

.barra-mov i { display: block; height: 100%; background: var(--verde); width: 100%; transition: width 0.2s; }

.pestañas {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 0 16px;
}

.pestañas::-webkit-scrollbar { display: none; }

.pestañas button {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  font-weight: 700;
  font-size: 14px;
}

.pestañas button.activa { background: var(--papel); color: var(--tinta); border-color: var(--papel); }

.panel { display: flex; flex-direction: column; gap: 10px; }
.panel[hidden] { display: none; }

.lista { display: flex; flex-direction: column; gap: 8px; }

.fila {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  border: 3px solid transparent;
}

.fila.seleccionada { border-color: var(--amarillo); }
.fila.bloqueada { opacity: 0.5; }
.fila.muerta { opacity: 0.4; }
.fila strong { font-size: 15px; display: block; }
.fila small { font-size: 12px; opacity: 0.75; display: block; }
.fila .acciones { display: flex; gap: 6px; align-items: center; }
.fila .acciones button {
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid var(--tinta);
  background: #fff;
  color: var(--tinta);
  font-weight: 800;
  font-size: 13px;
  min-width: 44px;
}
.fila .acciones button.comprar { background: var(--amarillo); }
.fila .acciones button:disabled { opacity: 0.4; }
.fila .cantidad { font-weight: 900; font-size: 18px; min-width: 28px; text-align: center; }
.fila .vida { height: 8px; background: rgba(255, 255, 255, 0.15); border-radius: 6px; overflow: hidden; margin-top: 4px; }
.fila .vida i { display: block; height: 100%; background: var(--verde); }
.fila .vida i.baja { background: var(--amarillo); }
.fila .vida i.critica { background: var(--rosa); }

.apuntar { display: flex; flex-direction: column; gap: 10px; }
.apuntar label { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.apuntar label input { flex-basis: 100%; }
.apuntar output { color: var(--amarillo); font-weight: 900; }

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 36px;
  background: transparent;
  padding: 0;
  border: none;
}
input[type=range]::-webkit-slider-runnable-track { height: 10px; background: rgba(255, 255, 255, 0.2); border-radius: 6px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--amarillo);
  border: 3px solid var(--tinta);
  margin-top: -11px;
}
input[type=range]::-moz-range-track { height: 10px; background: rgba(255, 255, 255, 0.2); border-radius: 6px; }
input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--amarillo); border: 3px solid var(--tinta); }

.direccion { display: flex; gap: 8px; align-items: center; }
.direccion .primario { flex: 1; }

.voces { display: flex; flex-direction: column; gap: 12px; }
.voces .grupo { background: rgba(255, 255, 255, 0.06); border-radius: 14px; padding: 10px; }
.voces .grupo strong { display: block; margin-bottom: 8px; }
.voces .botones { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.voces .voz {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: inherit;
  font-size: 13px;
  text-align: left;
}
.voces .voz.grabada { border-color: var(--verde); }
.voces .voz.grabando { border-color: var(--rosa); background: rgba(247, 37, 133, 0.25); animation: latir 0.6s infinite alternate; }
.voces .voz small { opacity: 0.7; font-size: 11px; }

@keyframes latir { from { opacity: 1; } to { opacity: 0.6; } }

.arte { display: flex; flex-direction: column; gap: 12px; }
.arte .grupo { background: rgba(255, 255, 255, 0.06); border-radius: 14px; padding: 10px; display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.arte canvas { width: 110px; height: 150px; background: rgba(255, 255, 255, 0.08); border-radius: 10px; }
.arte .vista { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.arte .vista canvas { width: 110px; height: 150px; cursor: pointer; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.arte .vista .pose { font-size: 11px; opacity: 0.8; text-align: center; }
.arte .vista .seguir { padding: 4px 10px; border-radius: 8px; border: none; background: var(--amarillo); color: var(--tinta); font-size: 12px; }
.arte .piezas { display: flex; flex-direction: column; gap: 6px; }
.arte .pieza .ajustar-pivotes { padding: 6px 10px; border-radius: 8px; border: none; background: var(--amarillo); color: var(--tinta); font-size: 12px; font-weight: 700; }
.editor-pivotes { position: fixed; inset: 0; z-index: 50; background: #14142a; color: #fff; display: flex; flex-direction: column; overflow: auto; }
.editor-pivotes .ep-cabecera { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: rgba(255, 255, 255, 0.06); }
.editor-pivotes .ep-cerrar { width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 16px; }
.editor-pivotes .ep-cuerpo { display: flex; gap: 14px; padding: 12px; flex-wrap: wrap; justify-content: center; }
.editor-pivotes .ep-columna { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.editor-pivotes canvas { background: rgba(255, 255, 255, 0.05); border-radius: 12px; touch-action: none; }
.editor-pivotes .ep-personaje { width: 300px; height: 360px; }
.editor-pivotes .ep-pieza { width: 288px; height: 288px; cursor: crosshair; }
.editor-pivotes .ep-poses, .editor-pivotes .ep-piezas { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 300px; }
.editor-pivotes .ep-poses button, .editor-pivotes .ep-piezas button { padding: 5px 9px; border-radius: 8px; border: 2px solid transparent; background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 12px; }
.editor-pivotes .ep-poses button.activa, .editor-pivotes .ep-piezas button.activa { border-color: var(--amarillo); color: var(--amarillo); }
.editor-pivotes .ep-ayuda { font-size: 12px; opacity: 0.8; max-width: 288px; margin: 0; }
.editor-pivotes .ep-acciones { display: flex; gap: 8px; }
.editor-pivotes .ep-acciones button { padding: 9px 12px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.25); background: transparent; color: #fff; font-size: 13px; }
.editor-pivotes .ep-acciones button.primario { background: var(--amarillo); color: var(--tinta); border-color: var(--amarillo); font-weight: 700; }
.arte .pieza { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; }
.arte .pieza span { flex: 1; }
.arte .pieza label { padding: 6px 10px; border-radius: 8px; background: var(--amarillo); color: var(--tinta); font-size: 12px; cursor: pointer; }
.arte .pieza input { display: none; }
.arte .pieza button { padding: 6px 8px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, 0.3); background: transparent; font-size: 12px; }
.arte .plantillas { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.arte .galeria { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; align-content: start; }
.arte .galeria canvas { width: 100%; height: auto; aspect-ratio: 1; }
.arte .plantillas a { color: var(--amarillo); font-size: 12px; }

textarea { min-height: 120px; resize: vertical; }

.pie {
  position: sticky;
  bottom: 0;
  background: linear-gradient(transparent, var(--fondo) 40%);
  padding: 20px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.mensaje {
  margin: 0;
  font-size: 13px;
  text-align: center;
  min-height: 18px;
  opacity: 0.85;
}

.burla {
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  border: 3px solid var(--tinta);
  background: var(--rosa);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  box-shadow: var(--sombra);
  user-select: none;
  -webkit-user-select: none;
}

.burla:active { transform: translateY(3px); box-shadow: none; }

.tarjeta.reto { min-height: 60vh; }
.tarjeta.reto h2 { font-size: 26px; margin: 0; }

#reto-cuerpo { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }

.duelo-boton {
  flex: 1;
  min-height: 40vh;
  border-radius: 20px;
  border: 5px solid var(--tinta);
  font-size: 30px;
  font-weight: 900;
  background: var(--gris);
  color: var(--tinta);
}

.duelo-boton.fuego { background: var(--rosa); color: #fff; animation: latir 0.3s infinite alternate; }

.rompecabezas {
  display: grid;
  gap: 4px;
  width: 100%;
  aspect-ratio: 1;
}

.rompecabezas button {
  border: 3px solid var(--tinta);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.rompecabezas button canvas { width: 100%; height: 100%; display: block; }
.rompecabezas button.marcada { outline: 4px solid var(--amarillo); outline-offset: -4px; }
.rompecabezas button.correcta { border-color: var(--verde); }

.arma-armado { display: flex; flex-direction: column; gap: 10px; }
.arma-armado .ranuras, .arma-armado .piezas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.arma-armado .ranura, .arma-armado .piezaArma {
  border: 3px dashed var(--tinta);
  border-radius: 10px;
  min-height: 56px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  background: rgba(27, 27, 47, 0.05);
  color: var(--tinta);
  padding: 4px;
  text-align: center;
}
.arma-armado .ranura.llena { border-style: solid; background: var(--verde); }
.arma-armado .piezaArma { border-style: solid; background: var(--amarillo); }
.arma-armado .piezaArma.marcada { outline: 4px solid var(--rosa); }
.arma-armado .piezaArma.usada { opacity: 0.25; }
.arma-armado .trabado { color: var(--rosa); font-weight: 900; text-align: center; font-size: 20px; }
.arma-armado .mostrar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.arma-armado .mostrar span { background: var(--verde); border-radius: 10px; padding: 12px 4px; text-align: center; font-weight: 800; font-size: 13px; color: var(--tinta); }

.escondites {
  display: grid;
  gap: 4px;
  width: 100%;
}

.escondites button {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid var(--tinta);
  background: #d9ead3;
  color: var(--tinta);
  font-weight: 800;
  font-size: 14px;
  padding: 0;
}

.escondites button.elegido { background: var(--verde); }
.escondites button.bengala { background: var(--amarillo); }
.escondites button.encontrado { background: var(--rosa); color: #fff; }

.reto-estado { text-align: center; font-weight: 800; font-size: 18px; }
.reto-estado.gane { color: #0a7c5c; }
.reto-estado.perdi { color: var(--rosa); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: var(--tinta);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--sombra);
}

.toast.error { background: var(--rosa); }
.toast[hidden] { display: none; }

#desconectado {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--rosa);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  z-index: 100;
  font-weight: 700;
  font-size: 13px;
}

#desconectado[hidden] { display: none; }

.fin-xp { font-size: 18px; }
.fin-xp strong { color: #0a7c5c; }

.columna-mapa, .columna-cuartel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

@media (orientation: landscape) and (min-width: 600px) {
  #pantalla-batalla {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 8px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding: 10px 14px;
  }
  #pantalla-batalla .barra-superior { grid-column: 1 / -1; position: static; margin: 0; padding: 0 0 4px; }
  .columna-mapa { grid-row: 2; overflow-y: auto; scrollbar-width: none; }
  .columna-cuartel { grid-row: 2; overflow-y: auto; scrollbar-width: none; padding-bottom: 8px; }
  .columna-mapa::-webkit-scrollbar, .columna-cuartel::-webkit-scrollbar { display: none; }
  .columna-mapa > *, .columna-cuartel > * { flex-shrink: 0; }
  .mapa-contenedor { flex: 0 0 auto; }
  .movimiento { grid-template-columns: 1fr 1.2fr 1fr auto; }
  .movimiento .redondo { padding: 10px; font-size: 18px; }
  .movimiento .barra-mov { grid-column: 1 / 4; }
  .movimiento .poder { grid-column: 4; grid-row: 1 / 3; padding: 6px 10px; max-width: 160px; }
  .movimiento .poder small { display: none; }
  .pestañas { margin: 0; padding: 0; position: sticky; top: 0; background: var(--fondo); z-index: 2; }
  .pie { position: static; padding: 6px 0 0; background: none; }
  .burla { padding: 10px; font-size: 14px; }
  .pantalla.flotante { padding: 10px 16px; }
  .tarjeta.reto { min-height: 0; max-height: calc(100vh - 20px); overflow: auto; padding: 12px 16px; }
  .tarjeta.reto h2 { font-size: 20px; }
  .tarjeta.reto .nota { display: none; }
  .rompecabezas { width: min(100%, 58vh); margin: 0 auto; }
  .escondites { width: min(100%, 110vh); margin: 0 auto; }
  .duelo-boton { min-height: 46vh; }
  #pantalla-sala .acciones-fijas { position: sticky; bottom: 0; margin: 0 -16px; }
  .rejilla-personajes { padding-bottom: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .personaje-carta canvas { height: 70px; }
}

.nombre-arma { display: flex; gap: 10px; align-items: center; min-width: 0; }
.nombre-arma .miniatura { width: 60px; height: 40px; flex: none; background: rgba(255, 255, 255, 0.9); border-radius: 8px; }
.pausa-movil { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(20, 20, 40, 0.8); backdrop-filter: blur(3px); padding: 20px; text-align: center; }
.pausa-movil[hidden] { display: none; }
.pausa-movil > div { background: #fffaf0; color: #1b1b2f; border: 4px solid #1b1b2f; border-radius: 18px; padding: 20px; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.pausa-movil strong { font-size: 24px; }
.pausa-movil p { margin: 0; opacity: 0.8; }

html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, select { -webkit-user-select: text; user-select: text; }
button, canvas { -webkit-touch-callout: none; touch-action: manipulation; }

.boton-armas { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 3px solid var(--amarillo); background: rgba(255, 255, 255, 0.08); color: inherit; text-align: left; cursor: pointer; }
.boton-armas canvas { width: 72px; height: 48px; background: #c6c6c6; border-radius: 6px; flex: none; }
.boton-armas .texto { flex: 1; display: flex; flex-direction: column; }
.boton-armas strong { font-size: 17px; }
.boton-armas small { opacity: 0.75; font-size: 12px; }
.boton-armas .cambiar { font-weight: 900; color: var(--amarillo); white-space: nowrap; }

.mapa-contenedor { position: relative; }
.armas-mapa { position: absolute; top: 8px; right: 8px; width: 64px; height: 52px; padding: 4px; border-radius: 6px; border: 3px solid #1b1b2f; background: #c6c6c6; box-shadow: inset -3px -3px 0 #555, inset 3px 3px 0 #fff; cursor: pointer; }
.armas-mapa canvas { width: 100%; height: 100%; }
.armas-mapa span { position: absolute; right: 4px; bottom: 1px; font-weight: 900; font-size: 13px; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }

.inventario { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); padding: 12px; }
.inventario[hidden] { display: none; }
.inventario .caja { width: min(560px, 100%); max-height: 100%; overflow: auto; background: #c6c6c6; border: 4px solid #1b1b2f; border-radius: 6px; box-shadow: inset -4px -4px 0 #555, inset 4px 4px 0 #fff; padding: 12px; color: #3f3f3f; font-family: 'Trebuchet MS', sans-serif; }
.inventario .titulo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; margin-bottom: 10px; }
.inventario .titulo span:first-child { flex: 1; }
.inventario .titulo button { width: 34px; height: 34px; border: 3px solid #1b1b2f; border-radius: 4px; background: #8b8b8b; color: #fff; font-weight: 900; box-shadow: inset -2px -2px 0 #555, inset 2px 2px 0 #bbb; }
.ranuras { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.ranura { position: relative; aspect-ratio: 1; padding: 6px; border: none; background: #8b8b8b; box-shadow: inset 3px 3px 0 #373737, inset -3px -3px 0 #fff; border-radius: 0; cursor: pointer; }
.ranura canvas { width: 100%; height: 100%; object-fit: contain; }
.ranura.marcada { outline: 4px solid #fff; outline-offset: -2px; }
.ranura.en-mano { background: #a7c957; }
.ranura.vacia canvas { opacity: 0.45; }
.ranura.bloqueada { filter: grayscale(1) brightness(0.6); }
.ranura .cuenta { position: absolute; right: 5px; bottom: 2px; font-weight: 900; font-size: 16px; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }
.ranura .candado { position: absolute; left: 4px; top: 2px; font-size: 14px; }
.detalle { margin-top: 10px; background: #8b8b8b; box-shadow: inset 3px 3px 0 #373737, inset -3px -3px 0 #fff; padding: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: #fff; }
.detalle .texto { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; text-shadow: 1px 1px 0 #3f3f3f; }
.detalle strong { font-size: 17px; }
.detalle small { font-size: 12px; }
.detalle .botones { display: flex; gap: 6px; }
.detalle .botones button { padding: 10px 14px; border: 3px solid #1b1b2f; border-radius: 4px; background: #c6c6c6; color: #3f3f3f; font-weight: 900; box-shadow: inset -2px -2px 0 #555, inset 2px 2px 0 #fff; }
.detalle .botones button.usar { background: #a7c957; color: #1b1b2f; }
.detalle .botones button:disabled { opacity: 0.5; }

#pantalla-batalla { position: fixed; inset: 0; display: block; padding: 0; margin: 0; max-width: none; width: 100vw; height: 100dvh; overflow: hidden; background: #141428; }
#pantalla-batalla .columna-mapa { position: absolute; inset: 0; display: block; overflow: visible; padding: 0; }
#pantalla-batalla .mapa-contenedor { position: absolute; inset: 0; border: none; border-radius: 0; box-shadow: none; aspect-ratio: auto; max-height: none; width: 100%; height: 100%; }
#pantalla-batalla #mapa { width: 100%; height: 100%; display: block; }
#pantalla-batalla .armas-mapa { display: none; }

#pantalla-batalla .barra-superior { position: absolute; top: 6px; left: 8px; right: auto; z-index: 6; display: flex; align-items: center; gap: 12px; padding: 4px 12px; margin: 0; width: auto; border-radius: 14px; background: rgba(20, 20, 40, 0.6); backdrop-filter: blur(2px); }
#pantalla-batalla .barra-superior .etiqueta { font-size: 9px; }
#pantalla-batalla .barra-superior strong { font-size: 16px; }
#pantalla-batalla .turno-info strong { font-size: 12px; }
#pantalla-batalla .turno-info span { font-size: 18px; }

.iconos { position: absolute; top: 8px; right: 8px; z-index: 6; display: flex; gap: 8px; }
.iconos button { width: 42px; height: 42px; border-radius: 50%; border: 3px solid #1b1b2f; background: rgba(255, 250, 240, 0.92); font-size: 19px; line-height: 1; display: grid; place-items: center; padding: 0; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); cursor: pointer; }
.iconos button.activo { background: var(--amarillo); }
.iconos button:active { transform: translateY(2px); box-shadow: none; }

#pantalla-batalla #controles-turno { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 6; pointer-events: none; }
#pantalla-batalla #controles-turno .movimiento { display: flex; align-items: flex-end; gap: 8px; flex-wrap: nowrap; }
#pantalla-batalla #controles-turno button { pointer-events: auto; }
#pantalla-batalla #controles-turno .redondo { width: 52px; height: 52px; border-radius: 50%; padding: 0; font-size: 18px; opacity: 0.92; }
#pantalla-batalla #controles-turno .salto { width: 64px; font-size: 13px; }
#pantalla-batalla #controles-turno .barra-mov { position: absolute; left: 0; bottom: -6px; width: 180px; height: 5px; }
#pantalla-batalla #controles-turno .poder { margin-left: auto; padding: 8px 14px; border-radius: 26px; opacity: 0.95; }

#pantalla-batalla .mapa-aviso { top: 54px; }

#pantalla-batalla .columna-cuartel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 52vw); z-index: 20; background: rgba(20, 20, 40, 0.94); padding: 52px 12px 12px; overflow-y: auto; transform: translateX(105%); transition: transform 0.22s ease; box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4); display: flex; flex-direction: column; gap: 10px; }
#pantalla-batalla .columna-cuartel.abierta { transform: translateX(0); }
.cerrar-hoja { position: absolute; top: 8px; right: 10px; width: 38px; height: 38px; border-radius: 50%; border: 3px solid #1b1b2f; background: #fffaf0; font-weight: 900; font-size: 16px; }
#pantalla-batalla .pestañas [data-pestaña="atacar"] { display: none; }
#pantalla-batalla .pie .burla { display: none; }
#pantalla-batalla #panel-atacar { display: none; }
.girar.activa { background: var(--amarillo); }
.aviso-construir { margin: 0; color: var(--verde); }
.aviso-construir.error { color: var(--rosa); }
.aviso-pruebas { background: rgba(255, 209, 102, 0.15); border: 2px solid var(--amarillo); border-radius: 10px; padding: 6px 10px; }
.iconos { z-index: 25; }
#pantalla-batalla .columna-cuartel { padding-top: 60px; }
.cerrar-hoja { right: auto; left: 10px; top: 10px; }
