/* Estilos comunes de toda la web: base, botones, cabecera, código, QR, avisos y avatares.
   Cada página añade encima solo lo suyo. Los botones llevan emoji en la etiqueta. */

:root {
  color-scheme: dark;
  --fondo: #0e1119;
  --tarjeta: #171b26;
  --borde: #252b3a;
  --texto: #e8ebf2;
  --suave: #8b93a7;
  --acento: #ff8a1f;
  --peligro: #ff5d5d;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(1200px 600px at 50% -10%, #1c2233 0%, var(--fondo) 60%);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
.sutil { color: var(--suave); font-size: .86rem; }
.centro { text-align: center; }
.error { color: #ffb3b3; font-size: .9rem; min-height: 1.2em; }
.atras { display: block; margin: 0 auto 18px; color: var(--suave); text-decoration: none; font-size: .9rem; }

/* Cabecera compacta de los juegos con partida: [←] [título] [Salir] */
.cabecera { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.cabecera .volver {
  text-decoration: none; color: var(--texto); font-size: 1.2rem; line-height: 1;
  padding: 9px 11px; border-radius: 12px; background: var(--tarjeta); border: 1px solid var(--borde);
  cursor: pointer; font-family: inherit;
}
.cabecera .titulo { flex: 1; font-weight: 700; }
.cabecera .salir {
  padding: 12px 18px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--peligro); color: #2a0505; font-size: 1rem; font-weight: 800;
  font-family: inherit;
}

/* Botones: .boton (amarillo, acción principal), .secundario (oscuro) y .peligro (rojo) */
.boton {
  display: block; width: 100%; padding: 15px 16px; border: 0; border-radius: 14px;
  background: var(--acento); color: #1a1400; font-size: 1rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.boton:disabled { opacity: .4; cursor: not-allowed; }
.boton.secundario { background: var(--tarjeta); color: var(--texto); border: 1px solid var(--borde); font-weight: 600; }
.boton.secundario:hover { border-color: var(--acento); }
.boton.peligro { background: var(--peligro); color: #2a0505; font-weight: 800; }

/* Campos de texto y código de partida */
.campo {
  display: block; width: 100%; padding: 13px 14px; border-radius: 12px;
  border: 1px solid var(--borde); background: #10131c; color: var(--texto);
  font-size: 1rem; margin: 8px 0 12px; font-family: inherit;
}
.campo:focus { outline: 2px solid var(--acento); outline-offset: 1px; }
.campo-codigo { text-transform: uppercase; text-align: center; letter-spacing: .25em; font-weight: 700; font-size: 1.2rem; }
.codigo { font-size: 2.4rem; font-weight: 800; letter-spacing: .2em; text-align: center; color: var(--acento); margin: 2px 0; }
.qr-caja { background: #fff; border-radius: 16px; padding: 14px; width: max-content; margin: 6px auto 12px; }
.qr-dibujo canvas, .qr-dibujo img { display: block; }

/* Aviso grande (resultado o error): se quita al tocar o solo a los 2,5 s */
.aviso {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: rgba(14,17,25,.9); padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.aviso.visible { opacity: 1; pointer-events: auto; }
.aviso .caja { text-align: center; font-size: 1.3rem; font-weight: 800; max-width: 420px; line-height: 1.4; }

/* Avatares */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  background: #10131c; border: 1px solid var(--borde);
}
.avatar-inicial {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--acento); font-weight: 800;
}
.ficha .avatar { width: 22px; height: 22px; border: 0; }
.ficha-quitar {
  background: transparent; border: none; color: var(--peligro, #e63946);
  cursor: pointer; padding: 0 2px 0 4px; font-size: .85rem; font-weight: bold;
  line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.ficha-quitar:hover { transform: scale(1.25); }
.quien { display: flex; align-items: center; gap: 8px; min-width: 0; }
.quien span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fila-avatar { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.previa-avatar .avatar-grande { width: 56px; height: 56px; }
.selector-avatares { margin: 4px 0 12px; padding: 12px; border: 1px dashed var(--borde); border-radius: 14px; }
.rejilla-avatares {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px;
  margin: 10px 0; max-height: 42vh; overflow-y: auto;
}
.opcion-avatar {
  padding: 3px; border-radius: 12px; border: 2px solid transparent; background: #10131c;
  cursor: pointer; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-family: inherit; color: var(--texto);
}
.opcion-avatar.elegida { border-color: var(--acento); }
.opcion-avatar img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; }
.opcion-avatar.sin { font-size: .72rem; color: var(--suave); text-align: center; line-height: 1.2; }
