/* ── js/gb/gb-ui.css ── */
/* gb-ui.css — game-builder 기본틀 UI(첫 화면 셸 · 학교 순위 · 학교 찾기 · 문제 · 모드 카드 · 모드 띠 · 전체화면 단추).
 * 키트 정본 = ~/.claude/skills/game-builder/kit/school-hub/client. 게임은 :root 의 --gb-* 토큰만 덮어 자기 색을 입힌다.
 * 🔴 원칙(2026-10-11 사용자 «심플하고 세련된 UI · 직관적인»): 주 행동 단추 1개 · 같은 종류는 같은 모양 · 장식 띠·배지 남발 금지 ·
 *    글자 ≥ 12px · 누르는 곳 ≥ 44px · 첫 화면 맨 위 = 학교 순위(접지 않음).
 */
:root {
  --gb-bg: #0f1729;
  --gb-panel: rgba(255, 255, 255, 0.055);
  --gb-panel-2: rgba(255, 255, 255, 0.09);
  --gb-line: rgba(255, 255, 255, 0.1);
  --gb-text: #eaf1ff;
  --gb-dim: rgba(234, 241, 255, 0.6);
  --gb-accent: #8fe3c0;
  --gb-accent-ink: #062419;
  --gb-gold: #ffd166;
  --gb-danger: #ff6b6b;
  --gb-radius: 16px;
  --gb-font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
}

/* ── 첫 화면 셸: 머리줄 → 학교 순위 → 주 단추 → 모드 → 보조 줄 ── */
.gb-home { width: 100%; max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; font-family: var(--gb-font); color: var(--gb-text); }
.gb-home-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.gb-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; letter-spacing: -0.3px; }
.gb-brand canvas, .gb-brand img { width: 34px; height: 34px; }
.gb-tools { display: flex; gap: 6px; }
.gb-icon { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--gb-line); background: var(--gb-panel); color: var(--gb-text);
  display: grid; place-items: center; font-size: 20px; cursor: pointer; padding: 0; }
.gb-icon:active { transform: scale(0.94); }
.gb-play { border: 0; border-radius: var(--gb-radius); min-height: 56px; font: 800 18px var(--gb-font); cursor: pointer;
  background: var(--gb-accent); color: var(--gb-accent-ink); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25); }
.gb-play:active { transform: scale(0.98); }
.gb-sub { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.gb-sub > button { min-height: 44px; border-radius: 12px; border: 1px solid var(--gb-line); background: var(--gb-panel); color: var(--gb-text);
  font: 700 13.5px var(--gb-font); cursor: pointer; padding: 6px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-sub > button.done { color: var(--gb-accent); border-color: color-mix(in srgb, var(--gb-accent) 50%, transparent); }

/* ── 학교 순위 카드(첫 화면 맨 위 · 접지 않음) ── */
.gb-rank { background: var(--gb-panel); border: 1.5px solid color-mix(in srgb, var(--gb-gold) 55%, transparent); border-radius: var(--gb-radius);
  padding: 10px 14px 8px; text-align: left; font-family: var(--gb-font); color: var(--gb-text); }
.gb-rank-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.gb-rank-head b { font-size: 15px; color: var(--gb-gold); }
.gb-rank-head small { flex: 1; color: var(--gb-dim); font-size: 12px; }
.gb-tix { font-size: 12.5px; font-weight: 800; color: var(--gb-text); background: var(--gb-panel-2); border-radius: 999px; padding: 2px 9px; }
.gb-rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; font-size: 14px; }
.gb-rank-list li { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.gb-rank-list .pos { flex: 0 0 24px; text-align: center; font-weight: 800; font-size: 13px; color: var(--gb-dim); }
.gb-rank-list li.medal .pos { font-size: 15px; }
.gb-rank-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-rank-list .nm small { color: var(--gb-dim); font-size: 12px; }
.gb-rank-list .pt { font-variant-numeric: tabular-nums; color: var(--gb-gold); }
.gb-rank-list li.me { color: var(--gb-accent); font-weight: 800; }
.gb-rank-list li.sep { border-top: 1px dashed var(--gb-line); margin-top: 3px; padding-top: 3px; }
.gb-rank-list li.dim { color: var(--gb-dim); font-size: 13px; }
.gb-rank-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--gb-line); font-size: 12.5px; }
.gb-mine { color: var(--gb-dim); }
.gb-mine b { color: var(--gb-accent); }
.gb-link { background: none; border: 0; color: var(--gb-accent); font: 700 12.5px var(--gb-font); cursor: pointer; padding: 6px 2px; min-height: 44px; }

/* ── 모드 카드(전부 같은 모양) ── */
.gb-modes { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 8px; }
.gb-mode { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 8px; align-items: center;
  text-align: left; min-height: 76px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--gb-line); background: var(--gb-panel);
  color: var(--gb-text); font-family: var(--gb-font); cursor: pointer; }
.gb-mode:active { transform: scale(0.97); }
.gb-mode-emoji { grid-row: 1 / span 2; width: 28px; height: 28px; line-height: 1; display: grid; place-items: center; color: var(--gb-accent, #ffcf5a); }
.gb-mode-emoji svg { width: 26px; height: 26px; }
.gb-mode-name { font-weight: 800; font-size: 15px; }
.gb-mode-desc { font-size: 12px; color: var(--gb-dim); line-height: 1.3; }
.gb-mode-best { grid-column: 1 / span 2; font-size: 12px; font-weight: 700; color: var(--gb-gold); min-height: 0; }
.gb-mode-best:empty { display: none; }

/* ── 게임 중 모드 띠 ── */
.gb-modebar { display: flex; justify-content: center; align-items: center; gap: 8px; pointer-events: none; font-family: var(--gb-font); font-variant-numeric: tabular-nums; }
.gb-chip { background: rgba(10, 16, 32, 0.72); color: var(--gb-text); border-radius: 12px; padding: 5px 12px; font-weight: 800; font-size: 15px; }
.gb-time { font-size: 20px; }
.gb-time.urgent { color: var(--gb-danger); animation: gbBlink 0.5s steps(2) infinite; }
.gb-hearts i { font-style: normal; }
.gb-hearts i.lost { opacity: 0.25; filter: grayscale(1); }
@keyframes gbBlink { 50% { opacity: 0.55; } }

/* ── 전체 덮개(학교 찾기 · 문제) ── */
/* 🔴 열 = minmax(0,1fr) — auto 열이면 입력칸·단추의 고유 폭이 열을 넓혀 390px 폰에서 창이 오른쪽으로 잘렸다(보카웜 2026-10-12 실측 sheet 434px) */
#gb-layer { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; background: rgba(6, 10, 22, 0.72);
  backdrop-filter: blur(4px); font-family: var(--gb-font); color: var(--gb-text); overflow-y: auto; }
#gb-layer[hidden] { display: none; }
.gb-sheet { width: 100%; max-width: 520px; background: var(--gb-bg); border: 1px solid var(--gb-line); border-radius: 20px; padding: 18px 16px; text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.gb-sheet h2 { margin: 0 0 6px; font-size: 21px; }
.gb-hint { margin: 0 0 12px; color: var(--gb-dim); font-size: 13.5px; line-height: 1.5; }
.gb-hint b { color: var(--gb-text); }
.gb-row { display: flex; gap: 6px; }
.gb-row select, .gb-row input { min-height: 46px; border-radius: 12px; border: 1px solid var(--gb-line); background: var(--gb-panel-2); color: var(--gb-text);
  font: 600 16px var(--gb-font); padding: 0 10px; }
.gb-row input { flex: 1; min-width: 0; user-select: text; -webkit-user-select: text; }
.gb-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.gb-pick { width: 100%; min-height: 46px; text-align: left; border-radius: 12px; border: 1px solid var(--gb-line); background: var(--gb-panel); color: var(--gb-text);
  font: 700 15px var(--gb-font); padding: 8px 12px; cursor: pointer; }
.gb-pick small { color: var(--gb-dim); font-weight: 600; }
.gb-msg { min-height: 20px; margin: 10px 0 0; font-size: 14px; color: var(--gb-dim); }
.gb-msg b { color: var(--gb-gold); }
.gb-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.gb-btn { min-height: 46px; min-width: 110px; border-radius: 12px; border: 0; background: var(--gb-accent); color: var(--gb-accent-ink); font: 800 16px var(--gb-font);
  padding: 0 18px; cursor: pointer; }
.gb-btn.ghost { background: transparent; color: var(--gb-text); border: 1px solid var(--gb-line); }
.gb-btn:disabled { opacity: 0.5; }
.gb-opts { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.gb-seg { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.gb-pill { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--gb-line); background: var(--gb-panel); color: var(--gb-text);
  font: 700 14px var(--gb-font); cursor: pointer; }
.gb-pill.on { background: var(--gb-accent); border-color: var(--gb-accent); color: var(--gb-accent-ink); }
.gb-qprog { display: flex; gap: 6px; justify-content: center; margin: 6px 0 0; }
.gb-qprog i { width: 30px; height: 7px; border-radius: 9px; background: var(--gb-panel-2); }
.gb-qprog i.done { background: var(--gb-accent); }
.gb-qprog i.now { background: var(--gb-gold); }
.gb-qtext { font-size: clamp(26px, 7vw, 40px); font-weight: 800; margin: 16px 0; }
.gb-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gb-choice { min-height: 72px; border-radius: 14px; border: 1px solid var(--gb-line); background: var(--gb-panel-2); color: var(--gb-text); font: 800 22px var(--gb-font); cursor: pointer; }
.gb-choice:active { transform: scale(0.97); }
.gb-review { text-align: left; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.gb-review .no { color: var(--gb-danger); }

@media (max-height: 640px) {
  .gb-home { gap: 8px; }
  .gb-rank { padding: 7px 12px 6px; }
  .gb-rank-list { font-size: 13px; }
  .gb-rank-list li { min-height: 21px; }
  .gb-play { min-height: 50px; font-size: 17px; }
  .gb-mode { min-height: 64px; padding: 8px 10px; }
}
@media (max-width: 350px) {
  .gb-mode-desc { display: none; }
}

/* 분수 = 위아래로 쌓기(kit/frac/frac.css 와 같은 규칙) — 여기 두는 이유: CSP style-src 'self' 게임은 frac.js 의 인라인 <style> 주입이 막힌다 */
.frac{display:inline-flex;flex-direction:column;align-items:center;vertical-align:middle;line-height:1.05;margin:0 .12em;font-size:.9em;font-variant-numeric:tabular-nums}
.frac-n{padding:0 .18em .06em;border-bottom:.09em solid currentColor}.frac-d{padding:.06em .18em 0}.frac-mixed{white-space:nowrap}.frac-mixed>.frac{margin-left:.06em}
/* 키트 화면 안에서는 키트 분수가 이긴다 — 게임이 자기 분수용 .frac(inline-block·top 이동)을 따로 갖고 있으면 뒤에 로드된 그 규칙이
   위 규칙을 덮어 «3 4»처럼 가로로 붙었다(퐁당 낚시 style.css 2026-10-12). id 선택자로 이기고, 게임이 흔히 주는 속성을 되돌린다. */
#gb-layer .frac,[data-gb] .frac{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;vertical-align:middle;position:static;top:auto;float:none;width:auto;height:auto;text-align:center;line-height:1.05}
#gb-layer .frac-n,#gb-layer .frac-d,[data-gb] .frac-n,[data-gb] .frac-d{display:block;position:static;float:none}
/* 보기가 홀수(수학 = 3개)면 마지막 보기를 한 줄 전체로 — 2열 격자에 빈칸이 남아 «하나 빠진» 것처럼 보였다(티샷 사용자 화면) */
#gb-layer .gb-choices > .gb-choice:last-child:nth-child(odd){grid-column:1/-1}

/* 아이콘(gb-icons.js) — 이모지 대신 */
.gb-ic { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }
.gb-ic-ok { color: #6fdc8c; } .gb-ic-no { color: #ff7a6b; }
.gb-hearts i .gb-ic { color: #ff5a6e; } .gb-hearts i.lost .gb-ic { color: rgba(255,255,255,.25); }
.gb-rank-list .pos.m1, .gb-rank-list .pos.m2, .gb-rank-list .pos.m3 { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 900; color: #1b1b1b; }
.gb-rank-list .pos.m1 { background: #ffd34d; } .gb-rank-list .pos.m2 { background: #d7dde6; } .gb-rank-list .pos.m3 { background: #e0a46a; }

/* 1.4.0 — 첫 화면 통계 줄 · 전체 순위(더보기) */
.gb-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 2px 0 6px; padding: 6px 0; border-bottom: 1px solid var(--gb-line); text-align: center; }
.gb-stats span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.gb-stats b { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--gb-text); }
.gb-stats small { font-size: 12px; color: var(--gb-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-more { display: block; width: 100%; text-align: center; }
.gb-rank-all { text-align: left; }
.gb-rank-all h2 { text-align: center; }
.gb-tabs { display: flex; gap: 6px; justify-content: center; margin: 4px 0 8px; }
.gb-tab { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--gb-line); background: transparent; color: var(--gb-text); font: 700 14px var(--gb-font); cursor: pointer; }
.gb-tab.on { background: var(--gb-accent); color: var(--gb-accent-ink); border-color: transparent; }
.gb-rank-scroll { max-height: min(60vh, 520px); overflow-y: auto; padding: 0 4px; }
.gb-rank-scroll li { min-height: 30px; }

/* 첫 화면 맨 아래 선행쌤 링크(1.14.0) — 누르는 곳 ≥44px · 글자 ≥12px */
.gb-site { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; margin: 10px 0 6px; padding: 10px 14px;
  box-sizing: border-box; flex-shrink: 0; border-radius: 16px; text-decoration: none; color: #fff; font: 500 13px var(--gb-font);
  background: linear-gradient(110deg, #6d28d9, #db2777, #f97316, #db2777, #6d28d9); background-size: 300% 100%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35) inset, 0 8px 24px rgba(219, 39, 119, 0.45); animation: gb-site-flow 7s linear infinite; }
.gb-site::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%); transform: translateX(-120%); animation: gb-site-shine 3.2s ease-in-out infinite; }
.gb-site-ic { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px;
  background: rgba(255, 255, 255, 0.22); animation: gb-site-pop 1.6s ease-in-out infinite; }
.gb-site-ic .gb-ic { width: 24px; height: 24px; }
.gb-site-tx { display: flex; flex-direction: column; min-width: 0; flex: 1; text-align: left; line-height: 1.25; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.gb-site-tx b { font-size: 18px; font-weight: 900; letter-spacing: -0.01em; }
.gb-site-tx small { font-size: 13px; font-weight: 600; opacity: 0.95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-site-go { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; min-height: 36px; padding: 0 12px; border-radius: 999px;
  background: #fff; color: #be185d; font-weight: 800; font-size: 13px; }
.gb-site-go .gb-ic { width: 14px; height: 14px; }
.gb-site:hover, .gb-site:focus-visible { filter: brightness(1.08); box-shadow: 0 0 0 2px #fff inset, 0 10px 30px rgba(219, 39, 119, 0.6); }
@keyframes gb-site-flow { to { background-position: 300% 0; } }
@keyframes gb-site-shine { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes gb-site-pop { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.12) rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) { .gb-site, .gb-site::after, .gb-site-ic { animation: none; } }

/* ── css/game.css ── */
/* 새벽등불 마을 — 겨울 동화 톤(밤 남색 · 등불 주황 · 눈 흰색). 글자·단추는 DOM, 월드만 캔버스. */
:root {
  --gb-accent: #ffb347; --gb-accent-ink: #2a1a05; --gb-bg: #1d2a4a; --gb-card: rgba(20, 30, 58, .86); --gb-ink: #f4f7ff; --gb-muted: #b9c6e4; --gb-line: rgba(255, 255, 255, .14);
  --ink: #f4f7ff; --muted: #b9c6e4; --navy: #1d2a4a; --navy2: #14203d; --amber: #ffb347; --amber2: #ff8a3d; --snow: #f4f8ff; --ice: #9fd4ff; --ok: #6fe3a1; --no: #ff8a8a;
  --r: 16px; --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--navy); color: var(--ink); font-family: var(--font); font-size: 15px; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }

/* 로딩 */
.loading { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #30477a, #0d1630); z-index: 50; }
.ld-card { width: min(86vw, 360px); text-align: center; }
.ld-title { font-size: 30px; font-weight: 800; letter-spacing: .02em; color: var(--amber); text-shadow: 0 0 24px rgba(255, 179, 71, .5); }
.ld-bar { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .12); margin: 18px 0 10px; overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber2), var(--amber)); transition: width .2s; }
.ld-msg { color: var(--muted); font-size: 14px; }

/* 첫 화면 — 3D 마을이 뒤에서 천천히 돈다 */
.gb-home { position: fixed; inset: 0; overflow-y: auto; padding: max(12px, env(safe-area-inset-top)) 14px 24px; background: linear-gradient(180deg, rgba(13, 22, 48, .78), rgba(13, 22, 48, .35) 45%, rgba(13, 22, 48, .82)); z-index: 10; }
.gb-home > * { max-width: 560px; margin-left: auto; margin-right: auto; }
.gb-brand { font-size: 24px; font-weight: 800; color: var(--amber); text-shadow: 0 2px 14px rgba(255, 160, 60, .45); }
.buddy { display: flex; gap: 12px; align-items: center; background: var(--gb-card); border: 1px solid var(--gb-line); border-radius: var(--r); padding: 10px 12px; margin: 12px auto; }
.buddy img { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(255, 170, 60, .6)); }
.buddy .bd-name { font-weight: 800; font-size: 16px; }
.buddy .bd-goal { color: var(--muted); font-size: 13px; margin-top: 2px; }
.buddy .bd-bar { height: 7px; background: rgba(255, 255, 255, .12); border-radius: 5px; margin-top: 6px; overflow: hidden; }
.buddy .bd-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber2), var(--amber)); }
.home-foot { color: var(--muted); font-size: 12px; text-align: center; margin-top: 16px; }

/* 마을 HUD */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud > * { pointer-events: auto; }
.topbar { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; display: flex; gap: 6px; align-items: center; }
.tb-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--gb-card); border: 1px solid var(--gb-line); display: grid; place-items: center; flex: none; }
.res { flex: 1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.res::-webkit-scrollbar { display: none; }
.chip { display: flex; align-items: center; gap: 4px; padding: 0 9px; height: 34px; border-radius: 17px; background: var(--gb-card); border: 1px solid var(--gb-line); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 14px; }
.chip.ember { color: var(--amber); border-color: rgba(255, 179, 71, .5); }
.chip.star { color: #ffe27a; }
.chip small { color: var(--muted); font-weight: 600; font-size: 11px; }
.goal { position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 52px); left: 50%; transform: translateX(-50%); max-width: calc(100vw - 20px); min-height: 40px; padding: 8px 14px; border-radius: 20px; background: linear-gradient(90deg, rgba(255, 138, 61, .92), rgba(255, 179, 71, .92)); color: #2a1405; font-weight: 800; display: flex; gap: 8px; align-items: center; box-shadow: 0 6px 20px rgba(255, 140, 50, .35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modak-say { position: absolute; left: 10px; bottom: 92px; max-width: min(70vw, 340px); background: rgba(255, 248, 235, .96); color: #3b2510; padding: 9px 13px; border-radius: 16px 16px 16px 4px; font-weight: 700; font-size: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.side { position: absolute; right: 8px; top: 120px; display: flex; flex-direction: column; gap: 8px; }
.side-btn { position: relative; width: 74px; min-height: 66px; border-radius: 18px; background: var(--gb-card); border: 1px solid var(--gb-line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; }
.side-btn b { font-weight: 800; }
.side-btn .sb-ic .ic { width: 24px; height: 24px; }
.side-btn i { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--amber2); color: #fff; font-style: normal; font-weight: 800; font-size: 12px; display: grid; place-items: center; }
.side-btn i.zero { background: #4a5878; }
.card-btn { color: var(--amber); border-color: rgba(255, 179, 71, .55); box-shadow: 0 0 18px rgba(255, 170, 60, .25); }
.night-btn { color: var(--ice); }
.card-btn.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 28px rgba(255, 170, 60, .7); transform: scale(1.04); } }
.tabs { position: absolute; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 560px; margin: 0 auto; }
.tabs button { min-height: 56px; border-radius: 16px; background: var(--gb-card); border: 1px solid var(--gb-line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 700; }
.tabs button .ic { width: 22px; height: 22px; }
.tabs button.dot::after { content: ""; position: absolute; transform: translate(16px, -18px); width: 9px; height: 9px; border-radius: 50%; background: #ff5d5d; }
.labels, .n-labels { position: absolute; inset: 0; pointer-events: none; }
.lbl { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; padding: 3px 8px; border-radius: 10px; font-size: 11px; background: rgba(14, 22, 44, .82); border: 1px solid var(--gb-line); font-size: 12px; font-weight: 700; white-space: nowrap; min-height: 26px; display: flex; align-items: center; gap: 4px; }
.lbl .pb { width: 46px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.lbl .pb i { display: block; height: 100%; background: var(--amber); }
.lbl.plot { width: 44px; height: 44px; border-radius: 50%; padding: 0; justify-content: center; background: rgba(255, 179, 71, .85); color: #2a1405; border: 2px solid #fff; transform: translate(-50%, -50%); }
.lbl.worker { background: rgba(111, 227, 161, .9); color: #062a16; }

/* 시트(창) */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(6, 10, 24, .45); }
.sh-box { position: relative; width: min(100vw, 600px); max-height: 86vh; overflow-y: auto; background: linear-gradient(180deg, #24355e, #1a2748); border: 1px solid var(--gb-line); border-radius: 22px 22px 0 0; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .4); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 720px) { .sheet { align-items: center; } .sh-box { border-radius: 22px; } }
.sh-x { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .08); }
.sh-title { font-size: 20px; font-weight: 800; margin: 2px 50px 6px 0; display: flex; gap: 8px; align-items: center; }
.sh-sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 800; background: var(--amber); color: #2a1405; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.ghost { background: rgba(255, 255, 255, .1); color: var(--ink); border: 1px solid var(--gb-line); }
.btn.ice { background: var(--ice); color: #0b2238; }
.btn[disabled], .btn.off { opacity: .45; pointer-events: none; }
.btn.wide { width: 100%; }
.cost { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.cost span { display: inline-flex; gap: 3px; align-items: center; padding: 4px 8px; border-radius: 10px; background: rgba(255, 255, 255, .08); font-weight: 700; font-size: 13px; }
.cost span.lack { color: var(--no); }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: rgba(255, 255, 255, .07); border: 1px solid var(--gb-line); border-radius: 14px; padding: 10px; min-height: 64px; text-align: left; display: flex; flex-direction: column; gap: 3px; }
.tile.on { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.tile.lock { opacity: .5; }
.tile b { font-size: 14px; }
.tile small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.tile img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.meter { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber2), var(--amber)); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; margin: 8px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 48px; height: 48px; border-radius: 14px; background: rgba(255, 255, 255, .1); display: grid; place-items: center; }
.stepper b { min-width: 60px; text-align: center; font-size: 18px; }
.hero-card { position: relative; }
.hero-card .role { position: absolute; top: 6px; left: 6px; font-size: 11px; padding: 2px 6px; border-radius: 8px; background: rgba(0, 0, 0, .45); }
.hero-card .lv { font-size: 12px; color: var(--amber); }
.stars { color: #ffe27a; letter-spacing: -1px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.li { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .07); min-height: 56px; }
.li .grow { flex: 1; min-width: 0; }
.li .grow small { display: block; color: var(--muted); font-size: 12px; }
.att { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.att div { aspect-ratio: 1; border-radius: 10px; background: rgba(255, 255, 255, .07); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.att div.got { background: var(--amber); color: #2a1405; }
.att div.big { border: 2px solid #ffe27a; }

/* 육각 안개 지도 */
.hexwrap { width: 100%; aspect-ratio: 1; max-height: 52vh; touch-action: none; border-radius: 16px; background: radial-gradient(circle, #2b416f, #121c36); overflow: hidden; }
.hexwrap svg { width: 100%; height: 100%; }
.hx { stroke: rgba(255, 255, 255, .25); stroke-width: 1; }
.hx.fog { fill: rgba(200, 220, 255, .12); }
.hx.lit { fill: rgba(255, 220, 160, .28); }
.hx.home { fill: rgba(255, 170, 60, .7); }
.hx.path { fill: rgba(111, 227, 161, .6); }
.hx.can { fill: rgba(159, 212, 255, .28); }
.hxi { pointer-events: none; color: #fff; }
.battle { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin: 10px 0; }
.bt-side { display: flex; flex-direction: column; gap: 6px; }
.bt-u { display: flex; gap: 6px; align-items: center; font-size: 12px; padding: 4px; border-radius: 10px; background: rgba(255, 255, 255, .06); }
.bt-u img { width: 34px; height: 34px; object-fit: contain; }
.bt-u .meter { flex: 1; }
.bt-u.ko { opacity: .35; filter: grayscale(1); }
.bt-u.hit { animation: hit .25s; }
@keyframes hit { 30% { transform: translateX(-5px) scale(.96); background: rgba(255, 255, 255, .5); } }

/* 문제 카드 */
.qcard { position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(96vw, 560px); z-index: 15; background: linear-gradient(180deg, rgba(255, 250, 240, .98), rgba(255, 238, 214, .98)); color: #2b1a0a; border-radius: 22px; padding: 12px 14px 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45), 0 0 0 3px rgba(255, 179, 71, .65); animation: up .18s ease-out; }
.qc-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; color: #9a5a17; }
.qc-subj { padding: 2px 8px; border-radius: 8px; background: rgba(255, 160, 60, .2); }
.qc-q { font-size: clamp(18px, 4.6vw, 23px); font-weight: 800; margin: 8px 2px 10px; line-height: 1.35; word-break: keep-all; }
.qc-body .ch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qc-body .ch button { min-height: 54px; border-radius: 14px; background: #fff; border: 2px solid #f1c48a; font-weight: 800; font-size: 17px; color: #2b1a0a; padding: 6px; word-break: keep-all; }
.qc-body .ch button:active { transform: scale(.97); }
.qc-body .ch button.right { background: #c9f7dc; border-color: #2fb36a; }
.qc-body .ch button.wrong { background: #ffd6d6; border-color: #e05a5a; }
.qc-body .drag { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-items: end; }
.qc-body .ember { min-height: 64px; border-radius: 50% 50% 46% 46%; background: radial-gradient(circle at 50% 35%, #fff3c4, #ffb347 55%, #ff7a2e); color: #3a1a00; font-weight: 800; font-size: 16px; display: grid; place-items: center; padding: 6px; box-shadow: 0 4px 14px rgba(255, 120, 40, .45); touch-action: none; user-select: none; word-break: keep-all; }
.qc-body .ember.lift { position: fixed; z-index: 30; pointer-events: none; transform: translate(-50%, -50%) scale(1.15); }
.qc-body .hearth { grid-column: 1 / -1; min-height: 52px; border-radius: 16px; border: 2px dashed #e08a2f; display: flex; align-items: center; justify-content: center; gap: 6px; color: #b05a10; font-weight: 800; }
.qc-body .hearth.over { background: rgba(255, 160, 60, .25); }
.qc-body .np-in { width: 100%; height: 52px; font-size: 26px; font-weight: 800; text-align: center; border-radius: 12px; border: 2px solid #f1c48a; background: #fff; color: #2b1a0a; }
.qc-fb { min-height: 0; font-weight: 800; text-align: center; }
.qc-fb.ok { color: #1b8a4c; } .qc-fb.no { color: #c43c3c; }
.freeze { position: fixed; inset: 0; z-index: 14; display: grid; place-items: center; background: radial-gradient(circle, rgba(159, 212, 255, .2), rgba(60, 120, 200, .45)); pointer-events: none; }
.fz-card { pointer-events: auto; width: min(90vw, 380px); text-align: center; background: rgba(230, 245, 255, .96); color: #0d2a46; border-radius: 22px; padding: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
.fz-t { font-size: 22px; font-weight: 900; }
.fz-ans { margin: 10px 0; padding: 10px; border-radius: 14px; background: #fff; font-size: 18px; font-weight: 800; }
.fz-ans b { color: #1b8a4c; }
.fz-left { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }
.fz-help { margin-top: 8px; min-height: 48px; padding: 0 16px; border-radius: 14px; background: var(--amber); color: #2a1405; font-weight: 800; }
.fz-tip { font-size: 12px; color: #3a5a7a; margin-top: 8px; }

/* 밤 HUD */
.nhud { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.nhud > * { pointer-events: auto; }
.nhud > .n-labels, .hud > .labels { pointer-events: none; }
.n-labels > *, .labels > * { pointer-events: auto; }
.n-top { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: center; }
.n-clock { min-width: 74px; height: 44px; border-radius: 14px; background: var(--gb-card); display: grid; place-items: center; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.n-clock.urgent { color: #ff9b9b; animation: pulse 1s infinite; }
.n-phase { padding: 0 12px; height: 44px; border-radius: 14px; background: var(--gb-card); display: grid; place-items: center; font-weight: 800; color: var(--ice); }
.n-boss { height: 44px; border-radius: 14px; background: var(--gb-card); display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 0 10px; font-weight: 800; font-size: 13px; }
.n-boss .bar { height: 10px; border-radius: 5px; background: rgba(159, 212, 255, .25); overflow: hidden; }
.n-boss .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffb347, #ff6a3d); transition: width .25s; }
.n-mode { grid-column: 1 / -1; }
.n-fires { position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 54px); left: 8px; display: flex; gap: 6px; }
.fire-chip { display: flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 14px; background: var(--gb-card); font-weight: 800; font-size: 13px; color: var(--amber); }
.fire-chip .meter { width: 70px; }
.fire-chip.out { color: var(--no); }
.vwarm { position: absolute; transform: translate(-50%, -100%); min-width: 52px; min-height: 44px; padding: 4px 6px; border-radius: 12px; background: rgba(14, 22, 44, .82); border: 1px solid var(--gb-line); font-size: 11px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; touch-action: none; }
.vwarm .meter { width: 44px; height: 5px; }
.vwarm.cold { border-color: #9fd4ff; color: #9fd4ff; animation: pulse 1s infinite; }
.chop { position: absolute; left: 10px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 4px); width: 92px; height: 92px; border-radius: 50%; background: var(--gb-card); border: 2px solid rgba(255, 179, 71, .5); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; user-select: none; -webkit-user-select: none; touch-action: none; }
.chop small { color: var(--muted); font-size: 11px; }
.chop .ring { width: 40px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .15); overflow: hidden; margin-bottom: 4px; }
.chop .ring i { display: block; height: 100%; width: 0; background: var(--amber); }
.nhud.carded .chop { bottom: 230px; }
.n-help { position: absolute; right: 10px; top: calc(max(8px, env(safe-area-inset-top)) + 54px); display: flex; gap: 4px; }
.n-help span { padding: 6px 10px; border-radius: 12px; background: var(--gb-card); font-size: 12px; font-weight: 800; }
.n-say { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); background: rgba(255, 248, 235, .96); color: #3b2510; padding: 10px 16px; border-radius: 18px; font-weight: 800; font-size: 16px; box-shadow: 0 8px 26px rgba(0, 0, 0, .35); max-width: 86vw; text-align: center; }
.spirit-tap { position: absolute; width: 60px; height: 60px; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid rgba(159, 212, 255, .55); box-shadow: 0 0 14px rgba(159, 212, 255, .5) inset; pointer-events: auto; }

.toast { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 40; background: rgba(14, 22, 44, .92); border: 1px solid var(--gb-line); padding: 10px 16px; border-radius: 16px; font-weight: 800; box-shadow: 0 8px 26px rgba(0, 0, 0, .4); max-width: 90vw; text-align: center; }
.fxlayer { position: fixed; inset: 0; pointer-events: none; z-index: 35; }
.result-stars { font-size: 44px; text-align: center; letter-spacing: 6px; }
.result-stars .ic { width: 48px; height: 48px; }
.result-stars .on { color: #ffe27a; filter: drop-shadow(0 0 10px rgba(255, 220, 100, .7)); }
.result-stars .off { color: rgba(255, 255, 255, .2); }
.bless { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bless button { min-height: 120px; border-radius: 16px; background: linear-gradient(180deg, #2f4a86, #1d2f5a); border: 2px solid rgba(255, 220, 140, .4); padding: 10px 6px; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; }
.bless button b { color: var(--amber); }
.bless button small { color: var(--muted); font-size: 12px; }
.portrait { width: 72px; height: 72px; object-fit: contain; }
.sel { min-height: 44px; border-radius: 12px; background: rgba(255, 255, 255, .1); border: 1px solid var(--gb-line); color: var(--ink); padding: 0 10px; font: inherit; }
textarea.code { width: 100%; min-height: 90px; border-radius: 12px; background: rgba(0, 0, 0, .25); color: var(--ink); border: 1px solid var(--gb-line); padding: 8px; font-family: ui-monospace, monospace; font-size: 11px; }
@media (max-width: 380px) { .side-btn { width: 64px; min-height: 60px; } .chip { padding: 0 7px; font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 480px) { .chip small { display: none; } .chip { padding: 0 7px; } }
.gb-play.is-building { opacity: .85; background: linear-gradient(90deg, #ffb347, #ffd28a); }   /* «loading» 은 로딩 화면(전체 고정) 이름이라 겹치면 단추가 화면을 덮는다 */

/* ── js/kit/juice.css ── */
/* @gb-juice-css v3 — kit/juice/juice.css. 게임 스타일시트 끝에 그대로 붙인다(CSP style-src 'self' 라 JS 가 <style> 을 넣지 않는다). */
.gbj-layer{position:fixed;inset:0;pointer-events:none;z-index:40;overflow:hidden}
.gbj-pop{position:absolute;transform:translate(-50%,-50%) scale(var(--s));font:900 22px/1 system-ui,sans-serif;text-shadow:0 2px 0 #0008,0 0 12px currentColor;white-space:nowrap;animation:gbjPop .9s cubic-bezier(.2,1.6,.4,1) forwards}
@keyframes gbjPop{0%{opacity:0;transform:translate(-50%,-50%) scale(calc(var(--s)*.3))}15%{opacity:1;transform:translate(-50%,-80%) scale(calc(var(--s)*1.35))}35%{transform:translate(calc(-50% + var(--dx)),-120%) scale(var(--s))}100%{opacity:0;transform:translate(calc(-50% + var(--dx)),-260%) scale(calc(var(--s)*.9))}}
.gbj-punch{animation:gbjPunch .32s cubic-bezier(.2,2,.4,1)}
@keyframes gbjPunch{0%{transform:scale(1)}30%{transform:scale(var(--gbj-p))}100%{transform:scale(1)}}
.gbj-flash{position:absolute;inset:0;opacity:0}
.gbj-flash.gbj-go{animation:gbjFlash .35s ease-out forwards}
@keyframes gbjFlash{to{opacity:0}}
/* 가운데 큰 글자 — 자리는 게임이 --gbj-banner-top 으로 옮긴다(HUD 배너·선택 카드와 겹치지 않게 · 2026-10-12 끝까지 진화 실측). 좁은 화면에서 넘치지 않게 vw 로 줄인다  · 튀어나올 때 1.25배라 폭은 76vw(2026-10-14 술래가 번진다: 92vw 면 412px 폰에서 양옆이 잘렸다 — banner-fit 실측) */
.gbj-banner{position:absolute;left:50%;top:var(--gbj-banner-top,40%);transform:translate(-50%,-50%);font:900 clamp(20px,6.4vw,40px)/1.1 system-ui,sans-serif;text-align:center;opacity:0;text-shadow:0 3px 0 #000a,0 0 24px currentColor;max-width:76vw;width:max-content}
.gbj-banner.gbj-go{animation:gbjBan var(--d,1.4s) cubic-bezier(.2,1.5,.4,1) forwards}
@keyframes gbjBan{0%{opacity:0;transform:translate(-50%,-50%) scale(.2) rotate(-8deg)}15%{opacity:1;transform:translate(-50%,-50%) scale(1.25) rotate(2deg)}30%{transform:translate(-50%,-50%) scale(1)}80%{opacity:1}100%{opacity:0;transform:translate(-50%,-70%) scale(1.05)}}
/* v3 타격 묶음(DOM 게임용 — 캔버스 게임은 콜백으로 직접 그린다): 찌그러짐·튕겨남·화면 흔들림·하얀 번쩍 */
/* 한 요소에 셋이 같이 걸린다 — animation 하나를 서로 덮지 않게 갈래마다 칸(--gbj-a1~3)을 따로 둔다 */
.gbj-squash,.gbj-knock,.gbj-hitflash{animation:var(--gbj-a1,none),var(--gbj-a2,none),var(--gbj-a3,none)}
.gbj-squash{--gbj-a1:gbjSquash .28s cubic-bezier(.2,2.2,.4,1)}
@keyframes gbjSquash{0%{transform:scale(1)}25%{transform:scale(1.3,.7)}55%{transform:scale(.88,1.12)}100%{transform:scale(1)}}
.gbj-knock{--gbj-a2:gbjKnock .4s cubic-bezier(.2,1.8,.4,1)}
@keyframes gbjKnock{0%{translate:0 0}25%{translate:var(--kx,14px) var(--ky,0)}60%{translate:calc(var(--kx,14px)*-.25) calc(var(--ky,0px)*-.25)}100%{translate:0 0}}
.gbj-shake{animation:gbjShake .3s linear}
@keyframes gbjShake{0%,100%{translate:0 0}20%{translate:calc(var(--sh,5px)*-1) var(--sh,5px)}40%{translate:var(--sh,5px) calc(var(--sh,5px)*-.6)}60%{translate:calc(var(--sh,5px)*-.6) calc(var(--sh,5px)*-.4)}80%{translate:calc(var(--sh,5px)*.4) calc(var(--sh,5px)*.3)}}
.gbj-hitflash{--gbj-a3:gbjWhite .16s steps(1,end)}
@keyframes gbjWhite{0%{filter:brightness(0) invert(1)}100%{filter:none}}
@media (prefers-reduced-motion:reduce){.gbj-pop,.gbj-banner.gbj-go,.gbj-punch,.gbj-squash,.gbj-knock,.gbj-shake,.gbj-hitflash{animation-duration:.01s}}

/* ── js/story/story.css ── */
/* @gb-story-css v1 — kit/story/story.js 대화창. 게임 스타일시트 끝에 붙인다(정본 = ~/.claude/skills/game-builder/kit/story/story.css).
   변수로 게임 색에 맞춘다: --gbs-box(대화창 바탕) --gbs-ink(글자) --gbs-accent(이름표·선택지 테두리) */
.gbs { position: fixed; inset: 0; z-index: 900; display: block; font-family: inherit; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.gbs[hidden] { display: none; }
.gbs-dim { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 6, 20, .78) 0%, rgba(10, 6, 20, .35) 45%, rgba(10, 6, 20, .15) 100%); }
.gbs-stage { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; pointer-events: none; }
.gbs-face { position: absolute; bottom: calc(clamp(118px, 26vh, 190px) - 14px); height: min(62vh, 520px); max-width: 52vw; object-fit: contain; object-position: bottom; filter: brightness(.55) saturate(.8); transform: translateY(6px) scale(.97); transition: filter .18s, transform .18s; }
.gbs-face[hidden] { display: none; }
.gbs-face.left { left: max(2vw, 8px); transform-origin: bottom left; }
.gbs-face.right { right: max(2vw, 8px); transform-origin: bottom right; }
.gbs-face.speaking { filter: none; transform: none; }
.gbs-face.pop { animation: gbs-pop .22s ease-out; }
@keyframes gbs-pop { 0% { transform: translateY(14px) scale(.94); opacity: .4; } 100% { transform: none; opacity: 1; } }
.gbs-box { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(860px, calc(100vw - 24px)); min-height: clamp(104px, 22vh, 170px); box-sizing: border-box; padding: 26px 22px 18px; border-radius: 20px; background: var(--gbs-box, rgba(34, 22, 52, .95)); color: var(--gbs-ink, #fff6e6); box-shadow: 0 0 0 3px var(--gbs-accent, rgba(255, 214, 107, .75)), 0 14px 34px rgba(0, 0, 0, .45); }
.gbs-name { position: absolute; left: 18px; top: -18px; padding: 5px 16px; border-radius: 12px; background: var(--c, #ffd66b); color: #2a1a3d; font-weight: 800; font-size: 17px; }
.gbs-name[hidden] { display: none; }
.gbs-text { font-size: clamp(18px, 2.6vw, 23px); line-height: 1.55; font-weight: 700; min-height: 2.2em; white-space: pre-line; word-break: keep-all; }
.gbs.narr .gbs-text { font-style: italic; color: var(--gbs-narr, #e5d8ff); text-align: center; }
.gbs-next { position: absolute; right: 18px; bottom: 10px; width: 14px; height: 14px; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg); opacity: 0; }
.gbs.ready .gbs-next { opacity: .85; animation: gbs-bob 0.9s ease-in-out infinite; }
@keyframes gbs-bob { 50% { translate: 0 4px; } }
.gbs-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.gbs-choices:empty { display: none; }
.gbs-choice { min-height: 52px; border-radius: 14px; border: 2px solid var(--gbs-accent, #ffd66b); background: rgba(255, 255, 255, .08); color: inherit; font: inherit; font-size: 19px; font-weight: 800; cursor: pointer; }
.gbs-choice:hover, .gbs-choice:focus-visible { background: rgba(255, 214, 107, .22); outline: none; }
/* 선택지 차례 — 빈 대사 칸·위 여백·«다음» 화살표를 걷어 단추 위아래 여백을 같게(10-20 사용자 «위아래 패딩이 너무 넓다») */
.gbs.choosing .gbs-box { min-height: 0; padding: 16px; }
.gbs.choosing .gbs-text:empty { display: none; }
.gbs.choosing .gbs-text:empty + .gbs-choices { margin-top: 0; }
.gbs.choosing .gbs-next { display: none; }
.gbs-tools { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; display: flex; gap: 8px; }
.gbs-btn { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 12px; border: 0; background: rgba(34, 22, 52, .85); color: #fff6e6; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.gbs-log { position: absolute; inset: 8% 6%; z-index: 2; padding: 18px; border-radius: 18px; background: rgba(20, 12, 34, .96); color: #fff6e6; display: flex; flex-direction: column; gap: 10px; }
.gbs-log[hidden] { display: none; }
.gbs-log-in { flex: 1; overflow: auto; font-size: 17px; line-height: 1.6; }
.gbs-log-in b { color: var(--gbs-accent, #ffd66b); }
.gbs.out { opacity: 0; transition: opacity .18s; }
@media (max-aspect-ratio: 3/4) { .gbs-face { height: min(46vh, 420px); max-width: 64vw; } .gbs-face.left { left: -4vw; } .gbs-face.right { right: -4vw; } }
@media (prefers-reduced-motion: reduce) { .gbs-face, .gbs-face.pop, .gbs.ready .gbs-next { animation: none; transition: none; } }

/* ── js/kit/numpad.css ── */
/* @gb-numpad v1 — numpad.js 의 NUMPAD_CSS 사본(CSP 게임용) */
.gb-numpad{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;width:min(100%,340px);margin:10px auto 0;touch-action:manipulation;user-select:none;-webkit-user-select:none}
.gb-numpad-key{min-height:56px;border-radius:14px;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.08);color:inherit;font:inherit;font-size:1.5rem;font-weight:700;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:transform .06s,background .06s}
.gb-numpad-key.down,.gb-numpad-key:active{transform:scale(.94);background:rgba(255,255,255,.2)}
.gb-numpad-key.del{font-size:1.3rem}.gb-numpad-key.ok{background:linear-gradient(135deg,#1fb5a5,#6a5ae0);border-color:transparent;color:#fff;font-size:1.15rem}
/* 마지막 줄 «확인» 넓히기 — numpad.js NUMPAD_CSS 와 같은 규칙(CSP 게임은 이 파일만 먹는다) */
.gb-numpad-key.wide{grid-column:1/-1}.gb-numpad-key.wide2{grid-column:span 2}

/* ── js/kit/frac.css ── */
/* @gb-frac v1 — frac.js 의 FRAC_CSS 사본. CSP 로 인라인 <style> 이 막힌 게임은 이 파일을 스타일시트에 넣는다. */
.frac{display:inline-flex;flex-direction:column;align-items:center;vertical-align:middle;line-height:1.05;margin:0 .12em;font-size:.9em;font-variant-numeric:tabular-nums}
.frac-n{padding:0 .18em .06em;border-bottom:.09em solid currentColor}.frac-d{padding:.06em .18em 0}.frac-mixed{white-space:nowrap}.frac-mixed>.frac{margin-left:.06em}
