/* Game navigation stays in the fullscreen dialog's own layer. */
.chess-dialog .chess-shell {
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}
.in-game-nav {
  position: fixed;
  z-index: 30;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  width: min(540px, calc(100% - 24px));
  padding: 6px;
  border: 1px solid #9cb27055;
  border-radius: 22px;
  background: linear-gradient(145deg, #2d3a2df7, #15231ef7);
  box-shadow:
    0 15px 40px #0009,
    inset 0 1px #e9ffc62b;
  backdrop-filter: blur(20px);
}
.in-game-nav:before {
  content: '';
  position: absolute;
  top: -1px;
  left: 36%;
  width: 28%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #d4ff72, transparent);
  box-shadow: 0 0 18px #bdfa4380;
  animation: game-nav-glow 4s ease-in-out infinite;
  pointer-events: none;
}
.in-game-nav button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 60px;
  min-width: 0;
  border-radius: 16px;
  color: #c1ceb7;
  font-size: 11px;
  font-weight: 700;
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.2s;
}
.in-game-nav button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.in-game-nav button[data-game-panel='deposit'] {
  background: linear-gradient(145deg, #445c30, #283b22);
  color: #d6ff94;
  box-shadow:
    inset 0 1px #b7f36d35,
    0 3px 0 #091405;
}
.in-game-nav button i {
  position: absolute;
  top: 6px;
  right: calc(50% - 28px);
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 12px;
  font-style: normal;
  background: #c3fa4c;
  color: #203112;
}
.in-game-nav button:active {
  transform: translateY(2px);
}
.in-game-nav button.is-active {
  color: #c3fa4c;
  background: #b8f15412;
}
.in-game-nav button:focus-visible,
.game-popup button:focus-visible {
  outline: 2px solid #c3fa4c;
  outline-offset: 3px;
}
.chess-dialog:has(#promotion:not([hidden])) .in-game-nav {
  visibility: hidden;
}
.game-popup {
  width: min(440px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  padding: 24px;
  margin: auto;
  overflow-y: auto;
  color: #edf4e3;
  font-family: inherit;
  border: 1px solid #758d4e88;
  border-radius: 24px;
  background: radial-gradient(ellipse at 95% 0%, #3a4b2b80, transparent 60%), #121e17;
  box-shadow:
    0 32px 90px #000b,
    inset 0 1px #d8f7a822;
  animation: game-panel-enter 0.36s cubic-bezier(0.18, 0.9, 0.25, 1.15);
}
.game-popup::backdrop {
  background: #030906a6;
  backdrop-filter: blur(3px);
}
.game-popup h2 {
  font-size: 25px;
  letter-spacing: -0.8px;
  margin: 10px 0 14px;
  line-height: 1.2;
}
.game-popup .eyebrow {
  font-size: 8px;
  letter-spacing: 1.7px;
  color: #bdd397;
}
.game-popup p {
  font-size: 12px;
  line-height: 1.7;
  color: #b8c5aa;
}
.game-popup-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.game-popup-heading .account-close {
  flex-shrink: 0;
}
.game-library-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 108px 20px 20px;
  margin: 10px 0 18px;
  border: 1px solid #b9db724d;
  border-radius: 18px;
  background: #0c160e;
  box-shadow:
    0 8px 0 -5px #060d09,
    0 20px 30px #0004;
}
.game-library-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  opacity: 0.65;
}
.game-library-card:before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, #08110c 3%, #08110cdd 38%, #08110c00 100%);
}
.game-library-card:after {
  content: '';
  position: absolute;
  inset: -100%;
  z-index: -1;
  background: linear-gradient(115deg, transparent 47%, #e6ffc528 50%, transparent 53%);
  transform: translateX(-35%);
  animation: game-card-shine 6s ease-in-out infinite;
  pointer-events: none;
}
.game-library-status {
  font-size: 10px;
  color: #c3fa4c;
}
.game-library-card h3 {
  font-size: 27px;
  margin: 8px 0 20px;
  letter-spacing: -0.6px;
}
.game-library-empty {
  padding: 30px 0;
}
#game-library-list > .account-secondary {
  margin-bottom: 20px;
}
.leave-game-dialog {
  max-width: 410px;
  animation: account-enter 0.2s ease-out;
}
.leave-amount {
  display: grid;
  gap: 7px;
  padding: 18px;
  margin: 20px 0;
  border: 1px solid #e5a05a4d;
  background: linear-gradient(120deg, #392b19, #1c2216);
  border-radius: 15px;
}
.leave-amount > span {
  font-size: 11px;
  color: #e9d0ae;
}
.leave-amount strong {
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -1.5px;
  color: #ffe3ac;
}
.leave-amount small {
  font-size: 9px;
  color: #bbaa8a;
}
.leave-actions {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}
.leave-confirm {
  width: 100%;
  min-height: 44px;
  padding: 10px;
  border: 1px solid #d78d7b55;
  border-radius: 11px;
  background: #a5432d12;
  color: #efb5a4;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
}
.profile-active-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid #b9e77455;
  border-radius: 16px;
  background: linear-gradient(130deg, #2d4124, #121f18);
  box-shadow:
    inset 0 1px #c6ee9b1c,
    0 4px 0 #070f0a;
}
.profile-active-card:before {
  content: '';
  position: absolute;
  inset: -100%;
  background: linear-gradient(115deg, transparent 47%, #daff9c16 50%, transparent 53%);
  z-index: -1;
  animation: game-card-shine 7s ease-in-out infinite;
}
.profile-active-emblem {
  display: grid;
  place-items: center;
  width: 46px;
  height: 52px;
  background: #0b19138c;
  border: 1px solid #c4f17940;
  border-radius: 14px;
}
.profile-active-emblem svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: #c3fa4c;
  stroke-width: 1.4;
  filter: drop-shadow(0 2px 6px #c3fa4c40);
}
.profile-active-copy {
  display: grid;
  gap: 6px;
}
.profile-active-copy strong {
  font-size: 14px;
}
.profile-active-copy small {
  font-size: 10px;
  color: #b1c69c;
}
.profile-active-copy small:before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 6px;
  background: #c3fa4c;
  box-shadow: 0 0 8px #c3fa4c;
}
#profile-resume-game {
  grid-column: 1/-1;
}
.profile-no-active {
  padding: 16px;
  margin: 0 0 16px;
  border: 1px dashed #63785466;
  border-radius: 12px;
  font-size: 12px;
  color: #acb99d;
  line-height: 1.6;
}
@keyframes game-nav-glow {
  50% {
    opacity: 0.45;
    transform: scaleX(0.65);
  }
}
@keyframes game-card-shine {
  0%,
  35% {
    transform: translateX(-35%);
  }
  75%,
  100% {
    transform: translateX(35%);
  }
}
@keyframes game-panel-enter {
  from {
    opacity: 0;
    transform: perspective(900px) translateY(24px) rotateX(7deg) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (hover: hover) {
  .in-game-nav button:hover {
    color: #d8ff96;
    background-color: #b1ea5420;
    transform: translateY(-2px);
  }
  .game-library-card .account-primary:hover {
    box-shadow: 0 0 24px #c3fa4c30;
  }
}
@media (max-width: 600px) {
  .in-game-nav {
    border-radius: 18px;
    gap: 3px;
    padding: 5px;
  }
  .in-game-nav button {
    font-size: 10px;
    min-height: 57px;
    border-radius: 13px;
  }
  .game-popup {
    padding: 20px;
    border-radius: 20px;
  }
  .game-popup h2 {
    font-size: 23px;
  }
  .game-library-card {
    padding-top: 88px;
  }
  .leave-amount strong {
    font-size: 36px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .game-popup,
  .in-game-nav:before,
  .game-library-card:after,
  .profile-active-card:before {
    animation: none !important;
  }
  .in-game-nav button {
    transition: none;
  }
}
body.motion-off .game-popup,
body.motion-off .in-game-nav:before,
body.motion-off .game-library-card:after,
body.motion-off .profile-active-card:before {
  animation: none;
}
body.page-hidden .in-game-nav:before,
body.page-hidden .game-library-card:after,
body.page-hidden .profile-active-card:before {
  animation-play-state: paused;
}
.game-result {
  position: absolute;
  z-index: 36;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(285px, calc(100% - 28px));
  padding: 20px;
  text-align: center;
  border-radius: 22px;
  border: 1px solid #bddc7780;
  color: #f0f7e4;
  background: radial-gradient(ellipse at 50% 0%, #4b5b26, #142015 75%);
  box-shadow:
    0 18px 45px #000a,
    inset 0 1px #edffc63b;
  animation: result-bounce 0.7s cubic-bezier(0.2, 0.8, 0.2, 1.15);
}
.game-result[hidden] {
  display: none;
}
.game-result .result-emblem {
  display: block;
  font-size: 42px;
  line-height: 1;
  color: #c3fa4c;
  filter: drop-shadow(0 4px 8px #8dbb3540);
  margin-bottom: 13px;
}
.game-result .eyebrow {
  font-size: 7px;
  letter-spacing: 1.3px;
}
.game-result h3 {
  font-size: 23px;
  letter-spacing: -0.8px;
  margin: 10px 0;
}
.game-result p {
  font-size: 11px;
  line-height: 1.7;
  color: #c5d2ae;
  margin: 0 0 17px;
}
.game-result .primary-button {
  width: 100%;
  font-size: 12px;
  min-height: 44px;
  padding: 11px 14px;
  justify-content: center;
  gap: 8px;
}
.game-result .primary-button svg {
  width: 18px;
  height: 18px;
}
.game-result[data-result='win'] {
  border-color: #f5d87c;
  background: radial-gradient(ellipse at 50% 0%, #776124, #182617 75%);
}
.game-result[data-result='win'] .result-emblem {
  color: #ffe397;
}
.game-result[data-result='win'] h3 {
  font-size: 37px;
  color: #ffeaab;
}
.game-result[data-result='loss'] .result-emblem {
  color: #b7c9a6;
}
@keyframes result-bounce {
  0% {
    opacity: 0;
    transform: translate(-50%, 20%) scale(0.6) rotate(-8deg);
  }
  65% {
    opacity: 1;
    transform: translate(-50%, -56%) scale(1.04) rotate(2deg);
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .game-result {
    animation: none;
  }
}
body.motion-off .game-result {
  animation: none;
}
.game-result[data-result='win'] {
  width: min(310px, calc(100% - 22px));
  padding: 17px;
  animation: coin-result-enter 0.35s ease-out;
}
.game-result[data-result='win'] .result-emblem {
  font-size: 25px;
  margin-bottom: 6px;
}
.game-result[data-result='win'] h3 {
  font-size: 31px;
  margin: 6px 0;
}
.game-result[data-result='win'] p {
  font-size: 10px;
  margin-bottom: 10px;
}
.result-payout {
  position: relative;
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
}
.result-payout[hidden] {
  display: none;
}
.result-payout > .sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.coin-scene {
  position: relative;
  height: 220px;
  isolation: isolate;
}
.win-coin-rain {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  max-width: none !important;
}
.win-coin-rain[hidden] {
  display: none;
}
.result-wallet {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 174px;
  height: 98px;
  z-index: 3;
  filter: drop-shadow(0 7px 10px #0007);
}
.wallet-back {
  position: absolute;
  inset: 0 6px 9px;
  border: 1px solid #d6f49f90;
  border-radius: 15px;
  background: linear-gradient(160deg, #9ebc5b, #3c5e2d);
  transform: skewY(-4deg);
}
.wallet-mouth {
  position: absolute;
  top: 8px;
  left: 14px;
  right: 14px;
  height: 20px;
  border: 1px solid #c1da8390;
  border-radius: 8px;
  background: #030b05;
  box-shadow: inset 0 4px 7px #000;
  transform: skewY(-3deg);
}
.wallet-front {
  position: absolute;
  inset: 25px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #caec8a88;
  border-radius: 11px 11px 15px 15px;
  background: linear-gradient(145deg, #5f7e3c, #294526);
  box-shadow:
    inset 0 2px #edffc55e,
    0 5px 0 #122613;
  font-style: normal;
}
.wallet-front > span {
  font-size: 7px;
  letter-spacing: 1.4px;
  color: #d3e7b1;
}
.wallet-front > strong {
  font-size: 29px;
  line-height: 1.1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  color: #f6ffdc;
  text-shadow: 0 2px 2px #0003;
}
.wallet-clasp {
  position: absolute;
  right: -6px;
  top: 50px;
  width: 26px;
  height: 22px;
  border: 1px solid #aacb6c;
  border-radius: 6px;
  background: linear-gradient(130deg, #a3c563, #4f6e34);
  box-shadow: 0 3px 5px #0007;
}
.wallet-clasp:after {
  content: '';
  position: absolute;
  right: 9px;
  top: 7px;
  width: 6px;
  height: 6px;
  background: #efffc7;
  border-radius: 50%;
  box-shadow: 0 1px 3px #0008;
}
.coin-platform {
  position: absolute;
  top: 198px;
  left: 50%;
  transform: translateX(-50%);
  width: min(220px, 90%);
  height: 15px;
  border: 1px solid #ffdf8390;
  border-radius: 50%;
  background: radial-gradient(ellipse, #d0ae504d, #5a54253b 70%);
  box-shadow:
    0 6px 0 #29341b,
    0 11px 22px #0007,
    0 0 22px #ffe77820;
  z-index: 1;
}
.coin-platform:before {
  content: '';
  position: absolute;
  inset: 3px 15px;
  border-top: 1px solid #ffeeb693;
  border-radius: 50%;
}
.result-payout > small {
  font-size: 11px;
  color: #c3fa4c;
}
.wallet-deposited-label {
  min-height: 14px;
  font-size: 9px;
  color: #c7d6ad;
  letter-spacing: 0.2px;
}
.result-payout[data-phase='collecting'] .wallet-mouth {
  box-shadow:
    inset 0 4px 7px #000,
    0 0 16px #c3fa4c55;
}
.result-payout[data-phase='collecting'] .wallet-front {
  border-color: #d8ff8e;
  box-shadow:
    inset 0 2px #e5ffb279,
    0 5px 0 #122613,
    0 0 20px #b5f04b33;
}
.result-payout.is-credited .result-wallet {
  animation: collected-wallet 0.6s ease-out;
}
.result-payout.is-credited .wallet-front > strong {
  animation: collected-amount 0.6s ease-out;
}
.result-payout.is-credited .wallet-deposited-label {
  color: #d9ff9e;
}
.result-payout.is-credited .coin-platform {
  opacity: 0.35;
  transition: opacity 0.5s;
}
@keyframes collected-wallet {
  40% {
    transform: translateX(-50%) scale(1.09);
    filter: drop-shadow(0 0 18px #c7f977a0);
  }
  100% {
    transform: translateX(-50%);
  }
}
@keyframes collected-amount {
  40% {
    color: #fff3ad;
    text-shadow: 0 0 15px #ffdc80b0;
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes coin-result-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (max-width: 380px) {
  .game-result {
    padding: 15px;
  }
  .game-result[data-result='win'] {
    padding: 13px;
  }
  .game-result .result-emblem {
    font-size: 25px;
    margin-bottom: 6px;
  }
  .game-result[data-result='win'] h3 {
    font-size: 27px;
  }
  .wallet-front > strong {
    font-size: 27px;
  }
  .game-result p {
    margin-bottom: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .game-result[data-result='win'],
  .result-payout * {
    animation: none !important;
    transition: none !important;
  }
}
body.motion-off .game-result[data-result='win'],
body.motion-off .result-payout * {
  animation: none !important;
}

.chess-dialog {
  overflow-x: hidden;
}
