/* Pop Pool — the 8-ball pool of Rede POP. The shared parts (strip, header, buttons, lobby, waiting room, chat, end
   screen, ranking) come from damas/src/damas.css; the table, the balls and the controls are drawn in code (game.js). */
:root {
  --ink: #1e1b4b; --muted: #6b6f8a; --line: #e5e7f0; --soft: #f5f3ff;
  --r: #E11D2E; --b: #1D4ED8; --g: #16A34A; --y: #FACC15; --w: #111827;
  --pink: #ec4899; --purple: #7c3aed;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: #fff; color: var(--ink); font-family: 'Baloo 2', 'Sora', system-ui, sans-serif;
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; overscroll-behavior: none; }
button { font: inherit; cursor: pointer; color: inherit; }
.hidden { display: none !important; }

/* platform strip (same as every game page) */
.platform-strip { position: relative; overflow: hidden; padding: 8px 0; flex-shrink: 0; width: 100%; min-height: 58px; background: #fff; }
.platform-strip::before, .platform-strip::after { content: ''; position: absolute; top: 0; bottom: 0; width: 32px; z-index: 2; pointer-events: none; }
.platform-strip::before { left: 0; background: linear-gradient(to right, #fff, transparent); }
.platform-strip::after { right: 0; background: linear-gradient(to left, #fff, transparent); }
.platform-track { display: flex; align-items: center; gap: 10px; width: max-content; animation: platformMarquee 36s linear infinite; }
@keyframes platformMarquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.platform-card { flex: 0 0 auto; width: 76px; height: 42px; border-radius: 12px; background: #fff; border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); display: flex; align-items: center; justify-content: center; }
.platform-card img { height: 22px; width: auto; max-width: 90%; object-fit: contain; display: block; }
@media (prefers-reduced-motion: reduce) { .platform-track { animation: none; } }

/* header */
.top { width: 100%; max-width: 480px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px; padding: 2px 12px; }
.top .brand { height: 42px; width: auto; justify-self: center; }
body.in-lobby .top .brand { visibility: hidden; }   /* the big logo is right below */
.icon-group { display: flex; gap: 5px; }
.icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0;
  background: #fff; border: 1.5px solid #ece7f7; box-shadow: 0 3px 0 #ece7f7; color: var(--ink); font-weight: 800; font-size: 17px;
  transition: transform .15s cubic-bezier(.34,1.56,.64,1); overflow: hidden; }
.icon:active { transform: scale(.88); }
#btnBack { font-size: 26px; line-height: 1; }

main { width: 100%; max-width: 480px; flex: 1; display: flex; flex-direction: column; padding: 0 12px calc(12px + env(safe-area-inset-bottom)); }
.view { display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* buttons drawn in code (the Codex jelly art was dropped, owner Oct 19) */
.jelly { --b1: #ff5fa8; --b2: #e11d74; --bd: #a30f52; position: relative; border: 0; width: 100%; max-width: 340px; min-height: 52px;
  padding: 10px 18px; border-radius: 18px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--b1), var(--b2)); box-shadow: 0 5px 0 var(--bd), 0 10px 18px -6px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.35);
  text-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .1s, box-shadow .1s; cursor: pointer; overflow: hidden; }
.jelly::after { content: ''; position: absolute; left: 10px; right: 10px; top: 4px; height: 38%; border-radius: 14px 14px 30px 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.32), rgba(255,255,255,0)); pointer-events: none; }
.jelly.blue { --b1: #4f9dff; --b2: #2563eb; --bd: #1740a8; }
.jelly span { font-weight: 800; font-size: clamp(17px, 5vw, 20px); line-height: 1.1; }
.jelly small { font-size: 12.5px; font-weight: 600; opacity: .92; margin-top: 3px; }
.jelly:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--bd), 0 4px 8px -4px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.35); }
.jelly:disabled { filter: grayscale(.7) opacity(.6); }
/* the two big lobby buttons: icon disc, text on the left, arrow on the right */
.jelly.big { flex-direction: row; justify-content: flex-start; gap: 14px; min-height: 76px; padding: 12px 16px; text-align: left; border-radius: 22px; }
.jelly.big .bi { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 25px;
  background: rgba(255,255,255,.22); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); text-shadow: none; }
.jelly.big .bt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.jelly.big span { font-size: 20px; }
.jelly.big .bx { flex: 0 0 auto; font-size: 26px; font-weight: 800; opacity: .9; }
.jelly.big.pink { animation: bigPulse 2.4s ease-in-out infinite; }
@keyframes bigPulse { 0%,100% { box-shadow: 0 5px 0 var(--bd), 0 10px 18px -6px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.35); }
  50% { box-shadow: 0 5px 0 var(--bd), 0 10px 26px -2px rgba(236,72,153,.55), inset 0 1px 0 rgba(255,255,255,.35); } }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 15px; padding: 6px; }
.mini-btn { border: 0; border-radius: 12px; padding: 8px 12px; font-weight: 800; color: #fff; text-decoration: none; font-size: 14px; }
.mini-btn.blue { background: linear-gradient(180deg, #5fb4ff, #1e6fe0); }
.mini-btn.green { background: linear-gradient(180deg, #4ade80, #16a34a); }

/* lobby */
.hero { text-align: center; margin-top: -6px; }
.hero-logo { width: min(250px, 62vw); height: auto; animation: logoFloat 3.4s ease-in-out infinite; }
@keyframes logoFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.hero-tag { margin: 0; color: var(--muted); font-weight: 600; font-size: 14px; }
#btnQuick small { min-height: 1em; }
.code-join { display: flex; gap: 6px; width: 100%; max-width: 340px; }
.code-join input { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; font: inherit; font-size: 15px; background: #fafaff; color: var(--ink); text-transform: uppercase; }
.code-join input::placeholder { text-transform: none; }
.code-join button { border: 0; border-radius: 14px; padding: 0 16px; font-weight: 800; color: #fff; background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.panel { position: relative; width: 100%; background: #fff; border: 1.5px solid var(--line); border-radius: 20px; padding: 14px; box-shadow: 0 4px 14px rgba(30,27,75,.06); }
.panel h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font-size: 19px; }
.panel h4 { margin: 14px 0 6px; font-size: 16px; }
.h-ico { font-size: 22px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; line-height: 1.35; }
.legend { display: grid; grid-template-columns: 1fr; gap: 8px; }
.legend .row { display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 1.3; }
.legend .row .pc { flex: 0 0 auto; }
.pts-rule { margin: 0; font-size: 14px; line-height: 1.45; }
.live-list { display: flex; flex-direction: column; gap: 8px; }
.live-empty { text-align: center; color: var(--muted); font-size: 14px; }
.live-empty img { width: 170px; height: auto; display: block; margin: 0 auto 2px; }
.live-empty p { margin: 0; }
.live-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 14px; background: var(--soft); }
.live-row .avs { display: flex; }
.live-row .avs > * { margin-left: -8px; border: 2px solid #fff; border-radius: 50%; }
.live-row .avs > *:first-child { margin-left: 0; }
.live-row .who { flex: 1; min-width: 0; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-row button { border: 0; border-radius: 12px; padding: 6px 12px; font-weight: 800; color: #fff; background: linear-gradient(180deg, #a78bfa, #7c3aed); }
/* waiting room */
#waitView h2 { margin: 6px 0 0; font-size: 22px; text-align: center; }
.wait-code { text-align: center; background: var(--soft); border-radius: 18px; padding: 10px 14px; width: 100%; max-width: 340px; }
.wait-code span { color: var(--muted); font-size: 13px; display: block; }
.wait-code b { font-size: 30px; letter-spacing: 4px; }
.wait-share { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
.wait-seats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; max-width: 360px; }
.wseat { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px; border-radius: 16px; background: #fff; border: 1.5px solid var(--line); text-align: center; }
.wseat b { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wseat .av { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #f1f0fb; font-size: 22px; color: var(--muted); }
.wseat.off { opacity: .5; }
.wseat.empty { border-style: dashed; color: var(--muted); }
.wait-hint { margin: 0; text-align: center; color: var(--muted); font-size: 14.5px; max-width: 340px; }

.status { font-weight: 800; font-size: 17px; text-align: center; min-height: 24px; line-height: 1.2; }
.status.mine { color: #be185d; animation: statusPulse 1.2s ease-in-out infinite; }
@keyframes statusPulse { 50% { transform: scale(1.05); } }
.timer { width: 100%; max-width: 340px; height: 6px; border-radius: 3px; background: #eef0f6; overflow: hidden; }
.timer i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f472b6, #a855f7); transition: width .25s linear; }
.timer i.low { background: linear-gradient(90deg, #f87171, #dc2626); }

.hand { position: relative; width: 100%; height: 118px; margin-top: 10px; }
.hand .pc { position: absolute; bottom: 4px; --w: 70px; transition: transform .2s cubic-bezier(.34,1.56,.64,1), left .25s, filter .2s; transform-origin: 50% 100%; }
.hand .pc.dim { filter: brightness(.82) saturate(.7) drop-shadow(0 2px 3px rgba(30,27,75,.18)); }
.hand .pc.ok { cursor: pointer; }
.hand .pc.drawn { box-shadow: 0 0 0 3px #fde047, 0 0 14px #facc15; }
.hand.spect { display: none; }

.actions { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 380px; padding-right: 0; }
.actions .act { width: 46%; max-width: 170px; }
.actions .act span { font-size: 17px; }
.watch-badge { background: var(--soft); border-radius: 14px; padding: 8px 12px; font-weight: 700; color: var(--purple); }

/* effects (sprite strips, added by game.js) */
.fx { position: absolute; pointer-events: none; z-index: 20; transform: translate(-50%, -50%); background-repeat: no-repeat; aspect-ratio: 1; }

/* chat (same as Pop Match / Pop Go) */
.talk-row { display: flex; align-items: center; gap: 6px; width: calc(100% - 84px); align-self: flex-start; }
.talk-row.no-react .reaction-bar { display: none; }
.talk-log-btn { position: relative; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 17px; }
.talk-unread { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.reaction-bar { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: 2px 0; }
.reaction-bar::-webkit-scrollbar { display: none; }
.reaction-bar button { flex: 0 0 auto; border: 1.5px solid var(--line); background: #faf9ff; border-radius: 10px; font-size: 18px; padding: 2px 7px; }
.pop-chat { display: flex; gap: 6px; width: calc(100% - 84px); align-self: flex-start; }
.pop-chat input { flex: 1; min-width: 0; height: 38px; border-radius: 19px; border: 1.5px solid #ddd6fe; padding: 0 14px; font: inherit; background: #f8fafc; color: var(--ink); }
.pop-chat button { width: 42px; height: 38px; border: 0; border-radius: 19px; background: linear-gradient(180deg, #f59e0b, #ea580c); color: #fff; font-size: 16px; }
.talk-log { position: fixed; left: 12px; right: 96px; bottom: calc(84px + env(safe-area-inset-bottom)); max-height: 46dvh; z-index: 300; background: #fff; border: 1.5px solid var(--line);
  border-radius: 18px; box-shadow: 0 10px 30px rgba(30,27,75,.2); display: flex; flex-direction: column; overflow: hidden; }
.talk-log-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.talk-log-head button { border: 0; background: none; font-size: 16px; }
.talk-log-list { overflow-y: auto; padding: 6px 12px 10px; display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.talk-item { display: flex; gap: 6px; align-items: baseline; }
.talk-item .who { font-weight: 800; color: var(--purple); }
.talk-item .what { flex: 1; word-break: break-word; }
.talk-item.emoji .what { font-size: 18px; }
.talk-item .when { color: var(--muted); font-size: 11px; }
.talk-empty { color: var(--muted); text-align: center; padding: 10px; }
.net-badge { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); background: #fef3c7; color: #92400e; border: 1.5px solid #fcd34d; font-weight: 800; padding: 6px 14px; border-radius: 14px; z-index: 400; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 600; background: rgba(30,27,75,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sheet { position: relative; background: #fff; border-radius: 22px; padding: 18px 16px; width: 100%; max-width: 420px; max-height: 86dvh; overflow-y: auto; box-shadow: 0 16px 40px rgba(30,27,75,.3); }
.sheet.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sheet h2 { margin: 0 0 8px; font-size: 22px; }
.sheet ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 14.5px; line-height: 1.35; }
.sheet-x { position: absolute; right: 10px; top: 10px; border: 0; background: var(--soft); width: 32px; height: 32px; border-radius: 50%; }
.gate-logo { width: 160px; height: auto; }
.win-box { position: relative; background: #fff; border-radius: 24px; padding: 14px 16px 12px; width: 100%; max-width: 380px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 16px 40px rgba(30,27,75,.3); }
.crown { position: relative; width: 230px; margin-top: -60px; }
.crown img { width: 100%; height: auto; display: block; }
.crown b { position: absolute; left: 19%; right: 19%; top: 61.5%; height: 16%; /* the ribbon's front band: y 215-290 of 360, centre 70% */ display: flex; align-items: center; justify-content: center; color: #5a2a00;
  font-size: 17px; font-weight: 800; letter-spacing: .2px; text-shadow: 0 1px 0 rgba(255,240,180,.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-box h2 { margin: 0; font-size: 24px; }
.win-rank { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 5px; }
.win-rank li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: #faf9ff; font-size: 14.5px; }
.win-rank li.me { background: #fdf2f8; border: 1.5px solid #f9a8d4; }
.win-rank .who { flex: 1; text-align: left; font-weight: 700; }
.win-rank .pts { font-weight: 800; color: #16a34a; }
.win-sponsor { display: flex; align-items: center; gap: 8px; border-radius: 14px; padding: 6px 12px; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; }
.win-sponsor img { height: 26px; width: auto; }
.win-box > * { position: relative; z-index: 1; }
.win-box > .fx-confetti { position: absolute; left: -10px; right: -10px; top: -60px; height: 360px; pointer-events: none; background: url(/pop/asset/game/fx-confetti.webp) 0 0 / 1600% 100% no-repeat; z-index: 0; opacity: .85; }
.fx-confetti.go { animation: confetti 1.4s steps(16, jump-none) forwards, confettiOut .5s 1.2s forwards; }
@keyframes confetti { to { background-position-x: 100%; } }
@keyframes confettiOut { to { opacity: 0; } }

/* short phones: everything must fit above the fold (strip + header + players + table + hand + buttons) */
@media (max-height: 760px) {
}
@media (max-height: 700px) {
  #gameView { gap: 3px; }
  .opps { min-height: 62px; }
  .opp .av, .opp .av > :first-child { width: 40px !important; height: 40px !important; }
  .opp .ring { left: -13px; top: -13px; width: 66px; height: 66px; }
  .status { font-size: 15px; min-height: 20px; }
  .hand { height: 98px; }
  .actions .act { max-width: 150px; }
}

/* ranking sheet */
.rank-list { display: flex; flex-direction: column; gap: 6px; }
.rank-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: #faf9ff; }
.rank-row.me { background: #fdf2f8; border: 1.5px solid #f9a8d4; }
.rank-row .pos { width: 28px; text-align: center; font-weight: 800; color: var(--muted); }
.rank-row .pos img { width: 26px; height: auto; display: block; margin: 0 auto; }
.rank-row .who { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .pts { font-weight: 800; color: var(--purple); }

.table-toast { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; z-index: 6;
  background: rgba(30,27,75,.88); color: #fff; font-weight: 800; padding: 8px 16px; border-radius: 16px; font-size: 17px; text-align: center; max-width: 86%;
  transition: opacity .2s, transform .25s cubic-bezier(.34,1.56,.64,1); }
.table-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }


/* ======================= Pop Pool ======================= */
body:has(#lobbyView:not(.hidden)) .top .brand { visibility: hidden; }   /* the lobby's big logo is right below */
.hero-logo { width: min(270px, 70vw); }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; max-width: 340px; }
.mode-pick button { border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 9px 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--ink); }
.mode-pick b { font-size: 16px; } .mode-pick small { font-size: 12px; color: var(--muted); font-weight: 600; }
.mode-pick button.on { border-color: #16a34a; background: #f0fdf4; box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.mode-pick button.on b { color: #15803d; }
.wait-mode { font-weight: 800; color: #15803d; background: #f0fdf4; border-radius: 12px; padding: 3px 12px; font-size: 14px; }
.wseat .team { font-size: 11px; font-weight: 800; border-radius: 8px; padding: 0 6px; color: #fff; }
.team-a { background: #ec4899; } .team-b { background: #2563eb; }

#gameView { gap: 6px; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
.tcard { position: relative; border: 2px solid var(--line); border-radius: 16px; padding: 6px 8px; background: #fff; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tcard.turn { border-color: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.25); }
.tcard.mine { background: #fdf2f8; }
.tcard .tp { display: flex; align-items: center; gap: 6px; min-width: 0; position: relative; }
.tcard .tp .nm { font-weight: 800; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tcard .tp.now .nm { color: #b45309; }
.tcard .tp.now .nm::before { content: '🎱 '; }
.tcard .tp.off { opacity: .45; }
.tcard .grp { font-size: 11.5px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.tcard .mb { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); position: relative; flex: 0 0 auto; }
.tcard .mb.st { background: #fff !important; overflow: hidden; }
.tcard .mb.st { box-shadow: inset 0 0 0 1px #cbd5e1; }
.tcard .mb.st::after { content: ''; position: absolute; left: 0; right: 0; top: 3px; height: 6px; background: var(--c); }
.tcard .mb.gone { opacity: .18; }
.tcard .ptimer { height: 4px; border-radius: 2px; background: #f1f0fb; overflow: hidden; }
.tcard .ptimer i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #84cc16); transition: width .25s linear; }
.tcard .ptimer i.low { background: linear-gradient(90deg, #ef4444, #f97316); }
.tcard .bubble { position: absolute; left: 50%; top: 0; transform: translate(-50%, -100%); background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 3px 8px;
  font-size: 13px; font-weight: 700; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; z-index: 5; box-shadow: 0 4px 10px rgba(30,27,75,.15); }
.tcard .bubble.emoji { font-size: 22px; padding: 0 6px; }
.tcard .bubble.out { opacity: 0; transition: opacity .3s; }
.bot-av { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #eef2ff; font-size: 16px; flex: 0 0 auto; }
.bot-av img { width: 22px; height: 22px; object-fit: contain; }

.table-wrap { position: relative; width: 100%; display: flex; justify-content: center; touch-action: none; }
#table { display: block; touch-action: none; border-radius: 18px; box-shadow: 0 10px 26px -10px rgba(20,40,20,.55); }
/* fine aim wheel: drag sideways to turn the cue a little */
.fine-aim { position: relative; flex: 0 0 auto; width: 66px; height: 48px; border-radius: 14px; touch-action: none; user-select: none; overflow: hidden;
  background: repeating-linear-gradient(90deg, #e2e8f0 0 6px, #94a3b8 6px 7px, #f8fafc 7px 12px); background-position: var(--roll, 0px) 0;
  border: 2px solid #cbd5e1; box-shadow: inset 10px 0 10px -6px rgba(0,0,0,.35), inset -10px 0 10px -6px rgba(0,0,0,.35); }
.fine-aim i { position: absolute; top: 4px; bottom: 4px; left: 50%; width: 3px; margin-left: -1.5px; background: #f59e0b; border-radius: 2px; }
.fine-aim::after { content: '◀ mira ▶'; position: absolute; left: 0; right: 0; bottom: 1px; text-align: center; font-size: 9px; font-weight: 800; color: #334155; text-shadow: 0 0 3px #fff; pointer-events: none; }
.fine-aim.on { border-color: #f59e0b; }
.fine-aim.off { opacity: .4; }
.controls { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 440px; }
.spin-btn { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%; border: 3px solid #e5e7eb; background: radial-gradient(circle at 35% 30%, #fff, #e5e7eb 70%); position: relative; padding: 0; }
.spin-btn i, .spin-ball i { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #dc2626; left: 50%; top: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px #fff; }
.power { position: relative; flex: 1; height: 48px; border-radius: 24px; background: linear-gradient(90deg, #f1f5f9, #e2e8f0); border: 2px solid #cbd5e1; overflow: hidden; touch-action: none; user-select: none; }
.power-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #22c55e, #facc15 55%, #ef4444); }
.power span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; white-space: nowrap; color: #475569; pointer-events: none; }
.power.off { opacity: .45; }
.spin-pop { position: absolute; left: 12px; z-index: 30; background: #fff; border: 1.5px solid var(--line); border-radius: 18px; padding: 10px 14px; text-align: center; box-shadow: 0 10px 28px rgba(30,27,75,.25); }
.spin-pop p { margin: 0 0 6px; font-weight: 800; }
.spin-pop small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; max-width: 160px; }
.spin-ball { position: relative; width: 120px; height: 120px; margin: 0 auto; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #e5e7eb 70%); border: 3px solid #cbd5e1; touch-action: none; }
.spin-ball i { width: 18px; height: 18px; }
.resign { margin-top: 0; }
@media (max-width: 380px) { body.pool-game .controls .fine-aim { width: 50px; } .fine-aim::after { content: '◀ ▶'; } body.pool-game .controls { gap: 5px; } }
@media (max-height: 720px) { .teams .tcard { padding: 4px 6px; } .controls .power, .spin-btn { height: 42px; } .spin-btn { width: 42px; } .status { font-size: 15px; } }

/* confetti only for the winners (it sat over the text otherwise) */
.win-box > .fx-confetti { opacity: 0; }
.win-box > .fx-confetti.go { opacity: .85; }

/* wide screens: the table lies down and may use more width than the rest of the page */
@media (min-width: 700px) { body:has(#gameView:not(.hidden)) main { max-width: 800px; } }

/* ---------- the game fits one screen, any phone, no scroll ---------- */
body.pool-game { height: 100dvh; min-height: 0; overflow: hidden; }
body.pool-game .top { padding: 2px 10px; }
body.pool-game .top .icon { width: 34px; height: 34px; font-size: 15px; }
body.pool-game main { flex: 1; min-height: 0; padding: 0 8px calc(6px + env(safe-area-inset-bottom)); max-width: none; }
body.pool-game #gameView { height: 100%; min-height: 0; display: flex; flex-direction: column; align-items: stretch; gap: 5px; position: relative; max-width: 800px; margin: 0 auto; width: 100%; }
body.pool-game .teams { flex: 0 0 auto; gap: 5px; }
body.pool-game .tcard { padding: 4px 7px; gap: 2px; border-radius: 12px; }
body.pool-game .tcard .tp { gap: 4px; }
body.pool-game .tcard .tp .nm { font-size: 12px; }
body.pool-game .tcard .tp > :first-child, body.pool-game .tcard .bot-av { width: 22px !important; height: 22px !important; font-size: 13px; }
body.pool-game .tcard .ptimer { height: 3px; }
body.pool-game .teams.pairs .tcard .grp { font-size: 10.5px; }
body.pool-game .table-wrap { flex: 1 1 auto; min-height: 0; align-items: center; overflow: hidden; }
body.pool-game .status { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); z-index: 5; pointer-events: none; font-size: 12.5px; min-height: 0;
  background: rgba(15,23,42,.72); color: #fff; padding: 3px 10px; border-radius: 12px; white-space: nowrap; max-width: 94%; overflow: hidden; text-overflow: ellipsis; }
body.pool-game .status:empty { display: none; }
body.pool-game .status.mine { color: #fde68a; animation: none; }
body.pool-game .watch-badge { position: absolute; right: 6px; bottom: 6px; z-index: 5; font-size: 12px; padding: 3px 8px; }
body.pool-game .controls { flex: 0 0 auto; max-width: none; gap: 6px; }
body.pool-game .controls .power, body.pool-game .controls .fine-aim { height: 44px; }
body.pool-game .controls .spin-btn, body.pool-game .controls .talk-log-btn { width: 44px; height: 44px; border-radius: 50%; }
/* full screen / focus mode: only the player cards, the table and the controls */
#btnFocus { display: none; }
body.pool-game #btnFocus { display: inline-grid; }
.game-head { display: flex; align-items: stretch; gap: 5px; flex: 0 0 auto; }
body.pool-game .game-head .teams { flex: 1 1 0; width: auto; min-width: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.focus-exit { display: none; flex: 0 0 auto; width: 30px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: #334155; font-weight: 800; font-size: 14px; padding: 0; }
body.pool-focus .focus-exit { display: block; }
body.pool-focus .platform-strip, body.pool-focus header.top, body.pool-focus #rpGuestBanner { display: none !important; }
body.pool-focus main { padding-top: calc(4px + env(safe-area-inset-top)); }
/* compact player cards during the game: one slim line each (avatar, name, the group's balls), the turn clock a 2px bar */
body.pool-game .tcard { flex-direction: row; align-items: center; gap: 5px; padding: 3px 6px 4px; border-width: 1.5px; border-radius: 11px; }
body.pool-game .tcard .tps { flex: 1 1 auto; min-width: 0; gap: 4px; }
body.pool-game .tcard .tp > :first-child, body.pool-game .tcard .bot-av { width: 20px !important; height: 20px !important; font-size: 12px; }
body.pool-game .tcard .tp .nm { font-size: 11.5px; }
body.pool-game .tcard .tp.now .nm::before { content: ''; }
body.pool-game .tcard .grp { flex: 0 0 auto; flex-wrap: nowrap; gap: 1px; font-size: 10px; }
body.pool-game .tcard .grp .lbl.wide { display: none; }
body.pool-game .tcard .mb { width: 9px; height: 9px; }
body.pool-game .tcard .mb.st::after { top: 2px; height: 5px; }
body.pool-game .tcard .ptimer { position: absolute; left: 8px; right: 8px; bottom: 1px; height: 2px; }
body.pool-game .teams.pairs .tcard { flex-wrap: wrap; row-gap: 1px; }
body.pool-game .teams.pairs .tcard .grp { flex-basis: 100%; }
body.pool-game .spin-pop { top: auto; bottom: 58px; }
body.pool-game .talk-log { left: 8px; right: 8px; bottom: calc(60px + env(safe-area-inset-bottom)); max-height: 60dvh; display: flex; flex-direction: column; }
body.pool-game .talk-log.hidden { display: none; }
body.pool-game .talk-log .talk-row { width: 100%; padding: 6px 10px 0; }
body.pool-game .talk-log .talk-log-list { flex: 1; min-height: 60px; }
body.pool-game .talk-log .pop-chat { width: auto; margin: 0 10px 6px; }
body.pool-game .talk-log .resign { align-self: center; margin: 0 0 6px; }

/* pairs: the two players of a side on one line */
.tcard .tps { display: flex; gap: 6px; min-width: 0; }
.tcard .tps .tp { flex: 1 1 0; min-width: 0; }
/* short screens (a phone lying down): no sponsor strip during the game, smaller header */
@media (max-height: 520px) {
  body.pool-game .platform-strip { display: none; }
  body.pool-game .top { padding: 0 10px; }
  body.pool-game .top .brand { height: 30px; }
  body.pool-game .top .icon { width: 30px; height: 30px; }
  body.pool-game .tcard .grp .mb { width: 10px; height: 10px; }
}
/* aim-line button: 3 per match */
.guide-btn { position: relative; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 2px solid #cbd5e1; background: #fff; font-size: 19px; padding: 0; }
.guide-btn b { position: absolute; right: -4px; top: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: #f59e0b; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.guide-btn.on { border-color: #f59e0b; background: #fef3c7; box-shadow: 0 0 0 3px rgba(245,158,11,.3); }
.guide-btn.off { opacity: .45; }
@media (max-width: 380px) { body.pool-game .controls .guide-btn { width: 38px; height: 38px; font-size: 16px; } }
/* v2 art: dark room behind the table during a game */
body.pool-game { background: #07141c url(../asset/game/bg-portrait.webp?v=2) center / cover no-repeat fixed; }
@media (orientation: landscape) { body.pool-game { background-image: url(../asset/game/bg-landscape.webp?v=2); } }
/* table look + cue pickers (lobby) */
.look-note { margin: -4px 0 10px; font-size: 13px; color: #64748b; }
.mesa-pick { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.mesa-pick button { flex: 0 0 auto; width: 96px; height: 58px; border-radius: 12px; border: 3px solid transparent; background-size: cover; background-position: center; position: relative; box-shadow: inset 0 0 0 4px rgba(60,30,10,.85); }
.mesa-pick button b { position: absolute; left: 0; right: 0; bottom: 4px; font-size: 12px; color: #fff; text-shadow: 0 1px 3px #000; }
.mesa-pick button.on, .cue-pick button.on { border-color: #f59e0b; box-shadow: inset 0 0 0 4px rgba(60,30,10,.85), 0 0 0 3px rgba(245,158,11,.35); }
.cue-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.cue-pick button { height: 40px; border-radius: 12px; border: 3px solid #e2e8f0; background: #0f172a; padding: 0 8px; display: flex; align-items: center; }
.cue-pick button.on { box-shadow: 0 0 0 3px rgba(245,158,11,.35); }
.cue-pick img { width: 100%; height: auto; display: block; }
/* no sliding sponsor strip during a game: the platform logos are pressed into the cloth instead */
body.pool-game .platform-strip { display: none !important; }
/* aim line choice for a friends' table */
.aim-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; max-width: 340px; margin-top: -2px; }
.aim-pick > span { grid-column: 1 / -1; font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; }
.aim-pick button { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 7px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--ink); }
.aim-pick b { font-size: 14px; } .aim-pick small { font-size: 10.5px; color: var(--muted); font-weight: 600; line-height: 1.2; }
.aim-pick button.on { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.aim-pick button.on b { color: #1d4ed8; }
