/* 바둑섬 — 초등학생용 밝은 테마. 화면(섹션)마다 대표 색이 바뀐다: body[data-sec] */
@font-face { font-family: "Jua"; src: url("/fonts/Jua-subset.woff2") format("woff2"); font-display: swap; }
:root {
  --bg: #fff7e6; --bg-2: #ffeccc; --card: #ffffff; --text: #2d2552; --muted: #776f98; --line: #f1e2c8; --chip: #fff1d9;
  --accent: #ff7043; --accent-dark: #d9532a; --accent-soft: #ffe3d8; --accent-2: #2fbf71;
  --board: #f0c46a; --board-2: #e2ad4c; --board-line: #6b4a12;
  --good: #22a861; --warn: #f0a020; --bad: #ff6b4a; --blunder: #e5384f;
  --tab-h: 70px; --radius: 22px; --shadow: 0 5px 0 var(--line);
  --font: "Jua", "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
/* 섹션 색: 홈=주황, 미션=초록, 대국=파랑, 복기=보라, 더보기=분홍 */
body[data-sec="home"]    { --accent: #ff7043; --accent-dark: #d9532a; --accent-soft: #ffe3d8; }
body[data-sec="mission"] { --accent: #22b366; --accent-dark: #178a4c; --accent-soft: #d9f5e5; }
body[data-sec="play"]    { --accent: #3a86ff; --accent-dark: #2364cc; --accent-soft: #dce9ff; }
body[data-sec="reviews"] { --accent: #8b5cf6; --accent-dark: #6a3fd6; --accent-soft: #ece4ff; }
body[data-sec="more"]    { --accent: #f2558f; --accent-dark: #c93a70; --accent-soft: #ffe0ec; }
:root:not([data-theme="light"]) { color-scheme: light dark; }
/* 다크 모드: 섹션의 연한 색을 어두운 바탕과 섞는다 */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body[data-sec] { --accent-soft: color-mix(in srgb, var(--accent) 24%, #241f44); } }
:root[data-theme="dark"] body[data-sec] { --accent-soft: color-mix(in srgb, var(--accent) 24%, #241f44); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #17142b; --bg-2: #1f1a3a; --card: #241f44; --text: #f4f0ff; --muted: #aba4cc; --line: #352e60; --chip: #2e2856; --accent-soft: #3a2f63;
    --board: #dcae58; --board-2: #c99a43; --board-line: #4a320c; --shadow: 0 5px 0 #0e0b1f; }
}
:root[data-theme="dark"] { --bg: #17142b; --bg-2: #1f1a3a; --card: #241f44; --text: #f4f0ff; --muted: #aba4cc; --line: #352e60; --chip: #2e2856; --accent-soft: #3a2f63;
  --board: #dcae58; --board-2: #c99a43; --board-line: #4a320c; --shadow: 0 5px 0 #0e0b1f; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; color: var(--text); font-family: var(--font); font-size: 17px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); background-image: radial-gradient(circle at 12% 8%, var(--bg-2) 0 90px, transparent 91px), radial-gradient(circle at 92% 30%, var(--bg-2) 0 60px, transparent 61px); background-attachment: fixed; }
b, strong, h1, h2, h3, h4, .t { font-weight: 400; } /* Jua 는 한 굵기뿐 — 가짜 굵게 방지 */
#app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); background: var(--bg); border-bottom: 3px solid var(--accent-soft); }
.topbar h1 { font-size: 23px; margin: 0; flex: 1; color: var(--accent); letter-spacing: -.3px; }
.icon-btn { background: var(--accent-soft); border: 0; border-radius: 12px; width: 38px; height: 38px; font-size: 26px; line-height: 1; color: var(--accent); padding: 0 0 3px; cursor: pointer; font-family: var(--font); }
.badge { font-size: 12px; background: var(--chip); color: var(--muted); padding: 3px 10px; border-radius: 999px; }
.view { flex: 1; padding: 16px; padding-bottom: calc(var(--tab-h) + 28px); max-width: 720px; width: 100%; margin: 0 auto; }
.view.enter > * { animation: pop-in .32s cubic-bezier(.2,1.3,.4,1) both; }
.view.enter > *:nth-child(2) { animation-delay: .04s; } .view.enter > *:nth-child(3) { animation-delay: .08s; } .view.enter > *:nth-child(4) { animation-delay: .12s; } .view.enter > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 6px 6px env(safe-area-inset-bottom); display: flex; gap: 4px; background: var(--card); border-top: 3px solid var(--line); z-index: 10; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); text-decoration: none; gap: 1px; border-radius: 16px; transition: background .2s; }
.tabbar a .ico { font-size: 24px; transition: transform .25s cubic-bezier(.2,1.6,.4,1); }
.tabbar a.active { color: var(--accent); background: var(--accent-soft); }
.tabbar a.active .ico { transform: translateY(-2px) scale(1.18); }
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h2 { font-size: 20px; margin: 0 0 8px; }
.card h3 { font-size: 16px; margin: 12px 0 6px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
/* 통통 버튼: 아래 그림자가 눌리면 쏙 들어간다 */
button.btn, a.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: #fff; border: 0; border-radius: 16px; padding: 13px 18px; font-family: var(--font); font-size: 18px; cursor: pointer; text-decoration: none; min-height: 50px; box-shadow: 0 5px 0 var(--accent-dark); transition: transform .08s, box-shadow .08s, filter .15s; position: relative; top: 0; margin-bottom: 5px; }
button.btn:active, a.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--accent-dark); }
@media (hover: hover) { button.btn:hover, a.btn:hover { filter: brightness(1.06); } }
.btn.secondary { background: var(--chip); color: var(--text); box-shadow: 0 5px 0 var(--line); }
.btn.secondary:active { box-shadow: 0 1px 0 var(--line); }
.btn.ghost { background: var(--card); color: var(--accent); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.ghost:active { box-shadow: 0 1px 0 var(--line); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 8px 14px; font-size: 15px; min-height: 40px; border-radius: 13px; box-shadow: 0 4px 0 var(--accent-dark); }
.btn.secondary.sm { box-shadow: 0 4px 0 var(--line); } .btn.ghost.sm { box-shadow: 0 3px 0 var(--line); }
.btn.sm:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: 4px 12px; font-size: 14px; margin: 2px 4px 2px 0; }
.chip.sev-blunder { background: var(--blunder); color: #fff; } .chip.sev-mistake { background: var(--bad); color: #fff; } .chip.sev-inaccuracy { background: var(--warn); color: #fff; } .chip.sev-best, .chip.sev-good { background: var(--good); color: #fff; }
.progress { height: 14px; background: var(--chip); border-radius: 999px; overflow: hidden; border: 2px solid var(--line); }
.progress > i { display: block; height: 100%; background: var(--accent-2); border-radius: 999px; transition: width .5s cubic-bezier(.2,1.2,.4,1);
  background-image: linear-gradient(45deg, rgba(255,255,255,.25) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.25) 50%, rgba(255,255,255,.25) 75%, transparent 75%); background-size: 18px 18px; animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 18px 0; } }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 13px 14px; margin-bottom: 10px; background: var(--card); border: 2px solid var(--line); border-radius: 18px; box-shadow: 0 4px 0 var(--line); display: flex; align-items: center; gap: 12px; font-size: 22px; }
.list li .grow { min-width: 0; font-size: 17px; }
.list li .t { font-size: 18px; }
.list li .chip { font-size: 14px; }
.list li.muted { font-size: 16px; justify-content: center; color: var(--muted); }
.list li.clickable { cursor: pointer; transition: transform .08s, box-shadow .08s; }
.list li.clickable:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.card .list li { box-shadow: none; border-width: 0 0 2px; border-radius: 0; margin: 0; padding: 11px 2px; background: transparent; }
.card .list li:last-child { border-bottom: 0; }
label.field { display: block; margin: 10px 0; font-size: 15px; color: var(--muted); }
label.field select, label.field input, label.field textarea { display: block; width: 100%; margin-top: 5px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); font-family: var(--font); font-size: 17px; }
label.field select:focus, label.field input:focus, label.field textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
label.field input[type=checkbox] { display: inline-block; width: 22px; height: 22px; margin: 0 6px 0 0; vertical-align: -4px; accent-color: var(--accent); }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); }
.seg button { background: var(--card); border: 0; padding: 9px 16px; color: var(--text); cursor: pointer; font-family: var(--font); font-size: 17px; }
.seg button.on { background: var(--accent); color: #fff; }
.board-wrap { width: 100%; max-width: 560px; margin: 0 auto; touch-action: manipulation; padding: 6px; background: var(--board-2); border-radius: 18px; box-shadow: 0 6px 0 rgba(107,74,18,.35); }
canvas.board { width: 100%; height: auto; display: block; border-radius: 12px; }
.board-tools { display: flex; gap: 10px; justify-content: center; margin: 14px 0 8px; flex-wrap: wrap; }
.stat { text-align: center; background: var(--chip); border-radius: 16px; padding: 8px 4px; }
.stat b { display: block; font-size: 28px; color: var(--accent); line-height: 1.2; }
.stat span { font-size: 13px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.coach { background: var(--accent-soft); border-left: 6px solid var(--accent); padding: 12px 14px; border-radius: 14px; font-size: 16px; }
.coach.strict { border-left-color: var(--blunder); }
.graph { width: 100%; height: 110px; display: block; border-radius: 14px; background: var(--chip); }
.bar { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 15px; }
.bar .lbl { width: 110px; }
.bar .track { flex: 1; height: 14px; background: var(--chip); border-radius: 999px; overflow: hidden; }
.bar .track i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.toast { position: fixed; bottom: calc(var(--tab-h) + 18px); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--card); padding: 12px 20px; border-radius: 999px; font-size: 17px; z-index: 50; max-width: 90%; box-shadow: 0 6px 18px rgba(0,0,0,.2); animation: toast-in .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes toast-in { from { transform: translate(-50%, 20px) scale(.8); opacity: 0; } }
.modal { position: fixed; inset: 0; background: rgba(20,14,40,.55); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal-card { background: var(--card); width: 100%; max-width: 560px; border-radius: 28px 28px 0 0; padding: 24px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 90dvh; overflow: auto; animation: sheet-up .35s cubic-bezier(.2,1.2,.4,1); }
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } }
.paywall h2 { margin: 0 0 6px; }
.paywall .product { border: 2px solid var(--line); border-radius: 16px; padding: 12px; margin: 8px 0; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.paywall .product.hl { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.paywall ul { padding-left: 18px; font-size: 15px; }
.lesson { font-size: 17px; line-height: 1.75; }
.lesson h4 { margin: 10px 0 4px; }
.ad { border: 2px dashed var(--line); border-radius: 14px; padding: 10px; text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0; }
.center { text-align: center; }
.big { font-size: 32px; color: var(--accent); }
/* 홈 상단 카드: 섹션 색 그라데이션 + 장식 바둑돌 */
.hero { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--accent), #ffb347); color: #fff; border-radius: 26px; padding: 20px; margin-bottom: 16px; box-shadow: 0 6px 0 var(--accent-dark); }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { width: 120px; height: 120px; right: -30px; top: -40px; background: radial-gradient(circle at 35% 35%, #666, #111); opacity: .22; }
.hero::after { width: 80px; height: 80px; right: 60px; top: -30px; background: radial-gradient(circle at 35% 35%, #fff, #ddd); opacity: .35; }
.hero > * { position: relative; }
.hero h2 { margin: 0 0 8px; font-size: 26px; line-height: 1.2; text-shadow: 0 2px 0 rgba(0,0,0,.12); }
.hero-rank { display: block; font-size: 18px; opacity: .92; }
.hero .btn { background: #fff; color: var(--accent); box-shadow: 0 5px 0 rgba(0,0,0,.15); }
.hero .progress { border-color: rgba(255,255,255,.4); }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.notice { font-size: 15px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); }
.timeline { display: flex; gap: 4px; }
.timeline i { flex: 1; height: 14px; border-radius: 5px; background: var(--chip); }
.timeline i.done { background: var(--accent-2); }
input[type=range] { width: 100%; accent-color: var(--accent); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 15px; }
.hidden, [hidden] { display: none !important; }
@media (min-width: 720px) { .two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } }
@media (prefers-reduced-motion: reduce) { .view.enter > *, .toast, .modal-card, .progress > i { animation: none !important; } .tabbar a .ico { transition: none; } }


/* AI 대국 승리 연출 (celebrate.js) */
.win-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle at 50% 40%, rgba(70,46,12,.93), rgba(8,6,4,.98)); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: win-fade .3s ease-out; overflow: hidden; }
.win-overlay.out { opacity: 0; transition: opacity .25s; }
.win-rain { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.win-rays { position: absolute; left: 50%; top: 40%; width: 160vmax; height: 160vmax; margin: -80vmax 0 0 -80vmax; background: repeating-conic-gradient(from 0deg, rgba(255,215,110,.13) 0 10deg, transparent 10deg 20deg); animation: win-spin 18s linear infinite; pointer-events: none; }
.win-box { position: relative; text-align: center; color: #fff; width: 100%; max-width: 420px; }
.win-crown { font-size: 64px; line-height: 1; animation: win-drop .7s cubic-bezier(.2,1.6,.4,1) both .1s; filter: drop-shadow(0 6px 16px rgba(245,197,66,.6)); }
.win-title { margin-top: 6px; font-size: clamp(48px, 15vw, 84px); font-weight: 900; letter-spacing: -1px; line-height: 1.05; white-space: nowrap;
  background: linear-gradient(100deg, #fff3c4 0%, #f5c542 35%, #fffbe8 50%, #f5c542 65%, #c98a1b 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(120,70,0,.55)) drop-shadow(0 0 24px rgba(245,197,66,.55)); animation: win-slam .65s cubic-bezier(.2,1.4,.4,1) both .2s, win-shine 2.4s linear infinite 1s; }
.win-reason { margin-top: 10px; font-size: 20px; font-weight: 800; animation: win-up .5s ease-out both .7s; }
.win-detail { margin-top: 4px; font-size: 15px; color: rgba(255,255,255,.8); animation: win-up .5s ease-out both .85s; }
.win-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; animation: win-up .5s ease-out both 1s; }
.win-chips span { background: rgba(245,197,66,.18); border: 1px solid rgba(245,197,66,.6); color: #ffe7a3; border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 700; }
.win-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; animation: win-up .5s ease-out both 1.15s; }
.win-actions .btn { width: 100%; }
.win-actions .win-next { background: linear-gradient(135deg, #f5c542, #e07a4b); color: #2a1600; font-size: 17px; }
.win-actions .btn.secondary { background: rgba(255,255,255,.14); color: #fff; }
.win-actions .btn.ghost { background: transparent; color: rgba(255,255,255,.85); border: 2px solid rgba(255,255,255,.3); box-shadow: none; }
.win-actions .win-next { box-shadow: 0 5px 0 #b8641f; }
.win-actions .btn.secondary { box-shadow: 0 5px 0 rgba(0,0,0,.35); }
.win-sound { position: absolute; top: -8px; right: 0; background: rgba(255,255,255,.12); border: 0; border-radius: 999px; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }
@keyframes win-fade { from { opacity: 0; } }
@keyframes win-spin { to { transform: rotate(360deg); } }
@keyframes win-slam { 0% { transform: scale(3.2) rotate(-6deg); opacity: 0; } 60% { transform: scale(.92) rotate(1deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes win-shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes win-drop { from { transform: translateY(-60px) scale(.4); opacity: 0; } }
@keyframes win-up { from { transform: translateY(14px); opacity: 0; } }
.board-wrap.won { animation: board-glow 1.6s ease-out 1; }
@keyframes board-glow { 0% { box-shadow: 0 0 0 0 rgba(245,197,66,.9); } 100% { box-shadow: 0 0 0 26px rgba(245,197,66,0); } }
@media (prefers-reduced-motion: reduce) { .win-overlay *, .win-overlay { animation-duration: .01s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; } }

/* AI 대국 패배·무승부 격려 카드 (celebrate.js) */
.lose-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: win-fade .3s ease-out; }
.lose-overlay.out { opacity: 0; transition: opacity .25s; }
.lose-card { background: var(--card); color: var(--text); width: 100%; max-width: 380px; border-radius: 20px; padding: 26px 20px 18px; text-align: center; box-shadow: var(--shadow); animation: lose-rise .45s cubic-bezier(.2,1.2,.4,1) both; }
.lose-icon { font-size: 52px; line-height: 1; animation: lose-sway 2.4s ease-in-out infinite .5s; display: inline-block; transform-origin: 50% 90%; }
.lose-title { margin-top: 8px; font-size: 26px; font-weight: 900; }
.lose-reason { margin-top: 2px; color: var(--muted); font-size: 14px; }
.lose-msg { margin: 14px 0 0; font-size: 16px; line-height: 1.55; }
.lose-note { margin-top: 10px; display: inline-block; background: var(--chip); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); }
.lose-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
@keyframes lose-rise { from { transform: translateY(30px) scale(.96); opacity: 0; } }
@keyframes lose-sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .lose-card, .lose-icon { animation: none; } }

/* ---- 3단계: AI 친구 캐릭터 · 말풍선 ---- */
.opp-ava { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; line-height: 1; background: color-mix(in srgb, var(--c, var(--accent)) 28%, var(--card)); border: 3px solid var(--c, var(--accent)); box-shadow: 0 4px 0 color-mix(in srgb, var(--c, var(--accent)) 55%, #000); }
.opp-ava.talk { animation: ava-hop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes ava-hop { 30% { transform: translateY(-8px) rotate(-6deg); } 60% { transform: translateY(0) rotate(4deg); } }
.opp { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.opp-body { flex: 1; min-width: 0; }
.opp-name { font-size: 17px; margin: 2px 0 4px; }
.bubble { position: relative; display: inline-block; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 8px 14px; font-size: 16px; box-shadow: 0 3px 0 var(--line); max-width: 100%; }
.bubble::before { content: ""; position: absolute; left: -9px; top: 12px; width: 14px; height: 14px; background: inherit; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); border-radius: 0 0 0 4px; }
.bubble.talk { animation: bubble-pop .35s cubic-bezier(.2,1.6,.4,1); transform-origin: 0 50%; }
@keyframes bubble-pop { from { transform: scale(.6); opacity: 0; } }
.char-card { display: flex; align-items: center; gap: 12px; background: var(--chip); border-radius: 18px; padding: 10px 12px; margin: 4px 0 10px; }
.char-card .t { font-size: 18px; }
.say-row { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 12px auto 0; max-width: 360px; text-align: left; animation: win-up .5s ease-out both .9s; }
.say-row .opp-ava { width: 46px; height: 46px; font-size: 26px; }
.say-row.dark .bubble { background: rgba(255,255,255,.95); color: #2d2552; border-color: transparent; box-shadow: none; }
.say-row.light { animation: none; margin-top: 12px; }
.promo-stars { font-size: 15px; margin: -2px 0 8px; opacity: .95; }
.stars { letter-spacing: 1px; } .stars i { font-style: normal; opacity: .55; }
.win-chips .stars i { opacity: .6; }
@media (prefers-reduced-motion: reduce) { .opp-ava.talk, .bubble.talk { animation: none; } }

/* ---- 스티커북 ---- */
.sticker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
.sticker { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 0; cursor: pointer; font-family: var(--font); color: var(--text); }
.sticker .st-ico { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; font-size: 40px; line-height: 1; background: var(--chip); border: 3px dashed var(--line); filter: grayscale(1); opacity: .35; transition: transform .2s; }
.sticker .st-q { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); font-size: 30px; color: var(--muted); text-shadow: 0 2px 0 var(--card); }
.sticker.on .st-ico { filter: none; opacity: 1; border: 4px solid #fff; background: color-mix(in srgb, var(--c, var(--accent)) 30%, #fff); box-shadow: 0 4px 0 color-mix(in srgb, var(--c, var(--accent)) 60%, #000), 0 0 0 2px color-mix(in srgb, var(--c, var(--accent)) 40%, transparent); transform: rotate(var(--tilt)); }
.sticker.on:active .st-ico { transform: rotate(var(--tilt)) scale(.94); }
.sticker .st-name { font-size: 14px; line-height: 1.2; text-align: center; }
.sticker .st-sub { font-size: 11px; color: var(--muted); }
.sticker .st-bar { width: 60px; height: 6px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.sticker .st-bar i { display: block; height: 100%; background: var(--accent); }
.sticker.new::after { content: "NEW"; position: absolute; top: 0; right: 8px; background: #ff3b6b; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 999px; transform: rotate(12deg); box-shadow: 0 2px 0 #b8204a; }
.sticker.new .st-ico { animation: sticker-in .7s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes sticker-in { 0% { transform: scale(.2) rotate(-30deg); opacity: 0; } 70% { transform: scale(1.15) rotate(var(--tilt)); opacity: 1; } }
.big-sticker { pointer-events: none; display: inline-flex; } .big-sticker .st-ico { width: 120px; height: 120px; font-size: 64px; } .big-sticker .st-q { top: 34px; font-size: 44px; }
@media (prefers-reduced-motion: reduce) { .sticker.new .st-ico { animation: none; } }

/* ---- 승급식 ---- */
.promo-overlay { background: radial-gradient(circle at 50% 38%, rgba(70,30,120,.94), rgba(10,6,24,.98)); }
.promo-ribbon { display: inline-block; position: relative; background: linear-gradient(180deg, #ff5a6e, #d6264a); color: #fff; font-size: 30px; letter-spacing: 6px; padding: 8px 34px; border-radius: 6px; box-shadow: 0 5px 0 #8f1630; animation: win-slam .6s cubic-bezier(.2,1.4,.4,1) both .1s; }
.promo-ribbon::before, .promo-ribbon::after { content: ""; position: absolute; top: 10px; border: 22px solid #b81e3e; z-index: -1; }
.promo-ribbon::before { left: -30px; border-left-color: transparent; } .promo-ribbon::after { right: -30px; border-right-color: transparent; }
.promo-medal { position: relative; width: 170px; height: 170px; margin: 26px auto 6px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c9, #f5c542 45%, #c98a1b); box-shadow: 0 0 0 8px rgba(255,255,255,.15), 0 0 40px rgba(245,197,66,.7), inset 0 -8px 0 rgba(0,0,0,.15); display: grid; place-items: center; animation: medal-spin 1.1s cubic-bezier(.2,1.2,.4,1) both .35s; }
.promo-medal span { grid-area: 1 / 1; font-size: 46px; color: #6b3d00; text-shadow: 0 2px 0 rgba(255,255,255,.6); }
.promo-medal .old { animation: rank-out .5s ease-in both 1.3s; }
.promo-medal .new { animation: rank-in .6s cubic-bezier(.2,1.8,.4,1) both 1.75s; }
@keyframes medal-spin { from { transform: rotateY(540deg) scale(.3); opacity: 0; } }
@keyframes rank-out { to { transform: scale(.2) translateY(-30px); opacity: 0; } }
@keyframes rank-in { from { transform: scale(2.6); opacity: 0; } }
.promo-overlay .win-reason { animation-delay: 2.1s; font-size: 24px; } .promo-overlay .win-detail { animation-delay: 2.25s; } .promo-overlay .win-actions { animation-delay: 2.4s; }
.win-actions .win-promo { background: linear-gradient(135deg, #ff5a6e, #8b5cf6); box-shadow: 0 5px 0 #5b2a9e; font-size: 19px; animation: promo-pulse 1.2s ease-in-out infinite 1.4s; }
@keyframes promo-pulse { 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .promo-medal, .promo-medal span, .promo-ribbon, .win-actions .win-promo { animation: none !important; } .promo-medal .old { display: none; } }

/* ---- 4단계: 아바타 ---- */
.avatar { position: relative; flex: none; display: inline-grid; place-items: center; width: var(--s); height: var(--s); border-radius: 50%; background: var(--bg); border: calc(var(--s) * .05 + 1px) solid #fff; box-shadow: 0 calc(var(--s) * .05) 0 rgba(0,0,0,.18); vertical-align: middle; }
.avatar .av-base { font-size: calc(var(--s) * .62); line-height: 1; }
.avatar .av-hat { position: absolute; top: calc(var(--s) * -.26); left: 50%; transform: translateX(-50%) rotate(-12deg); font-size: calc(var(--s) * .46); line-height: 1; filter: drop-shadow(0 2px 0 rgba(0,0,0,.15)); }
.hero-me { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.hero-me h2 { margin: 0; }
.hero-av { position: relative; text-decoration: none; padding-top: 10px; }
.hero-edit { position: absolute; right: -4px; bottom: -2px; background: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; font-size: 13px; box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.me-chip { display: inline-flex; align-items: center; gap: 4px; }
.av-preview { padding: 30px 0 6px; } .av-preview .avatar { animation: ava-hop 1.6s ease-in-out infinite; }
.av-tabs { display: flex; margin: 0 0 12px; } .av-tabs button { flex: 1; }
.av-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; padding-top: 10px; }
.av-item { position: relative; background: none; border: 3px solid transparent; border-radius: 22px; padding: 14px 0 6px; cursor: pointer; }
.av-item.sel { border-color: var(--accent); background: var(--accent-soft); }
.av-item.locked .avatar { filter: grayscale(1); opacity: .4; }
.av-lock { position: absolute; right: 4px; bottom: 2px; font-size: 18px; }

/* ---- 바둑 섬 모험 ---- */
.adv-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); background: linear-gradient(135deg, #d9f5e5, #dce9ff); border-color: #bfe6cf; }
:root[data-theme="dark"] .adv-card { background: linear-gradient(135deg, #1f3b33, #1f2b4a); border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .adv-card { background: linear-gradient(135deg, #1f3b33, #1f2b4a); border-color: var(--line); } }
.adv-card h2 { margin: 0 0 2px; }
.adv-card-ico { font-size: 44px; animation: ava-hop 2.4s ease-in-out infinite; }
.adv-go { background: #22b366; color: #fff; border-radius: 999px; padding: 6px 12px; font-size: 16px; box-shadow: 0 4px 0 #178a4c; }
.adv-map { position: relative; padding: 6px 0 10px; }
.island { position: relative; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 18%, var(--card)), var(--card)); border: 3px solid color-mix(in srgb, var(--c) 45%, var(--line)); border-radius: 34px 34px 26px 26px; padding: 14px 14px 16px; margin: 0 0 34px; box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 35%, var(--line)); }
.island:nth-child(odd) { margin-right: 22px; } .island:nth-child(even) { margin-left: 22px; }
.island:not(:last-child)::after { content: ""; position: absolute; left: 50%; bottom: -34px; height: 30px; border-left: 4px dashed color-mix(in srgb, var(--c) 50%, var(--line)); }
.island.locked { filter: grayscale(.85); opacity: .6; }
.island.current { box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 35%, var(--line)), 0 0 0 5px color-mix(in srgb, var(--c) 30%, transparent); }
.isl-head { display: flex; align-items: center; gap: 10px; }
.isl-head .t { font-size: 19px; }
.isl-path { position: relative; display: flex; justify-content: space-around; margin-top: 12px; }
.isl-path::before { content: ""; position: absolute; left: 16%; right: 16%; top: 30px; border-top: 4px dashed color-mix(in srgb, var(--c) 45%, var(--line)); }
.stage { position: relative; width: 74px; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; cursor: pointer; font-family: var(--font); color: var(--text); padding: 0; }
.stage b { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 400; background: var(--card); border: 4px solid var(--c); color: var(--c); box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 60%, #000); transition: transform .08s, box-shadow .08s; }
.stage.done b { background: var(--c); color: #fff; }
.stage:active b { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 60%, #000); }
.stage:disabled { cursor: default; } .stage:disabled b { border-style: dashed; color: var(--muted); }
.st-stars { font-size: 13px; letter-spacing: -1px; min-height: 18px; } .st-stars i { font-style: normal; opacity: .4; }
.you-here { position: absolute; top: -26px; right: 18px; display: flex; flex-direction: column; align-items: center; animation: ava-hop 1.4s ease-in-out infinite; z-index: 2; }
.you-here span { margin-top: 2px; background: var(--c); color: #fff; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.adv-dots { display: flex; justify-content: center; gap: 8px; margin: 0 0 12px; }
.adv-dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--chip); border: 2px solid var(--line); }
.adv-dots i.past { background: var(--accent); border-color: var(--accent); } .adv-dots i.now { background: var(--card); border-color: var(--accent); transform: scale(1.3); }
.big-ava { width: 84px; height: 84px; font-size: 50px; margin: 6px auto 0; }
.adv-stars { display: flex; justify-content: center; gap: 6px; margin: 10px 0 4px; }
.adv-stars span { font-size: 54px; filter: grayscale(1) opacity(.25); }
.adv-stars span:nth-child(2) { transform: translateY(-14px); font-size: 64px; }
.adv-stars span.on { filter: none; animation: star-pop .55s cubic-bezier(.2,1.8,.4,1) both var(--d); }
.adv-stars span:nth-child(2).on { animation-name: star-pop-mid; }
@keyframes star-pop { from { transform: scale(0) rotate(-90deg); } }
@keyframes star-pop-mid { from { transform: translateY(-14px) scale(0) rotate(-90deg); } to { transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { .adv-card-ico, .you-here, .av-preview .avatar, .adv-stars span.on { animation: none !important; } }

/* ---- 일러스트 (젠스파크) ---- */
.opp-ava img.ch-img { width: 92%; height: 92%; object-fit: contain; margin-top: 4%; pointer-events: none; }
.sticker .st-ico img.ch-img { width: 88%; height: 88%; object-fit: contain; }
.avatar .av-base img { width: 96%; height: 96%; object-fit: contain; display: block; }
.avatar.has-img .av-base { width: 100%; height: 100%; display: grid; place-items: center; }
.avatar .av-hat.img { top: calc(var(--s) * -.34); width: calc(var(--s) * .62); transform: translateX(-50%) rotate(-10deg); }
.avatar .av-hat.img img { width: 100%; display: block; }

/* ---- 게스트 전용 계정: 닉네임 고르기 · 복구 코드 ---- */
.nick-pick { margin-top: 12px; }
.nick-now { font-size: 22px; color: var(--accent); margin: 2px 0 8px; }
.nick-opt.on { background: var(--accent); color: #fff; }
.rc-code { font-size: 22px; letter-spacing: 1px; text-align: center; background: var(--chip); border: 2px dashed var(--accent); border-radius: 14px; padding: 12px; margin: 8px 0; user-select: all; }

/* ---- 대국 전 광고 (ads.js) ---- */
.ad-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(20,14,40,.6); display: flex; align-items: center; justify-content: center; padding: 16px; animation: win-fade .2s ease-out; }
.ad-card { background: var(--card); border-radius: 24px; width: 100%; max-width: 380px; padding: 18px; box-shadow: var(--shadow); }
.ad-tag { display: inline-block; font-size: 12px; background: var(--chip); color: var(--muted); border-radius: 6px; padding: 1px 8px; }
.ad-body { text-align: center; font-size: 48px; padding: 26px 0 16px; border: 2px dashed var(--line); border-radius: 16px; margin: 10px 0 14px; }
.ad-body p { font-size: 16px; margin: 6px 0 0; }
.safety { padding-left: 20px; font-size: 15px; line-height: 1.6; margin: 10px 0 16px; }
