/* BelaWorld — la paleta sale de las fotos de Bela. */

:root {
  --canela: #C0672E;
  --cobre: #E0A05C;
  --carbon: #3A3A3C;
  --crema: #F2EDE4;
  --frambuesa: #C24F68;
  --morado: #9A5CD0;
  --cocina: #252B3D;
  --roble: #D9C7A8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #1A1E2A;
  color: var(--crema);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overscroll-behavior: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Respetar la muesca y la barra de gestos del movil. */
  padding:
    max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

#escena {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-height: 100%;
}

#lienzo {
  display: block;
  max-width: 100%;
  /* dvh, no vh: con vh la barra de direcciones del movil deja el canvas
     mas alto que la pantalla y la pagina acaba haciendo scroll al tocar. */
  max-height: calc(100vh - 76px);
  max-height: calc(100dvh - 76px);
  aspect-ratio: 480 / 720;
  image-rendering: pixelated;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  touch-action: none;
  cursor: pointer;
}

#barra {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

button {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 18px;
  border: 2px solid var(--frambuesa);
  border-radius: 8px;
  background: var(--cocina);
  color: var(--cobre);
  cursor: pointer;
}

button:hover { background: var(--frambuesa); color: var(--crema); }

.capa {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 18, 26, 0.86);
  padding: 16px;
  z-index: 10;
}

.capa[hidden] { display: none; }

.tarjeta {
  width: 100%;
  max-width: 380px;
  background: var(--cocina);
  border: 3px solid var(--frambuesa);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
}

.tarjeta h1, .tarjeta h2 {
  margin: 0 0 10px;
  color: var(--cobre);
  letter-spacing: 2px;
  font-size: 22px;
}

.tarjeta p {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(242, 237, 228, 0.75);
}

#campo-nombre {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 2px solid rgba(242, 237, 228, 0.25);
  border-radius: 8px;
  background: #1A1E2A;
  color: var(--crema);
  text-align: center;
}

#campo-nombre:focus { outline: none; border-color: var(--morado); }

.jugadores {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}

.jugadores:empty { display: none; }

.jugadores button {
  border-color: var(--morado);
  color: var(--crema);
  padding: 10px 16px;
}

.jugadores button:hover { background: var(--morado); }

#boton-jugador {
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-color: var(--morado);
  color: var(--morado);
}

.sub {
  margin: -4px 0 14px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--morado);
}

.pestanas {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.pestanas button {
  flex: 1;
  font-size: 13px;
  padding: 7px 4px;
  border-color: rgba(242, 237, 228, 0.2);
  color: rgba(242, 237, 228, 0.6);
}

.pestanas button.activa {
  border-color: var(--frambuesa);
  color: var(--cobre);
}

#lista-marcador {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  text-align: left;
  max-height: 46vh;
  overflow-y: auto;
}

#lista-marcador li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 15px;
}

#lista-marcador li:nth-child(odd) { background: rgba(242, 237, 228, 0.05); }
#lista-marcador li.mio { background: rgba(154, 92, 208, 0.25); }
#lista-marcador li.vacio { justify-content: center; color: rgba(242, 237, 228, 0.5); font-size: 14px; }

.pos { width: 24px; color: var(--cobre); font-weight: 700; }
.quien { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pts { font-weight: 700; color: var(--frambuesa); }
