/* 포코와 별빛 탐험대 — 스타일
   설계 원칙: 저채도 파스텔 배경, 미션 중 움직이는 요소 최소화, 큰 터치 타깃 */
:root {
  --bg: #1b1f3b;
  --bg2: #24295a;
  --panel: rgba(255, 255, 255, 0.94);
  --ink: #2b2d42;
  --muted: #6b6f8a;
  --primary: #ff9b3d;
  --primary-dark: #e07f22;
  --accent: #4fc3c9;
  --good: #5fcf80;
  --bad: #ff8a80;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: "Noto Sans KR", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; color: var(--ink); background: var(--bg); overflow: hidden; }
button { font-family: inherit; }

.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px; }
.screen.active { display: flex; }

.panel {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 24px; width: min(720px, 100%); max-height: 100%; overflow-y: auto; text-align: center;
}
h1, h2, .stage-msg, .countdown, .stroop-word, .tap-btn, .btn-big { font-family: "Jua", "Noto Sans KR", "Malgun Gothic", sans-serif; font-weight: 400; letter-spacing: 0.01em; }
h1, h2 { margin: 0 0 8px; }
h2 { font-size: 1.6rem; }
p { line-height: 1.5; }

/* 버튼 */
.btn { border: none; border-radius: 999px; padding: 12px 22px; font-size: 1rem; font-weight: 700; cursor: pointer; transition: transform 0.08s, box-shadow 0.08s; }
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 0 var(--primary-dark); }
.btn-primary:active { box-shadow: 0 2px 0 var(--primary-dark); }
.btn-big { font-size: 1.35rem; padding: 18px 40px; margin-top: 16px; }
.btn-ghost { background: rgba(43, 45, 66, 0.08); color: var(--ink); }
.btn-ghost:hover { background: rgba(43, 45, 66, 0.14); }

/* 미션 안내 */
.intro-panel { display: flex; flex-direction: column; align-items: center; }
.poko { width: min(200px, 40vw); height: auto; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.2)); }
.bubble { background: #fff; border: 2px solid #e6e8f2; border-radius: 20px; padding: 12px 18px; margin: 8px 0; width: 100%; }
.bubble p { margin: 6px 0; font-size: 1.05rem; }
.intro-demo { display: flex; gap: 20px; justify-content: center; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.intro-demo .demo-item { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 0.95rem; }
.intro-demo img { width: 68px; height: 68px; object-fit: contain; }
.intro-demo .go { color: #2a9d5c; }
.intro-demo .nogo { color: #c0392b; }
.level-tag { color: var(--muted); font-size: 0.9rem; }

/* 미션 진행 */
#screen-task { flex-direction: column; justify-content: flex-start; padding: 0; background: var(--bg) center/cover no-repeat; }
#screen-task::before { content: ""; position: absolute; inset: 0; background: rgba(15, 18, 45, 0.28); pointer-events: none; }
#screen-task .hud, #screen-task .stage, #screen-task .task-controls { position: relative; }
.hud { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 18px; color: #fff; font-weight: 700; }
.hud-left { min-width: 120px; }
.hud-center { flex: 1; }
.hud-right { display: flex; align-items: center; gap: 6px; min-width: 70px; justify-content: flex-end; }
.hud-right > span { font-variant-numeric: tabular-nums; min-width: 1.5em; }
.hud-coin { width: 28px; height: 28px; }
.progress { height: 12px; background: rgba(255, 255, 255, 0.15); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #8fe3e8); transition: width 0.25s; }

.stage { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; position: relative; user-select: none; }
.task-controls { width: 100%; display: flex; justify-content: center; gap: 12px; padding: 14px; flex-wrap: wrap; }

/* 정답/오답 플래시 — 과도한 자극을 피하기 위해 짧고 부드럽게 */
.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.12s; }
.flash.good { background: rgba(95, 207, 128, 0.28); opacity: 1; }
.flash.bad { background: rgba(255, 138, 128, 0.22); opacity: 1; }

/* 큰 반응 버튼 (터치용) */
.tap-btn { background: var(--primary); color: #fff; border: none; border-radius: 999px; font-size: 1.4rem; font-weight: 800; padding: 20px 60px; box-shadow: 0 8px 0 var(--primary-dark); cursor: pointer; }
.tap-btn:active { transform: translateY(4px); box-shadow: 0 4px 0 var(--primary-dark); }
.tap-btn.secondary { background: var(--accent); box-shadow: 0 8px 0 #2f9aa0; }
.tap-btn.secondary:active { box-shadow: 0 4px 0 #2f9aa0; }
.key-hint { color: rgba(255, 255, 255, 0.6); font-size: 0.85rem; width: 100%; text-align: center; }

/* Stroop */



/* 미션 중 메시지 (규칙 변경 등) */
.stage-msg { color: #fff; font-size: 1.6rem; font-weight: 800; text-align: center; padding: 20px; }
.stage-msg small { display: block; font-size: 1rem; font-weight: 500; opacity: 0.8; margin-top: 8px; }
.countdown { color: #fff; font-size: 5rem; font-weight: 900; }

/* 보상 */
.reward-panel { display: flex; flex-direction: column; align-items: center; }
.reward-stars { display: flex; gap: 8px; margin: 10px 0; }
.reward-stars img { width: 48px; height: 48px; animation: pop 0.4s ease-out both; }
.reward-stars img:nth-child(2) { animation-delay: 0.15s; }
.reward-stars img:nth-child(3) { animation-delay: 0.3s; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.reward-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.reward-stats .chip { background: #f2f4fb; border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; }

/* 별 지도 */

/* 리포트 */
.report-panel { text-align: left; width: min(940px, 100%); }
.report-panel h2 { text-align: center; }
.report-note { font-size: 0.85rem; color: var(--muted); text-align: center; }
.report-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.9rem; }
.report-table th, .report-table td { padding: 8px 6px; border-bottom: 1px solid #e6e8f2; text-align: center; }
.report-table th { background: #f2f4fb; }
.report-section { margin-top: 18px; }
.report-section h3 { margin: 0 0 6px; font-size: 1.05rem; }
.trend { display: flex; align-items: flex-end; gap: 4px; height: 60px; }
.trend span { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-width: 6px; }

@media (max-width: 600px) {
  .panel { padding: 20px 16px; }
  .hud-left { min-width: 80px; font-size: 0.85rem; }
  .tap-btn { padding: 16px 40px; font-size: 1.2rem; }
}

/* ===== 게임 씬 공통 ===== */
.critter { width: 100%; height: 100%; object-fit: contain; background: center/contain no-repeat; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35)); }
.sprite { background-repeat: no-repeat; }
.critter.sprite { width: auto; height: 100%; max-width: 100%; margin: 0 auto; }
.critter.pop { animation: pop-in 0.18s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.critter.twinkle { animation: twinkle-in 0.22s ease-out both; }
.critter.hide { animation: hide-down 0.16s ease-in forwards; }
.critter.caught { animation: caught 0.4s ease-out forwards !important; }
.critter.bonk { animation: bonk 0.4s ease-out both !important; }
.critter.flyaway { animation: flyaway 0.5s ease-in forwards !important; }
@keyframes pop-in { from { transform: translateY(40%) scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes twinkle-in { from { transform: scale(0.3); opacity: 0; filter: brightness(2); } to { transform: none; opacity: 1; } }
@keyframes hide-down { to { transform: translateY(40%) scale(0.5); opacity: 0; } }
@keyframes caught { 40% { transform: scale(1.3); filter: brightness(1.6); } to { transform: scale(0); opacity: 0; } }
@keyframes bonk { 20% { transform: translateX(-8%) rotate(-8deg); } 50% { transform: translateX(8%) rotate(8deg); } 80% { transform: translateX(-4%); } to { transform: none; } }
@keyframes flyaway { to { transform: translateY(-80%) scale(0.6); opacity: 0; } }
.oops { animation: oops 0.5s ease-out both !important; }
@keyframes oops { 20%, 60% { filter: brightness(0.6) saturate(0.6) drop-shadow(0 8px 10px rgba(0,0,0,0.35)); } 40%, 80% { filter: brightness(1.2) drop-shadow(0 8px 10px rgba(0,0,0,0.35)); } }

.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.fx-particle { position: absolute; width: 10px; height: 10px; border-radius: 50%; margin: -5px; animation: particle 0.55s ease-out forwards; }
@keyframes particle { to { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; } }
.fx-popup { position: absolute; transform: translate(-50%, -50%); font-family: "Jua", "Noto Sans KR", sans-serif; font-size: 1.4rem; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.5); white-space: nowrap; animation: popup 0.85s ease-out forwards; }
.fx-popup.good { color: #ffe680; }
.fx-popup.bad { color: #ffb3ad; font-size: 1.2rem; }
.fx-popup.calm { color: #cfe9ff; font-size: 1.1rem; }
.fx-popup.combo { color: #ff9b3d; font-size: 2.2rem; animation-duration: 1s; }
@keyframes popup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -120%) scale(1); } }
.fx-coin { position: absolute; width: 34px; height: 34px; margin: -17px; transition: transform 0.5s cubic-bezier(0.3, 0, 0.6, 1), opacity 0.5s; }
.hud-coin.bump { animation: bump 0.2s ease-out; }
@keyframes bump { 50% { transform: scale(1.4); } }

/* HUD 추가 요소 */
.hud-left { display: flex; align-items: center; gap: 8px; }
.hud-poko { width: 44px; height: 44px; object-fit: contain; }
.hud-poko.react { animation: bump 0.25s ease-out; }
.hud-center { display: flex; flex-direction: column; gap: 4px; }
.hud-combo { font-family: "Jua", sans-serif; font-size: 0.95rem; color: #ffd24d; min-height: 1.2em; text-align: center; }
.hud-combo.hot { color: #ff9b3d; animation: bump 0.4s ease-out; }

.stage-msg.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(15, 18, 45, 0.7); z-index: 4; }

/* ===== ① 반짝 숲 달리기 ===== */
.runner { position: relative; width: 100%; height: 100%; overflow: hidden; }
.runner-bg { position: absolute; inset: 0; background: url("../assets/bg/forest.jpg") repeat-x; background-size: auto 100%; animation: scroll-bg 14s linear infinite; }
@keyframes scroll-bg { to { background-position-x: -1344px; } }
.runner-spot { position: absolute; bottom: 24%; width: 15%; aspect-ratio: 1; }
#spot-0 { left: 34%; } #spot-1 { left: 50%; } #spot-2 { left: 66%; } #spot-3 { left: 82%; }
.runner-poko { position: absolute; left: 8%; bottom: 20%; transform-origin: bottom center; filter: drop-shadow(0 8px 10px rgba(0,0,0,0.35)); transition: transform 0.07s linear; }

/* ===== ② 별자리 망원경 ===== */
.sky { position: relative; width: 100%; height: 100%; overflow: hidden; }
.constellation { position: absolute; inset: 0; width: 100%; height: 100%; }
.constellation circle { fill: rgba(255,255,255,0.18); transition: fill 0.3s, r 0.3s; }
.constellation circle.lit { fill: #ffe680; r: 10; filter: drop-shadow(0 0 4px #ffe680); }
.constellation line { stroke: rgba(255,255,255,0.08); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.constellation line.lit { stroke: #ffe680; stroke-width: 2; stroke-dasharray: none; filter: drop-shadow(0 0 3px #ffe680); }
.sky-critter { position: absolute; width: min(26vh, 40vw, 200px); aspect-ratio: 1; transform: translate(-50%, -50%); }
.telescope-mask { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 62% 62% at 50% 55%, transparent 60%, rgba(8, 10, 30, 0.75) 100%); }

/* ===== ③ 반딧불 연못 ===== */
.pond { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.nb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: min(58vh, 88vw, 440px); margin-bottom: 4%; }
.nb-cell { position: relative; aspect-ratio: 1; }
.nb-cell .pad { position: absolute; inset: 4%; width: 92%; height: 92%; object-fit: contain; opacity: 0.9; }
.nb-cell .pad-slot { position: absolute; inset: 18%; }
.nb-cell.ripple::after { content: ""; position: absolute; inset: 10%; border-radius: 50%; border: 3px solid #b9ff8a; animation: ripple 0.7s ease-out forwards; }
@keyframes ripple { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.pond-poko { position: absolute; right: 4%; bottom: 2%; transform-origin: bottom center; filter: drop-shadow(0 8px 10px rgba(0,0,0,0.35)); transition: transform 0.07s linear; }

/* ===== ④ 마법 물약 공방 ===== */
.lab { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.scroll { background: linear-gradient(#fff7e0, #f3e4bd); border: 3px solid #c9a86a; border-radius: 14px; padding: 12px 40px; min-width: min(60vw, 360px); min-height: 110px; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(0,0,0,0.35); opacity: 0.35; transform: scale(0.96); transition: opacity 0.15s, transform 0.15s; }
.scroll.show { opacity: 1; transform: none; }
.scroll.bonk { animation: bonk 0.4s ease-out both; }
.stroop-word { font-size: clamp(3rem, 12vw, 5.5rem); text-shadow: 0 2px 0 rgba(0,0,0,0.12); letter-spacing: 0.05em; }
.cauldron { width: min(22vh, 160px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 40%, var(--liquid, #6b6f8a) 0%, #2b2d42 75%); border: 6px solid #3a3d55; box-shadow: inset 0 -10px 20px rgba(0,0,0,0.5), 0 10px 20px rgba(0,0,0,0.4); transition: background 0.3s; }
.cauldron.bubble { animation: bubble 0.6s ease-out; }
@keyframes bubble { 30% { transform: scale(1.12); box-shadow: 0 0 40px var(--liquid), inset 0 -10px 20px rgba(0,0,0,0.5); } }
.potion-btn { position: relative; background: none; border: none; cursor: pointer; width: 104px; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform 0.15s; }
.potion-btn img { width: 104px; height: 104px; object-fit: contain; position: relative; }
.potion-liquid { position: absolute; top: 0; left: 0; width: 104px; height: 104px; background: var(--liquid); mix-blend-mode: multiply; opacity: 0.95; z-index: 1;
  -webkit-mask: url("../assets/characters/bottle.png") center/contain no-repeat, linear-gradient(transparent 26%, #000 34%); -webkit-mask-composite: source-in;
  mask: url("../assets/characters/bottle.png") center/contain no-repeat, linear-gradient(transparent 26%, #000 34%); mask-composite: intersect; }
.potion-btn::after { content: ""; position: absolute; top: 0; left: 0; width: 104px; height: 104px; border-radius: 50%; box-shadow: 0 0 26px var(--liquid); opacity: 0.55; z-index: 0; }
.potion-name { font-family: "Jua", sans-serif; color: #fff; font-size: 1rem; text-shadow: 0 1px 4px rgba(0,0,0,0.6); }
.potion-name small { display: block; font-family: "Noto Sans KR", sans-serif; font-size: 0.65rem; opacity: 0.7; }
.potion-btn:active, .potion-btn.pour { transform: translateY(-8px) rotate(-12deg); }

/* ===== 인트로 스토리 ===== */
#screen-intro { background: var(--bg) center/cover no-repeat; }
#screen-intro::before { content: ""; position: absolute; inset: 0; background: rgba(15, 18, 45, 0.45); }
#screen-intro > .panel { position: relative; background: rgba(255,255,255,0.92); }
.world-tag { margin: 0; font-family: "Jua", sans-serif; color: var(--accent); letter-spacing: 0.08em; font-size: 0.95rem; }
.story-row { display: flex; align-items: center; gap: 12px; width: 100%; }
.story-row .poko { width: min(150px, 32vw); flex-shrink: 0; }
.intro-panel { padding-top: 18px; padding-bottom: 18px; }
.intro-panel .btn-big { margin-top: 10px; padding: 14px 36px; }
.story-bubble { position: relative; flex: 1; background: #fff; border-radius: 18px; padding: 14px 16px; font-size: 1rem; text-align: left; box-shadow: 0 4px 12px rgba(0,0,0,0.08); margin: 0; }
.story-bubble::before { content: ""; position: absolute; left: -10px; top: 40%; border: 8px solid transparent; border-right-color: #fff; border-left: 0; }

/* ===== 스티커 / 별 지도 / 콘페티 ===== */
.sticker { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4)); }
.sticker.locked { filter: grayscale(1) brightness(0.35) opacity(0.6); }
.reward-sticker { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.reward-sticker img { width: 72px; height: 72px; animation: pop 0.5s ease-out both; }
.reward-sticker span { font-family: "Jua", sans-serif; color: var(--primary); font-size: 1.1rem; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
#screen-reward .panel { position: relative; z-index: 2; }
.starmap { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; }
.region { aspect-ratio: 16/9; border-radius: 14px; background: #333 center/cover; display: flex; align-items: flex-end; justify-content: center; padding: 8px; filter: grayscale(1) brightness(0.5); transition: filter 0.4s; overflow: hidden; }
.region.lit { filter: none; box-shadow: 0 0 18px rgba(255, 210, 77, 0.6); }
.region span { font-family: "Jua", sans-serif; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.7); }
.chip.plain { background: #f2f4fb; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .runner-bg, .runner-poko { animation: none; } }

/* ===== 일시정지 ===== */
.btn-pause { margin-left: 8px; }
.pause-overlay[hidden] { display: none; }
.pause-overlay { position: absolute; inset: 0; z-index: 20; background: rgba(15, 18, 45, 0.78); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pause-box { background: var(--panel); border-radius: var(--radius); padding: 28px 32px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: var(--shadow); max-width: 360px; }
.pause-box .pause-poko { width: 120px; }
.pause-box .btn-big { margin-top: 4px; }
#screen-task.paused .runner-bg { animation-play-state: paused; }
#screen-task.paused .stage, #screen-task.paused .task-controls { filter: blur(2px); }

.confirm-text { margin: 4px 0 10px; font-size: 1.05rem; }
.confirm-text small { color: var(--muted); font-size: 0.85rem; }
#pause-main { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#pause-main[hidden], #pause-confirm[hidden], .home-notice[hidden], #btn-reset-yes[hidden] { display: none; }
.btn-ghost.danger { background: #ffd9d6; color: #a12b22; }

/* ===================== 홈 화면 (리디자인) ===================== */
#screen-home { padding: 0; overflow: hidden; }
/* 장면 상자: JS(Home.layout)가 크기/위치를 계산. 배경과 포코가 같은 좌표계에서 켄번스로 함께 움직인다 */
.home-scene { position: absolute; transform-origin: 74% 68%; animation: kenburns 38s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.06); } }
.home-bg { position: absolute; inset: 0; background: url("../assets/bg/home.jpg") center/100% 100% no-repeat; }
.home-tint { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(14, 16, 44, 0.78) 0%, rgba(14, 16, 44, 0.45) 45%, rgba(14, 16, 44, 0.05) 75%), linear-gradient(0deg, rgba(14, 16, 44, 0.5) 0%, transparent 35%); }
.home-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* 언덕 정상 앵커(이미지 좌표 1000,508). 포코 발끝이 이 점에 놓인다 */
.home-anchor { position: absolute; left: 74.4%; bottom: 32.45%; width: 0; height: 100%; }
.home-shadow { position: absolute; left: 0; bottom: 0; width: calc(var(--char-h) * 0.9); height: calc(var(--char-h) * 0.16); transform: translate(-50%, 45%); border-radius: 50%; background: radial-gradient(ellipse, rgba(10, 20, 30, 0.55) 0%, rgba(10, 20, 30, 0) 70%); }
.home-poko { position: absolute; left: 0; bottom: 0; translate: -50% 0; transform-origin: bottom center; filter: drop-shadow(0 10px 14px rgba(0,0,0,0.45)) brightness(0.96) saturate(0.95); transition: transform 0.08s linear; }
.home-poko::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
/* 원형 아이콘 버튼 (음악·일시정지) — 이모지 대신 SVG로 기기마다 같은 모양 */
.btn-music, .btn-pause { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,0.45); background: rgba(255,255,255,0.16); color: #fff; cursor: pointer; flex-shrink: 0; transition: transform 0.15s, background 0.15s; box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
.btn-music:hover, .btn-pause:hover { transform: scale(1.08); background: rgba(255,255,255,0.3); }
.btn-music:active, .btn-pause:active { transform: scale(0.95); }
.btn-music .ic, .btn-pause .ic { width: 20px; height: 20px; fill: currentColor; display: block; }
.btn-music .ic-off, .btn-music.muted .ic-on { display: none; }
.btn-music.muted .ic-off { display: block; }
.btn-music.muted { opacity: 0.75; }
.btn-music:not(.hud) { position: absolute; top: 14px; right: 14px; z-index: 5; width: 44px; height: 44px; background: rgba(14, 16, 44, 0.5); backdrop-filter: blur(6px); }
.btn-music.hud { margin-left: 10px; }
.home-panel { position: relative; z-index: 2; color: #fff; width: min(520px, 100%); margin: 0 auto 0 clamp(16px, 6vw, 88px); padding: 24px 16px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.eyebrow { margin: 0; font-family: "Jua", sans-serif; font-size: 0.9rem; letter-spacing: 0.18em; color: #9be7ec; text-transform: uppercase; }
.title { font-size: clamp(2.4rem, 6.4vw, 4.2rem); line-height: 1.05; letter-spacing: -0.02em; margin: 0; display: flex; flex-direction: column; text-wrap: balance; }
.title span { display: block; background: linear-gradient(180deg, #fff 30%, #ffe9b0 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 rgba(120, 60, 0, 0.35)) drop-shadow(0 8px 20px rgba(0,0,0,0.45)); animation: title-glow 4s ease-in-out infinite; }
.title span:nth-child(2) { animation-delay: 0.6s; }
@keyframes title-glow { 50% { filter: drop-shadow(0 4px 0 rgba(120, 60, 0, 0.35)) drop-shadow(0 0 22px rgba(255, 220, 120, 0.55)); } }
.subtitle { font-size: 1.1rem; opacity: 0.92; margin: 0; }
.home-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.home-stats .chip { display: inline-flex; align-items: center; gap: 5px; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 999px; padding: 5px 12px; font-size: 0.88rem; backdrop-filter: blur(6px); font-variant-numeric: tabular-nums; }
.home-stats .chip img { width: 18px; height: 18px; }
.home-challenge { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, rgba(255, 155, 61, 0.28), rgba(79, 195, 201, 0.22)); border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 16px; padding: 10px 14px; width: 100%; backdrop-filter: blur(8px); text-shadow: none; }
.home-challenge img { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 3px 5px rgba(0,0,0,0.4)); }
.home-challenge div { display: flex; flex-direction: column; line-height: 1.3; }
.home-challenge small { font-size: 0.75rem; letter-spacing: 0.08em; color: #ffd98a; font-family: "Jua", sans-serif; }
.home-challenge b { font-size: 1rem; }
.home-challenge span { font-size: 0.8rem; color: #9be7ec; }
.home-challenge.done { border-color: #ffd24d; box-shadow: 0 0 18px rgba(255, 210, 77, 0.45); }
.home-menu { display: flex; flex-direction: column; gap: 10px; width: 100%; align-items: flex-start; }
.home-menu .btn-big { margin-top: 2px; padding: 18px 44px; font-size: 1.4rem; width: 100%; max-width: 480px; }
.home-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 480px; }
.home-grid .btn { padding: 12px 8px; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.btn-glass { background: rgba(255, 255, 255, 0.16); color: #fff; border: 1px solid rgba(255, 255, 255, 0.35); backdrop-filter: blur(6px); }
.btn-glass:hover { background: rgba(255, 255, 255, 0.28); }
.btn-shine { position: relative; overflow: hidden; animation: cta-pulse 2.4s ease-in-out infinite; }
.btn-shine::after { content: ""; position: absolute; top: -40%; left: -60%; width: 40%; height: 180%; background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,0.55) 50%, transparent 100%); transform: skewX(-20deg); animation: shine 3s ease-in-out infinite; }
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 140%; } }
@keyframes cta-pulse { 50% { box-shadow: 0 6px 0 var(--primary-dark), 0 0 30px rgba(255, 155, 61, 0.7); } }
.home-stickers { display: flex; gap: 8px; }
.sticker { animation: bob 3s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 0.35s); }
@keyframes bob { 50% { transform: translateY(-5px) rotate(3deg); } }
.home-notice { background: rgba(255, 210, 77, 0.92); color: #4a3200; border-radius: 12px; padding: 10px 14px; font-size: 0.95rem; text-shadow: none; margin: 0; }
.disclaimer { font-size: 0.74rem; opacity: 0.72; margin: 4px 0 0; line-height: 1.45; }
/* 등장 모션: 위에서부터 순서대로 */
.home-panel > * { opacity: 0; transform: translateY(16px); }
.home-panel.enter > * { animation: fade-up 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.home-panel.enter > *:nth-child(1) { animation-delay: 0.05s; } .home-panel.enter > *:nth-child(2) { animation-delay: 0.15s; }
.home-panel.enter > *:nth-child(3) { animation-delay: 0.3s; } .home-panel.enter > *:nth-child(4) { animation-delay: 0.4s; }
.home-panel.enter > *:nth-child(5) { animation-delay: 0.5s; } .home-panel.enter > *:nth-child(6) { animation-delay: 0.55s; }
.home-panel.enter > *:nth-child(7) { animation-delay: 0.6s; } .home-panel.enter > *:nth-child(8) { animation-delay: 0.75s; }
.home-panel.enter > *:nth-child(9) { animation-delay: 0.85s; }
@keyframes fade-up { to { opacity: 1; transform: none; } }

/* ===================== 세계 선택 카드 ===================== */
#screen-select { background: radial-gradient(ellipse at top, #2b3170 0%, var(--bg) 70%); flex-direction: column; gap: 18px; padding: 24px 16px; }
.select-wrap { width: 100%; max-width: 1100px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.select-title { color: #fff; font-size: 2rem; margin: 0; text-shadow: 0 3px 10px rgba(0,0,0,0.5); }
.world-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; width: 100%; padding: 8px 4px 12px; max-height: calc(100vh - 170px); overflow-y: auto; }
.world-card { position: relative; height: 210px; border: none; border-radius: 22px; overflow: hidden; cursor: pointer; color: #fff; text-align: left; padding: 0; scroll-snap-align: center; box-shadow: 0 14px 30px rgba(0,0,0,0.4); transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s; animation: card-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 0.09s); background: #222; }
@keyframes card-in { from { opacity: 0; transform: translateY(30px) scale(0.94); } }
.world-card:hover, .world-card:focus-visible { transform: translateY(-8px) scale(1.03); box-shadow: 0 22px 40px rgba(0,0,0,0.5), 0 0 0 3px rgba(255,255,255,0.5); outline: none; }
.wc-bg { position: absolute; inset: 0; background-size: cover; background-position: center; transition: transform 0.5s; }
.world-card:hover .wc-bg { transform: scale(1.08); }
.world-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10, 12, 40, 0.92) 0%, rgba(10, 12, 40, 0.35) 50%, transparent 75%); }
.wc-icon { position: absolute; top: 14px; left: 14px; width: 64px; height: 64px; object-fit: contain; z-index: 1; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5)); animation: bob 3s ease-in-out infinite; }
.wc-sticker { position: absolute; top: 12px; right: 12px; width: 48px; height: 48px; z-index: 1; filter: drop-shadow(0 3px 5px rgba(0,0,0,0.5)); }
.wc-new { position: absolute; top: 10px; right: 10px; z-index: 2; background: var(--primary); color: #fff; font-family: "Jua", sans-serif; font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; box-shadow: 0 3px 8px rgba(0,0,0,0.4); animation: bump 1.2s ease-in-out infinite; }
.wc-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px; z-index: 1; display: flex; flex-direction: column; gap: 4px; text-shadow: 0 1px 4px rgba(0,0,0,0.7); }
.wc-body small { font-family: "Jua", sans-serif; letter-spacing: 0.06em; color: #9be7ec; font-size: 0.8rem; }
.wc-body h3 { margin: 0; font-size: 1.1rem; }
.wc-body p { margin: 0; font-size: 0.74rem; line-height: 1.35; color: rgba(255,255,255,0.85); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wc-icon { width: 52px; height: 52px; top: 10px; left: 10px; }
.wc-sticker { width: 40px; height: 40px; top: 44px; right: 10px; }
.wc-body .lv { align-self: flex-start; margin-top: 6px; background: rgba(255,255,255,0.92); color: #1f8b91; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; text-shadow: none; }

/* ===================== ⑤ 강물 길잡이 (Flanker) ===================== */
.river { position: relative; width: 100%; height: 100%; overflow: hidden; }
.fish-row { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); display: flex; gap: 2vw; align-items: center; }
.fish { width: min(11vh, 15vw, 96px); height: auto; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35)); animation: fish-bob 1.2s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 0.15s); }
.fish.flip { transform: scaleX(-1); }
.fish.center { width: min(15vh, 20vw, 130px); filter: drop-shadow(0 0 14px #fff6b0) drop-shadow(0 6px 10px rgba(0,0,0,0.35)); }
@keyframes fish-bob { 50% { translate: 0 -6px; } }
.fish-row.swim-in { animation: swim-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes swim-in { from { opacity: 0; transform: translate(-50%, -50%) scale(0.6); } }
.fish-row.swim-left { animation: swim-left 0.6s ease-in forwards; }
.fish-row.swim-right { animation: swim-right 0.6s ease-in forwards; }
@keyframes swim-left { to { transform: translate(-160%, -50%); opacity: 0; } }
@keyframes swim-right { to { transform: translate(60%, -50%); opacity: 0; } }
.fish-row.scatter { animation: scatter 0.5s ease-out forwards; }
@keyframes scatter { to { transform: translate(-50%, -50%) scale(1.3); opacity: 0; } }
.boat { position: absolute; left: 50%; bottom: 3%; width: min(28vh, 42vw, 240px); transform: translateX(-50%); transform-origin: bottom center; filter: drop-shadow(0 10px 14px rgba(0,0,0,0.4)); animation: boat-rock 2.4s ease-in-out infinite; }
@keyframes boat-rock { 50% { rotate: 2deg; translate: 0 -4px; } }
.boat.row-left { animation: row-left 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.boat.row-right { animation: row-right 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
@keyframes row-left { 40% { transform: translateX(-90%) rotate(-8deg); } to { transform: translateX(-50%); } }
@keyframes row-right { 40% { transform: translateX(-10%) rotate(8deg); } to { transform: translateX(-50%); } }
.boat.bonk { animation: boat-bonk 0.45s ease-out both; }
@keyframes boat-bonk { 25% { transform: translateX(-56%) rotate(-6deg); } 60% { transform: translateX(-44%) rotate(6deg); } to { transform: translateX(-50%); } }
.tap-btn.dir { padding: 18px 36px; font-size: 1.25rem; }
.fish-demo { display: flex; gap: 4px; align-items: center; }
.fish-demo img { width: 40px; height: 40px; }
.fish-demo img.flip { transform: scaleX(-1); }
.fish-demo img.center { width: 54px; height: 54px; filter: drop-shadow(0 0 6px #ffd24d); }

/* 황금 별별이 */
.critter.gold { filter: drop-shadow(0 0 16px #ffe680) drop-shadow(0 6px 10px rgba(0,0,0,0.35)); animation: gold-spin 0.9s ease-in-out infinite alternate; }
@keyframes gold-spin { from { transform: scale(1) rotate(-6deg); } to { transform: scale(1.08) rotate(6deg); } }

/* 도전 성공 / 별 지도 등장 */
.challenge-clear { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; background: linear-gradient(135deg, #fff3c4, #ffe08a); color: #5a3d00; border-radius: 999px; padding: 8px 16px; font-size: 0.95rem; animation: pop 0.5s ease-out both; }
.challenge-clear img { width: 28px; height: 28px; object-fit: contain; }
.region { animation: card-in 0.5s ease-out both; animation-delay: calc(var(--i, 0) * 0.1s); }

@media (max-width: 700px) {
  .home-panel { margin: 0 auto; padding: 18px 16px 90px; align-items: center; text-align: center; width: 100%; }
  .home-menu { align-items: center; }
  #screen-home { overflow-y: auto; align-items: flex-start; }
  .home-panel { padding: 14px 16px 28px; align-items: flex-start; text-align: left; }
  .home-panel .eyebrow, .home-panel .title, .home-panel .subtitle { max-width: 62%; }
  .title { font-size: clamp(2rem, 9vw, 2.6rem); }
  .subtitle { font-size: 1rem; }
  .home-stats { margin-top: 20vh; }
  .home-menu { align-items: stretch; }
  .home-menu .btn-big { width: 100%; padding: 16px 20px; font-size: 1.25rem; }
  .home-row { width: 100%; }
  .home-row .btn { flex: 1 1 auto; font-size: 0.9rem; padding: 10px 12px; }
  .home-grid { grid-template-columns: repeat(2, 1fr); max-width: none; }
  .home-grid .btn { font-size: 0.9rem; padding: 11px 6px; }
  .disclaimer { max-width: none; text-align: left; }
  .home-tint { background: linear-gradient(0deg, rgba(14, 16, 44, 0.92) 0%, rgba(14, 16, 44, 0.82) 44%, rgba(14, 16, 44, 0.3) 53%, rgba(14, 16, 44, 0.05) 70%, rgba(14, 16, 44, 0.3) 100%), linear-gradient(90deg, rgba(14, 16, 44, 0.5) 0%, rgba(14, 16, 44, 0) 55%); }
  .home-poko { filter: drop-shadow(0 10px 14px rgba(0,0,0,0.45)); }
  .btn-music { top: 10px; right: 10px; }
  /* 미션 HUD: 두 줄(제목·코인·버튼 / 진행바) */
  .hud { flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; }
  .hud-left { flex: 1 1 auto; min-width: 0; }
  .hud-left #hud-mission { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.85rem; }
  .hud-right { order: 2; min-width: 0; }
  .hud-center { order: 3; flex-basis: 100%; }
  .hud-poko { width: 34px; height: 34px; }
  .btn-music, .btn-pause { width: 36px; height: 36px; }
  .btn-music .ic, .btn-pause .ic { width: 18px; height: 18px; }
  .btn-music.hud { margin-left: 4px; } .btn-pause { margin-left: 4px; }
  /* 미션 화면 조작 요소 */
  .task-controls { padding: 10px 8px; gap: 8px; flex-wrap: nowrap; }
  .tap-btn { padding: 14px 34px; font-size: 1.15rem; }
  .tap-btn.dir { padding: 14px 14px; font-size: 1rem; flex: 1 1 0; max-width: 46%; }
  .potion-btn { width: 66px; } .potion-btn img, .potion-liquid, .potion-btn::after { width: 62px; height: 62px; }
  .potion-btn .potion-name { font-size: 0.85rem; }
  .runner-poko { --rp: 1; }
  .num-btn { width: 56px; height: 56px; font-size: 1.5rem; }
  .fruit { width: min(18vh, 26vw, 110px); }
  .bell { width: min(16vh, 17vw, 96px); }
  .fish { width: 11vw; } .fish.center { width: 14vw; }
  .fish-row { gap: 1vw; }
  .chest { width: 30vw; }
  .rule-scroll { padding: 6px 16px; font-size: 1.2rem; }
  .sign-board { padding: 8px 20px; }
  .lantern { width: 54px; height: 54px; font-size: 1.25rem; }
  .stage-map { aspect-ratio: 16 / 10; } .stage-node { width: 46px; height: 46px; font-size: 1rem; }
  .stages-guide img { height: 70px; }
  .world-card { height: 200px; }
  .reward-panel, .panel { padding: 18px 14px; }
  .sprite-box { height: 130px; } .shop-preview .sprite-box { height: 110px; }
  .story-row .sprite-box { height: 110px; }
  .intro-demo img { width: 56px; height: 56px; }
  .title { font-size: 2.6rem; }
  .fish { width: 13vw; } .fish.center { width: 17vw; }
}
@media (prefers-reduced-motion: reduce) { .home-scene, .btn-shine, .btn-shine::after, .sticker, .title span, .wc-icon, .fish, .boat { animation: none; } }

/* ===================== 스프라이트 상자(정적 표정/애니 공용) ===================== */
.sprite-box { position: relative; background: center bottom / contain no-repeat; height: 170px; width: auto; aspect-ratio: 1; display: inline-block; filter: drop-shadow(0 8px 14px rgba(0,0,0,0.2)); }
.sprite-box.static .hat-slot { display: none; }
.sprite-box.sprite { aspect-ratio: auto; }
.story-row .sprite-box { flex-shrink: 0; }
.reward-stars img.dim { filter: grayscale(1) opacity(0.3); animation: none; }
.install-hint { margin: 0; font-size: 0.8rem; background: rgba(255,255,255,0.14); border-radius: 12px; padding: 8px 12px; text-shadow: none; }
.install-hint[hidden], #btn-install[hidden] { display: none; }

/* ===================== 스테이지 지도 ===================== */
#screen-stages { background: var(--bg) center/cover no-repeat; padding: 16px; }
#screen-stages::before { content: ""; position: absolute; inset: 0; background: rgba(10, 12, 40, 0.62); }
.stages-wrap { position: relative; width: min(960px, 100%); display: flex; flex-direction: column; gap: 12px; color: #fff; }
.stages-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stages-head h2 { margin: 0; font-size: 1.6rem; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.stages-head small { font-family: "Jua", sans-serif; color: #9be7ec; letter-spacing: 0.08em; }
.stage-map { position: relative; width: 100%; aspect-ratio: 16 / 7; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.18); border-radius: 22px; backdrop-filter: blur(4px); }
.stage-path { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage-path .rail { fill: none; stroke: rgba(255,255,255,0.25); stroke-width: 1.2; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; stroke-width: 4px; }
.stage-path .rail.done { stroke: #ffd24d; stroke-dasharray: none; filter: drop-shadow(0 0 4px #ffd24d); }
.stage-node { position: absolute; transform: translate(-50%, -50%); width: clamp(52px, 8vw, 76px); height: clamp(52px, 8vw, 76px); border-radius: 50%; border: 3px solid #fff; background: radial-gradient(circle at 35% 30%, #ffe9b0, #ff9b3d 70%); color: #4a2a00; font-family: "Jua", sans-serif; font-size: 1.4rem; cursor: pointer; box-shadow: 0 8px 18px rgba(0,0,0,0.45); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; transition: transform 0.15s; animation: card-in 0.5s ease-out both; animation-delay: calc(var(--i, 0) * 0.06s); }
.stage-node:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.1); }
.stage-node .stars { font-size: 0.7rem; color: #ffd24d; text-shadow: 0 1px 2px rgba(0,0,0,0.4); margin-top: 2px; }
.stage-node .stars i { font-style: normal; color: rgba(0,0,0,0.25); }
.stage-node.locked { background: radial-gradient(circle at 35% 30%, #8b90a8, #4a4f68 70%); color: #d9dbe6; border-color: rgba(255,255,255,0.4); cursor: not-allowed; box-shadow: none; }
.stage-node.locked .stars { color: #d9dbe6; }
.stage-node.current { box-shadow: 0 0 0 6px rgba(255, 210, 77, 0.35), 0 8px 18px rgba(0,0,0,0.45); animation: card-in 0.5s ease-out both, node-pulse 1.6s ease-in-out infinite; }
@keyframes node-pulse { 50% { box-shadow: 0 0 0 12px rgba(255, 210, 77, 0.15), 0 8px 18px rgba(0,0,0,0.45); } }
.stage-node.perfect { background: radial-gradient(circle at 35% 30%, #fff7c2, #ffd24d 70%); }
.stages-guide { display: flex; align-items: center; gap: 12px; }
.stages-guide img { height: 96px; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.4)); }
.stages-guide p { margin: 0; background: rgba(255,255,255,0.92); color: var(--ink); border-radius: 16px; padding: 10px 14px; font-size: 0.95rem; }
.wc-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.wc-stars { font-size: 0.8rem; color: #ffd24d; }

/* ===================== ⑥ 숨은 별별이 찾기 ===================== */
.cave { position: relative; width: 100%; height: 100%; overflow: hidden; }
.cave.shake { animation: cave-shake 0.5s ease-out; }
@keyframes cave-shake { 20% { transform: translate(-6px, 3px); } 40% { transform: translate(6px, -3px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(4px, -2px); } }
.cave-item { position: absolute; transform: translate(-50%, -50%); width: min(12vh, 16vw, 92px); height: min(12vh, 16vw, 92px); background: none; border: none; padding: 0; cursor: pointer; animation: cave-float 2.6s ease-in-out infinite alternate; animation-delay: var(--d, 0s); }
.cave-item img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4)); pointer-events: none; }
@keyframes cave-float { to { translate: 0 -8px; } }
.cave-item.drift { animation: cave-drift 6s ease-in-out infinite alternate; animation-delay: var(--d, 0s); }
@keyframes cave-drift { to { translate: var(--dx, 0) var(--dy, 0); } }
.cave-item.found { animation: caught 0.5s ease-out forwards; }
.cave-item.found img { filter: drop-shadow(0 0 18px #ffe680); }
.cave-item.bonk img { animation: bonk 0.4s ease-out both; }
.cave-item.reveal img { filter: drop-shadow(0 0 20px #ffe680) brightness(1.3); animation: bump 0.5s ease-out 3; }

/* ===================== ⑦ 마법 보물 분류 ===================== */
.attic { position: relative; width: 100%; height: 100%; }
.rule-scroll { position: absolute; left: 50%; top: 8%; transform: translateX(-50%); background: linear-gradient(#fff7e0, #f3e4bd); border: 3px solid #c9a86a; border-radius: 14px; padding: 8px 28px; font-family: "Jua", sans-serif; font-size: clamp(1.3rem, 4vw, 2rem); color: #5a3d00; box-shadow: 0 8px 20px rgba(0,0,0,0.35); }
.rule-scroll.flip { animation: rule-flip 0.6s ease-out; }
@keyframes rule-flip { 0% { transform: translateX(-50%) rotateX(90deg); } 60% { transform: translateX(-50%) rotateX(-15deg) scale(1.08); } 100% { transform: translateX(-50%); } }
.chest { position: absolute; bottom: 4%; width: min(24vh, 32vw, 200px); display: flex; flex-direction: column; align-items: center; transition: transform 0.2s; }
.chest.left { left: 6%; } .chest.right { right: 6%; }
.chest img { width: 100%; filter: drop-shadow(0 8px 12px rgba(0,0,0,0.45)); }
.chest-label { position: absolute; top: -18px; background: rgba(255,255,255,0.92); border-radius: 14px; padding: 4px 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.chest.open { transform: scale(1.1); }
.chest.open img { filter: drop-shadow(0 0 22px #ffe680) drop-shadow(0 8px 12px rgba(0,0,0,0.45)); }
.chest.bonk { animation: bonk 0.45s ease-out both; }
.gem-slot { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.gem-wrap { display: flex; filter: drop-shadow(0 0 16px rgba(255,255,255,0.6)) drop-shadow(0 8px 10px rgba(0,0,0,0.4)); }
.gem-wrap.pop { animation: pop-in 0.25s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.gem-wrap.to-left { animation: gem-left 0.45s ease-in forwards; }
.gem-wrap.to-right { animation: gem-right 0.45s ease-in forwards; }
@keyframes gem-left { to { transform: translate(-38vw, 28vh) scale(0.3); opacity: 0; } }
@keyframes gem-right { to { transform: translate(38vw, 28vh) scale(0.3); opacity: 0; } }
.gem { display: block; }
.switch-demo { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; text-align: left; }
@media (max-width: 600px) { .stage-map { aspect-ratio: 16 / 9; } .stage-node { font-size: 1.1rem; } .chest { width: 30vw; } }

/* ===================== 스테이지 변주: 팔레트·파티클·보스·아이템 ===================== */
#screen-task.pal-dawn::before { background: linear-gradient(180deg, rgba(255, 160, 90, 0.22), rgba(90, 40, 120, 0.3)); }
#screen-task.pal-aurora::before { background: linear-gradient(180deg, rgba(90, 255, 200, 0.16), rgba(120, 80, 220, 0.28)); animation: aurora-shift 8s ease-in-out infinite alternate; }
@keyframes aurora-shift { to { background: linear-gradient(180deg, rgba(160, 120, 255, 0.2), rgba(40, 200, 180, 0.24)); } }
#screen-task.pal-dark::before { background: radial-gradient(ellipse 55% 55% at 50% 50%, rgba(10, 12, 40, 0.15) 0%, rgba(5, 6, 20, 0.85) 100%); }
#screen-task.pal-boss::before { background: radial-gradient(ellipse 70% 70% at 50% 50%, rgba(60, 10, 40, 0.2) 0%, rgba(40, 5, 30, 0.7) 100%); animation: boss-pulse 2s ease-in-out infinite; }
@keyframes boss-pulse { 50% { background: radial-gradient(ellipse 70% 70% at 50% 50%, rgba(90, 10, 40, 0.25) 0%, rgba(50, 5, 30, 0.78) 100%); } }
#screen-task.shake { animation: cave-shake 0.45s ease-out; }
.task-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.task-fx[hidden] { display: none; }
.hud-items { display: flex; gap: 8px; justify-content: center; font-size: 0.8rem; color: #ffe680; }
.hud-items span { background: rgba(255,255,255,0.14); border-radius: 999px; padding: 1px 8px; }
.hud-avatar { position: relative; display: inline-block; }
.hud-hat { position: absolute; left: 52%; top: 12%; height: 40%; width: auto; transform: translate(-50%, -64%); pointer-events: none; }
.home-hat, .box-hat { position: absolute; left: 50%; top: 14%; height: 34%; width: auto; transform: translate(-50%, -66%); pointer-events: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.35)); }
.hat-slot[hidden] { display: none; }
.boss-bar { position: relative; z-index: 3; display: flex; align-items: center; gap: 12px; margin: 0 18px; padding: 8px 14px; background: rgba(40, 5, 30, 0.75); border: 2px solid #ff6b81; border-radius: 16px; color: #fff; }
.boss-bar[hidden] { display: none; }
.boss-bar img { height: 56px; filter: drop-shadow(0 0 10px #ff6b81); }
.boss-meta { flex: 1; }
.boss-meta b { font-family: "Jua", sans-serif; }
.boss-track { height: 12px; background: rgba(255,255,255,0.15); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.boss-hp { height: 100%; width: 100%; background: linear-gradient(90deg, #ff3d6e, #ff9b3d); transition: width 0.25s; }
.boss-bar.appear { animation: pop 0.5s ease-out; }
.boss-bar.hurt img { animation: bonk 0.35s ease-out; }
.boss-bar.attack { animation: boss-attack 0.45s ease-out; }
@keyframes boss-attack { 30% { transform: scale(1.06); box-shadow: 0 0 30px #ff3d6e; } }
.stage-event { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: rgba(15, 18, 45, 0.55); z-index: 4; color: #fff; text-align: center; animation: fade-up 0.3s ease-out; }
.stage-event img { height: 120px; animation: bob 1s ease-in-out infinite; }
.stage-event b { font-family: "Jua", sans-serif; font-size: 2rem; text-shadow: 0 3px 10px rgba(0,0,0,0.6); }
.stage-event small { font-size: 1.1rem; }
.coin-rain { position: absolute; top: -40px; width: 34px; animation: coin-fall 1.4s ease-in forwards; }
@keyframes coin-fall { to { transform: translateY(110vh) rotate(360deg); } }
.intro-stage { background: linear-gradient(135deg, rgba(255, 155, 61, 0.15), rgba(79, 195, 201, 0.15)); border: 1px dashed #c9a86a; border-radius: 14px; padding: 10px 14px; margin-top: 10px; text-align: left; }
.intro-stage b { font-family: "Jua", sans-serif; font-size: 1.1rem; }
.intro-stage p { margin: 4px 0 6px; font-size: 0.95rem; }
.feat-list { display: flex; flex-wrap: wrap; gap: 6px; }
.feat-list span { font-size: 0.78rem; background: #fff; border-radius: 999px; padding: 3px 9px; color: var(--muted); }
.feat-list span.new { background: var(--primary); color: #fff; font-weight: 700; animation: bump 0.6s ease-out 2; }
.boss-result { margin-top: 8px; font-family: "Jua", sans-serif; font-size: 1.05rem; color: #7a2d4a; background: #ffe3ea; border-radius: 12px; padding: 8px 14px; }
.boss-result.win { color: #5a3d00; background: linear-gradient(135deg, #fff3c4, #ffe08a); }
.home-stats .chip.hot { background: rgba(255, 120, 60, 0.35); border-color: #ff9b3d; }
/* 상점 */
.shop-panel { position: relative; z-index: 2; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin: 14px 0; }
.hat-card { background: #fff; border: 2px solid #e6e8f2; border-radius: 18px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: transform 0.15s, border-color 0.15s; animation: card-in 0.4s ease-out both; animation-delay: calc(var(--i, 0) * 0.06s); }
.hat-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.hat-card img, .hat-card .hat-none { width: 84px; height: 84px; object-fit: contain; font-size: 2.4rem; display: flex; align-items: center; justify-content: center; }
.hat-card b { font-size: 0.95rem; }
.hat-card span { font-size: 0.85rem; color: var(--primary-dark); font-weight: 700; }
.hat-card.equipped { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 155, 61, 0.3); }
.hat-card.poor span { color: var(--muted); }
.shop-msg { min-height: 1.4em; color: #c0392b; font-size: 0.9rem; margin: 0 0 8px; }

/* ===================== 스테이지 구간별 세계 변화 (시각만) ===================== */
#screen-task.band3 .runner-bg { animation-duration: 9s; }
#screen-task.band4 .runner-bg { animation-duration: 7s; }
#screen-task.band3 .boat, #screen-task.band4 .boat { animation-duration: 1.4s; }
#screen-task.band3 .fish, #screen-task.band4 .fish { animation-duration: 0.7s; }
#screen-task.band2 .nb-cell .pad { filter: hue-rotate(-20deg) saturate(1.2); }
#screen-task.band3 .nb-cell .pad { filter: hue-rotate(20deg) brightness(1.1) drop-shadow(0 0 8px rgba(160,255,220,0.5)); }
#screen-task.band4 .nb-cell .pad { filter: hue-rotate(-40deg) brightness(0.9) drop-shadow(0 0 8px rgba(255,120,70,0.6)); }
#screen-task.band3 .cauldron, #screen-task.band4 .cauldron { box-shadow: inset 0 -10px 20px rgba(0,0,0,0.5), 0 0 30px var(--liquid, #6b6f8a); }
#screen-task.band4 .critter.sprite[data-sprite="spiky_idle"] { filter: drop-shadow(0 0 12px #ff3d6e) brightness(0.85); }
#screen-task.band3 .chest img, #screen-task.band4 .chest img { filter: drop-shadow(0 0 14px #ffd24d) drop-shadow(0 8px 12px rgba(0,0,0,0.45)); }
.goal-line { font-size: 0.9rem; margin: 4px 0 6px; }
.goal-line span { color: var(--primary-dark); font-weight: 700; }
.goal-result { margin-top: 8px; font-size: 0.95rem; color: var(--muted); background: #f2f4fb; border-radius: 12px; padding: 6px 12px; }
.goal-result.ok { color: #1f6b3a; background: #e3f7ea; font-weight: 700; }
.stage-event.treasure { background: rgba(15, 18, 45, 0.35); }
.treasure-btn { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; animation: pop 0.4s ease-out; }
.treasure-btn img { height: 140px; animation: bump 0.6s ease-in-out infinite; filter: drop-shadow(0 0 20px #ffd24d); }
.treasure-btn b { font-family: "Jua", sans-serif; font-size: 1.6rem; text-shadow: 0 3px 10px rgba(0,0,0,0.6); }
.home-today { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.1); border-radius: 999px; padding: 4px 10px 4px 12px; }
.home-today small { font-size: 0.75rem; color: #9be7ec; font-family: "Jua", sans-serif; margin-right: 4px; }
.home-today img { width: 26px; height: 26px; object-fit: contain; }

/* ===================== ⑧ 별 잇기 ===================== */
.garden { position: relative; width: 100%; height: 100%; overflow: hidden; }
.trail-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.trail-lines line { stroke: #ffb7d5; stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px #ffb7d5); }
.lantern { position: absolute; transform: translate(-50%, -50%); width: min(9vh, 13vw, 72px); height: min(9vh, 13vw, 72px); border-radius: 50%; border: 3px solid #fff; background: radial-gradient(circle at 40% 30%, #ffd6e8, #ff7fb0 70%); color: #6a1a3a; font-family: "Jua", sans-serif; font-size: 1.5rem; cursor: pointer; box-shadow: 0 6px 14px rgba(0,0,0,0.4); animation: pop-in 0.25s cubic-bezier(0.2, 1.4, 0.4, 1) both; animation-delay: var(--d, 0s); }
.lantern.lit { background: radial-gradient(circle at 40% 30%, #fff7c2, #ffd24d 70%); color: #5a3d00; box-shadow: 0 0 22px #ffd24d; }
.lantern.bonk { animation: bonk 0.4s ease-out both; }
.lantern.firework { animation: lantern-pang 0.7s ease-out both; }
@keyframes lantern-pang { 0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 22px #ffd24d; } 35% { transform: translate(-50%, -50%) scale(1.5); box-shadow: 0 0 0 18px rgba(255, 244, 184, 0.55), 0 0 60px #fff4b8; filter: brightness(1.8); } 100% { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 0 0 40px rgba(255, 244, 184, 0), 0 0 30px #ffd24d; filter: none; } }
.trail-demo { display: flex; gap: 6px; }
.trail-demo span { width: 40px; height: 40px; border-radius: 50%; background: #ff7fb0; color: #fff; font-family: "Jua", sans-serif; display: flex; align-items: center; justify-content: center; }

/* ===================== ⑨ 텐트 친구 세기 ===================== */
.camp { position: relative; width: 100%; height: 100%; overflow: hidden; }
.tent-wrap { position: absolute; left: 8%; bottom: 8%; width: min(30vh, 40vw, 260px); }
.tent { width: 100%; filter: drop-shadow(0 10px 14px rgba(0,0,0,0.45)); }
.tent-count { position: absolute; left: 50%; top: -10px; transform: translateX(-50%); background: rgba(255,255,255,0.95); color: var(--ink); border-radius: 999px; padding: 4px 12px; font-family: "Jua", sans-serif; white-space: nowrap; }
.tent-count:empty { display: none; }
.camp-lane { position: absolute; left: 0; right: 0; bottom: 12%; height: 0; }
.walker { position: absolute; bottom: 0; height: min(12vh, 16vw, 96px); filter: drop-shadow(0 6px 8px rgba(0,0,0,0.4)); }
.walker.in { right: 4%; animation: walk-in var(--dur, 1s) ease-in-out forwards; }
.walker.out { right: 4%; animation: walk-out var(--dur, 1s) ease-in-out forwards; }
@keyframes walk-in { 0% { translate: 0 0; opacity: 1; } 85% { translate: calc(-66vw + 40%) 0; opacity: 1; } 100% { translate: calc(-66vw + 40%) 0; opacity: 0; scale: 0.6; } }
@keyframes walk-out { 0% { translate: calc(-66vw + 40%) 0; opacity: 0; scale: 0.6; } 15% { translate: calc(-66vw + 40%) 0; opacity: 1; scale: 1; } 100% { translate: 0 0; opacity: 1; } }
.camp-msg { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); color: #fff; font-family: "Jua", sans-serif; font-size: 2rem; text-shadow: 0 3px 10px rgba(0,0,0,0.6); }
.num-btn { background: var(--primary); color: #fff; border: none; border-radius: 18px; width: 68px; height: 68px; font-family: "Jua", sans-serif; font-size: 1.8rem; box-shadow: 0 6px 0 var(--primary-dark); cursor: pointer; }
.num-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--primary-dark); }
.hc-demo { display: flex; align-items: center; gap: 6px; font-size: 1.4rem; }
.hc-demo img { width: 36px; height: 36px; }

/* ===================== ⑩ 풍선 순서 기억 ===================== */
.plaza { position: relative; width: 100%; height: 100%; overflow: hidden; }
.balloon { position: absolute; transform: translate(-50%, -50%); width: min(13vh, 18vw, 96px); height: min(16vh, 22vw, 116px); border: none; background: none; cursor: pointer; padding: 0; animation: bl-float 2.4s ease-in-out infinite alternate; animation-delay: var(--d, 0s); }
.balloon::before { content: ""; position: absolute; inset: 0 0 18% 0; border-radius: 50% 50% 50% 50% / 45% 45% 55% 55%; background: radial-gradient(circle at 35% 30%, #fff8 0%, var(--c) 45%, color-mix(in srgb, var(--c) 70%, #000) 100%); box-shadow: 0 8px 16px rgba(0,0,0,0.35); }
.balloon::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 2px; height: 18%; background: rgba(255,255,255,0.7); }
.balloon b { position: absolute; left: 0; right: 0; top: 30%; text-align: center; color: #fff; font-family: "Jua", sans-serif; font-size: 2rem; text-shadow: 0 2px 6px rgba(0,0,0,0.5); transition: opacity 0.25s; }
.balloon .cloud-cover { position: absolute; inset: -6% -10% 12% -10%; border-radius: 50%; background: radial-gradient(circle at 30% 40%, #fff, #e8f0ff 70%, transparent 71%), radial-gradient(circle at 70% 45%, #fff, #e8f0ff 70%, transparent 71%), radial-gradient(circle at 50% 65%, #fff, #e8f0ff 72%, transparent 73%); opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.balloon.covered b { opacity: 0; }
.balloon.covered .cloud-cover { opacity: 0.97; }
.balloon.popped { animation: caught 0.4s ease-out forwards; }
.balloon.bonk { animation: bonk 0.4s ease-out both; }
@keyframes bl-float { to { translate: 0 -10px; } }
.bl-demo { display: flex; gap: 8px; }
.bl-demo span { width: 40px; height: 48px; border-radius: 50% 50% 50% 50% / 45% 45% 55% 55%; background: var(--c); color: #fff; font-family: "Jua", sans-serif; display: flex; align-items: center; justify-content: center; }

/* ===================== ⑪ 열매 계산 ===================== */
.orchard { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.sign-board { background: linear-gradient(#c98a4b, #a86b33); border: 4px solid #6b3f1c; border-radius: 14px; padding: 12px 36px; color: #fff7e0; font-family: "Jua", sans-serif; font-size: clamp(2rem, 7vw, 3.2rem); box-shadow: 0 10px 24px rgba(0,0,0,0.4); text-shadow: 0 2px 4px rgba(0,0,0,0.4); }
.sign-board.pop { animation: pop 0.35s ease-out; }
.fruit-row { display: flex; gap: clamp(12px, 4vw, 40px); }
.fruit { position: relative; background: none; border: none; cursor: pointer; width: min(18vh, 26vw, 150px); padding: 0; animation: pop-in 0.25s cubic-bezier(0.2, 1.4, 0.4, 1) both; animation-delay: var(--d, 0s); transition: transform 0.15s; }
.fruit img { width: 100%; filter: drop-shadow(0 8px 12px rgba(0,0,0,0.4)); }
.fruit b { position: absolute; left: 0; right: 0; top: 40%; text-align: center; color: #5a3d00; font-family: "Jua", sans-serif; font-size: clamp(1.6rem, 5vw, 2.4rem); }
.fruit small { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); color: rgba(255,255,255,0.7); font-size: 0.7rem; }
.fruit:hover { transform: translateY(-6px); }
.fruit.picked { animation: caught 0.5s ease-out forwards; }
.fruit.bonk { animation: bonk 0.4s ease-out both; }
.calc-demo { display: flex; align-items: center; gap: 10px; }
.calc-demo .sign { background: #a86b33; color: #fff; border-radius: 8px; padding: 4px 10px; font-family: "Jua", sans-serif; }
.fruit-demo { width: 40px; height: 40px; border-radius: 50%; background: #ffd24d; color: #5a3d00; font-family: "Jua", sans-serif; display: flex; align-items: center; justify-content: center; }

/* ===================== 리포트 인포그래픽 ===================== */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 6px 0 14px; }
.tile { background: #f2f4fb; border-radius: 14px; padding: 10px 8px; text-align: center; }
.tile b { display: block; font-family: "Jua", sans-serif; font-size: 1.4rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); font-size: 0.75rem; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 14px; }
.report-card { background: #fff; border: 1px solid #e6e8f2; border-radius: 16px; padding: 12px 14px; text-align: center; }
.report-card h3 { margin: 0; font-size: 1.05rem; }
.card-note { margin: 2px 0 6px; font-size: 0.78rem; color: var(--muted); }
.radar { width: 100%; max-width: 260px; height: auto; }
.radar .ring { fill: none; stroke: #e6e8f2; stroke-width: 1; }
.radar .area { fill: rgba(255, 155, 61, 0.28); stroke: #e07f22; stroke-width: 2; stroke-linejoin: round; }
.radar .dot { fill: #fff; stroke: #e07f22; stroke-width: 2; }
.radar text { font-size: 9.5px; fill: var(--ink); font-family: "Noto Sans KR", sans-serif; }
.heat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 260px; margin: 6px auto; }
.heat-grid span { aspect-ratio: 1; border-radius: 5px; }
.heat-legend { display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 0.72rem; color: var(--muted); }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.rs-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.rs-head img { width: 36px; height: 36px; object-fit: contain; }
.rs-head h3 { margin: 0; font-size: 1.05rem; }
.rs-head h3 small { color: var(--muted); font-weight: 400; font-size: 0.8rem; margin-left: 4px; }
.rs-head .card-note { margin: 0; }
.rs-head .up { color: #1f6b3a; } .rs-head .down { color: #a12b22; }
.rs-acc { margin-left: auto; font-family: "Jua", sans-serif; font-size: 1.5rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: auto; display: block; }
.spark .line { fill: none; stroke: #2f9aa0; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { fill: rgba(79, 195, 201, 0.18); }
.spark .dot { fill: #fff; stroke: #2f9aa0; stroke-width: 2; }
.spark .dot.end { fill: #2f9aa0; }
.spark .guide { stroke: #e6e8f2; stroke-dasharray: 3 3; }
.star-strip { display: flex; gap: 4px; margin: 6px 0; }
.star-strip span { flex: 1; text-align: center; font-size: 0.7rem; border-radius: 6px; padding: 3px 0; background: #e6e8f2; color: var(--muted); }
.star-strip .s1 { background: #fff1c2; color: #7a5a00; } .star-strip .s2 { background: #ffe08a; color: #5a3d00; } .star-strip .s3 { background: #f2b705; color: #3d2900; font-weight: 700; }
.kv { display: flex; flex-wrap: wrap; gap: 6px; }
.kv span { background: #f2f4fb; border-radius: 10px; padding: 4px 10px; display: flex; flex-direction: column; min-width: 80px; }
.kv small { font-size: 0.7rem; color: var(--muted); }
.kv b { font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.report-section { border-top: 1px solid #e6e8f2; padding-top: 12px; }

/* 꾸미기 미리보기 */
.shop-preview { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 4px 0 8px; }
.shop-preview .sprite-box { height: 150px; }
.shop-preview p { margin: 0; font-family: "Jua", sans-serif; color: var(--muted); }
.select-title { font-size: 1.6rem; }

/* ===================== 기존 게임 티어 변주 ===================== */
.runner-spot.n6 { width: 12%; }
.runner-spot.n6:nth-child(2) { left: 30%; } .runner-spot.n6:nth-child(3) { left: 41%; } .runner-spot.n6:nth-child(4) { left: 52%; }
.runner-spot.n6:nth-child(5) { left: 63%; bottom: 40%; } .runner-spot.n6:nth-child(6) { left: 74%; bottom: 40%; } .runner-spot.n6:nth-child(7) { left: 85%; }
.critter.fog-in { animation: fog-in 0.45s ease-out both; }
@keyframes fog-in { from { opacity: 0; filter: blur(8px) brightness(0.6); transform: scale(0.8); } to { opacity: 1; filter: none; transform: none; } }
.sky-critter.drift-l { animation: drift-l var(--dur, 800ms) linear both; }
.sky-critter.drift-r { animation: drift-r var(--dur, 800ms) linear both; }
@keyframes drift-l { from { translate: 12% 0; } to { translate: -12% 0; } }
@keyframes drift-r { from { translate: -12% 0; } to { translate: 12% 0; } }
.fish-row.wobble .fish { animation: fish-wobble 0.9s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 0.12s); }
@keyframes fish-wobble { 0%, 100% { translate: 0 -8px; rotate: -6deg; } 50% { translate: 0 8px; rotate: 6deg; } }
.fish-row.wobble { animation: swim-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1) both, row-drift 4s ease-in-out infinite alternate 0.35s; }
@keyframes row-drift { to { translate: 6% 0; } }
.cave-item[data-kind="star_fake"] img { filter: saturate(0.25) brightness(1.2) drop-shadow(0 4px 8px rgba(0,0,0,0.4)); }
.rule-scroll.faded { opacity: 0.12; transition: opacity 0.5s; }

/* ===================== ⑫ 별빛 멜로디 ===================== */
.stage-scene { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 14px; padding-bottom: 12%; }
.bell-row { display: flex; gap: clamp(8px, 3vw, 28px); align-items: flex-end; }
.bell { position: relative; background: none; border: none; cursor: pointer; width: min(17vh, 20vw, 130px); padding: 0; transition: transform 0.12s; }
.bell img { width: 100%; filter: drop-shadow(0 8px 12px rgba(0,0,0,0.4)); position: relative; z-index: 1; }
.bell .bell-glow { position: absolute; inset: 8% 12% 18% 12%; border-radius: 50% 50% 45% 45%; background: radial-gradient(circle at 40% 30%, #fff8 0%, var(--c) 45%, color-mix(in srgb, var(--c) 60%, #000) 100%); opacity: 0.8; mix-blend-mode: multiply; z-index: 2; transition: opacity 0.1s, box-shadow 0.1s; }
.bell small { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); color: rgba(255,255,255,0.7); font-size: 0.7rem; }
.bell.lit { transform: translateY(-10px) scale(1.06); }
.bell.lit .bell-glow { opacity: 0.95; box-shadow: 0 0 40px var(--c), 0 0 80px var(--c); mix-blend-mode: normal; }
.bell-row.playing .bell { pointer-events: none; }
.bell-row.finale .bell { animation: bump 0.5s ease-out; }
.bell-row.finale .bell:nth-child(2) { animation-delay: 0.08s; } .bell-row.finale .bell:nth-child(3) { animation-delay: 0.16s; } .bell-row.finale .bell:nth-child(4) { animation-delay: 0.24s; } .bell-row.finale .bell:nth-child(5) { animation-delay: 0.32s; }
.melody-msg { color: #fff; font-family: "Jua", sans-serif; font-size: 1.6rem; text-shadow: 0 3px 10px rgba(0,0,0,0.6); min-height: 1.4em; }
.melody-dots { display: flex; gap: 8px; }
.melody-dots span { width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,0.25); border: 2px solid rgba(255,255,255,0.5); }
.melody-dots span.ok { background: #ffd24d; border-color: #fff; box-shadow: 0 0 8px #ffd24d; }
.melody-dots span.bad { background: #ff6b81; border-color: #fff; }
.bell-demo { display: flex; gap: 6px; }
.bell-demo span { width: 30px; height: 34px; border-radius: 50% 50% 40% 40%; background: var(--c); box-shadow: 0 0 8px var(--c); }

/* ===================== 터치 기기 최적화 ===================== */
html, body { height: 100%; }
@supports (height: 100dvh) { body { height: 100dvh; } }
body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#screen-task, .stage, .task-controls, .home-scene, .stage-map { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.stage, .task-controls { touch-action: manipulation; }
/* 터치 전용 기기에서는 키보드 안내를 숨김 */
@media (hover: none) and (pointer: coarse) { .key-hint { display: none; } .potion-name small, .fruit small, .bell small { display: none; } }
/* 세로 화면 미션: 포코·보트 등 캐릭터 크기 축소 */
@media (max-width: 600px) and (orientation: portrait) {
  .runner-poko { left: 4%; bottom: 22%; }
  .runner-spot { width: 20%; } .runner-spot.n6 { width: 16%; }
  .pond-poko { right: 2%; bottom: 0; }
  .boat { width: 38vw; }
  .tent-wrap { width: 40vw; left: 4%; }
  .cpt-box { width: 60vw; }
  .sky-critter { width: 34vw; }
  .nb-grid { width: 86vw; margin-bottom: 30%; }
  .gng-grid { width: 90vw; }
}
/* 가로 폰(높이 낮음): HUD·버튼 축소, 패널 스크롤 */
@media (max-height: 460px) {
  .hud { padding: 6px 12px; } .hud-poko { width: 30px; height: 30px; }
  .task-controls { padding: 6px; } .tap-btn { padding: 10px 28px; font-size: 1rem; }
  .panel { max-height: 100%; overflow-y: auto; padding: 14px; }
  .sprite-box, .story-row .sprite-box { height: 90px; }
  .home-panel { gap: 6px; } .title { font-size: 1.8rem; } .home-menu .btn-big { padding: 10px 24px; font-size: 1.1rem; }
  .home-stickers, .disclaimer, .install-hint { display: none; }
  .runner-poko, .pond-poko { --char-h: 30%; }
  .potion-btn img, .potion-liquid, .potion-btn::after { width: 56px; height: 56px; } .potion-btn { width: 60px; }
  .bell { width: 12vh; } .fruit { width: 22vh; }
}

/* ===================== 반짝 숲 달리기 v2: 친구들이 포코를 향해 달려온다 ===================== */
.runner-lane { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.runner-critter { position: absolute; left: 100%; bottom: 22%; width: 16%; aspect-ratio: 1; animation: run-in var(--dur, 2000ms) linear forwards; will-change: left; }
.runner-critter.bee { bottom: 46%; }
.runner-critter.log { width: 14%; bottom: 21%; }
.critter.roll { animation: roll 0.7s linear infinite; }
@keyframes roll { to { transform: rotate(-360deg); } }
/* 뛰어넘은 통나무는 발밑으로, 숙여서 피한 꿀벌은 머리 위로 그대로 지나간다 */
.runner-critter.under { z-index: 0; } .runner-critter.over { z-index: 3; }
.runner-critter.stop { animation-play-state: paused; }
.runner-critter.pull { transition: transform 0.22s ease-in; transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.6); }
.runner-critter.pull .critter.caught { animation-delay: 0.12s; }
.runner-critter.fog { animation: run-in var(--dur, 2000ms) linear forwards, defog var(--dur, 2000ms) linear both; }
#screen-task.paused .runner-critter { animation-play-state: paused; }
@keyframes run-in { to { left: -25%; } }
@keyframes defog { 0% { filter: blur(7px) brightness(0.6); opacity: 0.45; } 45% { filter: blur(4px) brightness(0.8); opacity: 0.7; } 62%, 100% { filter: none; opacity: 1; } }
.critter.hop { animation: hop 0.5s ease-in-out infinite; }
@keyframes hop { 50% { transform: translateY(-16%); } }
.critter.flap { animation: flap 0.6s ease-in-out infinite; }
@keyframes flap { 50% { transform: translateY(-14%) rotate(-5deg); } }
/* 심술이가 스쳐 지나가는 모션: 혀를 내밀고 폴짝 뛰어 옆으로 */
.critter.taunt { animation: taunt 0.6s ease-out both !important; }
@keyframes taunt { 0% { transform: none; } 35% { transform: translateY(-60%) rotate(-18deg) scale(1.12); } 70% { transform: translateY(-12%) rotate(8deg); } 100% { transform: none; } }
.critter.wink { animation: wink 0.5s ease-out both !important; }
@keyframes wink { 50% { transform: scale(1.15) rotate(-10deg); } }
.runner-poko.lean { animation: lean 0.5s ease-out both; }
@keyframes lean { 30% { transform: rotate(-16deg) translateX(-7%); } 100% { transform: none; } }
.tap-btn.jump { background: #2fb36b; box-shadow: 0 8px 0 #1f7d4a; }
.tap-btn.jump:active { box-shadow: 0 4px 0 #1f7d4a; }
.intro-demo .jump { color: #1f7d4a; }
.tap-btn.duck { background: #3f8cff; box-shadow: 0 8px 0 #2a5fb3; }
.tap-btn.duck:active { box-shadow: 0 4px 0 #2a5fb3; }
.intro-demo .duck { color: #2a5fb3; }
@media (max-width: 600px) { .runner-critter { width: 22%; } .runner-critter.log { width: 18%; } .task-controls .tap-btn { padding: 14px 16px; font-size: 1.05rem; } .task-controls .tap-btn.duck, .task-controls .tap-btn.jump { padding: 14px 14px; } }
@media (prefers-reduced-motion: reduce) { .critter.hop, .critter.flap { animation: none; } }

/* ===================== 탐험대원 카드 · 랭킹 · 초대 ===================== */
.profile-chip { display: inline-flex; align-items: center; gap: 8px; margin: 2px 0 6px; padding: 6px 14px 6px 8px; border-radius: 999px; border: 2px solid rgba(255,255,255,0.5); background: rgba(14, 16, 44, 0.45); color: #fff; font-weight: 800; font-size: 0.95rem; cursor: pointer; backdrop-filter: blur(6px); transition: transform 0.15s, background 0.15s; }
.profile-chip:hover { transform: translateY(-1px); background: rgba(255,255,255,0.25); }
.profile-chip .pc-face { width: 26px; height: 26px; border-radius: 50%; background: #ffd24d; display: inline-flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.profile-chip { position: relative; }
.profile-chip.empty { background: rgba(255, 210, 77, 0.92); color: #4a3200; border-color: #fff; }
/* 홈 패널의 등장 애니메이션(.home-panel.enter > *)과 충돌하지 않도록 반짝임은 가상 요소에 */
.profile-chip.empty::after { content: ""; position: absolute; inset: -3px; border-radius: 999px; pointer-events: none; animation: chip-glow 1.6s ease-in-out infinite; }
@keyframes chip-glow { 50% { box-shadow: 0 0 0 6px rgba(255, 210, 77, 0.35); } }
.profile-panel { width: min(520px, 100%); text-align: left; }
.profile-panel h2 { text-align: center; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-weight: 700; color: var(--ink); }
.field small { color: var(--muted); font-weight: 400; }
.field input { font: inherit; font-size: 1.2rem; padding: 12px 14px; border-radius: 14px; border: 2px solid #e6e8f2; outline: none; background: #fff; }
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255, 140, 66, 0.18); }
.age-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.age-chip { padding: 10px 14px; border-radius: 999px; border: 2px solid #e6e8f2; background: #fff; font: inherit; font-weight: 800; cursor: pointer; transition: transform 0.12s, background 0.12s; }
.age-chip:hover { transform: translateY(-2px); }
.age-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
.profile-cost { background: #fff6dc; border-radius: 12px; padding: 10px 14px; font-size: 0.95rem; color: #5a3d00; margin: 6px 0 4px; }
.rank-panel { width: min(640px, 100%); text-align: left; }
.rank-panel h2 { text-align: center; }
.me-card { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 12px; }
.me-card > div { background: linear-gradient(160deg, #fff3c9, #ffe08a); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.me-card small { color: #7a5a10; font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card b { font-family: "Jua", sans-serif; font-size: 1.5rem; color: #4a3200; font-weight: 400; }
.rank-tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.rank-tab { flex: 1 1 auto; padding: 8px 10px; border-radius: 999px; border: 2px solid #e6e8f2; background: #fff; font: inherit; font-weight: 800; font-size: 0.9rem; cursor: pointer; }
.rank-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.rank-list { display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.rank-row { display: grid; grid-template-columns: 2.2em 1fr auto auto auto; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: #f6f7fc; font-weight: 700; }
.rank-row.me { background: #fff3c9; box-shadow: inset 0 0 0 2px #ffd24d; }
.rank-row .rk { font-family: "Jua", sans-serif; font-size: 1.1rem; text-align: center; }
.rank-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .bd { font-size: 0.78rem; color: var(--muted); background: #fff; border-radius: 999px; padding: 2px 8px; }
.rank-row .pt { font-variant-numeric: tabular-nums; }
.rank-row .st { font-size: 0.85rem; color: #7a5a10; }
.rank-empty, .rank-hint { color: var(--muted); text-align: center; padding: 20px 8px; margin: 0; }
.rank-updated { color: var(--muted); font-size: 0.85rem; margin: 8px 0; text-align: center; }
.band-stats { display: flex; flex-direction: column; gap: 10px; }
.band-row { background: #f6f7fc; border-radius: 12px; padding: 10px 12px; }
.band-row.mine { background: #fff3c9; }
.band-name { font-weight: 800; margin-bottom: 4px; }
.band-bar { height: 12px; border-radius: 999px; background: #e6e8f2; overflow: hidden; }
.band-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb347, #ff8c42); border-radius: 999px; transition: width 0.4s; }
.band-meta { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.invite-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: linear-gradient(160deg, #e8f3ff, #d6ecff); border-radius: 16px; padding: 12px 16px; margin: 6px 0 12px; }
.invite-card > div { display: flex; flex-direction: column; gap: 2px; }
.invite-card small { color: #2a5fb3; font-size: 0.8rem; }
.invite-card .code { font-family: "Jua", sans-serif; font-size: 2rem; letter-spacing: 0.15em; color: #1f3f78; font-weight: 400; }
@media (max-width: 600px) {
  .me-card { grid-template-columns: 1fr 1fr 1fr; gap: 6px; } .me-card b { font-size: 1.2rem; }
  .rank-row { grid-template-columns: 2em 1fr auto auto; } .rank-row .bd { display: none; }
  .rank-tab { font-size: 0.82rem; padding: 7px 8px; }
  .profile-chip { font-size: 0.88rem; }
}

/* ===================== 캐릭터 고르기 · 스피드 도전 ===================== */
.shop-sub { margin: 14px 0 4px; font-size: 1.05rem; color: var(--ink); text-align: left; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 8px 0 4px; }
.hero-card img { width: 96px; height: 96px; }
.hero-card small { color: var(--muted); font-size: 0.78rem; line-height: 1.2; }
.hero-card.equipped { background: linear-gradient(160deg, #fff7e0, #ffe9b8); }
.stages-guide { flex-wrap: wrap; }
.stage-speed { font-size: 0.9rem; padding: 8px 14px; }
.stage-speed small { display: block; font-size: 0.72rem; opacity: 0.85; font-weight: 400; }
.stage-speed.on { background: #ffd24d; color: #4a3200; border-color: #fff; box-shadow: 0 0 16px rgba(255, 210, 77, 0.7); }
@media (max-width: 600px) { .hero-grid { grid-template-columns: repeat(2, 1fr); } .hero-card img { width: 72px; height: 72px; } }

/* ===================== 모자 착용 그림 (캐릭터마다 실제로 쓴 모습) ===================== */
.sprite-box.static.breathe { animation: breathe 3.2s ease-in-out infinite; transform-origin: bottom center; }
@keyframes breathe { 50% { transform: scaleY(1.025) scaleX(0.99); } }
.sprite-box.static.hop { animation: home-hop 0.7s cubic-bezier(0.3, 1.4, 0.5, 1) both; transform-origin: bottom center; }
@keyframes home-hop { 0% { transform: none; } 35% { transform: translateY(-14%) scaleY(1.04); } 70% { transform: translateY(0) scaleY(0.96); } 100% { transform: none; } }
