/* Bingo Virtual: bingo hall felt, cream cards, colored balls by column.
   Single dark look on purpose (game screen inside the operator's iframe). */
:root {
  --bg: #0a2622; --panel: #103530; --panel2: #174339; --line: #25594f;
  --fg: #ecf5f0; --muted: #9bbdb2;
  --paper: #f7f0df; --paper-line: #e0d3b2; --ink: #22302c;
  --gold: #ffbf3c; --coral: #ff6a4d; --mint: #6fe0bd; --sky: #79bbff; --plum: #c79bff;
  --display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hidden { display: none !important; }

#splash { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; place-content: center; gap: 18px; justify-items: center; }
#splash.done { display: none; }
.splash-logo { font-family: var(--display); font-size: 3.4rem; color: var(--gold); letter-spacing: .04em; }
.splash-bar { width: 180px; height: 6px; border-radius: 6px; background: var(--panel2); overflow: hidden; }
.splash-bar-fill { height: 100%; width: 0; background: var(--gold); animation: fill 1.2s ease-out forwards; }
@keyframes fill { to { width: 100%; } }

#app-frame { max-width: 520px; margin: 0 auto; padding: 12px max(12px, env(safe-area-inset-left, 0px)) 24px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.top { display: flex; justify-content: space-between; align-items: center; }
.brand { font-family: var(--display); font-size: 1.7rem; color: var(--gold); }
.brand span { color: var(--fg); font-size: 1rem; }
.top-right { display: flex; align-items: center; gap: 8px; }
.btn-info { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--gold); transition: background .15s, color .15s, transform .1s; }
.btn-info:hover { background: var(--gold); color: var(--ink); }
.btn-info:active { transform: scale(.94); }
.balance-box { display: flex; align-items: center; height: 38px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.balance-box b { font-family: var(--display); font-weight: 400; font-size: 1.25rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.grant-banner { background: var(--mint); color: var(--ink); border-radius: 10px; padding: 7px 12px; font-weight: 800; text-align: center; }

.tube-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.tube { display: grid; grid-template-columns: repeat(17, minmax(0, 1fr)); gap: 3px; }
.ball { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: .74rem; color: var(--ink);
  --c: var(--gold); background: radial-gradient(circle at 32% 28%, #fff9 0 18%, transparent 19%), radial-gradient(circle, var(--c) 60%, color-mix(in srgb, var(--c) 70%, #000) 100%); }
.ball.empty { background: var(--bg); color: transparent; }
.ball.c0 { --c: var(--coral); } .ball.c1 { --c: var(--gold); } .ball.c2 { --c: var(--mint); } .ball.c3 { --c: var(--sky); } .ball.c4 { --c: var(--plum); }
.ball.pop { animation: pop .22s ease-out; }
@keyframes pop { from { transform: scale(.3); } to { transform: scale(1); } }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.card { position: relative; background: var(--paper); color: var(--ink); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 4px; border: 2px solid transparent; transition: opacity .2s, background .2s; }
/* An unused card: dimmed contents, but its "Usar" button stays bright,
   big and centered on the card. */
.card.off { background: color-mix(in srgb, var(--paper) 35%, var(--bg)); }
.card.off .card-h span, .card.off .grid, .card.off .card-r { opacity: .35; }
.card.off .card-h button { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1;
  padding: 10px 28px; border-radius: 12px; background: var(--gold); color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 1.15rem; box-shadow: 0 3px 0 #b07a12; }
.card.off .card-h button:active:not(:disabled) { transform: translate(-50%, calc(-50% + 2px)); box-shadow: 0 1px 0 #b07a12; }
.card.won { border-color: var(--gold); box-shadow: 0 0 0 3px #ffbf3c55; }
.card-h { display: flex; justify-content: space-between; align-items: center; font-size: .72rem; font-weight: 800; }
.card-h button { background: var(--ink); color: var(--paper); border: 0; border-radius: 6px; padding: 1px 8px; font-size: .68rem; font-weight: 800; }
/* A card in play: a small round "×" takes it out. */
.card:not(.off) .card-h button { width: 22px; height: 22px; padding: 0; border-radius: 50%; display: grid; place-items: center; font-size: 1rem; line-height: 1; }
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
.cell { aspect-ratio: 1.15; display: grid; place-items: center; border: 1px solid var(--paper-line); border-radius: 4px; font-family: var(--display); font-size: 1rem; position: relative; font-variant-numeric: tabular-nums; }
.cell.hit::after { content: ""; position: absolute; inset: 12%; border-radius: 50%; background: var(--coral); opacity: .8; mix-blend-mode: multiply; }
.cell.win { background: var(--gold); border-color: var(--gold); }
.card-r { min-height: 1.2em; font-size: .76rem; font-weight: 800; display: flex; justify-content: space-between; }
.card-r .w { color: #9a3412; }

.result { min-height: 2.4em; border-radius: 12px; display: grid; place-items: center; font-weight: 800; background: var(--panel2); text-align: center; padding: 4px 10px; }
.result.big { background: var(--gold); color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 1.35rem; }
.status { min-height: 1em; font-size: .85rem; color: var(--muted); text-align: center; }

.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.ctl { display: flex; flex-direction: column; gap: 3px; }
.lbl { font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 800; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); font-weight: 800; font-size: 1.1rem; }
.stepper b, .bet { font-family: var(--display); font-weight: 400; font-size: 1.15rem; min-width: 74px; text-align: center; font-variant-numeric: tabular-nums; }
/* Same height as the stepper, so "Aposta" lines up with "Valor por cartela". */
.bet { height: 34px; display: flex; align-items: center; justify-content: center; }
.btn-turbo { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--gold); transition: background .15s, color .15s; }
.btn-turbo[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.btn-play { margin-left: auto; background: var(--gold); color: var(--ink); border: 0; border-radius: 12px; padding: 10px 26px; font-family: var(--display); font-size: 1.35rem; box-shadow: 0 4px 0 #b07a12; }
.btn-play:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #b07a12; }

.pay-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 5px 4px; border-bottom: 1px solid var(--line); }
.pay-row b { font-family: var(--display); font-weight: 400; color: var(--gold); }
.mini { display: grid; grid-template-columns: repeat(5, 7px); gap: 1.5px; }
.mini i { width: 7px; height: 7px; border-radius: 1.5px; background: var(--line); }
.mini i.on { background: var(--gold); }
.pay-note { font-size: .75rem; color: var(--muted); margin: 6px 0 0; }

.modal { position: fixed; inset: 0; z-index: 40; background: #000a; display: grid; place-items: center; padding: 16px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; max-width: 320px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.modal-card p { margin: 0; font-weight: 800; }
.modal-card button { background: var(--gold); color: var(--ink); border: 0; border-radius: 10px; padding: 8px; font-weight: 800; }
/* Inside #app-frame: covers and centers on the game itself, not the whole window. */
#paytable-modal { position: absolute; padding: 12px; }
.paytable-card { position: relative; width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; text-align: left; }
.paytable-card h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.3rem; color: var(--gold); }
.modal-card .modal-x { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; padding: 0; border-radius: 50%; background: var(--panel2); color: var(--fg); font-size: 1.3rem; line-height: 1; }

#confetti-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti-piece { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: fall 1.1s ease-in forwards; }
@keyframes fall { to { transform: translateY(520px) rotate(540deg); opacity: 0; } }

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