/* ============ Base ============ */
:root {
  --bg: #0b1026;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-brd: rgba(255, 255, 255, 0.12);
  --text: #eef2ff;
  --muted: #9aa6cf;
  --accent: #f59e0b;
  --B: #8b3fd1; --I: #f2a516; --N: #1e88e5; --G: #2fa84f; --O: #e53935;
  --prefix: #2563eb; --suffix: #e11d48;
  --radius: 18px;
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  overflow: hidden; -webkit-font-smoothing: antialiased; user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }
.c-prefix { color: #60a5fa; } .c-root { color: #fff; } .c-suffix { color: #fb7185; }

/* animated background */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(1200px 800px at 15% 10%, #24307a 0%, transparent 60%),
              radial-gradient(1000px 700px at 90% 90%, #5b1d6e 0%, transparent 55%),
              linear-gradient(160deg, #0b1026, #10183a 60%, #0b1026); }
.bg-glow { position: absolute; inset: -20%; background: conic-gradient(from 0deg at 50% 50%, transparent, rgba(30,136,229,.12), transparent 30%, rgba(229,57,53,.10), transparent 60%, rgba(242,165,22,.10), transparent);
  animation: spin 40s linear infinite; }
#floaters span { position: absolute; bottom: -80px; font-size: 42px; color: rgba(255,255,255,.07); font-weight: 700; animation: floatUp linear infinite; }
@keyframes floatUp { to { transform: translateY(-120vh) rotate(25deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

.screen { position: fixed; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; animation: screenIn .45s ease both; }
@keyframes screenIn { from { opacity: 0; transform: scale(.985); } }

/* ============ Home ============ */
#screen-home { overflow-y: auto; }
.home-wrap { width: min(1100px, 94vw); margin: 0 auto; padding: 4vh 0 3vh; }
.logo { text-align: center; }
.logo h1 { margin: 10px 0 6px; line-height: 1; }
.logo-main { display: block; font-size: clamp(44px, 7vw, 86px); font-weight: 900; letter-spacing: -1px;
  background: linear-gradient(90deg, #ffd54a, #ff8a3d, #ff4d6d, #b06cff, #4fc3f7, #ffd54a); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite;
  filter: drop-shadow(0 6px 24px rgba(255,120,60,.35)); }
.logo-he { display: block; font-size: clamp(26px, 3.4vw, 40px); font-weight: 700; color: #dbe4ff; margin-top: 8px; font-family: 'David', 'Times New Roman', serif; }
@keyframes shine { to { background-position: 200% center; } }
.tagline { color: var(--muted); font-size: 18px; margin: 10px 0 0; }
.logo-balls { display: flex; justify-content: center; gap: 10px; }
.mini-ball, .row-ball {
  --c: var(--N); width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 22px;
  color: var(--c); position: relative;
  background: radial-gradient(circle at 32% 28%, #fff 0 8%, var(--c) 30%, color-mix(in srgb, var(--c) 55%, #000) 100%);
  box-shadow: 0 8px 20px rgba(0,0,0,.35), inset 0 -4px 10px rgba(0,0,0,.25);
}
.mini-ball::before, .row-ball::before { content: ''; position: absolute; inset: 22%; border-radius: 50%; background: #fff; z-index: -1; }
.mini-ball, .row-ball { isolation: isolate; }
.mini-ball { animation: bob 2.4s ease-in-out infinite; }
.mini-ball:nth-child(2) { animation-delay: .15s; } .mini-ball:nth-child(3) { animation-delay: .3s; }
.mini-ball:nth-child(4) { animation-delay: .45s; } .mini-ball:nth-child(5) { animation-delay: .6s; }
@keyframes bob { 50% { transform: translateY(-10px); } }
.b-B { --c: var(--B); } .b-I { --c: var(--I); } .b-N { --c: var(--N); } .b-G { --c: var(--G); } .b-O { --c: var(--O); }

.step-title { display: flex; align-items: center; gap: 10px; font-size: 20px; margin: 34px 0 14px; font-weight: 700; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background: #ffd54a; color: #111; display: grid; place-items: center; font-size: 16px; }

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode-card {
  --mc: #f59e0b; text-align: left; padding: 20px 20px 18px; border-radius: var(--radius); position: relative; overflow: hidden;
  background: var(--panel); border: 2px solid var(--panel-brd); backdrop-filter: blur(8px);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.mode-card:hover { transform: translateY(-4px); }
.mode-card[aria-checked="true"] { border-color: var(--mc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mc) 30%, transparent), 0 16px 40px rgba(0,0,0,.35); }
.mode-card::after { content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--mc); opacity: .18; filter: blur(10px); }
.mode-card .mc-top { display: flex; align-items: baseline; justify-content: space-between; padding-right: 34px; }
.mode-card .mc-name { font-size: 26px; font-weight: 900; color: var(--mc); }
.mode-card .mc-he { font-size: 20px; color: #cbd5ff; font-family: 'David', 'Times New Roman', serif; }
.mode-card .mc-blurb { color: var(--muted); margin: 8px 0 12px; min-height: 42px; font-size: 15px; }
.mode-card .mc-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-card .chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); }
.mode-card .mc-check { position: absolute; top: 14px; right: 14px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel-brd); display: grid; place-items: center; font-size: 14px; z-index: 1; }
.mode-card[aria-checked="true"] .mc-check { background: var(--mc); border-color: var(--mc); color: #111; }
.mode-card .mc-preview { height: 52px; margin-top: 12px; border-radius: 10px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.mode-card .mc-preview img { height: 52px; }

.play-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.play-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 22px; text-align: left; border-radius: var(--radius);
  border: none; background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.04)); box-shadow: inset 0 0 0 1px var(--panel-brd);
  transition: transform .2s, box-shadow .2s, background .2s;
}
.play-card:hover { transform: translateY(-4px) scale(1.01); box-shadow: inset 0 0 0 2px #ffd54a, 0 18px 40px rgba(0,0,0,.4); }
.play-icon { font-size: 38px; }
.play-name { font-size: 22px; font-weight: 800; }
.play-desc { color: var(--muted); font-size: 15px; line-height: 1.4; }
.home-foot { text-align: center; color: #6c78a6; margin-top: 30px; font-size: 13px; }

/* ============ Top bar ============ */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(5, 8, 25, .55); backdrop-filter: blur(10px); border-bottom: 1px solid var(--panel-brd); flex-wrap: wrap; z-index: 2; }
.spacer { flex: 1; }
.icon-btn, .pill-btn { border: 1px solid var(--panel-brd); background: rgba(255,255,255,.07); border-radius: 12px; height: 40px; transition: background .15s, transform .1s; }
.icon-btn { width: 40px; font-size: 18px; }
.pill-btn { padding: 0 14px; font-weight: 600; font-size: 14px; }
.icon-btn:hover, .pill-btn:hover { background: rgba(255,255,255,.16); }
.icon-btn:active, .pill-btn:active { transform: scale(.95); }
.pill-btn.on { background: #ffd54a; color: #111; border-color: #ffd54a; }
.pill-btn.primary { background: linear-gradient(135deg, #ffd54a, #ff8a3d); color: #111; border: none; }
.pill-btn:disabled { opacity: .4; cursor: default; }
.mode-badge { font-weight: 900; padding: 6px 14px; border-radius: 99px; background: var(--mc, #f59e0b); color: #111; letter-spacing: .5px; text-transform: uppercase; font-size: 14px; }
.counter { color: var(--muted); font-size: 15px; } .counter b { color: #fff; font-size: 20px; }
.stat { display: flex; flex-direction: column; align-items: center; min-width: 70px; line-height: 1.1; }
.stat small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat b.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.35); color: #ffd54a; } }

/* ============ Caller ============ */
.caller-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 18px; padding: 16px 18px 8px; }
.machine {
  position: relative; border-radius: 28px; padding: 54px 26px 22px; display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, #e9edf5 0%, #b9c2d3 45%, #8e98ad 100%);
  box-shadow: 0 30px 70px rgba(0,0,0,.55), inset 0 2px 0 #fff, inset 0 -6px 18px rgba(0,0,0,.25);
}
.marquee { position: absolute; top: 10px; left: 24px; right: 24px; height: 34px; border-radius: 14px; background: linear-gradient(90deg, #ffd54a, #ff8a3d, #ff4d6d, #ff8a3d, #ffd54a);
  display: flex; justify-content: space-around; align-items: center; box-shadow: inset 0 -4px 8px rgba(0,0,0,.2); }
.marquee i { width: 12px; height: 12px; border-radius: 50%; background: #fff7c2; box-shadow: 0 0 6px #fff3a0; opacity: .55; }
.machine.spinning .marquee i { animation: bulb .5s linear infinite; }
.marquee i:nth-child(even) { animation-delay: .25s !important; }
@keyframes bulb { 0%, 49% { opacity: 1; box-shadow: 0 0 14px 4px #fff59d; } 50%, 100% { opacity: .35; box-shadow: none; } }
.machine-title { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-weight: 900; font-style: italic; font-size: 22px; letter-spacing: 3px; color: #1b1b1b; padding: 0 18px; background: rgba(255,255,255,.55); border-radius: 10px; line-height: 30px; text-transform: uppercase; }
.machine-title.flash { animation: titleFlash .2s steps(2) 8; }
@keyframes titleFlash { 50% { color: #fff; background: #1e88e5; box-shadow: 0 0 30px #1e88e5; } }

.machine-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(150px, 0.8fr) 2fr; gap: 20px; align-items: center;
  border-radius: 20px; padding: 18px; background: repeating-conic-gradient(from 0deg at 50% 50%, #0d8fe0 0 10deg, #27b0ff 10deg 20deg); box-shadow: inset 0 0 0 6px #d6dce8, inset 0 0 40px rgba(0,0,0,.45); position: relative; overflow: hidden; }
.machine.spinning .machine-body { animation: rays 1.4s linear infinite; }
@keyframes rays { to { filter: hue-rotate(40deg) brightness(1.15); } }
.globe-wrap { position: relative; aspect-ratio: 1; width: 100%; max-height: 100%; }
#globe { width: 100%; height: 100%; display: block; position: relative; z-index: 1; }
.globe-base { position: absolute; bottom: -6%; left: 30%; right: 30%; height: 14%; border-radius: 0 0 50% 50%; background: linear-gradient(#c7cfdd, #6f7a90); }

.display { height: 100%; display: flex; align-items: center; }
.display-inner { width: 100%; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 16px; border-radius: 22px;
  background: linear-gradient(180deg, #f4f6fb, #c9d0dd); box-shadow: 0 0 0 5px #9aa4b8, 0 12px 30px rgba(0,0,0,.35), inset 0 3px 0 #fff; }
.ball-slot { width: clamp(90px, 10vw, 150px); aspect-ratio: 1; border-radius: 18px; background: linear-gradient(180deg, #8b95a8, #e6eaf2 30%, #fff 50%, #e6eaf2 70%, #8b95a8); display: grid; place-items: center; box-shadow: inset 0 0 12px rgba(0,0,0,.35); }

.call-ball { --c: #9aa4b8; width: 84%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle at 32% 28%, #fff 0 7%, var(--c) 32%, color-mix(in srgb, var(--c) 50%, #000) 100%);
  box-shadow: 0 10px 22px rgba(0,0,0,.4), inset 0 -6px 14px rgba(0,0,0,.25); }
.call-ball::before { content: ''; position: absolute; inset: 20%; border-radius: 50%; background: #fff; box-shadow: inset 0 2px 6px rgba(0,0,0,.2); }
.call-ball span { position: relative; font-weight: 900; font-size: clamp(30px, 4vw, 64px); color: var(--c); line-height: 1; }
.call-ball.empty { --c: #b9c1cf; } .call-ball.empty span { opacity: 0; }
.call-ball.drop { animation: ballDrop 1s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes ballDrop { 0% { transform: translate(-160%, -120%) rotate(-720deg) scale(.3); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }

.reel { position: relative; height: clamp(120px, 22vh, 220px); border-radius: 16px; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(180deg, #9aa4b8 0%, #fff 18%, #fff 82%, #9aa4b8 100%); box-shadow: inset 0 0 0 3px #b6bfcf, inset 0 0 22px rgba(0,0,0,.25); }
.reel img { max-width: 96%; max-height: 92%; object-fit: contain; display: block; }
.reel img:not([src]), .reel img[src=""] { display: none; }
.reel img.rolling { filter: blur(3px); animation: roll .08s linear infinite; }
@keyframes roll { from { transform: translateY(-30%); } to { transform: translateY(30%); } }
.reel img.land { animation: land 1.1s cubic-bezier(.16,1,.3,1) both; }
@keyframes land { 0% { filter: blur(24px); transform: scale(.7); opacity: .2; } 60% { filter: blur(0); transform: scale(1.07); opacity: 1; } 100% { transform: scale(1); } }
.reel-placeholder { position: absolute; color: #6b7487; font-size: clamp(16px, 2vw, 24px); text-align: center; padding: 10px; }
.reel.has-word .reel-placeholder { display: none; }
.reel.glow { animation: reelGlow 1.4s ease; }
@keyframes reelGlow { 30% { box-shadow: inset 0 0 0 3px #ffd54a, 0 0 40px 10px rgba(255,213,74,.7); } }

.bingo-row { display: flex; justify-content: center; gap: 14px; margin: 16px 0 4px; }
.row-ball { width: clamp(40px, 5vw, 64px); height: clamp(40px, 5vw, 64px); font-size: clamp(18px, 2.2vw, 28px); }
.row-ball.go { animation: rowSpin 2s cubic-bezier(.2,.9,.3,1.3); }
.row-ball.b-G.go { animation-duration: 4s; }
.row-ball.b-I.go, .row-ball.b-O.go { animation-direction: reverse; }
@keyframes rowSpin { to { transform: rotate(720deg); } }

.spin-btn { position: absolute; right: 26px; bottom: 18px; width: clamp(90px, 9vw, 120px); aspect-ratio: 1; border-radius: 50%; border: none;
  background: radial-gradient(circle at 35% 30%, #ff9a7a, #ff3d3d 45%, #a50f1f); color: #fff; box-shadow: 0 8px 0 #6d0915, 0 14px 30px rgba(0,0,0,.45), inset 0 3px 6px rgba(255,255,255,.5);
  display: flex; flex-direction: column; align-items: center; justify-content: center; transition: transform .08s, box-shadow .08s; z-index: 3; }
.spin-btn span { font-size: clamp(20px, 2vw, 28px); font-weight: 900; letter-spacing: 2px; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.spin-btn small { font-size: 11px; opacity: .8; }
.spin-btn:active, .spin-btn.pressed { transform: translateY(6px); box-shadow: 0 2px 0 #6d0915, 0 6px 14px rgba(0,0,0,.45), inset 0 3px 6px rgba(255,255,255,.5); }
.spin-btn:disabled { filter: grayscale(.6) brightness(.85); cursor: default; }
.spin-btn:not(:disabled) { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 8px 0 #6d0915, 0 14px 30px rgba(0,0,0,.45), 0 0 0 10px rgba(255,61,61,.25), inset 0 3px 6px rgba(255,255,255,.5); } }
.auto-bar { position: absolute; left: 26px; right: 160px; bottom: 10px; height: 5px; border-radius: 4px; background: rgba(0,0,0,.15); overflow: hidden; opacity: 0; transition: opacity .3s; }
.auto-bar.on { opacity: 1; }
.auto-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd54a, #ff4d6d); }

/* called board */
.board { display: flex; flex-direction: column; min-height: 0; border-radius: 24px; padding: 14px; background: var(--panel); border: 1px solid var(--panel-brd); backdrop-filter: blur(8px); }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.board-head h3 { margin: 0; font-size: 18px; }
.legend { display: flex; gap: 6px; }
.lg { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #fff; }
.lg-prefix { color: var(--prefix); } .lg-root { color: #111; } .lg-suffix { color: var(--suffix); }
.board-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; overflow: hidden; }
.bcol { display: flex; flex-direction: column; gap: 5px; min-height: 0; }
.bcol-head { --c: var(--N); text-align: center; font-weight: 900; font-size: 20px; color: #fff; background: var(--c); border-radius: 10px; padding: 4px 0; position: relative; }
.bcol-head small { position: absolute; right: 6px; top: 7px; font-size: 11px; opacity: .8; }
.bcol-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; scrollbar-width: thin; }
.called-chip { background: #fff; border-radius: 8px; padding: 2px; border: 2px solid transparent; transition: transform .15s; }
.called-chip:hover { transform: scale(1.04); }
.called-chip img { width: 100%; display: block; aspect-ratio: 432 / 180; object-fit: contain; }
.called-chip.latest { border-color: #ffd54a; box-shadow: 0 0 12px rgba(255,213,74,.8); animation: chipIn .6s ease both; }
@keyframes chipIn { from { transform: scale(.4); opacity: 0; } }

.help-dock { display: flex; align-items: center; gap: 10px; padding: 8px 18px 12px; flex-wrap: wrap; }
.dock-label { color: var(--muted); font-size: 14px; }
.help-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.help-chip { border: none; border-radius: 12px; padding: 8px 14px; font-weight: 700; font-size: 14px; color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.3); transition: transform .12s; }
.help-chip.red { background: linear-gradient(180deg, #ff5a4e, #d4141c); }
.help-chip.blue { background: linear-gradient(180deg, #4f7dff, #1834d6); }
.help-chip:hover { transform: translateY(-2px); }
.help-chip kbd { font: inherit; font-size: 11px; opacity: .7; margin-left: 6px; }

/* ============ Solo ============ */
.solo-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.3fr); gap: 20px; padding: 16px 20px 6px; }
.solo-caller { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.solo-call { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 16px; border-radius: 24px; background: linear-gradient(180deg, #f4f6fb, #c9d0dd); box-shadow: 0 0 0 5px #9aa4b8, 0 16px 34px rgba(0,0,0,.4); }
.timer-ring { position: relative; width: clamp(100px, 10vw, 140px); aspect-ratio: 1; display: grid; place-items: center; }
.timer-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(0,0,0,.12); stroke-width: 7; }
.ring-fg { fill: none; stroke: #22c55e; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 283; stroke-dashoffset: 0; }
.timer-ring .call-ball { width: 76%; }
.timer-ring .call-ball span { font-size: clamp(28px, 3vw, 46px); }
.solo-reel { height: clamp(110px, 18vh, 170px); }
.solo-info { display: flex; align-items: center; justify-content: space-between; min-height: 36px; }
.balls-left { color: var(--muted); } .balls-left b { color: #fff; font-size: 20px; }
.toast-zone { position: relative; font-weight: 900; font-size: 20px; }
.toast { animation: toast 1.2s ease both; display: inline-block; }
.toast.good { color: #4ade80; } .toast.bad { color: #fb7185; } .toast.info { color: #ffd54a; }
@keyframes toast { 0% { opacity: 0; transform: translateY(10px) scale(.8); } 20% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.recent { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--panel-brd); border-radius: 18px; padding: 10px 12px; }
.recent h4 { margin: 0 0 8px; font-size: 14px; } .recent h4 small { color: var(--muted); font-weight: 400; }
.recent-list { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; align-content: start; }
.recent-item { position: relative; background: #fff; border-radius: 8px; padding: 2px; }
.recent-item img { width: 100%; display: block; aspect-ratio: 432/180; object-fit: contain; }
.recent-item b { position: absolute; left: 4px; top: 2px; font-size: 11px; color: #fff; background: var(--c); border-radius: 5px; padding: 0 5px; }
.recent-item.done { opacity: .45; }
.solo-legend { justify-content: center; }

.card-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.bingo-card { --cell: min(calc((100vh - 230px) / 5.6), calc((58vw - 60px) / 5)); display: grid; grid-template-columns: repeat(5, var(--cell)); gap: 6px; padding: 12px; border-radius: 22px;
  background: linear-gradient(160deg, #1f2a5e, #121a40); box-shadow: 0 0 0 3px rgba(255,255,255,.12), 0 24px 60px rgba(0,0,0,.5); }
.card-head { --c: var(--N); height: calc(var(--cell) * .5); border-radius: 12px; display: grid; place-items: center; font-size: calc(var(--cell) * .32); font-weight: 900; color: #fff; background: var(--c); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); }
.cell { position: relative; width: var(--cell); height: calc(var(--cell) * .82); border: none; border-radius: 12px; background: #fff; padding: 4px; display: grid; place-items: center; overflow: hidden; transition: transform .12s; }
.cell:hover { transform: scale(1.04); z-index: 1; }
.cell img { max-width: 100%; max-height: 100%; pointer-events: none; }
.cell.free { background: radial-gradient(circle, #ffe680, #ffb300); color: #7a3e00; font-weight: 900; font-size: calc(var(--cell) * .18); cursor: default; }
.cell.free span { display: block; font-size: calc(var(--cell) * .32); line-height: 1; }
.cell .daub { position: absolute; inset: 10%; border-radius: 50%; background: radial-gradient(circle at 35% 35%, rgba(255,120,200,.75), rgba(214,30,140,.6)); mix-blend-mode: multiply; transform: scale(0); }
.cell.marked .daub { animation: daub .35s cubic-bezier(.3,1.6,.5,1) forwards; }
.cell.free .daub { transform: scale(1); background: none; }
@keyframes daub { to { transform: scale(1); } }
.cell.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.cell.win { box-shadow: 0 0 0 4px #ffd54a, 0 0 24px #ffd54a; animation: winPulse .8s ease-in-out infinite alternate; }
@keyframes winPulse { to { transform: scale(1.06); } }
.cell.hint { box-shadow: 0 0 0 3px #4ade80; }
.card-no { margin-top: 10px; color: var(--muted); font-size: 13px; }

/* ============ Modal ============ */
.modal { position: fixed; inset: 0; display: none; place-items: center; z-index: 20; }
.modal.open { display: grid; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 20, .7); backdrop-filter: blur(6px); animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.modal-box { position: relative; max-width: min(94vw, 1000px); max-height: 92vh; overflow: auto; border-radius: 24px; background: #151d45; border: 1px solid var(--panel-brd); box-shadow: 0 40px 90px rgba(0,0,0,.6); padding: 22px; }
.modal-box.fly { animation: flyIn .8s cubic-bezier(.34,1.45,.64,1) both; }
@keyframes flyIn { from { transform: translate(var(--fx, 0), var(--fy, -100vh)) rotate(var(--fr, 0deg)); } }
.modal-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 12px; border: none; background: rgba(255,255,255,.1); font-size: 20px; }
.modal-close:hover { background: #e53935; }
.help-view { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.help-view h2 { margin: 0 50px; font-size: 26px; }
.help-view img { width: min(80vw, 760px); max-height: 66vh; object-fit: contain; border-radius: 14px; }
.help-nav { display: flex; gap: 10px; align-items: center; }
.help-nav .dots { display: flex; gap: 6px; }
.help-nav .dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.25); }
.help-nav .dots i.on { background: #ffd54a; }
.check-view { display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: min(560px, 86vw); }
.check-view h2 { margin: 0; }
.check-form { display: flex; gap: 10px; }
.check-form input { width: 140px; font-size: 22px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--panel-brd); background: #0d1433; color: #fff; }
.check-result { font-size: 22px; font-weight: 800; text-align: center; }
.check-result.yes { color: #4ade80; font-size: 34px; } .check-result.no { color: #fbbf24; }
.check-view .bingo-card { --cell: min(13vh, 15vw, 110px); }
.check-view .cell { cursor: default; }
.win-view { text-align: center; padding: 10px 30px; }
.win-view .big { font-size: clamp(56px, 10vw, 110px); font-weight: 900; line-height: 1; background: linear-gradient(90deg, #ffd54a, #ff4d6d, #b06cff, #4fc3f7); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop .7s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes pop { from { transform: scale(.2) rotate(-12deg); opacity: 0; } }
.win-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 22px 0; }
.win-stats div { background: rgba(255,255,255,.06); border-radius: 14px; padding: 12px 14px; }
.win-stats small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.win-stats b { font-size: 26px; }
.new-best { color: #ffd54a; font-weight: 800; font-size: 20px; animation: bump .6s ease 3; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.modal-actions .pill-btn { height: 46px; font-size: 16px; padding: 0 22px; }
.countdown { font-size: 140px; font-weight: 900; text-align: center; padding: 10px 60px; color: #ffd54a; animation: pop .5s both; }

#confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 30; }
.img-error { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 60; max-width: min(560px, 92vw); padding: 14px 18px; border-radius: 14px; background: #3b0d16; border: 2px solid #ff5a6e; color: #fff; font-size: 15px; line-height: 1.45; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.img-error code { background: rgba(255,255,255,.12); padding: 1px 5px; border-radius: 5px; }
.img-error .pill-btn { margin-top: 10px; }

/* ============ Print ============ */
#screen-print { overflow-y: auto; }
.field { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.field input, .field select { width: 80px; height: 36px; border-radius: 10px; border: 1px solid var(--panel-brd); background: #0d1433; color: #fff; padding: 0 8px; font-size: 15px; }
.field select { width: auto; }
.print-tip { text-align: center; color: var(--muted); margin: 14px; }
.print-sheets { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 0 0 40px; }
.sheet { width: 210mm; min-height: 297mm; background: #fff; color: #111; padding: 10mm; display: grid; gap: 8mm; box-shadow: 0 10px 40px rgba(0,0,0,.5); align-content: start; }
.sheet.per-1, .sheet.per-2 { grid-template-columns: minmax(0, 1fr); } .sheet.per-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pcard { border: 2px solid #222; border-radius: 6mm; padding: 4mm; break-inside: avoid; min-width: 0; }
.pcard-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.5mm; }
.pcard-head { color: #fff; font-weight: 900; text-align: center; border-radius: 3mm; padding: 1mm 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pcard-cell { border: 1px solid #999; border-radius: 2mm; display: grid; place-items: center; aspect-ratio: 432 / 230; padding: 1mm; min-width: 0; overflow: hidden; }
.pcard-cell img { width: 100%; height: 100%; object-fit: contain; min-width: 0; }
.pcard-cell.free { font-weight: 900; background: #ffe680; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pcard-foot { display: flex; justify-content: space-between; font-size: 10pt; margin-top: 2mm; color: #444; }
.per-1 .pcard-head { font-size: 32pt; } .per-2 .pcard-head { font-size: 22pt; } .per-4 .pcard-head { font-size: 14pt; }
.per-1 .pcard-cell { aspect-ratio: 432 / 300; } .per-4 .pcard-foot { font-size: 8pt; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { height: auto !important; overflow: visible !important; background: #fff; }
  .bg, .no-print, #confetti, .modal, .screen:not(#screen-print) { display: none !important; }
  #screen-print { position: static; display: block !important; overflow: visible; animation: none; }
  .print-sheets { padding: 0; gap: 0; display: block; }
  .sheet { box-shadow: none; page-break-after: always; break-after: page; min-height: auto; height: 297mm; }
}

/* ============ Responsive ============ */
@media (max-width: 1000px), (max-height: 560px) {
  body { overflow: auto; }
  .screen { position: absolute; min-height: 100%; }
  .mode-grid, .play-grid { grid-template-columns: 1fr; }
  .caller-main, .solo-main { flex: none; display: flex; flex-direction: column; }
  .machine, .machine-body { min-height: auto; flex: none; }
  .machine { padding-bottom: 120px; }
  .display { height: auto; }
  .board { min-height: 320px; max-height: 70vh; }
  .machine-body { grid-template-columns: 1fr; }
  .globe-wrap { width: min(46%, 260px); margin: 0 auto; }
  .bingo-card { --cell: min(calc((96vw - 60px) / 5), 150px); }
  .win-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
