/* The Clubhouse mini games (js/screens/clubgames.js). The sheets use the app's own classes (hero, opt, chips, seg, bar,
   card rank, btn, album stickers); this file only holds the boards, the pond, the table and the dartboard. */

/* ---------- who is playing: two pills and whose turn it is ---------- */
.cg-vs{display:grid;grid-template-columns:minmax(0,1fr) minmax(4.4rem,5.4rem) minmax(0,1fr);align-items:center;gap:.4rem;margin:0 0 .6rem}
.cg-vs.solo{grid-template-columns:minmax(0,1fr) auto}
@media (max-width:430px){.cg-vs{grid-template-columns:minmax(0,1fr) minmax(3.6rem,4.6rem) minmax(0,1fr);gap:.3rem}.cg-vs .cg-p{gap:.3rem;padding:.3rem .35rem}.cg-vs .cg-av{width:1.9rem;height:1.9rem}}
.cg-p{display:flex;align-items:center;gap:.45rem;min-width:0;padding:.32rem .45rem;border-radius:.9rem;background:#f7ead6;border:.13rem solid transparent;transition:background .3s,border-color .3s}
.cg-p.r{flex-direction:row-reverse;text-align:right}
.cg-p.on{background:#fdebc3;border-color:var(--ink)}
.cg-av{width:2.15rem;height:2.15rem;border-radius:.6rem;border:.13rem solid var(--ink);overflow:hidden;flex:none;display:grid;place-items:center}
.cg-pn{min-width:0;line-height:1.1}
.cg-pn b{display:block;font-weight:400;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cg-pn small{display:flex;align-items:center;gap:.22rem;font-size:.76rem;color:#8a5d55;white-space:nowrap}
.cg-p.r .cg-pn small{justify-content:flex-end}
.cg-tok{display:inline-block;width:.72rem;height:.72rem;border-radius:50%;border:.1rem solid var(--ink);flex:none}
.cg-tok.d{background:#6e4d47}.cg-tok.l{background:#fffaf3}
.cg-turn{font-size:.92rem;line-height:1.15;text-align:center;color:var(--ink)}
.cg-check{display:inline-block;margin-top:.15rem;padding:0 .4rem;border-radius:.6rem;background:#fbe0da;border:.1rem solid rgba(138,93,85,.4);font-size:.78rem}
.cg-note{min-height:1.3em;margin-top:.5rem}

/* ---------- the lobby ---------- */
.opt.cg-who{display:flex;align-items:center;gap:.65rem;padding:.5rem .7rem}
.cg-who .grow{flex:1;min-width:0}
.cg-who b{display:block;font-weight:400}
.cg-who small{display:block;font-size:.82rem;color:#8a5d55;line-height:1.25}
.cg-who .cg-av{width:2.6rem;height:2.6rem}
.opt.cg-who[disabled]{opacity:.55;box-shadow:none;cursor:default}
/* games with a friend (js/friend-games.js): the picker shows each game's own icon in the avatar box; a live game they cannot
   join yet is shown soft but still answers a tap (it says why) */
.fg-pick .fg-ic{background:#fff8ea;padding:.2rem}.fg-pick .fg-ic>svg{width:100%;height:100%}
.opt.fg-pick[aria-disabled=true]{opacity:.55;box-shadow:none}
.card.cg-watch{gap:.4rem;margin-bottom:.2rem}
.cg-watch .cg-av{width:2rem;height:2rem}
.cg-watch .cg-av+.cg-av{margin-left:-.9rem}
.cg-watch .grow{font-size:.92rem;line-height:1.2}
.cg-people .chip{padding:.22rem .65rem .22rem .25rem}
.cg-people .cg-av{width:1.7rem;height:1.7rem;border-radius:.5rem;border-width:.1rem}
.cg-mechip{cursor:default}

/* ---------- boards ---------- */
.cg-board{position:relative}
.cg-svg{display:block;width:100%;height:auto;margin:0 auto;touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}
.cg-svg text{font-family:inherit}
.cg-svg[data-can="1"]{cursor:pointer}
.cg-drop{animation:cgDrop .34s var(--pop)}
@keyframes cgDrop{from{transform:scale(1.4);opacity:0}to{transform:none;opacity:1}}
.cg-ghost{animation:cgGhost 1.6s ease-in-out infinite}
@keyframes cgGhost{50%{opacity:.55}}
/* an Othello disc turning over: the old face narrows away, then the new one opens out */
.cg-flip circle{transform-origin:inherit}
.cg-flip .o{animation:cgFlipO .18s ease-in var(--d,0ms) forwards}
.cg-flip .n{transform:scaleX(0);animation:cgFlipN .2s ease-out calc(var(--d,0ms) + .18s) forwards}
@keyframes cgFlipO{to{transform:scaleX(0)}}
@keyframes cgFlipN{to{transform:scaleX(1)}}
.cg-pc{transition:transform .36s cubic-bezier(.3,.9,.4,1)}
/* cards over a board keep the app's wobbly ink outline (app.css draws it from --bc) */
.card.cg-promo{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:15.5rem;text-align:center;--bc:var(--ink);background:var(--paper);box-shadow:var(--shadow);animation:cgPop .3s var(--pop)}
.cg-promos{display:flex;gap:.4rem;justify-content:center;margin-top:.45rem}
.cg-promos .opt{width:3.2rem;height:3.2rem;padding:.2rem;display:grid;place-items:center}
.cg-promos .opt svg{width:2.5rem;height:2.5rem}
.cg-promos .opt.on{background:var(--butter)}
@keyframes cgPop{from{opacity:0;scale:.85}to{opacity:1;scale:1}}

/* ---------- jigsaw ---------- */
.cg-pics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.45rem}
.cg-pic{appearance:none;padding:0;border:.13rem solid var(--ink);border-radius:.75rem;overflow:hidden;aspect-ratio:480/389;background:#f7ead6;cursor:pointer;transition:transform .12s var(--pop),box-shadow .2s}
.cg-pic img{display:block;width:100%;height:100%;object-fit:cover}
.cg-pic:active{transform:scale(.95)}
.cg-pic[aria-pressed=true]{box-shadow:0 0 0 .22rem var(--butter),0 0 0 .35rem var(--ink)}
.cg-jhead{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem;margin:0 .1rem .3rem}
.cg-jhead b{font-weight:400;color:var(--ink)}
.cg-jbar{margin-bottom:.55rem}
.cg-jig{border-radius:.55rem;border:.13rem solid var(--ink);overflow:hidden;background:#efe0c9;line-height:0}
.cg-jig canvas{display:block;width:100%;touch-action:manipulation}
.cg-tray{display:grid;grid-auto-flow:column;grid-template-rows:auto;gap:.05rem;align-items:center;overflow-x:auto;overflow-y:hidden;touch-action:pan-x;padding:.3rem .4rem;margin-top:.55rem;border-radius:.9rem;background:#f7ead6;scrollbar-width:none;overscroll-behavior:contain}
.cg-tray::-webkit-scrollbar{display:none}
.cg-tp{display:grid;place-items:center;cursor:grab;transition:opacity .2s}
.cg-tp canvas{display:block}
.cg-tp.on canvas{filter:drop-shadow(0 0 .12rem #eebc55) drop-shadow(0 0 .3rem #f9cf73)}
.cg-tp.lift{opacity:.25}
.cg-float{position:fixed;left:0;top:0;z-index:90;pointer-events:none;filter:drop-shadow(0 .35rem .35rem rgba(90,60,40,.3))}
.cg-float.back{opacity:0;transition:opacity .25s}
.cg-frame{position:relative;margin:.5rem .35rem .2rem;border:.55rem solid #e8b98a;border-radius:.7rem;box-shadow:0 0 0 var(--lw) var(--ink),inset 0 0 0 .13rem var(--ink);animation:cgGlow 3.4s ease-in-out infinite}
.cg-frame img{display:block;width:100%;border-radius:.15rem}
@keyframes cgGlow{0%,100%{box-shadow:0 0 0 var(--lw) var(--ink),inset 0 0 0 .13rem var(--ink),0 0 .8rem .1rem rgba(249,207,115,.45)}50%{box-shadow:0 0 0 var(--lw) var(--ink),inset 0 0 0 .13rem var(--ink),0 0 1.6rem .4rem rgba(249,207,115,.8)}}
.cg-framed{text-align:center;font-size:1.3rem;margin:.9rem 0 .5rem}
.cg-helpers{display:flex;flex-wrap:wrap;gap:.3rem;justify-content:center}
.cg-helpers .tchip{gap:.3rem;padding:.12rem .5rem .12rem .15rem}
.cg-helpers .cg-av{width:1.3rem;height:1.3rem;border-radius:.4rem;border-width:.08rem}

/* ---------- fishing ---------- */
.cg-pond{position:relative;margin-top:.1rem;-webkit-tap-highlight-color:transparent}
.cg-pondsvg{display:block;width:100%;height:auto}
.cg-waves{animation:cgWaves 6s ease-in-out infinite alternate}
@keyframes cgWaves{to{transform:translateX(7px)}}
.cg-pond .cg-float,.cg-pond .cg-line{transition:opacity .3s}
.cg-pond[data-s=idle] .cg-float,.cg-pond[data-s=idle] .cg-line,.cg-pond[data-s=cast] .cg-line{opacity:0}
.cg-pond[data-s=cast] .cg-float{animation:cgCast .85s cubic-bezier(.25,.7,.45,1) both}
@keyframes cgCast{0%{transform:translate(-110px,-124px);opacity:0}10%{opacity:1}55%{transform:translate(-40px,-120px)}100%{transform:none}}
.cg-pond[data-s=wait] .cg-bob,.cg-pond[data-s=gone] .cg-bob{animation:cgBob 2.8s ease-in-out infinite}
@keyframes cgBob{50%{transform:translateY(2.4px)}}
.cg-pond.nib .cg-bob{animation:cgNib .7s ease-in-out}
@keyframes cgNib{25%{transform:translateY(2px) rotate(-6deg)}60%{transform:translateY(1px) rotate(5deg)}}
.cg-pond[data-s=bite] .cg-bob{animation:cgDip 1.2s ease-in-out infinite}
@keyframes cgDip{0%,100%{transform:translateY(3px)}40%{transform:translateY(9px)}}
.cg-ring ellipse{opacity:0;transform-origin:196px 186px}
.cg-pond[data-s=bite] .cg-ring ellipse{animation:cgRing 1.6s ease-out infinite}
.cg-pond[data-s=bite] .cg-ring ellipse+ellipse{animation-delay:.8s}
.cg-pond[data-s=cast] .cg-ring ellipse:first-child{animation:cgRing 1.2s ease-out .8s}
@keyframes cgRing{0%{opacity:.9;transform:scale(.6)}100%{opacity:0;transform:scale(2.6)}}
.cg-pond[data-s=caught] .cg-float{animation:cgLift .6s ease-in forwards}
@keyframes cgLift{to{transform:translate(-60px,-80px);opacity:0}}
.cg-pond[data-s=caught] .cg-line{opacity:0}
.card.cg-catch{position:absolute;left:50%;top:52%;transform:translate(-50%,-50%);width:74%;text-align:center;--bc:var(--ink);background:var(--paper);box-shadow:var(--shadow);animation:cgPop .45s var(--pop)}
.cg-catchfish svg{display:block;width:8.4rem;height:5.6rem;margin:0 auto;animation:cgSwim 3s ease-in-out infinite}
@keyframes cgSwim{50%{transform:translateY(-3px) rotate(-2deg)}}
.cg-catch b{display:block;font-weight:400;font-size:1.2rem;margin:.15rem 0 .4rem}
.cg-catch .tchips{justify-content:center}
.cg-fishbar{justify-content:center;margin-top:.55rem}
.cg-fishbar .btn svg{width:1.5rem;height:1.5rem}
.fishbook .album{grid-template-columns:repeat(4,minmax(0,1fr))}
.fishbook .stk b{white-space:normal;text-align:center;line-height:1.12;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;min-height:2.25em;font-size:.74rem}
.fishbook .stk.off{cursor:pointer}
.fishbook .stk.off .av{opacity:.8;padding:.15rem}
.cg-fav{background:#dcf0f8}.cg-fav.t3{background:#ece3f7}.cg-fav.t4{background:#fdebc3}
.stk .av .cg-fish{width:92%;height:92%}

/* ---------- pool ---------- */
.cg-ptab{display:flex;justify-content:center}
.cg-ptab canvas{display:block;touch-action:none;-webkit-user-select:none;user-select:none}
.cgsheet .foot{position:relative}
.cgsheet .foot .cg-powrow{position:absolute;inset:0 1.1rem;display:flex;align-items:center;gap:.6rem;opacity:0;pointer-events:none;transition:opacity .15s}
.cgsheet .foot.cg-aiming .cg-powrow{opacity:1}
.cgsheet .foot.cg-aiming .btn{opacity:0;pointer-events:none}
.cg-pow{flex:1}
.cg-pow i{transition:none}

/* ---------- darts ---------- */
.cg-dhead{display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin:0 .1rem .45rem}
.cg-dhead .cg-turn{font-weight:400;max-width:none;text-align:left;font-size:1.05rem}
.cg-slots{display:flex;gap:.25rem;flex:none}
.cg-slot{min-width:2.45rem;height:1.75rem;padding:0 .3rem;border-radius:.6rem;border:.12rem dashed rgba(138,93,85,.35);display:grid;place-items:center;font-size:.85rem}
.cg-slot.on{border:.12rem solid var(--ink);background:var(--paper)}
.cg-thunk{animation:cgThunk .3s var(--pop)}
@keyframes cgThunk{from{transform:scale(1.8);opacity:0}to{transform:none;opacity:1}}
.cg-drows{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.4rem;margin-top:.45rem}
.cg-drows.solo{grid-template-columns:1fr}
.cg-drows .card.rank{margin:0;padding:.35rem .5rem;gap:.4rem}
.cg-drows .card.rank .av{width:2rem;height:2rem}
.cg-drows .grow b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cg-drow .cg-fl{width:.4rem;height:1.6rem;border-radius:.3rem;border:.1rem solid var(--ink);flex:none}
.cg-drow .cg-sc{font-size:1.2rem;flex:none}
@media (max-width:430px){.cg-drows .card.rank{padding:.3rem .35rem;gap:.28rem}.cg-drows .card.rank .av{width:1.8rem;height:1.8rem}.cg-drow .cg-fl{width:.32rem}.cg-drow .cg-sc{font-size:1.05rem}}

/* ---------- the play layout (js/screens/clubgames.js gameSheet fit): the stage (board, table, pond, dartboard) and the side
   (players, whose turn, the hint, the buttons). A phone stacks them; a wide window puts the side in a column on the stage's
   right, and the stage is as tall as the window allows. While a game is on, the floating title gives its room to the board */
.layer.framed:has(.sheet.cg-playing){padding-top:calc(.6rem + var(--sat))}
.layer.framed:has(.sheet.cg-playing) .fhead{display:none}
.cg-play{display:flex;flex-direction:column;gap:.6rem}
.cg-side{display:contents}
.cg-play .cg-vs{order:1;margin:0}
.cg-play .cg-info{order:0}
.cg-stage{order:2;position:relative;width:100%;max-width:100%;margin:0 auto}
.cg-play .cg-note{order:4;margin:0;min-height:1.3em}
/* the darts hint is two lines while you aim and one after: keep room for two so the board does not jump under your finger */
.cg-note.two,.cg-play .cg-note.two{min-height:2.6em}
.cg-acts{order:5;display:flex;gap:.5rem}
.cg-acts .btn{flex:1}
.cg-acts:empty{display:none}
.sheet.cgsheet.cg-wide{max-width:min(100%,var(--cgw,30rem))}
.cg-wide .cg-play{display:grid;grid-template-columns:auto var(--cgside,16rem);grid-template-rows:var(--cgh,auto);column-gap:1.3rem;align-items:stretch}
.cg-wide .cg-stage{grid-column:1;grid-row:1;width:auto;margin:0;align-self:center}
.cg-wide .cg-side{grid-column:2;grid-row:1;display:flex;flex-direction:column;gap:.7rem;min-width:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:.15rem 0}
.cg-wide .cg-play .cg-vs{display:flex;flex-direction:column;align-items:stretch;gap:.55rem}
.cg-wide .cg-p,.cg-wide .cg-p.r{flex-direction:row;text-align:left;padding:.5rem .6rem}
.cg-wide .cg-p.r .cg-pn small{justify-content:flex-start}
.cg-wide .cg-p .cg-av{width:2.6rem;height:2.6rem}
.cg-wide .cg-pn b{font-size:1.08rem}
.cg-wide .cg-p.me{order:3}
.cg-wide .cg-turn{order:2;font-size:1.2rem;padding:.35rem 0}
.cg-wide .cg-play .cg-note{text-align:left}
.cg-wide .cg-acts{margin-top:auto;flex-direction:column}

/* the other player is thinking: three soft dots in their pill */
.cg-p{position:relative}
/* their-turn dots: on a phone the pill has no room beside the name, so they sit in a small bubble on the avatar's outer corner */
.cg-wait{position:absolute;top:-.45rem;left:-.3rem;display:inline-flex;gap:.16rem;padding:.2rem .28rem;flex:none;border-radius:.7rem;background:var(--paper);border:.13rem solid var(--ink)}
.cg-p.r .cg-wait{left:auto;right:-.3rem}
.cg-wide .cg-wait,.cg-wide .cg-p.r .cg-wait{position:static;margin-left:auto;margin-right:0;padding:0 .2rem;background:none;border:0}
.cg-wait i{width:.36rem;height:.36rem;border-radius:50%;background:var(--ink);opacity:.25;animation:cgWait 1.4s ease-in-out infinite}
.cg-wait i:nth-child(2){animation-delay:.18s}.cg-wait i:nth-child(3){animation-delay:.36s}
@keyframes cgWait{30%{opacity:.75}}

/* the end of a game, on the board */
.card.cg-result{position:absolute;left:50%;bottom:7%;transform:translateX(-50%);max-width:88%;width:max-content;text-align:center;font-size:1.05rem;
  padding:.55rem 1rem;--bc:var(--ink);background:var(--paper);box-shadow:var(--shadow);pointer-events:none;animation:cgRes .45s var(--pop) .35s both}
.card.cg-result.won{background:#fdebc3}
@keyframes cgRes{from{opacity:0;transform:translate(-50%,.6rem) scale(.9)}to{opacity:1;transform:translateX(-50%)}}

/* a stone that follows the mouse on Gomoku */
.cg-hover{pointer-events:none}

/* the games on the play layout: what goes where on a phone (stacked) and on a wide window (the side column) */
.cg-play .cg-tray{order:3;margin:0}
.cg-play .cg-drows{order:5;margin:0}
.cg-play .cg-fishbar{order:5;margin:0}
.cg-play .cg-dhead{margin:0}
.cg-play .cg-jbar{margin-bottom:0}
.cg-acts{position:relative}
.cg-acts:has(.cg-powrow){min-height:3rem;display:flex}
.cg-acts .cg-powrow{position:absolute;inset:0 .4rem;display:flex;align-items:center;gap:.6rem;opacity:0;pointer-events:none;transition:opacity .15s}
.cg-acts.cg-aiming .cg-powrow{opacity:1}
.cg-acts.cg-aiming .btn{opacity:0;pointer-events:none}
.cg-wide .cg-dhead{flex-direction:column;align-items:flex-start;gap:.5rem}
.cg-wide .cg-drows{grid-template-columns:1fr}
.cg-wide .cg-tray{flex:1 1 auto;min-height:5rem;grid-auto-flow:row;grid-template-columns:repeat(auto-fill,minmax(3.6rem,1fr));overflow-x:hidden;overflow-y:auto;touch-action:pan-y;align-content:start}
.cg-wide .cg-fishbar{justify-content:flex-start}
.cg-wide .cg-info .hero{margin:0}
/* the winning five: the line draws itself through them */
.cg-winline path{stroke-dasharray:1;stroke-dashoffset:1;animation:cgLine .55s ease-out .25s forwards}
@keyframes cgLine{to{stroke-dashoffset:0}}
.cg-cap{display:none}
.cg-wide .cg-cap{display:flex;flex-wrap:wrap;margin-top:.15rem}
.cg-cap svg{width:1.05rem;height:1.05rem;margin-right:-.25rem}
/* in the side column only the jigsaw tray gives way when room is short; the hint and buttons keep their full height */
.cg-wide .cg-side>*{flex-shrink:0}
.cg-wide .cg-side>.cg-tray{flex-shrink:1}
