/* ── GameHeader 공통 컴포넌트 ──────────────────────────────────
   in-the-dark, end-of-day 등 여러 미니 사이트에서 공유하는
   헤더 아이콘 버튼 + 풀프레임 메뉴 팝업 + 초기화 확인 팝업.

   색상은 전부 커스텀 프로퍼티로 빼뒀으니, 각 사이트는 자기 :root(또는
   .gh-root)에서 --gh-* 값만 다시 정의하면 톤을 맞출 수 있다.
   기본값은 in-the-dark의 다크+골드 테마. */

:root {
  --gh-accent: #ffe8a6;
  --gh-accent-2: #f0c565;
  --gh-on-accent: #1c1408;
  --gh-surface: rgba(20, 17, 13, 0.4);
  --gh-surface-hover: rgba(255, 228, 146, 0.14);
  --gh-icon: rgba(255, 232, 168, 0.75);
  --gh-icon-muted: rgba(255, 255, 255, 0.3);
  --gh-modal-bg: radial-gradient(ellipse at 50% 20%, #1c1a17 0%, #0a0908 78%);
  --gh-modal-border: rgba(255, 228, 146, 0.35);
  --gh-text: rgba(255, 255, 255, 0.62);
  --gh-text-strong: rgba(255, 232, 168, 0.95);
  --gh-kicker: rgba(255, 228, 146, 0.7);
  --gh-divider: rgba(255, 255, 255, 0.12);
  --gh-cancel-bg: rgba(255, 255, 255, 0.08);
  --gh-cancel-bg-hover: rgba(255, 255, 255, 0.14);
  --gh-cancel-text: rgba(240, 236, 228, 0.8);
  --gh-body-text: rgba(240, 236, 228, 0.92);
  --gh-font: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

/* 헤더 좌/우 그룹: 버튼을 절대좌표 하나하나 대신 flex로 배치해서, 방마다
   sound/reset이 빠져도 자리가 안 벌어지고 자연스럽게 당겨진다.
   좌: info만 / 우: sound, locale, reset, leave (순서는 DOM 순서로 정함) */
.gh-header-left,
.gh-header-right {
  position: absolute;
  top: 26px;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 10px;
}

.gh-header-left {
  left: 20px;
}

.gh-header-right {
  right: 20px;
}

.gh-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--gh-surface);
  backdrop-filter: blur(4px);
  color: var(--gh-icon);
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease;
}

.gh-icon-btn svg {
  width: 19px;
  height: 19px;
}

.gh-icon-btn:hover {
  background: var(--gh-surface-hover);
}

.gh-icon-btn:active {
  transform: translateY(1px) scale(0.96);
}

.gh-icon-btn--leave {
  text-decoration: none;
}

.gh-icon-btn--sound.is-muted {
  color: var(--gh-icon-muted);
}

/* 정보(ⓘ) 버튼: 책 소개 팝업을 여는 동작이라 살짝 톤을 줘서 구분하되,
   나머지 아이콘과 같은 크기(44px)로 둬서 헤더가 붐비지 않게 한다. */
.gh-icon-btn--info {
  background: linear-gradient(180deg, var(--gh-accent), var(--gh-accent-2));
  color: var(--gh-on-accent);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.gh-icon-btn--info:hover {
  background: linear-gradient(180deg, var(--gh-accent), var(--gh-accent-2));
  filter: brightness(1.04);
}

.gh-modal[hidden] {
  display: none;
}

.gh-modal {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  padding: 24px;
  overflow-y: auto;
  border-radius: var(--gs-card-radius, 24px);
  background: var(--gh-modal-bg);
  transform: translateX(-100%);
  transition: transform 360ms cubic-bezier(0.22, 0.9, 0.2, 1);
}

.gh-modal.is-visible {
  transform: translateX(0);
}

/* 모바일에서는 shared/game-shell.css의 .game-card와 마찬가지로 화면을
   꽉 채우는 셸이라 둥근 모서리가 어색하게 남는다 — 같은 560px 분기점에서
   없앤다. */
@media (max-width: 560px) {
  .gh-modal {
    border-radius: 0;
  }
}

.gh-modal-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: min(360px, 100%);
  margin: auto;
  padding: 32px 26px 28px;
  text-align: center;
  font-family: var(--gh-font);
}

.gh-modal-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.gh-modal-divider {
  width: 60%;
  height: 1px;
  background: var(--gh-divider);
}

.gh-modal-kicker {
  margin: 0;
  font-family: var(--gh-font);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gh-kicker);
}

.gh-modal-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gh-text-strong);
}

.gh-modal-desc {
  margin: -6px 0 0;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--gh-text);
}

.gh-modal-video {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.gh-modal-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.gh-modal-close {
  position: absolute;
  top: 26px;
  right: 20px;
  z-index: 2;
}

.gh-modal-cover-wrap {
  position: relative;
  width: 100%;
  max-width: 220px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.gh-modal-cover {
  display: block;
  width: 100%;
  border-radius: 0;
}

.gh-modal-cover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 9, 8, 0.80);
  text-align: center;
}

.gh-modal-cover-message {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.6;
  color: #fff;
}

/* CTA 버튼 (그림책 보러가기 등) */
.gh-cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.gh-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  font-family: var(--gh-font);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  color: var(--gh-on-accent);
  background: linear-gradient(180deg, var(--gh-accent), var(--gh-accent-2));
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  transition: transform 120ms ease, filter 150ms ease;
}

.gh-cta:hover {
  filter: brightness(1.05);
}

.gh-cta:active {
  transform: translateY(1px) scale(0.98);
}

.gh-cta-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── 초기화 확인 팝업 ── */
.gh-confirm[hidden] {
  display: none;
}

.gh-confirm {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.gh-confirm.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.gh-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 4, 0.75);
  backdrop-filter: blur(4px);
}

.gh-confirm-card {
  position: relative;
  z-index: 1;
  width: min(320px, 100%);
  padding: 26px 22px 20px;
  border-radius: 20px;
  background: var(--gh-modal-bg);
  border: 1px solid var(--gh-modal-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
  font-family: var(--gh-font);
}

.gh-confirm-text {
  margin: 0 0 20px;
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--gh-body-text);
}

.gh-confirm-actions {
  display: flex;
  gap: 10px;
}

.gh-confirm-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: 999px;
  border: 0;
  font-family: var(--gh-font);
  font-size: 0.88rem;
  cursor: pointer;
  transition: filter 150ms ease, background 150ms ease;
}

.gh-confirm-btn--cancel {
  background: var(--gh-cancel-bg);
  color: var(--gh-cancel-text);
}

.gh-confirm-btn--cancel:hover {
  background: var(--gh-cancel-bg-hover);
}

.gh-confirm-btn--ok {
  background: linear-gradient(180deg, var(--gh-accent), var(--gh-accent-2));
  color: var(--gh-on-accent);
}

.gh-confirm-btn--ok:hover {
  filter: brightness(1.06);
}

/* ── 언어 선택 팝업 (지구본 버튼 클릭 시) ── */
.gh-locale-modal[hidden] {
  display: none;
}

.gh-locale-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.gh-locale-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.gh-locale-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 4, 0.75);
  backdrop-filter: blur(4px);
}

.gh-locale-card {
  position: relative;
  z-index: 1;
  width: min(280px, 100%);
  padding: 16px;
  border-radius: 20px;
  background: var(--gh-modal-bg);
  border: 1px solid var(--gh-modal-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.gh-locale-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--gh-body-text);
  font-family: var(--gh-font);
  font-size: 0.94rem;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease;
}

.gh-locale-option + .gh-locale-option {
  margin-top: 6px;
}

.gh-locale-option:hover {
  background: var(--gh-cancel-bg);
}

.gh-locale-option.is-active {
  background: linear-gradient(180deg, var(--gh-accent), var(--gh-accent-2));
  color: var(--gh-on-accent);
  font-weight: 700;
}

.gh-locale-flag {
  font-size: 1.25rem;
  line-height: 1;
}
