/* 8 ball pool page, table overlay and home card (public/pool.js). The page reuses coinflip's .cf-* layout. */
.p8-create-row { grid-template-columns: minmax(0, 1fr) auto; }
#p8Create { height: 48px; padding: 0 24px; font-size: 15px; border-radius: 12px; white-space: nowrap; }
.p8-live { font: 800 11px 'Bricolage Grotesque', sans-serif; letter-spacing: .12em; color: #39d98a; padding: 4px 8px; border-radius: 999px; border: 1px solid rgba(57, 217, 138, .45); animation: p8Pulse 1.4s ease-in-out infinite; }
@keyframes p8Pulse { 50% { opacity: .45; } }
.p8-vs8 { position: relative; display: block; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #555 0, #141414 55%); color: transparent; }
.p8-vs8::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: #f4f1ea; }
.p8-vs8::after { content: '8'; position: absolute; inset: 0; display: grid; place-items: center; color: #111; font: 800 10px 'Bricolage Grotesque', sans-serif; }
.p8-why { font-size: 12px; color: var(--muted); text-align: right; max-width: 150px; }
.p8-grp { font-weight: 700; }
.p8-grp.solids { color: #f5c400; }
.p8-grp.stripes { color: #9ab8ff; }

/* ---------- overlay ---------- */
.p8-overlay { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; background: rgba(4, 6, 10, .84); animation: fadeIn .2s; padding: 16px; }
.p8-box { position: relative; width: min(1180px, 100%); max-height: 100%; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 18px 22px 16px; }
.p8-box .close { z-index: 2; top: 14px; right: 14px; width: 36px; height: 36px; display: grid; place-items: center; font-size: 22px; line-height: 1; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: var(--text, #fff); cursor: pointer; transition: background .15s, border-color .15s; }
.p8-box .close:hover { background: rgba(255, 90, 110, .18); border-color: rgba(255, 90, 110, .55); }
.p8-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin: 0 46px 14px 0; }
/* a player: the skin with the shot clock running round it, then name + balls */
.p8-side { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 8px 16px 8px 8px; border-radius: 20px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015)); transition: border-color .25s, background .25s, box-shadow .25s; }
.p8-side.right { flex-direction: row-reverse; text-align: right; padding: 8px 8px 8px 16px; }
.p8-side.turn { border-color: rgba(57, 217, 138, .4); background: linear-gradient(180deg, rgba(57, 217, 138, .1), rgba(57, 217, 138, .03)); box-shadow: 0 10px 26px -16px rgba(57, 217, 138, .7); }
.p8-side.won { border-color: rgba(255, 201, 64, .55); background: linear-gradient(180deg, rgba(255, 201, 64, .12), rgba(255, 201, 64, .03)); }
.p8-av { position: relative; width: 64px; height: 64px; flex: none; }
.p8-av img { position: absolute; inset: 8px; width: 48px; height: 48px; border-radius: 12px; image-rendering: pixelated; cursor: pointer; background: #0d0a1c; }
.p8-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.p8-side.right .p8-ring { transform: scaleX(-1); }
.p8-ring rect { fill: none; stroke-width: 4.5; }
.p8-ring .bg { stroke: rgba(255, 255, 255, .07); }
.p8-ring .fg { stroke: #39d98a; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; filter: drop-shadow(0 0 4px currentColor); color: #39d98a; transition: stroke .4s, color .4s; }
.p8-ring .fg.mid { stroke: #ffc940; color: #ffc940; }
.p8-ring .fg.low { stroke: #ff4d5e; color: #ff4d5e; animation: p8Tick 1s ease-in-out infinite; }
@keyframes p8Tick { 50% { opacity: .55; } }
.p8-who { min-width: 0; flex: 1; }
.p8-who .n { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p8-to { margin-left: 8px; font-size: 11px; font-weight: 700; color: #ff4d5e; }
.p8-side.right .p8-to { margin: 0 8px 0 0; }
.p8-balls { display: flex; gap: 4px; margin-top: 7px; min-height: 22px; align-items: center; }
.p8-side.right .p8-balls { justify-content: flex-end; }
.p8-balls .p8-bi { width: 22px; height: 22px; border-radius: 50%; background-size: cover; flex: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); transition: opacity .3s, filter .3s, transform .3s; }
.p8-balls .p8-bi.in { opacity: .2; filter: grayscale(1); transform: scale(.85); }
.p8-balls .p8-bi.eight { box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
.p8-open { font-size: 12px; color: var(--muted); }
/* the pot between the players */
.p8-mid { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.p8-pot { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 2px 10px; }
.p8-pot::before { content: ''; position: absolute; inset: -14px -30px; z-index: -1; pointer-events: none; background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 20%, transparent), transparent); }
.p8-pot .l { display: flex; align-items: center; gap: 8px; font-size: 10.5px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.p8-pot .l::before, .p8-pot .l::after { content: ''; width: 18px; height: 1px; background: linear-gradient(90deg, transparent, currentColor); }
.p8-pot .l::after { transform: scaleX(-1); }
.p8-pot .v { display: inline-flex; align-items: center; gap: 8px; font: 900 30px/1.05 'Bricolage Grotesque', sans-serif; letter-spacing: -.01em; color: #fff; text-shadow: 0 2px 14px rgba(0, 0, 0, .5); white-space: nowrap; }
.p8-pot .coin { width: 24px; height: 24px; vertical-align: 0; }
.p8-msg { margin-top: 8px; min-height: 22px; font-weight: 800; font-size: 14.5px; white-space: nowrap; }
.p8-foul { color: #ff4d5e; }
.p8-play { display: flex; align-items: center; justify-content: center; gap: 16px; }
.p8-tablecol { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.p8-rack { display: block; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .45)); }
.p8-tablewrap { position: relative; line-height: 0; }
#p8Canvas { display: block; touch-action: none; border-radius: 22px; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .55)); }
.p8-banner { position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; padding: 20px 34px; border-radius: 18px; line-height: 1.2; text-align: center;
  background: rgba(10, 6, 24, .88); border: 1px solid rgba(167, 123, 255, .45); box-shadow: 0 20px 50px rgba(0, 0, 0, .6); animation: p8Pop .35s cubic-bezier(.2, .9, .3, 1.3); }
.p8-banner .t { font: 900 30px 'Bricolage Grotesque', sans-serif; }
.p8-banner .t.win { color: #39d98a; }
.p8-banner .t.lose { color: #ff4d5e; }
.p8-banner .r { margin-top: 4px; color: var(--muted); font-size: 14px; }
.p8-banner .p { margin-top: 8px; font-size: 20px; font-weight: 800; color: var(--gold, #ffc940); }
@keyframes p8Pop { from { opacity: 0; transform: scale(.8); } }
/* power: drag down the bar and let go */
.p8-power { position: relative; flex: none; width: 34px; height: min(300px, 46vh); border-radius: 999px; background: #0d0a1c; border: 1px solid var(--line); touch-action: none; cursor: grab; opacity: .45; transition: opacity .2s; overflow: hidden; }
.p8-power.on { opacity: 1; border-color: rgba(57, 217, 138, .5); }
.p8-powerfill { position: absolute; inset: 0 0 auto 0; height: var(--p, 0%); background: linear-gradient(180deg, #39d98a, #ffc940 60%, #ff4d5e); }
.p8-powercue { position: absolute; left: 50%; top: 8px; height: calc(100% - 16px); width: 9px; transform: translate(-50%, 0); border-radius: 5px 5px 3px 3px; background: linear-gradient(180deg, #9ad7ff 0 3%, #f2e6cf 3% 8%, #d9a35b 8% 60%, #2a1650 60%); box-shadow: 0 2px 6px rgba(0, 0, 0, .5); pointer-events: none; }
.p8-foot { display: flex; justify-content: flex-end; margin-top: 10px; min-height: 34px; }
#p8Resign { padding: 6px 16px; }
#p8Resign:hover { border-color: #ff4d5e; color: #ff4d5e; }
/* phones held upright: the table is drawn on its side, the power bar goes under it */
.p8-box.rot { padding: 14px 10px 12px; }
.p8-box.rot .p8-head { grid-template-columns: 1fr auto 1fr; margin-right: 44px; gap: 6px; align-items: start; }
.p8-box.rot .p8-side, .p8-box.rot .p8-side.right { flex-direction: column; text-align: center; padding: 6px 4px 8px; gap: 4px; border-radius: 16px; }
.p8-box.rot .p8-av { width: 50px; height: 50px; }
.p8-box.rot .p8-av img { inset: 7px; width: 36px; height: 36px; border-radius: 9px; }
.p8-box.rot .p8-who { width: 100%; }
.p8-box.rot .p8-who .n { font-size: 13px; }
.p8-box.rot .p8-to { display: block; margin: 0; }
.p8-box.rot .p8-balls, .p8-box.rot .p8-side.right .p8-balls { gap: 2px; flex-wrap: wrap; justify-content: center; margin-top: 3px; }
.p8-box.rot .p8-pot { margin-top: 12px; }
.p8-box.rot .p8-pot .v { font-size: 22px; gap: 6px; }
.p8-box.rot .p8-pot .coin { width: 18px; height: 18px; }
.p8-box.rot .p8-mid { align-self: center; max-width: 150px; }
.p8-box.rot .p8-msg { white-space: normal; font-size: 12.5px; text-align: center; }
.p8-box.rot .p8-balls .p8-bi { width: 12px; height: 12px; }
.p8-box.rot .p8-play { gap: 8px; }
@media (max-width: 960px) {
  .p8-create-row { grid-template-columns: 1fr; }
  .p8-overlay { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { .p8-live, .p8-banner, .p8-ring .fg.low { animation: none; } }

/* ---------- home card (drawn, like the Russian Roulette card) ---------- */
.p8-cover { background: linear-gradient(180deg, #4923a5 0%, #3b1a8e 40%, #2b1369 70%, #1f0d48 100%); border-radius: inherit; }
.p8-cover .p8c-art, .p8-cover .p8c-art svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.p8c-halo { fill: #5329b5; }
.p8c-rail { fill: #241056; stroke: rgba(167, 123, 255, .5); stroke-width: .8; }
.p8c-felt { fill: #3d22a0; }
.p8c-line { stroke: rgba(255, 255, 255, .12); stroke-width: .35; stroke-dasharray: 1 1; }
.p8c-obj { transform-box: fill-box; transform-origin: center; }
.game-card:hover .p8-cover .p8c-stick { animation: p8cStick 2.6s infinite; }
.game-card:hover .p8-cover .p8c-cueball { animation: p8cCue 2.6s infinite; }
.game-card:hover .p8-cover .p8c-obj { animation: p8cObj 2.6s infinite; }
/* the stick draws back, strikes, then lifts away */
@keyframes p8cStick { 0% { transform: translateX(0); opacity: 1; animation-timing-function: ease-in-out; } 22% { transform: translateX(-5px); animation-timing-function: cubic-bezier(.5, 0, 1, .6); } 30% { transform: translateX(1.2px); opacity: 1; } 46% { transform: translateX(1.2px); opacity: 0; } 90% { transform: translateX(0); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
/* the cue ball runs to the 3, glances off and stops */
@keyframes p8cCue { 0%, 30% { transform: translate(0, 0); opacity: 1; animation-timing-function: cubic-bezier(.25, .6, .5, 1); } 44% { transform: translate(30.63px, -11.5px); animation-timing-function: cubic-bezier(.2, .7, .4, 1); } 58% { transform: translate(33.1px, -8.4px); opacity: 1; } 86% { transform: translate(33.1px, -8.4px); opacity: 1; } 92% { transform: translate(33.1px, -8.4px); opacity: 0; } 93% { transform: translate(0, 0); opacity: 0; } 100% { transform: translate(0, 0); opacity: 1; } }
/* the 3 rolls into the top right pocket and drops */
@keyframes p8cObj { 0%, 44% { transform: translate(0, 0) scale(1); opacity: 1; animation-timing-function: cubic-bezier(.2, .6, .5, 1); } 58% { transform: translate(15px, -12px) scale(1); opacity: 1; animation-timing-function: ease-in; } 65% { transform: translate(15px, -12px) scale(.3); opacity: 0; } 93% { transform: translate(0, 0) scale(1); opacity: 0; } 100% { transform: translate(0, 0) scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .game-card:hover .p8-cover .p8c-stick, .game-card:hover .p8-cover .p8c-cueball, .game-card:hover .p8-cover .p8c-obj { animation: none; } }
.p8-cover .p8c-tag { position: absolute; left: 8%; bottom: 18.5%; display: flex; align-items: center; gap: 5px; font-size: clamp(7px, 4.2cqw, 10px); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #b9a8dc; }
.p8-cover .p8c-tag::before { content: ''; width: .75em; height: .75em; border-radius: 50%; background: #39d98a; }
.p8-cover .p8c-name { position: absolute; left: 8%; bottom: 6%; font-size: clamp(12px, 9.5cqw, 22px); font-weight: 900; letter-spacing: -.01em; color: #fff; white-space: nowrap; }
/* with a mouse you pull the cue on the table itself; the bar just shows the power */
@media (pointer: fine) { .p8-power { pointer-events: none; cursor: default; } }
/* spin: a little cue ball with the tip's spot on it, above the power bar */
.p8-ctrl { display: flex; flex-direction: column; align-items: center; gap: 14px; flex: none; }
.p8-spin { position: relative; width: 58px; height: 58px; border-radius: 50%; flex: none; touch-action: none; cursor: crosshair; opacity: .5; transition: opacity .2s;
  background: radial-gradient(circle at 35% 30%, #fff 0, #f4f1ea 35%, #b9b4aa 100%); box-shadow: 0 0 0 1px var(--line), 0 6px 14px rgba(0, 0, 0, .45); }
.p8-spin.on { opacity: 1; box-shadow: 0 0 0 2px rgba(57, 217, 138, .55), 0 6px 14px rgba(0, 0, 0, .45); }
.p8-spin::before, .p8-spin::after { content: ''; position: absolute; background: rgba(0, 0, 0, .12); pointer-events: none; }
.p8-spin::before { left: 50%; top: 10%; bottom: 10%; width: 1px; }
.p8-spin::after { top: 50%; left: 10%; right: 10%; height: 1px; }
.p8-spin i { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; border-radius: 50%; transform: translate(-50%, -50%); background: #ff4d5e; box-shadow: 0 0 0 2px #fff, 0 0 8px rgba(255, 77, 94, .7); pointer-events: none; }
.p8-box.rot .p8-ctrl { gap: 10px; }
.p8-box.rot .p8-power { width: 40px; height: min(360px, 54vh); }
.p8-box.rot .p8-spin { width: 44px; height: 44px; }
.p8-banner .p8-lobby { margin-top: 14px; height: 40px; padding: 0 22px; border-radius: 10px; font-size: 14px; }
