:root {
  --bg: #fffaf2;
  --panel: #ffffff;
  --mint: #d5f7ea;
  --peach: #ffe1d6;
  --sky: #d9ecff;
  --ink: #3d3a4a;
  --red: #ff6b6b;
  --blue: #4f8fff;
  --gold: #ffcf54;
}

/* ───────────── 로그인 후 인트로 영상 ───────────── */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #080b12;
}

.intro-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.intro-skip-btn {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom));
  right: max(20px, env(safe-area-inset-right));
  z-index: 2;
  padding: 10px 18px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 28, 48, 0.72);
  font: inherit;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: background 0.15s ease, transform 0.15s ease;
}

.intro-skip-btn:hover {
  background: rgba(20, 28, 48, 0.9);
}

.intro-skip-btn:active {
  transform: scale(0.96);
}

.intro-play-btn {
  position: absolute;
  left: 50%;
  bottom: max(32px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 14px 24px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 28, 48, 0.88);
  font: inherit;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.intro-video-error {
  padding: 28px;
  border-radius: 24px;
  color: #2f3a52;
  background: #fffaf2;
  text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.intro-video-error p {
  margin: 0 0 18px;
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: radial-gradient(circle at top, #fff 0%, var(--bg) 60%);
  color: var(--ink);
  overscroll-behavior-y: contain;
  -webkit-touch-callout: none;
}

/* 모바일 앱처럼: 버튼류는 더블탭 확대/탭 지연 없이 즉시 반응 */
button, .btn, a, [role="button"], .activity-picker, .stage-node,
input[type="range"], input[type="text"], input[type="number"] {
  touch-action: manipulation;
}

/* 드래그 가능한 요소는 터치 시 스크롤 대신 드래그가 되도록 */
[draggable="true"] {
  touch-action: none;
}

#app { min-height: 100vh; padding: 18px; }
.hidden { display: none !important; }

/* 모든 화면 공통 상단 버튼 바 (왼쪽: 홈, 오른쪽: 전체화면·종료)
   화면별 버튼(◀ 활동 선택, ↺ 다시 하기 등)은 app.js가 이 바 안으로 옮겨 옆에 나란히 배치 */
.global-nav {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  z-index: 950;
  display: flex;
  align-items: center;
  gap: 8px;
}
.global-nav--left { left: max(10px, env(safe-area-inset-left)); }
.global-nav--right { right: max(10px, env(safe-area-inset-right)); }

/* 모든 화면 공통: 왼쪽 하단 이전 화면 버튼 */
.global-back-btn {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 960;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
  color: #1f2b42;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.global-back-btn:hover { transform: translateY(-1px); }
.global-back-btn:active { transform: translateY(0); }
.global-back-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* 상단 바 버튼 공통 스타일 — 홈·종료·전체화면·화면별 버튼 모두 동일한 크기/색/모양 */
.global-nav button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
  color: #1f2b42;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.global-nav button:hover { transform: translateY(-1px); }
.global-nav button:active { transform: translateY(0); }
.global-nav button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* 헤더 가운데 정렬용 투명 자리 채우개 (제거된 홈 버튼 자리) */
.header-spacer { visibility: hidden; pointer-events: none; }

/* 로그인 전에는 홈·종료 버튼 숨김 (전체화면 버튼은 유지) */
body.logged-out #globalHomeBtn,
body.logged-out #globalExitBtn { display: none; }

/* app.js가 바 안으로 옮긴 화면별 버튼: 절대 위치 해제하고 나란히 배치 */
.global-nav .global-nav-item {
  position: static !important;
  inset: auto !important;
  margin: 0 !important;
}

/* 전체화면 / 창모드 전환 (모양은 위 공통 스타일 사용) */
.display-mode-btn__icon {
  font-size: 1rem;
  line-height: 1;
}
@media (max-width: 420px) {
  .display-mode-btn__label { display: none; }
}

.panel {
  background: var(--panel);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.title {
  text-align: center;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  margin: 0 0 10px;
}
.sub { text-align: center; opacity: .75; margin: 0 0 14px; }

.btn {
  border: 0; border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f0f0ff);
  color: var(--ink);
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(0,0,0,.1);
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}
.btn.primary { background: linear-gradient(180deg, #ffe987, var(--gold)); }
.btn.ghost { background: rgba(255,255,255,0.7); border: 2px solid #e0ddf2; box-shadow: none; }
.btn.stage { width: 100%; text-align: left; margin: 8px 0; }

.center { max-width: 980px; margin: 0 auto; }
.row { display: grid; gap: 12px; }
.row.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.row.three { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.login-wrap { max-width: 460px; width: min(460px, 92vw); margin: 0 auto; }
.login-screen .login-wrap {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
}
.code-input {
  width: 100%; font-size: 2rem; text-align: center; letter-spacing: .5rem;
  border: 3px solid #f0d9ff; border-radius: 18px; padding: 14px;
}

.hero {
  display: flex; align-items: center; gap: 14px; justify-content: center;
}
.hero img {
  width: 90px; height: 90px; border-radius: 50%; background: #fff;
  border: 4px solid #ffd6a0; object-fit: cover;
}

.section-card {
  margin-top: 14px;
  border-radius: 20px;
  padding: 14px;
  background: linear-gradient(180deg, #fff, #f8f9ff);
  border: 2px dashed #e6e4ff;
}
.game-area { min-height: 220px; }

/* 태극기 — 만들기 ↔ 게양하기 좌우 이동 */
.tg-activity-shell {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px;
  align-items: center; width: 100%; min-height: 300px;
}
.tg-activity-body { min-width: 0; }
.tg-nav-btn {
  flex-shrink: 0; align-self: stretch; min-height: 120px;
  padding: 12px 10px; border-radius: 14px; border: 2px solid #c9c3ec;
  background: rgba(255,255,255,0.92); color: #5a3fb0; font-weight: 800;
  font-size: 0.88rem; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  line-height: 1.3; transition: background 0.15s, transform 0.12s;
}
.tg-nav-btn span { writing-mode: vertical-rl; text-orientation: mixed; letter-spacing: 0.05em; }
.tg-nav-btn:hover { background: #f0ecff; transform: scale(1.03); }
.tg-nav-btn.active { background: linear-gradient(180deg, #fff6e0, #ffd27f); border-color: #e0a93a; color: #8a5a10; cursor: default; }
.tg-nav-btn.active:hover { transform: none; }
@media (max-width: 640px) {
  .tg-activity-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .tg-nav-btn { min-height: auto; flex-direction: row; padding: 10px 16px; align-self: auto; }
  .tg-nav-btn span { writing-mode: horizontal-tb; }
  .tg-nav-left { order: 1; }
  .tg-activity-body { order: 2; }
  .tg-nav-right { order: 3; }
}

/* 태극기 */
.tg-game {
  display: flex; gap: 18px; align-items: flex-start; justify-content: center;
  flex-wrap: wrap; width: 100%; position: relative;
}
.tg-board-wrap { flex: 1 1 340px; max-width: 560px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tg-board {
  position: relative; width: 100%; aspect-ratio: 3 / 2;
  border-radius: 12px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  transition: box-shadow 0.8s;
}
.tg-frame { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; z-index: 1; }
.tg-board-art {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
}
.tg-placed-piece {
  position: absolute; display: flex; align-items: center; justify-content: center;
}
.tg-placed-piece img {
  width: 100%; height: 100%; object-fit: contain; filter: none;
}
.tg-placed-full {
  position: absolute;
  left: 4.444%; top: 6.667%; width: 91.111%; height: 86.667%;
  display: flex; align-items: center; justify-content: center;
}
.tg-placed-full img {
  width: 100%; height: 100%; object-fit: contain; filter: none;
}
.tg-done-flag { pointer-events: none; animation: tgDoneFlagIn 0.8s ease-out forwards; }
.tg-slot {
  position: absolute; border: 2px dashed transparent; border-radius: 6px;
  transition: background 0.2s, border-color 0.2s; z-index: 3;
  touch-action: manipulation;
}
.tg-slot.over { background: rgba(255,211,77,0.25); border-color: #ffb02e; }
.tg-slot.filled { opacity: 0; pointer-events: none; border-color: transparent; }
.tg-slot.tg-slot-wrong { animation: tgSlotShake 0.4s; border-color: #e2562f; }
@keyframes tgSlotShake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.tg-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(255,240,120,0.55) 0%, transparent 70%);
  animation: tgGlowIn 1.2s ease-out forwards;
}
@keyframes tgGlowIn {
  0% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 1; }
  100% { opacity: 0.35; transform: scale(1.05); }
}
.tg-board.tg-lit { box-shadow: 0 0 40px rgba(255,200,60,0.7), 0 8px 24px rgba(0,0,0,0.15); animation: tgLitPulse 2s ease-in-out infinite; }
@keyframes tgLitPulse { 50% { box-shadow: 0 0 56px rgba(255,220,80,0.9), 0 8px 24px rgba(0,0,0,0.15); } }
.tg-hint { font-weight: 700; color: #5a3fb0; margin: 0; font-size: 0.95rem; }
.tg-complete-next {
  margin-top: 4px; font-size: 1rem; padding: 12px 22px;
  animation: tgCompleteBtnIn 0.5s ease-out;
}
@keyframes tgCompleteBtnIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tg-tray {
  flex: 0 0 200px; min-height: 280px; padding: 14px;
  background: linear-gradient(180deg, #f5efe3, #e8dcc8);
  border: 4px solid #c9b896; border-radius: 16px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.08), 4px 6px 16px rgba(0,0,0,0.12);
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.tg-tray-title { font-weight: 800; color: #6a5030; margin: 0 0 4px; font-size: 1rem; }
.tg-piece {
  width: 88px; cursor: grab; transform: rotate(var(--rot, 0deg));
  transition: transform 0.2s, filter 0.2s; text-align: center;
  touch-action: manipulation;
}
.tg-piece:active { cursor: grabbing; }
.tg-piece img {
  width: 100%; height: 72px; object-fit: contain;
  display: block; filter: drop-shadow(0 3px 5px rgba(0,0,0,0.2));
}
.tg-plabel { font-size: 0.78rem; font-weight: 800; color: #444; }
.tg-piece.tg-pulse img { animation: tgPiecePulse 0.8s ease-in-out infinite; }
@keyframes tgPiecePulse { 50% { transform: scale(1.1); } }
.tg-piece.placed { cursor: default; }
.tg-piece.placed img { opacity: 0.45; filter: grayscale(0.35) drop-shadow(0 2px 3px rgba(0,0,0,0.15)); }
.tg-piece.placed .tg-plabel { opacity: 0.6; }
.tg-piece.tg-wrong { animation: tgWrong 0.45s; }
.tg-piece.tg-selected img {
  outline: 3px solid #ffb02e;
  outline-offset: 2px;
  border-radius: 10px;
  filter: drop-shadow(0 0 8px rgba(255,176,46,0.7));
}
@keyframes tgWrong { 30% { transform: rotate(var(--rot, 0deg)) translateX(-8px); } 70% { transform: rotate(var(--rot, 0deg)) translateX(8px); } }
.tg-tooltip {
  position: fixed; transform: translate(-50%, -100%); z-index: 100;
  max-width: 240px; padding: 10px 14px; border-radius: 14px;
  background: rgba(255,255,255,0.96); border: 2px solid #6a4fb3;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18); font-weight: 700; font-size: 0.92rem;
  color: #2f3a52; pointer-events: none;
}
.tg-tooltip::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%);
  border: 8px solid transparent; border-top-color: #6a4fb3;
}

/* 태극기 게양하기 */
.tg-hoist { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tg-hoist-mission { font-size: 1.15rem; font-weight: 800; color: #c8102e; margin: 0; }
.tg-hoist-desc { font-weight: 700; color: #444; margin: 0; text-align: center; }
.tg-suho {
  padding: 10px 16px; border-radius: 14px; background: rgba(255,255,255,0.9);
  border: 2px solid #6a4fb3; font-weight: 700; color: #2f3a52; max-width: 520px; text-align: center;
}
.tg-hol-bubble {
  padding: 12px 18px; border-radius: 16px; background: #fff;
  border: 2px solid #6a4fb3; box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  font-weight: 700; color: #2f3a52; max-width: 520px; text-align: center;
  animation: tgBubbleIn 0.5s ease-out;
}
@keyframes tgBubbleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* 날짜 ↔ 국경일 연결 */
.tg-hoist-match { width: 100%; }
.tg-match-board {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 72px;
  width: 100%; max-width: 580px; padding: 16px 12px; min-height: 280px;
}
.tg-match-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }
.tg-match-line { stroke: #6a4fb3; stroke-width: 3; stroke-linecap: round; }
.tg-match-line.ok { stroke: #2eaa50; stroke-width: 4; animation: tgLineIn 0.4s ease-out; }
@keyframes tgLineIn { from { stroke-dashoffset: 200; opacity: 0; } to { opacity: 1; } }
.tg-match-col { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 10px; }
.tg-match-label { font-weight: 800; color: #5a3fb0; margin: 0 0 4px; text-align: center; font-size: 0.95rem; }
.tg-match-box {
  padding: 12px 14px; border-radius: 12px; border: 2px solid #c9c3ec;
  background: #fff; font-weight: 800; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08); transition: border-color 0.15s, background 0.15s;
}
.tg-match-box.sel { border-color: #ffb02e; background: #fff6e0; box-shadow: 0 0 0 3px rgba(255,211,77,0.45); }
.tg-match-box.done { opacity: 0.35; pointer-events: none; text-decoration: line-through; }
.tg-match-box.wrong { animation: tgWrong 0.4s; border-color: #e2562f; }
.tg-match-msg { font-weight: 700; color: #5a3fb0; text-align: center; min-height: 1.4em; margin: 0; }
.tg-hol-tray {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  padding: 14px; min-height: 70px; width: 100%; max-width: 640px;
  background: rgba(40,20,60,0.08); border-radius: 14px; border: 2px dashed #999;
}
.tg-hol-card {
  padding: 10px 14px; border-radius: 12px; cursor: grab; font-weight: 800;
  background: linear-gradient(135deg, #fff6e0, #ffd27f); border: 2px solid #e0a93a;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15); display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tg-hol-card.tg-throw { animation: tgCardThrow 0.6s ease-out backwards; }
@keyframes tgCardThrow { from { transform: translateX(120px) rotate(20deg); opacity: 0; } }
.tg-hol-card.placed { cursor: default; box-shadow: none; }
.tg-hol-card.tg-wrong { animation: tgWrong 0.4s; }
.tg-hol-type { font-size: 0.72rem; padding: 2px 8px; border-radius: 99px; }
.tg-hol-type.celebration { background: #ffe0e0; color: #c8102e; }
.tg-hol-type.memorial { background: #e8e8f0; color: #444; }
.tg-hoist-pole .tg-pole-scene {
  position: relative; width: 100%; max-width: 560px; height: min(62vh, 520px);
  border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, #87ceeb 0%, #b8dff5 55%, #e8dcc8 55%, #d4c4a8 100%);
  box-shadow: 0 10px 28px rgba(0,0,0,0.2);
}
.tg-stick-img {
  position: absolute; width: auto; max-width: 14%;
  object-fit: contain; object-position: left top;
  pointer-events: none; user-select: none; -webkit-user-drag: none; z-index: 2;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.22));
}
.tg-flag-draggable {
  position: absolute; height: 30%; width: auto; aspect-ratio: 3 / 2;
  max-height: 32%; cursor: grab; z-index: 4;
  touch-action: none; transition: top 0.15s; pointer-events: auto;
}
.tg-flag-draggable.dragging { cursor: grabbing; transition: none; }
.tg-flag-draggable.snapped { transition: top 0.35s cubic-bezier(.2,1.2,.4,1); }
.tg-flag-draggable img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  pointer-events: none; user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.28));
}
@keyframes tgDoneFlagIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.tg-hoist-guide { font-weight: 800; color: #5a3fb0; margin: 0; }
.tg-hoist-back-match {
  margin-top: 4px; font-size: 1rem; padding: 12px 22px;
  animation: tgCompleteBtnIn 0.5s ease-out;
}
.tg-hoist-pole.done .tg-flag-draggable { animation: tgFlagWind 2.5s ease-in-out infinite; }
.tg-hoist-pole.tg-wind .tg-flag-draggable,
.tg-pole-scene.tg-wind .tg-flag-draggable { animation: tgFlagWind 2.5s ease-in-out infinite; }
@keyframes tgFlagWind { 50% { transform: skewX(-3deg) scale(1.02); } }
#missionCompleteBtn.disabled, #missionCompleteBtn:disabled { opacity: 0.45; pointer-events: none; filter: grayscale(0.5); }

/* 딱지접기: 4단계 영상 따라하기 */
.ttakji-tutorial { display: flex; flex-direction: column; gap: 14px; align-items: center; width: 100%; }
.ttakji-guide {
  margin: 0; padding: 0 12px; font-size: 1rem; font-weight: 700; color: #5a3fb0; text-align: center;
}
.ttakji-viewport {
  position: relative; width: 100%; max-width: 640px;
  min-height: 120px; aspect-ratio: 16 / 9;
  border-radius: 18px; overflow: hidden;
  background: linear-gradient(180deg, #fbf7ee, #f0e9d8);
  border: 4px solid #6a4fb3; box-shadow: 0 8px 22px rgba(0,0,0,0.18);
  transition: aspect-ratio 0.35s ease, min-height 0.35s ease, box-shadow 0.35s ease;
}
.ttakji-viewport.expanded {
  aspect-ratio: 16 / 9; min-height: 0;
  box-shadow: 0 12px 32px rgba(106, 79, 179, 0.35);
}
.ttakji-viewport-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; transition: opacity 0.25s ease;
}
.ttakji-viewport-placeholder.hidden { opacity: 0; pointer-events: none; }
.ttakji-player {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
}
.ttakji-player.open { opacity: 1; pointer-events: auto; }
.ttakji-main-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: #1a1430;
}
.ttakji-player-info {
  position: absolute; left: 12px; right: 12px; top: 12px; z-index: 2;
  padding: 8px 12px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(4px);
  text-align: left; pointer-events: none;
}
.ttakji-replay-btn {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 3; min-width: 120px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.ttakji-replay-btn.hidden { display: none; }
.ttakji-stepname { font-size: 1.1rem; font-weight: 800; color: #ffe14d; }
.ttakji-stepdesc { font-size: 0.92rem; color: #fff; margin-top: 4px; font-weight: 600; }
.ttakji-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  width: 100%; max-width: 640px;
}
.ttakji-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 6px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 2px solid #e8e2f8;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.ttakji-card.active {
  border-color: #6a4fb3; transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(106, 79, 179, 0.28);
}
.ttakji-card.done { border-color: #b8a8e8; }
.ttakji-card-btn {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 6px 8px; border: 0; border-radius: 10px;
  background: #ece7f6; color: #5a3fb0; font-family: inherit;
  font-size: 0.82rem; font-weight: 800; cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.ttakji-card.active .ttakji-card-btn { background: #6a4fb3; color: #fff; }
.ttakji-card.done .ttakji-card-btn { background: #d8ccf5; }
.ttakji-card-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.08); font-size: 0.75rem;
}
.ttakji-card.active .ttakji-card-num { background: rgba(255, 255, 255, 0.25); }
.ttakji-card-label { flex: 1; text-align: left; line-height: 1.2; }
.ttakji-card-preview {
  aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: #e8e2f8; border: 2px solid rgba(106, 79, 179, 0.15);
}
.ttakji-thumb {
  width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;
}
.ttakji-thumb-static {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 72px;
  background: linear-gradient(145deg, #5b4a9a, #2f2558);
  color: #ffe14d;
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}
.ttakji-progress { font-weight: 800; color: #6a4fb3; text-align: center; }
@media (max-width: 560px) {
  .ttakji-grid { grid-template-columns: repeat(2, 1fr); }
  .ttakji-card-label { font-size: 0.76rem; }
  .ttakji-stepname { font-size: 0.95rem; }
  .ttakji-stepdesc { font-size: 0.82rem; }
}

/* 한글 퍼즐 */
.hangul-game { display: flex; flex-direction: column; gap: 14px; align-items: center; width: 100%; }
.hg-quizbar { display: flex; align-items: center; gap: 14px; }
.hg-qnum { font-weight: 800; color: #6a4fb3; }
.hg-question { font-size: 1.3rem; font-weight: 800; color: #2f3a52; text-align: center; margin: 0; }
.hg-answer { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.hg-syllable {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px; border-radius: 14px; background: rgba(255,255,255,0.6); border: 2px dashed #c9c3ec;
}
.hg-body { display: flex; flex-direction: column; align-items: center; }
.hg-body.hg-stack { gap: 4px; }
.hg-row { display: flex; gap: 6px; justify-content: center; }
.hg-bottom { margin-top: 2px; }
.hg-slot {
  width: 58px; height: 58px; border-radius: 12px; background: rgba(255,255,255,0.85);
  border: 2px solid #ddd8f3; display: flex; align-items: center; justify-content: center;
}
.hg-slot.over { border-color: #ffb02e; background: #fff6e0; }
.hg-slot.filled { border-style: solid; }
.hg-status { min-height: 1.4em; font-weight: 800; color: #e2562f; }
.hg-tray {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  padding: 14px; border-radius: 16px; background: rgba(255,255,255,0.55);
  box-shadow: inset 0 0 12px rgba(0,0,0,0.06); min-height: 70px; width: 100%; max-width: 640px;
}
.hg-traytile { border: none; background: none; padding: 0; cursor: pointer; border-radius: 12px; }
.hg-traytile.sel { outline: 3px solid #ffd34d; outline-offset: 2px; }
.hg-tile {
  width: 58px; height: 58px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; font-size: 2rem; font-weight: 800; user-select: none;
}
.hg-tile img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.hg-tile.consonant { background: #eaf2ff; color: #2f6fe0; border: 2px solid #4d96ff; }
.hg-tile.vowel { background: #fff0ea; color: #e2562f; border: 2px solid #ff7a55; }
.hg-tile:has(img) { background: none; border: none; }
.hg-traytile .hg-tile { box-shadow: 0 3px 6px rgba(0,0,0,0.18); transition: transform 0.12s; }
.hg-traytile:hover .hg-tile { transform: translateY(-3px); }
.hg-slot .hg-tile { width: 100%; height: 100%; border: none; box-shadow: none; }

/* 단청 색칠 */
.dancheong-game { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.dancheong-intro { font-weight: 800; color: #2f3a52; text-align: center; margin: 0; font-size: 1.05rem; }
.dancheong-progress { font-weight: 800; color: #c0392b; text-align: center; margin: 0; }
.dancheong-hint { text-align: center; margin: 0; color: #5a6478; }
.dancheong-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}
.dancheong-pick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 3px solid #d4c4a8;
  border-radius: 16px;
  background: linear-gradient(180deg, #fffaf2, #f5ebe0);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.dancheong-pick-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(80, 50, 20, 0.15); }
.dancheong-pick-card.done { border-color: #27ae60; background: linear-gradient(180deg, #f0fff4, #e8f8ef); }
.dancheong-pick-card img { width: 100%; max-width: 200px; aspect-ratio: 1; object-fit: contain; pointer-events: none; }
.dancheong-pick-label { font-weight: 800; color: #3d2b1f; font-size: 1rem; }
.dancheong-pick-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #27ae60;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
}
.dancheong-color-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.dancheong-pattern-name { font-weight: 800; color: #3d2b1f; flex: 1; text-align: center; }
.dancheong-workspace {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}
.dancheong-canvas-wrap {
  flex: 1 1 280px;
  max-width: 420px;
  background: #fff;
  border: 3px solid #d4c4a8;
  border-radius: 16px;
  padding: 8px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.06);
}
.dancheong-canvas-wrap .dancheong-svg { cursor: inherit; }
.dancheong-svg { width: 100%; height: auto; display: block; }
.dancheong-svg .dc-zone { transition: fill 0.12s; }
.dancheong-svg .dc-zone:hover { filter: brightness(0.95); }
.dancheong-palette {
  flex: 0 0 140px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: linear-gradient(180deg, #fff8ee, #f0e6d6);
  border: 2px solid #d4c4a8;
  border-radius: 14px;
}
.dancheong-palette-title { margin: 0 0 4px; font-weight: 800; font-size: 0.85rem; color: #3d2b1f; text-align: center; }
.dancheong-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s;
}
.dancheong-swatch:hover { transform: scale(1.03); }
.dancheong-swatch.sel { border-color: #e2562f; background: #fff; box-shadow: 0 0 0 2px rgba(226,86,47,0.25); }
.dancheong-swatch-color {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.2);
  flex-shrink: 0;
}
.dancheong-swatch-name { font-size: 0.78rem; font-weight: 700; color: #3d2b1f; }
.dancheong-status { min-height: 1.4em; font-weight: 800; color: #27ae60; text-align: center; margin: 0; }
@media (max-width: 520px) {
  .dancheong-picker { grid-template-columns: 1fr; max-width: 280px; }
  .dancheong-palette { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; justify-content: center; max-width: 100%; }
  .dancheong-swatch { flex: 0 0 calc(50% - 8px); }
}

/* 탈춤놀이 — 저스트 댄스형 */
.talchum-game { text-align: center; }
.talchum-controls { margin-top: 8px; }
.talchum-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 6px;
}
.talchum-step-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 2px solid #e0dcf0;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #6a5f88;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}
.talchum-step-btn:hover {
  border-color: #ff9ec4;
  color: #d6246a;
  transform: translateY(-1px);
}
.talchum-step-btn.current {
  background: #ff2d78;
  border-color: #ff2d78;
  color: #fff;
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(255, 45, 120, 0.35);
}
.talchum-step-btn.done {
  background: #e8fbe9;
  border-color: #7ee787;
  color: #2a7a3a;
}
.talchum-step-btn.done.current {
  background: #ff2d78;
  border-color: #ff2d78;
  color: #fff;
}
.talchum-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  font-size: 11px;
  font-weight: 900;
}
.talchum-step-btn.current .talchum-step-num { background: rgba(255, 255, 255, 0.28); }
.talchum-step-label { white-space: nowrap; }

.tc-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.tc-score { font-size: 22px; font-weight: 900; color: #4a3f7a; }
.tc-combo { font-size: 18px; font-weight: 800; color: #ff2d78; min-height: 22px; }

.tc-stage {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: #1a1430;
  box-shadow: 0 8px 28px rgba(40, 30, 80, 0.3);
}
.tc-main-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tc-move-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  text-align: left;
  padding: 8px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.tc-move-name {
  font-size: 22px;
  font-weight: 900;
  color: #ffe14d;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.tc-move-desc {
  font-size: 13px;
  color: #fff;
  margin-top: 2px;
  font-weight: 600;
}
.tc-next {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 6px;
  font-weight: 700;
}
.tc-pip-wrap {
  position: absolute;
  right: 14px;
  bottom: 52px;
  z-index: 3;
  width: 26%;
  min-width: 96px;
  max-width: 168px;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  background: #1a1430;
}
.tc-pip-wrap.hidden {
  display: none;
}
.tc-pip-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  z-index: 1;
}
.talchum-status {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: max-content;
  max-width: 62%;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.talchum-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 4;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.25);
}
.talchum-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7ee787, #2ecc71);
  transition: width 0.08s linear;
}
.talchum-progress-fill.hit { background: linear-gradient(90deg, #ffd84d, #ff2d78); }
.tc-rating {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  z-index: 5;
  font-size: 34px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 10px rgba(0,0,0,0.55);
  opacity: 0;
  pointer-events: none;
  transition: all 0.18s ease;
}
.tc-rating.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.tc-rating.perfect { color: #ffe14d; }
.tc-rating.good { color: #7ee787; }
.tc-rating.ok { color: #86c5ff; }
.tc-rating.miss { color: #ffb3c1; }
.tc-count {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  font-size: 72px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 14px rgba(0,0,0,0.6);
  pointer-events: none;
}
@media (max-width: 560px) {
  .tc-stage { aspect-ratio: 4 / 3; max-width: 100%; }
  .tc-move-name { font-size: 18px; }
  .tc-move-desc { font-size: 11px; }
  .tc-pip-wrap { width: 30%; min-width: 80px; bottom: 46px; right: 10px; }
  .talchum-status { font-size: 11px; max-width: 70%; }
}

.drop-zone {
  border: 2px dashed #b8b8d8; border-radius: 14px;
  min-height: 72px; padding: 8px;
}
.piece {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 68px; min-height: 52px; margin: 6px;
  padding: 8px 10px;
  border-radius: 14px; font-weight: 700; user-select: none;
  background: #fff; border: 2px solid #ddd;
  cursor: grab;
}
.piece.red { background: #ffd6d6; border-color: #ff9898; }
.piece.blue { background: #d7e8ff; border-color: #91bbff; }
.piece.ok { outline: 3px solid #8bf0b2; }
.piece.food.bad { border-color: #ff9a9a; background: #fff0f0; }

.ingredient-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: grab;
  user-select: none;
  animation: pulseIngredient 1.8s ease-in-out infinite;
  touch-action: manipulation;
}
.ingredient-item img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.18));
}
.ingredient-item:active { cursor: grabbing; }
.ingredient-item.dragging {
  opacity: .6;
  animation: none !important;
  transform: scale(1.08);
}
.ingredient-item.used {
  opacity: 0;
  pointer-events: none;
  animation: none;
  transform: scale(0.6);
}

.bibimbap-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 520px;
  padding-bottom: 8px;
  overflow: visible;
}
.bibimbap-msg { margin: 0; }

.pot-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 340px;
}

.pot-zone {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(340px, 78vw);
  min-height: auto;
  min-width: auto;
  border: none;
  background: transparent;
  transition: filter .2s ease;
  touch-action: manipulation;
}
.pot-zone.drag-over {
  filter: drop-shadow(0 0 18px rgba(255, 200, 80, .9));
}
.pot-zone.pot-bounce {
  animation: potBounce .4s ease;
}
.pot-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 12px 16px rgba(0,0,0,.2));
}
.pot-layers {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.pot-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: layerIn .4s ease forwards;
}
.pot-done {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: layerIn .5s ease forwards;
}
.pot-done.hidden { display: none; }

@keyframes layerIn {
  0% { opacity: 0; transform: scale(.92); }
  100% { opacity: 1; transform: scale(1); }
}

.ingredient-tray {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  padding: 8px 4px 4px;
  margin-top: auto;
  background: transparent;
  border: none;
}
.ingredient-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

@keyframes pulseIngredient {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}
@keyframes potBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* STAGE 3-3 설날과 추석 — 드래그 분류 */
.stage-panel:has(.holiday-game) {
  overflow: visible;
  background: transparent;
}

.holiday-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 480px;
}

.holiday-msg {
  margin: 0;
  text-align: center;
  max-width: 92%;
}

.holiday-board {
  position: relative;
  width: min(920px, 96vw);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  touch-action: none;
}

.holiday-bg {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.holiday-zone {
  position: absolute;
  top: 12%;
  bottom: 8%;
  width: 42%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 8px;
  padding-bottom: 8px;
  cursor: pointer;
  transition: background .2s ease, box-shadow .2s ease;
  border-radius: 16px;
}

.holiday-zone--seollal { left: 2%; }
.holiday-zone--chuseok { right: 2%; }

.holiday-zone-stack {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: min(296px, 60vw);
  margin-top: 4px;
  pointer-events: none;
}

.holiday-zone-label {
  margin-top: auto;
  font-weight: 900;
  font-size: clamp(1rem, 2.8vw, 1.35rem);
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
}

.holiday-zone.drag-over {
  background: rgba(255, 230, 120, 0.28);
  box-shadow: inset 0 0 0 4px rgba(255, 210, 60, 0.85);
}

.holiday-card-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  pointer-events: none;
}

.holiday-card {
  position: relative;
  pointer-events: auto;
  width: min(210px, 34vw);
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.28));
  transition: filter .2s ease;
}

.holiday-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: #fff;
  pointer-events: none;
  user-select: none;
}

.holiday-card-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 12px;
  font-weight: 800;
  font-size: clamp(.78rem, 2.4vw, .95rem);
  line-height: 1.3;
  text-align: center;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  border-radius: 0 0 14px 14px;
  pointer-events: none;
}

.holiday-info-panel {
  position: absolute;
  left: 50%;
  bottom: 5%;
  transform: translateX(-50%);
  z-index: 9;
  width: min(440px, 90%);
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 200, 80, 0.75);
  pointer-events: none;
}

.holiday-info-text {
  margin: 0;
  font-size: clamp(.85rem, 2.2vw, .98rem);
  line-height: 1.55;
  color: #2f3a52;
  font-weight: 700;
  text-align: center;
}

.holiday-info-panel.popup {
  animation: holidayInfoPop .42s cubic-bezier(.34, 1.3, .64, 1) forwards;
}

.holiday-card.dragging {
  cursor: grabbing;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.35));
}

.holiday-card-wrap.popup .holiday-card {
  animation: holidayPop .45s cubic-bezier(.34, 1.4, .64, 1) forwards;
}

.holiday-card--placed {
  position: relative;
  width: 100%;
  cursor: default;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.22));
}

.holiday-card--placed img {
  border-radius: 12px;
}

.holiday-card--placed .holiday-card-label {
  padding: 5px 6px;
  font-size: clamp(.58rem, 2vw, .72rem);
  border-radius: 0 0 12px 12px;
}

.holiday-card--placed.landed {
  animation: holidayLand .35s cubic-bezier(.34, 1.3, .64, 1) forwards;
}

.holiday-card.wrong-shake {
  animation: holidayShake .45s ease;
}

.holiday-progress {
  margin: 0;
  font-weight: 800;
  font-size: 1rem;
  color: #2f3a52;
  background: rgba(255, 255, 255, 0.88);
  padding: 6px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

@keyframes holidayPop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes holidayInfoPop {
  0% { transform: translateX(-50%) translateY(12px) scale(.92); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

@keyframes holidayLand {
  0% { transform: scale(.85); opacity: .6; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes holidayShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
}

.stage-panel:has(.hanbok-game) {
  overflow: visible;
}

.hanbok-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 720px;
  background: transparent;
  position: relative;
}
.doll-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 48px;
  width: 100%;
  flex-wrap: wrap;
  padding: 16px 0 8px;
  margin-top: 48px;
}
.doll-wrap {
  text-align: center;
  background: transparent;
  border: none;
  box-shadow: none;
  transform: translateY(calc(80px + 3cm)) scale(1.8);
  transform-origin: bottom center;
}
.doll-label {
  margin: 0 0 8px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #2f3a52;
  text-shadow: 0 1px 4px rgba(255,255,255,.8);
}
.doll-stage.drop-zone {
  position: relative;
  width: min(300px, 44vw);
  border: none;
  min-height: auto;
  padding: 0;
  background: transparent;
  touch-action: manipulation;
}
.doll-stage.drag-over {
  filter: drop-shadow(0 0 16px rgba(255, 210, 120, .95));
}
.doll-stage.doll-bounce {
  animation: potBounce .4s ease;
}
.doll-base {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.15));
}
.doll-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.doll-layer[data-slot="shoe"] { z-index: 2; }
.doll-layer[data-slot="bottom"] { z-index: 3; }
.doll-layer[data-slot="top"] { z-index: 4; }
.doll-layer[data-slot="outer"] { z-index: 5; }
.doll-layer[data-slot="head"] { z-index: 6; }
.doll-layer[data-slot="hair"] { z-index: 7; }
.doll-layer[data-slot="acc"] { z-index: 20; }
.doll-layer.doll-layer--icon-acc {
  width: auto;
  height: 24%;
  max-width: 18%;
  left: 50%;
  top: 41%;
  object-fit: contain;
  transform: translate(calc(-50% + var(--icon-acc-x, 0px)), var(--icon-acc-y, 0px)) scale(var(--icon-acc-scale, 1));
  transform-origin: top center;
}
.doll-layer.layer-on {
  animation: dollLayerIn .35s ease forwards;
  pointer-events: auto;
  cursor: grab;
  touch-action: manipulation;
}
@keyframes dollLayerIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
.doll-layer.layer-on.dragging {
  opacity: .55;
  cursor: grabbing;
}

.hanbok-tray-columns {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.hanbok-tray-col {
  --hanbok-tray-gap: 72px;
  --hanbok-tray-side: 50px;
  position: fixed;
  top: var(--hanbok-tray-gap);
  bottom: var(--hanbok-tray-gap);
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #e8dfc8;
  border-radius: 20px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  pointer-events: auto;
}
.hanbok-tray-col--girl {
  left: var(--hanbok-tray-side);
  border-color: #f5c4d0;
}
.hanbok-tray-col--boy {
  right: var(--hanbok-tray-side);
  border-color: #b8d4f5;
}
.hanbok-tray-col.tray-drag-over {
  filter: drop-shadow(0 0 14px rgba(255, 210, 120, .95));
  border-color: #ffd278;
}
.tray-col-label {
  margin: 0;
  font-weight: 800;
  font-size: .95rem;
}
.hanbok-tray-varrow {
  flex-shrink: 0;
  width: 44px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff8e8, #ffe9b8);
  color: #4a3d2a;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.hanbok-tray-varrow:hover {
  transform: scale(1.05);
}
.hanbok-tray-viewport--v {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hanbok-tray-viewport--v::-webkit-scrollbar {
  display: none;
}
.hanbok-tray--v {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 6px 4px;
}
.hanbok-cloth-item {
  flex-shrink: 0;
  display: inline-flex;
  cursor: grab;
  animation: pulseIngredient 1.8s ease-in-out infinite;
  touch-action: manipulation;
}
.hanbok-tray-tooltip {
  position: fixed;
  z-index: 2000;
  padding: 12px 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff 0%, #fff8fb 100%);
  border: 2.5px solid #f5b8c8;
  box-shadow: 0 6px 16px rgba(245, 160, 185, 0.25);
  font-family: "Jua", "Malgun Gothic", sans-serif;
  font-size: 1.28rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #3d4a66;
  white-space: nowrap;
  pointer-events: none;
}
.hanbok-cloth-item img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.15));
  pointer-events: none;
}
.hanbok-cloth-item.dragging {
  opacity: .55;
  animation: none;
  transform: scale(1.06);
}
.hanbok-cloth-item.hb-selected img {
  outline: 3px solid #ff8fb3;
  outline-offset: 2px;
  border-radius: 12px;
  filter: drop-shadow(0 0 10px rgba(255,143,179,0.8));
}
.hanbok-cloth-item.used {
  opacity: 0;
  pointer-events: none;
  animation: none;
  width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.magnifier { cursor: zoom-in; }
.bill {
  position: relative;
  min-height: 220px;
  background: linear-gradient(120deg,#d5f0ce,#bbddb3);
  border-radius: 20px;
  padding: 16px;
}
.hotspot {
  position: absolute;
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.7);
  display: grid; place-items: center;
  font-size: 1.7rem;
  cursor: pointer;
}
.sparkle { animation: twinkle .8s ease; }
@keyframes twinkle {
  0% { box-shadow: 0 0 0 rgba(255,255,0,0); }
  50% { box-shadow: 0 0 26px rgba(255,240,120,1); transform: scale(1.06); }
  100% { box-shadow: 0 0 0 rgba(255,255,0,0); }
}

/* STAGE 1-4 화폐 활동 */
.money-game {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.money-progress {
  font-size: 1.1rem;
  font-weight: 800;
  color: #5a3fb0;
  margin: 0;
  text-align: center;
}
.money-step-count { margin: 0; }
.money-bill-stage {
  width: 100%;
  /* 화면 크기에 맞춰 지폐 크기 조절: 가로는 화면 폭, 세로는 남은 화면 높이 기준
     (지폐 비율 약 2:1 → 높이가 넘치지 않는 최대 폭 = 남은 높이 × 1.95) */
  max-width: max(320px, min(880px, 94vw, calc((100dvh - 420px) * 1.95)));
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.92), rgba(240,235,255,0.88));
  border: 2px solid #c9c3ec;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  animation: moneyBillIn 0.45s ease-out;
}
.money-bill-stage--back { animation: moneyFlipIn 0.55s ease-out; }
@keyframes moneyBillIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes moneyFlipIn {
  from { opacity: 0; transform: perspective(600px) rotateY(-18deg); }
  to { opacity: 1; transform: none; }
}
.money-bill-wrap {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  padding-top: 96px;
  line-height: 0;
}
.money-bill-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}
.money-person-pop {
  position: absolute;
  right: 2%;
  bottom: 0;
  width: 52%;
  max-height: 94%;
  object-fit: contain;
  transform-origin: center bottom;
  z-index: 3;
  pointer-events: none;
  animation: moneyPersonPopIn 0.45s ease-out, moneyPersonPulse 1.25s ease-in-out infinite;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,0.35));
}
@keyframes moneyPersonPopIn {
  from { opacity: 0; transform: scale(0.76) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes moneyPersonPulse {
  50% { transform: scale(1.06); }
}
.money-highlight {
  position: absolute;
  border: 3px solid transparent;
  border-radius: 12px;
  pointer-events: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.money-highlight--active {
  border-color: #ffb02e;
  box-shadow: 0 0 0 4px rgba(255,176,46,0.35), 0 0 28px rgba(255,211,77,0.75);
  animation: moneyPulse 1.2s ease-in-out infinite;
}
@keyframes moneyPulse {
  50% { box-shadow: 0 0 0 6px rgba(255,176,46,0.45), 0 0 36px rgba(255,230,120,0.95); }
}
.money-highlight-label {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translate(-50%, 100%);
  padding: 4px 10px;
  border-radius: 99px;
  background: #ffb02e;
  color: #3a2800;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}
.money-bubble {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 5;
  width: calc(100% - 24px);
  max-width: 560px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.94);
  border: 2px solid #6a4fb3;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  animation: tgBubbleIn 0.5s ease-out;
}
.money-bubble-icon { font-size: 1.4rem; }
.money-bubble-text {
  flex: 1 1 200px;
  margin: 0;
  font-weight: 700;
  color: #2f3a52;
  line-height: 1.35;
  text-align: left;
}
.money-replay { flex-shrink: 0; }
.money-next {
  min-width: 140px;
  font-size: 1rem;
  padding: 12px 28px;
  margin-top: 10px;
}
.money-game--quiz .money-quiz-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #5a3fb0;
  margin: 0;
}
.money-quiz-card {
  width: 100%;
  max-width: 520px;
}
.money-quiz-q {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 16px;
  line-height: 1.5;
}
.money-quiz-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.money-quiz-choice {
  width: 100%;
  padding: 12px 10px;
  font-weight: 700;
}
.money-quiz-hint { margin: 0; text-align: center; }
.money-done-msg {
  font-size: 1.15rem;
  font-weight: 800;
  color: #2eaa50;
  text-align: center;
  margin: 0;
}
@media (max-width: 480px) {
  .money-quiz-choices { grid-template-columns: 1fr; }
}

/* 무궁화 피우기: 이야기 → 개화 게임 → 사진 찾기 */
.mugu-story, .mugu-game, .mugu-photo-game { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mugu-progress { margin: 0; font-weight: 800; color: #5a3fb0; }
.mugu-story-frame { width: 100%; max-width: 420px; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.mugu-story-img { width: 100%; height: auto; display: block; }
.mugu-bubble {
  width: calc(100% - 24px); max-width: 560px; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 18px; background: rgba(255,255,255,0.94);
  border: 2px solid #6a4fb3; box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  animation: tgBubbleIn 0.5s ease-out;
}
.mugu-bubble--ack { border-color: #2eaa50; }
.mugu-bubble-icon { font-size: 1.4rem; }
.mugu-bubble-text { flex: 1 1 200px; margin: 0; font-weight: 700; color: #2f3a52; line-height: 1.35; text-align: left; }
.mugu-next { min-width: 140px; font-size: 1rem; padding: 12px 28px; margin-top: 2px; animation: tgCompleteBtnIn 0.5s ease-out; }
.mugu-hint { font-weight: 700; color: #5a3fb0; margin: 4px 0 0; text-align: center; }

.mugu-board-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mugu-board {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  background: radial-gradient(circle at 50% 65%, #eaf7e0, #d7ecc9 70%);
  border-radius: 50%; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border: 4px solid #c9e3b0; overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.mugu-board.over { border-color: #ffb02e; box-shadow: 0 0 0 4px rgba(255,211,77,0.35), 0 8px 24px rgba(0,0,0,0.15); }
.mugu-stem { position: absolute; left: 50%; bottom: 0; width: 6%; height: 30%; background: #4c9a3a; transform: translateX(-50%); border-radius: 4px 4px 0 0; }
.mugu-board-art { position: absolute; inset: 0; }
.mugu-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.mugu-complete-photo { animation: tgGlowIn 0.6s ease-out; }
.mugu-part-art { position: relative; width: 100%; height: 100%; }
.mugu-part-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.mugu-tray {
  width: 100%; max-width: 420px; min-height: 110px; padding: 14px;
  background: linear-gradient(180deg, #f5efe3, #e8dcc8);
  border: 4px solid #c9b896; border-radius: 16px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.08), 4px 6px 16px rgba(0,0,0,0.12);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
}
.mugu-piece { width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: grab; }
.mugu-piece:active { cursor: grabbing; }
.mugu-piece .mugu-part-art { width: 56px; height: 56px; margin: 0 auto; }
.mugu-plabel { font-size: 0.78rem; font-weight: 800; color: #444; }

.mugu-done-msg { font-size: 1.15rem; font-weight: 800; color: #2eaa50; text-align: center; margin: 0; }

.mugu-photo-hint { font-weight: 700; color: #5a3fb0; margin: 0; text-align: center; }
.mugu-photo-frame { position: relative; width: 100%; max-width: 520px; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 20px rgba(0,0,0,0.15); cursor: crosshair; line-height: 0; }
.mugu-photo-img { width: 100%; height: auto; display: block; }
.mugu-photo-shake { animation: tgWrong 0.4s; }
.mugu-highlight { position: absolute; border: 3px solid transparent; border-radius: 12px; pointer-events: none; }
.mugu-highlight--active { border-color: #2eaa50; box-shadow: 0 0 0 4px rgba(46,170,80,0.35), 0 0 28px rgba(120,230,150,0.75); animation: moneyPulse 1.2s ease-in-out infinite; }
.mugu-highlight--hint { border-color: #ffb02e; box-shadow: 0 0 0 4px rgba(255,176,46,0.35); animation: moneyPulse 1.2s ease-in-out infinite; }

.track {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px;
}
.cell { height: 34px; border-radius: 10px; background: #eeeef8; position: relative; }
.token { position: absolute; left: 7px; top: 7px; width: 20px; height: 20px; border-radius: 50%; }
.token.you { background: #ff8f6e; }
.token.ai { background: #7cb5ff; }

/* ── 윷놀이 ── */
.btn.sm { padding: 4px 10px; font-size: 0.82rem; }
.yut-game {
  display: flex; gap: 14px; align-items: stretch; width: 100%;
}
.yut-left, .yut-right {
  flex: 1 1 50%; min-width: 0; display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
.yut-left { flex: 0 1 44%; }
.yut-right { flex: 1 1 56%; }
.yut-right { justify-content: flex-start; }

/* 왼쪽: 던지기 담요 */
.yut-mat {
  position: relative;
  width: min(100%, 720px);
  aspect-ratio: 1;
  min-height: unset;
  padding: 10%;
  box-sizing: border-box;
  border-radius: 24px;
  background-image: var(--img-mat); background-size: contain; background-repeat: no-repeat; background-position: center;
  display: flex; align-items: center; justify-content: center;
}
.yut-sticks {
  --yut-h: min(calc(220px * 2.5), 100%);
  --yut-w: calc(var(--yut-h) * 0.324);
  display: flex; gap: 0; perspective: 900px; align-items: center; justify-content: center;
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
}
.yut-sticks.throwing { animation: yutMatShake 0.5s ease; }
@keyframes yutMatShake { 25% { transform: translateX(-4px) rotate(-1deg); } 75% { transform: translateX(4px) rotate(1deg); } }

/* 3D 클레이 윷가락 — PNG 비율(약 1:3.1), 기존 대비 250% */
.yut-stick {
  position: relative;
  height: var(--yut-h);
  width: var(--yut-w);
  flex-shrink: 0;
  transform: translateX(var(--tx, 0)) rotateZ(var(--rz, 0deg));
  transition: transform 0.5s cubic-bezier(.2,1.1,.4,1);
  filter: drop-shadow(0 10px 8px rgba(0,0,0,0.35));
}
.yut-stick + .yut-stick { margin-left: calc(var(--yut-w) * -0.44); }
/* up=편(평평·무표식), down=볼(X표식) */
.yut-stick.spin { animation: yutToss 0.9s cubic-bezier(.25,.6,.3,1) forwards; }
@keyframes yutToss {
  0%   { transform: translate(0, 0) rotateZ(0deg); }
  35%  { transform: translate(calc(var(--tx, 0) * 0.45), -120px) rotateZ(calc(var(--rz, 0deg) * 0.4)); }
  60%  { transform: translate(calc(var(--tx, 0) * 0.8), -40px) rotateZ(calc(var(--rz, 0deg) * 0.7)); }
  100% { transform: translate(var(--tx, 0), 0) rotateZ(var(--rz, 0deg)); }
}
.yut-stick .face {
  position: absolute; inset: 0;
  background-color: transparent; background-repeat: no-repeat;
  background-position: center; background-size: contain;
  background-image: var(--img-back);
  border: none; box-shadow: none;
}
.yut-stick.up .face { background-image: var(--img-back); }
.yut-stick.down .face { background-image: var(--img-front); }

/* 오른쪽: 윷판 */
.yut-board {
  position: relative; width: 100%; max-width: 500px; aspect-ratio: 1 / 1;
  background-image: var(--img-board); background-size: contain; background-repeat: no-repeat; background-position: center;
  flex: 0 0 auto;
}
.yut-mat-result {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(232, 244, 255, 0.82) 0%, rgba(232, 244, 255, 0.35) 42%, transparent 68%);
}
.yut-mat-result-name {
  font-size: clamp(3.8rem, 16vw, 7rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.08em;
  color: #1565c0;
  text-shadow:
    0 3px 0 #e3f2fd,
    0 0 2px #fff,
    0 10px 24px rgba(21, 101, 192, 0.28);
}
.yut-mat-result-move {
  font-size: clamp(1.05rem, 3.4vw, 1.55rem);
  font-weight: 800;
  color: #0d47a1;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #90caf9;
  border-radius: 999px;
  padding: 4px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.yut-mat-result.pop .yut-mat-result-name,
.yut-mat-result.pop .yut-mat-result-move {
  animation: yutResultPop 0.55s cubic-bezier(.2, 1.25, .4, 1);
}
.yut-mat-result.pop .yut-mat-result-move {
  animation-delay: 0.05s;
  animation-fill-mode: both;
}
@keyframes yutResultPop {
  0% { transform: scale(0.35); opacity: 0; }
  65% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.yut-node { display: none; }
.yut-token {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%; border: none;
  background: transparent; background-size: contain; background-repeat: no-repeat; background-position: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.28); transition: left 0.25s, top 0.25s; z-index: 2;
}
.yut-token-badge {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  font-size: 0.78rem; font-weight: 900; line-height: 20px; text-align: center;
  color: #fff; border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35); pointer-events: none; z-index: 4;
}
.yut-token.you .yut-token-badge { background: linear-gradient(180deg, #ff6b4a, #e8381a); }
.yut-token.ai .yut-token-badge { background: linear-gradient(180deg, #5aabff, #2563eb); }
.yut-token.you { background-image: var(--img-you); transform: translate(-8px, 0); }
.yut-token.ai { background-image: var(--img-ai); transform: translate(8px, 0); }
.yut-token.clickable {
  cursor: pointer;
  z-index: 4;
  outline: 3px solid #ffd34d;
  outline-offset: 2px;
  animation: yutPulse 1s infinite;
}
.yut-move-arrow {
  position: absolute;
  top: -34px;
  left: 50%;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  pointer-events: none;
  z-index: 5;
  animation: yutArrowBounce 0.85s ease-in-out infinite;
}
.yut-move-arrow::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin: 0 auto;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 18px solid #1565c0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.28));
}
.yut-enter-hint {
  position: relative;
  z-index: 2;
  border-color: #1565c0 !important;
  color: #1565c0 !important;
  font-weight: 800;
  animation: yutEnterGlow 1.1s ease-in-out infinite;
}
.yut-enter-hint::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -26px;
  width: 0;
  height: 0;
  margin-left: -9px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 15px solid #1565c0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  animation: yutEnterArrowBounce 0.85s ease-in-out infinite;
  pointer-events: none;
}
@keyframes yutPulse { 50% { box-shadow: 0 0 14px rgba(255,211,77,0.9); } }
@keyframes yutArrowBounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(10px); opacity: 0.85; }
}
@keyframes yutEnterArrowBounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(8px); opacity: 0.85; }
}
@keyframes yutEnterGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(21, 101, 192, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(21, 101, 192, 0.18); }
}

.yut-token-pick { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.yut-token-pick-title { margin: 0; font-weight: 800; color: #5a3fb0; font-size: 1rem; }
.yut-token-options { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.yut-token-opt {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 16px; border: 3px solid #d9b65f;
  background: rgba(255,255,255,0.92); cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
}
.yut-token-opt img { width: 64px; height: 64px; object-fit: contain; }
.yut-token-opt span { font-size: 0.85rem; font-weight: 800; color: #5a3fb0; }
.yut-token-opt:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,0.12); }
.yut-token-opt.sel { border-color: #ffd34d; background: #fff6e0; box-shadow: 0 0 0 3px rgba(255,211,77,0.45); }
.yut-first-pick { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* 오른쪽: 상황판 */
.yut-panel {
  width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 8px;
  background: rgba(255,255,255,0.85); border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}
.yut-statusbar { display: flex; justify-content: space-between; align-items: center; font-size: 1.05rem; }
.yut-turn { display: inline-flex; align-items: center; gap: 8px; }
.yut-turn-token, .yut-panel-token {
  display: inline-block; width: 30px; height: 30px;
  background-size: contain; background-repeat: no-repeat; background-position: center;
  flex-shrink: 0;
}
.yut-turn-token.you, .yut-panel-token.you { background-image: var(--img-you); }
.yut-turn-token.ai, .yut-panel-token.ai { background-image: var(--img-ai); }
.yut-homes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; align-items: center; font-size: 0.9rem; }
.yut-trays { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; font-size: 0.9rem; }
.yut-tray { display: flex; align-items: center; gap: 6px; min-width: 0; }
.yut-panel-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.yut-panel-label { font-weight: 800; color: #5a3fb0; min-width: 3.8em; }
.yut-token-row { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; min-height: 30px; }
.yut-token-row.empty { min-width: 30px; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; }
.dot.you { background: #ff7a55; } .dot.ai { background: #4f95ff; }
.yut-results { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.yut-chip {
  min-width: 38px; padding: 6px 10px; border-radius: 10px; border: 2px solid #d9b65f;
  background: #fff6e0; font-weight: 800; cursor: pointer; font-size: 0.9rem; white-space: nowrap;
}
.yut-chip.sel { background: #ffd34d; border-color: #c79a2e; box-shadow: 0 0 0 3px rgba(255,211,77,0.4); }
.yut-chip:disabled { opacity: 0.6; cursor: default; }
.yut-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.yut-actions .btn.primary { font-size: 1.15rem; padding: 12px 26px; }
.yut-status { min-height: 1.4em; font-weight: 700; color: #5a3fb0; text-align: center; }

@media (max-width: 720px) {
  .yut-game { flex-direction: column; }
  .yut-left, .yut-right { flex-basis: auto; }
  .yut-mat { max-width: 100%; padding: 9%; }
  .yut-sticks { --yut-h: min(calc(180px * 2.5), 100%); }
  .yut-stick + .yut-stick { margin-left: calc(var(--yut-w) * -0.48); }
  .yut-homes, .yut-trays { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.camera {
  min-height: 220px; border-radius: 18px; border: 4px solid #222;
  background: radial-gradient(circle,#fff 10%,#f6f7ff 70%);
  display: grid; place-items: center; font-size: 1.25rem;
}
.certificate {
  border: 3px solid #ffde78; border-radius: 18px; padding: 18px;
  background: #fff7d3; text-align: center;
}

.small { font-size: .9rem; opacity: .78; }
.pill {
  display: inline-block; padding: 4px 10px; border-radius: 99px;
  background: var(--mint); font-size: .85rem; margin: 3px 4px 0 0;
}

.stage-screen {
  position: relative;
  min-height: 100vh;
  margin: -18px;
  overflow: hidden;
}
.stage-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: linear-gradient(180deg, #9bd9f5, #c9f2ce);
}
.stage-overlay {
  position: relative;
  min-height: 100vh;
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.stage-panel {
  width: min(980px, 96vw);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  margin-top: 8px;
}
.stage-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.stage-title {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.5rem);
  text-align: center;
  flex: 1;
}
.stage-panel .section-card {
  background: rgba(255, 255, 255, 0.82);
}

.activity-toolbar {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}
.act-btn {
  position: absolute;
  pointer-events: auto;
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: .92rem;
  color: #2f3a52;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
  cursor: pointer;
}
.act-btn.primary {
  background: linear-gradient(180deg, #ffe987, var(--gold));
}
.act-btn:hover {
  transform: translateY(-1px);
}
.act-tl { top: 10px; left: 10px; }
.act-tr { top: 10px; right: 10px; }
.act-br { bottom: 10px; right: 10px; }
.act-score {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.stage-panel--activity {
  margin-top: 48px;
  margin-bottom: 48px;
  width: min(980px, 96vw);
  background: transparent;
  box-shadow: none;
  padding: 8px 6px;
}
.stage-panel--activity .stage-header--activity {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}
.stage-panel--activity .stage-title {
  color: #2f3a52;
}
.stage-panel--activity .section-card {
  background: rgba(255, 255, 255, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(4px);
}
.stage-overlay:has(.stage-panel--activity) {
  align-items: stretch;
  min-height: 100vh;
}
.stage-header--activity {
  justify-content: center;
}

/* 스테이지 활동 선택 (배경 위 이미지 그리드) */
.stage-screen--menu .stage-overlay--menu {
  align-items: center;
  justify-content: center;
  padding: 8px 12px 20px;
  min-height: 100vh;
}
.activity-picker-screen {
  width: min(1100px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.activity-picker-header {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.activity-picker-title {
  flex: 1;
  text-align: center;
  margin: 0;
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}
.activity-picker-home,
.activity-picker-help {
  flex-shrink: 0;
  border: 0;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.activity-picker-hint {
  margin: 0 0 12px;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.activity-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(16px, 2.5vw, 32px);
  width: 100%;
  max-width: min(920px, 92vw);
}
/* 활동 3개 스테이지 — 1×3, 화면 세로 중앙에 배치 */
.activity-picker-grid--triple {
  grid-template-columns: repeat(3, 1fr);
  max-width: min(1100px, 96vw);
  gap: clamp(12px, 2vw, 28px);
  align-items: center;
}
.stage-screen--menu:has(.activity-picker-grid--triple) .stage-overlay--menu {
  justify-content: center;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.activity-picker-screen:has(.activity-picker-grid--triple) {
  flex: 1 1 auto;
  min-height: calc(100dvh - 36px);
  justify-content: center;
  gap: 10px;
}
.activity-picker-grid--triple .activity-picker:nth-child(odd),
.activity-picker-grid--triple .activity-picker:nth-child(even) {
  transform: none;
}
.activity-picker-grid--triple .activity-picker:nth-child(odd):hover,
.activity-picker-grid--triple .activity-picker:nth-child(even):hover {
  transform: scale(1.03);
}
.activity-picker {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s ease;
}
.activity-picker:hover {
  transform: translateY(-4px) scale(1.03);
}
.activity-picker-img {
  width: 100%;
  max-width: min(320px, 38vw);
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.38));
}
.activity-picker-grid--triple .activity-picker-img {
  max-width: min(280px, 28vw);
}
.activity-picker-label {
  font-family: "Jua", sans-serif;
  font-size: clamp(1rem, 2.4vw, 1.3rem);
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
  line-height: 1.35;
}
@media (max-width: 520px) {
  .activity-picker-grid:not(.activity-picker-grid--triple) {
    grid-template-columns: 1fr;
    max-width: 300px;
  }
  .activity-picker-grid--triple {
    max-width: 100%;
    gap: 8px;
  }
  .activity-picker-img { max-width: min(260px, 70vw); }
  .activity-picker-grid--triple .activity-picker-img {
    max-width: 120px;
  }
  .activity-picker-grid--triple .activity-picker-label {
    font-size: 0.82rem;
  }
}

.hub-wrap {
  position: relative;
  border-radius: 24px;
  overflow: visible;
  min-height: 600px;
  margin-top: 14px;
  display: grid;
  place-items: center;
}
.map-path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.map-path path {
  fill: none;
  stroke: #fff8d1;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 2 1.2;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
}
.stage-node {
  position: absolute;
  width: 190px;
  height: 190px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #2f2d47;
  font-weight: 800;
  box-shadow: 0 8px 0 rgba(91, 114, 139, .35), 0 10px 16px rgba(0,0,0,.2);
  transition: transform .15s ease;
  animation: pulseNode 1.8s ease-in-out infinite;
}
.stage-node:hover { transform: translateY(-2px) scale(1.04); }
.stage-node img {
  width: 138px;
  height: 138px;
  object-fit: contain;
  border-radius: 12px;
}
.stage-node .label {
  position: absolute;
  left: 50%;
  bottom: -42px;
  transform: translateX(-50%);
  width: 290px;
  border-radius: 999px;
  display: inline-block;
  padding: 6px 16px;
  text-align: center;
  font-size: .9rem;
  white-space: nowrap;
  background: #fff;
  border: 2px solid #c8d0f0;
  z-index: 4;
}
.stage-node.s1 { left: 9%; top: 8%; background: linear-gradient(180deg, #ffd9de, #ffb8bf); animation-delay: .0s; }
.stage-node.s2 { left: 1.5%; top: 71%; background: linear-gradient(180deg, #d9ebff, #bcd8ff); animation-delay: .2s; }
.stage-node.s3 { right: 9%; top: 8%; background: linear-gradient(180deg, #f6ddff, #e8c4ff); animation-delay: .4s; }
.stage-node.s4 { right: 1.5%; top: 71%; background: linear-gradient(180deg, #ffeeb8, #ffd970); animation-delay: .6s; }

.home-screen {
  position: relative;
  min-height: 100vh;
  margin: -18px;
  overflow: hidden;
}
.home-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: linear-gradient(180deg, #9bd9f5, #c9f2ce);
}
.home-overlay {
  position: relative;
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(0,0,0,.02), rgba(0,0,0,.08));
  display: grid;
  place-items: center;
  padding: 16px 16px 24px;
}
.home-center {
  width: min(980px, 96vw);
  text-align: center;
}
.home-title {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 3.2rem);
  color: #ffffff;
  text-shadow: 0 4px 12px rgba(0,0,0,.28);
  letter-spacing: .04em;
}
.home-character {
  margin-top: 0;
  width: min(260px, 42vw);
  height: auto;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.24));
  transform: translateY(88px);
}
.home-progress {
  display: inline-block;
  margin: 8px 0 10px;
  color: #233046;
  background: rgba(255,255,255,.8);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
}
.home-tools { margin-bottom: 12px; }

.corner-btn {
  position: absolute;
  top: 14px;
  z-index: 3;
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 800;
  color: #1f2b42;
  background: rgba(255,255,255,.86);
  box-shadow: 0 6px 12px rgba(0,0,0,.15);
  cursor: pointer;
}
.corner-btn.left { left: 14px; }
.corner-btn.right { right: 14px; }
.home-score {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}
.session-badge {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}
.session-badge--save,
.session-badge--teacher {
  background: rgba(232, 248, 255, 0.95);
  color: #0b5f8a;
}
.session-badge--guest {
  background: rgba(255, 244, 220, 0.95);
  color: #8a5a00;
}
.session-badge--online {
  top: 92px;
  background: rgba(232, 255, 240, 0.95);
  color: #1a7a3a;
}

@keyframes pulseNode {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ── 우리민요 얼쑤! 리듬 게임 ── */
.rhythm-stage {
  margin: -18px;
}
.stage-screen.rhythm-stage {
  overflow-x: auto;
  overflow-y: hidden;
}
.rhythm-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rhythm-stage-overlay {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 16px 24px;
  z-index: 1;
}
.rhythm-stage-header {
  text-align: center;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 20px;
  padding: 10px 20px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}
.rhythm-stage-header--compact {
  margin-bottom: 8px;
  padding: 6px 14px;
}
.rhythm-stage-title {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  color: #2f3a52;
}
.rhythm-menu-card {
  width: min(520px, 94vw);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  padding: 24px 20px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  text-align: center;
}
.rhythm-menu-desc {
  margin: 0 0 18px;
  font-size: 1.05rem;
  line-height: 1.5;
  color: #3d3a4a;
}
.rhythm-song-grid {
  display: grid;
  gap: 14px;
}
.rhythm-song-btn {
  border: 3px solid #ffd970;
  border-radius: 20px;
  padding: 20px 16px;
  background: linear-gradient(180deg, #fff9e8, #ffeab8);
  cursor: pointer;
  font-size: 1.15rem;
  color: #2f3a52;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease;
}
.rhythm-song-btn:hover {
  transform: translateY(-2px) scale(1.02);
}
.rhythm-song-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 6px;
}
.rhythm-level-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.rhythm-level-btn {
  border: 2px solid #b8d4f5;
  border-radius: 16px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #fff, #eef6ff);
  font-weight: 800;
  font-size: 1rem;
  color: #2f3a52;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}
.rhythm-level-btn:hover:not(.locked) {
  transform: translateY(-1px);
}
.rhythm-level-btn.locked {
  opacity: 0.55;
  cursor: not-allowed;
  background: #ececec;
  border-color: #ccc;
}
.rhythm-back-btn {
  width: 100%;
}
/* ── 세마치 장단 연습 (3단계 전) ── */
.rhythm-semachi-card {
  width: min(560px, 96vw);
}
.semachi-pattern-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 4px;
  margin: 12px 0 6px;
  padding: 10px 8px;
  border-radius: 14px;
  background: rgba(20, 16, 12, 0.55);
  border: 2px solid rgba(255, 220, 100, 0.45);
}
.semachi-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  font-family: "Jua", sans-serif;
  font-size: clamp(14px, 3.2vw, 20px);
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}
.semachi-cell--hit {
  color: #ffe8a8;
  background: rgba(255, 200, 80, 0.15);
  font-weight: 400;
}
.semachi-cell--rest {
  color: rgba(255, 255, 255, 0.35);
}
.semachi-cell--active {
  transform: scale(1.06);
  background: rgba(255, 220, 100, 0.28);
  color: #fff;
}
.semachi-cell--sung {
  background: rgba(120, 200, 140, 0.35);
  color: #fff;
}
.semachi-pattern-caption {
  margin: 0 0 10px;
  font-family: "Jua", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: #3d3a4a;
}
.semachi-status {
  margin: 0 0 4px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #2f3a52;
  min-height: 1.4em;
}
.semachi-feedback {
  margin: 0 0 8px;
  min-height: 1.3em;
  font-weight: 800;
  font-size: 1rem;
}
.semachi-feedback--good {
  color: #2a9d5c;
}
.semachi-feedback--miss {
  color: #e07a5f;
}
.semachi-playfield {
  min-height: auto;
  margin: 4px 0 0;
  width: 100%;
}
.semachi-playfield .rhythm-note-zone {
  min-height: 90px;
}
.semachi-playfield .rhythm-janggu-area {
  min-height: min(140px, 28vw);
}
.semachi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 12px 0 14px;
}
.semachi-actions .btn {
  flex: 1 1 140px;
}
.rhythm-game {
  position: relative;
  width: min(1100px, 98vw);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 120px);
}
.rhythm-lyrics-wrap {
  width: 100%;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  padding: 0 4px;
  overflow: visible;
}
.rhythm-lyrics {
  text-align: center;
  font-family: "Jua", sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 400;
  line-height: 1.5;
  width: 100%;
}
/* ── 정간보 9칸 그리드 (경기 아리랑 노래방 자막) ── */
.jg-score {
  width: 100%;
  overflow: visible;
  padding: 6px 0;
}
.jg-score-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 6px;
}
.jg-slot-title {
  margin: 0 0 2px;
  font-family: "Jua", sans-serif;
  font-size: clamp(14px, 2vw, 18px);
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.02em;
}
.jg-measures {
  display: flex;
  flex-wrap: nowrap;
  gap: clamp(4px, 0.9vw, 10px);
  width: 100%;
  max-width: 1080px;
  justify-content: center;
}
.jg-measure {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 260px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: rgba(20, 16, 12, 0.55);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
  padding-top: 16px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.jg-measure--future {
  opacity: 0.38;
  transform: scale(0.97);
}
.jg-measure--past {
  opacity: 0.72;
}
.jg-measure--current {
  opacity: 1;
  border-color: rgba(255, 220, 100, 0.65);
  box-shadow: 0 0 14px rgba(255, 200, 50, 0.25);
}
.jg-accent {
  position: absolute;
  top: 3px;
  left: 7px;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 700;
  line-height: 1;
}
.jg-lyric-row {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
}
.jg-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(28px, 4.2vw, 36px);
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-family: "Jua", sans-serif;
  font-size: clamp(12px, 1.6vw, 18px);
  color: #fff;
  box-sizing: border-box;
  transition: color 0.12s ease, background 0.12s ease;
}
.jg-cell--dae {
  border-right: 2px solid rgba(255, 255, 255, 0.38);
}
.jg-cell--lyric {
  background: rgba(255, 255, 255, 0.06);
}
.jg-cell--empty {
  color: rgba(255, 255, 255, 0.15);
}
.jg-cell--lyric.sung {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.22);
  font-weight: 400;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.45);
}
.rhythm-lyric-line {
  margin: 6px 0;
  word-break: keep-all;
}
.rhythm-lyric-line--next {
  font-size: 0.72em;
  opacity: 0.65;
}
.rhythm-lyric-intro {
  margin: 0 0 8px;
  font-family: "Jua", sans-serif;
  font-size: 0.85em;
  font-weight: 400;
  color: #ffe566;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.rhythm-syllable--space {
  display: inline-block;
  width: 0.35em;
}
.rhythm-syllable {
  color: #fff;
  -webkit-text-stroke: 2.5px #1a1a1a;
  text-shadow: 2px 2px 0 #1a1a1a, -1px -1px 0 #1a1a1a;
  transition: color 0.12s ease;
  padding: 0 2px;
}
.rhythm-syllable.sung {
  color: #ffe566;
  -webkit-text-stroke: 2.5px #1a1a1a;
}
.rhythm-hud {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  font-weight: 800;
}
.rhythm-hud-level {
  font-size: 0.85rem;
  color: #555;
}
.rhythm-hud-score {
  font-size: 1.2rem;
  color: #2f3a52;
}
.rhythm-feedback {
  min-width: 120px;
  text-align: center;
  font-size: 1.05rem;
}
.rhythm-feedback--good {
  color: #2a9d5c;
}
.rhythm-feedback--miss {
  color: #e07a5f;
}
.rhythm-playfield {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(360px, 72vw);
  flex: 1;
  min-height: 300px;
  margin: 8px 0;
  margin-top: auto;
  isolation: isolate;
  overflow: visible;
}
.rhythm-note-zone {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 110px;
  pointer-events: none;
  z-index: 11;
}
.rhythm-janggu-area {
  position: relative;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  min-height: min(160px, 32vw);
  z-index: 4;
  pointer-events: none;
}
.rhythm-janggu-img {
  width: min(220px, 44vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
  pointer-events: none;
}
.rhythm-stick-target {
  position: absolute;
  bottom: 8%;
  z-index: 5;
  display: inline-flex;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  outline: none;
  pointer-events: auto;
  transform-origin: center bottom;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.rhythm-stick-target--gunggeul {
  left: 8%;
}
.rhythm-stick-target--yeol {
  right: calc(8% - 3.3cm);
  bottom: calc(8% + 1cm);
  transform: rotate(-75deg);
}
.rhythm-stick-target--both {
  left: 50%;
  bottom: 2%;
  transform: translateX(-50%);
  width: min(56px, 13vw);
  height: min(56px, 13vw);
  border-radius: 50%;
  background: linear-gradient(180deg, #fff3d6, #ffcf54);
  box-shadow: 0 4px 10px rgba(0,0,0,.2);
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #6a4a12;
  font-size: 1rem;
}
.rhythm-stick-target--both:active { transform: translateX(-50%) scale(.9); }
.rhythm-stick-target img {
  width: min(108px, 24vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.22));
  pointer-events: none;
  transform-origin: center bottom;
}
.rhythm-stick-target.rhythm-target--bounce:not(.rhythm-stick-target--yeol) {
  animation: rhythmSogoBounceBtn 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.rhythm-stick-target--yeol.rhythm-target--bounce {
  animation: rhythmYeolStickBounceBtn 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.rhythm-stick-target:not(.rhythm-stick-target--yeol) .rhythm-target-img--bounce {
  animation: rhythmSogoBounceImg 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.rhythm-stick-target--yeol .rhythm-target-img--bounce {
  animation: rhythmSogoBounceImg 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.rhythm-note-zone .rhythm-note {
  position: absolute;
  top: 50%;
  width: 78px;
  height: 78px;
  z-index: 12;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}
.rhythm-note--gunggeul {
  left: 14%;
}
.rhythm-note--yeol {
  left: 86%;
}
.rhythm-sound-label {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: "Jua", sans-serif;
  font-size: clamp(2.4rem, 9vw, 3.2rem);
  font-weight: 400;
  line-height: 1;
  color: #2f3a52;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.9), 0 4px 14px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  z-index: 14;
  animation: rhythmSoundLabelPop 0.7s ease forwards;
}
.rhythm-sound-label--deong {
  left: 50%;
}
.rhythm-sound-label--kung {
  left: 14%;
}
.rhythm-sound-label--deok {
  left: 86%;
}
@keyframes rhythmSoundLabelPop {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  18% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
  55% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.92); opacity: 0; }
}
.rhythm-note img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
}
.rhythm-note--gunggeul img {
  transform: rotate(60deg);
}
.rhythm-note--yeol img {
  transform: rotate(-60deg);
}
.rhythm-note--hit {
  animation: rhythmNoteHit 0.2s ease forwards;
}
.rhythm-note--miss {
  opacity: 0.4;
  animation: rhythmNoteMiss 0.4s ease forwards;
}
@keyframes rhythmNoteHit {
  to { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
}
@keyframes rhythmNoteMiss {
  to { transform: translate(-50%, -50%) scale(0.85); opacity: 0; }
}
.rhythm-target--bounce:not(.rhythm-stick-target--yeol) {
  animation: rhythmSogoBounceBtn 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.rhythm-target-img--bounce {
  animation: rhythmSogoBounceImg 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes rhythmSogoBounceBtn {
  0% { transform: scale(1); }
  35% { transform: scale(1.18); }
  65% { transform: scale(0.94); }
  100% { transform: scale(1); }
}
@keyframes rhythmYeolStickBounceBtn {
  0% { transform: rotate(-75deg) scale(1); }
  35% { transform: rotate(-75deg) scale(1.18); }
  65% { transform: rotate(-75deg) scale(0.94); }
  100% { transform: rotate(-75deg) scale(1); }
}
@keyframes rhythmSogoBounceImg {
  0% { transform: scale(1) translateY(0); }
  35% { transform: scale(1.28) translateY(-14px); }
  65% { transform: scale(0.95) translateY(5px); }
  100% { transform: scale(1) translateY(0); }
}
.rhythm-hint {
  margin: 8px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.rhythm-start-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 20px;
  z-index: 20;
}
.rhythm-start-btn {
  font-size: 1.3rem;
  padding: 16px 32px;
}
.rhythm-ending-card {
  max-width: 560px;
}
.rhythm-ending-msg {
  margin: 16px 0;
  font-size: 1.05rem;
  line-height: 1.5;
}

/* ── 국보 보물 보상 팝업 (SweetAlert2) ── */
.treasure-reward-popup {
  border-radius: 20px !important;
  padding: 1.4rem 1.2rem 1.1rem !important;
}
.treasure-reward-popup .swal2-title {
  font-size: 1.55rem !important;
  color: #5c2a00 !important;
  margin-bottom: 0.55rem !important;
}
.treasure-reward-text {
  margin: 0 0 1rem;
  font-size: 1.02rem;
  line-height: 1.55;
  color: #333;
  word-break: keep-all;
}
.treasure-reward-text strong {
  color: #b45309;
}
.treasure-reward-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.85rem;
  padding: 12px;
  max-width: 360px;
  background: linear-gradient(145deg, #fff8e7 0%, #ffe9b8 100%);
  border: 4px solid #d4a017;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(180, 83, 9, 0.18);
}
.treasure-reward-img {
  display: block;
  width: min(72vw, 300px);
  height: min(72vw, 300px);
  object-fit: contain;
  border-radius: 10px;
}
.treasure-reward-score {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #166534;
}
.treasure-reward-confirm {
  font-size: 1.05rem !important;
  padding: 0.55rem 1.4rem !important;
}
.treasure-detail-mission {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: #92400e;
  font-weight: 700;
}
.treasure-detail-story {
  margin: 0.85rem 0 0;
  font-size: 0.98rem;
  line-height: 1.5;
  color: #444;
  word-break: keep-all;
}

/* ── 보물도감 목록 화면 ── */
.treasure-album-entry {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #5c2a00;
  background: linear-gradient(180deg, #fff8e7 0%, #ffd978 100%);
  box-shadow: 0 8px 20px rgba(180, 83, 9, 0.28);
  cursor: pointer;
}
.treasure-album-entry:hover {
  transform: translateX(-50%) translateY(-2px);
}
.treasure-album-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(180, 83, 9, 0.15);
  font-size: 0.92rem;
}

.treasure-album-screen {
  position: relative;
  min-height: 100vh;
  margin: -18px;
  overflow: hidden;
}
.treasure-album-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 236, 179, 0.55), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(255, 207, 84, 0.35), transparent 40%),
    linear-gradient(165deg, #5c3d1e 0%, #8b5a2b 35%, #c4956a 100%);
}
.treasure-album-overlay {
  position: relative;
  min-height: 100vh;
  padding: 18px 16px 28px;
  max-width: 1080px;
  margin: 0 auto;
}
.treasure-album-header {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}
.treasure-album-back {
  justify-self: start;
  font-weight: 800;
}
.treasure-album-heading {
  text-align: center;
}
.treasure-album-title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: #fff8e7;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}
.treasure-album-sub {
  margin: 8px auto 0;
  max-width: 560px;
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(255, 248, 231, 0.92);
  word-break: keep-all;
}
.treasure-album-progress {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 10px 18px;
  border-radius: 16px;
  background: rgba(255, 248, 231, 0.95);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  font-weight: 800;
}
.treasure-album-progress-num {
  font-size: 1.8rem;
  color: #b45309;
}
.treasure-album-progress-sep,
.treasure-album-progress-total {
  font-size: 1.2rem;
  color: #78716c;
}
.treasure-album-progress-label {
  margin-left: 8px;
  font-size: 0.95rem;
  color: #57534e;
}

.treasure-album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.treasure-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 12px 10px 14px;
  border-radius: 18px;
  text-align: center;
  border: 3px solid transparent;
  background: rgba(255, 248, 231, 0.94);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}
.treasure-card--owned {
  cursor: pointer;
  border-color: #d4a017;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.treasure-card--owned:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(180, 83, 9, 0.25);
}
.treasure-card--locked {
  opacity: 0.82;
  border-color: #d6d3d1;
  background: rgba(245, 245, 244, 0.88);
}
.treasure-card-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(145deg, #fff8e7, #ffe9b8);
}
.treasure-card--locked .treasure-card-frame {
  background: linear-gradient(145deg, #e7e5e4, #d6d3d1);
}
.treasure-card-frame img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}
.treasure-card-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 1.1rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}
.treasure-card-lock {
  font-size: 2.2rem;
  line-height: 1;
}
.treasure-card-lock-label {
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #78716c;
}
.treasure-card-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: #44403c;
  line-height: 1.35;
  word-break: keep-all;
}
.treasure-card--locked .treasure-card-name {
  color: #a8a29e;
}
.treasure-card-mission {
  font-size: 0.72rem;
  font-weight: 700;
  color: #92400e;
  line-height: 1.3;
  word-break: keep-all;
}
.treasure-card--locked .treasure-card-mission {
  color: #78716c;
}

@media (min-width: 600px) {
  .treasure-album-grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 14px 10px;
  }
  .treasure-card {
    grid-column: span 2;
  }
  /* 마지막 줄 4개 가운데 정렬 (5-5-4 배열) */
  .treasure-card:nth-child(11) {
    grid-column: 2 / span 2;
  }
}

@media (min-width: 720px) {
  .treasure-album-header {
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
  .treasure-album-back { grid-row: 1; }
  .treasure-album-heading { grid-column: 2; }
  .treasure-album-progress {
    grid-row: 1;
    grid-column: 3;
    flex-direction: column;
    align-items: center;
    gap: 0;
    min-width: 110px;
  }
  .treasure-album-progress-label {
    margin-left: 0;
    margin-top: 2px;
  }
}

/* STAGE 1-3 애국가 — 월드컵 시상식 노래방 */
.anthem-activity {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
}
.anthem-story {
  background: linear-gradient(135deg, #1e3a5f 0%, #0f2744 100%);
  color: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  text-align: center;
}
.anthem-story-lead {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 800;
}
.anthem-story-sub {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  opacity: 0.92;
}
.anthem-mode-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.anthem-mode-btn {
  flex: 1;
  max-width: 200px;
  padding: 10px 12px;
  border: 2px solid #c4b5fd;
  border-radius: 12px;
  background: #fff;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.anthem-mode-btn:hover { background: #f5f3ff; transform: scale(1.02); }
.anthem-mode-btn.active {
  background: linear-gradient(180deg, #fef3c7, #fcd34d);
  border-color: #d97706;
  color: #78350f;
}
.anthem-mode-hint {
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  color: #57534e;
  font-weight: 600;
}
.anthem-ceremony {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 160px;
  max-height: 280px;
  background-color: #0c1929;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.anthem-ceremony-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.anthem-karaoke-wrap {
  background: #0f0f1a;
  border-radius: 14px;
  padding: 12px 14px;
  border: 2px solid #3b3b5c;
  width: 100%;
  margin: 0 auto;
}
.anthem-karaoke-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.anthem-karaoke-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #a78bfa;
}
.anthem-time {
  font-size: 0.82rem;
  font-weight: 700;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}
.anthem-karaoke { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.anthem-duration-hint {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #78716c;
}
.anthem-karaoke-line {
  position: relative;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  overflow: hidden;
  font-size: clamp(0.88rem, 3.5vw, 1.05rem);
  font-weight: 700;
  line-height: 1.5;
  word-break: keep-all;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.anthem-karaoke-line--future {
  color: #64748b;
  background: rgba(255,255,255,0.04);
}
.anthem-karaoke-line--past {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
}
.anthem-karaoke-line--active {
  color: #fff;
  background: rgba(251, 191, 36, 0.18);
  box-shadow: 0 0 0 2px #fbbf24;
}
.anthem-karaoke-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(251,191,36,0.35), rgba(251,191,36,0.08));
  transition: width 0.08s linear;
  pointer-events: none;
}
.anthem-karaoke-text { position: relative; z-index: 1; }
.anthem-wave-area { display: flex; flex-direction: column; gap: 6px; }
.anthem-wave-canvas {
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #1a1a2e;
  border: 1px solid #334155;
}
.anthem-wave-canvas--compare { min-height: 80px; }
.anthem-status {
  margin: 0;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: #44403c;
}
.anthem-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.anthem-controls .btn { min-width: 140px; }
.anthem-score-panel {
  text-align: center;
  background: linear-gradient(180deg, #fffbeb, #fef3c7);
  border: 2px solid #fbbf24;
  border-radius: 14px;
  padding: 14px;
}
.anthem-score-title {
  margin: 0 0 4px;
  font-size: 0.88rem;
  font-weight: 800;
  color: #92400e;
}
.anthem-score-val {
  margin: 0;
  font-size: 2rem;
  font-weight: 900;
  color: #b45309;
  line-height: 1.2;
}
.anthem-score-msg {
  margin: 6px 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #78350f;
}

/* ── STAGE 2-2 한옥 집짓기 ── */
#app:has(#hanok-embed) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding: 0;
  box-sizing: border-box;
}
.stage-screen:has(#hanok-embed) {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}
.stage-overlay:has(#hanok-embed) {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.stage-panel--activity:has(#hanok-embed) {
  margin: 44px 6px;
  padding: 2px 4px;
  height: calc(100dvh - 88px);
  max-height: calc(100dvh - 88px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.stage-panel--activity:has(#hanok-embed) .stage-header--activity {
  flex: 0 0 auto;
  margin-bottom: 4px;
  padding: 6px 12px;
}
.stage-panel--activity:has(#hanok-embed) #hanok-embed {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.stage-panel--activity:has(#hanok-embed) #hanok-embed > .hk-wrap {
  flex: 1 1 auto;
  min-height: 0;
}
@media (max-height: 620px) {
  .stage-panel--activity:has(#hanok-embed) {
    margin: 40px 4px;
    height: calc(100dvh - 80px);
    max-height: calc(100dvh - 80px);
  }
}
.hanok-game { text-align: center; }
.hanok-msg {
  margin: 0 0 8px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #2f3a52;
}
.hanok-learn {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff8e6, #ffe8cc);
  font-size: 0.92rem;
  font-weight: 700;
  color: #7c4a03;
  line-height: 1.45;
}
.hanok-touch-hint {
  margin-top: 10px;
  font-size: 0.85rem;
  opacity: 0.75;
}

/* 스토리 */
.hanok-story { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hanok-char { font-size: 2.4rem; line-height: 1; }
.hanok-char--artisan { animation: hanok-bob 2s ease-in-out infinite; }
.hanok-char--kid { animation: hanok-bob 2s ease-in-out infinite .4s; }
@keyframes hanok-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.hanok-vs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.hanok-vs-card {
  flex: 1;
  min-width: 120px;
  max-width: 160px;
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.hanok-vs-card--modern { background: linear-gradient(180deg, #e8ecf2, #cfd8e6); }
.hanok-vs-card--hanok { background: linear-gradient(180deg, #f5e6c8, #e8c98a); }
.hanok-vs-icon { font-size: 2rem; display: block; margin-bottom: 4px; }
.hanok-vs-card p { margin: 4px 0 0; font-size: 0.82rem; opacity: 0.85; }
.hanok-vs-arrow { font-size: 1.4rem; font-weight: 900; color: #c45c26; }
.hanok-bubble {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 18px;
  background: #fff;
  border: 3px solid #7cb87c;
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}
.hanok-bubble-speaker { margin: 0; font-weight: 900; color: #2e6b2e; font-size: 0.9rem; }
.hanok-bubble-text { margin: 8px 0; font-size: 1.05rem; line-height: 1.5; }
.hanok-bubble-tip { margin: 0; font-size: 0.88rem; color: #5a4a32; line-height: 1.45; }

.hanok-sync-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  background: #eceff3;
  color: #566;
}
.hanok-sync-badge--on { background: linear-gradient(135deg, #d6f2e0, #b8e8cc); color: #206b3f; }

/* 나무 베기 */
.hanok-wood-scene {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 220px;
  margin: 0 auto 14px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #cdeeff 0%, #eaf7d9 70%, #cfead1 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  touch-action: manipulation;
  cursor: pointer;
  user-select: none;
}
.hanok-wood-tree {
  font-size: 5.5rem;
  line-height: 1;
  margin-bottom: 8px;
  transform-origin: bottom center;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.18));
}
.hanok-wood-tree.wobble { animation: hanokWoodWobble .35s ease; }
.hanok-wood-tree.miss-shake { animation: hanok-shake .3s ease; }
.hanok-wood-tree.falling { animation: hanokWoodFall .8s ease forwards; }
@keyframes hanokWoodWobble {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-8deg); }
  60% { transform: rotate(6deg); }
}
@keyframes hanokWoodFall {
  0% { transform: rotate(0deg); opacity: 1; }
  100% { transform: rotate(85deg) translateY(10px); opacity: .3; }
}
.hanok-wood-gauge {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 26px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8e2d4, #d2c8b0);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.15);
  overflow: hidden;
}
.hanok-wood-zone {
  position: absolute;
  left: 38%;
  width: 24%;
  top: 0;
  bottom: 0;
  background: linear-gradient(180deg, #8fe08f, #4caf50);
}
.hanok-wood-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 10px;
  border-radius: 6px;
  background: #e8622c;
  box-shadow: 0 0 6px rgba(0,0,0,.35);
  transform: translateX(-50%);
}

/* 대패질 (문틀용 나무) */
.hanok-plane-scene {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 160px;
  margin: 0 auto 14px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #fff3d6 0%, #f7e0ae 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.hanok-plane-plank {
  font-size: 4.5rem;
  line-height: 1;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.18)) saturate(.7);
  transition: filter .3s ease;
}
.hanok-plane-plank.smoother { filter: drop-shadow(0 6px 8px rgba(0,0,0,.18)) saturate(1.15) brightness(1.08); }
.hanok-plane-tool {
  position: absolute;
  left: 20%;
  top: 50%;
  font-size: 2.2rem;
  transform: translateY(-50%);
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.2));
}
.hanok-plane-tool.swish { animation: hanokPlaneSwish .35s ease; }
@keyframes hanokPlaneSwish {
  0% { transform: translateY(-50%) translateX(0) rotate(0deg); }
  50% { transform: translateY(-50%) translateX(70px) rotate(-8deg); }
  100% { transform: translateY(-50%) translateX(0) rotate(0deg); }
}

/* 주춧돌 찾기 */
.hanok-stone-scene {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 260px;
  margin: 0 auto 12px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #cdeeff 0%, #dff0e0 45%, #cbb488 100%);
}
.hanok-stone {
  position: absolute;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 6px;
  touch-action: manipulation;
  transition: transform .15s ease;
}
.hanok-stone--flat { font-size: 2.6rem; filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); }
.hanok-stone--round { font-size: 1.6rem; opacity: .85; filter: drop-shadow(0 3px 3px rgba(0,0,0,.2)); }
.hanok-stone:focus-visible {
  outline: 3px solid #ffb02e;
  outline-offset: 3px;
  border-radius: 12px;
}
.hanok-stone.shake { animation: hanok-shake .35s ease; }
.hanok-stone.picked {
  animation: hanok-pop .4s ease forwards;
  opacity: .15;
  pointer-events: none;
}
.hanok-stone-basket { font-weight: 800; color: #5a4a32; }

/* 황토 캐기 */
.hanok-mound-wrap { display: flex; justify-content: center; margin-bottom: 14px; }
.hanok-mound {
  border: 0;
  background: transparent;
  font-size: 6rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.2));
}
.hanok-mound.pop { animation: hanok-pop .3s ease; }
.hanok-gauge-bar {
  width: 100%;
  max-width: 320px;
  height: 22px;
  margin: 0 auto;
  border-radius: 999px;
  background: #e8e2d4;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.15);
  overflow: hidden;
}
.hanok-gauge-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(180deg, #f0b96b, #c97f2e);
  transition: width .15s ease;
}

/* 창호지 */
.hanok-paper-frame {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.hanok-paper-door {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: min(220px, 80vw);
  padding: 14px;
  border: 6px solid #8b5a2b;
  border-radius: 8px;
  background: #d4a574;
}
.hanok-paper-slot {
  aspect-ratio: 1;
  border: 3px dashed rgba(255,255,255,.7);
  border-radius: 6px;
  background: rgba(0,0,0,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}
.hanok-paper-slot.filled {
  background: #f5f0e0;
  border-style: solid;
  border-color: #fff;
}
.hanok-paper-pieces {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.hanok-paper-piece {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(180deg, #fff, #f0e8d8);
  box-shadow: 0 4px 10px rgba(0,0,0,.12);
}
.hanok-paper-piece.used { opacity: .35; pointer-events: none; }

/* 온돌 */
.hanok-ondol { max-width: 320px; margin: 0 auto; }
.hanok-ondol-fire, .hanok-ondol-floor {
  padding: 8px;
  font-weight: 800;
  border-radius: 12px;
  margin: 6px 0;
}
.hanok-ondol-fire { background: #ffe0cc; }
.hanok-ondol-floor { background: #e8ddd0; }
.hanok-ondol-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0;
}
.hanok-ondol-cell {
  aspect-ratio: 1.4;
  border: 0;
  border-radius: 12px;
  font-size: 1.2rem;
  cursor: pointer;
  background: linear-gradient(180deg, #c9b896, #a89070);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.15);
}
.hanok-ondol-cell--empty { background: transparent; box-shadow: none; }
.hanok-ondol-cell.done {
  background: linear-gradient(180deg, #ff9a5c, #e86c2a);
  animation: hanok-pop .35s ease;
}
.hanok-ondol-cell.shake { animation: hanok-shake .4s ease; }
.hanok-ondol-progress { font-weight: 900; font-size: 1.1rem; }

/* 쿼터뷰 조립 */
.hanok-iso-scene {
  position: relative;
  width: min(300px, 90vw);
  height: 260px;
  margin: 0 auto 16px;
  perspective: 600px;
}
.hanok-iso-ground {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 220px;
  height: 80px;
  transform: translateX(-50%) rotateX(58deg) rotateZ(45deg);
  background: linear-gradient(135deg, #8fbc6a, #6b9b4a);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
}
.hanok-iso-layer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + var(--layer-i) * 36px);
  width: calc(140px + var(--layer-i) * 8px);
  padding: 10px 14px;
  border-radius: 42% 58% 61% 39% / 45% 40% 60% 55%;
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,255,255,.55), rgba(255,255,255,0) 55%),
    linear-gradient(145deg, #f7ead0, #ddb87a);
  border: 3px solid rgba(139,90,43,.35);
  box-shadow: 0 8px 16px rgba(0,0,0,.15), inset 0 -4px 6px rgba(139,90,43,.18);
  opacity: .25;
  transition: opacity .3s, transform .35s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
}
.hanok-iso-layer.placed { opacity: 1; }
.hanok-iso-layer.pop { animation: hanok-pop .45s ease; }
.hanok-iso-layer[data-layer="stone"] {
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,255,255,.5), rgba(255,255,255,0) 55%),
    linear-gradient(145deg, #d9d3c8, #a79c8c);
}
.hanok-iso-layer[data-layer="wood"] {
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,255,255,.4), rgba(255,255,255,0) 55%),
    linear-gradient(145deg, #d8a35f, #a5652c);
}
.hanok-iso-layer[data-layer="earth"] {
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,255,255,.4), rgba(255,255,255,0) 55%),
    linear-gradient(145deg, #d99a63, #b5652f);
}
.hanok-iso-layer[data-layer="roof"] {
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,255,255,.35), rgba(255,255,255,0) 55%),
    linear-gradient(145deg, #7d8b96, #3f4a54);
  color: #fff;
}
.hanok-iso-layer[data-layer="paper"] {
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,255,255,.7), rgba(255,255,255,0) 55%),
    linear-gradient(145deg, #fffaf0, #f0e6cf);
}
.hanok-iso-layer[data-layer="ondol"] {
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,255,255,.4), rgba(255,255,255,0) 55%),
    linear-gradient(145deg, #f2a765, #d9722c);
}
.hanok-iso-layer[data-layer="floor"] {
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,255,255,.45), rgba(255,255,255,0) 55%),
    linear-gradient(145deg, #e8c97a, #c79a44);
}
.hanok-iso-emoji { font-size: 1.6rem; }
.hanok-iso-label { font-size: 0.88rem; }
.hanok-iso-guide {
  position: absolute;
  bottom: calc(16px + var(--layer-i, 0) * 36px);
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 44px;
  border: 3px dashed #e86c2a;
  border-radius: 12px;
  animation: hanok-pulse 1.2s ease infinite;
  pointer-events: none;
}
@keyframes hanok-pulse {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}
@keyframes hanok-pop {
  0% { transform: translateX(-50%) scale(.7); }
  60% { transform: translateX(-50%) scale(1.08); }
  100% { transform: translateX(-50%) scale(1); }
}
@keyframes hanok-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.hanok-build-tray {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.hanok-build-piece {
  border: 0;
  border-radius: 16px;
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: grab;
  background: linear-gradient(180deg, #fff8e8, #f0d8a8);
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
}
.hanok-build-piece.dragging { transform: scale(1.05); }
.hanok-built-list { font-size: 0.88rem; opacity: 0.8; margin-top: 10px; }

/* 이름 · 마을 */
.hanok-name-preview { font-size: 4rem; margin: 10px 0; }
.hanok-name-input {
  width: min(320px, 100%);
  padding: 12px 16px;
  border: 3px solid #7cb87c;
  border-radius: 14px;
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 12px;
}
.hanok-village-grid {
  display: grid;
  grid-template-columns: repeat(var(--village-cols, 6), 1fr);
  gap: 8px;
  max-width: 560px;
  margin: 0 auto 14px;
}
.hanok-village-house {
  border: 0;
  border-radius: 12px;
  padding: 8px 4px;
  cursor: pointer;
  background: linear-gradient(180deg, #fff5e0, #f0d8a0);
  box-shadow: 0 4px 10px rgba(0,0,0,.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 72px;
  position: relative;
}
.hanok-village-house.mine { border: 3px solid #e86c2a; }
.hanok-village-house { transition: transform .15s ease; }
.hanok-village-house:active { transform: scale(.94); }
.hanok-village-roof { font-size: 1.4rem; }
.hanok-village-name {
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.2;
  word-break: keep-all;
}
.hanok-village-likes { font-size: 0.7rem; }
.hanok-village-liked { position: absolute; top: 2px; right: 2px; font-size: 0.75rem; }
.hanok-village-empty {
  min-height: 72px;
  border-radius: 12px;
  background: rgba(124,184,124,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  opacity: 0.6;
}
.hanok-village-actions { margin-top: 8px; }
.hanok-detail-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
  text-align: center;
}
.hanok-detail-card h3 { margin: 0 0 8px; }

@media (max-width: 480px) {
  .hanok-village-name { font-size: 0.55rem; }
  .hanok-wood-scene { height: 190px; }
  .hanok-stone-scene { height: 220px; }
}

/* ═══════════════════════════════════════════════════════════
   태블릿 — 레이아웃·버튼 배치 (스크롤 허용)
   (가로 600px+ 태블릿 · 세로 1024px 이하 또는 가로 1024px 이하)
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 600px) and (max-height: 1024px),
       (min-width: 600px) and (max-width: 1024px) {

  :root {
    --tablet-safe-top: 76px;
    --tablet-safe-bottom: 12px;
    --tablet-safe-x: 10px;
  }

  #app {
    min-height: 100dvh;
    padding: 8px;
    box-sizing: border-box;
  }

  .panel { padding: 12px; border-radius: 18px; }
  .title { font-size: clamp(1.05rem, 1.8vw, 1.45rem); margin-bottom: 6px; }
  .sub { margin-bottom: 8px; font-size: 0.86rem; }
  .btn { padding: 8px 12px; font-size: 0.88rem; border-radius: 12px; }
  .section-card { margin-top: 8px; padding: 10px; border-radius: 14px; }
  .game-area { min-height: 120px; }
  .hero img { width: 64px; height: 64px; }
  .code-input { font-size: 1.5rem; padding: 10px; }
  .login-wrap { max-width: 400px; }

  .login-screen .home-overlay {
    padding: 12px;
    overflow: visible;
  }

  .login-screen .home-center {
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .login-screen .login-wrap {
    padding: 10px 12px;
  }

  .login-screen .title { font-size: 1.15rem; }
  .login-screen .btn.stage { margin: 4px 0; padding: 9px 12px; }
  .login-screen .section-card { margin-top: 6px; padding: 8px; }

  /* ── 홈 / 로그인 ── */
  .home-screen,
  .treasure-album-screen,
  .stage-screen {
    min-height: 100vh;
    margin: -8px;
  }

  .home-overlay,
  .treasure-album-overlay,
  .stage-overlay {
    min-height: 100vh;
    padding: 48px 16px 52px;
    overflow: visible;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .login-screen .home-overlay {
    padding: 16px;
    justify-content: center;
  }

  .home-center {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    width: min(920px, 100%);
    margin: 0 auto;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .login-screen .home-center {
    width: 100%;
  }

  .home-title {
    font-size: clamp(1.35rem, 2.8vw, 1.85rem);
    flex-shrink: 0;
    margin-bottom: 6px;
  }

  .home-screen:not(.login-screen) .hub-wrap {
    flex: 0 1 auto;
    width: min(820px, 94%);
    margin: 0 auto;
    aspect-ratio: 4 / 3;
    max-height: min(56dvh, 460px);
    min-height: 0;
    align-self: center;
  }

  .home-screen:not(.login-screen) .home-character {
    width: min(190px, 30%);
    transform: translateY(6%);
  }

  .home-screen:not(.login-screen) .stage-node.s1 { left: 5%; top: 11%; }
  .home-screen:not(.login-screen) .stage-node.s2 { left: 5%; top: 57%; }
  .home-screen:not(.login-screen) .stage-node.s3 { right: 5%; top: 11%; }
  .home-screen:not(.login-screen) .stage-node.s4 { right: 5%; top: 57%; }

  .home-progress { margin: 4px 0 6px; padding: 4px 12px; font-size: 0.88rem; }
  .home-tools { margin-bottom: 6px; flex-shrink: 0; }

  .stage-node {
    width: 148px;
    height: 148px;
  }
  .stage-node img {
    width: 108px;
    height: 108px;
  }
  .stage-node .label {
    width: 210px;
    bottom: -30px;
    font-size: 0.78rem;
    padding: 4px 10px;
  }

  .corner-btn { top: 10px; padding: 7px 10px; font-size: 0.85rem; z-index: 8; }
  .corner-btn.left { left: 10px; }
  .corner-btn.right { right: 10px; }
  .home-score { top: 10px; padding: 5px 12px; font-size: 0.88rem; z-index: 8; }
  .session-badge { top: 46px; font-size: 11px; padding: 4px 10px; z-index: 8; }
  .session-badge--online { top: 74px; }
  .treasure-album-entry {
    bottom: 12px;
    padding: 8px 16px;
    font-size: 0.92rem;
    z-index: 8;
  }

  /* 스테이지 인트로 등 */
  .stage-panel:not(.stage-panel--activity) {
    margin: 0 auto;
    padding: 12px 14px;
    width: min(680px, calc(100% - 20px));
    overflow: visible;
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
  }

  .stage-panel:not(.stage-panel--activity) .section-card {
    overflow: visible;
    flex-shrink: 0;
  }

  .stage-panel:not(.stage-panel--activity) .btn.primary {
    flex-shrink: 0;
    margin-top: 8px;
  }

  .stage-header { margin-bottom: 8px; flex-shrink: 0; }
  .stage-title { font-size: clamp(0.95rem, 1.8vw, 1.25rem); }

  /* ── 활동 화면: 툴바를 상단 바로 재배치 (버튼 잘림 방지) ── */
  .stage-overlay:has(.stage-panel--activity) {
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100vh;
    padding: 0;
    overflow: visible;
  }

  .stage-overlay:has(.stage-panel--activity) .activity-toolbar {
    position: relative;
    inset: auto;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    gap: 6px 8px;
    padding: 6px var(--tablet-safe-x) 4px;
    z-index: 30;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0));
  }

  .stage-overlay:has(.stage-panel--activity) .act-btn,
  .stage-overlay:has(.stage-panel--activity) .act-score {
    position: static;
    transform: none;
    pointer-events: auto;
    flex-shrink: 0;
  }

  .stage-overlay:has(.stage-panel--activity) .act-tl {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    max-width: 100%;
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 6px 8px;
  }

  .stage-overlay:has(.stage-panel--activity) .act-score {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    font-size: 0.82rem;
    padding: 5px 10px;
  }

  .stage-overlay:has(.stage-panel--activity) .act-tr {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    max-width: 100%;
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 6px 8px;
  }

  .stage-overlay:has(.stage-panel--activity) .act-br {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    width: auto;
    min-width: 132px;
    font-size: 0.82rem;
    padding: 7px 14px;
    z-index: 31;
  }

  .stage-panel--activity {
    margin: 0 auto;
    padding: 2px 10px 16px;
    width: min(920px, calc(100% - 16px));
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .stage-panel--activity .stage-header--activity {
    padding: 5px 10px;
    margin-bottom: 4px;
    flex-shrink: 0;
  }

  .stage-panel--activity .section-card {
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 10px 12px;
    margin-top: 0;
    width: 100%;
  }

  .stage-panel--activity > .tg-activity-shell {
    width: 100%;
    overflow: visible;
  }

  .act-btn { padding: 7px 10px; font-size: 0.82rem; }

  /* ── 활동 선택 ── */
  .stage-screen--menu .stage-overlay--menu {
    padding: 40px 10px 14px;
    min-height: 0;
    height: 100%;
    justify-content: center;
    overflow: visible;
  }

  .stage-screen--menu:has(.activity-picker-grid--triple) .stage-overlay--menu {
    padding: 52px 10px 52px;
    justify-content: center;
  }

  .activity-picker-screen {
    flex: 0 1 auto;
    width: min(1100px, 100%);
    margin: 0 auto;
    justify-content: center;
    gap: 6px;
    overflow: visible;
  }

  .activity-picker-screen:has(.activity-picker-grid--triple) {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    justify-content: center;
    gap: 8px;
  }

  .activity-picker-home,
  .activity-picker-help {
    flex-shrink: 0;
    z-index: 4;
  }

  .activity-picker-header { margin-bottom: 0; width: 100%; }
  .activity-picker-title { font-size: clamp(0.95rem, 2vw, 1.2rem); }
  .activity-picker-hint { margin-bottom: 4px; font-size: 0.9rem; }

  .activity-picker-grid {
    gap: clamp(14px, 2.2vw, 28px);
    width: 100%;
    max-width: min(960px, 94vw);
    margin: 0 auto;
  }

  .activity-picker-grid--triple {
    max-width: min(1100px, 96vw);
    gap: clamp(12px, 2vw, 24px);
    margin: 0 auto;
  }

  .activity-picker-grid--triple .activity-picker:nth-child(odd),
  .activity-picker-grid--triple .activity-picker:nth-child(even) {
    transform: none;
  }

  .activity-picker-grid--triple .activity-picker:nth-child(odd):hover,
  .activity-picker-grid--triple .activity-picker:nth-child(even):hover {
    transform: scale(1.03);
  }

  .activity-picker-img { max-width: min(280px, 32vw); }
  .activity-picker-grid--triple .activity-picker-img { max-width: min(250px, 26vw); }
  .activity-picker-label { font-size: clamp(0.95rem, 1.8vw, 1.15rem); }
  .activity-picker-grid--triple .activity-picker-label { font-size: clamp(0.88rem, 1.6vw, 1.05rem); }

  /* ── 미니게임 공통 중앙 정렬 ── */
  .tg-activity-shell,
  .hangul-game,
  .dancheong-game,
  .bibimbap-game,
  .holiday-game,
  .hanbok-game,
  .anthem-activity,
  .money-game,
  .talchum-game,
  .ttakji-tutorial,
  .yut-game,
  .mugu-story,
  .mugu-game,
  .mugu-photo-game {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    align-items: center;
    justify-content: center;
  }

  /* ── 태극기 ── */
  .tg-activity-shell {
    min-height: 0;
    gap: 6px;
    justify-content: center;
    align-items: center;
    grid-template-columns: auto 1fr auto;
  }
  .tg-nav-btn {
    min-height: 64px;
    padding: 6px 5px;
    font-size: 0.72rem;
    flex-shrink: 0;
    z-index: 2;
  }
  .tg-activity-body { display: flex; justify-content: center; width: 100%; min-width: 0; }
  .tg-game { justify-content: center; align-items: center; }
  .tg-board-wrap { flex: 1 1 200px; max-width: 380px; }
  .tg-tray { flex: 0 0 130px; min-height: 0; padding: 6px; }
  .tg-piece img { height: 46px; }
  .tg-match-board { min-height: 140px; padding: 8px; margin: 0 auto; }
  .tg-hoist { gap: 6px; width: 100%; align-items: center; }
  .tg-complete-next,
  .tg-hoist-back-match {
    flex-shrink: 0;
    width: 100%;
    max-width: 420px;
    margin-top: 6px;
  }

  /* ── 무궁화 ── */
  .section-card.mugu-story,
  .section-card.mugu-game,
  .section-card.mugu-photo-game {
    gap: 8px;
    justify-content: flex-start;
    flex-shrink: 0;
  }

  .mugu-story-frame { max-width: min(360px, 88%); }
  .mugu-board-wrap {
    width: 100%;
    max-width: min(300px, 42dvh);
    gap: 6px;
    flex-shrink: 0;
  }

  .mugu-board {
    width: 100%;
    max-height: min(300px, 38dvh);
    aspect-ratio: 1;
    height: auto;
  }

  .mugu-tray {
    min-height: 56px;
    max-width: min(300px, 42dvh);
    padding: 8px;
    flex-shrink: 0;
  }

  .mugu-piece { width: 60px; }
  .mugu-piece .mugu-part-art { width: 44px; height: 44px; }
  .mugu-bubble { padding: 8px 10px; gap: 8px; }
  .mugu-next { padding: 8px 18px; font-size: 0.88rem; flex-shrink: 0; }
  .mugu-photo-frame { max-width: min(380px, 88%); }

  /* ── 애국가 ── */
  .anthem-activity { gap: 6px; max-width: 560px; }
  .anthem-story { padding: 8px 10px; font-size: 0.84rem; }
  .anthem-karaoke { max-height: 120px; flex-shrink: 1; min-height: 0; }
  .anthem-controls {
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }
  .anthem-controls .btn { min-width: 110px; }
  .anthem-score-panel { flex-shrink: 0; padding: 10px; }
  .anthem-score-val { font-size: 1.4rem; }
  .anthem-wave-canvas--compare { min-height: 52px; }

  /* ── 한글 퍼즐 ── */
  .hangul-game { gap: 8px; }
  .hg-question { font-size: 1.05rem; }
  .hg-slot { width: 46px; height: 46px; }
  .hg-tile { width: 46px; height: 46px; font-size: 1.5rem; }
  .hg-tray { min-height: 56px; padding: 8px; gap: 6px; }

  /* ── 단청 ── */
  .dancheong-game { gap: 6px; }
  .dancheong-workspace { gap: 10px; }
  .dancheong-canvas-wrap { max-width: 340px; flex: 1 1 220px; }
  .dancheong-picker { gap: 8px; max-width: 480px; }
  .dancheong-pick-card { padding: 8px; }
  .dancheong-pick-card img { max-width: 140px; }

  /* ── 비빔밥 ── */
  .bibimbap-game { min-height: 0; gap: 8px; flex: 1; justify-content: space-evenly; }
  .pot-area { min-height: 0; flex: 1 1 auto; display: flex; align-items: center; justify-content: center; }
  .pot-zone { width: min(280px, 44vw); }
  .ingredient-item img { width: 56px; height: 56px; }
  .ingredient-tray { gap: 6px; padding: 4px; margin-top: 0; }
  .ingredient-row { gap: 10px; justify-content: center; }

  /* ── 설날·추석 ── */
  .holiday-game { min-height: 0; flex: 1; gap: 4px; }
  .holiday-board { width: min(780px, 94vw); }
  .holiday-card-wrap { max-width: 88px; }

  /* ── 한복 ── */
  .hanbok-game {
    min-height: 0;
    flex: 1;
    gap: 4px;
    overflow: visible;
    position: relative;
  }

  .doll-area {
    margin: 0 auto;
    padding: 4px 0;
    gap: clamp(20px, 4vw, 36px);
    flex: 1;
    min-height: 0;
    align-items: flex-end;
    justify-content: center;
    width: calc(100% - 210px);
    max-width: 560px;
  }

  .doll-wrap {
    transform: translateY(8px) scale(1.22);
  }

  .doll-stage.drop-zone { width: min(210px, 26vw); }
  .doll-label { font-size: 0.88rem; margin-bottom: 4px; }

  .hanbok-tray-col {
    --hanbok-tray-gap: 38px;
    --hanbok-tray-side: 8px;
    width: 82px;
    padding: 4px 3px;
    gap: 3px;
    z-index: 15;
  }

  .hanbok-tray-varrow {
    flex-shrink: 0;
    min-height: 28px;
    padding: 2px 0;
    font-size: 0.72rem;
    z-index: 16;
  }

  .tray-col-label { font-size: 0.72rem; flex-shrink: 0; }
  .hanbok-cloth-item img { width: 48px; height: 48px; }
  .hanbok-tray--v { gap: 6px; }
  .hanbok-tray-viewport--v {
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
  }

  /* ── 윷놀이 ── */
  .yut-game { gap: 8px; align-items: stretch; justify-content: center; }
  .yut-left, .yut-right { gap: 6px; flex: 1 1 48%; align-items: center; min-width: 0; }
  .yut-board { max-width: 320px; margin: 0 auto; }
  .yut-mat { padding: 5%; margin: 0 auto; }
  .yut-actions,
  .yut-actions .btn,
  .yut-chip-row { flex-shrink: 0; }

  /* ── 딱지접기 ── */
  .ttakji-tutorial { gap: 6px; }
  .ttakji-grid { gap: 6px; max-width: 500px; }
  .ttakji-card { padding: 5px; }
  .ttakji-viewport { max-width: 480px; min-height: 0; flex-shrink: 1; }
  .ttakji-guide { font-size: 0.84rem; padding: 0 6px; }
  .ttakji-replay-btn { flex-shrink: 0; z-index: 3; }

  /* ── 탈춤 ── */
  .talchum-game { gap: 4px; }
  .tc-stage { max-width: 540px; flex-shrink: 1; min-height: 0; }
  .tc-hud { margin-bottom: 4px; flex-shrink: 0; }
  .tc-score { font-size: 16px; }
  .tc-move-name { font-size: 16px; }
  .talchum-controls,
  .talchum-controls .btn,
  #tcStart { flex-shrink: 0; }

  /* ── 리듬 게임 ── */
  .rhythm-stage {
    min-height: 100vh;
    margin: -8px;
  }

  .stage-screen.rhythm-stage {
    overflow: visible;
  }

  .rhythm-stage-overlay {
    min-height: 100vh;
    padding: 0 0 24px;
    overflow: visible;
    box-sizing: border-box;
    justify-content: flex-start;
    gap: 4px;
    display: flex;
    flex-direction: column;
  }

  .rhythm-stage-overlay .activity-toolbar {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    gap: 6px 8px;
    padding: 6px var(--tablet-safe-x) 4px;
    z-index: 30;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0));
  }

  .rhythm-stage-overlay .act-btn,
  .rhythm-stage-overlay .act-score {
    position: static;
    transform: none;
    pointer-events: auto;
  }

  .rhythm-stage-overlay .act-tl { grid-column: 1; grid-row: 1; justify-self: start; font-size: 0.78rem; padding: 6px 8px; }
  .rhythm-stage-overlay .act-score { grid-column: 2; grid-row: 1; justify-self: center; font-size: 0.82rem; padding: 5px 10px; }
  .rhythm-stage-overlay .act-tr { grid-column: 3; grid-row: 1; justify-self: end; font-size: 0.78rem; padding: 6px 8px; }
  .rhythm-stage-overlay .act-br { grid-column: 1 / -1; grid-row: 2; justify-self: center; font-size: 0.82rem; padding: 7px 14px; }

  .rhythm-stage-header {
    margin-bottom: 4px;
    padding: 5px 12px;
    flex-shrink: 0;
  }

  .rhythm-stage-header--compact {
    margin-bottom: 2px;
    padding: 4px 10px;
  }

  .rhythm-stage-title { font-size: clamp(0.9rem, 1.8vw, 1.15rem); }

  .rhythm-stage-overlay > .rhythm-menu-card,
  .rhythm-stage-overlay > .rhythm-semachi-card,
  .rhythm-stage-overlay > .rhythm-game {
    flex: 1 1 auto;
    min-height: 0;
    margin-left: auto;
    margin-right: auto;
    width: min(560px, calc(100% - 20px));
  }

  .rhythm-menu-card,
  .rhythm-semachi-card {
    padding: 12px 14px;
    margin: 0 auto;
  }

  .rhythm-song-btn,
  .rhythm-level-btn,
  .rhythm-back-btn,
  .rhythm-start-btn,
  .semachi-actions .btn,
  #semachiDemoBtn,
  #semachiStartL3,
  #rhythmEndingHome {
    flex-shrink: 0;
  }

  .semachi-actions {
    margin: 6px 0 4px;
    gap: 6px;
    flex-shrink: 0;
  }

  .rhythm-menu-desc { margin-bottom: 10px; font-size: 0.92rem; }
  .rhythm-song-btn { padding: 12px 10px; font-size: 0.95rem; }
  .rhythm-song-icon { font-size: 1.5rem; margin-bottom: 4px; }
  .rhythm-level-btn { padding: 10px 12px; font-size: 0.9rem; }

  .rhythm-game {
    min-height: 0;
    flex: 0 1 auto;
    overflow: visible;
    justify-content: center;
    margin: 0 auto;
  }

  .rhythm-lyrics-wrap { min-height: 56px; margin-bottom: 4px; }
  .rhythm-lyrics { font-size: clamp(20px, 3vw, 30px); }
  .rhythm-hud { padding: 5px 8px; margin-bottom: 4px; gap: 6px 10px; width: 100%; }
  .rhythm-playfield {
    min-height: 0;
    flex: 0 1 auto;
    margin: 4px auto;
    width: min(340px, 62vw);
    align-self: center;
  }
  .rhythm-note-zone { min-height: 70px; }
  .rhythm-janggu-area { min-height: min(110px, 18vw); }
  .rhythm-janggu-img { width: min(160px, 32vw); }
  .semachi-playfield .rhythm-note-zone { min-height: 60px; }
  .semachi-playfield .rhythm-janggu-area { min-height: min(100px, 16vw); }

  /* ── 보물도감 ── */
  .treasure-album-overlay {
    display: flex;
    flex-direction: column;
    padding: 48px 16px 16px;
    justify-content: flex-start;
    align-items: stretch;
  }

  .treasure-album-header { margin-bottom: 8px; gap: 6px; }
  .treasure-album-title { font-size: clamp(1.2rem, 2.5vw, 1.6rem); }
  .treasure-album-sub { font-size: 0.85rem; margin-top: 4px; }
  .treasure-album-progress { padding: 6px 12px; }
  .treasure-album-progress-num { font-size: 1.4rem; }

  .treasure-album-grid {
    flex: 1;
    min-height: 0;
    align-content: start;
    gap: 8px 6px;
  }

  .treasure-card { padding: 6px 4px 8px; gap: 4px; border-radius: 12px; }
  .treasure-card-name { font-size: 0.68rem; }
  .treasure-card-mission { font-size: 0.62rem; }
  .treasure-card-lock { font-size: 1.6rem; }

  /* ── 한옥 임베드 ── */
  .stage-panel--activity:has(#hanok-embed) {
    margin: 0 auto;
    width: min(920px, calc(100% - 16px));
  }

  /* ── 화폐 투어 ── */
  .money-game { gap: 6px; }
  .money-bill-wrap { max-width: none; }
  /* 태블릿도 화면 크기에 맞춰 지폐 확대 (세로 남은 공간 기준) */
  .money-bill-stage { max-width: max(300px, min(820px, 92vw, calc((100dvh - 400px) * 1.95))); }
  .money-next,
  .money-replay,
  .money-quiz-choice { flex-shrink: 0; }
  .money-quiz-choices { gap: 6px; }
  .money-bubble { flex-shrink: 0; }

  /* ── 교사 대시보드 ── */
  .stage-panel:has(#teacherDashboardBody) .section-card {
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  .stage-panel:has(#teacherDashboardBody) [style*="overflow:auto"] {
    flex: 1;
    min-height: 0;
    overflow: auto !important;
    max-height: none;
  }

  .stage-panel:has(#teacherDashboardBody) table {
    font-size: 12px !important;
  }

  .stage-panel:has(#teacherDashboardBody) th,
  .stage-panel:has(#teacherDashboardBody) td {
    padding: 5px 6px !important;
  }
}

/* ── 태블릿·터치 기기 성능 완화 ──
   무한 그림자/필터 애니메이션과 backdrop-blur는 GPU 부하가 커서
   저사양 태블릿에서 버벅임의 주원인. 터치 기기에서는 끄거나 단순화. */
@media (hover: none) and (pointer: coarse) {
  .tg-board.tg-lit,
  .tg-piece.tg-pulse img,
  .tg-hoist-pole.done .tg-flag-draggable,
  .tg-pole-scene.tg-wind .tg-flag-draggable,
  .money-person-pop,
  .money-highlight--active,
  .anthem-karaoke-line--active,
  .rhythm-target--bounce,
  .rhythm-target-img--bounce {
    animation: none !important;
  }

  .intro-skip-btn,
  .home-center .panel,
  .stage-panel--activity .section-card,
  .swal2-container {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .money-person-pop,
  .tg-piece img,
  .tg-flag-draggable img {
    filter: none !important;
  }

  .stage-bg {
    /* 큰 배경 PNG 디코딩·합성 비용 완화 */
    image-rendering: auto;
    transform: translateZ(0);
  }

  /* 영상 활동: 동시 디코딩·그림자 합성 줄이기 */
  .ttakji-main-video,
  .tc-main-video,
  .tc-pip-video,
  .anthem-ceremony-video {
    transform: translateZ(0);
  }
  .ttakji-viewport,
  .tc-stage {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18) !important;
  }
}
