/* The pool scene has its own compact match header and full-height chat column. */
.pool-left-controls{display:flex;flex-direction:column;align-items:center;gap:10px;align-self:stretch;padding-top:7px;min-height:0}.pool-left-controls .pool-sound{font-size:9px;width:52px;min-height:27px;background:#17273a;color:#a6bed5;border:1px solid #31465d;box-shadow:none;margin:0;padding:4px}.pool-hit{width:64px;text-align:center}.pool-left-controls .pool-spot{display:block;width:64px;height:64px;aspect-ratio:1;border:0;box-shadow:none;border-radius:50%;cursor:crosshair;margin:0}.pool-hit .pool-spot-reset{display:block;width:64px;margin:5px 0 0;padding:2px;min-height:21px;font-size:9px;box-shadow:none;background:none;color:#a2b8cf;border:0}.pool-power-meter{position:relative;flex:1;max-height:480px;min-height:80px;width:23px;border:1px solid #21344e;background:#101b2d;border-radius:5px;overflow:hidden;margin-top:12px;box-shadow:inset 0 1px 7px #0009}.power-cue{position:absolute;top:10px;bottom:10px;left:8px;width:7px;background:linear-gradient(90deg,#79512f,#ecc991 45%,#9b6e3b);border-top:4px solid #9eb5b9;transform:translateY(var(--cue-pull,0px));transition:transform .045s;box-shadow:1px 0 3px #0008}.power-cue:after{content:'';position:absolute;top:65%;left:0;right:0;height:30%;background:repeating-linear-gradient(#222c38 0 12px,#b58a55 13px 15px)}.power-fill{position:absolute;inset:auto 0 0;height:var(--pull,0%);background:linear-gradient(#fae59b88,#e6a33a88);pointer-events:none}.pool-power-value{font-size:10px;color:#e6c783;font-weight:700}.pool-table-wrap{position:relative;min-width:0;display:grid;place-items:center}.pool-countdown{position:absolute;inset:0;background:#020a17b8;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:5;border-radius:26px;pointer-events:auto}.pool-countdown b{font-size:clamp(64px,12vw,150px);font-weight:900;line-height:1.1;color:#e9f7ff;text-shadow:0 4px 0 #4587ba,0 10px 30px #155a8c;animation:pool-count-pulse 1s infinite}.pool-countdown span{margin-top:22px;color:#dceeff;font-size:22px;font-weight:700}.pool-controls{display:none!important}@keyframes pool-count-pulse{0%{transform:scale(1.12)}70%,100%{transform:scale(1)}}@media(prefers-reduced-motion:reduce){.pool-countdown b{animation:none}}
body.pool-game[data-screen="play"]{background:#080e18;color:#deebf7;overflow:hidden}
.pool-game[data-screen="play"] header{height:46px;background:#090f1b;border-color:#243042;padding:0 20px;color:#c0d1e2}
.pool-game[data-screen="play"] header>a{font-size:20px;color:#e8f4ff}
.pool-game[data-screen="play"] header button{min-height:30px;padding:5px 11px;background:#26354b;border-color:#42536c;color:#e5edf8;box-shadow:none}
.pool-game[data-screen="play"] header #game-name,.pool-game[data-screen="play"] header>div>a{color:#9bb0c8}
/* Rightward offset of the table group only. The chat column and every other
   element keep their original width and position; the table's right edge stays
   one sliver away from the sidebar. */
.pool-game[data-screen="play"]{--pool-shift:28px}
.pool-game[data-screen="play"] .arena{height:calc(100dvh - 46px);min-height:0;grid-template-columns:minmax(0,1fr) 285px;padding:0;gap:0;align-items:stretch;background:#070c14}
.pool-game.portal-embedded[data-screen="play"] .arena{height:100dvh}
.pool-game[data-screen="play"] .game-panel{min-height:0;height:100%;padding:10px 16px 14px;border:0;border-radius:0;background:radial-gradient(ellipse at 50% 55%,#132a3c,#050a11 78%);overflow:hidden}
.pool-game[data-screen="play"] .game-panel .board-top{position:absolute;left:16px;top:13px;z-index:2;gap:10px}
.pool-game[data-screen="play"] .board-top>.eyebrow{display:none}
.pool-game[data-screen="play"] .board-top button{width:32px;height:30px;padding:0;min-height:30px;overflow:hidden;font-size:0;color:#d8e9f6;background:#1b293c;border:1px solid #36475e;border-radius:9px;box-shadow:none}
.pool-game[data-screen="play"] .board-top button::before{content:'←';font-size:23px;line-height:1}
.pool-matchup{position:relative;flex:none;width:min(780px,calc(100% - 110px));margin:0 auto;height:74px;min-height:74px}
.pool-matchup #seats{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:105px;height:100%;align-items:center}
.pool-matchup .seat{display:flex;align-items:center;gap:12px;min-height:0;padding:7px 0;background:none;border:0;border-radius:0;box-shadow:none;color:#e1ecf5}
.pool-matchup .seat:nth-child(2){flex-direction:row-reverse;text-align:right}
.pool-matchup .seat.active{background:none;box-shadow:none;border:0;color:#fff}
.pool-matchup .seat.active .seat-avatar{border-color:#fff4d4;box-shadow:0 0 14px #d9b96a60}
.pool-matchup .avatar-shell{width:47px;height:47px;flex:0 0 47px}
.pool-matchup .seat-avatar{border-radius:12px;border:2px solid #5a6b85;box-shadow:0 3px 8px #0006}
.pool-matchup .avatar-frame{inset:-8px;width:63px;height:63px}
.pool-matchup .seat-copy{display:flex;flex-direction:column;gap:5px}
.pool-matchup .seat-name{gap:6px;flex-wrap:wrap}
.pool-matchup .seat:nth-child(2) .seat-name{justify-content:flex-end}
.pool-matchup .seat-name strong{font-size:15px;max-width:180px;line-height:1.3}
.pool-matchup .member-label{font-size:7px;min-width:0;padding:1px 4px}
.pool-matchup .seat-status{font-size:9px;margin:0;color:#7c96b0}
.pool-matchup .seat.active .seat-status{color:#ecd294}
.pool-player-score{font-size:11px;color:#9db7cc;white-space:nowrap;align-self:flex-end;margin-bottom:11px}
.pool-match-clock{position:absolute;left:50%;top:12px;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;justify-content:center;width:66px;height:53px;background:#101b2e;border:1px solid #24344d;border-radius:10px;gap:4px}
.pool-clock-label{font-size:8px;color:#6c86a5;letter-spacing:2px}
.pool-match-clock #turn-clock{font-size:19px;line-height:1;margin:0;color:#f4cf7b;font-variant-numeric:tabular-nums}
.pool-round-strip{position:relative;min-height:23px;max-width:850px;margin:0 auto 3px;display:flex;align-items:center;justify-content:center;gap:12px;color:#9eb7cb;flex:none}
.pool-round-strip #status{font-size:11px;color:#9eb7cb;min-height:0;margin:0;text-align:center;line-height:1.4}
.pool-round-strip #again{width:auto;min-height:26px;padding:4px 12px;margin:0;background:#bf9b51;color:#fff8df;border:1px solid #f0d08a;box-shadow:none;font-size:11px}
.pool-game[data-screen="play"] .play-sidebar{display:flex;height:100%;min-height:0;gap:0;border-left:1px solid #263652;background:#172844}
.pool-game[data-screen="play"] .play-sidebar>.players-panel,.pool-game[data-screen="play"] .play-sidebar>.turn-panel{display:none}
.pool-game[data-screen="play"] .pool-chat-panel{display:flex;flex-direction:column;gap:0;flex:1;min-height:0;padding:16px 12px 12px;background:linear-gradient(#203657,#172844);border:0;border-radius:0;box-shadow:none;overflow:hidden}
.pool-chat-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-bottom:14px;border-bottom:1px solid #ffffff10;flex:none}
.pool-chat-heading h2{margin:0;font-size:15px;color:#e7f1fb;letter-spacing:0}
/* The old static 'Room only' badge is now a real fullscreen toggle. Inside
   the portal it is an EXIT-ONLY control: the shell header owns entering
   fullscreen, so the chat heading shows the plain-text 退出全屏 label only
   while fullscreen is active. No pill, fill, border, radius, native tooltip
   or selectable text: hovering/clicking must never paint a pale square over
   the white label. The heading uses space-between, so the title never moves.
   Standalone tabs keep the always-visible toggle (their header has no
   fullscreen button of its own). */
.pool-chat-fullscreen{flex:none;appearance:none;cursor:pointer;font:inherit;font-size:10px;font-weight:700;line-height:1.3;
  min-width:0;text-align:center;color:#cfe0f7;background:transparent;background-image:none;border:0;border-radius:0;box-shadow:none;padding:0;
  user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;
  transition:none}
/* table.css paints EVERY button with a pale #eaf2ff hover fill plus a -1px
   lift; the two home themes add `button:hover` rules at (0,4,1). Scope the
   flat override to .pool-chat-panel (0,5,0) so it wins on every screen, theme
   and load order: no fill, underline, colour change or lift in the resting,
   hover or active state. Height, font size and the plain text label are
   unchanged; only the keyboard focus ring remains. */
.pool-chat-panel .pool-chat-heading .pool-chat-fullscreen:not(:disabled),
.pool-chat-panel .pool-chat-heading .pool-chat-fullscreen:hover:not(:disabled),
.pool-chat-panel .pool-chat-heading .pool-chat-fullscreen:active:not(:disabled){
  background:transparent;background-image:none;
  border:0;box-shadow:none;transform:none;text-decoration:none}
.pool-chat-fullscreen:focus-visible{outline:2px solid #8fb7ff;outline-offset:2px}
.pool-chat-fullscreen[aria-pressed="true"]{color:#fff}
html.embedded-game .pool-chat-fullscreen{display:none}
html.embedded-game .pool-chat-fullscreen[aria-pressed="true"]{display:inline-block}
.pool-chat-log{flex:1;min-height:100px;overflow:auto;overscroll-behavior:contain;padding:12px 2px;scrollbar-width:thin;scrollbar-color:#49668b transparent}
.pool-chat-empty{font-size:11px;color:#7d9bbc;line-height:1.7;margin:6px 0}
.pool-chat-message{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;margin:0 0 12px;font-size:12px;line-height:1.65;overflow-wrap:anywhere;word-break:break-word}
.pool-chat-line{margin:0;min-width:0;color:#e3edf7}
.pool-chat-line strong{font-size:inherit;color:#a5d5ff}
.pool-chat-message time{padding-top:3px;font-size:8px;color:#637f9f;white-space:nowrap;font-variant-numeric:tabular-nums}
.pool-chat-body{white-space:pre-wrap}
.pool-chat-ball{display:inline-block;width:14px;height:14px;margin-inline-end:2px;vertical-align:middle}
.pool-chat-emoji .pool-chat-body{font-size:20px;line-height:1.2;vertical-align:-2px}
.pool-chat-notice{font-size:9px;line-height:1.5;margin:0 1px 8px;color:#87a4c5;min-height:14px;flex:none}
.pool-chat-panel .reactions-panel{padding:0;margin:0 0 9px;border:0;border-radius:0;background:none;box-shadow:none;flex:none}
.pool-chat-panel .reaction-buttons{gap:5px;display:grid;grid-template-columns:repeat(6,1fr)}
.pool-chat-panel .reaction-buttons button{padding:3px 0;min-height:31px;font-size:18px;border-radius:8px;border:1px solid #3d5574;background:#203857;color:#d7e5f2;box-shadow:none}
.pool-chat-panel #reaction-note,.pool-chat-panel #reaction-feed{display:none}
.pool-chat-form{display:flex;align-items:center;gap:6px;margin:0;flex:none}
.pool-chat-form input{min-width:0;flex:1;width:100%;margin:0;padding:10px;font-size:12px;border-radius:10px;border:1px solid #3e5676;background:#10213a;color:#eaf4ff;box-shadow:inset 0 2px 5px #0002}
.pool-chat-form input::placeholder{color:#6887ab}
.pool-chat-form button{min-height:38px;padding:8px 10px;font-size:11px;margin:0;border-radius:10px;border:1px solid #6681a5;background:#344f75;color:#e6f2ff;box-shadow:none}
.pool-chat-form button:disabled{opacity:.45}
.pool-game[data-screen="play"] .pool-leave{margin:0 12px 12px;padding:7px 12px;min-height:29px;width:calc(100% - 24px);font-size:10px;color:#a0b6cf;background:#15233a;border:1px solid #344b69;box-shadow:none}
.pool-game[data-screen="play"] .game-panel .board.pool{margin:auto;max-width:none;flex:1;min-height:0;display:flex;flex-direction:column;justify-content:center}
.pool-game[data-screen="play"] .pool-hud{display:none}
.pool-game[data-screen="play"] .pool canvas:not(.pool-spot){max-width:100%;max-height:calc(100dvh - 175px);width:100%;height:auto;object-fit:contain;box-shadow:none;margin:auto}
.pool-game.portal-embedded[data-screen="play"] .pool canvas:not(.pool-spot){max-height:calc(100dvh - 125px)}
.pool-game[data-screen="play"] .pool-left-controls{flex-shrink:0}
.pool-game[data-screen="play"] .pool-note{font-size:10px;color:#718da5;margin:6px 0 0;min-height:13px}
/* Keep canvas geometry proportional: pointer coordinates use its real box. */
.pool-game[data-screen="play"] .game-panel .board.pool{display:grid;grid-template-columns:64px minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto auto;column-gap:10px;align-items:stretch}
.pool-game[data-screen="play"] .pool-left-controls{grid-column:1;grid-row:1/4;display:flex;flex-direction:column;align-items:center;gap:10px;min-width:0}
.pool-game[data-screen="play"] .pool-table-wrap{grid-column:2;grid-row:1;display:grid;place-items:center;min-width:0;min-height:0;position:relative}
.pool-game[data-screen="play"] .pool canvas.pool-table-canvas{display:block;width:min(100%,calc((100dvh - 202px)*1.817));height:auto;max-height:none;aspect-ratio:1112/612;object-fit:fill}
.pool-game.portal-embedded[data-screen="play"] .pool canvas.pool-table-canvas{width:min(100%,calc((100dvh - 156px)*1.817));height:auto;max-height:none}
.pool-game[data-screen="play"] .pool-controls{display:none;grid-column:2;grid-row:2;width:100%;max-width:none}
.pool-game[data-screen="play"] .pool-note{grid-column:2;grid-row:3}
.pool-game[data-screen="play"] .pool canvas.pool-spot{display:block;width:62px;height:62px;max-width:62px;max-height:62px;aspect-ratio:1;box-shadow:none;border-radius:50%;cursor:crosshair;touch-action:none}
.pool-game[data-screen="play"] .pool-hit{width:64px;display:flex;flex-direction:column;align-items:center;gap:4px}
.pool-game[data-screen="play"] .pool .pool-spot-reset{font-size:8px;min-height:20px;padding:2px 4px;margin:0;width:62px;background:#1c2c3f;border-color:#34475d;color:#c3d4e3;box-shadow:none}
.pool-game[data-screen="play"] .pool .pool-sound{font-size:9px;width:62px;min-height:24px;padding:3px 5px;margin:0;background:#1c2c3f;border-color:#34475d;color:#bbcee0;box-shadow:none}
@media(max-width:1000px) and (min-width:761px){
 .pool-game[data-screen="play"]{--pool-shift:14px}
 .pool-game[data-screen="play"] .arena{grid-template-columns:minmax(0,1fr) 240px}
 .pool-matchup{width:calc(100% - 70px)}.pool-matchup #seats{gap:80px}.pool-matchup .seat-name strong{max-width:110px;font-size:12px}.pool-player-score{display:none}.pool-matchup .avatar-shell{width:38px;height:38px;flex-basis:38px}.pool-matchup .avatar-frame{width:52px;height:52px;inset:-7px}.pool-match-clock{width:52px;height:47px;top:15px}
}
@media(max-width:760px){
 .pool-game[data-screen="play"]{--pool-shift:0px}
 body.pool-game[data-screen="play"]{overflow:auto}.pool-game[data-screen="play"] header{height:44px;padding:0 12px}.pool-game[data-screen="play"] header>div{gap:8px}.pool-game[data-screen="play"] header>a{font-size:18px}.pool-game[data-screen="play"] #profile{display:none}
 .pool-game[data-screen="play"] .arena,.pool-game.portal-embedded[data-screen="play"] .arena{height:auto;min-height:calc(100dvh - 44px);grid-template-columns:1fr;display:grid;gap:0}
 .pool-game[data-screen="play"] .game-panel{height:auto;padding:5px 6px 10px;min-height:0;overflow:hidden}
 .pool-game[data-screen="play"] .game-panel .board-top{top:10px;left:8px}.pool-game[data-screen="play"] .board-top button{width:27px;height:26px;min-height:26px}
 .pool-matchup{width:calc(100% - 70px);height:64px;min-height:64px;margin-left:40px}.pool-matchup #seats{gap:58px}.pool-matchup .seat{gap:7px;padding:6px 0}.pool-matchup .avatar-shell{width:32px;height:32px;flex-basis:32px}.pool-matchup .avatar-frame{width:44px;height:44px;inset:-6px}.pool-matchup .seat-name strong{font-size:11px;max-width:75px}.pool-matchup .seat-status{font-size:7px}.pool-matchup .member-label{font-size:6px;padding:0 2px}.pool-match-clock{width:43px;height:42px;top:10px;border-radius:8px}.pool-match-clock #turn-clock{font-size:15px}.pool-clock-label{font-size:7px}.pool-player-score{display:none}
 .pool-round-strip{min-height:20px;margin-bottom:3px}.pool-round-strip #status{font-size:9px}.pool-game[data-screen="play"] .game-panel .board.pool{margin:0 auto;display:block;min-height:0}
 .pool-game[data-screen="play"] .pool canvas:not(.pool-spot),.pool-game.portal-embedded[data-screen="play"] .pool canvas:not(.pool-spot){max-height:none;width:100%;height:auto}
 .pool-game[data-screen="play"] .game-panel .board.pool{display:grid;grid-template-columns:42px minmax(0,1fr);column-gap:4px}.pool-game[data-screen="play"] .pool canvas.pool-spot{width:40px;height:40px;max-width:40px;max-height:40px}.pool-game[data-screen="play"] .pool-hit{width:42px}.pool-game[data-screen="play"] .pool .pool-spot-reset,.pool-game[data-screen="play"] .pool .pool-sound{width:42px;font-size:7px;padding:2px 1px}
 .pool-game[data-screen="play"] .play-sidebar{height:300px;min-height:0;border-left:0;border-top:1px solid #2d405c}.pool-game[data-screen="play"] .pool-chat-panel{padding:11px 12px 9px}.pool-chat-heading{padding-bottom:8px}.pool-chat-heading h2{font-size:13px}.pool-chat-log{padding:8px 1px}.pool-chat-message{margin-bottom:10px;font-size:11px}.pool-chat-notice{margin-bottom:5px}.pool-chat-panel .reaction-buttons button{min-height:28px;font-size:17px}.pool-chat-panel .reactions-panel{margin-bottom:7px}.pool-game[data-screen="play"] .pool-leave{margin-bottom:9px;min-height:27px}
}

.pool-game .pool-chat-form button:hover:not(:disabled){background:#42628c;color:#fff;border-color:#86a1c4}.pool-game .pool-left-controls .pool-sound:hover:not(:disabled){background:#263f5c;color:#e8f3ff}
.pool-power-meter{touch-action:none;cursor:ns-resize;width:32px}.power-cue{transition:none}.pool-pocketed{display:flex;gap:3px;min-height:22px}.pool-mini-ball{display:grid;place-items:center;flex:none;width:22px;height:22px;border-radius:50%;background:radial-gradient(circle at 32% 25%,#fff 0%,var(--ball) 38%,#080c19 100%);font:bold 11px sans-serif;color:white;text-shadow:0 1px 2px #000;box-shadow:0 2px 3px #0008}.pool-return{position:absolute;right:0;top:8%;bottom:8%;width:30px;display:flex;flex-direction:column-reverse;gap:3px;align-items:center;padding:8px 2px;border:3px solid #bb944f;border-radius:22px;background:#060b12;box-shadow:inset 0 0 0 2px #493b25;overflow:hidden;pointer-events:none}.pool-return .pool-mini-ball{animation:pool-sink-roll .7s ease-out both}@keyframes pool-sink-roll{from{transform:translateY(-450px) rotate(-720deg)}to{transform:translateY(0) rotate(0)}}@media(prefers-reduced-motion:reduce){.pool-return .pool-mini-ball{animation:none}}
/* Return channel shares the table canvas, scale and ball artwork. */
.pool-return{display:none}.pool-game[data-screen="play"] .pool canvas.pool-table-canvas{aspect-ratio:1232/644;width:min(100%,calc((100dvh - 202px)*1.9130))}.pool-game.portal-embedded[data-screen="play"] .pool canvas.pool-table-canvas{width:min(100%,calc((100dvh - 156px)*1.9130))}.pool-pocketed{font-size:9px;color:#91acc4;align-items:center}.pool-matchup .pool-pocketed canvas.pool-target-ball{display:block;width:27px;height:27px;max-height:none;margin:0;box-shadow:none}.pool-matchup .seat-copy{min-width:0}.pool-pocketed{flex-wrap:wrap}.pool-game .pool-table-canvas{touch-action:none}@media(max-width:700px){.pool-game[data-screen="play"] .pool canvas.pool-table-canvas,.pool-game.portal-embedded[data-screen="play"] .pool canvas.pool-table-canvas{width:100%}.pool-matchup .pool-pocketed canvas.pool-target-ball{width:16px;height:16px}.pool-pocketed{gap:1px}}
.power-cue{left:50%;margin-left:-7px;width:14px;border:0;background:url('../assets/pool/power-cue.svg') center/100% 100% no-repeat;box-shadow:none;filter:drop-shadow(1px 1px 1px #0009)}
.power-cue:after{display:none}
/* Reclaim the duplicate turn-caption rows for the table. */
.pool-matchup{height:60px;min-height:60px}
.pool-matchup .seat-status{display:none}
.pool-matchup .seat{padding:3px 0}
.pool-match-clock{top:4px}
.pool-round-strip:not(.pool-ended){display:none}
.pool-game[data-screen="play"] .pool canvas.pool-table-canvas{width:min(100%,calc((100dvh - 162px)*1.9130))}
.pool-game.portal-embedded[data-screen="play"] .pool canvas.pool-table-canvas{width:min(100%,calc((100dvh - 116px)*1.9130))}
@media(max-width:760px){.pool-matchup{height:52px;min-height:52px}.pool-match-clock{top:5px}}
@media(max-width:700px){.pool-game[data-screen="play"] .pool canvas.pool-table-canvas,.pool-game.portal-embedded[data-screen="play"] .pool canvas.pool-table-canvas{width:100%}}
/* Each countdown phase animates once through the Web Animations API. GO never blocks a shot. */
.pool-countdown b{animation:none}
.pool-countdown[data-phase="GO"]{pointer-events:none;background:#020a1750}
.pool-countdown[data-phase="GO"] b{color:#ffe9a3;text-shadow:0 4px 0 #8a672b,0 10px 30px #155a8c}
/* Lead-in: one caption-only second before 3 · 2 · 1. No number is shown yet. */
.pool-countdown[data-phase="READY"] b{display:none}
.pool-countdown[data-phase="READY"] span{
  margin-top:0;color:#eaf3ff;font-size:clamp(22px,4.2vmin,44px);
  letter-spacing:.14em;text-shadow:0 0 26px #8ab4ff99;
  animation:pool-ready-in .9s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes pool-ready-in{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.pool-countdown[data-phase="READY"] span{animation:none}}

/* Pool results occupy the viewport without replacing the real rematch action. */
.pool-game .pool-round-strip{display:none}
.pool-result-overlay{position:fixed;inset:0;width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;padding:24px;border:0;border-radius:0;background:transparent;box-shadow:none;color:#eaf4ff;overflow:hidden}
.pool-result-overlay[open]{display:grid;place-items:center}
.pool-result-overlay::backdrop{background:#030a15b8;backdrop-filter:blur(5px)}
.pool-result-card{--result-accent:#f4d78c;position:relative;z-index:1;width:min(460px,100%);max-height:calc(100dvh - 48px);overflow:auto;padding:30px 34px 28px;border:1px solid #c9a76280;border-radius:26px;text-align:center;background:radial-gradient(ellipse at 50% 0,#715c303a,transparent 62%),linear-gradient(160deg,#192c43,#0d192b 75%);box-shadow:0 24px 85px #0009,inset 0 1px #ffffff14;animation:pool-result-arrive .32s ease-out both}
.pool-result-overlay[data-outcome="loss"] .pool-result-card{--result-accent:#b6cdee;border-color:#7796bf88;background:radial-gradient(ellipse at 50% 0,#536f9840,transparent 65%),linear-gradient(160deg,#192c43,#0d192b 75%)}
.pool-result-overlay[data-outcome="draw"] .pool-result-card{--result-accent:#8cded5;border-color:#6dbbb388}
.pool-result-label{margin:2px 0 5px;color:var(--result-accent);font-size:11px;font-weight:700;letter-spacing:4px}
.pool-result-emblem{position:relative;display:grid;place-items:center;width:114px;height:114px;margin:2px auto 5px;border-radius:50%;background:radial-gradient(circle,#e2bd5440,transparent 69%)}
.pool-result-emblem::before,.pool-result-emblem::after{content:'✦';position:absolute;color:var(--result-accent);font-size:23px;top:18px;left:5px;transform:rotate(-14deg)}
.pool-result-emblem::after{font-size:15px;top:69px;left:auto;right:4px;transform:rotate(12deg)}
.pool-result-emblem canvas{display:block;width:108px;height:108px}
.pool-result-emblem svg{display:block;width:66px;height:66px;color:var(--result-accent);filter:drop-shadow(0 4px 16px #0006)}
.pool-result-card h2{margin:0;color:#fff4d4;font-size:clamp(27px,5vw,36px);font-weight:900;line-height:1.3;letter-spacing:-.5px;overflow-wrap:anywhere}
.pool-result-overlay[data-outcome="loss"] h2,.pool-result-overlay[data-outcome="draw"] h2{color:var(--result-accent)}
.pool-result-description{margin:11px 0 23px;color:#a5bbd2;font-size:13px;line-height:1.65}
.pool-result-players{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:25px}
.pool-result-player{position:relative;min-width:0;display:flex;flex-direction:column;align-items:center;gap:7px;padding:17px 10px;background:#06112266;border:1px solid #6984a433;border-radius:14px}
.pool-result-player strong{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#e3edf8;font-size:14px;font-weight:700}
.pool-result-player>span{color:#91a9c2;font-size:11px}
.pool-result-player.winner{border-color:#d5b5657a;background:#a9822214}
.pool-result-winner{position:absolute;top:-9px;right:10px;padding:2px 7px;border-radius:5px;background:#d8bc73;color:#32260c;font-size:9px;line-height:1.3}
.pool-result-actions{display:flex;flex-direction:column;gap:10px}
.pool-result-card #again{width:100%;min-height:49px;margin:0;padding:12px 18px;border:1px solid #ffdfa0;border-radius:12px;background:linear-gradient(#f6d88a,#d8ac52);box-shadow:0 5px 15px #0003,inset 0 1px #fff5;color:#30240f;font-size:16px;font-weight:800}
.pool-result-card #again:hover:not(:disabled){background:linear-gradient(#ffe6a6,#e5ba65);border-color:#fff0c0;color:#30240f}
.pool-result-nav{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.pool-result-card .pool-result-nav button{width:100%;min-height:38px;padding:8px 10px;border:1px solid #8fa8c438;border-radius:10px;background:#ffffff08;box-shadow:none;color:#cbd8ea;font-size:12px;font-weight:700}
.pool-result-card .pool-result-nav button:hover{background:#aec9ed1c;border-color:#a9bdd366;color:#fff}
.pool-result-card .pool-result-close{position:absolute;top:13px;right:13px;display:grid;place-items:center;width:33px;height:33px;min-height:33px;margin:0;padding:0;border:0;border-radius:50%;background:#93abc40d;box-shadow:none;color:#9cb2ca;font-size:25px;font-weight:400;line-height:1}
.pool-result-card .pool-result-close:hover{background:#abc6e31a;color:#eff6ff}
.pool-result-card button:focus-visible,.pool-result-open:focus-visible{outline:2px solid #fff1bc;outline-offset:3px}
.pool-result-note{margin:15px 0 0;color:#e5d2a0;font-size:12px;line-height:1.65}
/* "View result" is created with the same class list as the "Leave game"
   button (see createResult()), so it inherits the active theme's sidebar
   button skin. Do not add size / colour overrides for .pool-result-open:
   they made the two stacked buttons differ on every non-pool game. */
.pool-result-confetti{position:absolute;inset:0;overflow:hidden;pointer-events:none}
body>.pool-result-confetti{position:fixed;z-index:100}
.pool-result-confetti i{position:absolute;left:var(--x);top:-24px;width:var(--width);height:calc(var(--width)*1.6);border-radius:1px;background:var(--color);opacity:0;animation:pool-confetti-fall var(--duration) var(--delay) linear both}
.pool-result-confetti i:nth-child(3n){border-radius:50%;height:var(--width)}
/* Linear travel keeps an even top-to-bottom density. Fading only in the last
   10% also removes the long invisible tail that used to empty the screen. */
@keyframes pool-confetti-fall{0%{opacity:0;transform:translate3d(0,-4vh,0) rotate(0)}6%{opacity:1}90%{opacity:.95}100%{opacity:0;transform:translate3d(var(--drift),112vh,0) rotate(var(--spin))}}
@keyframes pool-result-arrive{from{opacity:0;transform:translateY(16px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}
@media(max-width:480px){.pool-result-overlay{padding:16px}.pool-result-card{padding:25px 23px 20px;max-height:calc(100dvh - 32px);border-radius:22px}.pool-result-emblem{width:98px;height:98px}.pool-result-emblem canvas{width:94px;height:94px}.pool-result-description{margin-bottom:19px}.pool-result-players{margin-bottom:20px}.pool-result-nav{gap:8px}.pool-result-card .pool-result-nav button{font-size:11px;padding:7px 6px}}
@media(prefers-reduced-motion:reduce){.pool-result-card{animation:none}.pool-result-confetti{display:none}.pool-result-confetti i{animation:none}}

/* Size the controls and table as one group: a height-limited canvas must not leave a gap beside the cue. */
.pool-game[data-screen="play"] .game-panel .board.pool{grid-template-rows:minmax(0,1fr);row-gap:0}
.pool-game[data-screen="play"] .pool-left-controls{grid-row:1}
.pool-game[data-screen="play"] .pool-note{display:none}
@media(min-width:761px){
 .pool-game[data-screen="play"] .game-panel{padding:6px 8px}
 .pool-game[data-screen="play"] .game-panel .board.pool{--pool-table-height:calc(100dvh - 118px);width:min(100%,calc(var(--pool-table-height)*1232/644 + 70px));flex:0 1 auto;margin:auto 0 auto auto;grid-template-columns:64px minmax(0,1fr);column-gap:6px}
 .pool-game.portal-embedded[data-screen="play"] .game-panel .board.pool{--pool-table-height:calc(100dvh - 72px)}
 .pool-game[data-screen="play"] .pool-table-wrap{place-items:center;align-self:center}
 .pool-game[data-screen="play"] .pool canvas.pool-table-canvas,.pool-game.portal-embedded[data-screen="play"] .pool canvas.pool-table-canvas{width:100%;height:auto;max-width:100%;max-height:none;aspect-ratio:1232/644;margin:0}
}

/* Match identities face the clock; target rows stay in seven fixed positions. */
.pool-matchup{container-type:inline-size;width:min(1080px,calc(100% - 90px));height:84px;min-height:84px;margin:0 auto}
.pool-matchup #seats{gap:clamp(48px,8.9cqw,96px)}
.pool-matchup .seat{gap:clamp(4px,1.1cqw,12px);padding:2px 0;transition:opacity .25s,filter .25s}
.pool-matchup .seat:not(.active){opacity:.42;filter:saturate(.7)}
.pool-matchup .seat:first-child{flex-direction:row-reverse;text-align:right}
.pool-matchup .seat:nth-child(2){flex-direction:row;text-align:left}
.pool-matchup .seat-copy{gap:2px}
.pool-matchup .seat:first-child .seat-name{justify-content:flex-end}
.pool-matchup .seat:nth-child(2) .seat-name{justify-content:flex-start}
.pool-matchup .seat-name{flex-wrap:nowrap;min-height:19px}
.pool-matchup .seat-name strong{max-width:260px}
.pool-matchup .avatar-shell{width:clamp(26px,5.55cqw,60px);height:clamp(26px,5.55cqw,60px);flex-basis:clamp(26px,5.55cqw,60px)}
.pool-matchup .avatar-frame{inset:-17%;width:134%;height:134%}
.pool-matchup .pool-pocketed{flex-wrap:nowrap;gap:clamp(0px,.37cqw,4px);min-height:clamp(16px,5cqw,54px)}
.pool-matchup .seat:first-child .pool-pocketed{justify-content:flex-end}
.pool-matchup .seat:nth-child(2) .pool-pocketed{justify-content:flex-start}
.pool-matchup .pool-pocketed canvas.pool-target-ball{width:clamp(16px,5cqw,54px);height:clamp(16px,5cqw,54px);flex:none}
.pool-matchup .pool-pocketed:empty{display:flex}
/* Defensive: an older cached script may still create placeholder recesses. */
.pool-target-empty{display:none!important}
.pool-match-clock{top:50%;transform:translate(-50%,-50%)}
@media(min-width:761px){
 .pool-game[data-screen="play"] .game-panel .board.pool{--pool-table-height:calc(100dvh - 142px);width:min(100%,calc(var(--pool-table-height)*1232/644 + 86px));grid-template-columns:80px minmax(0,1fr)}
 .pool-game.portal-embedded[data-screen="play"] .game-panel .board.pool{--pool-table-height:calc(100dvh - 96px)}
 .pool-game[data-screen="play"] .pool-hit{width:80px}
 .pool-game[data-screen="play"] .pool canvas.pool-spot{width:78px;height:78px;max-width:78px;max-height:78px}
 .pool-game[data-screen="play"] .pool .pool-sound,.pool-game[data-screen="play"] .pool .pool-spot-reset{width:76px;font-size:10px;min-height:25px}
 .pool-game[data-screen="play"] .pool .pool-sound{min-height:29px;font-size:11px}
 .pool-power-meter{width:42px;max-height:600px}
 .power-cue{width:18px;margin-left:-9px}
 .pool-power-value{font-size:12px}
}
/* Move only the table; the chat column keeps its original 285/240px width.
   With a height-limited canvas the spare room goes to the left; with a
   width-limited canvas the table gives up that width on its left edge so the
   right edge still clears the sidebar by a sliver.
   Second step: the canvas paints a black margin of 15.5/1232 of its width to
   the right of the yellow return channel, plus 8px of panel padding. Shift the
   table group by --pool-right-fill (two thirds) of that spare gap so one third
   remains; the percentage in translateX resolves against the group's own
   width, keeping the fraction exact at every viewport. Nothing else moves —
   chat, cue controls, feedback labels and turn toast are outside the group. */
.pool-game[data-screen="play"]{--pool-right-fill:.6667}
@media(min-width:761px){
 .pool-game[data-screen="play"] .game-panel .board.pool{max-width:calc(100% - var(--pool-shift,0px) + 80px * (var(--pool-controls-scale,1) - 1));margin:auto 0 auto auto}
 .pool-game[data-screen="play"] .pool-table-wrap{transform:translateX(calc(8px * var(--pool-right-fill) + 1.2581% * var(--pool-right-fill)))}
}
/* Enlarge the cue-side controls (sound, spin ball, power meter, percentage).
   The grid column and board width grow by the same amount, so the canvas keeps
   its exact size and right-hand position — only the control column extends to
   the left. One --pool-controls-scale drives every dimension. */
@media(min-width:761px){
 .pool-game[data-screen="play"]{--pool-controls-scale:1.12}
 .pool-game[data-screen="play"] .game-panel .board.pool{
   grid-template-columns:calc(80px * var(--pool-controls-scale)) minmax(0,1fr);
   width:min(100%,calc(var(--pool-table-height)*1232/644 + 6px + 80px * var(--pool-controls-scale)))}
 .pool-game[data-screen="play"] .pool-hit{width:calc(80px * var(--pool-controls-scale))}
 .pool-game[data-screen="play"] .pool canvas.pool-spot{width:calc(78px * var(--pool-controls-scale));height:calc(78px * var(--pool-controls-scale));max-width:none;max-height:none}
 .pool-game[data-screen="play"] .pool .pool-sound,.pool-game[data-screen="play"] .pool .pool-spot-reset{width:calc(76px * var(--pool-controls-scale));font-size:calc(10px * var(--pool-controls-scale))}
 .pool-game[data-screen="play"] .pool .pool-sound{min-height:calc(29px * var(--pool-controls-scale));font-size:calc(11px * var(--pool-controls-scale))}
 .pool-game[data-screen="play"] .pool-power-meter{width:calc(42px * var(--pool-controls-scale))}
 .pool-game[data-screen="play"] .power-cue{width:calc(18px * var(--pool-controls-scale));margin-left:calc(-9px * var(--pool-controls-scale))}
 .pool-game[data-screen="play"] .pool-power-value{font-size:calc(12px * var(--pool-controls-scale))}
}
@media(min-width:1001px){
 .pool-game[data-screen="play"]{--pool-controls-scale:1.25}
}
@media(max-width:760px){
 .pool-matchup{width:calc(100% - 40px);height:60px;min-height:60px;margin-left:40px}
 .pool-matchup .seat-name{min-height:14px;gap:3px}
 .pool-matchup .seat-name strong{font-size:10px;max-width:100px}
 .pool-matchup .member-label{display:none}
 .pool-match-clock{width:34px;height:38px}
}

.table-chat-layout#arena{max-width:none;min-height:calc(100dvh - var(--table-header));grid-template-columns:minmax(0,1fr) minmax(220px,290px) minmax(220px,280px);gap:12px;padding:8px}
.table-chat-layout .game-panel{min-height:0;padding:0;position:relative}
.table-chat-layout .game-panel h1,.table-chat-layout .board-top #mode{display:none}
.table-chat-layout .board-top{position:absolute;inset:5px auto auto 5px;z-index:3}
.table-chat-layout .board-top button{font-size:0;width:30px;padding:0}
.table-chat-layout .board-top button::before{content:'←';font-size:21px}
.table-chat-layout .game-panel>.board:not(.cards):not(.sketch){width:min(100%,calc(100dvh - var(--table-header) - 18px));max-width:none;margin:auto}
.table-chat-layout>.pool-chat-panel{display:flex;flex-direction:column;min-height:0;height:calc(100dvh - var(--table-header) - 16px);padding:16px 12px;background:linear-gradient(#203657,#172844);color:#e7f1fb;position:sticky;top:0;overflow:hidden}
.table-chat-layout>.pool-chat-panel .pool-chat-log{min-height:0}
@media(max-width:920px){.table-chat-layout#arena{grid-template-columns:minmax(0,1fr) minmax(200px,265px)}.table-chat-layout>.pool-chat-panel{grid-column:2;grid-row:1;height:min(70dvh,600px)}.table-chat-layout>.play-sidebar{grid-column:1/-1}}
@media(max-width:620px){.table-chat-layout#arena{grid-template-columns:minmax(0,1fr)}.table-chat-layout>.pool-chat-panel{grid-column:1;grid-row:auto;position:static;height:340px}.table-chat-layout>.play-sidebar{grid-column:1}.table-chat-layout .game-panel>.board:not(.cards):not(.sketch){width:100%}}
.portal-embedded[data-screen="play"]{--table-header:0px}
.portal-embedded[data-screen="play"]>header{display:none}

.pool-chat-system .pool-chat-line,.pool-chat-system .pool-chat-line strong{color:var(--system-color,#f3f6ff)}

.pool-chat-system[data-kind="foul"]{--system-color:#ff929d}
.pool-chat-system[data-kind="reward"]{--system-color:#86e9ab}
/* One caption frame for both the shot feedback and the turn announcement.
   Feedback always shows first and the turn caption follows after it fades,
   so both can share the same square shape, type, shadow and place on the cloth. */
.pool-feedback,.pool-turn-toast{position:absolute;top:22%;left:50%;transform:translateX(-50%);pointer-events:none}
.pool-feedback{z-index:5;display:grid;justify-items:center;gap:8px}
.pool-feedback span,.pool-turn-toast{
  display:block;padding:.36em .95em;border-radius:6px;white-space:nowrap;
  border:1px solid #ff929d88;background:#402330;color:#fff2f5;
  font-size:clamp(19px,2.4vw,36px);font-weight:800;
  box-shadow:0 8px 25px #0005}
/* Every caption over the cloth now shares one height: the turn toast uses the
   same font-size and em-based padding as the feedback labels, so "该你击球"
   is exactly as tall as "你打全色球 / 犯规 / 奖励一杆" at every viewport. */
.pool-feedback [data-kind="reward"]{background:#173b31;color:#b7ffd3;border-color:#86e9ab88}
.pool-feedback [data-kind="groups"]{background:#172b49;color:#eef5ff;border-color:#8eb5ed99}
/* Brief turn caption over the table: gold for the local player, cool blue for
   the opponent. Purely decorative (pointer-events:none, aria-hidden) so it can
   never block aiming, dragging or a click on the cue ball. No leading dot. */
/* Sits inside the blue cloth, clear of the top rail and centre pocket: 15%
   used to pin the caption right on the black cushion, which looked cramped. */
.pool-turn-toast{z-index:6;
  border-color:#f4d78c8a;background:#332914;color:#ffe6ad;
  animation:pool-turn-pop 2s cubic-bezier(.22,.7,.25,1) both}
.pool-turn-toast[hidden]{display:none!important}
.pool-turn-toast[data-kind="opponent"]{border-color:#8fb6e47a;color:#d8e8ff;background:#172b49}
@keyframes pool-turn-pop{
  0%{opacity:0;transform:translate(-50%,14px) scale(.86)}
  13%{opacity:1;transform:translate(-50%,0) scale(1)}
  74%{opacity:1;transform:translate(-50%,0) scale(1)}
  100%{opacity:0;transform:translate(-50%,-10px) scale(.98)}
}
@media(prefers-reduced-motion:reduce){.pool-turn-toast{animation:none;transform:translate(-50%,0)}}
@media(max-width:760px){.pool-feedback,.pool-turn-toast{top:19%}}
.table-home-theme[data-screen="play"]{background:#0b1120;color:#e6edf8}
.table-home-theme[data-screen="play"]:not(.pool-game) .game-panel{background:#111a30;border-color:#263654}
.table-home-theme[data-screen="play"]:not(.pool-game) .play-sidebar>section{background:#151f37;color:#e6edf8;border-color:#303e60}
.table-home-theme[data-screen="play"]:not(.pool-game) .play-sidebar h2{color:#e6edf8}
.table-chat-layout#arena{align-items:stretch}
.table-chat-layout .game-panel>.board.puzzle{width:min(100%,calc((100dvh - var(--table-header) - 20px) * 1.778))}
@media(min-width:921px){.table-chat-layout#arena>.pool-chat-panel{grid-column:3;grid-row:1}}
@media(min-width:621px) and (max-width:920px){
 .table-chat-layout#arena>.pool-chat-panel{grid-column:2;grid-row:1/3}
 .table-chat-layout#arena>.play-sidebar{grid-column:1}
}

.pool-result-confetti:is([data-outcome="win"],[data-outcome="loss"]) i{animation-iteration-count:infinite}
.pool-countdown b{font-size:clamp(76px,16vmin,220px)}
.pool-countdown span{font-size:clamp(20px,3.4vmin,38px)}

.board-countdown .game-panel>.pool-countdown{z-index:4}

.board-countdown .table-chat-layout .board-top{z-index:6}
/* The READY / 3-2-1 overlay blocks the board, but "back to game home" must be
   clickable from the very first frame of a match, not only after GO clears it.
   Works for every countdown game (pool, snooker, bubbles, chess, four), not
   just the ones that use the table-chat layout. Snooker raises its own overlay
   to z-index 9 (above the shot card), so the arrow has to clear that too. */
body.board-countdown[data-screen="play"] .game-panel>.board-top{z-index:10}
body.board-countdown[data-screen="play"] .game-panel>.board-top button{pointer-events:auto}
.table-chat-layout .play-sidebar .seat{background:#1c2945;color:#e6edf8;border-color:#354968}
.table-chat-layout .play-sidebar .seat.active{background:#253757;border-color:#819ee3}
.table-chat-layout .play-sidebar .seat-status,.table-chat-layout .play-sidebar p{color:#a9badd}
.table-chat-layout .play-sidebar .turn-panel{background:#151f37}
.table-chat-layout .play-sidebar button,.table-chat-layout .board-top button{background:#192846;color:#e6edf8;border-color:#3a5076;box-shadow:none}
.table-chat-layout .game-panel>.board.cards{width:min(96%,1350px);max-width:none;margin:auto;container-type:inline-size}
.table-chat-layout .cards .card-table{padding:clamp(16px,5cqw,62px) 12px;font-size:clamp(12px,2cqw,22px)}
.table-chat-layout .cards .playing-card{width:clamp(42px,9cqw,112px);height:auto;aspect-ratio:65/95;font-size:clamp(24px,5cqw,56px)}
.table-chat-layout .cards .card-hand{padding:clamp(10px,4cqw,45px) 0}

.pool-chat-log{display:flex;flex-direction:column}
.pool-chat-log::before{content:'';flex:1 0 0}
.pool-chat-log>*{flex-shrink:0}
.pool-chat-log .pool-chat-message{margin-bottom:4px;line-height:1.4}
/* The seat names and the chat log used to share one size variable, which
   made the room chat noticeably larger than the rest of the sidebar. Keep
   the seat names where they were and give the log its own, smaller scale;
   the inline ball icons follow so a line of text stays balanced. */
.pool-game{--pool-player-text-size:15px;--pool-chat-text-size:12px}
.pool-game .pool-matchup .seat-name strong{font-size:var(--pool-player-text-size)}
.pool-game .pool-chat-log .pool-chat-message{font-size:var(--pool-chat-text-size)}
@media(max-width:1000px){.pool-game{--pool-player-text-size:13px;--pool-chat-text-size:11px}}
@media(max-width:760px){.pool-game{--pool-player-text-size:12px;--pool-chat-text-size:11px}}
.pool-chat-log .pool-chat-message time{padding-top:1px}
.connect-four-game .table-chat-layout .game-panel{
  container-type:inline-size;
  padding-top:var(--four-launch-height,12dvh);
}
.connect-four-game .table-chat-layout .game-panel>.board{
  --four-width:min(96cqw,calc(100dvh - var(--table-header) - 36px));
  width:var(--four-width);
  margin:0 auto auto;
}
/* Connect Four: recessed slots, glossy counters, opaque held coin and a 50%-opacity landing hint. */
.connect-four-game{
  --four-one:radial-gradient(circle at 32% 24%,#fff8d6 0%,#ffd878 24%,#f2b33c 58%,#c47d1c 88%,#8a4f10 100%);
  --four-two:radial-gradient(circle at 32% 24%,#ffe0e8 0%,#ffa7b8 24%,#e85b79 58%,#a62d54 88%,#6e1837 100%);
  --four-hole:radial-gradient(circle at 50% 34%,#0a1330 0%,#111e42 62%,#1c2d5b 100%);
  --four-coin-shadow:inset 0 2px 3px #fff9,inset 0 -6px 9px #0004,0 3px 7px #0007;
}
.connect-four-game.table-home-theme[data-screen="play"] .game-panel{
  background:radial-gradient(ellipse 70% 55% at 50% 0%,#3b56a055,transparent 70%),radial-gradient(ellipse 65% 45% at 50% 100%,#1d356a4d,transparent 75%),linear-gradient(165deg,#101b33,#0a1122 72%);
  border-color:#2a3a60;
  box-shadow:inset 0 1px 0 #ffffff12,inset 0 -30px 60px #050a18a8;
}
.connect-four-game .table-chat-layout .game-panel>.board:not(.cards):not(.sketch){
  width:min(96cqw,calc(100dvh - var(--table-header) - 52px));
  max-width:none;
  margin:0 auto auto;
}
.connect-four-game .board{
  background:linear-gradient(155deg,#4b6ad0 0%,#3149a6 42%,#1d2d78 100%);
  border:1px solid #8ea9ff80;
  border-bottom:9px solid #14215e;
  border-radius:22px;
  box-shadow:0 26px 55px #0009,inset 0 2px 0 #ffffff55,inset 0 -20px 36px #0a133a80;
}
.connect-four-game .board .cell[data-value="0"]{
  background:var(--four-hole);
  box-shadow:inset 0 6px 11px #000a,inset 0 -2px 1px #6f8dff33,0 1px 0 #b9ccff24;
}
.connect-four-game .board .cell[data-value="0"]:hover:not(:disabled){background:var(--four-hole)}
.connect-four-game .board .cell.four-col-hover[data-value="0"]:not(:disabled){
  background:radial-gradient(circle at 50% 34%,#1b3160,#0e1b3d 68%,#2a4486);
  box-shadow:inset 0 6px 11px #000a,inset 0 0 0 2px #8fb0ff55,0 0 18px #4774ff66;
}
.connect-four-game .board .cell.four-landing[data-value="0"]:not(:disabled){
  background:radial-gradient(circle at 50% 36%,#242b4c,#101830 70%);
  box-shadow:inset 0 6px 11px #0008,inset 0 0 0 2px #ffd87877,0 0 22px #ffd87844;
}
.connect-four-game .board .cell[data-value="1"]{background:var(--four-one);box-shadow:var(--four-coin-shadow)}
.connect-four-game .board .cell[data-value="2"]{background:var(--four-two);box-shadow:var(--four-coin-shadow)}
/* Classic theme: no content:'' is generated for .cell::before (table.css only
   generates it for .gomoku), so the ring below is inert and settled counters
   are plain. The launch coin must match, see the scoped rule at the marker.
   Reverse switch: add content:'';position:absolute here, then delete the two
   classic-only marker rules below to ring every counter instead. */
.connect-four-game .board .cell[data-value="1"]::before,
.connect-four-game .board .cell[data-value="2"]::before{
  display:block;inset:13%;width:auto;height:auto;background:none;filter:none;
  border:1px solid #ffffff4d;border-radius:50%;
  box-shadow:inset 0 1px 2px #0003,0 1px 0 #ffffff2e;
}
.connect-four-game .board .cell.last::after{inset:40%;border:2px solid #fff;box-shadow:0 0 10px #ffffffcc,inset 0 0 6px #ffffffaa}
.connect-four-game .board .cell[data-value="1"]:hover:not(:disabled){background:var(--four-one)}
.connect-four-game .board .cell[data-value="2"]:hover:not(:disabled){background:var(--four-two)}
.connect-four-game .board .cell.four-drop-hidden[data-value]{
  background:var(--four-hole);
  box-shadow:inset 0 6px 11px #000a,inset 0 -2px 1px #6f8dff33,0 1px 0 #b9ccff24;
}
.connect-four-game .table-chat-layout .board-top button{
  width:34px;height:34px;border-radius:10px;
  border-color:#3d4f78;background:#182744e0;color:#c9d8f5;box-shadow:0 3px 10px #0006;
}
.connect-four-game .table-chat-layout .play-sidebar>section{
  background:linear-gradient(160deg,#182642,#111b31);border-color:#2f4067;
  box-shadow:0 10px 26px #0004,inset 0 1px 0 #ffffff0d;
}
/* The shared turn card is forced light by table.css; keep it on-theme here. */
.connect-four-game .table-chat-layout .play-sidebar .turn-panel{
  background:linear-gradient(160deg,#203455,#15223b)!important;
  border-color:#3a4c73;color:#e6edf8;
}
.connect-four-game .table-chat-layout .play-sidebar .turn-panel h2,
.connect-four-game .table-chat-layout .play-sidebar #status{color:#f2f6ff}
.connect-four-game .table-chat-layout .play-sidebar .turn-panel .eyebrow{color:#93a9d8}
.connect-four-game .table-chat-layout .play-sidebar .turn-panel #turn-instruction,
.connect-four-game .table-chat-layout .play-sidebar .turn-panel p{color:#a9badd}
.connect-four-game #message{background:#1d2b47;border-color:#3c5076;color:#d6e3f8;box-shadow:0 8px 24px #0006}
.connect-four-game .table-chat-layout>.pool-chat-panel{
  background:linear-gradient(160deg,#1a2c4c,#111c33);
  border:1px solid #2f4067;border-radius:18px;
}
.four-drop-marker{position:absolute;z-index:3;pointer-events:none;width:var(--coin-size);height:var(--coin-size);translate:-50% -50%;opacity:1}
.four-drop-marker i{
  position:absolute;inset:0;border-radius:50%;background:var(--four-one);
  box-shadow:0 0 0 3px #ffffff1a,0 10px 22px #0009,inset 0 2px 3px #fff9,inset 0 -6px 9px #0004;
}
.four-drop-marker i::after{
  content:'';position:absolute;inset:13%;border-radius:50%;
  border:1px solid #ffffff4d;box-shadow:inset 0 1px 2px #0003,0 1px 0 #ffffff2e;
}
.four-drop-marker[data-player="2"] i{background:var(--four-two)}
/* Classic theme: the held/dropping coin is the same object as a settled
   counter, so it must not gain an inner ring or a larger floating halo.
   Themed skins keep the face artwork drawn by four-theme.css on ::after. */
body.connect-four-game:not(.four-themed) .four-drop-marker i{box-shadow:var(--four-coin-shadow)}
body.connect-four-game:not(.four-themed) .four-drop-marker i::after{content:none}
.four-drop-marker span{position:absolute;left:23%;top:-27%;width:90%;height:auto}
.four-drop-marker[data-mode="preview"] span{display:none}
.four-drop-ghost{
  position:absolute;z-index:2;pointer-events:none;width:var(--coin-size);height:var(--coin-size);
  border-radius:50%;translate:-50% -50%;background:var(--four-one);opacity:.5;
  box-shadow:0 0 0 2px #ffe6a680,0 0 22px #ffd87855,inset 0 2px 3px #fff9,inset 0 -6px 9px #0004;
  transition:left .1s ease,top .1s ease;
}
.four-drop-ghost::after{content:'';position:absolute;inset:9%;border:2px dashed #fff6d9;border-radius:50%}
.four-drop-ghost[data-player="2"]{background:var(--four-two)}
.four-drop-beam{
  position:absolute;z-index:1;pointer-events:none;width:calc(var(--coin-size) * .3);
  translate:-50% 0;border-radius:999px;opacity:.32;
  background:linear-gradient(180deg,#ffd87800,#ffd87855 22%,#ffd87822 78%,#ffd87800);
}
.four-drop-beam[data-player="2"]{background:linear-gradient(180deg,#e85b7900,#e85b7955 22%,#e85b7922 78%,#e85b7900)}
.four-drop-marker[hidden],.four-drop-ghost[hidden],.four-drop-beam[hidden]{display:none!important}

.table-chat-layout .game-panel > .board.arcade-board:not(.cards):not(.sketch) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: center;
  background: none;
  box-shadow: none;
  padding: 8px;
  width: 100%;
  min-height: 0;
  height: 100%;
  gap: 8px;
  border: 0;
}
.arcade-board canvas {
  display: block;
  width: min(100%, calc((100dvh - 120px) * 1.96));
  height: auto;
  touch-action: none;
}
.arcade-board.bubbles canvas {
  width: min(100%, calc((100dvh - 120px) * .47));
  border: 1px solid rgba(196,132,255,.45);
  border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(112,52,196,.22), 0 20px 60px rgba(78,24,156,.45);
}
.arcade-board.bubbles .arcade-controls button {
  background: linear-gradient(135deg,#a45cff,#ff56ac);
  border: 1px solid #dcb2ff;
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
  box-shadow: 0 6px 22px rgba(164,92,255,.4);
}
.arcade-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
}
.arcade-controls label[hidden] { display: none; }
.arcade-controls input { width: min(25vw, 180px); margin: 0; padding: 0; vertical-align: middle; }

/* Grow the table left/up into the clear space on those two edges only. The
   canvas keeps its right/bottom anchor, so the chat column, cue controls,
   match header and the yellow return channel stay exactly where they were.
   The translate() cancels the centred grid's half of the inset, so the whole
   delta lands on the left/top edge (16px -> 8.4px vertically at 1232/644).
   --pool-edge-inset < 0 = grow the table into the gap; 0 = old geometry;
   > 0 = add breathing room instead (table shrinks slightly). Negative values
   are capped by the fixed cue-control column: ~42px of clear space at 1920px,
   ~38px at 1440px, ~28px at 900px, so a few px of gap is always preserved. */
.pool-game[data-screen="play"]{--pool-edge-inset:-16px}
@media(max-width:1600px) and (min-width:1001px){
 .pool-game[data-screen="play"]{--pool-edge-inset:-12px}
}
@media(max-width:1000px) and (min-width:761px){
 .pool-game[data-screen="play"]{--pool-edge-inset:-8px}
}
@media(max-width:760px){
 .pool-game[data-screen="play"]{--pool-edge-inset:0px}
}
@media(min-width:761px){
 .pool-game[data-screen="play"] .pool canvas.pool-table-canvas,
 .pool-game.portal-embedded[data-screen="play"] .pool canvas.pool-table-canvas{
   width:calc(100% - var(--pool-edge-inset,0px));
   max-width:none;
   transform:translate(calc(var(--pool-edge-inset,0px)/2),calc(var(--pool-edge-inset,0px)/3.826));
 }
}

/* Portal fullscreen on desktop only: enlarge the two avatar pictures and
   the centred "Turn" badge by 50%. The pocketed-ball icons
   (canvas.pool-target-ball) and every ball painted on the table canvas keep
   their exact size; only the picture holders grow. The body flag is set by
   portal-controls.js from the portal's joyflock:game-fullscreen message,
   so the embedded (non-fullscreen) layout is untouched. */
@media(min-width:1001px){
body.pool-game[data-screen="play"][data-game-fullscreen="1"] .pool-matchup .avatar-shell{
  width:calc(clamp(26px,5.55cqw,60px)*1.5);
  height:calc(clamp(26px,5.55cqw,60px)*1.5);
  flex-basis:calc(clamp(26px,5.55cqw,60px)*1.5);
}
body.pool-game[data-screen="play"][data-game-fullscreen="1"] .pool-match-clock{
  width:99px;height:79.5px;
}
body.pool-game[data-screen="play"][data-game-fullscreen="1"] .pool-clock-label{font-size:12px}
body.pool-game[data-screen="play"][data-game-fullscreen="1"] .pool-match-clock #turn-clock{font-size:28.5px}
/* The badge is absolutely centred, so the two seats need a gap wider than
   the badge itself: 99px + ~20px on each side. Leave the matchup width alone
   (all cqw-based sizes, especially the ball icons, stay pixel-identical) and
   just narrow the seats; the ball rows merely shift a few px outwards. On
   narrow screens the zoom is disabled entirely, because a 99px badge cannot
   fit between the seats there without overlapping the avatars. */
body.pool-game[data-screen="play"][data-game-fullscreen="1"] .pool-matchup #seats{
  gap:140px;
}
}

/* Countdown scrim must cover the LEFT RAIL too.
   The 3 · 2 · 1 card is an absolutely positioned child of .pool-table-wrap,
   so its #020a17b8 scrim only dims the table canvas: the sound button, spin
   ball, power meter and 0% readout next to it stayed bright and clickable
   during the whole countdown. Mirror the exact same scrim over the rail while
   any countdown phase is on screen. :has() watches the [hidden] attribute
   that pool-countdown.js toggles, so no JS state and no second scrim on the
   table (which would double-dim it). The GO phase uses the lighter scrim and
   lets clicks through, exactly like the card itself. */
.pool-game[data-screen="play"] .pool-left-controls{position:relative}
.pool-game[data-screen="play"] .board.pool:has(.pool-countdown:not([hidden])) .pool-left-controls::after{
  content:'';position:absolute;inset:0;z-index:6;background:#020a17b8;
  border-radius:12px;pointer-events:auto;
}
.pool-game[data-screen="play"] .board.pool:has(.pool-countdown[data-phase="GO"]:not([hidden])) .pool-left-controls::after{
  background:#020a1750;pointer-events:none;
}
