:root {
  --bg0: #060a12; --panel: rgba(20, 28, 44, 0.86); --panel2: rgba(34, 46, 70, 0.92); --line: rgba(255,255,255,0.1);
  --ink: #f6f8fc; --muted: #a3afc5; --gold: #ffc83d; --go: #22c97c; --go2: #0e9a58;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; color: var(--ink); font-family: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent; }
body { background: radial-gradient(ellipse 120% 80% at 50% 45%, #123a2e 0%, #0b1f22 45%, var(--bg0) 100%); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- chunky buttons ---------- */
.big-btn { --c1: #4ea0ff; --c2: #2a6cf0; --c3: #1a4bb4; position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px 16px; border: 0; border-radius: 18px; color: #fff; font-weight: 900; font-size: 17px; letter-spacing: 0.2px; text-shadow: 0 2px 0 rgba(0,0,0,0.22); background: linear-gradient(180deg, var(--c1), var(--c2)); box-shadow: 0 5px 0 var(--c3), 0 10px 22px rgba(0,0,0,0.35), inset 0 2px 0 rgba(255,255,255,0.35); transition: transform 0.08s, box-shadow 0.08s, filter 0.15s; }
.big-btn:hover { filter: brightness(1.08); }
.big-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--c3), 0 4px 12px rgba(0,0,0,0.35), inset 0 2px 0 rgba(255,255,255,0.35); }
.big-btn:disabled { filter: grayscale(0.7) brightness(0.8); cursor: default; }
.big-btn.play { --c1: #48eba3; --c2: #1fbf74; --c3: #0b7f47; }
.big-btn.blue { --c1: #5aa8ff; --c2: #2f6ff0; --c3: #1b48a8; }
.big-btn.orange { --c1: #ffa14d; --c2: #f26a1f; --c3: #a8420c; }
.big-btn.purple { --c1: #b98aff; --c2: #7c47f0; --c3: #4f25a8; }
.big-btn.teal { --c1: #4fe0e6; --c2: #13a9b8; --c3: #0a6d78; }
.big-btn.red { --c1: #ff7a6a; --c2: #e2382a; --c3: #962015; }
.big-btn.sm { padding: 10px 14px; font-size: 15px; border-radius: 14px; }
.big-btn .bi { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: rgba(255,255,255,0.18); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15); flex: none; }
.big-btn .bi svg { width: 26px; height: 26px; }
.big-btn.hero { justify-content: flex-start; padding: 16px 20px; border-radius: 22px; overflow: hidden; }
.big-btn.hero .bi { width: 58px; height: 58px; border-radius: 18px; }
.big-btn.hero .bi svg { width: 34px; height: 34px; }
.big-btn.hero .bt { display: flex; flex-direction: column; align-items: flex-start; }
.big-btn.hero b { font-size: 30px; line-height: 1.05; }
.big-btn.hero small { font-size: 14px; font-weight: 700; opacity: 0.92; }
.big-btn.hero::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.3) 50%, transparent 65%); background-size: 250% 100%; animation: shine 3.4s ease-in-out infinite; pointer-events: none; }
@keyframes shine { 0%, 60% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
.text-btn { background: none; border: 0; color: var(--muted); font-weight: 800; padding: 10px; }
.text-btn:hover { color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05)); font-weight: 800; box-shadow: 0 3px 0 rgba(0,0,0,0.35); }
.btn.primary { background: linear-gradient(180deg, #48eba3, #1fbf74); color: #fff; box-shadow: 0 3px 0 #0b7f47; border-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- menus ---------- */
#menu { position: fixed; inset: 0; overflow-y: auto; touch-action: pan-y; background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(6,10,18,0.55), rgba(6,10,18,0.88) 100%); }
.screen { max-width: 560px; margin: 0 auto; padding: max(18px, 4vh) 18px 32px; animation: rise 0.28s ease-out; }
.screen.wide { max-width: 760px; }
.screen.center { text-align: center; padding-top: 12vh; }
.screen.center .stack { margin: 0 auto; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 18px; }
.logo-ball { width: 56px; height: 56px; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.6)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-8deg); } }
h1 { margin: 0; font-size: 38px; font-weight: 900; letter-spacing: -0.6px; line-height: 1; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.35), 0 10px 30px rgba(0,0,0,0.6); }
h2 { font-size: 26px; font-weight: 900; margin: 12px 0 6px; letter-spacing: -0.3px; }
.blurb { color: var(--muted); margin: 0 0 14px; line-height: 1.45; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.grid.three { grid-template-columns: repeat(3, 1fr); margin-top: 0; }
.grid .big-btn:not(.sm) { flex-direction: column; gap: 8px; padding: 16px 10px 14px; min-height: 108px; }
.grid .big-btn b { font-size: 16px; }

#tables-wrap { margin-top: 22px; padding: 14px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 14px 34px rgba(0,0,0,0.4); }
.daily { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; margin: 0 2px 12px; }
.kicker { color: var(--gold); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 1.3px; }
.daily .tname { font-size: 18px; }
.next-in { color: var(--muted); font-size: 12px; margin-left: auto; }
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tcard { position: relative; padding: 6px 6px 8px; border: 2px solid transparent; border-radius: 16px; background: linear-gradient(180deg, var(--panel2), rgba(16,22,34,0.9)); box-shadow: 0 4px 0 rgba(0,0,0,0.4); transition: transform 0.12s, border-color 0.15s; }
.tcard:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.25); }
.tcard:active { transform: translateY(2px); }
.tcard.today { border-color: var(--gold); box-shadow: 0 4px 0 rgba(0,0,0,0.4), 0 0 20px rgba(255,200,61,0.3); }
.tcard canvas { width: 100%; height: 78px; display: block; }
.tcard b { display: block; margin-top: 4px; font-size: 14px; text-align: center; }
.badge { position: absolute; top: -7px; right: -5px; z-index: 1; background: linear-gradient(180deg, #ffd45e, #ffae1c); color: #3a2400; font-size: 10px; font-weight: 900; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.6px; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.badge.today { background: linear-gradient(180deg, #ffe07a, #ffb21c); }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.profile { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.profile input { width: 120px; background: none; border: 0; outline: none; user-select: text; font-weight: 800; }
.av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 14px; color: #fff; background: linear-gradient(135deg, #3d8bff, #8a4fff); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.25); flex: none; position: relative; }
.coins { display: flex; align-items: center; gap: 7px; padding: 8px 14px 8px 9px; border-radius: 999px; background: linear-gradient(180deg, rgba(255,200,61,0.22), rgba(255,157,28,0.1)); border: 1px solid rgba(255,200,61,0.4); font-weight: 900; }
.coins .shop { display: flex; align-items: center; gap: 4px; color: var(--gold); font-size: 13px; padding-left: 9px; margin-left: 2px; border-left: 1px solid rgba(255,200,61,0.3); }
.coins .shop svg { width: 15px; height: 15px; }
.coins.static { cursor: default; }
.coin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c4 0 12%, #ffd34d 30%, #e9a20c 70%, #a86c00); box-shadow: inset 0 0 0 2px rgba(150,90,0,0.35), 0 1px 3px rgba(0,0,0,0.4); vertical-align: -4px; flex: none; }

.back { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 999px; color: var(--ink); padding: 7px 14px 7px 9px; font-weight: 800; }
.back svg { width: 18px; height: 18px; }
.prev.big { width: 100%; height: 220px; display: block; margin-top: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.levels { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 8px; align-items: center; padding: 10px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.levels span { font-weight: 900; padding: 0 6px; }
.row { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.row .big-btn { width: auto; }
.or { margin: 18px 0 0; text-align: center; }
#btn-create { margin-top: 6px; }
#join-code { flex: 1; min-width: 0; text-transform: uppercase; background: rgba(0,0,0,0.4); border: 2px solid var(--line); border-radius: 14px; padding: 11px 12px; letter-spacing: 4px; font-weight: 900; user-select: text; outline: none; }
#join-code:focus { border-color: var(--go); }
.spinner { position: relative; width: 74px; height: 74px; margin: 0 auto 10px; }
.spinner::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 5px solid rgba(255,255,255,0.08); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
.spinner span { position: absolute; inset: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 10%, #222 35%, #000); box-shadow: 0 4px 10px rgba(0,0,0,0.6); }
@keyframes spin { to { transform: rotate(360deg); } }
.share { margin: 16px auto; max-width: 420px; }
.share .code { font-size: 46px; font-weight: 900; letter-spacing: 10px; color: var(--gold); text-shadow: 0 4px 20px rgba(255,200,61,0.35); }
.share .link { flex: 1; min-width: 0; background: rgba(0,0,0,0.4); border: 1px solid var(--line); border-radius: 12px; padding: 11px; color: var(--muted); user-select: text; }
#btn-cancel { margin-top: 18px; }
.shop-head { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cues { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cuecard { padding: 12px; background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 2px solid var(--line); border-radius: 18px; text-align: center; }
.cuecard.on { border-color: var(--go); box-shadow: 0 0 24px rgba(32,199,122,0.25); }
.cuecard canvas { width: 100%; height: 44px; display: block; margin-bottom: 6px; }
.cuecard .btn { width: 100%; margin-top: 10px; }
.trophy { width: 96px; height: 96px; margin: 0 auto; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 8%, #ffd34d 25%, #e39b00 70%, #8a5a00); box-shadow: 0 0 0 8px rgba(255,200,61,0.15), 0 10px 40px rgba(255,200,61,0.4); animation: pop 0.5s cubic-bezier(.2,1.6,.4,1); }
.trophy.lose { background: radial-gradient(circle at 35% 30%, #fff 0 8%, #9aa6bd 30%, #4a5468 75%, #252b38); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }
.reward { font-size: 24px; font-weight: 900; color: var(--gold); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(4,7,12,0.6); animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal .box { width: min(360px, 90vw); padding: 22px 20px 18px; border-radius: 22px; text-align: center; background: linear-gradient(180deg, #24304a, #161e30); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,0,0,0.6); animation: pop 0.25s cubic-bezier(.2,1.4,.4,1); }
.modal b { font-size: 21px; }
.modal p { color: var(--muted); margin: 8px 0 14px; }
.modal .row { justify-content: center; }
.modal .row .big-btn { flex: 1; }

/* ---------- HUD ---------- */
#hud { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left)); pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-right { display: flex; gap: 6px; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; border: 1px solid var(--line); background: rgba(16,22,34,0.88); box-shadow: 0 3px 0 rgba(0,0,0,0.4); }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.4); }
.icon-btn.sound .off { display: none; }
.icon-btn.sound.muted .on { display: none; }
.icon-btn.sound.muted .off { display: inline; }
.players { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: center; min-width: 0; }
.pl { --t: 1; display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 42%; padding: 5px 14px 5px 5px; border-radius: 999px; background: linear-gradient(180deg, rgba(34,44,66,0.94), rgba(16,22,34,0.94)); border: 2px solid var(--line); box-shadow: 0 4px 12px rgba(0,0,0,0.35); transition: box-shadow 0.25s, border-color 0.25s, opacity 0.25s; opacity: 0.7; }
.pl.right { padding: 5px 5px 5px 14px; }
.pl.right .who { align-items: flex-end; }
.pl.turn { opacity: 1; border-color: rgba(255,200,61,0.85); box-shadow: 0 0 22px rgba(255,200,61,0.35); }
.pl .av { width: 36px; height: 36px; }
.pl.turn .av::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--t) * 360deg), rgba(255,255,255,0.08) 0); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
.pl.right .av { background: linear-gradient(135deg, #ff6a4d, #d93a2b); }
.who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pl .name { font-weight: 900; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pl .balls { display: flex; gap: 2px; min-height: 14px; white-space: nowrap; overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 700; }
.pl .balls img { width: 14px; height: 14px; }
.pl .balls img.gone { opacity: 0.15; filter: grayscale(1); }
.vs { display: flex; flex-direction: column; align-items: center; font-weight: 900; font-size: 12px; color: var(--gold); text-shadow: 0 0 10px rgba(255,200,61,0.5); }
#timer { font-size: 18px; color: #ff6a4d; text-shadow: 0 0 12px rgba(255,80,50,0.6); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }
#toast { position: fixed; left: 50%; top: 64px; transform: translate(-50%, -6px); max-width: 90%; padding: 9px 18px; border-radius: 999px; background: rgba(8,12,20,0.9); border: 1px solid var(--line); font-weight: 800; text-align: center; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 5; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#hint { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: 80%; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 16px; background: rgba(8,12,20,0.9); border: 1px solid rgba(255,200,61,0.45); font-weight: 700; font-size: 14px; pointer-events: none; animation: rise 0.3s ease-out; }
#hint .hand { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--gold); animation: tap 1.4s ease-in-out infinite; flex: none; }
@keyframes tap { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.6); opacity: 0.5; } }

/* left control column: spin ball on top, power slider below */
#controls { position: fixed; left: max(10px, env(safe-area-inset-left)); top: 66px; bottom: max(12px, env(safe-area-inset-bottom)); width: 104px; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px 0; border-radius: 22px; background: linear-gradient(180deg, rgba(22,30,46,0.9), rgba(12,17,28,0.9)); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,0.45); }
#strike { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#strike .face { position: relative; width: 76px; height: 76px; border-radius: 50%; background: radial-gradient(circle at 36% 30%, #fff 0 6%, #f4f0e4 30%, #cfc9b8 75%, #8f8a7c); box-shadow: 0 6px 14px rgba(0,0,0,0.5), inset 0 -4px 10px rgba(0,0,0,0.25); cursor: crosshair; touch-action: none; }
#strike .cross { position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(rgba(0,0,0,0.14), rgba(0,0,0,0.14)) center / 1px 70% no-repeat, linear-gradient(rgba(0,0,0,0.14), rgba(0,0,0,0.14)) center / 70% 1px no-repeat; }
#strike .dot { position: absolute; left: 50%; top: 50%; width: 15px; height: 15px; margin: -7.5px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff8a7a, #e0261c 60%, #8a0f08); box-shadow: 0 0 0 2px rgba(255,255,255,0.75), 0 2px 4px rgba(0,0,0,0.5); }
#strike .label { font-size: 11px; font-weight: 800; color: var(--muted); text-align: center; line-height: 1.15; min-height: 26px; padding: 0 4px; }
#power { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#power .pct { font-size: 13px; font-weight: 900; color: var(--gold); }
#power .track { position: relative; flex: 1; min-height: 80px; width: 52px; border-radius: 16px; background: linear-gradient(90deg, rgba(0,0,0,0.55), rgba(0,0,0,0.3), rgba(0,0,0,0.55)); border: 1px solid var(--line); box-shadow: inset 0 3px 8px rgba(0,0,0,0.7); overflow: hidden; touch-action: none; cursor: ns-resize; }
#power .fill { position: absolute; left: 0; right: 0; top: 0; height: 0; background: linear-gradient(180deg, #22c97c, #ffc83d 55%, #ff4d2e); opacity: 0.85; }
#power .handle { position: absolute; left: 50%; top: 0; width: 16px; height: 100%; margin-left: -8px; pointer-events: none; }
#power .handle i { position: absolute; left: 0; right: 0; top: 0; height: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #f4efe4 0 10px, #2a7de1 10px 13px, #e9d2a6 13px 52%, #6b3a1c 52% 60%, #1c1c1c 60%); box-shadow: 0 2px 6px rgba(0,0,0,0.6), inset 2px 0 2px rgba(255,255,255,0.3); }
#power .track.active { border-color: rgba(255,200,61,0.6); }
#power .pull { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
#power .pull::after { content: ' ↓'; }
#controls .off { opacity: 0.4; pointer-events: none; }

@media (max-width: 600px), (max-height: 500px) {
  h1 { font-size: 28px; } .logo-ball { width: 42px; height: 42px; }
  .big-btn.hero b { font-size: 24px; } .grid .big-btn:not(.sm) { min-height: 88px; }
  .grid.three { grid-template-columns: 1fr; }
  #hint { font-size: 12px; padding: 7px 12px; bottom: 8px; } #toast { font-size: 13px; padding: 6px 14px; top: 52px; }
  #hud { padding-top: max(5px, env(safe-area-inset-top)); padding-bottom: 4px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 12px; }
  #controls { top: 50px; width: 78px; gap: 8px; padding: 8px 0; border-radius: 18px; }
  #strike .face { width: 56px; height: 56px; } #strike .label { font-size: 10px; min-height: 22px; }
  #power .track { width: 40px; }
  .pl .name { font-size: 12px; } .pl .av { width: 28px; height: 28px; font-size: 12px; }
}

/* Phones held sideways: short screens get a compact menu that fits without scrolling. */
@media (max-height: 500px) and (min-aspect-ratio: 4/3) {
  .screen { max-width: 680px; padding: max(10px, env(safe-area-inset-top)) max(56px, env(safe-area-inset-right)) 16px max(56px, env(safe-area-inset-left)); }
  .logo { margin-bottom: 10px; } h1 { font-size: 24px; } .logo-ball { width: 34px; height: 34px; }
  .big-btn.hero { padding: 10px 16px; } .big-btn.hero .bi { width: 44px; height: 44px; } .big-btn.hero b { font-size: 22px; }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
  .grid .big-btn:not(.sm) { min-height: 0; padding: 10px 6px; gap: 4px; }
  .grid .big-btn .bi { width: 34px; height: 34px; border-radius: 10px; } .grid .big-btn .bi svg { width: 20px; height: 20px; }
  .grid .big-btn b { font-size: 14px; }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
  .bar { margin-top: 10px; } #tables-wrap { margin-top: 12px; }
  .prev.big { height: 120px; }
  .screen.center { padding-top: 4vh; }
}
/* Phones held upright: the players get their own row under the buttons, and
   the control column slims down so the upright table gets the width. */
@media (max-width: 500px) and (orientation: portrait) {
  #hud { flex-wrap: wrap; row-gap: 6px; }
  .players { order: 3; flex: 0 0 100%; gap: 6px; }
  .pl { max-width: 44%; flex: 1 1 0; }
  .pl.right { justify-content: flex-end; }
  .pl .balls img { width: 11px; height: 11px; }
  .vs { font-size: 10px; }
  #controls { top: calc(max(5px, env(safe-area-inset-top)) + 96px); width: 68px; }
  #strike .face { width: 50px; height: 50px; }
  #power .track { width: 36px; }
  #toast { top: calc(max(5px, env(safe-area-inset-top)) + 96px); }
}

/* ---------- win celebration ---------- */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
.win-banner { position: fixed; left: 50%; top: 42%; z-index: 40; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap;
  font-size: clamp(40px, 9vw, 96px); font-weight: 900; letter-spacing: -1px; color: #fff3a8;
  background: linear-gradient(180deg, #fffbe0, #ffd34d 55%, #ff9d1c); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 #8a4a00) drop-shadow(0 10px 30px rgba(0,0,0,0.6));
  animation: banner 1.6s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes banner { 0% { transform: translate(-50%, -50%) scale(0.2) rotate(-8deg); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1.12) rotate(2deg); opacity: 1; } 30% { transform: translate(-50%, -50%) scale(1) rotate(0); } 82% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(0.96); } }
.trophy { position: relative; }
.trophy.win::before { content: ''; position: absolute; inset: -70px; z-index: -1; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255,211,77,0.28) 0 10deg, transparent 10deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%); mask: radial-gradient(circle, #000 25%, transparent 70%);
  animation: rays 8s linear infinite; }
.trophy.win::after { content: '★'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; color: #fff6c4; text-shadow: 0 2px 0 #a86c00; }
@keyframes rays { to { transform: rotate(360deg); } }
#s-result.won .rtitle { font-size: 40px; background: linear-gradient(180deg, #fffbe0, #ffd34d 60%, #ff9d1c); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.35)); animation: pop 0.5s 0.1s cubic-bezier(.2,1.6,.4,1) both; }
.reward.bump { animation: bump 0.35s ease-out; }
@keyframes bump { 50% { transform: scale(1.25); } }
