/* sport539-com-tw · midnight baccarat table popup · prefix ball- */
.ball-backdrop,
.ball-backdrop * { box-sizing: border-box; }

.ball-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(120deg, rgba(7, 20, 56, 0.86), rgba(1, 7, 21, 0.93)),
    rgba(1, 7, 21, 0.9);
  opacity: 0;
  transition: opacity 200ms ease;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
}
.ball-backdrop.is-visible { opacity: 1; }

.ball-card {
  position: relative;
  width: min(94vw, 430px);
  max-height: min(94vh, 740px);
  overflow-y: auto;
  border: 1px solid #6778ae;
  border-radius: 18px;
  background: #07132e;
  box-shadow: 0 30px 85px rgba(0, 0, 0, 0.68), 0 0 42px rgba(48, 84, 176, 0.18);
  transform: perspective(850px) rotateX(6deg) translateY(16px);
  transition: transform 240ms ease;
}
.ball-backdrop.is-visible .ball-card { transform: perspective(850px) rotateX(0) translateY(0); }

.ball-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 8;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(196, 211, 255, 0.36);
  border-radius: 9px;
  color: #e8eeff;
  background: rgba(4, 12, 32, 0.75);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.ball-close:focus-visible,
.ball-reveal:focus-visible,
.ball-cta:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.ball-table {
  padding: 28px 24px 20px;
  color: #e9efff;
  background:
    linear-gradient(rgba(128, 152, 222, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(128, 152, 222, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 26%, rgba(28, 74, 142, 0.28), transparent 48%),
    #07132e;
  background-size: 18px 18px, 18px 18px, auto, auto;
}
.ball-heading { padding-right: 34px; text-align: left; }
.ball-brand { color: #8eaaf2; font-size: 10px; font-weight: 900; letter-spacing: 0.2em; }
.ball-title { margin: 7px 0 3px; color: #fff; font-family: Georgia, "Times New Roman", serif; font-size: clamp(27px, 8vw, 38px); line-height: 1.05; }
.ball-desc { margin: 0 0 17px; color: #aebcdf; font-size: 14px; }
.ball-desc strong { color: #dfc079; font-size: 17px; }

.ball-felt {
  position: relative;
  min-height: 250px;
  padding: 24px 18px 18px;
  overflow: hidden;
  border: 2px solid #b29a66;
  border-radius: 160px 160px 18px 18px;
  background:
    radial-gradient(ellipse at 50% 0, rgba(69, 113, 175, 0.34), transparent 56%),
    repeating-linear-gradient(120deg, rgba(255,255,255,0.018) 0 2px, transparent 2px 6px),
    #0a2750;
  box-shadow: inset 0 0 40px rgba(1, 8, 28, 0.68), 0 15px 28px rgba(0, 0, 0, 0.35);
}
.ball-felt::after {
  content: "PLAYER  •  BANKER";
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  color: rgba(196, 211, 255, 0.15);
  font-family: Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-align: center;
}

.ball-card-hand {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: 122px;
  perspective: 700px;
}
.ball-playing-card {
  position: relative;
  width: 82px;
  height: 116px;
  transform-style: preserve-3d;
  transition: transform 720ms cubic-bezier(0.16, 0.82, 0.2, 1);
}
.ball-playing-card-one { transform: translateX(12px) rotate(-7deg) rotateY(0); }
.ball-playing-card-two { transform: translateX(-12px) rotate(7deg) rotateY(0); }
.ball-card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid #e4d7b7;
  border-radius: 8px;
  box-shadow: 0 10px 19px rgba(0, 0, 0, 0.4);
  backface-visibility: hidden;
}
.ball-card-back {
  color: #c5d3fb;
  background:
    linear-gradient(45deg, transparent 46%, rgba(214,225,255,.2) 47% 53%, transparent 54%) 0 0 / 12px 12px,
    #142d69;
  transform: rotateY(0);
}
.ball-card-back span { padding: 4px; border: 1px solid #8fa9ef; font-family: Georgia, serif; font-size: 11px; letter-spacing: 0.08em; }
.ball-card-front {
  color: #151927;
  background: #fffdf4;
  transform: rotateY(180deg);
}
.ball-rank { position: absolute; top: 6px; left: 8px; font-family: Georgia, serif; font-size: 24px; font-weight: 900; }
.ball-suit { color: #101a35; font-size: 39px; }
.ball-red { color: #a71828; }
.ball-felt.is-flipping .ball-playing-card-one,
.ball-felt.is-revealed .ball-playing-card-one { transform: translateX(-4px) rotate(-11deg) rotateY(180deg); }
.ball-felt.is-flipping .ball-playing-card-two,
.ball-felt.is-revealed .ball-playing-card-two { transform: translateX(4px) rotate(11deg) rotateY(180deg); }

.ball-chips {
  position: absolute;
  top: 72px;
  right: 24px;
  width: 62px;
  height: 62px;
}
.ball-chips span {
  position: absolute;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 4px dashed rgba(255,255,255,0.72);
  border-radius: 50%;
  color: #fff;
  background: #334f9e;
  box-shadow: inset 0 0 0 3px #172b63, 0 4px 8px rgba(0,0,0,.35);
  font-size: 12px;
  font-weight: 900;
}
.ball-chips span:nth-child(2) { top: 15px; left: 8px; background: #8c2638; }
.ball-chips span:nth-child(3) { top: 29px; left: -1px; background: #1b6a5c; }

.ball-reveal {
  position: relative;
  z-index: 3;
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 13px;
  padding: 9px 18px;
  border: 2px solid #f1dfa8;
  border-radius: 7px;
  color: #07132e;
  background: linear-gradient(180deg, #f6e8bd, #d4b56c);
  box-shadow: 0 6px 0 #6b5525, 0 11px 20px rgba(0, 0, 0, 0.32);
  font-size: 16px;
  font-weight: 950;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.ball-reveal:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.ball-reveal:disabled { cursor: wait; opacity: 0.9; }
.ball-card[data-interaction-state="complete"] .ball-reveal {
  color: #e9efff;
  border-color: #7898e8;
  background: linear-gradient(180deg, #284c9a, #132c68);
  box-shadow: 0 5px 0 #071633, 0 0 18px rgba(104, 143, 239, 0.32);
  cursor: default;
}
.ball-status {
  position: relative;
  z-index: 3;
  margin: 11px 0 0;
  color: #c8d5f7;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.ball-result {
  position: absolute;
  top: 18px;
  right: 66px;
  left: 66px;
  min-height: 128px;
  z-index: 5;
  display: grid;
  place-content: center;
  gap: 2px;
  text-align: center;
  border: 1px solid rgba(222, 195, 126, 0.62);
  border-radius: 70px 70px 12px 12px;
  color: #fff;
  background: rgba(4, 16, 42, 0.94);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.94);
  transition: opacity 260ms ease, transform 260ms ease, visibility 260ms;
}
.ball-felt.is-revealed .ball-result { opacity: 1; visibility: visible; transform: scale(1); }
.ball-result span { color: #aebde8; font-size: 12px; letter-spacing: 0.12em; }
.ball-result strong { color: #e3c77e; font-family: Georgia, serif; font-size: 68px; line-height: 0.95; text-shadow: 0 0 20px rgba(224, 193, 116, 0.3); }
.ball-result em { color: #fff; font-style: normal; font-size: 13px; }

.ball-offer {
  margin: 15px 0;
  padding: 10px 13px;
  border-left: 3px solid #d9bd76;
  background: linear-gradient(90deg, rgba(218, 190, 118, 0.12), transparent);
  text-align: left;
}
.ball-offer > span { color: #899dd4; font-size: 10px; font-weight: 900; letter-spacing: 0.16em; }
.ball-offer p { display: flex; align-items: baseline; gap: 7px; margin: 3px 0 0; }
.ball-offer b { color: #f4f6ff; font-size: 19px; }
.ball-offer i { color: #8fa0ce; font-style: normal; font-size: 13px; }
.ball-offer strong { color: #e1c478; font-family: Georgia, serif; font-size: 38px; line-height: 1; }
.ball-offer em { color: #e1c478; font-style: normal; font-size: 13px; }

.ball-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 1px solid #e7d6a6;
  border-radius: 7px;
  color: #07132e;
  background: linear-gradient(180deg, #f1dfa9, #c6a55b);
  box-shadow: 0 10px 22px rgba(1, 7, 22, 0.38);
  text-decoration: none;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.03em;
}
.ball-cta:hover { filter: brightness(1.08); transform: translateY(-1px); }
.ball-terms { margin: 13px 0 0; color: rgba(190, 203, 239, 0.62); font-size: 11px; line-height: 1.5; }
.ball-compliance { margin: 5px 0 0; color: rgba(190, 203, 239, 0.54); font-size: 11px; }

@media (max-width: 520px) {
  .ball-backdrop { place-items: end center; padding: 0; }
  .ball-card {
    width: 100%;
    max-height: 94vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }
  .ball-backdrop.is-visible .ball-card { transform: translateY(0); }
  .ball-table { padding: 24px 20px max(18px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .ball-backdrop,
  .ball-card,
  .ball-playing-card,
  .ball-reveal,
  .ball-result { transition: none !important; animation: none !important; }
}
