
.al-tally{
  position: fixed;
  inset: 0;
  z-index: 99500;
  background: #070912;          
  opacity: 0;
  visibility: hidden;           
  transition: opacity .35s cubic-bezier(0.65,0,0.35,1), visibility 0s linear .35s;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.al-tally.is-open{
  opacity: 1;
  visibility: visible;
  transition: opacity .35s cubic-bezier(0.65,0,0.35,1), visibility 0s;
}
.al-tally-canvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.al-tally-avatar{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  pointer-events: none;
}
.al-tally-motions{
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;                   
  --key: 45px;
  --key-gap: 3px;
  width: calc(var(--key) + 16px);
  display: flex;
  flex-direction: column;
  gap: var(--key-gap);
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;
}
.al-tally-motions.left { left: 0; background: linear-gradient(to right, rgba(7,9,18,.72), rgba(7,9,18,0)); }
.al-tally-motions.right{ right: 0; background: linear-gradient(to left,  rgba(7,9,18,.72), rgba(7,9,18,0)); }
.al-tally-motions.is-in{ background: none; }
.al-tally-motion{
  position: relative;           
  width: var(--key);
  height: var(--key);
  flex: none;
  padding: 0;
  border-radius: calc(var(--key) * 0.29);
  cursor: pointer;
  background: linear-gradient(#2b3566, #1b2246);
  border: 2px solid #4de0d8;
  box-shadow: 0 3px 0 #101634, 0 5px 12px rgba(0,0,0,.45);
}
.al-tally-motion:active{ transform: translateY(3px); box-shadow: 0 1px 0 #101634; }
.al-tally-motion.is-on{ border-color: #ffd24a; }
.al-tally-motion.is-new{ border-color: #ffc94d; }
.al-tally-glow{
  position: absolute;
  inset: -5px;                            
  border-radius: calc(var(--key) * 0.29 + 5px);
  border: 3px solid #ffc94d;              
  box-shadow:
    0 0 0 3px rgba(255,201,77,.55),                                        
    0 0 calc(var(--key) * 0.14) calc(var(--key) * 0.05) rgba(255,201,77,.95), 
    0 0 calc(var(--key) * 0.34) calc(var(--key) * 0.14) rgba(255,201,77,.55), 
    inset 0 0 calc(var(--key) * 0.1) 2px rgba(255,201,77,.6);              
  opacity: 0;
  pointer-events: none;
}
.al-tally-motion.is-new .al-tally-glow{
  animation: alTallyGlowBreath 1.4s ease-in-out infinite;
}
@keyframes alTallyGlowBreath{
  0%, 100% { opacity: .62; }
  50%      { opacity: 1; }
}
.al-tally-hand, .al-tally-hand-tip{
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}
.al-tally-motion img{ width: 90%; height: 90%; object-fit: contain; pointer-events: none; }
.al-tally-motion img{ position: relative; }
.al-tally-wave{ position: absolute; inset: -22%; border-radius: 30%; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, rgba(255,236,150,.95), rgba(255,201,77,.65) 55%, rgba(255,201,77,0)); }
.al-tally-motion.is-wave{ z-index: 2; animation: alTallyWaveGrow var(--al-wave-dur, .6s) ease-in-out; }
.al-tally-motion.is-wave .al-tally-wave{ animation: alTallyWaveLight var(--al-wave-dur, .6s) ease-in-out; }
@keyframes alTallyWaveGrow{ 0%, 100%{ transform: scale(1); } 50%{ transform: scale(var(--al-wave-grow, 1.36)); } }
@keyframes alTallyWaveLight{ 0%, 100%{ opacity: 0; } 50%{ opacity: var(--al-wave-light, .9); } }
.al-tally-leave{
  position: absolute;
  left: 84px;
  top: 18px;
  z-index: 3;
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #dfe6f5;
  font: 700 26px/1 system-ui, -apple-system, sans-serif;
  background: linear-gradient(#2b3566, #1b2246);
  border: 3px solid #4de0d8;
  box-shadow: 0 3px 0 #101634, 0 5px 12px rgba(0,0,0,.45);
}
.al-tally-leave:active{ transform: translateY(3px); box-shadow: 0 1px 0 #101634; }
.al-tally-clock{
  position: absolute;
  left: 80.5%;
  top: 48px;                    
  transform: translate(-50%, -50%);
  z-index: 3;                   
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s cubic-bezier(0.65,0,0.35,1);
}
.al-tally-clock.is-on{ opacity: 1; }
.al-tally-clock-num{
  font: 700 52px/1 var(--font-read);
  color: #fff;
  text-shadow: 0 3px 0 #101634, 0 6px 16px rgba(0,0,0,.55);
  transform-origin: center;
  display: inline-block;
}
.al-tally-clock-num.beat{ animation: alTallyClockBeat .55s cubic-bezier(.34,1.6,.5,1); }
@keyframes alTallyClockBeat{
  0%   { transform: scale(.62); color: #fff; }
  50%  { transform: scale(1.26); color: #e63a46; }
  100% { transform: scale(1);   color: #fff; }
}
.al-tally-clock-num.is-low{ color: #ff6b6b; }
body.al-builder-over #game-chooser{ visibility: hidden !important; }
.al-tally:not(.is-open) .al-tally-glow{ animation-play-state: paused !important; }
