/* Jugadores de la pantalla de inicio, en compacto (rejilla de fichas + panel de edición) y tableros en una fila de pastillas.
 * La altura de la sección casi no depende del número de jugadores: la rejilla tiene una altura mínima y una máxima y se desplaza por dentro.
 * Compatibilidad con Chromium ~60: rejilla con grid-gap (no gap), sin gap en flexbox (márgenes), sin min()/max()/clamp(), sin aspect-ratio ni inset. */

/* ---- Tableros: una sola fila baja de pastillas, con la descripción corta del elegido debajo ---- */
.board-pills { display: flex; flex-wrap: wrap; justify-content: center; margin: 4px 0 2px; }
.board-pills .board-card { width: auto; max-width: none; flex: 0 0 auto; flex-direction: row; align-items: center; min-height: 44px; padding: 6px 14px; margin: 4px; border-radius: 999px; }
.board-pills .board-card .badge { align-self: center; margin-right: 8px; }
.board-pills .board-card .board-name { font-size: 0.95rem; white-space: nowrap; }
.board-desc { text-align: center; min-height: 1.4em; margin: 2px 8px 12px; opacity: 0.88; line-height: 1.35; }

/* ---- Sección de jugadores ---- */
.players-section { margin: 6px 0 14px; }
.players-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; }
.players-head h3 { margin: 0 14px 0 4px; font-size: 1.15rem; color: #e9d5ff; }
.players-head button { min-height: 44px; padding: 8px 16px; margin: 4px; font-size: 0.95rem; }
.count-ctl { display: flex; align-items: center; margin: 4px; }
.count-ctl button { width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0 6px; border-radius: 50%; font-size: 1.4rem; line-height: 1; }
.count-ctl output { min-width: 2.2ch; text-align: center; font-weight: 900; font-size: 1.35rem; }
.players-head .switch { margin: 4px 4px 4px 12px; min-height: 44px; display: flex; align-items: center; }
.players-section .hint { text-align: center; margin: 2px 8px 6px; }

.player-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 52px; grid-gap: 8px; align-content: start; min-height: 112px; max-height: 236px; overflow-y: auto; padding: 4px; margin: 4px 0; border-radius: 14px; background: rgba(255, 255, 255, 0.03); -webkit-overflow-scrolling: touch; }
.pcell { min-width: 0; }
.players-section .ptile { display: flex; align-items: center; width: 100%; height: 52px; min-height: 44px; margin: 0; padding: 0 8px; text-align: left; font-weight: 400; color: #fff; background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(255, 255, 255, 0.12); border-radius: 12px; box-shadow: none; transform: none; filter: none; }
.players-section .ptile:hover { background: rgba(255, 255, 255, 0.14); transform: none; box-shadow: none; }
.players-section .ptile:focus { outline: 3px solid #facc15; outline-offset: 1px; }
.players-section .ptile.on { border-color: #c084fc; background: rgba(192, 132, 252, 0.25); }
.pt-e { flex: none; width: 2rem; font-size: 1.6rem; line-height: 1; text-align: center; margin-right: 6px; }
.pt-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pt-t b { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-t small { font-size: 0.78rem; color: #d8b4fe; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Panel de edición del jugador ---- */
.pp-wrap { display: block; background: rgba(8, 6, 18, 0.35); backdrop-filter: none; padding-bottom: 0; z-index: 260; }
.pp-wrap.hidden { display: none; }
.pp { position: absolute; width: 340px; max-width: calc(100% - 16px); max-height: calc(100% - 16px); overflow-y: auto; box-sizing: border-box; padding: 14px; text-align: left; color: #fff; background: linear-gradient(165deg, #2a1a40 0%, #16122a 100%); border: 1px solid rgba(192, 132, 252, 0.45); border-radius: 16px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65); }
.pp h3 { margin: 0 0 10px; font-size: 1.05rem; color: #e9d5ff; }
.pp-row { margin: 8px 0; }
.pp-row label, .pp-lab { display: block; margin-bottom: 4px; font-size: 0.9rem; font-weight: 700; color: #e9d5ff; }
.pp select, .pp input, .pp textarea { width: 100%; min-height: 44px; box-sizing: border-box; font-size: 1rem; }
.pp textarea { min-height: 150px; }
.pp-emojis { display: grid; grid-template-columns: repeat(7, 1fr); grid-gap: 6px; }
.pp-emojis .pp-emoji { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 44px; font-size: 1.45rem; cursor: pointer; border-radius: 10px; background: rgba(255, 255, 255, 0.08); border: 2px solid transparent; }
.pp-emojis .pp-emoji:focus { outline: 3px solid #facc15; }
.pp-emojis .pp-emoji.on { border-color: #c084fc; background: rgba(192, 132, 252, 0.4); }
.pp-emojis .pp-emoji.taken { opacity: 0.5; border: 2px dashed rgba(255, 255, 255, 0.4); }
.pp-btns { display: flex; margin-top: 12px; }
.pp-btns button { flex: 1; min-height: 44px; margin: 0 4px; padding: 8px 12px; }

/* ---- Móvil: 2 columnas, lista con altura fija que se desplaza por dentro, panel como hoja inferior y «Iniciar partida» siempre visible ---- */
@media (max-width: 700px) {
  .player-grid { grid-template-columns: repeat(2, 1fr); height: 206px; min-height: 206px; max-height: 206px; }
  .players-head h3 { margin: 0 8px 0 0; }
  .players-head .switch { margin: 0 4px; width: 100%; justify-content: center; }
  .players-section .hint { display: none; }          /* en el móvil el aviso de privacidad se lee dentro del panel («Orientación (privada)») */
  .board-pills { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .pp-wrap { background: rgba(8, 6, 18, 0.7); }
  .pp { position: fixed; left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto; max-width: none; max-height: 88%; border-radius: 18px 18px 0 0; padding-bottom: calc(46px + env(safe-area-inset-bottom, 0px)); }
  #setup { padding-bottom: 92px; }
  .start-actions #btnChooseGame { position: fixed; left: 12px; right: 12px; bottom: 40px; z-index: 60; width: auto; min-height: 56px; margin: 0; font-size: 1.25rem; }
}

/* ---- Modo tele: todo en la unidad fluida (1 rem = 1u) ---- */
.tv-mode .player-grid { grid-auto-rows: 2.8rem; grid-gap: 0.5rem; min-height: 6rem; max-height: 12.8rem; }
.tv-mode .players-section .ptile { height: 2.8rem; padding: 0 0.6rem; }
.tv-mode .pt-e { font-size: 1.5rem; width: 2rem; }
.tv-mode .pt-t b { font-size: 1.1rem; }
.tv-mode .pt-t small { font-size: 0.9rem; }
.tv-mode .players-head button { min-height: 2.8rem; font-size: 1.05rem; }
.tv-mode .count-ctl button { width: 2.8rem; height: 2.8rem; min-height: 2.8rem; }
.tv-mode .board-pills .board-card { min-height: 2.8rem; padding: 0.3rem 1rem; font-size: 1.05rem; width: auto; }
.tv-mode .pp { width: 27rem; font-size: 1.05rem; }
.tv-mode .pp-emojis .pp-emoji { min-height: 2.6rem; font-size: 1.5rem; }
.tv-mode .pp select, .tv-mode .pp input { min-height: 2.8rem; }
.tv-mode .pp-btns button { min-height: 2.8rem; font-size: 1.1rem; }
.tv-mode .board-pills { flex-wrap: nowrap; }
.tv-mode .board-pills .board-card { padding: 0.2rem 0.7rem; margin: 0.2rem; font-size: 0.95rem; }
.tv-mode .board-pills .board-card .badge { margin-right: 0.4rem; font-size: 0.6rem; padding: 0.1rem 0.45rem; }
.tv-mode .board-pills .board-card .board-name { font-size: 0.95rem; }
