:root { --bg: #1e1b4b; --card-bg: #2e1065; --primary: #f97316; --text: #ffffff; --text-muted: #a78bfa; --border: rgba(255,255,255,0.1); --b-color: #3b82f6; --i-color: #8b5cf6; --n-color: #d946ef; --g-color: #10b981; --o-color: #f97316; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif; margin: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.screen { display: none; flex-direction: column; height: 100%; padding: 24px; overflow-y: auto; animation: fadeIn 0.3s ease-out; }
.screen.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.btn { background: linear-gradient(135deg, #f97316, #ea580c); color: #fff; border: none; padding: 14px; border-radius: 12px; font-weight: 900; font-size: 16px; width: 100%; cursor: pointer; box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4); margin-top: 10px; }
.btn:active { transform: scale(0.98); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text-muted); box-shadow: none; }
input { width: 100%; padding: 16px; background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: 12px; color: white; font-size: 16px; margin-bottom: 16px; }

.wallet-card { background: linear-gradient(135deg, #4c1d95, #3b0764); padding: 24px; border-radius: 20px; color: white; border: 1px solid var(--border); margin-bottom: 24px; text-align: center; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-btn { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; align-items: center; font-weight: bold; }

#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #0f172a; padding: 12px 20px; border-radius: 50px; z-index: 1000; display: flex; align-items: center; gap: 10px; opacity: 0; transition: 0.3s; border: 1px solid var(--border); font-weight: bold; }
#toast.show { opacity: 1; top: 40px; }
#full-screen-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg); z-index: 9999; display: none; align-items: center; justify-content: center; flex-direction: column; }
#fs-timer { font-size: 120px; font-weight: 900; color: var(--primary); }
#fs-text { font-size: 24px; color: white; letter-spacing: 2px; }
#win-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 10000; align-items: center; justify-content: center; flex-direction: column; display: none; }
.win-box { background: linear-gradient(135deg, #f97316, #ea580c); padding: 30px; border-radius: 20px; color: white; width: 90%; max-width: 400px; text-align: center; border: 3px solid #fff; }
.win-item { background: rgba(0,0,0,0.3); padding: 15px; border-radius: 12px; margin-top: 10px; }
.win-amt { font-size: 28px; font-weight: 900; }

.game-top-bar { display: flex; gap: 4px; margin-bottom: 10px; }
.g-stat { flex: 1; background: var(--card-bg); border: 1px solid var(--border); text-align: center; border-radius: 8px; padding: 6px 2px; }
.g-stat div:first-child { color: var(--text-muted); font-size: 10px; font-weight: 700; margin-bottom: 2px; }
.g-stat div:last-child { color: #fff; font-size: 12px; font-weight: 900; }
.game-split { display: flex; gap: 8px; flex: 1; overflow: hidden; }

.game-left { flex: 0 0 48%; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; overflow-y: auto; }
.master-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; text-align: center; }
.m-head { font-weight: 900; font-size: 13px; padding: 6px 0; color: white; border-radius: 4px; }
.m-head.b { background: var(--b-color); } .m-head.i { background: var(--i-color); } .m-head.n { background: var(--n-color); } .m-head.g { background: var(--g-color); } .m-head.o { background: var(--o-color); }
.m-cell { background: rgba(255,255,255,0.08); border-radius: 4px; font-size: 12px; padding: 6px 0; color: rgba(255,255,255,0.6); font-weight: 700; border: 1px solid rgba(255,255,255,0.05); }
.m-cell.called { background: var(--primary); color: #fff; font-weight: 900; border-color: var(--primary); }

.game-right { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.g-history { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-pill { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 900; color: white; border: 1px solid rgba(255,255,255,0.2); }
.g-current-area { background: rgba(255,255,255,0.05); border-radius: 12px; padding: 15px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); }
.big-ball-glow { width: 70px; height: 70px; border-radius: 50%; background: #fff; border: 4px solid #eab308; box-shadow: 0 0 20px #eab308; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; color: #4c1d95; }

.g-cards { display: flex; flex-direction: column; gap: 10px; }
.play-card-wrap { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.cartela-badge { background: #1e1b4b; color: #eab308; font-size: 11px; font-weight: 900; text-align: center; padding: 4px; border-radius: 20px; margin: 0 auto 8px auto; width: fit-content; border: 1px solid #eab308; }
.play-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.play-cell { aspect-ratio: 1; background: #fff; color: #3b0764; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 14px; }
.play-cell.head { background: transparent; color: white; font-size: 14px; height: 24px; border-radius: 4px; }
.play-cell.marked { background: var(--g-color); color: white; }

#scr-lobby { padding: 0; display: none; flex-direction: column; height: 100vh; }
#scr-lobby.active { display: flex; }
.lobby-layer-1 { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background: var(--card-bg); border-bottom: 1px solid var(--border); }
.icon-btn { background: var(--bg); border: 1px solid var(--border); width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; }
.lobby-layer-2 { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 10px; gap: 8px; background: var(--bg); border-bottom: 1px solid var(--border); }
.info-box { background: var(--card-bg); border-radius: 8px; padding: 8px; text-align: center; }
.info-label { font-size: 10px; color: var(--text-muted); font-weight: bold; }
.info-val { font-size: 14px; font-weight: 900; color: var(--primary); }
.lobby-layer-3 { flex: 1; overflow-y: auto; padding: 10px; }
.lobby-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 6px; }
.num-btn { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; height: 45px; display: flex; align-items: center; justify-content: center; font-weight: bold; color: white; cursor: pointer; }
.num-btn.selected { background: var(--primary); border-color: white; }

/* --- FIXED MINI CARD GRAPHICS --- */
.lobby-layer-4 { background: var(--card-bg); padding: 10px; display: flex; gap: 10px; overflow-x: auto; min-height: 140px; border-top: 1px solid var(--border); }
.mini-card-wrapper { background: #0f172a; border: 1px solid var(--border); border-radius: 6px; width: 110px; flex-shrink: 0; overflow: hidden; }
.mini-card-label { font-size: 9px; padding: 4px; background: #1e293b; color: #f59e0b; text-align: center; border-bottom: 1px solid var(--border); font-weight: bold; }
.mini-header-row { display: grid; grid-template-columns: repeat(5, 1fr); background: #1e1b4b; }
.mh-cell { font-size: 9px; font-weight: bold; text-align: center; color: #fff; padding: 3px 0; }
.mini-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--border); border-top: 1px solid var(--border); }
.mini-cell { background: #0f172a; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: bold; color: #fff; }
.mini-cell.free { color: #f59e0b; font-size: 12px; }