/* Normas del chat y moderación */
.norm-back { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.norm-box { background: #fff; color: #222; border-radius: 14px; padding: 18px; max-width: 440px; width: 100%; max-height: 88vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.norm-box h2 { margin: 0 0 4px; font-size: 20px; }
.norm-box p, .norm-box ul { margin: 4px 0; line-height: 1.4; }
.norm-box ul { padding-left: 20px; }
.norm-box .btn { margin-top: 10px; }
#acceptRow .link { color: #2f6fb5; padding: 0; }
.mod-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mod-add { display: flex; gap: 6px; margin: 6px 0; }
.mod-add input { flex: 1; min-width: 0; }
.mod-cat { margin: 6px 0; }
.chip { display: inline-block; background: #eef1f4; border-radius: 12px; padding: 2px 4px 2px 9px; margin: 2px; font-size: 13px; }
.chip button { background: none; border: 0; font-size: 16px; line-height: 1; cursor: pointer; }
.prow2.dim { opacity: .5; }

/* Mapa en vivo del administrador */
.mp-boxes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 4px; }
.mp-box { background: #fff; border: 1px solid #e3dccd; border-radius: 10px; padding: 8px 4px; text-align: center; }
.mp-box b { display: block; font-size: 24px; color: #1d4fa8; }
.mp-box small { color: #666; font-size: 11px; }
.mp-table { background: #fff; border: 1px solid #e3dccd; border-radius: 10px; padding: 10px; margin: 8px 0; }
.mp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.mp-score { margin-left: auto; font-weight: 800; font-size: 18px; }
.mp-seats { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.mp-seat { background: #eaf2ff; border-radius: 8px; padding: 3px 9px; font-size: 13px; font-weight: 700; }
.mp-seat.bot { background: #f1ecff; font-weight: 600; }
.mp-seat.off { opacity: .5; }
.mp-seat.free { background: #f3f3f3; color: #999; font-weight: 400; }
.mp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag.st-playing { background: #d9f5df; color: #176b2c; }
.mp-person { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid #eee; }
.mp-person small { color: #666; flex: 1; }
.mp-nums { display: grid; gap: 4px; }
.mp-note { color: #777; font-size: 12px; margin-top: 12px; }
@media (max-width: 420px) { .mp-boxes { grid-template-columns: repeat(2, 1fr); } }

/* Fichas de todos, solo para el administrador que observa */
#godHands { position: fixed; left: 8px; top: 56px; z-index: 30; background: rgba(15,25,40,.88); color: #fff; border-radius: 10px; padding: 8px 10px; max-width: calc(100vw - 16px); display: none; }
body.in-table #godHands:not([hidden]) { display: block; }
.gh-title { display: block; font-size: 12px; opacity: .8; margin-bottom: 4px; }
.gh-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.gh-row.gh-turn .gh-name { color: #ffd54a; }
.gh-name { width: 108px; font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-tiles { display: flex; flex-wrap: wrap; gap: 2px; }
.gh-tiles .rt { width: 34px; display: block; }
.gh-tiles .rt svg { width: 100%; height: auto; display: block; }

/* Clasificación final de la Longana */
.rank-list { margin: 8px auto 0; max-width: 300px; }
.rk { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; padding: 5px 8px; border-bottom: 1px solid #e3dccd; text-align: left; }
.rk.win { background: #e1f4e3; font-weight: 800; }
.rk i { font-style: normal; font-weight: 800; }

/* Lista de modalidades (como «Dominó online» de Ludoteka) */
.mod-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 8px; }
.mod-card { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; width: 100%; padding: 6px 6px 5px; background: #fff; border: 1px solid #d8dccf; border-radius: 10px; cursor: pointer; font: inherit; }
.mod-card:hover:not(:disabled) { border-color: #0b8fb3; box-shadow: 0 1px 6px rgba(11,143,179,.25); }
.mod-card.sel { border: 2px solid #0b8fb3; background: #eaf7fb; }
.mod-card.soon { opacity: .55; cursor: default; }
.mod-ico svg { width: 44px; height: 44px; display: block; }
.mod-ico img { height: 50px; width: auto; display: block; margin: 0 auto; }
.mod-ico svg { width: 42px; height: 42px; }
.mod-card.soon .mod-ico img { filter: grayscale(.6); }
.mod-txt b { display: block; font-size: 13px; line-height: 1.15; color: #0b6f86; }
.mod-txt small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #555; font-size: 10.5px; line-height: 1.25; }
.mod-n { font-size: 11px; color: #1f7a2e; font-weight: 700; white-space: nowrap; margin-top: auto; }
.mod-card.soon .mod-n { color: #8a6d00; }

/* Tarjeta de bienvenida del salón */
.welcome { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; background: linear-gradient(135deg, #0b8fb3, #17b3c8); color: #fff; border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; }
.welcome:empty { display: none; }
.wl-me { display: flex; align-items: center; gap: 10px; }
.wl-me b { display: block; font-size: 18px; }
.wl-me small { opacity: .9; }
.wl-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.wl-stats span { background: rgba(255,255,255,.18); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.wl-stats b { font-size: 16px; }

/* En PC (pantalla ancha) las tres secciones se ven a la vez, como en Ludoteka: Abrir partida · Partidas y torneos · Jugadores */
@media (min-width: 1100px) {
  #lobby:not([hidden]) { max-width: 1400px; display: grid; grid-template-columns: minmax(340px, 400px) minmax(420px, 1fr) minmax(280px, 340px); grid-auto-flow: row dense; gap: 16px; align-items: start; }
  #lobby > .install-banner, #lobby > .reclaim-bar, #lobby > .welcome { grid-column: 1 / -1; margin-bottom: 0; }
  #lobby .ltabs { display: none; }
  #lobby .lpanel, #lobby .lpanel[hidden] { display: block; border-top: 1px solid #d8dccf; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
  #lobby .lpanel::before { display: block; font-weight: 800; font-size: 18px; color: #0b6f86; margin-bottom: 10px; }
  #lobby .lpanel[data-lpanel=open] { grid-column: 1; grid-row: span 2; }
  #lobby .lpanel[data-lpanel=games] { grid-column: 2; }
  #lobby .lpanel[data-lpanel=torneos] { grid-column: 2; }
  #lobby .lpanel[data-lpanel=players] { grid-column: 3; grid-row: span 2; }
  #lobby .lpanel[data-lpanel=open]::before { content: '✔ Abrir partida'; }
  #lobby .lpanel[data-lpanel=games]::before { content: '☰ Partidas'; }
  #lobby .lpanel[data-lpanel=torneos]::before { content: '🏆 Torneos'; }
  #lobby .lpanel[data-lpanel=players]::before { content: '👤 Jugadores'; }
  #lobby.admin .lpanel[data-lpanel=open] { display: none; }
}
/* Aviso de versión nueva (app.js): arriba al centro, debajo de la barra, sin tapar las fichas de la mano */
.version-nueva { position: fixed; left: 50%; transform: translateX(-50%); top: calc(64px + env(safe-area-inset-top)); z-index: 2000;
  padding: 10px 16px; border-radius: 22px; box-shadow: 0 4px 14px rgba(0,0,0,.35); font-weight: 800; max-width: calc(100vw - 32px); }
.reclaim-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff3cd; border: 1px solid #e6c866; color: #5c4400; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-weight: 700; }
.btn.danger { color: #b3261e; border-color: #e3b5b1; }

/* Torneo: escoger e invitar jugadores */
.invite-title { margin-top: 10px; font-weight: 700; }
.invite-pick { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; max-height: 240px; overflow-y: auto; }
.inv-opt { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid #cfdccf; border-radius: 8px; background: #fff; font: inherit; cursor: pointer; }
.inv-opt .nm { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-opt.on { background: #e1f4e3; border-color: #4ba35b; }
.inv-count { font-size: 12px; margin-top: 2px; }
.tp-inv { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.tp-inv .tag.ok { background: #d9f5df; color: #176b2c; }
.inv-back .btn { width: 100%; margin-top: 6px; }

/* Cambio de lugar */
.tb.on { background: #ffd54a; }
.swap-opt { width: 100%; margin-top: 6px; }
/* El aviso del cambio va abajo y no oscurece la mesa (al terminar la data hay que poder ver las fichas y la cuenta) */
.swap-back { background: transparent; align-items: flex-end; pointer-events: none; padding-bottom: 70px; }
.swap-back .norm-box { pointer-events: auto; max-width: 360px; box-shadow: 0 6px 24px rgba(0,0,0,.45); }
.norm-box [data-ans] { width: 100%; margin-top: 6px; }

/* Parejas en la lista y en la sala de espera; partida privada */
.pair-title { background: #d3e3d4; color: #4b624d; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; padding: 2px 8px; }
button.srow.empty-seat { width: 100%; border: 0; border-bottom: 1px solid #cfdccf; background: transparent; cursor: pointer; text-align: left; font-family: inherit; }
button.srow.empty-seat:hover { background: #dfeee0; }
.tp-private { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 8px 0; text-align: center; }
.tp-private small { color: #555; max-width: 300px; }
.tp-qr { background: #fff; padding: 6px; border-radius: 8px; }
