.final-win {
  position: fixed;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
  background: rgba(11, 15, 35, 0.8019607843);
}
.final-win__confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1001;
}
.final-win--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.4s ease, visibility 0s linear 0s;
}
.final-win--visible .final-win__popup {
  animation: win-pop-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards, win-pulse 3.5s cubic-bezier(0.22, 0.61, 0.36, 1) 0.5s infinite;
}
.final-win--visible .win__multiplier-value {
  animation: win-mult-pop 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) 0.42s forwards;
}
.final-win--hiding .win__popup {
  animation: win-pop-out 0.22s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
}
.final-win__popup {
  position: relative;
  z-index: 1;
  width: min(80vw, 480px);
  max-width: 100%;
  height: auto;
  padding: 40px 30px 30px 30px;
  border-radius: 20px;
  background: radial-gradient(85.27% 86.29% at 50% 13.71%, rgba(46, 56, 102, 0.7) 0%, rgba(67, 79, 135, 0.5) 33.98%, rgba(110, 130, 200, 0.5) 80.75%);
  box-shadow: 0 1.362px 0 0 rgba(255, 255, 255, 0.55) inset, 0 0 9.73px 0 rgba(255, 255, 255, 0.6) inset, 0 3.892px 9.73px 0 rgba(9, 33, 63, 0.9), 0 4px 35px rgba(43, 198, 255, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transform-origin: 50% 60%;
  will-change: transform, opacity;
  transform: translateY(14px) scale(0.92);
  filter: blur(2px);
}
@media (orientation: portrait) {
  .final-win__popup {
    padding: 30px 20px 20px 20px;
    gap: 10px;
  }
}
.final-win__popup::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 22px;
  padding: 2px;
  background: linear-gradient(90deg, #1a3d7a, #4093FF, #ffffff, #40ffe9, #ffffff, #4093FF, #1a3d7a);
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: borderGradientMove 2s linear infinite;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.95));
}
.final-win__popup::after {
  content: "";
  position: absolute;
  inset: -40% -60%;
  border-radius: inherit;
  clip-path: inset(0 round 23px);
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.22) 45%, rgba(255, 255, 255, 0.06) 55%, transparent 65%);
  transform: translateX(-35%) translateY(0);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.final-win__title-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  max-width: 100%;
}
.final-win .win__congra {
  position: relative;
  overflow: visible;
  font-family: var(--basic-font);
  font-weight: 900;
  font-size: clamp(26px, 6vw, 30px);
  line-height: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: center;
  text-transform: uppercase;
  color: #FFFFFF;
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 0 0 20px 0;
  text-shadow: 0 0 19.46px #181A3D;
  z-index: 0;
}
.final-win .win__congra span {
  display: block;
  text-align: center;
}
.final-win .win__congra::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  z-index: -1;
  background: radial-gradient(100% 100% at 34.25% 30.76%, #6ADBFF 0%, #5C8AFF 49.88%, #0020EE 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 3px transparent;
  color: transparent;
}
.final-win .win__title-won {
  position: relative;
  overflow: visible;
  font-family: var(--basic-font);
  font-weight: 900;
  font-size: clamp(30px, 6.5vw, 52px);
  line-height: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: center;
  background: linear-gradient(180deg, #F9F104 0%, #FEDD09 52%, #FF8401 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 0;
}
.final-win .win__title-won span {
  display: block;
  text-align: center;
}
.final-win .win__title-won::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  z-index: -1;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 -1px 0 rgb(255, 139, 7), 0 1px 0 rgb(252, 249, 21), 0 2px 2px rgba(28, 35, 67, 0.8), 0 0 20px rgba(24, 26, 61, 0.85);
}
.final-win__divider {
  width: 100%;
  height: 2px;
  flex: 0 0 auto;
  align-self: stretch;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.01) 4.31%, rgba(255, 255, 255, 0.16) 49.04%, rgba(255, 255, 255, 0.01) 100%);
}
.final-win__mult {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--basic-font);
  font-size: clamp(12px, 4vw, 16px);
  font-weight: 700;
  color: #2E3866;
  padding: 0;
}
.final-win .win__amount {
  position: relative;
  display: inline-block;
  text-align: center;
  white-space: nowrap;
  font-family: var(--basic-font);
  font-weight: 900;
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1;
  color: #FFFFFF;
  padding: 6px 10px;
  text-shadow: 0 0 19.46px #181A3D;
  z-index: 0;
  opacity: 1;
  transform: none;
}
.final-win .win__amount::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(100% 100% at 34.25% 30.76%, #6ADBFF 0%, #5C8AFF 49.88%, #0020EE 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 4px transparent;
  color: transparent;
}
.final-win__multiplier {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--basic-font);
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 700;
  color: white;
}
.final-win__multiplier-label {
  opacity: 0.95;
}
.final-win__multiplier-value {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  font-size: clamp(16px, 3vw, 22px);
  line-height: 1;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  color: white;
}
.final-win {
  /* region SPARKLES */
}
.final-win__dialog-sparkles {
  position: absolute;
  inset: -48px -48px;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}
.final-win__sparkles {
  position: absolute;
  inset: -26px;
  pointer-events: none;
  z-index: 2;
}
.final-win__sparkle {
  position: absolute;
  display: block;
  --star-base: clamp(18px, 3vmin, 42px);
  width: var(--star-base);
  height: var(--star-base);
  opacity: 0.9;
  transform-origin: 50% 50%;
  will-change: transform, opacity, filter;
  animation: win-twinkle 1.45s ease-out infinite, win-glow-breath 1.45s ease-in-out infinite;
}
.final-win__sparkle svg {
  width: 100%;
  height: 100%;
  display: block;
}
.final-win__dialog-sparkles .final-win__sparkle {
  --star-base: clamp(18px, 3vmin, 42px);
  width: var(--star-base);
  height: var(--star-base);
  animation: win-twinkle 1.45s ease-out infinite;
}
.final-win__sparkle.s1 {
  left: 0;
  top: 54%;
  width: var(--star-base);
  height: var(--star-base);
  animation-delay: 0s;
  animation-duration: 1.35s, 1.35s;
}
.final-win__sparkle.s2 {
  left: 40%;
  bottom: 10%;
  width: var(--star-base);
  height: var(--star-base);
  animation-delay: 0.22s, 0.22s;
  animation-duration: 1.55s, 1.55s;
}
.final-win__sparkle.s3 {
  right: 10%;
  top: -26%;
  width: var(--star-base);
  height: var(--star-base);
  animation-delay: 0.1s, 0.1s;
  animation-duration: 1.45s, 1.45s;
}
.final-win__sparkle.s4 {
  right: 0%;
  bottom: 2%;
  width: calc(var(--star-base) * 1.9);
  height: calc(var(--star-base) * 1.9);
  animation-delay: 0.38s, 0.38s;
  animation-duration: 1.6s, 1.6s;
}
.final-win__sparkle.s5 {
  left: 33%;
  top: -10%;
  width: calc(var(--star-base) * 1.3);
  height: calc(var(--star-base) * 1.3);
  animation-delay: 0.16s, 0.16s;
  animation-duration: 1.5s, 1.5s;
}
.final-win__sparkle.s6 {
  right: 1%;
  bottom: 60%;
  width: var(--star-base);
  height: var(--star-base);
  animation-delay: 0.52s, 0.52s;
  animation-duration: 1.7s, 1.7s;
}
.final-win__sparkle.s7 {
  left: -5%;
  bottom: 35%;
  width: calc(var(--star-base) * 2.5);
  height: calc(var(--star-base) * 2.5);
  animation-delay: 0.3s, 0.3s;
  animation-duration: 1.58s, 1.58s;
}
.final-win__sparkle.p1 {
  left: 5%;
  bottom: 20%;
  width: calc(var(--star-base) * 2);
  height: calc(var(--star-base) * 2);
  animation-delay: 0.1s;
}
.final-win__sparkle.p2 {
  left: 11%;
  bottom: 35%;
  width: calc(var(--star-base) * 1.3);
  height: calc(var(--star-base) * 1.3);
  animation-delay: 0.7s;
}
.final-win__sparkle.p3 {
  left: 15%;
  bottom: 14%;
  width: calc(var(--star-base) * 1.6);
  height: calc(var(--star-base) * 1.6);
  animation-delay: 0.55s;
}
.final-win__sparkle.p4 {
  right: 12%;
  top: 35%;
  width: calc(var(--star-base) * 1.3);
  height: calc(var(--star-base) * 1.3);
  animation-delay: 0.25s;
}
.final-win__sparkle.p5 {
  right: 9%;
  top: 22%;
  width: calc(var(--star-base) * 1.6);
  height: calc(var(--star-base) * 1.6);
  animation-delay: 0.7s;
}
.final-win__sparkle.p6 {
  right: 18%;
  top: 22%;
  width: var(--star-base);
  height: var(--star-base);
  animation-delay: 0.48s;
}
.final-win {
  /* endregion */
  /* region CONFETTI PIECES */
}
.final-win__confetti-piece {
  position: absolute;
  display: block;
  pointer-events: none;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  animation: win-twinkle 1.45s ease-out infinite;
}
.final-win__confetti-piece svg {
  width: 100%;
  height: 100%;
  display: block;
}
.final-win__confetti-piece.c1 {
  left: -5%;
  top: -10%;
  width: clamp(46px, 5.5vmin, 82px);
  height: clamp(46px, 5.5vmin, 82px);
  animation-duration: 1.45s;
  animation-delay: 0s;
}
.final-win__confetti-piece.c2 {
  right: -8%;
  top: 5%;
  width: clamp(28px, 3.8vmin, 48px);
  height: clamp(28px, 3.8vmin, 48px);
  animation-duration: 1.45s;
  animation-delay: 0.4s;
}
.final-win__confetti-piece.c3 {
  left: 15%;
  top: -15%;
  width: clamp(22px, 3.2vmin, 40px);
  height: clamp(22px, 3.2vmin, 40px);
  animation-duration: 1.45s;
  animation-delay: 0.8s;
}
.final-win__confetti-piece.c4 {
  right: 10%;
  top: -12%;
  width: clamp(40px, 4.5vmin, 72px);
  height: clamp(40px, 4.5vmin, 72px);
  animation-duration: 1.45s;
  animation-delay: 0.2s;
}
.final-win__confetti-piece.c5 {
  left: -10%;
  top: 30%;
  width: clamp(24px, 3.5vmin, 44px);
  height: clamp(24px, 3.5vmin, 44px);
  animation-duration: 1.45s;
  animation-delay: 1.1s;
}
.final-win__confetti-piece.c6 {
  right: -5%;
  top: 45%;
  width: clamp(30px, 4.2vmin, 50px);
  height: clamp(30px, 4.2vmin, 50px);
  animation-duration: 1.45s;
  animation-delay: 0.6s;
}
.final-win__confetti-piece.c7 {
  left: 40%;
  top: -18%;
  width: clamp(34px, 4.8vmin, 58px);
  height: clamp(34px, 4.8vmin, 58px);
  animation-duration: 1.45s;
  animation-delay: 1.4s;
}
.final-win__confetti-piece.c8 {
  right: 30%;
  top: -8%;
  width: clamp(18px, 2.8vmin, 36px);
  height: clamp(18px, 2.8vmin, 36px);
  animation-duration: 1.45s;
  animation-delay: 0.9s;
}
.final-win {
  /* endregion */
}

@media (orientation: landscape) and (max-height: 360px) {
  .final-win__popup {
    width: min(70vw, 400px);
    padding: 24px 30px 20px;
    gap: 8px;
  }
  .final-win .win__congra {
    font-size: clamp(22px, 4.4vw, 26px);
    margin-bottom: 10px;
  }
  .final-win .win__title-won {
    font-size: clamp(28px, 5.2vw, 44px);
  }
  .final-win__mult {
    gap: 4px;
  }
  .final-win .win__amount {
    font-size: clamp(24px, 4.8vw, 40px);
    padding: 4px 10px;
  }
  .final-win__multiplier {
    font-size: clamp(14px, 2.6vw, 20px);
  }
  .final-win__multiplier-value {
    font-size: clamp(14px, 2.6vw, 20px);
  }
  .win__popup {
    padding: 30px 40px;
    gap: 12px;
  }
  .win__amount {
    font-size: clamp(24px, 5vw, 44px);
  }
}
@keyframes win-pop-in {
  0% {
    opacity: 0;
    transform: scale(0.85);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}
@keyframes win-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 1.362px 0 rgba(255, 255, 255, 0.55) inset, 0 0 9.73px rgba(255, 255, 255, 0.6) inset, 0 4px 35px rgba(43, 198, 255, 0.55);
  }
  5% {
    transform: scale(1.07);
    box-shadow: 0 1.362px 0 rgba(255, 255, 255, 0.95) inset, 0 0 22px rgba(255, 255, 255, 0.95) inset, 0 4px 60px rgb(43, 198, 255);
  }
  14% {
    transform: scale(0.975);
    box-shadow: 0 1.362px 0 rgba(255, 255, 255, 0.58) inset, 0 0 10px rgba(255, 255, 255, 0.62) inset, 0 4px 36px rgba(43, 198, 255, 0.55);
  }
  22% {
    transform: scale(1.015);
  }
  50% {
    transform: scale(1.012);
    box-shadow: 0 1.362px 0 rgba(255, 255, 255, 0.65) inset, 0 0 12px rgba(255, 255, 255, 0.7) inset, 0 4px 40px rgba(43, 198, 255, 0.65);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 1.362px 0 rgba(255, 255, 255, 0.55) inset, 0 0 9.73px rgba(255, 255, 255, 0.6) inset, 0 4px 35px rgba(43, 198, 255, 0.55);
  }
}
@keyframes win-pop-out {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-14px) scale(0.99);
    filter: blur(0);
  }
}
@keyframes win-twinkle {
  0% {
    transform: scale(0.55);
    opacity: 0;
  }
  18% {
    transform: scale(1.05);
    opacity: 1;
  }
  55% {
    transform: scale(0.95);
    opacity: 0.95;
  }
  100% {
    transform: scale(1.22);
    opacity: 0;
  }
}
@keyframes win-glow-breath {
  0%, 100% {
    filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
  }
  50% {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.65));
  }
}
@keyframes win-mult-pop {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
    color: #ffffff;
  }
  40% {
    opacity: 1;
    transform: translateY(-4px) scale(1.15);
    color: #5ec5ff;
  }
  70% {
    transform: translateY(2px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    color: #ffffff;
  }
}
@keyframes win-confetti-wobble {
  0% {
    opacity: 0;
    transform: translateX(0) rotate(0deg) scale(0.5);
  }
  12% {
    opacity: 1;
    transform: translateX(10px) rotate(25deg) scale(1.1);
  }
  28% {
    opacity: 0.95;
    transform: translateX(-8px) rotate(-18deg) scale(1);
  }
  45% {
    opacity: 0.85;
    transform: translateX(6px) rotate(12deg) scale(0.95);
  }
  62% {
    opacity: 0.55;
    transform: translateX(-4px) rotate(-8deg) scale(0.85);
  }
  80% {
    opacity: 0.2;
    transform: translateX(2px) rotate(4deg) scale(0.7);
  }
  100% {
    opacity: 0;
    transform: translateX(0) rotate(0deg) scale(0.5);
  }
}
@keyframes borderGradientMove {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 100% 50%;
  }
}
/* === DEV ONLY: force popup visible === */
/* ==================================== */
