/**
 * demo2 크롬 위에 공통 인증·메뉴팝업·사이트메시지가 보이도록 z-index 보정
 */
.auth-modal-root,
.menu-popup-root,
.site-message-root,
.site-message-layer,
.memo-layer-root,
.mb-div-popup-root {
  z-index: 15000 !important;
}

/* wallet 모달 — 메인 크롬/팝업 위에 표시 (hidden일 때만 숨김) */
body.page-demo2-home #modal-root {
  z-index: 12100;
}
body.page-demo2-home #modal-root[hidden] {
  display: none !important;
}
body.page-demo2-home #modal-root:not([hidden]) {
  display: grid !important;
}

/* 게스트/회원 토글은 PHP body 클래스(is-guest / is-in) 기준 */
body.is-guest .sess {
  display: none !important;
}

body.is-in .auth.is-login,
body.is-in .auth.is-join,
body.is-member .auth.is-login,
body.is-member .auth.is-join {
  display: none !important;
}

body.is-guest .auth.is-login,
body.is-guest .auth.is-join {
  display: inline-flex;
}

.sess-menu nav a.is-out {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: #f0a0a0;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.sess-menu nav a.is-out svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* ── demo2 인증 모달: signal-demo modal-panel 스타일 (공통 auth-modal.css 덮어씀) ── */
.demo2-auth-overlay.mb-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 13000 !important;
  display: grid !important;
  place-items: center;
  padding: 24px;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s;
}

.demo2-auth-overlay.mb-auth-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* 닫기: 오버레이만 페이드 — 패널 opacity 토글 금지(깜빡임 방지) */
.demo2-auth-overlay.mb-auth-overlay.is-open.is-closing,
.demo2-auth-overlay.mb-auth-overlay.is-closing {
  opacity: 0;
  visibility: visible;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s;
}

.demo2-auth-overlay .modal-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: pointer;
}

/* 로그인 모달 가로 — 990의 절반 */
#mb-auth-login-overlay.demo2-auth-overlay .modal-stack {
  width: min(495px, calc(100vw - 48px)) !important;
}

.demo2-auth-overlay .modal-stack {
  position: relative;
  z-index: 1;
  width: min(660px, 100%);
}

.demo2-auth-overlay .modal-stack.is-join {
  width: min(520px, 100%);
}

.demo2-auth-overlay .modal-panel.mb-auth-modal {
  display: block !important;
  position: relative;
  width: 100% !important;
  max-width: none !important;
  max-height: min(90vh, 860px) !important;
  overflow: hidden;
  overflow-y: auto;
  border-radius: 10px !important;
  background: #0c0d18 !important;
  border: 0 !important;
  box-shadow: 0 0 0 1px rgba(162, 77, 255, 0.55), 0 24px 60px rgba(0, 0, 0, 0.55) !important;
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

.demo2-auth-overlay.is-open .modal-panel.mb-auth-modal,
.demo2-auth-overlay .modal-panel.mb-auth-modal.is-closing {
  opacity: 1 !important;
  transform: none !important;
}

.demo2-auth-overlay .mb-auth-honeypot,
#modal-root .mb-auth-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#modal-root[data-open="login"] .demo2-auth-alert,
#modal-root[data-open="join"] .demo2-auth-alert {
  margin-top: 10px;
}
#modal-root[data-open="login"] #www-turnstile-wrap {
  margin: 8px 0 4px;
}

#modal-root[data-open="join"] .demo2-recommend-summary {
  margin: 0 0 14px;
  color: #9b95b5;
  font-size: 13px;
}
#modal-root[data-open="join"] .demo2-recommend-inline-msg:not(.d-none) {
  display: block;
  margin-top: 8px;
  color: #fb7185;
  font-size: 12px;
  font-weight: 700;
}
#modal-root[data-open="join"] .au-hint.is-bad {
  color: #fb7185;
}

.demo2-auth-alert {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.demo2-auth-alert.mb-auth-alert-danger {
  background: rgba(220, 53, 69, 0.16);
  color: #ff8a9a;
  border: 1px solid rgba(220, 53, 69, 0.35);
}

.demo2-auth-alert.mb-auth-alert-success {
  background: rgba(25, 135, 84, 0.16);
  color: #7ddea8;
  border: 1px solid rgba(25, 135, 84, 0.35);
}

.demo2-register-wrap {
  padding: 18px 22px 22px;
}

.demo2-signup-modes {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.demo2-signup-modes button {
  flex: 1;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(162, 77, 255, 0.35);
  background: rgba(12, 13, 24, 0.9);
  color: #c9c3e0;
  font: inherit;
  cursor: pointer;
}

.demo2-signup-modes button.active {
  background: rgba(122, 61, 255, 0.28);
  border-color: #9b5cff;
  color: #fff;
}

.demo2-reg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.demo2-reg-grid .modal-field.is-full,
.demo2-reg-grid .modal-field[data-signup-field="crypto"],
.demo2-reg-grid .modal-field[data-signup-field="telegram"] {
  grid-column: 1 / -1;
}

.demo2-reg-grid .modal-field {
  margin: 0;
}

.demo2-reg-grid .modal-field input,
.demo2-reg-grid .modal-field select {
  width: 100%;
}

@media (max-width: 560px) {
  .demo2-reg-grid {
    grid-template-columns: 1fr;
  }
}

/* demo2 인증 모달·패널 스크롤 — 사이트 톤(다크 + 퍼플) */
.demo2-auth-overlay .modal-panel,
body.page-demo2-home {
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 92, 255, 0.75) rgba(8, 10, 22, 0.95);
}

.demo2-auth-overlay .modal-panel::-webkit-scrollbar,
body.page-demo2-home::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.demo2-auth-overlay .modal-panel::-webkit-scrollbar-track,
body.page-demo2-home::-webkit-scrollbar-track {
  background: rgba(8, 10, 22, 0.95);
  border-radius: 8px;
}

.demo2-auth-overlay .modal-panel::-webkit-scrollbar-thumb,
body.page-demo2-home::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(155, 92, 255, 0.95), rgba(90, 50, 200, 0.85));
  border-radius: 8px;
  border: 2px solid rgba(8, 10, 22, 0.95);
  background-clip: padding-box;
}

.demo2-auth-overlay .modal-panel::-webkit-scrollbar-thumb:hover,
body.page-demo2-home::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #b57cff, #7a3dff);
  border: 2px solid rgba(8, 10, 22, 0.95);
  background-clip: padding-box;
}

.demo2-auth-overlay .modal-panel::-webkit-scrollbar-corner,
body.page-demo2-home::-webkit-scrollbar-corner {
  background: transparent;
}

/* Bootstrap 미로드 메인에서도 단계/알림 숨김이 동작하도록 */
body.page-demo2-home .d-none {
  display: none !important;
}

/* DB 팝업(notice-pops) — 인증/메뉴보다 아래, 페이지 위 */
body.page-demo2-home .notice-pops {
  z-index: 11000;
}

/* 우회주소 팝업 (#demo2-bypass-root) — modal-root와 분리 */
.demo2-bypass-root {
  position: fixed;
  inset: 0;
  z-index: 12600;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  overscroll-behavior: none;
}

.demo2-bypass-root[hidden] {
  display: none !important;
}

.demo2-bypass-root .modal-stack.is-bypass {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
}

.demo2-bypass-root .modal-panel.is-bypass {
  display: flex !important;
}

.demo2-bypass-root .bp-empty {
  margin: 0;
  padding: 18px 12px;
  color: #9b95b5;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

@media (max-width: 860px) {
  .demo2-bypass-root {
    padding: 12px;
  }
  .demo2-bypass-root .modal-stack.is-bypass {
    width: min(400px, 100%);
  }
}

/* 슬롯 게임 리스트 모달 */
.demo2-slot-lobby-root {
  position: fixed;
  inset: 0;
  z-index: 12500;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
}

.demo2-slot-lobby-root[hidden] {
  display: none !important;
}

.demo2-slot-lobby-root .modal-stack.is-slot {
  width: min(1473px, 80vw);
  max-width: 80vw;
  min-width: 0;
}

/* 게임 결과 수와 무관하게 패널 높이 고정 — 본문(.slot-lobby-body)만 스크롤 */
.demo2-slot-lobby-root .modal-panel.is-slot-lobby {
  display: flex !important;
  width: 100%;
  height: min(78vh, 1148px);
  max-height: min(78vh, 1148px);
}

.demo2-slot-lobby-root .slot-provs:not(.is-open) .slot-chip.is-slot-fold:not(.is-more) {
  display: none;
}

.demo2-slot-lobby-root .slot-provs:not(.is-open) .slot-chip.is-more {
  display: inline-flex;
}

.demo2-slot-lobby-root .slot-provs.is-open .slot-chip.is-slot-fold:not(.is-more):not(.is-less) {
  display: inline-flex;
}

.demo2-slot-lobby-root .slot-provs.is-open .slot-chip.is-more {
  display: none;
}

.demo2-slot-lobby-root .slot-provs.is-open .slot-chip.is-less {
  display: inline-flex;
}

.demo2-slot-lobby-root .slot-load-more {
  margin: 16px 0 0;
  color: #9b8ec4;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 980px) {
  .demo2-slot-lobby-root {
    padding: 10px;
    align-items: stretch;
    justify-items: stretch;
  }
  .demo2-slot-lobby-root .modal-stack.is-slot {
    width: 100%;
    max-width: 100%;
  }
  .demo2-slot-lobby-root .modal-panel.is-slot-lobby {
    height: calc(100vh - 20px);
    height: calc(100dvh - 20px);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
  }
}

.demo2-recommend-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 14px;
}

.demo2-recommend-summary-main {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* 추천코드 메시지 — 박스 없이 인라인 (변경 우측 / 다음 아래) */
.demo2-recommend-inline-msg {
  margin: 0;
  padding: 0;
  background: none !important;
  border: none !important;
  color: #ff8a9a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

#register-recommend-step-message.demo2-recommend-inline-msg {
  display: block;
  margin-top: 8px;
}

#register-recommend-step-message.demo2-recommend-inline-msg.d-none {
  display: none !important;
}

.demo2-recommend-summary .demo2-recommend-inline-msg {
  display: inline;
}

/* 헤더 티커 — 데스크톱 절반 폭 중앙 (ticker-below는 전체 폭 유지) */
body.page-demo2-home .topbar-inner > .ticker {
  width: 50%;
  max-width: 50%;
  justify-self: center;
}

/* signal demo2 — 모바일 로그인·회원가입 팝업 상단 프로모 배너 숨김 */
@media (max-width: 860px) {
  body.page-signal-demo2 .modal-panel.is-auth .au-aside {
    display: none !important;
  }
}
