/* v139: position the text-only POP TIME HUD in the center of the actual
   tagline-to-board gap, regardless of legacy v128 dial offsets. */
#gameStage > .stats .pop-time-hud {
  position:absolute!important;
  top:var(--pw139-text-top,0px)!important;
  left:50%!important;
  right:auto!important;
  bottom:auto!important;
  transform:translateX(-50%)!important;
  width:min(310px,94vw)!important;
  max-width:94vw!important;
  height:var(--pw139-text-height,122px)!important;
  min-height:0!important;
  padding:0!important;
  margin:0!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  background:transparent!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  pointer-events:none!important;
}
#gameStage > .stats .pop-time-hud[hidden]{display:none!important}
#gameStage .pop-time-clock, .moonlit-app .pop-time-clock {
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:center!important;
  justify-content:center!important;
  gap:4px!important;
  border:0!important;
  background:none!important;
  border-radius:0!important;
  box-shadow:none!important;
  padding:0!important;
  box-sizing:border-box!important;
  text-align:center!important;
}
#gameStage .pop-time-clock small {
  font-size:clamp(12px,3.6vw,16px)!important;
  line-height:1!important;
  letter-spacing:2px!important;
  white-space:nowrap!important;
  margin:0!important;
}
#gameStage .pop-time-clock strong {
  font-size:clamp(54px,18vw,80px)!important;
  line-height:.89!important;
  margin:0!important;
  white-space:nowrap!important;
}
#gameStage .pop-time-clock span {
  font-size:clamp(11px,3vw,13px)!important;
  line-height:1.05!important;
  letter-spacing:1.5px!important;
  white-space:nowrap!important;
  margin:0!important;
}
/* Keep legacy scoreboard boxes in the layout while they're hidden. */
body.pop-time-active #gameStage>.stats>.stat {
  visibility:hidden!important;
  opacity:0!important;
  pointer-events:none!important;
}
@media(orientation:portrait) and (max-height:740px){
  #gameStage .pop-time-clock {gap:2px!important}
  #gameStage .pop-time-clock strong{font-size:clamp(42px,13.5vw,58px)!important}
  #gameStage .pop-time-clock small{font-size:11px!important}
  #gameStage .pop-time-clock span{font-size:10px!important}
}
@media(orientation:portrait) and (max-height:620px){
  #gameStage .pop-time-clock strong{font-size:38px!important}
  #gameStage .pop-time-clock small{font-size:10px!important}
  #gameStage .pop-time-clock span{font-size:9px!important}
}

/* Persistent state for each of four rotations: change the membrane's REST
   silhouette when a shape rotates, not just a temporary touch effect.
   The shape changes only on a user action, so idle animation still runs
   only on transform/opacity with the existing 7s v137 cycle. */
#gameStage>#rack>.piece[data-rot="0"]:not(.used)::before{
  border-radius:47% 53% 49% 51% / 52% 47% 53% 48%!important;
}
#gameStage>#rack>.piece[data-rot="1"]:not(.used)::before{
  border-radius:43% 57% 55% 45% / 48% 56% 44% 52%!important;
}
#gameStage>#rack>.piece[data-rot="2"]:not(.used)::before{
  border-radius:55% 45% 46% 54% / 55% 45% 53% 47%!important;
}
#gameStage>#rack>.piece[data-rot="3"]:not(.used)::before{
  border-radius:50% 50% 57% 43% / 44% 54% 46% 56%!important;
}
/* Press responds quickly, rotation has a brief 'settle' but never overrides
   the persistent border-radius from data-rot. */
#gameStage>#rack>.piece.tap-rotated::before {
  animation:pw139RotateSettle .24s cubic-bezier(.2,.82,.28,1) both!important;
}
#gameStage>#rack>.piece:not(.used):active::before {
  animation:pw139Pressed .18s ease-out both!important;
}
@keyframes pw139RotateSettle {
  0%{transform:scale(.970,1.028) rotate(-.8deg);opacity:.96}
  54%{transform:scale(1.027,.982) rotate(.65deg);opacity:1}
  100%{transform:scale(1,1) rotate(0);opacity:1}
}
@keyframes pw139Pressed {
  0%{transform:scale(1,1)}
  50%{transform:scale(1.013,.989)}
  100%{transform:scale(1,1)}
}
@media(prefers-reduced-motion:reduce){
  #gameStage>#rack>.piece.tap-rotated::before,
  #gameStage>#rack>.piece:not(.used):active::before{
    animation:none!important;
  }
}
