/* 부모 창 — 게임 진행 중 전체 화면 차단 (월드: 골드 액센트) */
.mg-game-block {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  padding: 24px;
}

.mg-game-block-panel {
  width: min(560px, 100%);
  padding: 32px 28px;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: linear-gradient(180deg, #111 0%, #0a0a0a 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.mg-game-block-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.18);
  color: #d4af37;
  font-size: 22px;
}

.mg-game-block-icon.is-hourglass,
.mg-game-block.is-ending .mg-game-block-icon {
  font-size: 28px;
  animation: mg-hourglass-flip 1.5s ease-in-out infinite;
}

.mg-game-block-icon.is-hourglass i,
.mg-game-block.is-ending .mg-game-block-icon i {
  display: block;
  line-height: 1;
}

@keyframes mg-hourglass-flip {
  0%,
  40% {
    transform: rotate(0deg);
  }
  50%,
  90% {
    transform: rotate(180deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.mg-game-block-title {
  margin: 0 0 12px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.mg-game-block.is-ending .mg-game-block-title {
  font-size: 18px;
  line-height: 1.45;
}

.mg-game-block-desc {
  margin: 0 0 24px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  line-height: 1.6;
  white-space: nowrap;
}

.mg-game-block.is-ending .mg-game-block-desc {
  white-space: normal;
}

.mg-game-block-end {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: #d4af37;
  color: #111;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.mg-game-block-end:hover {
  background: #e0c04a;
  filter: brightness(1.05);
  color: #111;
}

.mg-game-block-end:disabled,
.mg-game-block.is-ending .mg-game-block-end {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  pointer-events: none;
  background: #8a7a4a;
  color: #1a1a1a;
}

body.mg-game-blocked {
  overflow: hidden;
}

/* 유자망 — 실행/종료 안내 패널 (PC: 공통 game-launch-block.css 숨김 해제) */
@media (min-width: 992px) {
  body.page-shell.mg-game-blocked:not(.mg-game-same-window) .mg-game-block-panel,
  body.mg-game-blocked:not(.mg-game-same-window) .mg-game-block[data-show-parent-panel="1"] .mg-game-block-panel {
    display: block !important;
  }
}

/* 종료·정산 중 — 전체 오버레이 + 안내 패널 */
body.page-shell .mg-game-block.is-ending {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92) !important;
  pointer-events: auto;
  z-index: 50010;
  padding: 24px;
}

body.page-shell .mg-game-block.is-ending .mg-game-block-panel {
  display: block !important;
}

body.page-shell .mg-game-block.is-ending .mg-game-block-icon,
body.page-shell .mg-game-block.is-ending .mg-game-block-desc {
  display: inline-flex;
}

body.page-shell .mg-game-block.is-ending .mg-game-block-desc {
  display: block;
}

/* 모바일 iframe — 게임 DIV가 하단 「실행 중」 패널보다 위 */
body.page-shell.mg-game-iframe-popup .mg-game-iframe-shell {
  z-index: 50000;
}

body.page-shell.mg-game-iframe-popup .mg-game-block,
body.page-shell.mg-game-iframe-popup .mg-game-block.is-iframe-popup {
  display: flex !important;
  align-items: flex-end;
  justify-content: center;
  background: transparent !important;
  pointer-events: none;
  z-index: 10020;
  padding: 0 12px max(12px, env(safe-area-inset-bottom));
}

body.page-shell.mg-game-iframe-popup .mg-game-block-panel,
body.page-shell.mg-game-same-window .mg-game-block-panel {
  display: block !important;
  pointer-events: auto;
  width: min(560px, 100%);
}

/* 모바일 iframe 폴백 — 유자망 테마 오버레이가 게임을 가리지 않도록 */
body.mg-game-same-window .mg-game-block {
  background: transparent !important;
  pointer-events: none;
  align-items: flex-end;
  padding: 0;
}

body.mg-game-same-window .mg-game-block-panel {
  margin-bottom: max(12px, env(safe-area-inset-bottom));
  padding: 14px 16px 16px;
}

body.mg-game-same-window .mg-game-block-icon,
body.mg-game-same-window .mg-game-block-desc {
  display: none;
}

body.mg-game-same-window .mg-game-block-title {
  margin: 0 0 12px;
  font-size: 16px;
}

body.mg-game-same-window .mg-game-block-end {
  width: 100%;
  min-width: 0;
}

body.page-shell.mg-game-iframe-popup .mg-game-iframe-shell {
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
}

body.page-shell.mg-game-iframe-popup .mg-game-iframe-bar {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 44px;
  padding: max(6px, env(safe-area-inset-top)) 12px 6px;
  background: #111;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: auto;
}

body.page-shell.mg-game-iframe-popup .mg-game-iframe-shell .mg-game-same-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: auto;
  border: 0;
  background: #000;
}

body.page-shell.mg-game-iframe-popup .mg-game-iframe-close--icon {
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}

body.page-shell.mg-game-iframe-popup .mg-game-iframe-close--icon:active {
  background: rgba(255, 255, 255, 0.16);
}

.mg-game-iframe-shell {
  position: fixed;
  inset: 0;
  z-index: 50000;
  display: flex;
  flex-direction: column;
  background: #0b0b0f;
}

.mg-game-iframe-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 48px;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  background: #111;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mg-game-iframe-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #d4af37;
  color: #111;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.mg-game-iframe-close:active {
  filter: brightness(1.05);
}

.mg-game-iframe-shell .mg-game-same-frame {
  position: relative;
  inset: auto;
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  z-index: 1;
  border: 0;
  background: #000;
}
