/* Partida grátis em modal (index.php). O visual do jogo vem de
   /games/count-masters/game-modal.css (isolado em .cm-game). */
html.cm-demo-open,
html.cm-demo-open body { overflow: hidden !important; }

.cm-demo-modal {
  position: fixed;
  inset: 0;
  z-index: 1150; /* acima das abas (1100); abaixo de depósito/saque (1200+) e suporte */
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: linear-gradient(160deg, #363f56, #20273b 75%);
  opacity: 0;
  transition: opacity .2s ease;
}
.cm-demo-modal[hidden] { display: none; }
.cm-demo-modal.is-open { opacity: 1; }

.cm-demo-frame { position: relative; width: 100%; height: 100%; display: flex; justify-content: center; }

.cm-demo-close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 30;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #526b8c;
  border-radius: 50%;
  background: #263e5ce6;
  color: #fff;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}
.cm-demo-close:hover { background: #31507a; }
.cm-demo-close:focus-visible { outline: 2px solid #7cc4ff; outline-offset: 2px; }

/* O jogo ocupa a altura do modal, como na página própria. */
.cm-game { width: 100%; height: 100%; display: flex; justify-content: center; font-family: 'Nunito Sans', sans-serif; color: #edf3ff; }
.cm-game .game-shell { height: 100%; max-height: 100%; min-height: 0; }
.cm-game footer a[data-cm-demo-close] { cursor: pointer; }

/* ---------------- Tela de resultado ---------------- */
.cm-demo-result {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  background: #0a1222d9;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow-y: auto;
}
.cm-demo-result[hidden] { display: none; }

.cm-demo-card {
  width: min(420px, 100%);
  padding: 22px 20px 18px;
  border: 1px solid #2c4166;
  border-radius: 20px;
  background: linear-gradient(180deg, #16223a, #0f1829);
  box-shadow: 0 24px 70px #000a, inset 0 1px 0 #ffffff14;
  text-align: center;
  font-family: 'Nunito Sans', CountBody, sans-serif;
  color: #edf3ff;
  animation: cm-demo-pop .28s ease both;
}
@keyframes cm-demo-pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.cm-demo-eyebrow { display: block; font-size: 11px; font-weight: 900; letter-spacing: 1.6px; color: #7fa2cf; }
.cm-demo-card h2 { margin: 6px 0 4px; font: 800 30px/1.1 'Baloo 2', CountDisplay, sans-serif; color: #fff; }
.cm-demo-result.is-win h2 { color: #ffd84a; text-shadow: 0 2px 0 #b07a0b; }
.cm-demo-could { margin: 10px 0 2px; font-size: 16px; font-weight: 800; color: #d6e6fb; }
.cm-demo-could strong { display: block; margin-top: 2px; font: 800 38px/1.1 'Baloo 2', CountDisplay, sans-serif; color: #5ee0b4; }
.cm-demo-note { display: block; margin: 4px 0 0; font-size: 12.5px; font-weight: 700; color: #9db3d3; }

.cm-demo-real { margin-top: 18px; padding-top: 16px; border-top: 1px solid #263a5c; }
.cm-demo-real h3 { margin: 0 0 12px; font: 800 22px/1.15 'Baloo 2', CountDisplay, sans-serif; color: #fff; }
.cm-demo-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cm-demo-chips .chip-m {
  position: relative;
  min-height: 46px;
  padding: 12px 4px 8px;
  border: 1px solid #33507a;
  border-radius: 12px;
  background: #182a46;
  color: #fff;
  font: 800 15px/1 'Nunito Sans', sans-serif;
  cursor: pointer;
}
.cm-demo-chips .chip-m.active { border-color: #4fb4ff; background: #1f4a78; box-shadow: 0 0 0 2px #4fb4ff55; }
.cm-demo-chips .badge-m {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 6px;
  background: #ffcf33;
  color: #3b2a00;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: .3px;
  white-space: nowrap;
}
.cm-demo-chips .badge-m.hot { background: #ff5a5f; color: #fff; }
.cm-demo-chips .badge-m.vip { background: #b68cff; color: #1e0b3d; }

.cm-demo-amount {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 0 14px;
  height: 54px;
  border: 1px solid #33507a;
  border-radius: 14px;
  background: #0c1526;
}
.cm-demo-amount span { font-weight: 900; color: #7fa2cf; }
.cm-demo-amount input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: #fff; font: 800 24px/1 'Nunito Sans', sans-serif; outline: none; }
.cm-demo-amount:focus-within { border-color: #4fb4ff; }

.cm-demo-pix,
.cm-demo-again {
  width: 100%;
  margin-top: 12px;
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffd84a, #f5b400);
  box-shadow: 0 4px 0 #b07a0b;
  color: #3b2a00;
  font: 900 16px/1 'Nunito Sans', sans-serif;
  letter-spacing: .3px;
  text-transform: uppercase;
  cursor: pointer;
}
.cm-demo-pix:active,
.cm-demo-again:active { transform: translateY(2px); box-shadow: 0 2px 0 #b07a0b; }
.cm-demo-again { margin-top: 18px; background: linear-gradient(180deg, #4fb4ff, #2a86d6); box-shadow: 0 4px 0 #1b5e99; color: #fff; }

.cm-demo-back {
  display: inline-block;
  margin-top: 14px;
  color: #aedff5;
  font-size: 14px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cm-demo-legal { display: block; margin-top: 10px; font-size: 10.5px; color: #7f93b2; }

@media (max-height: 700px) {
  .cm-demo-card { padding: 16px 16px 14px; }
  .cm-demo-card h2 { font-size: 25px; }
  .cm-demo-could strong { font-size: 32px; }
  .cm-demo-real { margin-top: 12px; padding-top: 12px; }
}

/* ---------------- "Treina para começar!" no painel ---------------- */
.count-train { margin: 14px 0 0; padding: 12px; border: 1px dashed #ffd84a66; border-radius: 14px; background: #ffd84a10; text-align: center; }
.count-train p { margin: 0 0 8px; font-weight: 900; font-size: 15px; color: #ffd84a; letter-spacing: .2px; }
.count-train .count-button { width: 100%; }

/* Durante a partida grátis, nada da home por cima do jogo. */
html.cm-demo-open #notificacao-saque { display: none !important; }
