/* =========================================================================
   Bingo Total — hoja de estilos única (offline, sin dependencias)
   ========================================================================= */
:root {
  --bg: #0e1626;
  --bg-2: #16233a;
  --panel: #1b2b45;
  --panel-2: #223552;
  --line: #2f4767;
  --text: #eaf1fb;
  --muted: #9bb0cc;
  --primary: #2f80ed;
  --primary-2: #56a8ff;
  --gold: #ffc247;
  --green: #27c093;
  --red: #ef4a5a;
  --b: #2f80ed;
  --i: #ef4a5a;
  --n: #9aa7b8;
  --g: #a259ff;
  --o: #f2c400;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1d3357 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #231f4a 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

/* ---------------------------------------------------------------- cabecera */
.app-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: rgba(14, 22, 38, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--primary), #7b3ff2);
  box-shadow: 0 6px 18px rgba(47, 128, 237, .45);
  font-weight: 800; font-size: 15px; letter-spacing: -.5px;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 12px; color: var(--muted); }
.header-spacer { flex: 1; }
.round-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.round-chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.live { background: var(--red); box-shadow: 0 0 0 4px rgba(239, 74, 90, .18); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------------------------------------------------------------- pestañas */
.tabs {
  display: flex; gap: 6px; padding: 10px 18px 0; overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 16px; border-radius: 12px 12px 0 0; color: var(--muted);
  font-weight: 600; font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.tab.active { color: var(--text); background: var(--panel); border-bottom-color: var(--primary); }

main { padding: 20px 18px 90px; max-width: 1240px; margin: 0 auto; }
.panel { display: none; animation: fade .18s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 16px; margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

/* ---------------------------------------------------------------- juego */
.game-grid { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .game-grid { grid-template-columns: 1fr; } }

.ball-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ball {
  position: relative; width: 190px; height: 190px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 32% 26%, #fff, #dfe8f5 55%, #b9c8dd 100%);
  color: #12203a; box-shadow: inset 0 -14px 26px rgba(0,0,0,.18), 0 16px 40px rgba(0,0,0,.45);
  transition: transform .18s ease;
}
.ball.pop { animation: pop .42s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { 0% { transform: scale(.6) rotate(-8deg); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.ball-letter {
  position: absolute; top: 26px; font-size: 15px; font-weight: 800; letter-spacing: .18em;
  opacity: .55; transition: color .2s;
}
.ball-number { font-size: 78px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ball-na { font-size: 26px; font-weight: 700; color: #7d8ba0; }
.ball::after {
  content: ""; position: absolute; inset: 10px; border-radius: 50%;
  border: 3px solid transparent; transition: border-color .2s;
}
.ball[data-letter="B"]::after { border-color: var(--b); }
.ball[data-letter="I"]::after { border-color: var(--i); }
.ball[data-letter="N"]::after { border-color: var(--n); }
.ball[data-letter="G"]::after { border-color: var(--g); }
.ball[data-letter="O"]::after { border-color: var(--o); }

.history { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; min-height: 34px; }
.history .h {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line);
}
.history .h:first-child { background: var(--primary); border-color: var(--primary-2); }
.draw-count { font-size: 13px; color: var(--muted); }
.draw-count b { color: var(--text); font-size: 15px; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 16px; border-radius: 12px; font-weight: 700; font-size: 14px;
  background: var(--panel-2); border: 1px solid var(--line);
  transition: transform .12s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .42; cursor: not-allowed; filter: none; }
.btn.primary { background: linear-gradient(180deg, var(--primary-2), var(--primary)); border-color: transparent; box-shadow: 0 8px 22px rgba(47, 128, 237, .35); }
.btn.gold { background: linear-gradient(180deg, #ffd479, var(--gold)); color: #2a1d00; border-color: transparent; }
.btn.green { background: linear-gradient(180deg, #4be0b4, var(--green)); color: #002a20; border-color: transparent; }
.btn.danger { background: linear-gradient(180deg, #ff7080, var(--red)); border-color: transparent; }
.btn.block { width: 100%; }
.btn.small { padding: 9px 12px; font-size: 13px; border-radius: 10px; }

/* tablero */
.board-wrap { overflow: hidden; }
.board {
  display: grid; grid-template-columns: repeat(var(--bcols, 15), minmax(0, 1fr)); gap: 5px;
}
@media (max-width: 760px) {
  .board { gap: 3px; }
  .cell { font-size: 10px; border-radius: 5px; }
  .cell::before { display: none; }
}
.cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 8px;
  display: grid; place-items: center; font-weight: 700; font-size: clamp(10px, 1.5vw, 17px);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  transition: background .18s, color .18s, transform .12s;
}
.cell::before {
  content: attr(data-l); position: absolute; top: 2px; left: 4px;
  font-size: 8px; font-weight: 700; opacity: .45;
}
.cell:hover { background: #2c4270; }
.cell.called { background: linear-gradient(180deg, #ff6b7a, #d92b3d); color: #fff; border-color: #ff8b96; box-shadow: 0 0 0 2px rgba(239,74,90,.25); }
.cell.called::before { opacity: .85; }
.cell.just { animation: pop .45s ease; }

/* progreso de patrones en juego */
.progress-list { display: flex; flex-direction: column; gap: 10px; }
.prog {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
}
.prog .p5 { width: 40px; height: 40px; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); gap: 1px; }
.prog .p5 i { aspect-ratio: 1 / 1; background: #32496b; border-radius: 1px; }
.prog .p5 i.on { background: var(--gold); }
.prog .p5 i.free { background: #43608c; }
.prog .p5.p90 { width: 56px; height: auto; }
.prog .name { font-size: 13px; font-weight: 700; }
.prog .meta { font-size: 11px; color: var(--muted); }
.prog .pct { font-size: 12px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.prog.win { border-color: var(--green); box-shadow: 0 0 0 2px rgba(39,192,147,.18); }

.bar { height: 6px; background: #2a3f5e; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-2), var(--gold)); width: 0; transition: width .25s; }

/* banner ganador */
.winner {
  display: none; align-items: center; gap: 12px; margin-bottom: 14px;
  padding: 14px 16px; border-radius: 14px;
  background: linear-gradient(100deg, rgba(39,192,147,.18), rgba(255,194,71,.12));
  border: 1px solid var(--green);
}
.winner.show { display: flex; animation: fade .2s; }
.winner .ico { font-size: 26px; }
.winner strong { display: block; font-size: 15px; }
.winner span { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- formularios */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.field input, .field select {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  background: #12203a; border: 1px solid var(--line); color: var(--text);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(47,128,237,.18); }
.field .hint { font-size: 11px; color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.switch input { width: 44px; height: 26px; appearance: none; background: #2a3f5e; border-radius: 99px; position: relative; transition: background .18s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .18s; }
.switch input:checked { background: var(--green); }
.switch input:checked::after { transform: translateX(18px); }

/* ---------------------------------------------------------------- patrones */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  padding: 8px 13px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.chip.active { background: var(--primary); border-color: var(--primary-2); color: #fff; }

.pat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.pat {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px; border-radius: 12px; background: var(--panel-2);
  border: 1px solid var(--line); font-size: 12px; font-weight: 600; text-align: center;
  transition: transform .12s, border-color .15s, background .15s;
}
.pat:hover { transform: translateY(-2px); border-color: var(--primary-2); }
.pat.selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,194,71,.22); background: #2a3a22; }
.pat .p5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; width: 70px; }
.pat .p5 i { aspect-ratio: 1; background: #31486b; border-radius: 2px; }
.pat .p5 i.on { background: var(--gold); }
.pat .p5 i.free { background: #43608c; }

/* variante Bingo 90 (3x9) */
.p5.p90 { grid-template-columns: repeat(9, 1fr) !important; grid-template-rows: repeat(3, 1fr); width: 96px; }
.p5.p90 i { aspect-ratio: 1.4 / 1 !important; }
.pat .p5.p90 { width: 108px; }
.active-item .p5.p90 { width: 58px; }
.prog .mini.p90 { width: 56px; height: auto; }
.pat .nm { line-height: 1.2; }
.pat .badge { font-size: 10px; color: var(--gold); font-weight: 700; }

.active-list { display: flex; flex-direction: column; gap: 10px; }
.active-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.active-item .p5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; width: 38px; }
.active-item .p5 i { aspect-ratio: 1; background: #31486b; border-radius: 1px; }
.active-item .p5 i.on { background: var(--gold); }
.active-item input { padding: 7px 9px; border-radius: 8px; background: #12203a; border: 1px solid var(--line); font-size: 12px; width: 100%; }
.active-item .two { display: flex; gap: 8px; margin-top: 6px; }
.active-item .two input:last-child { max-width: 92px; }

.editor5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; width: min(240px, 70vw); }
.editor5 button { aspect-ratio: 1; border-radius: 8px; background: #31486b; border: 1px solid var(--line); font-size: 11px; color: var(--muted); font-weight: 700; }
.editor5 button.on { background: var(--gold); color: #2a1d00; border-color: #ffd479; }
.editor5 button.free { background: #43608c; color: #cfe0f7; }

/* ---------------------------------------------------------------- cartones */
.cards-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.mini-card {
  background: #fff; color: #16233a; border-radius: 12px; padding: 10px;
  border: 1px solid #d7e0ee; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.mini-card .mc-head { display: flex; justify-content: space-between; font-size: 10px; font-weight: 700; color: #6b7c93; margin-bottom: 6px; }
.mini-card .mc-title { font-size: 11px; font-weight: 800; color: #16233a; }
.mini-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
.mini-grid.rows3 { grid-template-columns: repeat(9, 1fr); }
.mini-grid b { display: grid; place-items: center; aspect-ratio: 1; font-size: 11px; background: #eef3fa; border-radius: 3px; font-weight: 700; }
.mini-grid.rows3 b { font-size: 9px; aspect-ratio: 1.6; }
.mini-grid b.free { background: #16233a; color: #fff; font-size: 7px; }
.mini-grid b.off { background: transparent; }
.mini-grid b.hit { background: #ffd66b; }
.mini-card .mc-foot { display: flex; justify-content: space-between; font-size: 9px; color: #7c8aa0; margin-top: 6px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
table.data td.num { font-variant-numeric: tabular-nums; }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

.hash { word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); background: #0f1c30; padding: 10px; border-radius: 8px; border: 1px solid var(--line); }

/* ---------------------------------------------------------------- modal */
.modal {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(5, 9, 17, .72); backdrop-filter: blur(4px);
}
.modal.show { display: flex; }
.modal-box {
  width: min(680px, 100%); max-height: 88vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); padding: 22px;
}
.modal-box h3 { font-size: 18px; margin-bottom: 6px; }
.modal-box p { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 30px);
  background: #23395c; border: 1px solid var(--line); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 200; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi > div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.kpi b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 11px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 10px; }

/* ---------------------------------------------------------------- impresión */
.print-area { display: none; }
body.printing { background: #fff; }
body.printing .app-header, body.printing .tabs, body.printing main, body.printing .toast { display: none !important; }
body.printing .print-area { display: block; }

.print-sheet {
  display: grid; gap: 6mm; padding: 0;
  grid-template-columns: repeat(var(--cols, 2), 1fr);
  page-break-after: always; break-after: page;
}
.print-sheet:last-child { page-break-after: auto; break-after: auto; }

.p-card {
  border: 1.4pt solid #12203a; border-radius: 4mm; padding: var(--ppad, 3mm);
  display: flex; flex-direction: column; gap: 2mm; break-inside: avoid;
  color: #12203a; background: #fff;
}
.p-card .p-head { display: flex; justify-content: space-between; align-items: baseline; gap: 2mm; }
.p-card .p-name { font-size: var(--pname, 9pt); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.p-card .p-num { font-size: calc(var(--pname, 9pt) * .9); font-weight: 700; }
.p-card .p-sub { font-size: calc(var(--pname, 9pt) * .72); color: #5b6b80; }
.p-card .p-letters { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6mm; }
.p-card .p-letters span { text-align: center; font-size: var(--plet, 8.5pt); font-weight: 800; color: #fff; padding: .8mm 0; border-radius: 1.2mm; }
.p-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6mm; }
.p-grid.rows3 { grid-template-columns: repeat(9, 1fr); }
.p-grid b {
  display: grid; place-items: center; aspect-ratio: 1 / 1;
  border: .5pt solid #c3ccda; border-radius: 1.2mm;
  font-size: var(--pnum, 11pt); font-weight: 700; font-variant-numeric: tabular-nums;
}
.p-grid.rows3 b { aspect-ratio: 1.5 / 1; font-size: calc(var(--pnum, 11pt) * .78); }
.p-grid b.free { background: #12203a; color: #fff; font-size: calc(var(--pnum, 11pt) * .5); letter-spacing: .04em; }
.p-grid b.off { border: 0; }
.p-card .p-foot { display: flex; justify-content: space-between; font-size: calc(var(--pname, 9pt) * .66); color: #6b7a8e; }
.p-card .p-code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .03em; }

@page { size: A4 portrait; margin: 8mm; }
@media print {
  :root { --text: #000; }
  html, body { background: #fff !important; }
  .app-header, .tabs, main, .bottom-nav, .toast, .modal { display: none !important; }
  .print-area { display: block !important; }
}

/* nav inferior móvil */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: rgba(14, 22, 38, .96); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(6, 1fr); backdrop-filter: blur(10px);
}
.bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; font-size: 10px; color: var(--muted); border-radius: 10px; font-weight: 600; }
.bottom-nav button .ic { font-size: 17px; line-height: 1; }
.bottom-nav button.active { color: var(--primary-2); background: rgba(47,128,237,.12); }
@media (max-width: 380px) {
  .bottom-nav button { font-size: 9px; }
  .bottom-nav button .ic { font-size: 15px; }
}
@media (max-width: 820px) {
  .bottom-nav { display: grid; }
  .tabs { display: none; }
  main { padding-bottom: 96px; }
  .app-header { padding: 10px 14px; gap: 10px; }
  .brand-text strong { font-size: 15px; }
  .brand-text span { font-size: 11px; }
  .round-chip { padding: 6px 10px; font-size: 11px; gap: 6px; }
  .round-chip span.lbl { display: none; }
  .round-chip b + b::before { content: "· "; opacity: .55; }
}

/* =========================================================================
   Sala multijugador
   ========================================================================= */
.sala-link {
  display: flex; gap: 10px; align-items: center;
  background: #0f1c30; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.sala-link code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text); }

.claim { padding: 9px 12px; border-radius: 10px; margin-bottom: 8px; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); }
.claim.ok { background: rgba(39,192,147,.14); border-color: var(--green); }
.claim.no { background: rgba(239,74,90,.12); border-color: var(--red); }

/* ---------------- vista del jugador (celular) ---------------- */
body.player-mode { overflow: hidden; }
body.player-mode .app-header,
body.player-mode .tabs,
body.player-mode main,
body.player-mode .bottom-nav,
body.player-mode .toast { display: none !important; }

.player-app {
  position: fixed; inset: 0; z-index: 90; overflow-y: auto;
  background:
    radial-gradient(900px 420px at 50% -10%, #1d3357 0%, transparent 65%),
    var(--bg);
  display: flex; flex-direction: column;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
body:not(.player-mode) .player-app { display: none !important; }
.player-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px calc(12px + env(safe-area-inset-top)) 16px;
  background: rgba(14, 22, 38, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.ph-sala { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.ph-sala b { color: var(--text); font-size: 15px; letter-spacing: .04em; }
.ph-sala .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.ph-sala .dot.on { background: var(--green); box-shadow: 0 0 0 4px rgba(39,192,147,.15); }
.ph-name { font-size: 13px; font-weight: 700; color: var(--text); max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.player-body { padding: 16px; max-width: 560px; width: 100%; margin: 0 auto; }

.p-hero { text-align: center; padding: 18px 0 8px; }
.p-hero-ball {
  width: 110px; height: 110px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px; font-weight: 800; color: #12203a;
  background: radial-gradient(circle at 32% 26%, #fff, #dfe8f5 60%, #b9c8dd 100%);
  box-shadow: 0 14px 30px rgba(0,0,0,.45);
}
.p-hero h1 { font-size: 22px; margin-bottom: 6px; }
.p-hero p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.p-join-form { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 0 auto; }
.p-join-form input {
  padding: 14px; border-radius: 12px; background: #12203a; border: 1px solid var(--line);
  color: var(--text); font-size: 16px; text-align: center;
}
.p-join-form .btn { padding: 15px; font-size: 15px; }

.p-status { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 12px; }

.p-last {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 16px; margin-bottom: 12px;
}
.p-last-ball {
  width: 72px; height: 72px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 30px; font-weight: 800; color: #12203a;
  background: radial-gradient(circle at 32% 26%, #fff, #e3ebf6 62%, #c3d1e2 100%);
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.14);
}
.p-last-ball[data-l="B"] { box-shadow: inset 0 0 0 3px var(--b), inset 0 -6px 12px rgba(0,0,0,.14); }
.p-last-ball[data-l="I"] { box-shadow: inset 0 0 0 3px var(--i), inset 0 -6px 12px rgba(0,0,0,.14); }
.p-last-ball[data-l="N"] { box-shadow: inset 0 0 0 3px var(--n), inset 0 -6px 12px rgba(0,0,0,.14); }
.p-last-ball[data-l="G"] { box-shadow: inset 0 0 0 3px var(--g), inset 0 -6px 12px rgba(0,0,0,.14); }
.p-last-ball[data-l="O"] { box-shadow: inset 0 0 0 3px var(--o), inset 0 -6px 12px rgba(0,0,0,.14); }
.p-last-meta { display: flex; flex-direction: column; gap: 4px; }
.p-last-meta span { font-size: 12px; color: var(--muted); }
.p-last-meta b { font-size: 17px; font-variant-numeric: tabular-nums; }

.p-called { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; max-height: 78px; overflow-y: auto; }
.chipnum {
  min-width: 30px; height: 26px; padding: 0 6px; border-radius: 7px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}

.p-winner {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; padding: 14px 16px;
  border-radius: 14px; background: linear-gradient(100deg, rgba(39,192,147,.22), rgba(255,194,71,.14));
  border: 1px solid var(--green);
}
.p-winner b { font-size: 16px; }
.p-winner span { font-size: 13px; color: var(--muted); }

.p-cards { display: flex; flex-direction: column; gap: 14px; }
.p-card {
  background: #fff; border-radius: 16px; padding: 10px 10px 12px;
  box-shadow: 0 8px 22px rgba(0,0,0,.3);
}
.p-card .mini-card { background: transparent; box-shadow: none; border: 0; padding: 0; }
.p-card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  color: #16233a; font-size: 13px; font-weight: 700; margin-bottom: 8px;
}
.p-progress { font-size: 11px; font-weight: 700; color: #0b6fa4; background: #eaf2fb; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.p-progress.win { background: #12203a; color: #ffd66b; }
.p-card .btn { margin-top: 10px; background: #16233a; color: #fff; }
.p-card .btn.gold { background: linear-gradient(180deg, #ffd479, var(--gold)); color: #2a1d00; }
.p-hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; line-height: 1.5; }
/* QR de la sala */
.sala-body { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.sala-info { flex: 1; min-width: 280px; }
.sala-qr-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px; background: #fff; border-radius: 14px;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
}
.sala-qr { width: 190px; height: 190px; }
.sala-qr svg { width: 100%; height: 100%; display: block; }
.sala-qr-wrap span { font-size: 11px; font-weight: 700; color: #16233a; text-transform: uppercase; letter-spacing: .06em; }
/* selector de color del tema */
.field input[type="color"] {
  padding: 4px; height: 42px; cursor: pointer;
  background: #12203a; border: 1px solid var(--line); border-radius: 10px;
}
.field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
/* entrada del jugador con código */
.unirse-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.unirse-row input {
  flex: 0 1 200px; min-width: 140px;
  padding: 12px; border-radius: 12px; text-align: center;
  font-size: 26px; font-weight: 800; letter-spacing: .32em;
  font-variant-numeric: tabular-nums;
  background: #12203a; border: 1px solid var(--line); color: var(--text);
}
.unirse-row input::placeholder { letter-spacing: .18em; opacity: .35; }
.unirse-row input:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(47,128,237,.18); }
/* control rápido del ritmo automático */
.ritmo {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 10px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.ritmo-lbl { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ritmo b { font-size: 16px; font-variant-numeric: tabular-nums; min-width: 42px; text-align: center; }
.ritmo-btn {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: #12203a; border: 1px solid var(--line); color: var(--text);
  font-size: 19px; font-weight: 800; line-height: 1;
  transition: background .15s, transform .1s;
}
.ritmo-btn:hover { background: #1b3155; }
.ritmo-btn:active { transform: scale(.94); }
.ritmo-hint { margin-left: auto; font-size: 11px; color: var(--muted); }
@media (max-width: 420px) { .ritmo-hint { display: none; } }