/* =====================================================================
   Casino Amigos — hoja de estilos única
   Mobile-first, sin frameworks. Tema oscuro con acentos verde paño y dorado.
   CSP estricta: no se usan estilos inline en el HTML.
   ===================================================================== */

:root {
    --bg: #0d0f14;
    --bg-2: #141821;
    --surface: #181c26;
    --surface-2: #202634;
    --border: #2b3242;
    --text: #e8ebf1;
    --muted: #8d97a8;
    --primary: #1fb57a;
    --primary-2: #17935f;
    --gold: #f2c14e;
    --danger: #e5484d;
    --info: #3b82f6;
    --red: #d63a3a;
    --black: #1e222b;
    --green: #169a5a;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --bottomnav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: radial-gradient(1200px 600px at 50% -200px, #1a2433 0%, var(--bg) 60%) fixed, var(--bg);
    min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
code, pre { font-family: var(--mono); font-size: .85em; }
small { font-size: .82em; }
.muted { color: var(--muted); }
.text-pos { color: var(--primary); }
.text-neg { color: var(--danger); }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-wrap { white-space: normal; word-break: break-word; min-width: 140px; }
.only-mobile { display: inline-flex; }
.only-desktop { display: none; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--gold); color: #000; padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: rgba(13, 15, 20, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.topbar__inner {
    max-width: 1200px; margin: 0 auto; padding: .6rem 1rem;
    display: flex; align-items: center; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand__logo {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #0e6e46); color: #fff; font-size: 1.2rem;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset;
}
.brand__logo--lg { width: 60px; height: 60px; font-size: 2rem; border-radius: 16px; }
.brand__name { display: none; }
.tag { background: var(--gold); color: #1a1300; padding: .05rem .45rem; border-radius: 6px; font-size: .7rem; vertical-align: middle; }
.mainnav { display: none; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.balance-pill {
    display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
    padding: .3rem .9rem; color: var(--gold);
}
.balance-pill:hover { text-decoration: none; border-color: var(--gold); }
.balance-pill__label { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.balance-pill strong { font-variant-numeric: tabular-nums; font-size: 1rem; }
.inline-form { display: inline; margin: 0; }

/* ---------- Bottom nav (móvil) ---------- */
.bottomnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: rgba(20, 24, 33, .97); border-top: 1px solid var(--border);
}
.bottomnav__link {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); font-size: .7rem;
}
.bottomnav__link:hover { text-decoration: none; color: var(--text); }
.bottomnav__link.is-active { color: var(--gold); }
.layout-app .footer { padding-bottom: calc(var(--bottomnav-h) + 1.5rem); }

/* ---------- Layout general ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 1rem; display: grid; gap: 1rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 1rem; }
.page-head h1 { margin-bottom: .2rem; }
.page-head p { margin: .2rem 0 0; }
.page-head--row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.back-link { display: inline-block; font-size: .85rem; margin-bottom: .35rem; color: var(--muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.section-head h2 { margin: 0; }
.two-cols, .three-cols { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.two-cols > *, .three-cols > * { min-width: 0; }

/* ---------- Card ---------- */
.card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem; box-shadow: var(--shadow); min-width: 0;
}
.card--narrow { max-width: 560px; }

/* ---------- Alertas y toasts ---------- */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); border: 1px solid; }
.alert--success { background: rgba(31, 181, 122, .12); border-color: rgba(31, 181, 122, .45); color: #b9f3d9; }
.alert--error { background: rgba(229, 72, 77, .12); border-color: rgba(229, 72, 77, .5); color: #ffc9ca; }
.alert--info { background: rgba(59, 130, 246, .12); border-color: rgba(59, 130, 246, .45); color: #cfe0ff; }
.announcement { white-space: pre-line; }
.toast-stack {
    position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--bottomnav-h) + 12px + env(safe-area-inset-bottom));
    display: grid; gap: .5rem; width: min(92vw, 420px); pointer-events: none;
}
.toast {
    padding: .7rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2);
    border: 1px solid var(--border); box-shadow: var(--shadow); animation: toast-in .2s ease-out;
}
.toast--success { border-color: var(--primary); }
.toast--error { border-color: var(--danger); }
.toast.is-leaving { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .65rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; color: var(--text); background: var(--surface-2);
    transition: background .15s, border-color .15s, transform .05s; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: linear-gradient(180deg, var(--primary), var(--primary-2)); color: #03140c; }
.btn--primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover:not(:disabled) { border-color: var(--muted); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { padding: .35rem .7rem; font-size: .85rem; }
.btn--lg { padding: .85rem 1.6rem; font-size: 1.05rem; }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.icon { flex-shrink: 0; }

/* ---------- Formularios ---------- */
.form { display: grid; gap: .9rem; }
.field { display: grid; gap: .3rem; }
.field__label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.field__hint { color: var(--muted); font-size: .78rem; }
.field-error { color: #ff9ea1; font-size: .82rem; margin: 0; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=number], input[type=date], select, textarea {
    width: 100%; padding: .7rem .8rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: #0f131b; color: var(--text); font: inherit;
    min-height: 44px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; }
input[type=date] { color-scheme: dark; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.field--inline { flex: 1 1 140px; }
.field--grow { flex: 3 1 220px; }
.stack-sm { display: grid; gap: .4rem; margin-top: .4rem; min-width: 220px; }

/* ---------- Tablas (en móvil se convierten en tarjetas) ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.table th, .table td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:hover { background: rgba(255, 255, 255, .02); }
.table__empty td { text-align: center; color: var(--muted); padding: 1.2rem; }
.table tr.is-new { animation: row-flash 1.2s ease-out; }
@keyframes row-flash { from { background: rgba(242, 193, 78, .25); } }

@media (max-width: 719px) {
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .6rem; padding: .3rem .2rem; }
    .table td { border: 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; padding: .3rem .6rem; }
    .table td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; text-align: left; flex-shrink: 0; }
    .table td:not([data-label])::before { content: none; }
    .table td.cell-wrap { min-width: 0; }
    .table__empty td { justify-content: center; }
    .table--matrix td { justify-content: space-between; }
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700;
    background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap;
}
.badge--won, .badge--active { background: rgba(31, 181, 122, .15); border-color: rgba(31, 181, 122, .5); color: #7ee2b5; }
.badge--lost, .badge--inactive { background: rgba(229, 72, 77, .13); border-color: rgba(229, 72, 77, .45); color: #ff9ea1; }
.badge--push { background: rgba(59, 130, 246, .13); border-color: rgba(59, 130, 246, .45); color: #a8c8ff; }
.badge--refunded, .badge--pending { color: var(--muted); }
.badge--role-administrador { color: var(--gold); border-color: rgba(242, 193, 78, .45); }
.badge--role-superadministrador { background: var(--gold); color: #1a1300; border-color: var(--gold); }
.badge--tx-win, .badge--tx-manual_credit, .badge--tx-bonus, .badge--tx-refund { color: #7ee2b5; }
.badge--tx-bet, .badge--tx-manual_debit { color: #ff9ea1; }
.badge--tx-adjustment { color: var(--gold); }

/* ---------- Dashboard / stats ---------- */
.hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.hero p { margin: 0; }
.hero__label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin: 0; }
.hero__balance { font-size: 2.2rem; font-weight: 800; color: var(--gold); margin: .1rem 0 .4rem; font-variant-numeric: tabular-nums; }
.hero__balance small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.hero__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.stats-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; display: grid; gap: .15rem; min-width: 0; }
.stat__label { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.stat__value { font-size: 1.25rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: .5rem 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Paginación ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
.pagination__info { color: var(--muted); font-size: .85rem; }

/* ---------- Misceláneos ---------- */
.rules { margin-top: .5rem; color: var(--muted); font-size: .88rem; }
.rules summary { cursor: pointer; color: var(--text); font-weight: 600; }
.rules ul { padding-left: 1.1rem; }
.json { white-space: pre-wrap; word-break: break-word; background: #0b0e14; padding: .6rem; border-radius: 8px; border: 1px solid var(--border); max-height: 320px; overflow: auto; text-align: left; }
details summary { cursor: pointer; }
.inline-action summary { list-style: none; }
.inline-action summary::-webkit-details-marker { display: none; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.bars li { display: grid; grid-template-columns: 48px 1fr auto; gap: .6rem; align-items: center; font-size: .85rem; }
.bars__meter { width: 100%; height: 14px; }
.bars__value { font-variant-numeric: tabular-nums; color: var(--muted); }
.error-page { text-align: center; }
.error-page__code { font-size: 4rem; font-weight: 800; color: var(--gold); margin: 0; line-height: 1; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-content: center; gap: 1rem; padding: 1.5rem 1rem; }
.auth__brand { text-align: center; display: grid; justify-items: center; gap: .4rem; }
.auth__brand h1 { margin: 0; }
.auth__brand p { margin: 0; }
.auth__card { width: min(420px, calc(100vw - 2rem)); display: grid; gap: 1rem; }
.auth__card h2 { margin: 0; }
.auth__switch { text-align: center; margin: 0; color: var(--muted); }
.auth__note { text-align: center; font-size: .78rem; max-width: 420px; margin: 0 auto; }

/* ---------- Panel admin ---------- */
.topbar--admin { border-bottom-color: rgba(242, 193, 78, .35); }
.admin { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: 1fr; }
.admin__nav {
    display: flex; gap: .3rem; overflow-x: auto; padding: .6rem 1rem; border-bottom: 1px solid var(--border);
    scrollbar-width: thin; position: sticky; top: 55px; z-index: 10; background: var(--bg);
}
.admin__link { padding: .45rem .8rem; border-radius: 8px; color: var(--muted); white-space: nowrap; font-weight: 600; font-size: .9rem; }
.admin__link:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.admin__link.is-active { background: var(--surface-2); color: var(--gold); }
.admin__main { padding: 1rem; display: grid; gap: 1rem; min-width: 0; align-content: start; }

/* ---------- Juegos: comunes ---------- */
.game { display: grid; gap: 1rem; }
.game__stage { text-align: center; display: grid; gap: .8rem; justify-items: center; background: radial-gradient(600px 240px at 50% 0, #1b4d36 0%, var(--surface) 70%); }
.game__controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; margin-top: 1rem; }
.game__total { font-size: 1rem; }
.game__total strong { color: var(--gold); font-variant-numeric: tabular-nums; }
.rl-message { margin: 0; min-height: 1.5em; font-weight: 600; }
.rl-message.is-win { color: #7ee2b5; }
.rl-message.is-lose { color: #ff9ea1; }
.amount-input { display: flex; gap: .35rem; align-items: stretch; }
.amount-input input { flex: 1; min-width: 0; font-size: 1.1rem; font-weight: 700; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; background: #0f131b; padding: .3rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.segmented__opt { padding: .6rem; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.segmented__opt.is-selected { background: var(--surface-2); color: var(--gold); box-shadow: 0 0 0 1px var(--border) inset; }
.segmented--big .segmented__opt { padding: .9rem; font-size: 1.1rem; }
.dice-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; text-align: center; }
.dice-info > div { background: #0f131b; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem; display: grid; }
.dice-info span { font-size: .72rem; }
.dice-info strong { font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--gold); height: 32px; }

/* ---------- Ruleta ---------- */
.rl-display { display: grid; justify-items: center; gap: .5rem; }
.rl-ball {
    width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center;
    font-size: 2.4rem; font-weight: 800; color: #fff; background: #2a3040;
    border: 4px solid var(--gold); box-shadow: 0 0 0 6px rgba(242, 193, 78, .15), var(--shadow);
    font-variant-numeric: tabular-nums;
}
.rl-ball--red { background: var(--red); }
.rl-ball--black { background: var(--black); }
.rl-ball--green { background: var(--green); }
.rl-ball.is-spinning { animation: pulse .18s linear infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }
.rl-history { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; min-height: 28px; }
.rl-history span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: #fff; }
.rl-history .h-red { background: var(--red); }
.rl-history .h-black { background: var(--black); border: 1px solid var(--border); }
.rl-history .h-green { background: var(--green); }

.chip-picker { display: flex; gap: .45rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }
.chip {
    width: 46px; height: 46px; border-radius: 50%; border: 3px dashed rgba(255, 255, 255, .7);
    font: inherit; font-weight: 800; font-size: .85rem; color: #fff; cursor: pointer;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .4); transition: transform .1s;
}
.chip--0 { background: #6b7280; }
.chip--1 { background: #c0392b; }
.chip--2 { background: #2563eb; }
.chip--3 { background: #16a34a; }
.chip--4 { background: #111827; }
.chip--5 { background: #7c3aed; }
.chip.is-selected { transform: translateY(-4px); box-shadow: 0 0 0 3px var(--gold), 0 6px 0 rgba(0, 0, 0, .4); }

/* Paño: grilla vertical en móvil (5 columnas x 14 filas); horizontal en escritorio (14 x 5).
   Las clases gx-N / gy-N indican columna/fila en la versión horizontal; en móvil se transponen. */
.rl-board {
    display: grid; gap: 3px; user-select: none; -webkit-user-select: none;
    grid-template-columns: repeat(3, 1fr) 1.1fr 1.1fr;
    grid-auto-rows: 40px;
    background: #0d4a31; padding: 6px; border-radius: 12px; border: 2px solid #3a2a12;
}
.rl-cell {
    position: relative; border: 1px solid rgba(255, 255, 255, .25); border-radius: 5px;
    font: inherit; font-weight: 800; color: #fff; cursor: pointer; background: transparent; padding: 0;
    font-size: .95rem; display: grid; place-items: center; touch-action: manipulation;
}
.rl-cell:hover { filter: brightness(1.2); }
.rl-cell--red { background: var(--red); }
.rl-cell--black { background: var(--black); }
.rl-cell--green { background: var(--green); }
.rl-cell--outside { background: rgba(0, 0, 0, .18); font-size: .78rem; }
.rl-cell.is-winner { box-shadow: 0 0 0 3px var(--gold), 0 0 16px var(--gold); z-index: 1; }
.chip-badge { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; z-index: 2; }
/* Móvil: gx => fila, gy => columna (espejada para que 1-2-3 queden de izquierda a derecha). */
.rl-zero { grid-row: 1; grid-column: 1 / span 3; }
/* Ruleta Americana: 0 y 00 comparten el lugar del cero (0 del lado del 1, 00 del lado del 3). */
.rl-zeros { grid-row: 1; grid-column: 1 / span 3; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.gx-2 { grid-row: 2; } .gx-3 { grid-row: 3; } .gx-4 { grid-row: 4; } .gx-5 { grid-row: 5; }
.gx-6 { grid-row: 6; } .gx-7 { grid-row: 7; } .gx-8 { grid-row: 8; } .gx-9 { grid-row: 9; }
.gx-10 { grid-row: 10; } .gx-11 { grid-row: 11; } .gx-12 { grid-row: 12; } .gx-13 { grid-row: 13; } .gx-14 { grid-row: 14; }
.gy-1 { grid-column: 3; } .gy-2 { grid-column: 2; } .gy-3 { grid-column: 1; } .gy-4 { grid-column: 4; } .gy-5 { grid-column: 5; }
.span-2 { grid-row-end: span 2; } .span-4 { grid-row-end: span 4; }

@media (min-width: 720px) {
    .rl-board { grid-template-columns: 1.1fr repeat(12, 1fr) 1.1fr; grid-auto-rows: 48px; grid-template-rows: repeat(3, 52px) 42px 42px; }
    .rl-zero { grid-column: 1; grid-row: 1 / span 3; }
    .rl-zeros { grid-column: 1; grid-row: 1 / span 3; grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
    .rl-zeros > :first-child { grid-row: 2; }
    .rl-zeros > :last-child { grid-row: 1; }
    .gx-2 { grid-column: 2; } .gx-3 { grid-column: 3; } .gx-4 { grid-column: 4; } .gx-5 { grid-column: 5; }
    .gx-6 { grid-column: 6; } .gx-7 { grid-column: 7; } .gx-8 { grid-column: 8; } .gx-9 { grid-column: 9; }
    .gx-10 { grid-column: 10; } .gx-11 { grid-column: 11; } .gx-12 { grid-column: 12; } .gx-13 { grid-column: 13; } .gx-14 { grid-column: 14; }
    .gy-1 { grid-row: 1; } .gy-2 { grid-row: 2; } .gy-3 { grid-row: 3; } .gy-4 { grid-row: 4; } .gy-5 { grid-row: 5; }
    .span-2 { grid-row-end: auto; grid-column-end: span 2; }
    .span-4 { grid-row-end: auto; grid-column-end: span 4; }
}

/* ---------- Dados ---------- */
.dice-roll { font-size: 3.4rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); letter-spacing: .02em; }
.dice-roll.is-win { color: #7ee2b5; }
.dice-roll.is-lose { color: #ff9ea1; }
.dice-roll.is-rolling { opacity: .6; }
.dice-track { position: relative; width: 100%; max-width: 560px; height: 14px; border-radius: 7px; background: rgba(229, 72, 77, .55); overflow: visible; }
.dice-track__win { position: absolute; top: 0; bottom: 0; background: rgba(31, 181, 122, .85); border-radius: 7px; }
.dice-track__marker { position: absolute; left: 0; top: -8px; width: 100%; height: 30px; pointer-events: none; display: none; transform: translateX(0); transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.dice-track__marker::before { content: ""; position: absolute; left: -2px; top: 0; width: 4px; height: 30px; background: #fff; border-radius: 2px; box-shadow: 0 0 8px #fff; }
.dice-track__marker.is-visible { display: block; }
.dice-scale { width: 100%; max-width: 560px; display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); }

/* ---------- Moneda ---------- */
.coin-scene { perspective: 800px; padding: 1rem; }
.coin { width: 140px; height: 140px; position: relative; transform-style: preserve-3d; transition: transform 1.2s cubic-bezier(.2, .8, .2, 1); }
.coin__face {
    position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; backface-visibility: hidden;
    font-weight: 800; letter-spacing: .1em; color: #3a2a00; border: 6px solid #b8860b;
    background: radial-gradient(circle at 35% 30%, #ffe89a, #f2c14e 45%, #b8860b 100%);
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35), var(--shadow);
}
.coin__face--tails { transform: rotateY(180deg); background: radial-gradient(circle at 35% 30%, #f1f1f1, #c9ccd3 45%, #7d828d 100%); border-color: #7d828d; color: #22262e; }
.coin.is-flipping { animation: coin-spin .5s linear infinite; }
.coin.show-heads { transform: rotateY(1800deg); }
.coin.show-tails { transform: rotateY(1980deg); }
@keyframes coin-spin { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }

/* ---------- Escritorio ---------- */
@media (min-width: 720px) {
    body { font-size: 15.5px; }
    .brand__name { display: inline; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .three-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .container { padding: 1.5rem 1rem; gap: 1.25rem; }
    .card { padding: 1.25rem; }
    .toast-stack { bottom: 20px; }
}
@media (min-width: 1000px) {
    .mainnav { display: flex; gap: .2rem; margin-left: 1rem; }
    .mainnav__link { color: var(--muted); padding: .45rem .75rem; border-radius: 8px; font-weight: 600; }
    .mainnav__link:hover { color: var(--text); background: var(--surface); text-decoration: none; }
    .mainnav__link.is-active { color: var(--gold); background: var(--surface-2); }
    .mainnav__link--admin { color: var(--gold); border: 1px solid rgba(242, 193, 78, .35); }
    .only-mobile { display: none; }
    .only-desktop { display: inline; }
    .bottomnav { display: none; }
    .layout-app .footer { padding-bottom: 1.5rem; }
    .three-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stats-grid--admin { grid-template-columns: repeat(4, 1fr); }
    .admin { grid-template-columns: 220px 1fr; }
    .admin__nav { flex-direction: column; border-bottom: 0; border-right: 1px solid var(--border); min-height: calc(100vh - 56px); padding: 1rem .75rem; top: 56px; align-self: start; }
    .admin__main { padding: 1.5rem; }
    .game--roulette { grid-template-columns: 300px 1fr; align-items: start; }
    .game--dice, .game--coinflip { grid-template-columns: 1fr 1fr; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Slots ---------- */
.slot-machine { width: 100%; max-width: 420px; padding: 14px; border-radius: 22px; background: linear-gradient(180deg, #5a1d1d, #2c0f0f); border: 3px solid var(--gold); box-shadow: var(--shadow); }
.slot-window { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: #0b0d12; border-radius: 14px; padding: 8px; }
.slot-window { --cell: clamp(62px, 19vw, 84px); --gap: 6px; }
.slot-reel { height: calc(3 * var(--cell) + 2 * var(--gap)); border-radius: 10px; background: linear-gradient(180deg, #1c2130, #f4f1e8 22%, #fffdf7 50%, #f4f1e8 78%, #1c2130); overflow: hidden; }
.reel-strip { display: flex; flex-direction: column; gap: var(--gap); will-change: transform; }
.slot-cell { display: grid; place-items: center; height: var(--cell); flex-shrink: 0; font-size: clamp(2rem, 11vw, 3rem); line-height: 1; user-select: none; border-radius: 8px; }
.slot-cell img { width: 78%; height: 78%; object-fit: contain; pointer-events: none; }
.slot-cell:not(.slot-cell--line) { opacity: .5; }
.reel-strip.is-blur .slot-cell { opacity: .85; }
.slot-cell.is-hit { opacity: 1; background: radial-gradient(circle, rgba(242, 193, 78, .55), rgba(242, 193, 78, 0) 70%); animation: win-pulse .6s ease-in-out 3; }
.slot-payline { position: absolute; left: 4px; right: 4px; top: 50%; height: 3px; margin-top: -1px; background: rgba(242, 193, 78, .8); border-radius: 2px; pointer-events: none; }
.slot-window.is-win .slot-payline { background: var(--primary); box-shadow: 0 0 12px var(--primary); }
@keyframes win-pulse { 50% { transform: scale(1.18); } }
.slot-prize { margin: 0; font-size: 1.3rem; font-weight: 800; color: var(--gold); padding: .2rem .9rem; border-radius: 999px; }
.slot-prize strong { font-variant-numeric: tabular-nums; }
.paytable__combo img { width: 26px; height: 26px; vertical-align: middle; }
.paytable h3 { font-size: .95rem; margin: .2rem 0 .5rem; }
.paytable ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem .8rem; }
.paytable li { display: flex; justify-content: space-between; gap: .5rem; background: #0f131b; border: 1px solid var(--border); border-radius: 8px; padding: .35rem .6rem; font-size: .9rem; }
.paytable strong { color: var(--gold); }

/* ---------- Blackjack ---------- */
.bj-table { background: radial-gradient(700px 300px at 50% 40%, #1f6b47 0%, #0f3b2a 70%); min-height: 330px; align-content: space-between; }
.bj-hand { display: grid; gap: .4rem; justify-items: center; width: 100%; }
.bj-hand__label { margin: 0; font-weight: 700; color: #e6f5ec; }
.bj-total { color: var(--gold); font-variant-numeric: tabular-nums; }
.bj-cards { display: flex; justify-content: center; min-height: 96px; }
.bj-card {
    width: 64px; height: 92px; border-radius: 8px; background: #fffdf7; color: #151821; border: 1px solid #c9c2b0;
    display: grid; grid-template-rows: auto 1fr; padding: 4px 6px; font-weight: 800; font-size: 1.05rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .45); margin-left: -18px; animation: card-in .25s ease-out;
}
.bj-card:first-child { margin-left: 0; }
.bj-card--red { color: #c0262d; }
.bj-card__suit { display: grid; place-items: center; font-size: 1.9rem; }
.bj-card--back { background: repeating-linear-gradient(45deg, #1d3e8a 0 6px, #2a53b0 6px 12px); border: 3px solid #fffdf7; }
@keyframes card-in { from { transform: translateY(-14px); opacity: 0; } }
.bj-actions .btn-row { display: grid; grid-template-columns: 1fr 1fr; }
[hidden] { display: none !important; }

@media (min-width: 1000px) {
    .game--slots, .game--blackjack { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* ---------- Admin: configuración de juegos ---------- */
.config-table { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem; margin: 0; min-width: 0; }
.config-table legend { font-weight: 700; padding: 0 .3rem; }
.table--compact td, .table--compact th { padding: .3rem; }
.table--compact input { min-height: 36px; padding: .35rem .45rem; }
@media (min-width: 1000px) { .admin-games { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* =====================================================================
   Lobby V1.2 — carrusel, buscador, categorías, secciones y tarjetas.
   Identidad propia: paño verde, dorado y acentos por categoría.
   Carruseles con scroll-snap (funcionan sin JS; lobby.js agrega flechas/puntos).
   ===================================================================== */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Carrusel de destacados */
.hero-carousel { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.hero-carousel__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; }
.hero-carousel__track::-webkit-scrollbar { display: none; }
.hero-slide { position: relative; flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 16 / 9; color: var(--text); display: block; overflow: hidden; }
.hero-slide:hover { text-decoration: none; }
.hero-slide__art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 72% 50%; }
.hero-slide__text {
    position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: .3rem;
    padding: 1rem 38% 2.1rem 1rem; background: linear-gradient(90deg, rgba(8, 10, 14, .94) 0%, rgba(8, 10, 14, .78) 50%, rgba(8, 10, 14, .1) 100%);
}
.hero-slide__kicker { font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #111; background: var(--gold); padding: .1rem .5rem; border-radius: 999px; }
.hero-slide__title { font-size: 1.35rem; line-height: 1.15; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); }
.hero-slide__desc { font-size: .8rem; color: #cfd6e2; max-width: 34rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-slide__cta { margin-top: .25rem; pointer-events: none; }
.hero-carousel__dots { position: absolute; left: 0; right: 0; bottom: .6rem; display: flex; justify-content: center; gap: .4rem; }
.hero-carousel__dot { width: 8px; height: 8px; padding: 0; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .4); cursor: pointer; transition: width .2s, background .2s; }
.hero-carousel__dot.is-active { width: 22px; background: var(--gold); }

/* Saldo compacto */
.wallet-strip { display: grid; gap: .75rem; }
.wallet-strip p { margin: 0; }
.wallet-strip__stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: 0; }
.wallet-strip__stats div { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .45rem .65rem; min-width: 0; }
.wallet-strip__stats dt { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.wallet-strip__stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Buscador + categorías */
.lobby-toolbar { display: grid; gap: .7rem; min-width: 0; }
.lobby-toolbar > * { min-width: 0; }
.lobby-search { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .3rem .35rem .3rem .9rem; }
.lobby-search:focus-within { border-color: var(--gold); }
.lobby-search .icon { color: var(--muted); flex-shrink: 0; }
.lobby-search input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: inherit; padding: .35rem 0; }
.lobby-search input:focus { outline: none; }
.lobby-search .btn { border-radius: 999px; }
.cat-chips { display: flex; gap: .5rem; overflow-x: auto; scroll-snap-type: x proximity; padding: .1rem .1rem .45rem; scrollbar-width: thin; }
.cat-chip {
    flex: 0 0 auto; scroll-snap-align: start; display: grid; justify-items: center; gap: .3rem; width: 78px; padding: .6rem .3rem .5rem;
    border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: .72rem; font-weight: 700;
    text-align: center; line-height: 1.15; transition: border-color .12s, color .12s, background .12s;
}
.cat-chip:hover { text-decoration: none; color: var(--text); border-color: #3d475c; }
.cat-chip.is-active { color: #111; background: var(--gold); border-color: var(--gold); }
.cat-chip__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: rgba(255, 255, 255, .05); color: var(--gold); }
.cat-chip.is-active .cat-chip__icon { background: rgba(0, 0, 0, .12); color: #111; }

/* Secciones */
.lobby-section { display: grid; gap: .6rem; min-width: 0; }
.lobby-section__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.lobby-section__title { margin: 0; font-size: 1.1rem; display: flex; align-items: center; gap: .55rem; }
.lobby-section__title::before { content: ""; width: 5px; height: 1.15em; border-radius: 3px; background: linear-gradient(180deg, var(--gold), var(--primary)); flex-shrink: 0; }
.lobby-section--proximamente .lobby-section__title::before { background: linear-gradient(180deg, #a78bfa, #38bdf8); }
.lobby-section--favoritos .lobby-section__title::before { background: linear-gradient(180deg, #fb7185, var(--danger)); }
.lobby-section__actions { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.lobby-section__all { font-size: .8rem; font-weight: 700; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); white-space: nowrap; }
.lobby-section__all:hover { text-decoration: none; border-color: var(--gold); }
.row-nav { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; padding: 0; }
.row-nav:disabled { opacity: .35; cursor: default; }
.row-nav .icon { width: 18px; height: 18px; }
.game-row { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: .7rem; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding-bottom: .4rem; scrollbar-width: none; }
.game-row::-webkit-scrollbar { display: none; }
.game-row > .game-card { scroll-snap-align: start; }
.games-grid { display: grid; gap: .7rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.empty-state { display: grid; gap: .6rem; justify-items: start; }
.empty-state p { margin: 0; }

/* Tarjeta de juego */
.game-card { position: relative; min-width: 0; }
.game-card__link { display: grid; gap: .45rem; color: var(--text); }
.game-card__link:hover { text-decoration: none; }
.game-card__thumb { position: relative; display: block; border-radius: 16px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); border: 1px solid var(--border); transition: transform .15s, border-color .15s, box-shadow .15s; }
.game-card__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
a.game-card__link:hover .game-card__thumb, a.game-card__link:focus-visible .game-card__thumb { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }
.game-card__play {
    position: absolute; left: 50%; bottom: .6rem; transform: translateX(-50%); padding: .3rem .9rem; border-radius: 999px;
    background: var(--primary); color: #fff; font-size: .78rem; font-weight: 800; opacity: 0; transition: opacity .15s;
}
a.game-card__link:hover .game-card__play, a.game-card__link:focus-visible .game-card__play { opacity: 1; }
.game-card__body { display: grid; gap: .05rem; padding: 0 .15rem; min-width: 0; }
.game-card__name { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card__meta { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card.is-coming-soon .game-card__thumb img, .game-card.is-maintenance .game-card__thumb img { filter: grayscale(.55) brightness(.7); }
.game-badge { position: absolute; top: .5rem; left: .5rem; font-size: .66rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 999px; }
.game-badge--new { background: var(--gold); color: #111; }
.game-badge--soon { background: #6d28d9; color: #fff; }
.game-badge--maint { background: #b45309; color: #fff; }
.fav-form { position: absolute; top: .4rem; right: .4rem; margin: 0; }
.fav-btn {
    display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 999px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .2); background: rgba(8, 10, 14, .55); color: #fff; backdrop-filter: blur(4px);
}
.fav-btn .icon { width: 18px; height: 18px; }
.fav-btn:hover { border-color: #fb7185; }
.fav-btn.is-on { color: #fb7185; border-color: #fb7185; }
.fav-btn.is-on .icon { fill: currentColor; }
.fav-btn[aria-busy="true"] { opacity: .6; }

@media (min-width: 560px) {
    .game-row { grid-auto-columns: 28%; }
    .games-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hero-slide { aspect-ratio: 21 / 9; }
}
@media (min-width: 720px) {
    .hero-slide { aspect-ratio: 1200 / 420; }
    .hero-slide__text { justify-content: center; padding: 1.5rem 2rem 2.2rem; right: auto; width: 62%; background: linear-gradient(90deg, rgba(8, 10, 14, .9) 0%, rgba(8, 10, 14, .6) 65%, rgba(8, 10, 14, 0) 100%); }
    .hero-slide__title { font-size: 2rem; }
    .hero-slide__desc { font-size: .95rem; }
    .hero-slide__art { object-position: center; }
    .wallet-strip { grid-template-columns: auto 1fr auto; align-items: center; }
    .wallet-strip__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lobby-toolbar { grid-template-columns: minmax(240px, 340px) 1fr; align-items: center; }
    .game-row { grid-auto-columns: calc((100% - 3 * .7rem) / 4); }
    .games-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
    .game-row { grid-auto-columns: calc((100% - 5 * .8rem) / 6); gap: .8rem; }
    .games-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .8rem; }
}

/* ---------- Sonido (V1.2) ---------- */
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn:hover { border-color: var(--gold); }
.icon-btn .icon { width: 19px; height: 19px; }
.sound-toggle .sound-toggle__on { display: inline-flex; }
.sound-toggle .sound-toggle__off { display: none; }
.sound-toggle.is-muted .sound-toggle__on { display: none; }
.sound-toggle.is-muted .sound-toggle__off { display: inline-flex; }
.sound-toggle.is-muted { color: var(--muted); }
.sound-settings input[type="range"] { width: 100%; accent-color: var(--gold); }

/* =====================================================================
   Kit de mesa V1.2 — cartas, fichas con valor y efectos de premio.
   Sólo transform/opacity en animaciones; todo se apaga con reduced-motion
   o "Juego rápido" (.is-fast-play).
   ===================================================================== */
.pcard { --card-w: clamp(64px, 17vw, 112px); position: relative; display: inline-block; width: var(--card-w); aspect-ratio: 280 / 390; perspective: 900px; flex-shrink: 0; }
.pcard__inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .42s cubic-bezier(.2, .8, .2, 1); transform: rotateY(180deg); }
.pcard.is-up .pcard__inner { transform: rotateY(0deg); }
.pcard__face { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 7%; backface-visibility: hidden; box-shadow: 0 4px 10px rgba(0, 0, 0, .35); user-select: none; }
.pcard__back { transform: rotateY(180deg); }
.pcard-row { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; min-height: calc(clamp(64px, 17vw, 112px) * 1.39); }
.pcard-row .pcard + .pcard { margin-left: calc(var(--card-w) * -0.28); }

.vchip { position: relative; display: inline-grid; place-items: center; width: var(--chip-w, 52px); aspect-ratio: 1; padding: 0; border: 0; background: none; border-radius: 50%; flex-shrink: 0; }
.vchip img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .45)); }
.vchip__label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: calc(var(--chip-w, 52px) * .3); color: #111; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
button.vchip { cursor: pointer; transition: transform .12s; }
button.vchip:hover { transform: translateY(-2px); }
button.vchip.is-selected { transform: translateY(-5px); outline: 3px solid var(--gold); outline-offset: 2px; }
.vchip-stack { display: inline-flex; flex-direction: column-reverse; --chip-w: 40px; }
.vchip-stack .vchip + .vchip { margin-bottom: calc(var(--chip-w) * -0.82); }

.fx-host { position: relative; }
.fx-layer { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 5; }
.fx-spark { position: absolute; width: 14px; height: 14px; margin: -7px; background: #ffe9a8; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: fx-spark 1s var(--delay, 0ms) cubic-bezier(.15, .7, .3, 1) forwards; opacity: 0; }
.fx-spark--coin { width: 12px; height: 12px; margin: -6px; clip-path: none; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4c2, var(--gold) 55%, #a97a12); }
@keyframes fx-spark {
    0% { transform: translate(0, 0) scale(.3) rotate(0); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(160deg); opacity: 0; }
}
.fx-glow::after { content: ""; position: absolute; inset: -18%; border-radius: 50%; pointer-events: none; z-index: 1;
    background: radial-gradient(closest-side, rgba(242, 193, 78, .5), rgba(242, 193, 78, 0)); animation: fx-halo 1.4s ease-out forwards; }
.fx-glow--big::after, .fx-glow--jackpot::after { animation-duration: 1.9s; background: radial-gradient(closest-side, rgba(255, 220, 120, .65), rgba(242, 193, 78, 0)); }
@keyframes fx-halo { 0% { opacity: 0; transform: scale(.6); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(1.15); } }

.is-fast-play .pcard__inner { transition: none; }
.is-fast-play .fx-spark { animation: none; }
.is-fast-play .fx-glow::after { animation-duration: .5s; }
@media (prefers-reduced-motion: reduce) {
    .pcard__inner { transition: none; }
    .fx-spark { display: none; }
}

.felt { background: radial-gradient(120% 90% at 50% 0%, #1d6b45 0%, #0f3b2a 55%, #0a2419 100%); border-color: #1f5a3f; }
.chip-rack { display: flex; flex-wrap: wrap; gap: .5rem; }
.kit-prize { font-size: 1.2rem; display: inline-block; padding: .3rem .8rem; border-radius: 999px; }

/* ---------- Ruleta V1.2: rueda y bola (kit/wheel.js) ---------- */
.rl-stage { display: grid; justify-items: center; gap: 1rem; width: 100%; }
.rwheel { position: relative; width: min(78vw, 300px); aspect-ratio: 1; border-radius: 50%; box-shadow: 0 14px 30px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(0, 0, 0, .3); }
.rwheel__rotor, .rwheel__orbit { position: absolute; inset: 0; will-change: transform; }
.rwheel__rotor img { width: 100%; height: 100%; display: block; user-select: none; pointer-events: none; }
.rwheel__ball { position: absolute; left: 50%; top: 50%; width: 5.2%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #d9dde5 55%, #9aa1ad); box-shadow: 0 2px 4px rgba(0, 0, 0, .6); }
.rwheel__pointer { position: absolute; left: 50%; top: -6px; width: 0; height: 0; margin-left: -9px; border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 16px solid var(--gold); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.chip-picker .vchip { --chip-w: 48px; }
.rl-cell { position: relative; }
.rl-cell .chip-badge.vchip { --chip-w: 22px; position: absolute; top: auto; left: auto; right: 1px; bottom: 1px; transform: none; }
.rl-cell .chip-badge .vchip__label { font-size: 7.5px; }
@media (min-width: 1000px) {
    .game--roulette { grid-template-columns: minmax(330px, 380px) 1fr; }
    .rwheel { width: 290px; }
}

/* ---------- Blackjack V1.2: cartas del kit ---------- */
.bj-table .pcard { --card-w: clamp(66px, 19vw, 104px); }
.bj-cards.pcard-row { min-height: calc(clamp(66px, 19vw, 104px) * 1.39); flex-wrap: nowrap; }
.bj-stake-line { display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.bj-stake-chips .vchip-stack { --chip-w: 30px; vertical-align: middle; }

/* ---------- Dados V1.2: dados percentiles (d10) propios ---------- */
.d10-pair { display: flex; gap: 1rem; justify-content: center; }
.d10 { position: relative; width: clamp(64px, 18vw, 84px); aspect-ratio: 1; display: grid; place-items: center; }
.d10 img { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .45)); }
.d10__num { position: relative; font-weight: 900; font-size: clamp(1.1rem, 4.6vw, 1.45rem); font-variant-numeric: tabular-nums; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); margin-top: -12%; }
#d10-units .d10__num { color: #3b2a12; text-shadow: none; }
.d10.is-rolling { animation: d10-roll .42s linear infinite; }
@keyframes d10-roll { 0% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-8px) rotate(90deg); } 50% { transform: translateY(0) rotate(180deg); } 75% { transform: translateY(-6px) rotate(270deg); } 100% { transform: translateY(0) rotate(360deg); } }
.is-fast-play .d10.is-rolling { animation: none; }
@media (prefers-reduced-motion: reduce) { .d10.is-rolling { animation: none; } .dice-track__marker { transition: none; } }

/* ---------- Cara o Cruz V1.2: caras SVG propias ---------- */
.coin__face img { width: 100%; height: 100%; display: block; border-radius: 50%; }
.coin__face--heads, .coin__face--tails { padding: 0; border: 0; background: none; }
.coin-scene { position: relative; border-radius: 50%; }
.coin-scene::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 2px; height: 10px; border-radius: 50%; background: rgba(0, 0, 0, .35); filter: blur(4px); z-index: -1; }
.bj-hand { border-radius: 16px; }
.slot-line { display: inline-flex; gap: 2px; vertical-align: middle; }
.slot-mini { width: 20px; height: 20px; }
/* Los destellos de premio nunca deben ensanchar la página (desborde horizontal en celular). */
.game__stage, .bj-table, .felt { overflow: hidden; }

/* ---------- Guardianes Dorados (motor ways, V1.2 Fase 1.5d) ----------
   Sólo se animan transform/opacity (WAAPI desde games/ways.js); las celdas tienen
   tamaño fijo por aspecto, así las cascadas no provocan reflow. */
.ways-stage {
    background: radial-gradient(ellipse at 50% 0%, #3d1f7a 0%, #1a0e3d 55%, #0d0724 100%);
    border-color: #6d4fc2; display: flex; flex-direction: column; align-items: center; gap: .6rem;
}
.ways-top { width: 100%; max-width: 560px; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.ways-title {
    font-weight: 900; font-size: clamp(1.05rem, 4.4vw, 1.45rem); letter-spacing: .06em; text-transform: uppercase;
    background: linear-gradient(180deg, #fff3c4, #fbbf24 55%, #b45309); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ways-meter { font-size: .78rem; color: #e9d5ff; background: rgba(0, 0, 0, .35); border: 1px solid rgba(251, 191, 36, .5); border-radius: 999px; padding: .2rem .65rem; white-space: nowrap; }
.ways-meter strong { color: var(--gold); font-variant-numeric: tabular-nums; }
.ways-frame {
    position: relative; width: 100%; max-width: 560px; padding: 6px; border-radius: 18px;
    background: linear-gradient(180deg, #fde68a, #d97706 45%, #92400e); box-shadow: var(--shadow), 0 0 24px rgba(251, 191, 36, .25);
}
.ways-grid {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 5px; border-radius: 13px; overflow: hidden;
    background: linear-gradient(180deg, #160b33, #0b0620);
}
.ways-col { display: grid; grid-template-rows: repeat(5, 1fr); gap: 4px; }
.ways-cell { position: relative; aspect-ratio: 1; border-radius: 10px; }
.ways-cell img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.ways-cell.is-win { z-index: 1; box-shadow: 0 0 0 2px #fde68a, 0 0 14px 2px rgba(251, 191, 36, .85); }
.ways-cell.is-win img { filter: brightness(1.18); }
.ways-cell.is-scatter { z-index: 1; animation: ways-pulse .7s ease-in-out infinite alternate; box-shadow: 0 0 0 2px #c7d2fe, 0 0 18px 4px rgba(165, 180, 252, .9); }
.ways-col.is-spinning .ways-cell { filter: blur(1.2px) brightness(.9); animation: ways-shake .12s linear infinite; }
@keyframes ways-pulse { from { transform: scale(1); } to { transform: scale(1.08); } }
@keyframes ways-shake { from { transform: translateY(-6%); } to { transform: translateY(6%); } }
.ways-banner {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; max-width: 90%;
    padding: .8rem 1.4rem; border-radius: 16px; text-align: center; font-weight: 900; font-size: clamp(1.1rem, 5vw, 1.8rem);
    color: #fff7d6; background: rgba(20, 8, 45, .88); border: 2px solid var(--gold); box-shadow: 0 0 30px rgba(251, 191, 36, .5);
}
.ways-fs { width: 100%; max-width: 560px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem; }
.ways-fs__count { font-weight: 800; color: #fde68a; font-size: .92rem; }
.ways-ladder { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; }
.ways-ladder li { min-width: 2.2rem; text-align: center; font-weight: 800; font-size: .8rem; padding: .15rem .35rem; border-radius: 999px; color: #c4b5fd; border: 1px solid rgba(196, 181, 253, .35); }
.ways-ladder li.is-active { color: #1a1300; background: var(--gold); border-color: var(--gold); box-shadow: 0 0 10px rgba(251, 191, 36, .7); }
.ways-win { margin: 0; font-size: 1.35rem; font-weight: 800; color: var(--gold); }
.ways-win strong { font-variant-numeric: tabular-nums; }
.ways-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; width: 100%; max-width: 560px; min-height: 1.4rem; font-size: .85rem; color: #e9d5ff; }
.ways-steps li { display: flex; align-items: center; gap: .4rem; }
.ways-last { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin: .6rem 0 0; font-size: .88rem; color: var(--muted); }
.ways-paytable summary { cursor: pointer; font-weight: 700; }
.ways-paytable ul { grid-template-columns: 1fr; margin-top: .5rem; }
.ways-paytable li { justify-content: flex-start; align-items: center; }
.ways-paytable__name { flex: 0 0 8.5rem; font-weight: 700; }
.ways-paytable__pays { display: flex; flex-wrap: wrap; gap: .2rem .7rem; color: var(--gold); font-variant-numeric: tabular-nums; font-size: .82rem; }
@media (min-width: 1000px) { .game--ways { grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); align-items: start; } }
.is-fast-play .ways-cell.is-scatter, .is-fast-play .ways-col.is-spinning .ways-cell { animation: none; filter: none; }
@media (prefers-reduced-motion: reduce) { .ways-cell.is-scatter, .ways-col.is-spinning .ways-cell { animation: none; filter: none; } }

/* ---------- Video Póker (V1.2 Fase 1.5e) ---------- */
.vp-table { background: radial-gradient(ellipse at 50% 20%, #12305e 0%, #0a1a3a 60%, #060f24 100%); border-color: #2b4c8c; display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.vp-paytable { width: 100%; max-width: 460px; border-collapse: separate; border-spacing: 0 2px; font-size: .86rem; }
.vp-paytable th, .vp-paytable td { padding: .22rem .6rem; background: rgba(0, 0, 0, .28); color: #fde68a; font-weight: 700; }
.vp-paytable th { text-align: left; border-radius: 6px 0 0 6px; color: #e2e8f0; font-weight: 600; }
.vp-paytable td { text-align: right; border-radius: 0 6px 6px 0; font-variant-numeric: tabular-nums; }
.vp-paytable tr.is-hit th, .vp-paytable tr.is-hit td { background: var(--gold); color: #1a1300; }
.vp-hand { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(4px, 1.6vw, 12px); width: 100%; max-width: 600px; }
.vp-slot { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 0; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; }
.vp-slot:disabled { cursor: default; }
.vp-slot__card { display: block; width: 100%; border-radius: 10px; transition: transform .15s ease; }
.vp-slot .pcard { --card-w: 100%; width: 100%; }
.vp-slot .pcard--empty { display: block; aspect-ratio: 280 / 390; border-radius: 10px; border: 2px dashed rgba(148, 163, 184, .35); background: rgba(255, 255, 255, .04); }
.vp-slot__hold { font-size: clamp(.58rem, 2.4vw, .78rem); font-weight: 900; letter-spacing: .06em; padding: .18rem .45rem; border-radius: 999px; color: #94a3b8; border: 1px solid rgba(148, 163, 184, .35); visibility: hidden; }
.vp-slot:not(:disabled) .vp-slot__hold { visibility: visible; }
.vp-slot.is-held .vp-slot__hold { visibility: visible; color: #1a1300; background: var(--gold); border-color: var(--gold); }
.vp-slot.is-held .vp-slot__card { transform: translateY(-6px); box-shadow: 0 0 0 3px var(--gold), 0 8px 18px rgba(0, 0, 0, .45); }
.vp-slot:focus-visible { outline: none; }
.vp-slot:focus-visible .vp-slot__card { box-shadow: 0 0 0 3px #93c5fd; }
.vp-result { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--gold); text-align: center; }
.vp-stake { margin: 0 0 .6rem; }
@media (min-width: 1000px) { .game--videopoker { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); align-items: start; } }
.is-fast-play .vp-slot__card { transition: none; }
@media (prefers-reduced-motion: reduce) { .vp-slot__card { transition: none; } }

/* ---------- Baccarat Punto Banco (V1.2 Fase 1.5f) ---------- */
.bc-table { background: #0b4d32 url("../img/table/baccarat-felt.svg") center / cover no-repeat; border-color: #1f7a52; display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.bc-hands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(.5rem, 3vw, 1.5rem); width: 100%; max-width: 720px; }
.bc-hand { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .6rem .3rem; border-radius: 16px; transition: box-shadow .2s; }
.bc-hand.is-winner { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(251, 191, 36, .45); }
.bc-hand.is-tie { box-shadow: 0 0 0 3px #93c5fd; }
.bc-hand__title { margin: 0; display: flex; align-items: center; gap: .5rem; font-size: clamp(.95rem, 3.6vw, 1.15rem); letter-spacing: .06em; text-transform: uppercase; color: #fde68a; }
.bc-total { display: inline-grid; place-items: center; min-width: 2em; height: 2em; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; font-variant-numeric: tabular-nums; font-size: 1.05em; }
.bc-table .pcard { --card-w: clamp(52px, 13.5vw, 92px); }
.bc-cards.pcard-row { flex-wrap: nowrap; min-height: calc(clamp(52px, 13.5vw, 92px) * 1.39); }
.bc-cards .pcard + .pcard { margin-left: calc(var(--card-w) * -0.38); }
.bc-cards .pcard.is-third { margin-top: calc(var(--card-w) * .18); }
.bc-outcome { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--gold); text-align: center; }
.bc-history { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; min-height: 1.6rem; }
.bc-history span { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; font-size: .78rem; font-weight: 900; color: #fff; }
.bc-history .h-player { background: #1d4ed8; }
.bc-history .h-banker { background: #b91c1c; }
.bc-history .h-tie { background: #15803d; }
.bc-spots { display: grid; grid-template-columns: 1fr .8fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.bc-spot { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; min-height: 96px; padding: .6rem .3rem; border-radius: 14px; border: 2px solid rgba(251, 191, 36, .45); background: #0f5132; color: #f8fafc; font: inherit; cursor: pointer; touch-action: manipulation; transition: transform .12s, box-shadow .2s; }
.bc-spot--player { background: linear-gradient(160deg, #1e3a8a, #0f5132 75%); }
.bc-spot--banker { background: linear-gradient(200deg, #7f1d1d, #0f5132 75%); }
.bc-spot--tie { background: linear-gradient(180deg, #166534, #0f5132); }
.bc-spot:hover { transform: translateY(-2px); }
.bc-spot:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.bc-spot.has-bet { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.bc-spot.is-winner { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(251, 191, 36, .5); }
.bc-spot.is-push { box-shadow: 0 0 0 3px #93c5fd; }
.bc-spot__name { font-weight: 900; letter-spacing: .05em; text-transform: uppercase; font-size: clamp(.82rem, 3.4vw, 1rem); }
.bc-spot__odds { font-size: .78rem; color: #fde68a; }
.bc-spot__amount { font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #e2e8f0; }
.bc-spot .chip-badge.vchip { --chip-w: 26px; position: absolute; top: auto; bottom: 4px; right: 4px; left: auto; transform: none; }
.bc-spot .chip-badge .vchip__label { font-size: 8.5px; }
@media (max-width: 479px) { .bc-spot .chip-badge.vchip { display: none; } } /* en celular el monto ya se lee en texto */
.is-fast-play .bc-hand, .is-fast-play .bc-spot { transition: none; }
@media (prefers-reduced-motion: reduce) { .bc-hand, .bc-spot { transition: none; } .bc-spot:hover { transform: none; } }
@media (min-width: 1000px) { .game--baccarat { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); align-items: start; } }

/* ---------- Espacios de integración (módulos HTML5) ---------- */
.slot-card__empty { display: grid; place-items: center; border: 2px dashed var(--border); background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .02) 0 12px, rgba(255, 255, 255, .045) 12px 24px); }
.slot-card__num { font-size: clamp(2rem, 9vw, 3.2rem); font-weight: 900; color: var(--muted); opacity: .55; font-variant-numeric: tabular-nums; }
.slot-card--pending .game-card__name { color: var(--muted); }
