/* ==========================================================================
   SUERTÉA v2 — sistema de diseño compartido (portal del cliente + panel)
   Tema oscuro por defecto (<html data-theme="dark">); variante [data-theme="light"].
   Mobile-first. Sin dependencias. Los nombres de componente son estables:
   el panel (css/suertea-admin.css) reutiliza .card .btn .badge .progress etc.
   ========================================================================== */

/* ---- 1. Tokens ---------------------------------------------------------- */
:root {
  --bg: #050a07;
  --bg2: #0a1a0e;
  --card: #0c1f13;
  --card2: #102618;
  --borde: rgba(240, 190, 60, .35);
  --texto: #f4f1e6;
  --muted: #9aa79c;
  --oro: #ffe08a;
  --oro2: #c99a1e;
  --verde: #1e8f3a;
  --ambar: #d99a1b;
  --rojo: #c0392b;
  --ok: #39bd62;
  --radio: 18px;

  /* auxiliares (no forman parte del contrato mínimo) */
  --oro-medio: #e8b830;
  --sobre-oro: #161407;
  --sombra: 0 8px 28px rgba(0, 0, 0, .35);
  --linea: rgba(244, 241, 230, .09);
  --glow: radial-gradient(120% 60% at 50% -5%, rgba(30, 143, 58, .22), transparent 70%);
  --fuente: Montserrat, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f6f9f4;
  --bg2: #e8f2e6;
  --card: #ffffff;
  --card2: #eef5ec;
  --borde: rgba(160, 117, 20, .38);
  --texto: #15271a;
  --muted: #566b5c;
  --oro: #ffe08a;
  --oro2: #a77a14;
  --verde: #187831;
  --ambar: #ad7411;
  --rojo: #ae3025;
  --ok: #238647;
  --sombra: 0 8px 24px rgba(21, 39, 26, .10);
  --linea: rgba(21, 39, 26, .10);
  --glow: radial-gradient(120% 60% at 50% -5%, rgba(30, 143, 58, .12), transparent 70%);
  color-scheme: light;
}

/* ---- 2. Base ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--texto);
  font: 15px/1.5 var(--fuente);
  -webkit-font-smoothing: antialiased;
}
body::before {               /* brillo verde suave, fijo, sin repintar al hacer scroll */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--glow), linear-gradient(180deg, var(--bg2), var(--bg) 70%);
  pointer-events: none;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 8px 0; }
a { color: var(--oro); }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button, a, input, select { touch-action: manipulation; }
button:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muted, .text-muted { color: var(--muted); }
.center { text-align: center; }

/* ---- 3. Contenedor y cabecera del portal -------------------------------- */
.portal {
  max-width: 540px;
  margin: 0 auto;
  padding: 14px 16px 112px;       /* hueco para la navegación inferior */
}
.portal--sin-nav { padding-bottom: 36px; }

.brand { text-align: center; margin: 4px 0 18px; }
.brand a { display: inline-block; text-decoration: none; }
.brand img {
  display: block;
  width: min(270px, 74vw);
  height: auto;
  margin: 0 auto;
  mix-blend-mode: lighten;        /* el fondo negro del logo se funde con el fondo */
}
[data-theme="light"] .brand img { mix-blend-mode: normal; border-radius: 22px; background: #000; }
.brand strong { display: block; color: var(--oro); font-size: 28px; letter-spacing: -.5px; }
.brand small {
  display: block; margin-top: 2px; font-size: 10px; letter-spacing: 3px; color: var(--muted);
}

.topbar {
  display: flex; align-items: center; gap: 12px; margin: 0 0 14px;
}
.topbar-back {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 50%; border: 1px solid var(--borde); background: var(--card);
  color: var(--texto); text-decoration: none;
}
.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; text-decoration: none; color: var(--oro); min-width: 0; }
.topbar-brand img { width: 30px; height: 30px; object-fit: contain; }
.topbar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.svg-icon { width: 22px; height: 22px; flex: none; }

/* El trébol y el logo son PNG/JPG con fondo negro: en tema oscuro se funden con el fondo. */
.topbar-brand img, .success-icon, .empty-state img { mix-blend-mode: lighten; }
[data-theme="light"] .topbar-brand img,
[data-theme="light"] .success-icon,
[data-theme="light"] .empty-state img { mix-blend-mode: normal; border-radius: 14px; }

/* ---- 4. Tarjetas -------------------------------------------------------- */
.card, .summary {
  background: linear-gradient(150deg, var(--card), var(--card2));
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 18px;
  margin: 14px 0;
  box-shadow: var(--sombra);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card--flat { box-shadow: none; }
.empty-state { text-align: center; padding: 30px 16px; }
.empty-state img { margin-bottom: 8px; }

.eyebrow {
  color: var(--oro); font-weight: 800; letter-spacing: 1.2px; font-size: 12px; text-transform: uppercase;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border: 1px solid var(--borde); border-radius: 999px;
  color: var(--oro); font-weight: 800; font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
}
.rifa-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.rifa-num {
  color: var(--oro); font-weight: 800; font-size: 13px;
  border: 1px solid var(--borde); border-radius: 10px; padding: 3px 9px;
}
.prize-label { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin: 0; }
.prize { margin: 2px 0 10px; font-size: 30px; line-height: 1.15; font-weight: 800; color: var(--oro); overflow-wrap: anywhere; }
.prize--largo { font-size: 22px; }
.prize-image { display: block; width: 100%; max-height: 230px; object-fit: contain; border-radius: 14px; margin: 6px 0 10px; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.fact {
  background: rgba(0, 0, 0, .18); border: 1px solid var(--linea); border-radius: 14px; padding: 10px 12px;
}
[data-theme="light"] .fact { background: var(--card2); }
.fact small { display: block; color: var(--muted); font-size: 11px; }
.fact strong { font-size: 17px; }

.detail {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  margin: 10px 0; overflow-wrap: anywhere;
}
.detail > :first-child { color: var(--muted); }
.detail > :last-child { text-align: right; font-weight: 700; }

/* ---- 5. Botones --------------------------------------------------------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 12px 16px; margin: 12px 0;
  border: 1px solid var(--borde); border-radius: 14px;
  background: transparent; color: var(--texto);
  font-weight: 800; text-align: center; text-decoration: none; letter-spacing: .3px;
}
.btn-primary {
  background: linear-gradient(115deg, #ffe08a, var(--oro-medio) 55%, #c99a1e);
  color: var(--sobre-oro);
  border: 0;
  text-transform: uppercase;
  box-shadow: 0 6px 20px rgba(232, 184, 48, .22);
}
.btn-secondary { background: transparent; border-color: var(--oro2); color: var(--texto); }
.btn-danger { border-color: var(--rojo); color: #ff9d8f; }
[data-theme="light"] .btn-danger { color: var(--rojo); }
.btn-sm { width: auto; min-height: 38px; padding: 6px 14px; margin: 0; font-size: 13px; border-radius: 11px; }
.btn-inline { display: inline-flex; width: auto; }
.btn:active:not(:disabled) { transform: translateY(1px); }

/* ---- 6. Insignias, alertas, aviso ---------------------------------------- */
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--borde); color: var(--oro); font-size: 12px; font-weight: 800; letter-spacing: .5px;
}
.badge-ok { color: #8be8a6; border-color: rgba(57, 189, 98, .5); background: rgba(57, 189, 98, .12); }
.badge-warn { color: #ffd37a; border-color: rgba(217, 154, 27, .55); background: rgba(217, 154, 27, .12); }
.badge-danger { color: #ff9d8f; border-color: rgba(192, 57, 43, .6); background: rgba(192, 57, 43, .14); }
.badge-muted { color: var(--muted); border-color: var(--linea); }
[data-theme="light"] .badge-ok { color: var(--ok); }
[data-theme="light"] .badge-warn { color: var(--ambar); }
[data-theme="light"] .badge-danger { color: var(--rojo); }

.alert, .error {
  margin: 12px 0; padding: 12px 14px; border-radius: 12px; font-size: 14px;
  border: 1px solid rgba(192, 57, 43, .7); background: rgba(192, 57, 43, .13); color: #ffc4b8;
}
[data-theme="light"] .alert, [data-theme="light"] .error { color: #8a2217; }
.alert-ok { border-color: rgba(57, 189, 98, .6); background: rgba(57, 189, 98, .12); color: #b6f0c7; }
[data-theme="light"] .alert-ok { color: #14602e; }
.alert-info { border-color: var(--borde); background: rgba(240, 190, 60, .08); color: var(--texto); }

.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%);
  z-index: 50; width: max-content; max-width: min(92vw, 420px);
  padding: 12px 18px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--oro2); color: var(--texto);
  box-shadow: var(--sombra); font-weight: 600; text-align: center;
}

/* ---- 7. Progreso y cuenta regresiva -------------------------------------- */
.progress-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-top: 14px; }
.progress-row strong { color: var(--oro); }
.progress {
  height: 12px; margin-top: 6px; border-radius: 999px; overflow: hidden;
  background: rgba(130, 148, 124, .22);
}
.progress > span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--verde), #9ad85a 60%, var(--oro));
  transition: width .5s ease;
}

.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 14px; }
.countdown > div {
  border: 1px solid var(--borde); border-radius: 12px; padding: 8px 2px 6px;
  text-align: center; background: rgba(0, 0, 0, .18);
}
[data-theme="light"] .countdown > div { background: var(--card2); }
.countdown b { display: block; font-size: 24px; line-height: 1.1; color: var(--oro); font-variant-numeric: tabular-nums; }
.countdown small { font-size: 10px; color: var(--muted); }
.countdown.is-over b { color: var(--muted); }
.countdown-title { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* ---- 8. Stepper ---------------------------------------------------------- */
.stepper { display: flex; list-style: none; margin: 4px 0 16px; padding: 0; counter-reset: paso; }
.stepper li {
  flex: 1; position: relative; text-align: center; font-size: 11px; font-weight: 600; color: var(--muted);
}
.stepper li::before {          /* círculo numerado */
  counter-increment: paso; content: counter(paso);
  display: grid; place-items: center; width: 28px; height: 28px; margin: 0 auto 4px;
  border-radius: 50%; border: 1px solid var(--muted); background: var(--bg);
  position: relative; z-index: 1; font-size: 13px; font-weight: 800;
}
.stepper li + li::after {      /* línea que une con el paso anterior */
  content: ""; position: absolute; top: 14px; right: 50%; width: 100%; height: 2px;
  background: var(--linea);
}
.stepper li[aria-current="step"] { color: var(--oro); }
.stepper li[aria-current="step"]::before {
  background: linear-gradient(130deg, var(--oro), var(--oro-medio)); border-color: var(--oro); color: var(--sobre-oro);
  box-shadow: 0 0 12px rgba(255, 224, 138, .45);
}
.stepper li[data-done] { color: var(--texto); }
.stepper li[data-done]::before { content: "✓"; border-color: var(--oro2); color: var(--oro); }
.stepper li[data-done]::after, .stepper li[aria-current="step"]::after { background: var(--oro2); }

/* ---- 9. Fichas de número y tablero --------------------------------------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 12px; margin: 12px 0; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--verde); }
.dot.reserved { background: var(--ambar); }
.dot.sold { background: var(--rojo); }

.number {
  display: grid; place-items: center; width: 100%; aspect-ratio: 1 / 1; padding: 0;
  border: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #34b95a, var(--verde) 62%, #11602a);
  color: #fff; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  font-size: clamp(9px, 2.9vw, 12px);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .25);
}
button.number { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.number.selected {
  background: radial-gradient(circle at 35% 28%, #fff4c2, var(--oro) 38%, var(--oro-medio) 75%, var(--oro2));
  color: #1b1505;
  box-shadow: 0 0 0 2px rgba(255, 224, 138, .45), 0 0 12px rgba(255, 216, 90, .6);
  transform: scale(1.06);
}
.number.apartado { background: var(--ambar); color: #1b1505; cursor: not-allowed; box-shadow: none; }
.number.pagado { background: var(--rojo); opacity: .6; cursor: not-allowed; box-shadow: none; }
.number.conflict { outline: 2px solid var(--oro); outline-offset: 2px; animation: sacudir .35s 2; }
@keyframes sacudir { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

.number-grid {
  display: grid; grid-template-columns: repeat(var(--cols, 10), minmax(0, 1fr)); gap: 6px;
}
.number-grid--4 { --cols: 8; }
.number-grid--4 .number { font-size: clamp(9px, 2.6vw, 11px); }
.board {
  background: rgba(0, 0, 0, .18); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 12px 10px; margin: 12px 0;
}
[data-theme="light"] .board { background: var(--card2); }
.scroll-grid { max-height: min(50vh, 360px); overflow-y: auto; overscroll-behavior: contain; }

.numbers { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 14px 0; }
.numbers .number { width: 48px; font-size: 16px; }
.numbers .number.sm { width: 34px; font-size: 12px; }

.rangos details { border: 1px solid var(--linea); border-radius: 14px; margin: 8px 0; background: rgba(0, 0, 0, .15); }
.rangos summary { padding: 12px 14px; cursor: pointer; font-weight: 700; color: var(--oro); }
.rangos .number-grid { padding: 4px 10px 12px; }

.search-box { margin: 12px 0; }
.search-results { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.search-results .number { width: 52px; font-size: 13px; }

/* ---- 10. Formularios ----------------------------------------------------- */
label { display: block; font-size: 13px; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  font-size: 16px;                /* 16px evita el zoom automático de iOS al enfocar */
  border: 1px solid var(--borde); border-radius: 12px;
  background: var(--card2); color: var(--texto);
}
input::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--oro); outline-offset: 0; }
.field {
  display: flex; align-items: center; gap: 12px; margin: 10px 0; padding: 10px 14px;
  background: var(--card); border: 1px solid var(--borde); border-radius: 14px;
}
.field > svg { color: var(--muted); }
.field-body { flex: 1; min-width: 0; }
.field-body small { display: block; color: var(--texto); font-size: 12px; font-weight: 600; }
.field-body input { min-height: 34px; padding: 2px 0; border: 0; border-radius: 0; background: transparent; }
.field-body input:focus { outline: 0; }
.field:focus-within { border-color: var(--oro); box-shadow: 0 0 0 2px rgba(255, 224, 138, .25); }
.field.is-invalid { border-color: var(--rojo); }
.field-error { margin: -4px 4px 8px; font-size: 12px; color: #ff9d8f; }
[data-theme="light"] .field-error { color: var(--rojo); }
.row { display: flex; align-items: flex-end; gap: 10px; }
.row > * { flex: 1; }
.row > .btn { flex: none; width: auto; margin: 0; }
.note { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-size: 12px; color: var(--muted); }

/* ---- 11. Resumen fijo de la selección ------------------------------------ */
.summary-bar {
  position: sticky; bottom: 0; z-index: 5;
  margin: 14px -16px 0; padding: 20px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 26%);
}
.summary-card {
  background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 12px 14px; box-shadow: 0 -4px 24px rgba(0, 0, 0, .35);
}
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.summary-row small { display: block; color: var(--muted); font-size: 11px; }
.summary-row strong { font-size: 22px; color: var(--oro); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 28px; align-items: center; }
.chips .number { width: 30px; font-size: 11px; transform: none; }
.chips .vacio { color: var(--muted); font-size: 13px; }
.summary-card .btn { margin: 10px 0 0; }

/* ---- 12. Éxito, códigos, pagos ------------------------------------------- */
.success { text-align: center; }
.success-icon { display: block; width: 84px; height: 84px; margin: 6px auto 8px; object-fit: contain; }
.success h1 { font-size: 30px; color: var(--oro); }
.code {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 8px 0 0; padding: 8px 8px 8px 16px; border: 1px solid var(--borde); border-radius: 12px;
  background: rgba(0, 0, 0, .2); font-size: 18px; font-weight: 800; letter-spacing: 1px; overflow-wrap: anywhere;
}
.code .btn { margin: 0; }
.pagos .detail strong { color: var(--texto); }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.copy-row span:first-child { color: var(--muted); }
.copy-row b { margin-left: auto; overflow-wrap: anywhere; text-align: right; }
.copy-btn {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--borde); background: transparent; color: var(--oro);
}
.lista-resultados { list-style: none; margin: 0; padding: 0; }
.lista-resultados li {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 8px 0;
  border: 1px solid var(--linea); border-radius: 14px; background: var(--card);
}
.lista-resultados .number { width: 38px; flex: none; font-size: 13px; }
.lista-resultados .fecha { margin-left: auto; color: var(--muted); font-size: 12px; }
.tagline { text-align: center; color: var(--oro); font-style: italic; font-size: 13px; margin: 20px 0 0; }

/* ---- 13. Navegación inferior del portal ----------------------------------- */
.portal-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; padding: 0 0 env(safe-area-inset-bottom);
  background: var(--bg); border-top: 1px solid var(--borde);
}
.portal-nav-inner { display: flex; width: 100%; max-width: 540px; }
.portal-nav a, .portal-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 8px; border: 0; background: none;
  color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none;
}
.portal-nav [aria-current="page"] { color: var(--oro); }

/* ---- 14. Piezas para el panel (reutilizables) ------------------------------ */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.kpi { background: var(--card); border: 1px solid var(--borde); border-radius: 16px; padding: 14px; }
.kpi small { display: block; color: var(--muted); font-size: 12px; }
.kpi strong { display: block; font-size: 22px; margin-top: 2px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--linea); border-radius: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--linea); white-space: nowrap; }
.table th { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.table tr:last-child td { border-bottom: 0; }

/* ---- 15. Transiciones y escritorio ---------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .btn, .number { transition: background .15s, box-shadow .15s, transform .12s, opacity .15s; }
  .step-enter { animation: entrar .22s ease-out; }
  @keyframes entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
@media (min-width: 480px) {
  .number-grid { gap: 8px; }
  .number { font-size: 13px; }
  .number-grid--4 .number { font-size: 11px; }
  .portal { padding-left: 24px; padding-right: 24px; }
  .summary-bar { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
}

/* ---- 16. Capa de juego: Parchís (activa con <html class="game-on">) ----
   El arte (tablero, fichas, tu casa, META, pista, dado) vive en css/suertea-game.css y js/game-fx.js.
   Aquí solo está lo que el portal necesita para COLOCARLO. Todo cuelga de .game-on: si el juego
   no carga, el diseño base de arriba queda intacto. Los nombres de clase (.pool-*, .hero-mesa,
   .mesa-*, .ok-felt, .leg-bola…) son internos y estables: solo cambia lo que se ve. -------- */

/* estado base: piezas de juego ocultas hasta que js/portal.js las enciende */
.hero-mesa:not(.is-ready), .pista:not(.is-built) { display: none; }
.game-on .legend--base { display: none; }
/* leyenda: Libre = ficha de color · Apartada = ficha con reloj (atenuada) · Vendida = casilla en la META (✓ dorado) */
.legend--juego { gap: 6px 16px; }
.leg-bola {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%; vertical-align: -2px;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .75) 0 14%, rgba(255, 255, 255, 0) 38%),
    conic-gradient(#d81f26 0 25%, #f7c600 0 50%, #12873a 0 75%, #1d4fd8 0);
  box-shadow: inset -1px -2px 2px rgba(0, 0, 0, .3), 0 0 0 1px rgba(0, 0, 0, .35);
}
.leg-bola--res { opacity: .6; position: relative; }
.leg-bola--res::after {
  content: ""; position: absolute; right: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle, #2a1d05 0 55%, #c99a1e 60%);
}
.leg-bola--ven {
  position: relative;
  background: radial-gradient(circle at 50% 40%, #fff6dc, #ecd9a3 70%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .45), 0 0 0 1.5px var(--oro2);
}
.leg-bola--ven::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 9px; font-weight: 800; line-height: 1; color: #7a5200;
}

/* --- Inicio: tablero de parchís inclinado con sus 4 casas de color en las esquinas (madera clara, ribete dorado) --- */
.hero-mesa.is-ready {
  position: relative; height: 212px; margin: 2px -6px 8px; overflow: hidden; border-radius: 16px;
  border: 2px solid var(--oro2);
  background:
    radial-gradient(circle 74px at 0 0, rgba(216, 31, 38, .62) 0 71px, rgba(216, 31, 38, 0) 74px),
    radial-gradient(circle 74px at 100% 0, rgba(247, 198, 0, .7) 0 71px, rgba(247, 198, 0, 0) 74px),
    radial-gradient(circle 74px at 100% 100%, rgba(18, 135, 58, .62) 0 71px, rgba(18, 135, 58, 0) 74px),
    radial-gradient(circle 74px at 0 100%, rgba(29, 79, 216, .6) 0 71px, rgba(29, 79, 216, 0) 74px),
    radial-gradient(95% 90% at 50% 45%, #fbf0cd 0%, #efdba6 70%, #dcc287 100%);
  box-shadow: inset 0 0 0 1.5px rgba(88, 52, 12, .5), inset 0 0 0 5px rgba(255, 244, 205, .85), 0 8px 22px -6px rgba(0, 0, 0, .5);
}
.hero-tabla { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.hero-tabla .pool-table { width: 78%; margin: 0; }
.hero-mesa .hero-casa { position: absolute; z-index: 2; --hs: 34px; }
.hero-mesa .hero-casa--tl { left: 4px; top: 4px; }
.hero-mesa .hero-casa--tr { right: 4px; top: 4px; }
.hero-mesa .hero-casa--bl { left: 4px; bottom: 4px; }
.hero-mesa .hero-casa--br { right: 4px; bottom: 4px; }

/* --- Inicio: pista de parchís en lugar de la barra --- */
.rifa .pista.is-built { margin: 2px 0 2px; }
.rifa.has-track .progress, .apartado.has-track .progress {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); margin: 0; border: 0;
}
.pista .pq-track { padding-top: 30px; }

/* cuenta regresiva como marcador de juego (LED dorado en panel oscuro con ribete de madera) */
.game-on .countdown {
  gap: 0; padding: 10px 4px 8px; border-radius: 14px; border: 1.5px solid rgba(242, 193, 78, .6);
  background: linear-gradient(180deg, #06120a, #020805);
  box-shadow: inset 0 3px 9px rgba(0, 0, 0, .8), 0 0 0 3px #2b1608, 0 0 0 4px rgba(242, 193, 78, .35);
}
.game-on .countdown > div { position: relative; border: 0; background: none; padding: 2px 0 0; }
.game-on .countdown > div + div::before {
  content: ":"; position: absolute; left: -3px; top: 2px; font-weight: 800; font-size: 22px; line-height: 1.1;
  color: rgba(255, 211, 90, .55);
}
.game-on .countdown b { color: #ffd35a; text-shadow: 0 0 9px rgba(255, 190, 40, .75); letter-spacing: 1px; }
.game-on .countdown small { letter-spacing: .6px; text-transform: uppercase; font-size: 9px; }
.game-on .countdown-title {
  margin-top: 14px; color: var(--oro); font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; font-size: 11px;
}

/* --- Paso 1: tablero, tableros numerados, tu casa, dado --- */
.game-on .board { background: none; border: 0; padding: 0; margin: 12px 0 10px; }
.game-on .scroll-grid { max-height: none; overflow: visible; }
.mesa-nav { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; }
.mesa-nav .btn { width: 46px; min-height: 48px; margin: 0; padding: 0; font-size: 24px; line-height: 1; flex: none; }
.mesa-nav .mesa-sel { flex: 1; min-width: 0; }
.mesa-nav select { min-height: 48px; padding: 8px 10px; font-size: 13px; font-weight: 700; text-overflow: ellipsis; }
.azar-row { align-items: stretch; }
.azar-row select { height: 100%; }
.btn-romper { min-width: 140px; }
.btn-dado {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px 0 4px;
  border-color: var(--oro2);
}
.dado-caja { display: grid; place-items: center; width: 52px; height: 46px; flex: none; }
.dado-caja .pq-dice { --ds: 28px; }
.juego-ayuda { margin: 6px 0 0; font-size: 13px; color: var(--oro); min-height: 20px; }
.portal .pool-table { margin-top: 6px; }
.pool-ball.is-conflicto .pb-s { box-shadow: inset -2px -3px 5px rgba(0, 0, 0, .28), 0 0 0 2px var(--rojo), 0 0 12px rgba(192, 57, 43, .8); }
.pool-ball.is-conflicto { animation: sacudir .35s 2; }

/* resumen fijo en modo juego: tu casa arriba (ancho completo); total y botón en la fila de abajo */
.game-on .summary-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.game-on .summary-row { display: contents; }
.game-on .summary-row > div:first-child { grid-column: 1 / -1; }
.game-on .summary-row > div:first-child > small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.game-on .summary-row > .center { text-align: left; grid-column: 1; }
.game-on .summary-card > .btn { margin: 0; width: auto; min-width: 168px; grid-column: 2; }
/* tu casa pegada abajo (resumen fijo): 8 ranuras, fichas que llegan con rebote */
.game-on .summary-card .chips.pool-tray {
  --slot: 30px; gap: 5px; padding: 6px 8px; min-height: 44px; border-radius: 12px; flex-wrap: nowrap; overflow: hidden;
}
.game-on .summary-card .pool-tray .vacio { font-size: 11px; color: rgba(244, 241, 230, .6); white-space: nowrap; }
.game-on .summary-card .pool-tray-slot > .pool-ball:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; border-radius: 50%; }
.pool-ball.is-static { cursor: default; }
.bola-mini { display: block; width: 36px; }
#res-numeros .bola-mini .pool-ball { width: 100%; }

/* --- Stepper: game-fx.js lo convierte en fichas de parchís (conserva las etiquetas del texto) --- */
.stepper.pq-steps { margin: 2px 0 28px; padding-top: 30px; }

/* --- Paso 2: la luz del tablero se enciende al enfocar el campo --- */
.game-on .field { position: relative; }
.game-on .field::after {
  content: ""; position: absolute; left: 8%; right: 8%; top: -16px; height: 18px; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(255, 224, 138, .7), rgba(255, 224, 138, 0) 70%);
  transition: opacity .35s ease;
}
.game-on .field:focus-within {
  background: linear-gradient(180deg, rgba(255, 224, 138, .12), var(--card) 70%);
  box-shadow: 0 0 0 2px rgba(255, 224, 138, .3), 0 -6px 22px -4px rgba(255, 224, 138, .5);
}
.game-on .field:focus-within::after { opacity: 1; }

/* --- Paso 3: «¡Llegaste a la META!» --- */
.juego-lema {
  margin: 0 0 4px; font-size: 18px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--oro);
}
.ok-mesa { margin: 10px 0 12px; max-height: 190px; overflow: hidden; transition: max-height .5s ease, opacity .5s ease, margin .5s ease; }
.ok-mesa.is-done { max-height: 0; opacity: 0; margin: 0; }
/* tablero de parchís del paso «Listo»: madera clara, casas de color en las esquinas y ribete dorado (la META va abajo al centro) */
.ok-felt {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 12px 26px; border-radius: 14px;
  background:
    radial-gradient(circle 52px at 0 0, rgba(216, 31, 38, .55) 0 49px, rgba(216, 31, 38, 0) 52px),
    radial-gradient(circle 52px at 100% 0, rgba(247, 198, 0, .65) 0 49px, rgba(247, 198, 0, 0) 52px),
    radial-gradient(circle 52px at 100% 100%, rgba(18, 135, 58, .55) 0 49px, rgba(18, 135, 58, 0) 52px),
    radial-gradient(circle 52px at 0 100%, rgba(29, 79, 216, .55) 0 49px, rgba(29, 79, 216, 0) 52px),
    radial-gradient(115% 105% at 50% 40%, #fff6dc 0%, #f3e2b0 55%, #dfc489 100%);
  box-shadow: inset 0 0 0 1.5px rgba(88, 52, 12, .5), inset 0 0 0 5px rgba(255, 244, 205, .85), 0 0 0 2px rgba(201, 154, 30, .9);
}
.ok-bola { flex: 0 0 auto; width: 34px; display: block; }
.ok-tronera { left: 50%; bottom: 3px; width: 34px; height: 34px; translate: -50% 40%; }
.bandeja-ok { justify-content: center; margin: 10px 0 4px; }
.bandeja-ok .pool-tray-slot { --slot: 40px; }

/* --- apartado.php / resultados.php: fichas por estado --- */
.numbers.has-balls { gap: 8px; }
.numbers.pool-tray { justify-content: center; margin: 14px 0; }
.bolas--pagado.pool-tray {
  border-color: rgba(255, 224, 138, .9);
  box-shadow: inset 0 4px 9px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 224, 138, .5), 0 0 24px rgba(255, 224, 138, .35);
}
.bolas--apartado.pool-tray { --slot: 44px; }
.bolas--vencido.pool-tray { opacity: .9; }
.bolas--vencido.pool-tray.is-vacia { opacity: .55; }
.bola-suelta { position: relative; display: block; width: 58px; }
.bola-ganadora { width: 76px; margin: 10px 4px 4px; }
.bola-ganadora .pool-ball[data-state="ganadora"] .pb-s { animation: pb-winner 3.6s ease-in-out infinite; }
.bola-ganadora .pool-ball[data-state="ganadora"]::before {
  content: ""; position: absolute; z-index: 0; left: -30%; top: -30%; width: 160%; height: 160%; border-radius: 50%;
  pointer-events: none; background: radial-gradient(circle, rgba(255, 224, 138, .5), rgba(255, 224, 138, 0) 62%);
  animation: pb-halo 2.4s ease-in-out infinite;
}
.mesa-regreso { margin: 10px auto 0; max-width: 240px; }
.mesa-regreso:not(.is-ready) { display: none; }
.pista-leyenda {
  display: flex; list-style: none; margin: -2px 0 6px; padding: 0 4px; font-size: 11px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase; color: var(--muted);
}
.pista-leyenda li { flex: 1; text-align: center; }
.pista-leyenda li:first-child { text-align: left; }
.pista-leyenda li:last-child { text-align: right; }
.pista-leyenda li[data-on] { color: var(--oro); }
.apartado--vencido .pista-leyenda li:not(:first-child) { color: var(--muted); }
.number--bola { width: 38px; background: none; box-shadow: none; display: block; font-size: 0; }
.lista-resultados .number--bola { width: 40px; }

@media (prefers-reduced-motion: reduce) {
  .ok-mesa, .game-on .field::after, .juego-lema { transition: none; animation: none; }
  .bola-ganadora .pool-ball[data-state="ganadora"] .pb-s, .bola-ganadora .pool-ball[data-state="ganadora"]::before { animation: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .juego-lema { animation: lema-in .7s cubic-bezier(.34, 1.56, .64, 1) both; }
  @keyframes lema-in { from { opacity: 0; transform: scale(.6) translateY(10px); } to { opacity: 1; transform: none; } }
}
