/* El campo de batalla: el canvas ocupa toda la pantalla y lo demás flota encima. Pensado para una mano, a 375 × 812. */
@font-face { font-family: "Baloo 2"; src: url("/fuentes/baloo-2-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Baloo 2"; src: url("/fuentes/baloo-2-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --cielo-1: #62b6f6;
  --cielo-2: #2f86e0;
  --amarillo: #ffc83d;
  --cafe: #3a2a00;
  --sombra: rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  position: fixed; inset: 0;
  background: linear-gradient(var(--cielo-1), var(--cielo-2));
  color: #fff;
  font-family: "Baloo 2", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
[hidden] { display: none !important; }

/* Sin esto, el navegador de Instagram o de TikTok hace zoom o scroll de la página al arrastrar o pellizcar. */
#lienzo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#lienzo:active { cursor: grabbing; }

.arriba {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; flex-direction: column; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 12px 0;
  pointer-events: none;
}
.fila-arriba { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.fila-arriba > *, .arriba > .carrera { pointer-events: auto; }

.boton-chico {
  display: inline-block; padding: 6px 12px; border-radius: 12px; border: 0;
  background: var(--sombra); color: #fff; font: inherit; font-weight: 800; font-size: 14px; text-decoration: none;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

.mensaje {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(86vw, 360px); margin: 0; padding: 16px 18px; border-radius: 18px;
  background: var(--sombra); text-align: center; font-size: 17px; font-weight: 800; line-height: 1.25;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

/* Arriba: cuánto falta y los conectados, a la derecha del «Volver»; debajo, la pastilla de la carrera. */
.tablero {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; text-align: right;
}
.cartel, .conectados {
  margin: 0; padding: 4px 10px; border-radius: 12px; background: var(--sombra); font-size: 14px; line-height: 1.25;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.cartel { font-weight: 800; }
.cartel a { color: var(--amarillo); }
.conectados { font-size: 13px; }
.conectados::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #5cff8a; vertical-align: 1px; }

.carrera {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0;
  padding: 6px 10px; border: 0; border-radius: 14px; background: var(--sombra); color: #fff; font: inherit; font-size: 14px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); cursor: pointer;
}
.puesto, .fila-carrera { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.puesto img, .fila-carrera img { width: 24px; height: 18px; border-radius: 3px; object-fit: cover; flex: none; }
.numero-puesto { font-weight: 800; color: var(--amarillo); }
.puesto { gap: 4px; }
.puesto .nombre-pais { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puesto .total { white-space: nowrap; }
.total { font-weight: 800; }
.flecha { font-size: 13px; opacity: 0.8; }

/* Abajo: los botones, a mano con el pulgar. */
.abajo {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 8px; align-items: stretch;
  padding: 0 12px max(12px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.abajo > * { pointer-events: auto; }
.botones { display: flex; gap: 8px; }
.botones > * { flex: 1; }
.boton {
  display: block; padding: 12px 14px; border: 0; border-radius: 16px; background: var(--amarillo); color: var(--cafe);
  font: inherit; font-weight: 800; font-size: 17px; text-align: center; text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 0 #c99410;
}
.boton-claro { background: rgba(255, 255, 255, 0.24); color: #fff; box-shadow: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.aviso-lugar {
  margin: 0 auto; padding: 4px 10px; border-radius: 12px; background: var(--sombra); font-size: 13px; text-align: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

/* La hoja de tu ejército: cuántos son y cómo está armado. */
.hoja { position: absolute; inset: 0; display: flex; align-items: flex-end; background: rgba(0, 0, 0, 0.35); }
.hoja-caja {
  width: 100%; max-height: 86%; overflow-y: auto; padding: 18px 16px max(16px, env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0; background: var(--cielo-2); box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.25);
  -webkit-user-select: text; user-select: text;
}
.hoja h2 { margin: 0 0 10px; font-size: 22px; font-weight: 800; }
.total-ejercito { margin: 0 0 8px; font-size: 17px; font-weight: 800; }
#composicion-ejercito { margin-bottom: 12px; }
.carrera .nombre-pais { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carrera img { width: 24px; height: 18px; border-radius: 3px; object-fit: cover; flex: none; }
.fila-carrera {
  display: flex; flex-wrap: wrap; padding: 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.14); font-size: 16px;
}
.fila-carrera .nombre-pais { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-carrera.tuya { background: rgba(255, 200, 61, 0.22); outline: 2px solid var(--amarillo); }
.composicion { flex-basis: 100%; margin-top: 8px; }
.barra-composicion { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.2); }
.leyenda { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 14px; }
.punto { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 50%; vertical-align: 0; }
.chico { margin: 0 0 8px; font-size: 14px; line-height: 1.35; opacity: 0.95; }
.invitar { font-weight: 800; color: var(--amarillo); }
.hoja .boton { margin-top: 6px; width: 100%; }
