/* spades · polish layer: trick pips, coach line, result banners, safe areas, touch sizes. Visual only. */
.sp-pips{grid-column:1/-1;display:flex;gap:3px;margin-top:4px;flex-wrap:nowrap}
.sp-pips i{flex:1 1 0;min-width:0;max-width:14px;height:8px;border-radius:3px;border:1.5px solid #cbd5e1;background:transparent;transition:background .25s,border-color .25s}
.sp-pips i.b{border-color:#15803D}
.sp-pips i.w{background:#15803D;border-color:#15803D}
.sp-team.t1 .sp-pips i.b{border-color:#64748b}
.sp-team.t1 .sp-pips i.w{background:#64748b;border-color:#64748b}
#sp-coach{margin:.3rem 0;padding:.5rem .7rem;border-radius:10px;background:#ecfdf5;border:1px solid #86efac;color:#14532d;font-size:.82rem;line-height:1.4;text-align:center}
#sp-coach[hidden]{display:none}
.sp-banner{margin:.3rem 0 .5rem;padding:.45rem .6rem;border-radius:10px;font-weight:800;font-size:.9rem;color:#1e293b}
#sp-overlay p.sp-banner.good{background:#dcfce7;color:#14532d}
#sp-overlay p.sp-banner.bad{background:#fee2e2;color:#7f1d1d}
#sp-overlay .panel{animation:sp-pop .22s ease-out}
@keyframes sp-pop{from{transform:scale(.94);opacity:0}to{transform:none;opacity:1}}
#sp-overlay{padding-left:max(1rem,env(safe-area-inset-left));padding-right:max(1rem,env(safe-area-inset-right));padding-bottom:max(1rem,env(safe-area-inset-bottom))}
#sp-hand{padding-bottom:max(.25rem,env(safe-area-inset-bottom))}
.sp-seg button,#sp-new,#sp-last{min-height:44px}
#sp-bid-grid button{min-height:44px;min-width:44px}
@media (prefers-reduced-motion:reduce){#sp-overlay .panel{animation:none}.sp-pips i{transition:none}}
/* wave3: native Full screen hides the same chrome the immersive fit hides (fs-fit only covers html.pip-immersive) */
html.pip-native :is(.facts,.sp-howto,.sp-stats,#sp-depth-gameplay,#sp-depth-review,#sp-tracker,.sp-opts,.sp-rules,.pip-actions,#similar-games,footer,.playyard-ad,.below-content,.bottom-ad-section){display:none!important}
html.pip-native,html.pip-immersive{overscroll-behavior:none}
/* wave3: table depth: soft vignette, rim light, deeper card shadows, winning card pulse */
#sp-table{box-shadow:inset 0 0 46px #0007,inset 0 2px 0 #ffffff22,0 10px 24px -8px #0008}
#sp-table .slot .card,#sp-table .slot.card{filter:drop-shadow(0 5px 6px #0006)}
.slot.win{animation:sp-win 1.1s ease-in-out infinite alternate}
@keyframes sp-win{from{filter:brightness(1)}to{filter:brightness(1.12)}}
#sp-hand .card{transition:transform .18s cubic-bezier(.2,.8,.3,1.2),opacity .15s,filter .15s}
@media (prefers-reduced-motion:reduce){.slot.win{animation:none}}

/* qa: depth panels hidden in full screen */
html.pip-immersive #sp-depth-gameplay,html.pip-immersive #sp-depth-review,html.pip-native #sp-depth-gameplay,html.pip-native #sp-depth-review{display:none !important}

/* wave4: full screen layout. Stage is a grid: score / table (fills) / status / hand. Landscape puts score + status beside the table. */
html:is(.pip-immersive,.pip-native) .game-wrap.pip-stage{display:grid!important;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto auto;gap:4px;overflow:hidden!important;overscroll-behavior:none;align-content:stretch;box-sizing:border-box}
html.pip-native .game-wrap.pip-stage{padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))!important}
html:is(.pip-immersive,.pip-native) .game-wrap.pip-stage>:is(.game-title,.facts,.sp-howto,.sp-bar,.sp-stats,#sp-depth-gameplay,#sp-depth-review,#sp-tracker,.sp-opts,.sp-rules,.pip-actions){display:none!important}
html:is(.pip-immersive,.pip-native) .game-wrap.pip-stage>:is(#sp-score,#sp-table,#sp-status,#sp-hand,#sp-bid,#sp-blind,#sp-coach){margin:0;min-width:0}
html:is(.pip-immersive,.pip-native) #sp-score{grid-row:1;grid-column:1;gap:4px}
html:is(.pip-immersive,.pip-native) #sp-score .sp-team{padding:.25rem .45rem}
html:is(.pip-immersive,.pip-native) #sp-table{grid-row:2;grid-column:1;min-height:0;height:auto;grid-template-columns:72px 1fr 72px;grid-template-rows:auto minmax(0,1fr) auto;padding:.35rem .3rem}
html:is(.pip-immersive,.pip-native) #sp-table .sp-mid{min-height:0}
html:is(.pip-immersive,.pip-native) #sp-table .slot{width:54px;height:76px}
html:is(.pip-immersive,.pip-native) #sp-table .slot.s2,html:is(.pip-immersive,.pip-native) #sp-table .slot.s0{margin-left:-27px}
html:is(.pip-immersive,.pip-native) #sp-table .slot.s1,html:is(.pip-immersive,.pip-native) #sp-table .slot.s3{margin-top:-38px}
html:is(.pip-immersive,.pip-native) #sp-status{grid-row:3;grid-column:1;min-height:0;margin:0;font-size:.85rem;line-height:1.25;overflow:hidden}
html:is(.pip-immersive,.pip-native) #sp-hand{grid-row:4;grid-column:1;min-height:0;padding-bottom:max(.25rem,env(safe-area-inset-bottom));overflow:visible}
/* bid, blind nil and coach float over the table so the hand stays in view */
html:is(.pip-immersive,.pip-native) .game-wrap.pip-stage>:is(#sp-bid,#sp-blind){grid-row:2;grid-column:1;align-self:end;z-index:6;max-height:100%;overflow:auto;padding:.4rem;box-shadow:0 6px 18px #0006}
html:is(.pip-immersive,.pip-native) .game-wrap.pip-stage>#sp-coach{grid-row:2;grid-column:1;align-self:start;z-index:5;margin:.2rem!important;padding:.3rem .5rem;font-size:.74rem;line-height:1.3}
html:is(.pip-immersive,.pip-native) #sp-bid .sp-bid-q{font-size:.8rem;margin:0 0 .3rem}
html:is(.pip-immersive,.pip-native) #sp-bid .sp-bid-hint{font-size:.7rem;margin:.3rem 0;line-height:1.3}
html:is(.pip-immersive,.pip-native) #sp-bid-grid{gap:4px}
html:is(.pip-immersive,.pip-native) #sp-bid-go,html:is(.pip-immersive,.pip-native) #sp-blind .btn{min-height:44px;margin-top:.2rem}
html:is(.pip-immersive,.pip-native) #sp-bid[hidden],html:is(.pip-immersive,.pip-native) #sp-blind[hidden],html:is(.pip-immersive,.pip-native) #sp-coach[hidden]{display:none!important}
@media (orientation:landscape) and (max-height:520px){
  html:is(.pip-immersive,.pip-native) .game-wrap.pip-stage{grid-template-columns:minmax(0,1fr) 190px;grid-template-rows:auto minmax(0,1fr) auto;column-gap:6px}
  html:is(.pip-immersive,.pip-native) #sp-table{grid-row:1/3;grid-column:1}
  html:is(.pip-immersive,.pip-native) #sp-score{grid-row:1;grid-column:2;grid-template-columns:1fr}
  html:is(.pip-immersive,.pip-native) #sp-status{grid-row:2;grid-column:2;align-self:start}
  html:is(.pip-immersive,.pip-native) #sp-hand{grid-row:3;grid-column:1/3}
  html:is(.pip-immersive,.pip-native) .game-wrap.pip-stage>:is(#sp-bid,#sp-blind){grid-row:1/3;grid-column:1}
  html:is(.pip-immersive,.pip-native) .game-wrap.pip-stage>#sp-coach{grid-row:2;grid-column:2;align-self:end}
  html:is(.pip-immersive,.pip-native) #sp-table .slot{width:50px;height:70px}
  html:is(.pip-immersive,.pip-native) #sp-table .slot.s2,html:is(.pip-immersive,.pip-native) #sp-table .slot.s0{margin-left:-25px}
  html:is(.pip-immersive,.pip-native) #sp-table .slot.s1,html:is(.pip-immersive,.pip-native) #sp-table .slot.s3{margin-top:-35px}
}
