/* apps/bat/style.css — 할로윈 박쥐 날기: 달밤 보라 하늘 + 호박 주황 + 달빛 노랑 + 유령 연두 포인트, 둥근 글꼴.
 * 모바일 한 줄(--app-width 480px). 글꼴은 언어 파일 fonts → :root 변수(--font-display 등, 생성기가 이 파일 뒤에 둔다).
 * 공통 타이틀 바(G.topBar)·끝 화면(data-mg-end)은 --mg-* 변수로만 색을 맞춘다.
 */
:root {
  --sky-0: #120a2c;
  --sky-1: #24144d;
  --sky-2: #4a2a6e;
  --peach: #ffb066;
  --peach-2: #ff8a3d;
  --pumpkin: #ff9a3c;
  --pumpkin-2: #c8641c;
  --sun: #ffe08a;
  --ghost: #b8f5c8;
  --ink: #fff8f0;
  --ink-dim: rgba(255, 248, 240, 0.8);
  --ink-faint: rgba(255, 248, 240, 0.52);
  --dark: #1a0b28;
  --card: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 154, 60, 0.38);

  --font-display: 'Fredoka', var(--font-sans);
  --display-weight: 600;
  --wb: normal;
  --hyphens: manual;

  /* 공통 타이틀 바 · 언어 선택 */
  --mg-top-fg: var(--ink);
  --mg-top-badge-bg: var(--pumpkin);
  --mg-top-badge-fg: var(--dark);
  --lang-bg: rgba(255, 248, 240, 0.08);
  --lang-fg: var(--ink);
  --lang-border: rgba(255, 154, 60, 0.42);
  /* 공통 끝 화면 */
  --mg-star-on: #ffd36b;
  --mg-star-off: rgba(255, 248, 240, 0.2);
  --mg-heart-bg: rgba(255, 143, 107, 0.12);
  --mg-heart-border: rgba(255, 143, 107, 0.5);
  --mg-heart-fg: var(--peach);
  --mg-heart-on: var(--peach-2);
  --mg-share-bg: rgba(255, 248, 240, 0.06);
  --mg-share-border: rgba(255, 248, 240, 0.16);
  --mg-x: var(--ink);
  --mg-tiktok: var(--ink);
  --mg-faq-bg: rgba(255, 248, 240, 0.05);
  --mg-faq-border: rgba(255, 154, 60, 0.26);
  --mg-end-retry-bg: var(--pumpkin);
  --mg-end-retry-fg: var(--dark);
  --toast-bg: rgba(34, 25, 90, 0.97);
}

html { background: var(--sky-0); }
body.bat-body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 120% 60% at 50% -12%, var(--sky-2), var(--sky-1) 48%, var(--sky-0) 82%) fixed;
  color: var(--ink);
  line-height: 1.6;
  word-break: var(--wb);
  hyphens: var(--hyphens);
  -webkit-hyphens: var(--hyphens);
}
[hidden] { display: none !important; }

/* 제목·버튼 글꼴: base.css 의 :lang(zh|th|vi) 규칙보다 뒤에서 다시 지정 */
.bat-h1, .bat-kicker, .bat-h1-main, .bat-h1-main em, .bat-badge, .bat-btn, .bat-how-txt, .bat-facts,
.bat-hud-label, .bat-hud-val, .bat-hint, .bat-paused-title,
.bat-eyebrow, .bat-score-big, .bat-points, .bat-newbest, .bat-best, .bat-stat dt, .bat-stat dd, .bat-top, .bat-doc h1 {
  font-family: var(--font-display);
}

/* ---------------- 공통 레이아웃 ---------------- */
.bat-shell { max-width: var(--app-width); margin: 0 auto; padding: 8px 16px 0; }
.bat-screen { padding-top: 12px; }

.bat-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 58px;
  padding: 12px 18px;
  border: 3px solid var(--dark); border-radius: 18px;
  font-size: 20px; font-weight: var(--display-weight);
  line-height: 1.25; letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.bat-btn-primary { background: var(--pumpkin); color: var(--dark); box-shadow: 0 5px 0 var(--pumpkin-2), 0 10px 26px rgba(255, 154, 60, 0.28); }
.bat-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--pumpkin-2); }
.bat-field:focus-visible { outline: none; border-color: rgba(255, 224, 138, 0.85); }
.bat-btn:focus-visible, .bat-pause:focus-visible { outline: 3px solid var(--peach); outline-offset: 3px; }
.bat-btn-sm { width: auto; min-height: 50px; padding: 10px 28px; font-size: 18px; }

/* ---------------- 시작 화면 (티징 + 짧은 방법) ---------------- */
.bat-start { text-align: center; padding-top: 14px; }
.bat-badge {
  display: inline-block; margin: 0 0 10px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 179, 138, 0.16); color: var(--peach);
  border: 1.5px solid rgba(255, 179, 138, 0.5);
  font-size: 13px; line-height: 1.35;
}
.bat-hero { position: relative; margin: 0 auto 4px; max-width: 220px; }
.bat-hero-art { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 22px rgba(255, 217, 119, 0.25)); }
.bat-h1 { margin: 12px 0 10px; line-height: 1.15; font-weight: var(--display-weight); }
.bat-kicker {
  display: inline-block; max-width: 100%; margin-bottom: 10px; padding: 3px 12px;
  background: var(--sun); color: var(--dark); border-radius: 8px;
  font-size: 15px; line-height: 1.35; letter-spacing: 0.02em; transform: rotate(-1.5deg);
}
.bat-h1-main { display: block; font-size: 34px; color: var(--ink); overflow-wrap: break-word; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
.bat-h1-main em { font-style: normal; color: var(--peach); }
.bat-hook { margin: 0 auto 16px; max-width: 380px; font-size: 16px; color: var(--ink-dim); }
.bat-how {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 0 0 18px; padding: 0; list-style: none;
}
.bat-how li {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
  padding: 10px 6px; border-radius: 14px;
  background: var(--card); border: 1.5px solid rgba(255, 248, 240, 0.12);
}
.bat-how-ico { font-size: 24px; line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.bat-how-txt { font-size: 13.5px; line-height: 1.25; color: var(--ink); overflow-wrap: break-word; max-width: 100%; }
.bat-facts { margin: 14px 0 0; font-size: 13px; color: var(--ink-faint); letter-spacing: 0.02em; }

/* ---------------- 게임 화면 ---------------- */
.bat-play { padding-top: 6px; }
.bat-hud {
  display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 6px; align-items: stretch;
  margin: 0 auto 8px; max-width: 448px;
}
.bat-hud-box {
  position: relative; display: flex; flex-direction: column; justify-content: center; min-width: 0;
  padding: 4px 10px 5px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); border: 1.5px solid rgba(255, 248, 240, 0.12);
}
.bat-hud-label { font-size: 11px; line-height: 1.2; letter-spacing: 0.06em; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bat-hud-val { font-size: 22px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.bat-hud-score .bat-hud-val { color: var(--sun); }
.bat-pause {
  display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0;
  border-radius: 12px; border: 1.5px solid rgba(255, 248, 240, 0.2); background: rgba(255, 255, 255, 0.08); cursor: pointer;
}
.bat-pause span { display: block; width: 14px; height: 16px; border-left: 5px solid var(--ink); border-right: 5px solid var(--ink); }

.bat-field {
  position: relative; margin: 0 auto; max-width: 448px; height: 440px;
  border-radius: 18px; overflow: hidden; outline: none; cursor: pointer;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  border: 3px solid rgba(255, 154, 60, 0.42);
  background: #2b1957;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.bat-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.bat-hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  max-width: calc(100% - 32px); margin: 0; padding: 6px 16px; border-radius: 999px;
  background: rgba(26, 11, 40, 0.74); color: var(--ink); font-size: 16px; line-height: 1.35; text-align: center;
  pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bat-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  text-align: center; padding: 16px;
}
.bat-paused { background: rgba(18, 10, 44, 0.76); cursor: default; }
.bat-paused-title { margin: 0; font-size: 34px; line-height: 1.2; color: var(--ink); }

/* ---------------- 끝 화면: 점수 카드 ---------------- */
.bat-end { padding-top: 10px; }
.bat-result {
  position: relative; margin: 0 0 22px; padding: 20px 16px 18px; text-align: center;
  border-radius: 24px; border: 2px solid var(--line);
  background: linear-gradient(170deg, rgba(74, 42, 110, 0.92), rgba(36, 20, 77, 0.96));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}
.bat-eyebrow {
  display: inline-block; max-width: 100%; margin: 0 0 6px; padding: 4px 14px; border-radius: 999px;
  background: var(--peach); color: var(--dark); font-size: 16px; line-height: 1.35;
}
.bat-score-line { margin: 4px 0 0; line-height: 1; }
.bat-score-big { font-size: 68px; line-height: 1.05; color: var(--sun); font-variant-numeric: tabular-nums; text-shadow: 0 4px 0 var(--dark); }
.bat-points { font-size: 20px; color: var(--ink-dim); }
.bat-newbest {
  display: inline-block; margin: 10px 0 0; padding: 3px 12px; border-radius: 8px;
  background: var(--sun); color: var(--dark); font-size: 16px; line-height: 1.35; transform: rotate(-2deg);
}
.bat-best { margin: 8px 0 0; font-size: 16px; color: var(--ink-dim); }
.bat-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 0; }
.bat-stat { min-width: 0; padding: 10px 6px; border-radius: 14px; background: var(--card); border: 1.5px solid rgba(255, 248, 240, 0.12); }
.bat-stat dt { font-size: 13px; line-height: 1.3; color: var(--ink-faint); overflow-wrap: break-word; }
.bat-stat dd { margin: 2px 0 0; font-size: 26px; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; }
.bat-rank { margin: 14px 0 0; padding: 12px 10px; border-radius: 14px; background: rgba(255, 154, 60, 0.08); border: 1.5px dashed rgba(255, 154, 60, 0.42); }
.bat-comparing { margin: 0; font-size: 14px; color: var(--ink-faint); }
.bat-top { margin: 0; font-size: 30px; line-height: 1.2; color: var(--ghost); }
.bat-beat { margin: 4px 0 0; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.bat-others { margin: 2px 0 0; font-size: 13px; line-height: 1.4; color: var(--ink-faint); }

/* ---------------- 언어별 ---------------- */
html:lang(th) .bat-h1-main, html:lang(th) .bat-kicker, html:lang(th) .bat-how-txt, html:lang(th) .bat-btn, html:lang(th) .bat-hook, html:lang(th) .bat-hint { line-height: 1.55; letter-spacing: 0; }
html:lang(th) .bat-hud-label, html:lang(th) .bat-stat dt { line-height: 1.5; letter-spacing: 0; }
html:lang(vi) .bat-h1-main, html:lang(vi) .bat-kicker { line-height: 1.3; }
html:lang(ja) .bat-h1-main, html:lang(zh) .bat-h1-main, html:lang(ko) .bat-h1-main { font-size: 32px; line-height: 1.25; }
html:lang(ja) .bat-how-txt, html:lang(zh) .bat-how-txt, html:lang(ko) .bat-how-txt { font-size: 13px; }
html:lang(ru) .bat-h1-main, html:lang(vi) .bat-h1-main { font-size: 31px; }
html:lang(ru) .bat-hud-label { letter-spacing: 0.02em; }

/* ---------------- 개인정보처리방침 ---------------- */
.bat-doc { padding: 16px 0 8px; }
.bat-doc h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 14px; }
.bat-doc h2 { font-size: 17px; margin: 22px 0 6px; color: var(--peach); }
.bat-doc p { color: var(--ink-dim); font-size: 15px; }
.bat-doc a, .site-footer a { color: var(--sun); }

/* ---------------- 움직임 줄이기 ---------------- */
@media (prefers-reduced-motion: reduce) {
  .bat-btn { transition: none; }
}
@media (max-width: 359px) {
  .bat-h1-main { font-size: 29px; }
  .bat-hud-val { font-size: 19px; }
}
