/*
 * 3D shuffling-deck loader (web). Markup: src/ui/deck-loader/markup.ts.
 * One 3.6s loop: the deck splits, riffles back together, fans out face up,
 * then gathers again, on a table tilted away from the viewer.
 */
.cgl {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-family: Rubik_700Bold, Rubik, -apple-system, 'Segoe UI', Heebo, Arial, sans-serif;
  --cgl-delay: 0ms;
  --w: 82px;
  --h: 117px;
}
#cg-preload {
  position: fixed;
  z-index: 2147483000;
  background:
    radial-gradient(90% 55% at 50% 12%, rgba(91, 124, 255, 0.28), rgba(91, 124, 255, 0) 70%),
    linear-gradient(180deg, #1a2660 0%, #111a45 30%, #0a1030 68%, #050817 100%);
  transition: opacity 0.35s ease;
}
#cg-preload.cg-out {
  opacity: 0;
}
.cgl-stage {
  position: relative;
  width: 320px;
  height: 270px;
  perspective: 900px;
  perspective-origin: 50% 20%;
}
.cgl-glow {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 400px;
  height: 400px;
  margin: -200px 0 0 -200px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 207, 90, 0.26), rgba(91, 124, 255, 0.14) 55%, rgba(91, 124, 255, 0) 100%);
  animation: cgl-breathe 3.6s ease-in-out infinite;
  animation-delay: var(--cgl-delay);
}
.cgl-table {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(46deg) rotateZ(-8deg);
  animation: cgl-sway 7.2s ease-in-out infinite;
  animation-delay: var(--cgl-delay);
}
.cgl-shadow {
  position: absolute;
  left: -100px;
  top: -86px;
  width: 200px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
  animation: cgl-shadow 3.6s cubic-bezier(0.45, 0.05, 0.25, 1) infinite;
  animation-delay: var(--cgl-delay);
}
.cgl-card {
  position: absolute;
  left: calc(var(--w) / -2);
  top: calc(var(--h) / -2);
  width: var(--w);
  height: var(--h);
  transform-style: preserve-3d;
  transform-origin: 50% 165%;
  animation: cgl-deal 3.6s cubic-bezier(0.45, 0.05, 0.25, 1) infinite;
  animation-delay: calc(var(--cgl-delay) + var(--i) * 55ms);
  will-change: transform;
}
.cgl-back,
.cgl-face {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-sizing: border-box;
  overflow: hidden;
}
.cgl-back {
  border: 2px solid #f0c14a;
  background:
    repeating-linear-gradient(45deg, rgba(255, 215, 120, 0.16) 0 1px, rgba(0, 0, 0, 0) 1px 7px),
    repeating-linear-gradient(-45deg, rgba(255, 215, 120, 0.16) 0 1px, rgba(0, 0, 0, 0) 1px 7px),
    linear-gradient(160deg, #3048b0 0%, #1a2768 55%, #0e1546 100%);
  box-shadow: inset 0 0 0 3px #16205a, inset 0 0 0 4px rgba(240, 193, 74, 0.55), 0 2px 0 rgba(0, 0, 0, 0.35);
}
.cgl-back::after {
  content: '\2660\FE0E';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 1.5px solid #f0c14a;
  background: radial-gradient(circle at 35% 30%, #2b3f9e, #111a52);
  color: #ffd86b;
  font-size: 18px;
  line-height: 31px;
  text-align: center;
  box-sizing: border-box;
}
.cgl-back::before {
  content: '';
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0) 40%, rgba(255, 240, 200, 0.28) 50%, rgba(255, 255, 255, 0) 60%);
  animation: cgl-sheen 3.6s ease-in-out infinite;
  animation-delay: calc(var(--cgl-delay) + var(--i) * 55ms);
}
.cgl-face {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #ffffff 0%, #f6f1e4 100%);
  border: 1px solid rgba(20, 24, 40, 0.18);
  color: #1b2030;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4px rgba(214, 170, 72, 0.45);
}
.cgl-face.cgl-red {
  color: #cf2e3a;
}
.cgl-face b,
.cgl-face em,
.cgl-face u {
  position: absolute;
  font-style: normal;
  text-decoration: none;
  line-height: 1;
  font-weight: 800;
}
.cgl-face b {
  left: 7px;
  top: 7px;
  font-size: 19px;
  letter-spacing: -0.5px;
}
.cgl-face em {
  left: 7px;
  top: 27px;
  font-size: 15px;
}
.cgl-face u {
  left: 0;
  right: 0;
  top: 50%;
  margin-top: -25px;
  text-align: center;
  font-size: 48px;
}
.cgl-face .cgl-b2 {
  left: auto;
  top: auto;
  right: 7px;
  bottom: 7px;
  transform: rotate(180deg);
}
.cgl-face .cgl-e2 {
  left: auto;
  top: auto;
  right: 7px;
  bottom: 27px;
  transform: rotate(180deg);
}
.cgl-label {
  margin-top: 6px;
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: #f4efe4;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
html[lang='he'] .cgl [lang='en'],
html:not([lang='he']) .cgl [lang='he'] {
  display: none;
}
.cgl-dots {
  display: inline-flex;
  gap: 3px;
  margin: 0 4px;
}
.cgl-dots i {
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background: #ffd86b;
  animation: cgl-dot 1.2s ease-in-out infinite;
}
.cgl-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.cgl-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
.cgl-bar {
  position: relative;
  width: 132px;
  height: 4px;
  margin-top: 14px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
}
.cgl-bar i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 46%;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 216, 107, 0), #ffd86b 45%, #fff3c4 60%, rgba(255, 216, 107, 0));
  animation: cgl-run 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes cgl-deal {
  0%,
  8% {
    transform: translate3d(0, 0, calc(var(--i) * 1.6px)) rotateZ(0deg) rotateY(0deg);
  }
  21%,
  27% {
    transform: translate3d(calc(var(--s) * 66px), calc(var(--s) * -10px), calc(34px + var(--i) * 2px)) rotateZ(calc(var(--s) * -10deg)) rotateY(calc(var(--s) * -16deg));
  }
  40%,
  49% {
    transform: translate3d(0, 0, calc(var(--r) * 1.6px)) rotateZ(0deg) rotateY(0deg);
  }
  64%,
  76% {
    transform: translate3d(0, -18px, calc(58px + var(--i) * 1.6px)) rotateZ(var(--f)) rotateY(180deg);
  }
  92%,
  100% {
    transform: translate3d(0, 0, calc(var(--i) * 1.6px)) rotateZ(0deg) rotateY(360deg);
  }
}
@keyframes cgl-shadow {
  0%,
  8%,
  40%,
  49%,
  92%,
  100% {
    transform: scale(0.82);
    opacity: 1;
  }
  21%,
  27% {
    transform: scale(1.35, 0.9);
    opacity: 0.7;
  }
  64%,
  76% {
    transform: scale(1.5, 1.05);
    opacity: 0.55;
  }
}
@keyframes cgl-sway {
  0%,
  100% {
    transform: rotateX(46deg) rotateZ(-8deg) translateY(0);
  }
  50% {
    transform: rotateX(41deg) rotateZ(8deg) translateY(-6px);
  }
}
@keyframes cgl-breathe {
  0%,
  100% {
    opacity: 0.75;
    transform: scale(0.94);
  }
  70% {
    opacity: 1;
    transform: scale(1.06);
  }
}
@keyframes cgl-sheen {
  0%,
  55% {
    transform: translateX(-60%);
  }
  85%,
  100% {
    transform: translateX(60%);
  }
}
@keyframes cgl-dot {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}
@keyframes cgl-run {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(230%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cgl-card,
  .cgl-shadow,
  .cgl-back::before {
    animation-duration: 7.2s;
  }
  .cgl-table {
    animation: none;
  }
}
