/* =========================================================
   GameBox 공용 스타일
   - 모든 화면(첫 화면·나이대 화면·게임)이 함께 쓰는 것만 둔다:
     색, 글꼴 크기, 윗줄(돌아가기·소리 버튼).
   - 게임 고유의 모양은 각 게임 폴더의 CSS에 둔다.
   ========================================================= */

:root {
  /* 바탕·글자 색 */
  --bg: #fff8ef;
  --ink: #2b2a33;
  --ink-soft: #6b6878;
  --card: #ffffff;
  --line: #e9e1d4;

  /* 나이대별 색 (첫 화면 칸, 나이대 화면 머리에 쓴다) */
  --age-toddler: #ff8a65;
  --age-kinder: #ffc94d;
  --age-lower: #7ccf7a;
  --age-teen: #4fb3e8;
  --age-adult: #8c7ae6;
  --age-senior: #e6739f;

  /* 글꼴 크기 */
  --font-body: 20px;
  --font-big: 28px;
  --font-title: 34px;

  /* 누르는 것의 최소 크기 (PLAN 3절: 유아·시니어 72px, 나머지 48px) */
  --tap-min: 48px;
  --tap-big: 72px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: var(--font-body);
  line-height: 1.5;
  /* 두 번 눌러 확대되는 것을 막는다(핀치 확대는 그대로 된다) */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 윗줄: 돌아가기 · (가운데 내용) · 소리 ---------- */
.gb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  /* 노치 있는 폰의 가로 화면에서 버튼이 가려지지 않게 */
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

/* 둥근 아이콘 버튼 (돌아가기·소리). 유아·시니어 기준인 72px로 모두 맞춘다. */
.gb-iconbtn {
  position: relative;
  flex: none;
  width: var(--tap-big);
  height: var(--tap-big);
  border: none;
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--line);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  /* 길게 누를 때 휴대폰의 글자 선택·메뉴가 뜨지 않게 */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.gb-iconbtn svg { width: 40px; height: 40px; }
.gb-iconbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }

/* 길게 눌러 나가기: 누르는 동안 테두리 고리가 차오른다 */
.gb-back[data-hold] { touch-action: none; }
.gb-iconbtn .gb-hold-ring {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  pointer-events: none;
}
.gb-hold-ring circle {
  fill: none;
  stroke: var(--age-toddler);
  stroke-width: 6;
  stroke-linecap: round;
  /* 원 둘레 = 2π×37 ≈ 233 */
  stroke-dasharray: 233;
  stroke-dashoffset: 233;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
.gb-iconbtn.is-holding .gb-hold-ring circle {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset var(--hold-ms, 1200ms) linear;
}

/* 소리 꺼짐 표시: 스피커 위에 빗금 */
.gb-sound .gb-sound-off { display: none; }
.gb-sound.is-off .gb-sound-on { display: none; }
.gb-sound.is-off .gb-sound-off { display: inline; }

/* 음악 꺼짐 표시: 음표 위에 빗금, 음표는 흐리게 */
.gb-music .gb-music-off { display: none; }
.gb-music.is-off .gb-music-off { display: inline; }
.gb-music.is-off { color: var(--ink-soft); }

/* 윗줄 오른쪽 버튼 묶음(효과음·음악) */
.gb-topbar-right { display: flex; gap: 8px; flex: none; }
