/* ============================================================
   슈가크로스 플레이북 — 스타일 v3 "Bakery Notebook"
   레퍼런스: 크림 모눈 노트 + 핑크 차양 + 흰 라운드 카드 + 골드/핑크/민트 필 버튼
   에셋: assets/sugarcross 시트에서 잘라낸 일러스트(tools/sc/slice_assets.py)
   ============================================================ */
:root {
  --paper: #FFF8EC; --grid: rgba(214, 186, 146, .30);
  --ink: #4A2C20; --ink-soft: #8B6B5C; --line: #5B3B2C;
  --card: #FFFDF9; --lip: #E9D6BC; --lip-d: #D9BE9A;
  --pink: #F28CA6; --pink-d: #D9677F; --pink-l: #FFE6EC;
  --gold: #F6C453; --gold-d: #D89B2B; --gold-l: #FFF2CC;
  --mint: #8ED8BE; --mint-d: #52AE8E; --mint-l: #E2F6EE;
  --sky: #9AD3F0; --sky-d: #5FA9D1; --sky-l: #E4F4FC;
  --orange: #F29A45; --orange-d: #D0752A; --green: #5BC27A;
  --r-xl: 28px; --r-lg: 22px; --r-md: 16px;
  --ol: 2.5px solid var(--line);
  --shadow: 0 4px 0 var(--lip), 0 10px 22px -12px rgba(120, 80, 40, .35);
  --font-display: 'Fredoka', 'Jua', 'Pretendard Variable', system-ui, sans-serif;
  --font-body: 'Pretendard Variable', Pretendard, system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --z-top: 20; --z-dock: 30; --z-modal: 80; --z-toast: 90; --z-fx: 95; --z-splash: 100;
  color-scheme: light;
}

/* ── 모바일 웹 하드닝 (전역 규칙) ───────────────── */
html { overflow-x: clip; -webkit-text-size-adjust: 100%; }
body {
  overflow-x: clip; overscroll-behavior-x: none; overscroll-behavior-y: none; overflow-wrap: break-word;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.scroll-x { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none; }
.scroll-x::-webkit-scrollbar { display: none; }
@media (pointer: coarse) {
  input, select, textarea, [contenteditable],
  input[class], select[class], textarea[class], [contenteditable][class] { font-size: 16px; }
}
button, a, label, select, summary, [role='button'] { touch-action: manipulation; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }

/* ── 기본 ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body); color: var(--ink); font-size: 16px; line-height: 1.45;
  min-height: 100vh; min-height: 100dvh;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px; background-position: -1px -1px;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; max-width: 100%; }
svg { display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; margin: 0; line-height: 1.12; letter-spacing: -.01em; text-wrap: balance; color: var(--ink); }
p { margin: 0; text-wrap: pretty; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.center { text-align: center; }
.choice, .nb, .eq, .gate-q, .key, .total-stars, .plate-n, .cnt { font-variant-numeric: tabular-nums; }

/* 장식: 핑크 차양 + 쿠키 테두리 (페이지 전체 폭) */
.awning-top { height: clamp(52px, 10vw, 92px); background: url('../assets/ui/awning.webp') top center / auto 100% repeat-x; pointer-events: none; }
.cookie-border { height: clamp(48px, 9vw, 80px); margin-top: 8px; background: url('../assets/ui/border_cookies.webp') bottom center / auto 100% repeat-x; pointer-events: none; }

.app { max-width: 640px; margin: -18px auto 0; padding: 0 16px 24px; }
.screen { display: none; }
.screen.active { display: block; }
.screen.active > :not(.topbar) { animation: rise .4s var(--ease-spring) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ── 공용 표면 ── */
.card { display: block; width: 100%; text-align: left; background: var(--card); border: var(--ol); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.btn {
  --c1: #FFFFFF; --c2: #FBF3E6; --d: var(--lip-d);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 0 24px;
  font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--ink);
  background: linear-gradient(180deg, var(--c1), var(--c2)); border: var(--ol); border-radius: 999px;
  box-shadow: 0 4px 0 var(--d), inset 0 3px 0 rgba(255,255,255,.7);
  transition: transform .12s var(--ease-spring), box-shadow .12s, filter .15s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--d); }
.btn.gold { --c1: #FCDD86; --c2: #F3BE4C; --d: var(--gold-d); }
.btn.pink { --c1: #F9B5C6; --c2: #EE8AA3; --d: var(--pink-d); }
.btn.mint { --c1: #B4E9D5; --c2: #82D2B5; --d: var(--mint-d); }
.btn.orange { --c1: #F8B66E; --c2: #F0943E; --d: var(--orange-d); color: #fff; }
.btn.danger { --c1: #FFB3B8; --c2: #F2808A; --d: #C2505B; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 4px; font-weight: 500; }
.btn.ghost:active { transform: none; box-shadow: none; }
.btn.small { min-height: 46px; font-size: 16px; padding: 0 18px; }
.btn.big { min-height: 60px; font-size: 21px; width: 100%; }
.btn:disabled { filter: grayscale(.5); opacity: .6; }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.kicker { font-family: var(--font-display); font-weight: 600; color: var(--pink-d); font-size: 14px; }

.char { position: relative; display: inline-grid; place-items: center; width: var(--s); height: var(--s); flex: none; }
.char img { width: var(--s); height: var(--s); max-width: none; object-fit: contain; }
.char-svg { filter: drop-shadow(0 3px 2px rgba(91,59,44,.18)); }
.prop-img { position: relative; display: inline-grid; place-items: center; flex: none; }
.prop-img img { width: 100%; height: 100%; object-fit: contain; }
.prop-label { position: absolute; left: 50%; top: 50%; translate: -50% -50%; min-width: 1.7em; padding: 0 .2em; display: grid; place-items: center; aspect-ratio: 1; font-family: var(--font-display); font-weight: 700; font-size: 1.15em; color: var(--ink); background: #FFF2CC; border: 2px solid var(--line); border-radius: 50%; }
.prop-svg { flex: none; }
.ui-btn { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%; transition: transform .14s var(--ease-spring); }
.ui-btn .ui-img { width: 48px; height: 48px; filter: drop-shadow(0 3px 0 rgba(91,59,44,.25)); }
.ui-btn:active { transform: scale(.9); }

/* ── 스플래시 ── */
.splash {
  position: fixed; inset: 0; z-index: var(--z-splash); display: grid; place-items: center; padding: 24px; overflow: hidden; cursor: pointer;
  background: url('../assets/ui/awning.webp') top center / auto clamp(60px, 12vw, 110px) repeat-x, url('../assets/ui/border_cookies.webp') bottom center / auto clamp(56px, 10vw, 90px) repeat-x,
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 28px 28px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 28px 28px, var(--paper);
  transition: opacity .45s, visibility .45s;
}
.splash.gone { opacity: 0; visibility: hidden; }
.splash-inner { position: relative; text-align: center; max-width: 440px; }
.splash-logo { width: min(330px, 84%); height: auto; margin: 0 auto 8px; animation: bob 3s ease-in-out infinite; }
.splash-kicker { display: inline-block; font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink); padding: 4px 14px; background: var(--card); border: var(--ol); border-radius: 999px; }
.splash-art { display: flex; justify-content: center; align-items: flex-end; margin: 20px 0 4px; min-height: 130px; }
.splash-art .char { margin: 0 -14px; animation: bob 3s ease-in-out infinite; }
.splash-art .char:nth-child(2) { transform: translateY(-8px) scale(1.15); z-index: 1; animation-delay: .4s; }
.splash-art .char:nth-child(3) { animation-delay: .8s; }
.splash-cta {
  display: inline-block; margin-top: 18px; padding: 15px 32px; font-family: var(--font-display); font-weight: 700; font-size: 21px; color: var(--ink);
  background: linear-gradient(180deg, #FCDD86, #F3BE4C); border: var(--ol); border-radius: 999px; box-shadow: 0 5px 0 var(--gold-d);
  opacity: .4; transition: opacity .3s;
}
.splash.ready .splash-cta { opacity: 1; animation: pulse 1.6s ease-in-out infinite; }
.splash-note { margin-top: 12px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
@keyframes bob { 50% { translate: 0 -6px; } }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* ── 상단 바 ── */
.topbar {
  position: sticky; top: 0; z-index: var(--z-top); display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 10px; margin: 0 -16px 6px;
  background: linear-gradient(180deg, var(--paper) 70%, rgba(255,248,236,0));
}
.tb-space { flex: 1; }
.pf-switch { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--card); border: var(--ol); border-radius: 999px; box-shadow: 0 3px 0 var(--lip); }
.pf-dot { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; overflow: hidden; transition: background .15s; }
.pf-dot .char img { border-radius: 50%; object-fit: cover; }
.pf-dot.on { background: var(--pink-l); box-shadow: inset 0 0 0 2.5px var(--pink); }
.pf-dot.add { font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--ink-soft); }
.chip {
  min-width: 44px; height: 44px; padding: 0 12px; display: grid; place-items: center; flex: none;
  font-family: var(--font-display); font-weight: 600; font-size: 16px; background: var(--card); border: var(--ol); border-radius: 999px; box-shadow: 0 3px 0 var(--lip);
}
.chip.round { padding: 0; font-size: 20px; }
.chip.on { background: var(--gold-l); }
.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--lip); }
.star-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 44px; padding: 0 14px 0 8px; flex: none;
  font-family: var(--font-display); font-weight: 700; font-size: 18px; background: var(--card); border: var(--ol); border-radius: 999px; box-shadow: 0 3px 0 var(--lip);
}
button.star-pill:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--lip); }
.sign, .unlock-all { display: none; }

/* ── 홈 ── */
.home-grid { display: block; }
.home-side { display: none; }
.home-main { padding-bottom: calc(96px + var(--safe-b)); }
.home-hero { position: relative; display: flex; align-items: flex-end; gap: 8px; margin: 6px 0 -26px; z-index: 2; pointer-events: none; }
.hh-copy { flex: 1; padding-bottom: 36px; }
.hh-copy h1 { font-size: clamp(30px, 9vw, 42px); line-height: 1.04; }
.hh-copy p { margin-top: 6px; color: var(--ink-soft); font-size: 15px; font-weight: 500; }
.hh-char { flex: none; pointer-events: auto; filter: drop-shadow(0 6px 4px rgba(91,59,44,.15)); }

.season-banner {
  position: relative; display: flex; align-items: center; width: 100%; min-height: 168px; padding: 26px 14px 16px 18px; overflow: hidden; text-align: left;
  background: radial-gradient(circle at 82% 70%, color-mix(in srgb, var(--theme) 45%, #fff) 0%, transparent 55%), linear-gradient(100deg, var(--card) 40%, #FFF3E2);
  border: var(--ol); border-radius: var(--r-lg); box-shadow: var(--shadow);
  transition: transform .14s var(--ease-spring);
}
.season-banner:active { transform: translateY(3px); }
.sb-copy { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sb-copy small { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.sb-copy b { font-family: var(--font-display); font-weight: 700; font-size: 23px; line-height: 1.15; max-width: 12em; word-break: keep-all; }
.play-btn { align-self: flex-start; margin-top: 10px; padding: 9px 18px; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .02em;
  background: linear-gradient(180deg, #F8B66E, #F0943E); border: var(--ol); border-radius: 14px; box-shadow: 0 3px 0 var(--orange-d); }
.sb-art { position: relative; flex: none; width: 46%; height: 132px; }
.sb-tree { position: absolute; right: 22%; bottom: -4px; width: 96px; height: auto; }
.sb-props { position: absolute; left: 0; bottom: -2px; display: flex; align-items: flex-end; gap: 0; }
.sb-art .char { position: absolute; right: -6px; bottom: -8px; }
.new-flag { position: absolute; top: 10px; right: -2px; padding: 4px 14px 4px 18px; font-family: var(--font-display); font-weight: 700; font-size: 14px; color: #fff;
  background: #E8566A; border: 2px solid var(--line); border-right: 0; clip-path: polygon(10px 50%, 0 0, 100% 0, 100% 100%, 0 100%); }

.ch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.ch-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 10px 12px; text-align: center;
  background: var(--card); border: var(--ol); border-radius: var(--r-lg); box-shadow: var(--shadow);
  transition: transform .14s var(--ease-spring), box-shadow .14s;
  animation: rise .45s var(--ease-spring) backwards; animation-delay: calc(var(--i) * 50ms + .1s);
}
.ch-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lip); }
.ch-card.locked { background: #FFF1F4; }
.ch-art { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1.15; border-radius: 16px;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--theme) 30%, #fff) 0%, transparent 70%); }
.ch-art .lm-img, .ch-art .lm-svg { width: 92%; height: 92%; object-fit: contain; }
.ch-card.locked .ch-art .lm-img, .ch-card.locked .ch-art .lm-svg { filter: saturate(.75) opacity(.9); }
.free-tag { position: absolute; top: 9px; right: 9px; z-index: 1; padding: 2px 10px; font-family: var(--font-display); font-weight: 700; font-size: 12.5px; color: #fff; background: var(--green); border: 2px solid var(--line); border-radius: 999px; }
.ch-lock { position: absolute; right: 2px; bottom: 0; z-index: 1; filter: drop-shadow(0 3px 0 rgba(91,59,44,.2)); }
.ch-lock .lock-img, .ch-lock svg { width: 50px; height: 50px; }
.ch-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 1.2; margin-top: 4px; }
.ch-name em { display: block; font-style: normal; font-weight: 600; font-size: 12px; color: var(--ink-soft); }
.ch-sub { font-size: 11.5px; line-height: 1.3; color: var(--ink-soft); }
.ch-foot { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.ch-stars { display: flex; gap: 1px; }
.st { padding: 2px 10px; font-family: var(--font-display); font-weight: 600; font-size: 12px; border: 2px solid var(--line); border-radius: 999px; }
.st.done { background: var(--gold-l); }
.st.play { background: var(--card); }
.st.new { background: var(--mint-l); }
.st.lock { background: var(--pink-l); color: var(--pink-d); border-color: color-mix(in srgb, var(--pink-d) 60%, var(--line)); }
.foot { margin: 22px 0 0; text-align: center; color: var(--ink-soft); font-size: 13px; font-weight: 500; }

.dock {
  position: fixed; left: 50%; bottom: calc(10px + var(--safe-b)); z-index: var(--z-dock); translate: -50% 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(560px, calc(100% - 28px)); padding: 7px;
  background: rgba(255,253,249,.96); border: var(--ol); border-radius: 26px; box-shadow: 0 6px 0 var(--lip), 0 16px 30px -12px rgba(91,59,44,.45);
}
.screen:not(#screen-home) .dock, #screen-home:not(.active) .dock { display: none; }
.dock-btn { display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; min-height: 58px; padding: 4px 10px; font-family: var(--font-display); font-weight: 700; font-size: 15px;
  background: var(--card); border: 2px solid var(--line); border-radius: 18px; box-shadow: 0 3px 0 var(--lip); }
.dock-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--lip); }
.dock-gacha { width: 34px; height: auto; }
.dock-chars { display: flex; }
.dock-chars .char { margin-right: -12px; }
.dock-chars .char img { border-radius: 50%; object-fit: cover; background: var(--pink-l); border: 2px solid #fff; }
.dock-btn .dock-chars { margin-right: 8px; }

/* 진행 바 */
.bar { position: relative; display: block; height: 14px; margin-top: 8px; background: #F4E8D6; border: 2px solid var(--line); border-radius: 999px; }
.bar i { display: block; height: 100%; border-radius: 999px; background: repeating-linear-gradient(-45deg, #F8CF68 0 8px, #F3BE4C 8px 16px); transition: width .5s var(--ease-spring); }

/* ── 챕터 화면 ── */
.ch-head {
  position: relative; display: flex; gap: 12px; align-items: center; min-height: 170px; padding: 16px; overflow: hidden;
  background: linear-gradient(90deg, rgba(255,253,249,.96) 0%, rgba(255,253,249,.88) 52%, rgba(255,253,249,.25) 100%), var(--scene, none) center / cover, color-mix(in srgb, var(--theme) 30%, #fff);
  border: var(--ol); border-radius: var(--r-xl); box-shadow: var(--shadow);
}
.ch-lm { position: relative; flex: none; width: 124px; height: 124px; display: grid; place-items: center; background: color-mix(in srgb, var(--theme) 28%, #fff); border: var(--ol); border-radius: 50%; }
.ch-lm .lm-img, .ch-lm .lm-svg { width: 118px; height: 118px; object-fit: contain; }
.ch-copy { position: relative; flex: 1; min-width: 0; }
.ch-kicker { font-family: var(--font-display); font-weight: 600; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--pink-d); }
.ch-copy h1 { font-size: 25px; margin: 2px 0 4px; }
.ch-copy p:not(.ch-kicker) { color: var(--ink-soft); font-size: 13.5px; font-weight: 500; }
.ch-count { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.host-line { display: flex; align-items: flex-end; gap: 4px; margin: 12px 0 6px; }
.host-btn { flex: none; transition: transform .15s var(--ease-spring); }
.host-btn:active { transform: scale(.94); }
.bubble { position: relative; flex: 1; margin-bottom: 26px; padding: 12px 15px; font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 1.38;
  background: var(--card); border: var(--ol); border-radius: 20px 20px 20px 6px; box-shadow: 0 3px 0 var(--lip); }
.game-list { display: grid; gap: 12px; margin-top: 4px; }
.game-tile { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; text-align: left; background: var(--card); border: var(--ol); border-radius: var(--r-lg); box-shadow: var(--shadow);
  transition: transform .14s var(--ease-spring), box-shadow .14s; animation: rise .4s var(--ease-spring) backwards; animation-delay: calc(var(--i) * 60ms + .1s); }
.game-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lip); }
.game-tile.soon { opacity: .65; }
.gt-ic { flex: none; width: 66px; height: 66px; display: grid; place-items: center; border-radius: 20px; border: var(--ol); background: color-mix(in srgb, var(--theme) 30%, #fff); }
.gt-copy { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.gt-copy b { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.boss { font-style: normal; font-family: var(--font-display); font-weight: 700; font-size: 12px; color: #fff; background: #E8566A; padding: 2px 9px; border-radius: 999px; border: 2px solid var(--line); }
.boss-tile { background: linear-gradient(120deg, var(--card) 55%, var(--pink-l)); }
.gt-stars { display: flex; align-items: center; gap: 3px; flex-basis: 100%; }
.gt-stars small { color: var(--ink-soft); font-size: 13px; margin-left: 4px; font-weight: 600; }
.gt-go { width: 42px; height: 42px; display: grid; place-items: center; flex: none; padding-left: 3px; font-size: 18px; color: #fff; background: linear-gradient(180deg, #F8B66E, #F0943E); border: var(--ol); border-radius: 50%; box-shadow: 0 3px 0 var(--orange-d); }
.soon .gt-go { display: none; }
.reward-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 14px; background: rgba(255,253,249,.8); border: 2.5px dashed var(--line); border-radius: var(--r-md); }
.reward-row:not(.got) .rw-art img, .reward-row:not(.got) .rw-art svg { filter: brightness(0) opacity(.25); }
.reward-row.got { background: var(--gold-l); border-style: solid; }
.reward-row p { font-size: 14px; font-weight: 600; color: var(--ink-soft); }

/* ── 게임 화면 ── */
.game-bar { position: sticky; top: 0; z-index: var(--z-top); display: grid; grid-template-columns: 48px 1fr 48px auto; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 10px; margin: 0 -16px 4px; background: linear-gradient(180deg, var(--paper) 72%, rgba(255,248,236,0)); }
.game-bar .star-pill { padding: 0 12px 0 6px; font-size: 16px; }
/* 와플 진행바: 와플 격자 + 분홍 아이싱 */
.wafer {
  position: relative; justify-self: center; display: flex; gap: 2px; padding: 9px 12px 6px; max-width: 260px;
  background: repeating-linear-gradient(45deg, rgba(160,100,30,.25) 0 2px, transparent 2px 12px), repeating-linear-gradient(-45deg, rgba(160,100,30,.25) 0 2px, transparent 2px 12px), linear-gradient(180deg, #F3CB7E, #E3AC55);
  border: var(--ol); border-radius: 14px; box-shadow: 0 3px 0 var(--lip-d);
}
.wafer::before { content: ''; position: absolute; left: -2px; right: -2px; top: -3px; height: 12px; border-radius: 12px 12px 8px 8px;
  background: radial-gradient(circle at 10% 100%, #F9C6D3 5px, transparent 5.5px) 0 4px / 26px 12px repeat-x, #F9C6D3; border: 2px solid var(--line); border-bottom: 0; }
.w-star { position: relative; display: grid; place-items: center; }
.w-star svg { width: clamp(22px, 7vw, 30px); height: auto; }
.w-star:not(.on) svg path { fill: #C98E45; stroke: rgba(91,59,44,.6); }
.game-title { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.game-title h2 { flex: 1; font-size: 22px; }
.gh-ic { flex: none; width: 46px; height: 46px; display: grid; place-items: center; background: color-mix(in srgb, var(--theme) 30%, #fff); border: var(--ol); border-radius: 14px; }
.gt-count { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-display); font-weight: 700; padding: 4px 10px; background: var(--card); border: 2px solid var(--line); border-radius: 999px; }
.modes { display: flex; gap: 8px; margin: 0 -16px 10px; padding: 2px 0 6px; }
.modes::before, .modes::after { content: ''; flex: 0 0 8px; }
.mode { flex: none; min-height: 44px; padding: 0 16px; font-family: var(--font-display); font-weight: 600; font-size: 15px; background: var(--card); border: 2px solid var(--line); border-radius: 999px; box-shadow: 0 3px 0 var(--lip); }
.mode.on { background: var(--gold-l); box-shadow: 0 0 0 2px var(--gold), 0 3px 0 var(--lip); }

/* 스테이지 = 와플 테두리 액자 */
.stage {
  position: relative; padding: 12px; min-height: 320px;
  background: #FFFBF3; border: 9px solid #EBC88E; border-radius: var(--r-xl);
  box-shadow: 0 0 0 2.5px var(--line), inset 0 0 0 2px rgba(91,59,44,.35), 0 8px 0 var(--lip), 0 18px 30px -14px rgba(120,80,40,.4);
}
.stage.staged { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "talk" "board" "answers"; }
.stage.staged.no-answers { grid-template-areas: "talk" "board"; }
.soon-msg { padding: 60px 0; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 24px; }

.prompt { grid-area: talk; display: flex; align-items: center; gap: 8px; }
.prompt p {
  position: relative; flex: 1; order: 1; font-family: var(--font-display); font-weight: 600; font-size: clamp(16px, 4.4vw, 19px); line-height: 1.35;
  padding: 11px 14px; background: #fff; border: var(--ol); border-radius: 20px 20px 6px 20px; box-shadow: 0 3px 0 var(--lip);
}
.prompt-host { order: 2; flex: none; }
.prompt-host .char img { border-radius: 50%; object-fit: cover; background: color-mix(in srgb, var(--theme) 25%, #fff); border: 2.5px solid var(--line); }
.prompt-body { display: none; }

.board {
  grid-area: board; position: relative; min-width: 0; padding: 14px 10px; border: var(--ol); border-radius: 20px; overflow: hidden;
  background: var(--scene, none) center / cover, color-mix(in srgb, var(--theme) 22%, #fff);
}
.board::before { content: ''; position: absolute; inset: 0; background: rgba(255,253,249,.42); pointer-events: none; }
.board > * { position: relative; }
.stage:not(.staged) > .board { display: none; }

.choices { grid-area: answers; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choices.sym { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choices.shapes, .choices.bulbs { grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); }
.choices.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice {
  --c1: #FCDD86; --c2: #F3BE4C; --d: var(--gold-d);
  position: relative; min-height: 64px; display: grid; place-items: center; padding: 6px 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 32px; color: var(--ink);
  background: linear-gradient(180deg, var(--c1), var(--c2)); border: var(--ol); border-radius: 999px;
  box-shadow: 0 4px 0 var(--d), inset 0 3px 0 rgba(255,255,255,.55);
  transition: transform .12s var(--ease-spring), box-shadow .12s, filter .2s;
}
.choice:nth-child(4n+2) { --c1: #F9B5C6; --c2: #EE8AA3; --d: var(--pink-d); }
.choice:nth-child(4n+3) { --c1: #B4E9D5; --c2: #82D2B5; --d: var(--mint-d); }
.choice:nth-child(4n+4) { --c1: #C3E6F8; --c2: #92CBEB; --d: var(--sky-d); }
.choice:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--d); }
.choices.wide .choice { font-size: 21px; }
.choices.sym .choice { font-size: 40px; }
.choices.shapes .choice, .choices.bulbs .choice { border-radius: 22px; --c1: #fff; --c2: #FBF3E6; --d: var(--lip-d); }
.choice.right { --c1: #8FE3B4; --c2: #4FC487; --d: #2E9561; color: #fff; text-shadow: 0 2px 0 rgba(20,90,50,.35); animation: pop .4s var(--ease-spring); box-shadow: 0 4px 0 var(--d), 0 0 0 4px rgba(79,196,135,.3); }
.choice.wrong { filter: grayscale(.85); opacity: .5; transform: translateY(3px); box-shadow: 0 1px 0 var(--d); }
.choice .shape-svg { width: 74px; height: 74px; }
.shake { animation: shake .4s; }
.pop { animation: pop .4s var(--ease-spring); }
.bounce { animation: bounce .55s var(--ease-spring); }
@keyframes shake { 20% { translate: -7px 0; } 40% { translate: 7px 0; } 60% { translate: -5px 0; } 80% { translate: 4px 0; } }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
@keyframes bounce { 35% { transform: translateY(-12px) scale(1.06); } 100% { transform: none; } }
.eq { margin-top: 12px; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 30px; }
.eq-q { display: inline-block; min-width: 1.3em; padding: 0 8px; color: var(--pink-d); background: #fff; border: 2.5px dashed var(--pink); border-radius: 12px; }
.frost { background: rgba(255,253,249,.9); border: 2px solid var(--line); border-radius: var(--r-md); }

/* 숫자판 */
.nb-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 4px; padding: 6px; background: rgba(255,253,249,.92); border: 2px solid var(--line); border-radius: 14px; }
.nb { aspect-ratio: 1; display: grid; place-items: center; min-width: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(12px, 3.5vw, 18px);
  background: #fff; border: 1.5px solid #E6D3B8; border-radius: 9px; transition: transform .12s var(--ease-spring), background .15s; }
button.nb:active { transform: scale(.9); }
.nb.seen { background: var(--gold-l); border-color: #EBCB7C; }
.nb.on { background: var(--gold); border-color: var(--line); transform: scale(1.12); z-index: 1; }
.nb.target { border-color: #CFA977; }
.nb.lit { background: var(--pink-l); border-color: #F2B6C5; }
.nb.hop { background: var(--pink); color: #fff; border-color: var(--line); animation: pop .3s var(--ease-spring); }
.nb.hint { animation: pulse .5s 3; background: var(--gold-l); }
.nb.cover { background: #FFF3DF; border: 1.5px dashed #D9A867; }
.nb.cover svg, .nb.cover .prop-img { width: 84%; height: 84%; }
.nb.glow { border: 2.5px solid var(--pink); box-shadow: 0 0 0 3px rgba(242,140,166,.35); animation: pulse 1.2s ease-in-out infinite; }
.nb.reveal { background: var(--pink); color: #fff; border-color: var(--line); animation: pop .4s var(--ease-spring); }
.nb-info { min-height: 120px; margin-top: 12px; padding: 12px; text-align: center; background: rgba(255,253,249,.94); border: 2px solid var(--line); border-radius: var(--r-md); }
.nb-big { font-family: var(--font-display); font-weight: 700; font-size: 54px; line-height: 1; color: var(--pink); -webkit-text-stroke: 2px var(--line); paint-order: stroke fill; }
.nb-words { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0 10px; }
.nb-words span { font-family: var(--font-display); font-weight: 600; padding: 2px 11px; font-size: 15px; border: 2px solid var(--line); border-radius: 999px; }
.nb-words span:nth-child(1) { background: var(--gold-l); }
.nb-words span:nth-child(2) { background: var(--sky-l); }
.nb-words span:nth-child(3) { background: var(--pink-l); }
.tens { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ten-row { display: flex; gap: 1px; padding: 2px 5px; background: #FFF1DA; border: 1.5px solid #EBCB9A; border-radius: 9px; }
.ten-row.ones { background: transparent; border-color: transparent; }
.nb-progress { margin-top: 10px; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: 16px; }

/* 콕콕 세기: 장면 위에 바로 흩뿌림 */
.count-field { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(3, 76px); gap: 4px; padding: 6px; }
.item { position: relative; display: grid; place-items: center; translate: var(--jx) var(--jy); rotate: var(--rot); transition: transform .2s var(--ease-spring); filter: drop-shadow(0 4px 2px rgba(91,59,44,.25)); }
.item:active { transform: scale(.88); }
.item.on { transform: scale(.9); }
.item.on > :first-child { filter: saturate(.7) brightness(.95); }
.item .tag { position: absolute; top: -2px; right: 2px; min-width: 28px; height: 28px; display: none; place-items: center; background: var(--pink); color: #fff; border: 2px solid var(--line); border-radius: 50%; font-family: var(--font-display); font-size: 16px; font-weight: 700; rotate: calc(var(--rot) * -1); }
.item.on .tag { display: grid; animation: pop .35s var(--ease-spring); }

/* 10프레임: 와플 트레이 이미지 */
.tenframe { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(2, 1fr); gap: 2.2% 1.6%;
  width: min(100%, 420px); aspect-ratio: 478 / 220; margin: 0 auto; padding: 5.6% 5.4% 6.2% 5.4%;
  background: url('../assets/ui/tray.webp') center / 100% 100% no-repeat; filter: drop-shadow(0 6px 4px rgba(91,59,44,.25)); }
.tf { display: grid; place-items: center; border-radius: 50%; min-width: 0; }
.tf .prop-img, .tf .prop-svg { width: 88% !important; height: 88% !important; }
.tf.q { margin: 8%; font-family: var(--font-display); font-weight: 700; font-size: clamp(16px, 5vw, 24px); color: var(--pink-d); background: rgba(255,255,255,.85); border: 2.5px dashed var(--pink-d); }

/* 비교 */
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.vs .side { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; min-height: 196px; background: rgba(255,253,249,.92); border: 2px solid var(--line); border-radius: var(--r-md); }
.vs .side .char img { border-radius: 50%; object-fit: cover; background: var(--sky-l); border: 2px solid var(--line); }
.vs .side:last-child .char img { background: var(--pink-l); }
.pile { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 132px; }
.cnt { font-family: var(--font-display); font-weight: 700; font-size: 28px; }
.vs-mid { width: 54px; height: 54px; display: grid; place-items: center; background: linear-gradient(180deg, #FCDD86, #F3BE4C); border: var(--ol); border-radius: 50%; box-shadow: 0 3px 0 var(--gold-d); }
.vs-q { font-family: var(--font-display); font-weight: 700; font-size: 30px; }

/* 도형 */
.shape-stage { display: grid; place-items: center; padding: 4px; }
.shape-stage .shape-svg { width: min(240px, 66vw); height: auto; filter: drop-shadow(0 6px 0 rgba(91,59,44,.15)); }
.shape-stage.done { animation: pop .45s var(--ease-spring); }
.corner { cursor: pointer; }
.corner .dot { fill: #fff; transition: fill .15s; }
.corner.on .dot { fill: var(--pink); }
.sx-count { text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 21px; margin-top: 4px; }

/* 기차 패턴 */
.train { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; align-items: end; padding: 12px 6px 16px;
  background: linear-gradient(180deg, transparent 78%, #9C6B3F 78% 84%, transparent 84%), rgba(255,253,249,.85); border: 2px solid var(--line); border-radius: var(--r-md); }
.car { position: relative; display: grid; place-items: center; aspect-ratio: .8; background: #fff; border: 2px solid var(--line); border-radius: 9px 9px 4px 4px; box-shadow: inset 0 -4px 0 var(--pink-l); }
.car.engine { background: transparent; border: 0; box-shadow: none; }
.car.engine svg { width: 100%; height: auto; }
.car.miss { background: var(--gold-l); border-style: dashed; box-shadow: none; }
.car .q { font-family: var(--font-display); font-size: 22px; color: var(--pink-d); font-weight: 700; }
.bulb { position: relative; display: grid; place-items: center; width: 100%; }
.car .bulb svg, .car .bulb .prop-img { width: 100% !important; height: auto !important; aspect-ratio: 1; }
.bulb i { position: absolute; bottom: 6%; font-style: normal; font-size: 11px; color: #fff; text-shadow: 0 0 2px var(--line), 0 0 2px var(--line); }
.choices.bulbs .bulb i { font-size: 15px; }

/* 쌓기나무 */
.iso-stage { display: grid; place-items: center; }
.iso-stage .iso-svg { width: min(260px, 70vw); height: auto; filter: drop-shadow(0 8px 0 rgba(91,59,44,.14)); }
.build-wrap { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.build-wrap .iso-svg { width: min(220px, 50vw); }
.bpad-grid { display: grid; grid-template-columns: repeat(3, 48px); gap: 6px; transform: rotate(45deg) scaleY(.85); margin: 18px 14px; }
.bpad { width: 48px; height: 48px; display: grid; place-items: center; background: #fff; border: 2px solid var(--line); border-radius: 11px; box-shadow: 0 3px 0 var(--lip-d); }
.bpad.has { background: linear-gradient(180deg, #F8D58A, #EBB457); box-shadow: 0 3px 0 #C98522; }
.bpad b { transform: rotate(-45deg); font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.bpad:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--lip-d); }
[data-act=minus].on { --c1: #F9B5C6; --c2: #EE8AA3; --d: var(--pink-d); }
.board .row { margin-top: 12px; }
@media (max-width: 400px) {
  .build-wrap { grid-template-columns: 1fr; justify-items: center; }
  .stage { padding: 8px; border-width: 7px; }
  .board { padding: 10px 6px; }
  .nb-grid { gap: 3px; padding: 4px; }
}

/* 나누기 */
.tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 64px; padding: 10px; background: rgba(255,241,218,.94); border: 2px solid var(--line); border-radius: var(--r-md); }
.plates { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 8px; margin-top: 12px; }
.plate { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; min-height: 158px; background: rgba(255,255,255,.95); border: var(--ol); border-radius: 50% 50% 22px 22px / 28% 28% 22px 22px; box-shadow: 0 4px 0 var(--lip-d); transition: transform .12s var(--ease-spring); }
.plate:active { transform: translateY(3px); }
.plate .char img { border-radius: 50%; object-fit: cover; background: var(--pink-l); border: 2px solid var(--line); }
.plate-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 1px; max-width: 110px; }
.plate-n { font-family: var(--font-display); font-weight: 700; font-size: 21px; }

/* 덧셈·뺄셈 / 코인 / 묶음 */
.arith, .coins { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 12px; background: rgba(255,253,249,.9); border: 2px solid var(--line); border-radius: var(--r-md); }
.grp { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 220px; }
.grp.add { padding: 4px; border: 2.5px dashed var(--pink); border-radius: 14px; }
.g-it.gone { opacity: .35; position: relative; }
.g-it.gone::after { content: ''; position: absolute; inset: 12%; background: linear-gradient(45deg, transparent 44%, #E8566A 44% 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, #E8566A 44% 56%, transparent 56%); }
.op { font-family: var(--font-display); font-weight: 700; font-size: 36px; }
.clock-stage { display: grid; place-items: center; }
.clock-stage .clock-svg { width: min(210px, 58vw); height: auto; filter: drop-shadow(0 6px 0 rgba(91,59,44,.15)); }
.coin { animation: pop .35s var(--ease-spring) backwards; filter: drop-shadow(0 3px 0 rgba(91,59,44,.2)); }
.groups { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.group { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; min-width: 78px; background: rgba(255,253,249,.94); border: 2px solid var(--line); border-radius: 18px; transition: background .2s; }
.group.lit { background: var(--gold-l); animation: pop .35s var(--ease-spring); }
.g-items { display: grid; grid-template-columns: repeat(2, auto); gap: 2px; justify-content: center; }
.g-sum { font-family: var(--font-display); font-weight: 700; font-size: 20px; min-height: 26px; }

/* 보스 */
.boss-track { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; padding: 6px 10px; background: var(--pink-l); border: 2px solid var(--line); border-radius: 999px; }
.bt-step { width: 34px; height: 34px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; background: #fff; border: 2px solid var(--line); border-radius: 50%; }
.bt-step.now { background: var(--gold); animation: pulse 1.2s infinite; }
.bt-step.done { color: #fff; background: var(--pink); }
.bt-castle { margin-left: auto; }
.bt-castle .lm-img { width: 44px; height: 44px; }
.boss-stage { min-width: 0; }
.boss-win { text-align: center; padding: 10px 0; }
.bw-art { display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.boss-win h3 { font-size: 30px; margin: 8px 0 4px; color: var(--pink-d); }
.boss-win p { margin-bottom: 14px; font-weight: 600; }

/* ── 도감 ── */
.dex-head { margin: 4px 2px 14px; }
.dex-head h1 { font-size: 30px; }
.tabs { display: inline-flex; gap: 4px; margin-top: 10px; padding: 4px; background: var(--card); border: var(--ol); border-radius: 999px; box-shadow: 0 3px 0 var(--lip); }
.tab { min-height: 44px; padding: 0 16px; font-family: var(--font-display); font-weight: 600; font-size: 15px; border-radius: 999px; }
.tab small { color: var(--ink-soft); font-weight: 500; }
.tab.on { background: var(--gold-l); box-shadow: inset 0 0 0 2px var(--gold); }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.dex-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 10px 14px; text-align: center; background: var(--card); border: var(--ol); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.dex-item b { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.dex-item small { color: var(--ink-soft); font-size: 12.5px; line-height: 1.35; }
.dex-item.unknown { background: #F7EFE3; }
.dex-item.unknown .di-art img, .dex-item.unknown .di-art svg { filter: brightness(0) opacity(.16); }
.st-img { width: 110px; height: 110px; }
.btn-gacha { width: 22px; height: auto; }

/* ── 토스트 · 연출 ── */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); z-index: var(--z-toast); translate: -50% 20px; opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); padding: 9px 18px 9px 10px;
  font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--ink); background: var(--card); border: var(--ol); border-radius: 999px;
  box-shadow: 0 4px 0 var(--lip), 0 14px 26px -10px rgba(91,59,44,.45); transition: opacity .2s, translate .3s var(--ease-spring);
}
.toast .char img { border-radius: 50%; object-fit: cover; background: var(--pink-l); }
.toast.show { opacity: 1; translate: -50% 0; }
.toast.good { background: var(--gold-l); }
.toast.oops { background: #fff; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-fx); overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 16px; border-radius: 3px; animation: fall 1.5s ease-in forwards; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--r)); opacity: .9; } }
.fly-star { position: fixed; left: 50%; top: 45%; z-index: var(--z-fx); pointer-events: none; animation: fly 1s cubic-bezier(.3, .6, .4, 1) forwards; }
@keyframes fly { 0% { transform: translate(-50%, 0) scale(.4); opacity: 0; } 25% { transform: translate(-50%, -20px) scale(1.5); opacity: 1; } 100% { transform: translate(calc(min(46vw, 260px)), -42vh) scale(.5); opacity: 0; } }

/* ── 모달 ── */
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 16px; background: rgba(74, 44, 32, .42); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.modal.open { opacity: 1; visibility: visible; }
.modal-box {
  width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 18px 16px; text-align: center; background: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 24px 24px;
  border: var(--ol); border-radius: 28px; box-shadow: 0 6px 0 var(--lip-d), 0 30px 50px -20px rgba(74,44,32,.6);
  transform: translateY(18px) scale(.96); transition: transform .3s var(--ease-spring);
}
.modal.open .modal-box { transform: none; }
.modal-box h3 { font-size: 24px; margin: 4px 0 6px; }
.modal-box .muted { font-size: 14px; }
.fine { margin-top: 12px; font-size: 12.5px; color: var(--ink-soft); }

.celebrate { position: relative; }
.celebrate::before { content: ''; position: absolute; left: 50%; top: 120px; width: 300px; height: 300px; translate: -50% -50%; border-radius: 50%; background: repeating-conic-gradient(rgba(246,196,83,.32) 0 12deg, transparent 12deg 24deg); animation: spin 22s linear infinite; pointer-events: none; }
@keyframes spin { to { rotate: 360deg; } }
.celebrate > * { position: relative; }
.celebrate .cel-art { display: grid; place-items: center; margin: 8px 0; animation: pop .55s var(--ease-spring); }
.celebrate h3 { font-size: 30px; color: var(--pink-d); }
.cel-note { margin-top: 8px; font-family: var(--font-display); font-weight: 600; font-size: 16px; }

.gacha-stage { position: relative; display: grid; place-items: center; min-height: 240px; }
.gm-img { width: 150px; height: auto; filter: drop-shadow(0 8px 4px rgba(91,59,44,.2)); }
.gm-img.shaking { animation: wobble .25s ease-in-out infinite; }
@keyframes wobble { 25% { rotate: -5deg; } 75% { rotate: 5deg; } }
.capsule { position: absolute; bottom: 10px; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(180deg, #F28CA6 50%, #fff 50%); border: 2px solid var(--line); animation: drop .9s .2s ease-in backwards; }
@keyframes drop { from { transform: translateY(-80px) scale(.4); opacity: 0; } }
.gacha-prize { animation: pop .55s var(--ease-spring); }
.prize-img { width: 170px; height: 170px; filter: drop-shadow(0 6px 4px rgba(91,59,44,.2)); }
.gacha-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.gacha-bal { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 14px; font-family: var(--font-display); font-weight: 600; background: var(--card); border: 2px solid var(--line); border-radius: 999px; }

.gate-q { margin: 14px 0; font-family: var(--font-display); font-weight: 700; font-size: 40px; }
.gate-in { display: inline-block; min-width: 2.2em; padding: 0 10px; background: #fff; border: var(--ol); border-radius: 14px; }
.gate-in.empty { color: #CDB79A; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; max-width: 300px; margin: 0 auto 6px; }
.key { min-height: 56px; font-family: var(--font-display); font-weight: 700; font-size: 25px; background: #fff; border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 3px 0 var(--lip-d); }
.key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--lip-d); }
.key.ok { background: linear-gradient(180deg, #FCDD86, #F3BE4C); box-shadow: 0 3px 0 var(--gold-d); font-size: 19px; }

.store h3 { margin-bottom: 12px; }
.pass-card { position: relative; padding: 24px 14px 16px; margin-top: 14px; background: linear-gradient(160deg, var(--gold-l), #FFE3EA); border: var(--ol); border-radius: 22px; box-shadow: 0 5px 0 var(--lip-d); }
.pass-card.owned { background: var(--mint-l); }
.ribbon { position: absolute; top: -15px; left: 50%; translate: -50% 0; white-space: nowrap; padding: 4px 16px; font-family: var(--font-display); font-weight: 700; font-size: 14px; color: #fff; background: var(--pink); border: 2px solid var(--line); border-radius: 999px; }
.pass-art { display: flex; justify-content: center; gap: 4px; margin-bottom: 6px; }
.pass-art span { display: grid; place-items: center; width: 58px; height: 58px; background: #fff; border: 2px solid var(--line); border-radius: 50%; overflow: hidden; }
.pass-art svg, .pass-art img { width: 54px; height: 54px; object-fit: contain; }
.pass-card h4 { font-size: 25px; }
.pass-card p { font-size: 14px; color: var(--ink-soft); margin: 4px 0 12px; font-weight: 500; }
.once { margin: 8px 0 0 !important; font-size: 13px !important; color: var(--ink-soft); }
.sect { margin: 18px 0 8px; font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--ink-soft); }
.single-list { display: grid; gap: 8px; }
.single { display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 18px; box-shadow: 0 3px 0 var(--lip); }
.single.focus { background: var(--gold-l); box-shadow: 0 0 0 3px var(--pink), 0 3px 0 var(--lip); }
.s-ic svg, .s-ic img { width: 46px; height: 46px; object-fit: contain; }
.s-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.s-t b { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.s-t small { color: var(--ink-soft); font-size: 12px; }
.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; list-style: none; padding: 0; margin: 14px 0 0; }
.trust li { padding: 3px 11px; font-size: 13px; font-weight: 600; background: var(--mint-l); border: 2px solid var(--line); border-radius: 999px; }
.dev-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding: 10px 12px; font-size: 14px; font-weight: 600; background: repeating-linear-gradient(45deg, #FFF3BF 0 10px, #FFF9DB 10px 20px); border: 2px dashed var(--line); border-radius: 14px; }

.switch { position: relative; width: 58px; height: 34px; flex: none; background: #E9DCC6; border: 2px solid var(--line); border-radius: 999px; transition: background .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border: 2px solid var(--line); border-radius: 50%; transition: transform .25s var(--ease-spring); }
.switch.on { background: var(--mint); }
.switch.on i { transform: translateX(24px); }

.set-list { display: grid; gap: 8px; margin: 12px 0 4px; text-align: left; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; padding: 8px 14px; background: #fff; border: 2px solid var(--line); border-radius: 18px; box-shadow: 0 3px 0 var(--lip); }
button.set { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; }
.set span { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.set small { color: var(--ink-soft); font-size: 12.5px; }
.set.danger span { color: #C2505B; }

.pf-list { display: grid; gap: 8px; margin: 12px 0; }
.pf { display: flex; align-items: center; gap: 6px; }
.pf-main { flex: 1; display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 20px; box-shadow: 0 3px 0 var(--lip); }
.pf-main .char img { border-radius: 50%; object-fit: cover; background: var(--pink-l); }
.pf.on .pf-main { background: var(--gold-l); box-shadow: 0 0 0 3px var(--pink), 0 3px 0 var(--lip); }
.pf-main b { flex: 1; font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.pf-main small { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-display); font-weight: 600; font-size: 15px; }
label.field { display: grid; gap: 6px; margin: 12px 0; font-family: var(--font-display); font-weight: 600; text-align: left; }
label.field input { width: 100%; min-height: 54px; padding: 0 14px; font: 500 18px var(--font-body); color: var(--ink); background: #fff; border: var(--ol); border-radius: 16px; }
.av-pick { display: flex; justify-content: center; gap: 10px; }
.av { padding: 5px; background: #fff; border: 2px solid var(--line); border-radius: 50%; box-shadow: 0 3px 0 var(--lip); }
.av .char img { border-radius: 50%; object-fit: cover; }
.av.on { background: var(--gold-l); box-shadow: 0 0 0 3px var(--pink); }

.locked-art { position: relative; display: inline-grid; place-items: center; margin-bottom: 4px; }
.locked-art > :first-child { width: 150px; height: 150px; filter: saturate(.8); }
.locked-art .node-lock { position: absolute; right: -6px; bottom: 0; }
.locked-art .lock-img { width: 56px; height: 56px; }
.locked-host { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; font-family: var(--font-display); font-weight: 600; }
.locked-host .char img { border-radius: 50%; object-fit: cover; background: var(--pink-l); border: 2px solid var(--line); }

/* hover 는 마우스가 있을 때만 */
@media (hover: hover) and (pointer: fine) {
  .ch-card:hover, .game-tile:hover, .season-banner:hover, .dex-item:hover { transform: translateY(-3px); }
  .choice:hover:not(:disabled):not(.right) { filter: brightness(1.04); transform: translateY(-2px); }
  .btn:hover:not(:disabled) { filter: brightness(1.04); }
  .key:hover, .mode:hover, .chip:hover, .dock-btn:hover { background-color: #FFF8E8; }
  .ui-btn:hover { transform: scale(1.06); }
}

/* ── 가로 · 태블릿 (레퍼런스 2·3) ── */
@media (min-width: 860px) {
  .app { max-width: 1180px; padding: 0 24px 24px; }
  .topbar, .game-bar { margin: 0 -24px 10px; padding-left: 24px; padding-right: 24px; }
  .sign { display: flex; flex-direction: column; align-items: center; padding: 6px 16px 8px; margin-left: 6px; font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.05;
    background: linear-gradient(180deg, #FFF3DC, #F7E1BD); border: var(--ol); border-radius: 16px; box-shadow: 0 4px 0 var(--lip-d); }
  .unlock-all { display: inline-flex; align-items: center; gap: 8px; height: 54px; padding: 0 20px 0 12px; text-align: left; font-family: var(--font-display);
    background: linear-gradient(180deg, #FCDD86, #F3BE4C); border: var(--ol); border-radius: 18px; box-shadow: 0 4px 0 var(--gold-d); }
  .unlock-all span { display: flex; flex-direction: column; line-height: 1.1; }
  .unlock-all b { font-weight: 700; font-size: 16px; letter-spacing: .02em; }
  .unlock-all small { font-weight: 500; font-size: 13px; color: var(--ink-soft); }
  .home-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; align-items: start; }
  .home-side { position: sticky; top: 84px; display: grid; gap: 12px; padding: 12px; background: #F8E9D2; border: var(--ol); border-radius: 26px; box-shadow: var(--shadow); }
  .side-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; background: var(--card); border: 2px solid var(--line); border-radius: 18px; }
  .side-card.hi b { font-family: var(--font-display); font-weight: 700; font-size: 22px; }
  .hi-art { display: grid; place-items: center; width: 100%; padding: 6px 0; background: var(--gold-l); border-radius: 14px; }
  .side-card.lv b { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: .03em; }
  .side-card.lv .bar { width: 100%; height: 18px; }
  .side-card.lv .bar svg { position: absolute; right: -8px; top: 50%; translate: 0 -50%; }
  .side-card.lv small { font-family: var(--font-display); font-weight: 600; color: var(--ink-soft); }
  .side-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; text-align: left; border: 2px solid var(--line); border-radius: 18px; box-shadow: 0 3px 0 var(--lip-d); }
  .side-btn.gacha { background: var(--pink-l); }
  .side-btn.dex { background: var(--card); }
  .side-btn span:last-child { display: flex; flex-direction: column; }
  .side-btn b { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
  .side-btn small { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-display); font-weight: 500; color: var(--ink-soft); }
  .gb-img { width: 62px; height: auto; }
  .side-btn:active { transform: translateY(2px); }
  .home-hero, .dock { display: none; }
  .home-main { padding-bottom: 8px; }
  .season-banner { min-height: 150px; }
  .ch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .ch-name { font-size: 19px; }
  .ch-sub { font-size: 12.5px; }
  .toast { bottom: calc(28px + var(--safe-b)); }

  /* 게임: 보드 왼쪽, 캐릭터 말풍선 + 정답 버튼 오른쪽 (레퍼런스 3) */
  #screen-game { max-width: 1080px; margin: 0 auto; }
  .stage { padding: 16px; }
  .stage.staged { grid-template-columns: minmax(0, 1fr) 290px; grid-template-rows: auto 1fr; grid-template-areas: "board talk" "board answers"; align-items: start; column-gap: 18px; }
  .stage.staged.no-answers { grid-template-areas: "board talk" "board ."; }
  .prompt { flex-direction: column; align-items: flex-end; gap: 0; }
  .prompt p { order: 0; align-self: stretch; border-radius: 20px; margin-bottom: 4px; }
  .prompt p::after { content: ''; position: absolute; right: 54px; bottom: -12px; width: 18px; height: 18px; background: #fff; border-right: 2.5px solid var(--line); border-bottom: 2.5px solid var(--line); transform: rotate(45deg); }
  .prompt-host { display: none; }
  .prompt-body { display: block; order: 1; align-self: flex-end; margin-right: 8px; }
  .board { align-self: stretch; min-height: 380px; padding: 18px 16px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
  .choices { grid-template-columns: 1fr; align-self: end; }
  .choices.sym { grid-template-columns: repeat(3, 1fr); }
  .choices.shapes, .choices.bulbs { grid-template-columns: repeat(2, 1fr); }
  .choice { min-height: 68px; }
}

/* ============================================================
   확장 게임 (친구 플레이북 이식분)
   ============================================================ */
.pz-left { margin-top: 10px; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink-soft); }
.pz-bar { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }
.pz-bar .pz-left { margin: 0; }
.eq.big { font-size: 40px; }

/* 수직선 */
.nline { position: relative; display: flex; justify-content: space-between; gap: 4px; max-width: 420px; margin: 18px auto 6px; padding: 0 6px; }
.nline::before { content: ''; position: absolute; left: 10px; right: 10px; top: 50%; height: 5px; translate: 0 -50%; background: var(--line); border-radius: 3px; }
.nl-dot { position: relative; width: clamp(48px, 15vw, 62px); aspect-ratio: 1; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 6vw, 26px); background: #fff; border: var(--ol); border-radius: 50%; box-shadow: 0 3px 0 var(--lip-d); }
.nl-dot.me { background: var(--gold-l); }
.nl-dot.q { color: var(--pink-d); background: var(--pink-l); border-style: dashed; }
.nl-tip { text-align: center; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--ink-soft); }

/* 십 막대 */
.pv { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 6px; padding: 12px; background: rgba(255,253,249,.92); border: 2px solid var(--line); border-radius: var(--r-md); }
.rod { display: grid; grid-template-rows: repeat(10, 1fr); gap: 1px; width: 18px; height: 130px; padding: 2px; background: #C98522; border: 2px solid var(--line); border-radius: 5px; }
.rod i, .ones i { display: block; background: linear-gradient(180deg, #F8D58A, #EBB457); border-radius: 2px; }
.ones { display: grid; grid-template-columns: repeat(2, 16px); gap: 3px; align-content: end; }
.ones i { width: 16px; height: 16px; border: 1.5px solid var(--line); }

/* 10 만들기 */
.mk-goal { text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 28px; margin-bottom: 10px; }
.mk-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 440px; margin: 0 auto; }
.mk-t { min-height: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-family: var(--font-display); font-weight: 700; font-size: 28px; background: #fff; border: var(--ol); border-radius: 18px; box-shadow: 0 4px 0 var(--lip-d); transition: transform .12s var(--ease-spring), opacity .3s; }
.mk-t:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lip-d); }
.mk-t.sel { background: var(--gold-l); box-shadow: 0 0 0 3px var(--gold), 0 4px 0 var(--gold-d); }
.mk-t.gone { opacity: 0; transform: scale(.6); pointer-events: none; }
.mk-dots { display: grid; grid-template-columns: repeat(5, 7px); gap: 2px; }
.mk-dots i { width: 7px; height: 7px; border-radius: 50%; background: #EEE2CF; }
.mk-dots i.on { background: var(--pink); }

/* 스도쿠 */
.sk-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(100%, 360px); margin: 0 auto; background: #fff; border: 3px solid var(--line); border-radius: 14px; overflow: hidden; }
.sk-c { aspect-ratio: 1; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 7vw, 34px); border-right: 1.5px solid #E6D3B8; border-bottom: 1.5px solid #E6D3B8; transition: background .15s; }
.sk-grid[style*="--n:6"] .sk-c { font-size: clamp(18px, 5vw, 26px); }
.sk-c.br { border-right: 3px solid var(--line); }
.sk-c.bb { border-bottom: 3px solid var(--line); }
.sk-c.given { background: #FFF6E6; }
.sk-c.peer { background: #FFF9EE; }
.sk-c.sel { background: var(--gold-l); box-shadow: inset 0 0 0 3px var(--gold); }
.sk-c.bad { background: #FFE3E8; }
.sk-c.glow { animation: pulse .7s 3; background: var(--mint-l); }
.sk-pad { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 8px; width: min(100%, 360px); margin: 12px auto 0; }
.sk-num { min-height: 54px; font-family: var(--font-display); font-weight: 700; font-size: 26px; color: var(--c); background: #fff; border: var(--ol); border-radius: 16px; box-shadow: 0 4px 0 var(--lip-d); }
.sk-num:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lip-d); }

/* 세로셈 */
.col-root { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; }
.colf { display: grid; grid-template-columns: 34px repeat(var(--d), 42px); justify-content: center; padding: 10px 14px 12px; font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1.25; background: rgba(255,253,249,.95); border: 2px solid var(--line); border-radius: var(--r-md); }
.colf > span { display: grid; place-items: center; min-height: 42px; }
.cf-carry { min-height: 24px !important; font-size: 18px; color: var(--pink-d); }
.cf-line { grid-column: 1 / -1; min-height: 0 !important; height: 4px; margin: 4px 0; background: var(--line); border-radius: 2px; }
.cf-ans { color: var(--pink-d); background: #fff; border: 2px dashed #E6D3B8; border-radius: 10px; margin: 0 2px; }
.cf-ans.next { border-color: var(--pink); background: var(--pink-l); }
.pad-in { width: min(100%, 270px); margin: 0; }
.pad-in .key { min-height: 52px; }

/* 구구단 */
.dots { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px; background: rgba(255,253,249,.92); border: 2px solid var(--line); border-radius: var(--r-md); }
.drow { display: flex; gap: 5px; padding: 3px 6px; background: var(--gold-l); border-radius: 999px; }
.drow i { width: 16px; height: 16px; border-radius: 50%; background: var(--pink); border: 1.5px solid var(--line); }
.dan-pick { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 10px; }
.dan { min-width: 52px; min-height: 44px; padding: 0 10px; font-family: var(--font-display); font-weight: 700; font-size: 17px; background: #fff; border: 2px solid var(--line); border-radius: 999px; box-shadow: 0 3px 0 var(--lip); }
.dan.on { background: var(--gold-l); box-shadow: 0 0 0 2px var(--gold), 0 3px 0 var(--lip); }
.chant { list-style: none; margin: 0 auto; padding: 8px; max-width: 380px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: rgba(255,253,249,.94); border: 2px solid var(--line); border-radius: var(--r-md); }
.chant li { display: flex; flex-direction: column; padding: 6px 10px; border-radius: 12px; transition: background .2s, transform .2s; }
.chant li b { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.chant li small { color: var(--ink-soft); font-size: 12.5px; }
.chant li.done { background: var(--mint-l); }
.chant li.on { background: var(--gold); transform: scale(1.05); }

/* 트리 꾸미기 */
.tree-root { text-align: center; }
.tree-wrap { display: grid; place-items: center; }
.xtree { width: min(250px, 66vw); height: auto; filter: drop-shadow(0 6px 0 rgba(91,59,44,.15)); }
.xtree .orn { cursor: pointer; }

/* 낱말: 공용 글자판 */
.letter-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.lk { min-width: 46px; min-height: 48px; padding: 0 8px; font-family: var(--font-display); font-weight: 700; font-size: 22px; background: #fff; border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 3px 0 var(--lip-d); transition: transform .1s; }
.letter-bank.big .lk { min-width: 56px; min-height: 58px; font-size: 26px; }
.lk:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--lip-d); }
.lk.ok { background: var(--mint-l); }
.lk.no, .lk.used { opacity: .35; }
.lk.bad { background: #FFE3E8; animation: shake .35s; }
.word-slots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.word-slots span { width: 46px; height: 52px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 26px; background: #fff; border-bottom: 4px solid var(--line); border-radius: 10px 10px 4px 4px; }
.word-slots span.got { background: var(--mint-l); animation: pop .3s var(--ease-spring); }
.word-slots span.miss { color: var(--pink-d); }

/* 크로스워드 */
.cw-grid { display: grid; grid-template-columns: repeat(var(--c), minmax(0, 52px)); justify-content: center; gap: 3px; }
.cw-x { aspect-ratio: 1; }
.cw-c { position: relative; aspect-ratio: 1; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: clamp(16px, 5vw, 24px); background: #fff; border: 2px solid var(--line); border-radius: 9px; }
.cw-c small { position: absolute; top: 1px; left: 4px; font-size: 10px; color: var(--ink-soft); }
.cw-c.on { background: var(--sky-l); }
.cw-c.nx { box-shadow: inset 0 0 0 3px var(--pink); background: var(--pink-l); }
.cw-c.got { color: var(--ink); }
.cw-c.bad { animation: shake .35s; background: #FFE3E8; }
.cw-c.yay { background: var(--mint-l); animation: pop .35s var(--ease-spring); }
.cw-clue { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; padding: 8px 12px; background: rgba(255,253,249,.95); border: 2px solid var(--line); border-radius: var(--r-md); }
.cw-clue > span:nth-child(2) { display: flex; flex-direction: column; font-family: var(--font-display); }
.cw-clue small { color: var(--ink-soft); }
.cw-em { font-size: 44px; line-height: 1; }
.cw-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.cw-l { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 10px; font-family: var(--font-display); background: #fff; border: 2px solid var(--line); border-radius: 999px; }
.cw-l span { font-size: 22px; }
.cw-l.sel { background: var(--gold-l); }
.cw-l.done { background: var(--mint-l); opacity: .75; }

/* 눈사람 · 순서 맞추기 */
.hg-stage { display: flex; align-items: center; justify-content: center; gap: 10px; }
.hg-snow .snow-svg { width: 130px; height: auto; }
.hg-pic { display: grid; place-items: center; width: 110px; height: 110px; font-size: 64px; background: rgba(255,253,249,.95); border: var(--ol); border-radius: 24px; box-shadow: 0 4px 0 var(--lip-d); }
.hg-stage.solo .hg-pic { width: 130px; height: 130px; font-size: 78px; }
.hg-lives { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 8px; font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.hg-lives i { width: 14px; height: 14px; border-radius: 50%; background: var(--sky); border: 2px solid var(--line); }
.hg-lives i.off { background: #E9DCC6; }
.hg-lives span { margin-left: 6px; color: var(--ink-soft); }

/* 낱말 찾기 */
.ws-grid { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 54px)); justify-content: center; gap: 3px; }
.ws-c { aspect-ratio: 1; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: clamp(17px, 5vw, 24px); background: #fff; border: 2px solid #E6D3B8; border-radius: 10px; }
.ws-c.sel { background: var(--gold-l); border-color: var(--gold-d); }
.ws-c.got { background: var(--mint-l); border-color: var(--mint-d); }
.ws-c.bad { background: #FFE3E8; animation: shake .35s; }
.ws-c.yay { animation: pop .4s var(--ease-spring); background: var(--gold); }
.ws-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.ws-w { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; font-family: var(--font-display); font-weight: 600; font-size: 14px; background: #fff; border: 2px solid var(--line); border-radius: 999px; }
.ws-w i { font-style: normal; font-size: 20px; }
.ws-w.done { background: var(--mint-l); }

/* 짝꿍 카드 */
.mm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 86px)); justify-content: center; gap: 8px; }
.mm-c { aspect-ratio: .82; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: #fff; background: repeating-linear-gradient(45deg, #F28CA6 0 8px, #F7A8BB 8px 16px); border: var(--ol); border-radius: 16px; box-shadow: 0 4px 0 var(--pink-d); transition: transform .25s var(--ease-spring); }
.mm-c b { font-size: 30px; }
.mm-c.up { color: var(--ink); background: #fff; box-shadow: 0 4px 0 var(--lip-d); transform: rotateY(0); animation: pop .3s var(--ease-spring); }
.mm-c.up.pic span { font-size: 40px; }
.mm-c.got { background: var(--mint-l); opacity: .85; }

/* 첫 글자 · 국기 */
.fl-card { width: 120px; height: 120px; margin: 0 auto; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 70px; color: var(--pink-d); background: #fff; border: var(--ol); border-radius: 26px; box-shadow: 0 5px 0 var(--lip-d); }
.choices.pics { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
.choices.pics .choice { --c1: #fff; --c2: #FBF3E6; --d: var(--lip-d); border-radius: 22px; min-height: 86px; }
.fl-em, .fg-em { font-size: 48px; line-height: 1; }
.fg-big { margin: 4px auto; text-align: center; font-size: clamp(120px, 34vw, 200px); line-height: 1.05; filter: drop-shadow(0 6px 4px rgba(91,59,44,.25)); }
.fg-name { width: fit-content; margin: 6px auto; padding: 8px 22px; font-family: var(--font-display); font-weight: 700; font-size: 30px; background: #fff; border: var(--ol); border-radius: 18px; box-shadow: 0 4px 0 var(--lip-d); }
.fg-conts { display: flex; gap: 6px; padding-bottom: 6px; }
.fg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 420px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
.fg-c { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; background: rgba(255,255,255,.95); border: 2px solid var(--line); border-radius: 14px; }
.fg-c span { font-size: 40px; line-height: 1.1; }
.fg-c b { font-family: var(--font-display); font-weight: 600; font-size: 13px; line-height: 1.2; text-align: center; }
.fg-c.seen { background: var(--mint-l); }

/* 홈: 보너스 팩 */
.pack-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.pack-card { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px 10px 10px; text-align: left; background: linear-gradient(110deg, var(--card) 55%, color-mix(in srgb, var(--theme) 35%, #fff)); border: var(--ol); border-radius: var(--r-lg); box-shadow: var(--shadow); animation: rise .45s var(--ease-spring) backwards; animation-delay: calc(var(--i) * 60ms + .3s); }
.pack-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lip); }
.pack-card.locked { background: #FFF1F4; }
.pk-art { position: relative; flex: none; width: 92px; height: 92px; display: grid; place-items: center; background: color-mix(in srgb, var(--theme) 35%, #fff); border: 2px solid var(--line); border-radius: 22px; }
.pk-art .lm-img, .pk-art .lm-svg { width: 84px; height: 84px; object-fit: contain; }
.pk-art .ch-lock { right: -8px; bottom: -6px; }
.pk-art .ch-lock .lock-img { width: 38px; height: 38px; }
.pk-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pk-copy b { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.pk-copy small { color: var(--ink-soft); font-size: 13px; }
.pk-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.pk-stars { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-display); font-weight: 600; }
@media (min-width: 860px) { .pack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mm-grid { grid-template-columns: repeat(4, 96px); } }

/* ══════════ 스토리: 홈 카드 · 극장 · 컷씬 (data/story.json) ══════════ */
.dock { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dock-story { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle, #FFF3C4, #FFD9E4); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--line); }
@media (max-width: 480px) {
  .dock-btn { flex-direction: column; gap: 2px; min-height: 64px; font-size: 13px; padding: 4px; }
  .dock-btn .dock-chars { margin-right: 0; }
  .dock-chars .char { margin-right: -16px; }
}

.story-card {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: stretch; width: 100%; margin: 0 0 14px; overflow: hidden; text-align: left;
  background: var(--card); border: var(--ol); border-radius: var(--r-lg); box-shadow: var(--shadow); transition: transform .14s var(--ease-spring);
}
.story-card:active { transform: translateY(3px); }
.sc-map { min-height: 150px; background: var(--map) center / cover no-repeat; border-right: var(--ol); }
.sc-copy { display: flex; flex-direction: column; gap: 4px; padding: 16px 14px 14px; background: radial-gradient(circle at 90% 10%, #FFF3C4 0, transparent 60%), linear-gradient(160deg, #FFF8EC, #FFEAF0); }
.sc-copy small { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--pink-d); }
.sc-copy b { font-family: var(--font-display); font-weight: 700; font-size: 19px; line-height: 1.2; word-break: keep-all; text-wrap: balance; }
.sc-copy .play-btn { margin-top: auto; }
.star-track { display: flex; gap: 2px; margin: 4px 0 6px; }
.ss { display: inline-grid; place-items: center; filter: grayscale(1) opacity(.35); }
.ss.on { filter: drop-shadow(0 0 6px var(--c)); }
.ss.on svg path, .ss.on svg polygon { fill: var(--c); }
@media (max-width: 400px) { .story-card { grid-template-columns: 1fr; } .sc-map { min-height: 120px; border-right: 0; border-bottom: var(--ol); } }

/* 극장 화면 */
#screen-story { padding-bottom: 40px; }
.story-head { padding: 6px 4px 12px; }
.story-head h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(24px, 6vw, 32px); line-height: 1.15; word-break: keep-all; text-wrap: balance; }
.story-head .muted { margin-top: 4px; font-size: 15px; max-width: 34em; }
.world-map { position: relative; margin: 0 0 18px; border: var(--ol); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); background: #E9F5DF; }
.world-map img { display: block; width: 100%; height: auto; }
.map-pin { position: absolute; translate: -50% -50%; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.7); border: 2.5px dashed rgba(91,59,44,.5); filter: grayscale(.9); opacity: .8; }
.map-pin.on { background: #fff; border: 2.5px solid var(--line); filter: drop-shadow(0 0 10px var(--c)); opacity: 1; animation: pinGlow 2.4s ease-in-out infinite; }
.map-pin.on svg path, .map-pin.on svg polygon { fill: var(--c); }
@keyframes pinGlow { 50% { transform: translateY(-4px) scale(1.06); } }
.map-count { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 6px; padding: 5px 12px; font-family: var(--font-display); font-weight: 700; font-size: 16px;
  background: rgba(255,253,249,.94); border: 2px solid var(--line); border-radius: 999px; }
@media (max-width: 480px) { .map-pin { width: 34px; height: 34px; } .map-pin svg { width: 22px; height: 22px; } }

.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.ep-card { display: flex; flex-direction: column; text-align: left; background: var(--card); border: var(--ol); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .14s var(--ease-spring); animation: rise .45s var(--ease-spring) both; animation-delay: calc(var(--i) * 50ms); }
.ep-card:active { transform: translateY(3px); }
.ep-th { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: var(--ol); background: #F3E6D3; }
.ep-th img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ep-card.locked .ep-th img { filter: blur(6px) saturate(.5) brightness(1.05); transform: scale(1.08); }
.ep-th .ch-lock { right: 50%; bottom: 50%; translate: 50% 50%; }
.ep-play { position: absolute; left: 50%; top: 50%; translate: -50% -50%; display: grid; place-items: center; width: 54px; height: 54px; padding-left: 4px; font-size: 22px; color: #fff;
  background: rgba(232, 86, 106, .92); border: 2.5px solid #fff; border-radius: 50%; box-shadow: 0 4px 12px rgba(91,59,44,.35); }
.ep-th .new-flag { top: 10px; }
.ep-copy { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px 14px; }
.ep-copy em { font-style: normal; font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--pink-d); }
.ep-copy b { font-family: var(--font-display); font-weight: 700; font-size: 17.5px; line-height: 1.25; word-break: keep-all; }
.ep-copy small { color: var(--ink-soft); font-size: 13.5px; font-weight: 500; }

/* 챕터 화면: 이야기 칩 */
.host-line { flex-wrap: wrap; }
.ep-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 14px 6px 10px; margin-left: auto; font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #fff;
  background: linear-gradient(180deg, #F2879B, #E25F78); border: var(--ol); border-radius: 16px; box-shadow: 0 3px 0 #B84860; }
.ep-chip span { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.ep-chip small { font-size: 12px; font-weight: 600; opacity: .92; }
.ep-chip.locked { color: var(--ink-soft); background: var(--card); box-shadow: 0 3px 0 var(--lip); }
.ep-chip:active { transform: translateY(2px); }

/* 클리어 축하: 에피소드 열림 */
.ep-unlock .ep-th.big { width: min(100%, 360px); margin: 10px auto 12px; border: var(--ol); border-radius: var(--r-md); box-shadow: var(--shadow); }
.ep-unlock .cel-note { display: flex; align-items: center; justify-content: center; gap: 6px; }

/* 컷씬 플레이어 — 16:9 장면 위에 자막·캐릭터를 앱이 언어별로 얹는다 */
.cutscene { position: fixed; inset: 0; z-index: calc(var(--z-modal) + 5); display: grid; place-items: center; padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: radial-gradient(circle at 50% 30%, #5B3B6E, #2A1A2E 70%); opacity: 0; transition: opacity .35s; }
.cutscene.in { opacity: 1; }
.cs-stage { position: relative; width: min(100%, calc((100dvh - 20px) * 16 / 9)); aspect-ratio: 16 / 9; border-radius: 22px; overflow: hidden; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--line), 0 30px 60px -20px rgba(0,0,0,.6); background: #F3E6D3; }
.cs-still, .cs-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cs-still { animation: kenburns 16s ease-in-out infinite alternate; transform-origin: 50% 40%; }
.cs-video { opacity: 0; transition: opacity .6s; }
.cutscene.has-video .cs-video { opacity: 1; }
.cutscene.has-video .cs-still { animation: none; }
@keyframes kenburns { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.14) translate(-2%, 1.5%); } }
.cs-sparkle { position: absolute; inset: 0; pointer-events: none; background:
  radial-gradient(2px 2px at 20% 30%, #fff, transparent), radial-gradient(2px 2px at 70% 18%, #fff, transparent), radial-gradient(3px 3px at 45% 12%, #FFF3C4, transparent),
  radial-gradient(2px 2px at 85% 40%, #fff, transparent), radial-gradient(2px 2px at 10% 60%, #FFE6EC, transparent); animation: twinkle 2.6s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .2; } }
.cs-title { position: absolute; left: 14px; top: 12px; display: flex; flex-direction: column; padding: 8px 16px; max-width: 70%; background: rgba(255,253,249,.92); border: 2.5px solid var(--line); border-radius: 16px; box-shadow: 0 3px 0 var(--lip); }
.cs-title em { font-style: normal; font-family: var(--font-display); font-weight: 600; font-size: 12.5px; color: var(--pink-d); }
.cs-title b { font-family: var(--font-display); font-weight: 700; font-size: clamp(15px, 2.4vw, 22px); line-height: 1.2; word-break: keep-all; }
.cs-sub { position: absolute; left: 50%; bottom: 14px; translate: -50% 0; display: flex; align-items: flex-end; gap: 10px; width: min(calc(100% - 28px), 880px); min-height: 74px; padding: 12px 18px;
  background: rgba(255,253,249,.95); border: 2.5px solid var(--line); border-radius: 20px; box-shadow: 0 4px 0 var(--lip), 0 14px 30px -12px rgba(0,0,0,.4); }
.cs-sub.narr { background: rgba(255,248,236,.95); font-style: normal; }
.cs-sub.pop { animation: subIn .4s var(--ease-spring); }
@keyframes subIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.cs-sub p { flex: 1; margin: 0; align-self: center; font-family: var(--font-display); font-weight: 600; font-size: clamp(15px, 2.2vw, 22px); line-height: 1.4; word-break: keep-all; text-wrap: pretty; }
.cs-who { flex: none; display: flex; flex-direction: column; align-items: center; margin: -54px 0 -6px; }
.cs-who:empty { display: none; }
.cs-who .char { filter: drop-shadow(0 4px 3px rgba(91,59,44,.25)); animation: hop .5s var(--ease-spring); }
.cs-who b { margin-top: -4px; padding: 1px 10px; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #fff; background: var(--pink-d); border: 2px solid var(--line); border-radius: 999px; white-space: nowrap; }
@keyframes hop { from { transform: translateY(16px) scale(.9); } }
.cs-end { display: flex; justify-content: center; gap: 10px; width: 100%; }
.cs-dots { position: absolute; right: 16px; top: 18px; display: flex; gap: 6px; }
.cs-dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.6); border: 2px solid var(--line); }
.cs-dots i.on { background: var(--gold); }
.cs-next { position: absolute; inset: 0; z-index: 0; background: transparent; cursor: pointer; }
.cs-stage { z-index: 1; pointer-events: none; }
.cs-stage .cs-sub, .cs-stage .cs-end button { pointer-events: auto; }
.cs-skip { position: absolute; right: max(14px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top)); z-index: 2; min-height: 44px; padding: 0 16px; font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: var(--ink); background: rgba(255,253,249,.92); border: 2px solid var(--line); border-radius: 999px; box-shadow: 0 3px 0 var(--lip); }
@media (max-width: 640px) {
  .cs-dots { display: none; }
  .cs-title { padding: 5px 10px; border-radius: 12px; }
  .cs-sub { bottom: 8px; padding: 8px 12px; min-height: 56px; width: calc(100% - 16px); }
  .cs-who .char { --s: 60px !important; width: 60px; height: 60px; }
  .cs-who .char img { width: 60px; height: 60px; }
  .cs-who { margin-top: -34px; }
}
/* 세로 폰: 장면 아래로 자막을 꺼내 글자를 키운다 */
@media (max-aspect-ratio: 1/1) {
  .cutscene { align-content: center; }
  .cs-stage { width: 100%; overflow: visible; border-radius: 18px; }
  .cs-stage > .cs-still, .cs-stage > .cs-video { border-radius: 18px; }
  .cs-sub { top: calc(100% + 18px); bottom: auto; width: 100%; }
}
@media (hover: hover) and (pointer: fine) {
  .story-card:hover, .ep-card:hover { transform: translateY(-2px); }
  .cs-skip:hover { background: #fff; }
}
@media (max-width: 600px) {
  .host-line .bubble { flex: 1 1 0; }
  .ep-chip { order: 3; flex: 1 0 100%; justify-content: center; margin: 6px 0 0; }
}

/* 게임 바: 뒤로(챕터) + 홈 */
.game-bar { grid-template-columns: auto minmax(0, 1fr) 48px auto; }
.gb-nav { display: flex; gap: 6px; }
@media (max-width: 420px) {
  .game-bar { gap: 5px; }
  .gb-nav { gap: 4px; }
  .game-bar .wafer svg { width: 22px; height: 22px; }
}

/* ══════════ V2 · 공통 UX: 손가락 가이드 · 부드러운 오답 · 최소 터치 영역 ══════════ */
.choice { min-height: 56px; min-width: 56px; }
@media (min-width: 768px) { .choice { min-height: 64px; } }
.shake { animation: shakeSoft .3s ease-in-out; }
@keyframes shakeSoft { 25% { translate: -4px 0; } 50% { translate: 4px 0; } 75% { translate: -2px 0; } }
.choice.hint-glow { animation: hintGlow 1.4s ease-in-out infinite; }
@keyframes hintGlow { 50% { box-shadow: 0 4px 0 var(--d), 0 0 0 6px rgba(255, 212, 59, .55), 0 0 22px rgba(255, 212, 59, .7); } }
.ux-finger { position: fixed; z-index: var(--z-fx); translate: -30% -10%; pointer-events: none; opacity: 0; transition: top .9s cubic-bezier(.3, .7, .3, 1), opacity .3s; filter: drop-shadow(0 4px 6px rgba(91,59,44,.3)); }
.ux-finger.go { opacity: .9; animation: fingerTap 1s .9s ease-in-out 2; }
.ux-finger.out { opacity: 0; }
@keyframes fingerTap { 50% { transform: scale(.86) translateY(4px); } }

/* ══════════ V2 · 오늘의 캔디 모험 카드 · 30일 코스 · 데일리 바 ══════════ */
.daily-card { position: relative; margin: 0 0 14px; padding: 14px 14px 12px; background: radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--theme) 40%, #fff) 0, transparent 55%), var(--card);
  border: var(--ol); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.dc-top { display: flex; align-items: center; gap: 12px; }
.dc-day { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border: var(--ol); border-radius: 20px; background: linear-gradient(180deg, #FCDD86, #F3BE4C); box-shadow: 0 3px 0 var(--gold-d); line-height: 1; }
.dc-day small { font-family: var(--font-display); font-weight: 600; font-size: 12px; }
.dc-day b { font-family: var(--font-display); font-weight: 700; font-size: 28px; }
.dc-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dc-copy small { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--pink-d); }
.dc-copy small em { font-style: normal; color: #fff; background: #E8566A; padding: 0 7px; border-radius: 6px; }
.dc-copy b { font-family: var(--font-display); font-weight: 700; font-size: 19px; line-height: 1.2; word-break: keep-all; }
.dc-copy span { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.dc-gift { flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--pink-l); border: 2px dashed var(--pink); }
.dc-stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 10px; padding: 0; list-style: none; counter-reset: st; }
.dc-stages li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; text-align: center; font-size: 12.5px; font-weight: 600; line-height: 1.2; word-break: keep-all;
  background: #FFF8EC; border: 2px solid var(--lip); border-radius: 14px; counter-increment: st; }
.dc-stages li::before { content: counter(st); position: absolute; left: 6px; top: 4px; font-family: var(--font-display); font-weight: 700; font-size: 12px; color: var(--ink-soft); }
.dc-foot { display: flex; align-items: center; gap: 8px; }
.dc-reward { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-display); font-weight: 700; }
.dc-course { min-height: 44px; padding: 0 12px; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--ink-soft); background: transparent; border: 2px dashed var(--lip-d); border-radius: 14px; }
.dc-course small { color: var(--pink-d); }
.dc-go { margin-left: auto; min-height: 48px; padding: 0 22px; }
.course-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.cd { position: relative; display: grid; place-items: center; aspect-ratio: 1; min-height: 48px; font-family: var(--font-display); font-weight: 700; font-size: 19px;
  background: color-mix(in srgb, var(--theme) 25%, #fff); border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 3px 0 var(--lip); }
.cd i { position: absolute; right: -4px; top: -6px; font-style: normal; font-size: 13px; }
.cd.done { background: color-mix(in srgb, var(--theme) 70%, #fff); }
.cd.done i { display: grid; place-items: center; width: 20px; height: 20px; color: #fff; background: var(--green); border: 2px solid var(--line); border-radius: 50%; }
.cd.today { outline: 3px solid var(--pink); outline-offset: 2px; animation: pulse 1.4s ease-in-out infinite; }
.cd.locked { filter: grayscale(.7); opacity: .6; }
.cd.boss b { color: var(--pink-d); }
.dl-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 6px 12px; font-family: var(--font-display); font-weight: 600; font-size: 15px;
  background: color-mix(in srgb, var(--theme) 30%, #fff); border: 2px solid var(--line); border-radius: 14px; }
.dl-bar b { padding: 1px 9px; color: #fff; background: var(--pink-d); border-radius: 8px; }
.dl-dots { display: flex; gap: 5px; margin-left: auto; }
.dl-dots i { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--line); transition: background .2s; }
.dl-dots i.on { background: var(--gold); animation: pop .35s var(--ease-spring); }
.cel-cos { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0; }
.cel-cos span { display: flex; flex-direction: column; text-align: left; }
.cel-cos small { color: var(--pink-d); font-weight: 700; }

/* ══════════ V2 · 옷장 · 코스튬 착용 ══════════ */
.hi-art { position: relative; display: block; margin: 0 auto; }
.hi-wd { position: absolute; right: -4px; bottom: 4px; padding: 2px 9px; font-family: var(--font-display); font-weight: 700; font-size: 12px; color: #fff; background: var(--pink-d); border: 2px solid var(--line); border-radius: 999px; }
.dock-wd { width: 34px; height: 34px; }
.dock { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#screen-wardrobe { padding-bottom: 30px; }
.wd-room { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.wd-stage { position: relative; min-height: 340px; padding: 12px; background: var(--bg) center / cover no-repeat; border: var(--ol); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; align-items: center; }
.wd-tabs { display: flex; gap: 6px; padding: 5px; background: rgba(255,253,249,.92); border: 2px solid var(--line); border-radius: 999px; }
.wd-tab { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 2px 12px 2px 4px; font-family: var(--font-display); font-weight: 700; font-size: 14px; border-radius: 999px; }
.wd-tab.on { background: var(--pink-l); box-shadow: inset 0 0 0 2px var(--pink); }
.wd-model { margin-top: auto; position: relative; z-index: 1; padding-top: 50px; }
.wd-rug { position: absolute; left: 50%; bottom: 10px; translate: -50% 0; width: 260px; height: 44px; border-radius: 50%; background: rgba(242,140,166,.35); }
.wd-closet { padding: 12px 14px; background: var(--card); border: var(--ol); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.wd-closet h3 { margin: 6px 0 8px; font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--pink-d); }
.wd-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.wd-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; min-height: 56px; background: #FFF8EC; border: 2px solid var(--lip-d); border-radius: 16px; }
.wd-item small { font-size: 11.5px; font-weight: 600; line-height: 1.2; text-align: center; word-break: keep-all; color: var(--ink-soft); }
.wd-item.on { background: var(--pink-l); border-color: var(--pink-d); box-shadow: 0 0 0 3px rgba(242,140,166,.35); }
.wd-item.locked .wd-img { filter: grayscale(1) brightness(1.1) opacity(.45); }
.wd-item .ch-lock { right: 6px; top: 6px; bottom: auto; }
.wd-img { width: 64px; height: 64px; }
@media (min-width: 860px) { .wd-room { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } .wd-stage { min-height: 520px; } }

/* ══════════ V2 · 수료증 ══════════ */
.cert-box { width: min(760px, 96vw); }
.cert-view { margin: 10px 0 12px; border: var(--ol); border-radius: 12px; overflow: hidden; background: #FFF8EC; min-height: 120px; display: grid; place-items: center; }
.cert-view img { display: block; width: 100%; height: auto; }
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  #print-area img { width: 100%; height: auto; }
  @page { size: landscape; margin: 8mm; }
}

/* ══════════ V2 · 부모 게이트: 꾹 누르기 ══════════ */
.hold-pad .key { position: relative; display: grid; place-items: center; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.hold-pad .key span { position: relative; z-index: 1; }
.hold-pad .ring { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); rotate: -90deg; pointer-events: none; }
.hold-pad .ring circle { fill: none; stroke: var(--pink); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 107; stroke-dashoffset: calc(107 * (1 - var(--p, 0))); opacity: 0; }
.hold-pad .key.holding { background: var(--pink-l); }
.hold-pad .key.holding .ring circle { opacity: 1; }

/* ══════════ V2 · 온보딩 ══════════ */
.onb { position: fixed; inset: 0; z-index: calc(var(--z-modal) + 4); display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(circle at 50% 20%, #FFF3C4, #FFE6EC 70%); opacity: 0; transition: opacity .3s; }
.onb.in { opacity: 1; }
.onb-card { width: min(560px, 100%); padding: 22px 18px 18px; text-align: center; background: var(--card); border: var(--ol); border-radius: var(--r-xl); box-shadow: var(--shadow); }
.onb-card h2 { margin: 4px 0 12px; font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 5vw, 26px); line-height: 1.25; word-break: keep-all; text-wrap: balance; }
.onb-q { margin: 14px 0 8px; font-family: var(--font-display); font-weight: 600; }
.onb-ages { display: flex; justify-content: center; gap: 8px; }
.chip-b { min-width: 64px; min-height: 48px; font-family: var(--font-display); font-weight: 700; font-size: 18px; background: #fff; border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 3px 0 var(--lip); }
.chip-b.on { background: linear-gradient(180deg, #FCDD86, #F3BE4C); box-shadow: 0 3px 0 var(--gold-d); }
.onb-partners { display: flex; justify-content: center; gap: 10px; }
.onb-p { display: flex; flex-direction: column; align-items: center; padding: 6px 8px; border: 2px solid transparent; border-radius: 18px; font-family: var(--font-display); }
.onb-p.on { background: var(--pink-l); border-color: var(--pink-d); }
.onb-art { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 60px; margin: 8px 0 14px; }
.onb-eq { font-family: var(--font-display); font-weight: 700; font-size: 44px; }
.onb-card .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice.soft-no { filter: grayscale(.6); opacity: .6; }
.onb-pack { display: block; width: min(360px, 90%); height: auto; margin: 0 auto 6px; animation: hop .6s var(--ease-spring); }
.onb-bar { display: block; height: 14px; margin: 12px auto 6px; max-width: 320px; background: #fff; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.onb-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #FCDD86, #F28CA6); animation: fillBar 1.8s ease-out forwards; }
@keyframes fillBar { to { width: 100%; } }
.onb-plan { margin: 10px 0; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--pink-d); }

/* ══════════ V2 · Game A 와플 한붓그리기 ══════════ */
.ol-wrap { position: relative; width: min(100%, 420px); margin: 0 auto; touch-action: none; }
.ol-svg { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
.ol-e { stroke: #6B3A1F; stroke-width: 2.2; stroke-dasharray: 3 2.6; stroke-linecap: round; opacity: .75; }
.ol-e.done { stroke: #FF8A3D; stroke-width: 4.2; stroke-dasharray: none; opacity: 1; filter: drop-shadow(0 0 1.5px #FFE066); }
.ol-trail { fill: none; stroke: none; }
.ol-hit { fill: transparent; }
.ol-star { fill: #FFE066; stroke: #5B3B2C; stroke-width: 1.2; stroke-linejoin: round; }
.ol-n.start .ol-star { animation: starPulse 1.1s ease-in-out infinite; }
.ol-n.visited .ol-star { fill: #FFB627; }
.ol-n.cur .ol-star { fill: #FF5A8A; }
@keyframes starPulse { 50% { transform: scale(1.35); } }
.ol-hero { position: absolute; left: -8px; bottom: -10px; transition: left 1.6s ease-in-out; }
.ol-wrap.win .ol-hero { left: calc(100% - 64px); }
.ol-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-family: var(--font-display); font-weight: 700; }

/* ══════════ V2 · Game B 딸기 케이크 나누기 ══════════ */
.ck-board { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ck { display: block; }
.ck-plate { fill: #fff; stroke: #E9D6BC; stroke-width: 2; }
.ck-s > path { stroke: #5B3B2C; stroke-width: 1.2; stroke-linejoin: round; }
.ck-s.on > path { fill: #FFD9E3; cursor: pointer; }
.ck-rim { fill: #F4C27A; stroke: #5B3B2C; stroke-width: 1.2; }
.ck-leaf { fill: #5BC27A; stroke: none; }
.ck-s.off > path { fill: #FFF8EC; stroke-dasharray: 2 2; opacity: .7; }
.ck-cake.shaded .ck-s.on > path { fill: #FF9DB5; }
.ck-cream { fill: #fff; stroke: #E9D6BC; stroke-width: .8; }
.ck-berry { fill: #FF4F6D; stroke: #8C1F33; stroke-width: .6; }
.ck-piece { fill: #FFF3E6; stroke: #5B3B2C; stroke-width: 2; stroke-linejoin: round; }
.ck-plates { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; width: 100%; }
.ck-plate-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 120px; padding: 6px 4px 8px; background: #fff; border: 2px solid var(--line); border-radius: 50% 50% 22px 22px / 30% 30% 22px 22px; box-shadow: 0 3px 0 var(--lip); }
.ck-plate-btn.solo { width: min(220px, 100%); margin: 0 auto; }
.ck-pile { display: flex; flex-wrap: wrap; justify-content: center; gap: 0; min-height: 34px; }
.ck-sl { display: inline-flex; animation: pop .3s var(--ease-spring); cursor: pointer; }
.ck-n { font-family: var(--font-display); font-size: 18px; }
.ck-done-row { display: flex; justify-content: center; margin-top: 8px; }
.frac { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-family: var(--font-display); font-weight: 700; }
.frac i { font-style: normal; font-size: 22px; padding: 0 6px; }
.frac i:first-child { border-bottom: 3px solid currentColor; }

/* ══════════ V2 · Game C 두기 빵집 계산대 ══════════ */
.bk-shop { display: flex; flex-direction: column; gap: 10px; }
.bk-counter { position: relative; display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; padding: 10px 10px 12px; background: linear-gradient(180deg, #FFE6EC, #FFD3DE); border: 2px solid var(--line); border-radius: 18px; }
.bk-items { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bk-item { position: relative; display: inline-flex; flex-direction: column; align-items: center; }
.bk-tag { margin-top: -6px; padding: 1px 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; background: #fff; border: 2px solid var(--line); border-radius: 8px; }
.bk-plus { font-style: normal; font-family: var(--font-display); font-weight: 700; font-size: 22px; }
.bk-paid { padding: 4px 10px; font-family: var(--font-display); font-weight: 600; background: #fff; border: 2px dashed var(--line); border-radius: 12px; }
.bk-paid b { font-size: 20px; color: var(--pink-d); }
.bk-reg { margin-left: auto; }
.bk-tray { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 8px 12px; background: #FFF8EC; border: 2px dashed var(--lip-d); border-radius: 16px; }
.bk-tray-coins { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; }
.bk-sum { flex: none; min-width: 48px; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 26px; color: var(--pink-d); }
.bk-coins { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bk-coin { display: grid; place-items: center; width: 64px; height: 64px; font-family: var(--font-display); font-weight: 700; font-size: 20px; border: 2.5px solid var(--line); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 18%, transparent 19%), linear-gradient(180deg, #FFD3E0, #F59BB8); box-shadow: 0 4px 0 #C9667F; }
.bk-coin.c5 { background: radial-gradient(circle at 35% 30%, #fff 0 18%, transparent 19%), linear-gradient(180deg, #D9F5E6, #8ED8BE); box-shadow: 0 4px 0 var(--mint-d); }
.bk-coin.c10 { background: radial-gradient(circle at 35% 30%, #fff 0 18%, transparent 19%), linear-gradient(180deg, #FFF2CC, #F6C453); box-shadow: 0 4px 0 var(--gold-d); }
.bk-coin:active { transform: translateY(3px); box-shadow: 0 1px 0 #C9667F; }
.bk-coin.mini { width: 44px; height: 44px; font-size: 15px; box-shadow: 0 2px 0 #C9667F; animation: pop .25s var(--ease-spring); }
.bk-give { margin-left: auto; min-height: 56px; }
@media (hover: hover) and (pointer: fine) {
  .bk-coin:hover, .wd-item:hover, .cd:hover { transform: translateY(-2px); }
}

/* ══════════ 가족 계정 (Apple · Google) ══════════ */
.acct { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; text-align: left; background: #FFF8EC; border: 2px solid var(--lip-d); border-radius: 16px; }
.acct b { display: flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 700; font-size: 16px; word-break: break-all; }
.acct small { color: var(--ink-soft); font-size: 13.5px; line-height: 1.4; }
.acct.off { opacity: .8; }
.acct.on .row { justify-content: flex-start; margin: 0; }
.acct-del { align-self: flex-start; color: #C2505B; }
.sso { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; padding: 0 16px; font-family: -apple-system, 'Pretendard Variable', system-ui, sans-serif; font-weight: 600; font-size: 16px; border-radius: 12px; }
.sso.apple { color: #fff; background: #000; border: 1px solid #000; }
.sso.google { color: #1F1F1F; background: #fff; border: 1px solid #747775; }
.sso:active { transform: translateY(1px); }
.sso:disabled { opacity: .6; }
.dressed-look img { object-fit: contain; }

.acct-consent { font-size: 12px !important; }
.gsi-slot { display: flex; justify-content: center; min-height: 44px; }
