/* v5 polish: hide inactive overlays, realistic dice, smoother motion */
.drawer[aria-hidden="true"],
.screen-mode[aria-hidden="true"]{
  visibility:hidden!important;
  opacity:0!important;
  pointer-events:none!important;
}
.screen-mode[aria-hidden="true"] .screen-close,
.screen-mode[aria-hidden="true"] .screen-card,
.drawer[aria-hidden="true"] .drawer-panel{
  display:none!important;
}
.drawer[aria-hidden="false"],
.screen-mode[aria-hidden="false"]{
  visibility:visible!important;
  opacity:1!important;
  pointer-events:auto!important;
}

.real-dice-grid{
  perspective:1100px;
  align-items:stretch;
}
.dice-player{
  position:relative;
  overflow:hidden;
  animation:diceCardLand .42s cubic-bezier(.2,.9,.2,1) both;
}
.dice-player:before{
  content:'';
  position:absolute;
  inset:-60% auto auto -25%;
  width:150%;
  height:100%;
  background:linear-gradient(115deg,transparent 10%,rgba(255,255,255,.08),transparent 70%);
  transform:rotate(18deg);
  pointer-events:none;
}
.dice-pair{
  perspective:900px;
  transform-style:preserve-3d;
}
.real-die{
  width:56px!important;
  height:56px!important;
  border-radius:14px!important;
  position:relative!important;
  display:block!important;
  color:transparent!important;
  font-size:0!important;
  background:
    radial-gradient(circle at 30% 22%,rgba(255,255,255,.95),rgba(255,255,255,.25) 20%,transparent 34%),
    linear-gradient(145deg,#ffffff 0%,#f2edf7 48%,#d8d1df 100%)!important;
  border:1px solid rgba(255,255,255,.86)!important;
  box-shadow:
    0 16px 30px rgba(0,0,0,.38),
    inset 5px 5px 11px rgba(255,255,255,.95),
    inset -8px -8px 14px rgba(72,55,96,.22),
    inset 0 0 0 1px rgba(0,0,0,.05)!important;
  transform-style:preserve-3d;
  backface-visibility:hidden;
}
.real-die:before{
  content:'';
  position:absolute;
  left:50%;
  top:50%;
  width:8px;
  height:8px;
  margin:-4px 0 0 -4px;
  border-radius:999px;
  background:#18121f;
  box-shadow:none;
  filter:drop-shadow(0 1px 1px rgba(255,255,255,.18));
}
.real-die:after{
  content:''!important;
  position:absolute!important;
  left:8px!important;
  top:6px!important;
  width:24px!important;
  height:12px!important;
  border-radius:999px!important;
  background:rgba(255,255,255,.72)!important;
  filter:blur(2px)!important;
  pointer-events:none!important;
}
.real-die[data-v="1"]:before{background:#18121f;box-shadow:none;}
.real-die[data-v="2"]:before{background:transparent;box-shadow:-13px -13px 0 #18121f,13px 13px 0 #18121f;}
.real-die[data-v="3"]:before{background:#18121f;box-shadow:-13px -13px 0 #18121f,13px 13px 0 #18121f;}
.real-die[data-v="4"]:before{background:transparent;box-shadow:-13px -13px 0 #18121f,13px -13px 0 #18121f,-13px 13px 0 #18121f,13px 13px 0 #18121f;}
.real-die[data-v="5"]:before{background:#18121f;box-shadow:-13px -13px 0 #18121f,13px -13px 0 #18121f,-13px 13px 0 #18121f,13px 13px 0 #18121f;}
.real-die[data-v="6"]:before{background:transparent;box-shadow:-13px -15px 0 #18121f,13px -15px 0 #18121f,-13px 0 0 #18121f,13px 0 0 #18121f,-13px 15px 0 #18121f,13px 15px 0 #18121f;}
.real-die.rolling{
  animation:diceThrowReal .78s cubic-bezier(.17,.9,.22,1.08) both!important;
}
.dice-pair .real-die:nth-child(2).rolling{
  animation-delay:.055s!important;
}
@keyframes diceThrowReal{
  0%{transform:translate3d(-16px,-34px,0) rotateX(0deg) rotateY(0deg) rotateZ(-18deg) scale(.78);filter:blur(.6px)}
  18%{transform:translate3d(13px,-18px,36px) rotateX(160deg) rotateY(-130deg) rotateZ(32deg) scale(1.08);filter:blur(.4px)}
  38%{transform:translate3d(-12px,11px,8px) rotateX(310deg) rotateY(220deg) rotateZ(-38deg) scale(.96)}
  58%{transform:translate3d(9px,-7px,24px) rotateX(470deg) rotateY(-320deg) rotateZ(24deg) scale(1.04)}
  78%{transform:translate3d(-3px,4px,0) rotateX(540deg) rotateY(360deg) rotateZ(-9deg) scale(.99)}
  100%{transform:translate3d(0,0,0) rotateX(720deg) rotateY(360deg) rotateZ(0deg) scale(1);filter:blur(0)}
}
@keyframes diceCardLand{
  from{opacity:0;transform:translateY(16px) scale(.96)}
  to{opacity:1;transform:translateY(0) scale(1)}
}

.poker-card{
  transform-origin:center bottom;
  transition:transform .18s ease, box-shadow .18s ease;
}
.poker-card:hover{
  transform:translateY(-4px) rotateZ(-1deg);
}
.poker-card.flip{
  animation:cardFlipBetter .88s cubic-bezier(.16,.9,.2,1) both!important;
}
@keyframes cardFlipBetter{
  0%{opacity:0;transform:translate3d(0,-28px,0) rotateY(180deg) rotateZ(-4deg) scale(.82);background:repeating-linear-gradient(45deg,#241735 0 7px,#3d2b5c 7px 14px);color:transparent;}
  28%{opacity:1;transform:translate3d(0,0,30px) rotateY(120deg) rotateZ(2deg) scale(1.06);color:transparent;}
  56%{transform:translate3d(0,0,16px) rotateY(42deg) rotateZ(-1deg) scale(1.02);color:transparent;}
  100%{opacity:1;transform:translate3d(0,0,0) rotateY(0) rotateZ(0) scale(1);color:inherit;}
}
.result-card-pop,
.stage-card{
  animation:stageSoftIn .28s ease both;
}
@keyframes stageSoftIn{
  from{opacity:.86;transform:translateY(8px)}
  to{opacity:1;transform:translateY(0)}
}

@media(max-width:760px){
  .real-die{width:50px!important;height:50px!important;border-radius:13px!important;}
  .real-die:before{width:7px;height:7px;margin:-3.5px 0 0 -3.5px;}
  .real-die[data-v="2"]:before{box-shadow:-11px -11px 0 #18121f,11px 11px 0 #18121f;}
  .real-die[data-v="3"]:before{box-shadow:-11px -11px 0 #18121f,11px 11px 0 #18121f;}
  .real-die[data-v="4"]:before{box-shadow:-11px -11px 0 #18121f,11px -11px 0 #18121f,-11px 11px 0 #18121f,11px 11px 0 #18121f;}
  .real-die[data-v="5"]:before{box-shadow:-11px -11px 0 #18121f,11px -11px 0 #18121f,-11px 11px 0 #18121f,11px 11px 0 #18121f;}
  .real-die[data-v="6"]:before{box-shadow:-11px -13px 0 #18121f,11px -13px 0 #18121f,-11px 0 0 #18121f,11px 0 0 #18121f,-11px 13px 0 #18121f,11px 13px 0 #18121f;}
}
@media(max-width:390px){
  .real-die{width:44px!important;height:44px!important;border-radius:12px!important;}
  .dice-pair{gap:7px!important;}
}
