/* Modal único que hospeda as abas (/apostas, /perfil...) dentro da home. */
html.cm-page-open,
html.cm-page-open body { overflow: hidden !important; }

.cm-page-modal {
  position: fixed;
  inset: 0;
  z-index: 1100; /* acima do topo (1040), abaixo de depósito/saque (1200+) e suporte */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 3vw, 32px);
}
.cm-page-modal[hidden] { display: none; }

.cm-page-backdrop {
  position: absolute;
  inset: 0;
  background: #020817cc;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .2s ease;
}

.cm-page-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1120px, 100%);
  height: min(880px, 100%);
  background: #0b1424;
  border: 1px solid #24354e;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 90px #000b, inset 0 1px 0 #ffffff12;
  opacity: 0;
  transform: translateY(18px) scale(.985);
  transition: opacity .22s ease, transform .22s ease;
}
.cm-page-modal[data-size="narrow"] .cm-page-card { width: min(500px, 100%); height: min(820px, 100%); }

.cm-page-modal.is-open .cm-page-backdrop { opacity: 1; }
.cm-page-modal.is-open .cm-page-card { opacity: 1; transform: none; }

.cm-page-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px 10px 20px;
  background: #0d1729;
  border-bottom: 1px solid #24354e;
}
.cm-page-head h2 {
  margin: 0;
  font: 800 1.05rem/1.2 CountBody, Inter, system-ui, sans-serif;
  letter-spacing: .2px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cm-page-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #526b8c;
  border-radius: 50%;
  background: #263e5c;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.cm-page-close:hover { background: #31507a; }
.cm-page-close:active { transform: scale(.94); }
.cm-page-close:focus-visible { outline: 2px solid #7cc4ff; outline-offset: 2px; }

.cm-page-body { position: relative; flex: 1 1 auto; min-height: 0; background: #071022; }
.cm-page-body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  transition: opacity .18s ease;
}
.cm-page-modal.is-loading iframe { opacity: 0; }

.cm-page-loader {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.cm-page-modal.is-loading .cm-page-loader { display: flex; }
.cm-page-loader span {
  width: 38px;
  height: 38px;
  border: 3px solid #ffffff26;
  border-top-color: #4fb4ff;
  border-radius: 50%;
  animation: cm-page-spin .8s linear infinite;
}
@keyframes cm-page-spin { to { transform: rotate(360deg); } }

/* Celular: tela cheia, acima da barra inferior. */
@media (max-width: 640px) {
  .cm-page-modal { padding: 0; align-items: stretch; }
  .cm-page-card,
  .cm-page-modal[data-size="narrow"] .cm-page-card {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    transform: translateY(24px);
  }
  .cm-page-head { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .cm-page-backdrop, .cm-page-card, .cm-page-body iframe { transition: none; }
}
