/* 배움 놀이터 게임 레이어 스타일 — styles.css 다음에 로드
   자체 디자인 (외부 이미지·폰트·텍스처 없음). 학생 터치 대상 44px 이상 유지 */

.bg-btn {
  min-height: 44px;
}

.bg-sprite {
  display: block;
  image-rendering: pixelated;
}

/* ---------- 활동 바 안의 지도 버튼 ---------- */
.daily-routine {
  display: flex;
  align-items: stretch;
  gap: 6px;
  width: min(820px, 100%);
}

.daily-routine > .routine-actions {
  flex: 1 1 auto;
  min-width: 0;
}

.game-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 92px;
  padding: 6px 14px;
  border: 3px solid #B45309;
  border-radius: 18px;
  background: #FFF4CC;
  color: #2D3436;
  font: inherit;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 #B45309;
}

.game-chip:hover {
  background: #FEF08A;
}

.game-chip:focus-visible,
.game-panel button:focus-visible {
  outline: 4px solid #C2410C;
  outline-offset: 2px;
}

.game-chip-avatar,
.game-chip-star {
  display: inline-flex;
  line-height: 0;
}

.game-chip-stars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.game-chip.is-new {
  animation: game-pulse 1.6s ease-in-out 3;
}

.game-chip.is-bump {
  animation: game-bump 0.35s ease-out;
}

@keyframes game-pulse {
  0%, 100% { box-shadow: inset 2px 2px 0 var(--voxel-hi), inset -2px -2px 0 var(--voxel-lo), 0 0 0 0 rgba(255, 207, 51, 0.9); }
  50% { box-shadow: inset 2px 2px 0 var(--voxel-hi), inset -2px -2px 0 var(--voxel-lo), 0 0 0 6px rgba(255, 207, 51, 0); }
}

@keyframes game-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ---------- 별 알림 (상단 메뉴판·탭 가림 방지: 하단 플로팅) ---------- */
.game-toast {
  position: fixed;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 3px solid #B45309;
  border-radius: 999px;
  background: #FFFBEB;
  color: #2D3436;
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 0);
  box-shadow: 0 4px 12px rgba(45, 52, 54, 0.14);
}

.game-toast.is-visible {
  animation: game-toast 1.6s ease forwards;
}

@keyframes game-toast {
  0% { opacity: 0; transform: translate(-50%, 6px); }
  15% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}

/* ---------- 창 공통 (따뜻한 동화책 앨범 스타일) ---------- */
.game-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 14px calc(14px + env(safe-area-inset-bottom, 0px));
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}

.game-layer[hidden] {
  display: none;
}

body.game-open {
  overflow: hidden;
}

.game-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 36, 30, 0.52);
}

.game-panel {
  position: relative;
  width: min(780px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow: auto;
  padding: 20px 22px 22px;
  border: 4px solid #5C4B3F;
  border-radius: 28px;
  background: #FFF8F0;
  color: #2D3436;
  box-shadow: 0 8px 0 #5C4B3F, 0 20px 44px rgba(45, 36, 30, 0.24);
}

.game-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.game-title {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.25;
  color: #2D3436;
  letter-spacing: -0.01em;
}

.game-close {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 48px;
  padding: 8px 16px;
  border: 3px solid #5C4B3F;
  border-radius: 16px;
  background: #FFFFFF;
  color: #2D3436;
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #5C4B3F;
}

.game-close:active,
.game-action:active,
.game-island:active,
.game-choice:active {
  transform: translateY(2px);
}

.game-lead {
  margin: 4px 0 10px;
  font-size: 18px;
  font-weight: 800;
  color: #3D4852;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.game-action {
  min-width: 136px;
  min-height: 52px;
  padding: 10px 20px;
  border: 3px solid #9A3412;
  border-radius: 18px;
  background: #C2410C;
  color: #FFFFFF;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #9A3412;
}

.game-action.is-secondary {
  border-color: #5C4B3F;
  background: #FFFFFF;
  color: #2D3436;
  box-shadow: 0 4px 0 #5C4B3F;
}

/* ---------- 섬 지도 ---------- */
.game-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 3px solid #E5D6C5;
  border-radius: 22px;
  background: #FFFFFF;
  box-shadow: 0 4px 12px rgba(92, 75, 63, 0.07);
}

.game-hero-art {
  flex: 0 0 auto;
  line-height: 0;
}

.game-hero-info p {
  margin: 0;
}

.game-hero-stars {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 24px;
  font-weight: 900;
  color: #92400E;
}

.game-hero-note {
  margin-top: 3px;
  color: #4B5563;
  font-size: 15px;
  font-weight: 700;
}

.game-islands {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 3px solid #93C5FD;
  border-radius: 24px;
  background: linear-gradient(180deg, #E0F2FE 0%, #BAE6FD 100%);
}

.game-island {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  border: 3px solid #5C4B3F;
  border-radius: 22px;
  background: #FFFFFF;
  color: #2D3436;
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 5px 0 #5C4B3F;
}

.game-island:hover {
  background: #FFFDF9;
}

.game-island-art {
  line-height: 0;
}

.game-island-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.game-island-text strong {
  font-size: 19px;
}

.game-island-progress {
  font-size: 14px;
  font-weight: 800;
  color: #4B5563;
}

.game-minis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.game-mini {
  position: relative;
  height: 22px;
  overflow: hidden;
  border: 2px solid #CFC2B2;
  border-radius: 10px;
  background: #F8F5F0;
  font-size: 11px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
}

.game-mini-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: #86EFAC;
}

.game-mini.is-done {
  border-color: #CA8A04;
  background: #FEF08A;
}

.game-mini.is-done .game-mini-fill {
  background: #FEF08A;
}

.game-mini-label {
  position: relative;
}

/* ---------- 스티커 도감 ---------- */
.game-sticker-group h3 {
  margin: 16px 0 8px;
  font-size: 18px;
  font-weight: 900;
  color: #2D3436;
}

.game-stickers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.game-sticker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 112px;
  padding: 10px 8px;
  border: 3px solid #DFD2C3;
  border-radius: 20px;
  background: #FFFFFF;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 4px 0 #DFD2C3;
}

.game-sticker.is-locked {
  border-style: dashed;
  border-color: #D4C5B4;
  background: #F6F1EA;
  color: #6B7280;
  box-shadow: none;
}

.game-sticker-hint {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  word-break: keep-all;
}

.bg-sticker-art {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.bg-badge {
  position: absolute;
  right: -8px;
  bottom: -4px;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border: 2px solid #92400E;
  border-radius: 999px;
  background: #FDE047;
  color: #2D3436;
  font-size: 13px;
  font-weight: 900;
  line-height: 20px;
  text-align: center;
}

/* 도감 칸: 숫자 배지를 작게, 그림 밖 오른쪽 아래로 */
.game-sticker .bg-badge {
  right: -14px;
  bottom: -6px;
  min-width: 22px;
  height: 20px;
  padding: 0 4px;
  font-size: 11px;
  line-height: 16px;
}

.game-reward-art .bg-badge {
  min-width: 40px;
  height: 40px;
  font-size: 22px;
  line-height: 36px;
}

/* ---------- 캐릭터 꾸미기 ---------- */
.game-avatar-preview {
  display: flex;
  justify-content: center;
  padding: 12px;
  border: 3px solid #E5D6C5;
  border-radius: 22px;
  background: #FFFFFF;
}

.game-choice-title {
  margin: 14px 0 8px;
  font-size: 17px;
  font-weight: 900;
}

.game-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.game-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 92px;
  min-height: 56px;
  padding: 8px;
  border: 3px solid #CFC2B2;
  border-radius: 18px;
  background: #FFFFFF;
  color: #2D3436;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 #CFC2B2;
}

.game-choice[aria-pressed="true"] {
  border-color: #15803D;
  background: #E2F4E6;
  color: #14532D;
  box-shadow: 0 3px 0 #15803D;
}

.game-choice:disabled {
  border-style: dashed;
  background: #F4EFE8;
  color: #6B7280;
  box-shadow: none;
  cursor: not-allowed;
}

.game-slot-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

@media (max-width: 520px) {
  .game-slot-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.game-slot-btn {
  min-width: 64px;
  min-height: 48px;
  padding: 6px 8px;
  border-radius: 14px;
  border: 2.5px solid #CFC2B2;
  background: #FFFFFF;
  color: #2D3436;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 2px 0 #CFC2B2;
}

.game-slot-btn[aria-pressed="true"] {
  border-color: #0F766E;
  background: #ECFDF5;
  color: #064E3B;
  box-shadow: 0 2px 0 #0F766E;
}

/* ---------- 새 스티커 축하 ---------- */
.game-panel-reward {
  width: min(440px, 100%);
  text-align: center;
}

.game-panel-reward .game-panel-head {
  justify-content: center;
  position: relative;
}

.game-panel-reward .game-close {
  position: absolute;
  top: 0;
  right: 0;
}

.game-panel-reward .game-title {
  padding: 0 76px;
}

.game-kicker {
  margin: 0 0 6px;
  color: #C2410C;
  font-size: 18px;
  font-weight: 900;
}

.game-reward-art {
  position: relative;
  display: flex;
  justify-content: center;
  width: fit-content;
  margin: 8px auto;
  padding: 20px;
  background: radial-gradient(circle, #FEF08A 0 48%, transparent 52%);
  animation: game-pop 0.5s ease-out;
}

.game-reward-art::before,
.game-reward-art::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #FBBF24;
  border: 2px solid #B45309;
  animation: game-twinkle 1.2s ease-in-out infinite;
}

.game-reward-art::before {
  top: 6px;
  left: 0;
}

.game-reward-art::after {
  right: 0;
  bottom: 14px;
  animation-delay: 0.6s;
}

.game-count {
  margin: 0;
  color: #4B5563;
  font-weight: 800;
}

@keyframes game-pop {
  0% { transform: scale(0.6); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes game-twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* ---------- 마스코트 칭찬 (상단 메뉴판 가림 방지: 하단 중앙 배지) ---------- */
.game-praise {
  position: fixed;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 65;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(92vw, 480px);
  padding: 7px 18px 7px 10px;
  border: 3px solid #B45309;
  border-radius: 999px;
  background: #FFFBEB;
  color: #2D3436;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.3;
  word-break: keep-all;
  pointer-events: none;
  transform: translateX(-50%);
  box-shadow: 0 6px 18px rgba(45, 52, 54, 0.16);
}

.game-praise[hidden] {
  display: none;
}

.game-praise-art {
  flex: 0 0 auto;
  line-height: 0;
}

.game-praise.is-visible {
  animation: game-praise-in 0.35s ease-out;
}

.game-praise.is-visible .game-praise-art {
  animation: game-hop 0.6s ease-out 2;
}

@keyframes game-praise-in {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes game-hop {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
}

/* 앱 고대비 설정 */
html.app-high-contrast .game-praise,
html.app-high-contrast .game-panel,
html.app-high-contrast .game-sticker,
html.app-high-contrast .game-sticker.is-locked {
  border-color: #000000;
  background: #ffffff;
  color: #000000;
}

html.app-high-contrast .game-sticker-hint,
html.app-high-contrast .game-hero-note,
html.app-high-contrast .game-lead {
  color: #000000;
}

/* ---------- 교사용 게임 설정 ---------- */
.teacher-game {
  margin-top: 12px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

#gameResetBtn.is-armed {
  border-color: var(--coral);
  background: #fee2e2;
  color: #7f1d1d;
}

/* ---------- 좁은 화면 ---------- */
@media (max-width: 560px) {
  .game-islands {
    grid-template-columns: 1fr;
  }

  .game-island {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    text-align: left;
  }

  .game-island .game-minis {
    grid-column: 1 / -1;
  }

  .game-title {
    font-size: 21px;
  }

  .game-panel {
    padding: 14px 14px 16px;
    border-radius: 22px;
  }

  .game-islands {
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
  }

  .game-island {
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .game-action {
    min-width: 0;
    flex: 1 1 40%;
  }
}

/* ---------- 조용한 모드 · 움직임 줄이기 ---------- */
.game-calm .game-praise.is-visible,
.game-calm .game-praise.is-visible .game-praise-art,
.game-calm .game-chip.is-new,
.game-calm .game-chip.is-bump,
.game-calm .game-reward-art {
  animation: none;
}

.game-calm .game-reward-art::before,
.game-calm .game-reward-art::after {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .game-praise.is-visible,
  .game-praise.is-visible .game-praise-art,
  .game-chip.is-new,
  .game-chip.is-bump,
  .game-reward-art,
  .game-reward-art::before,
  .game-reward-art::after {
    animation: none;
  }

  .game-toast.is-visible {
    animation: none;
    opacity: 1;
  }
}

/* ---------- v2.2 문제 화면 씬 (미니 지도·블록 탑·표정 장면) ---------- */
.scene-map {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
  line-height: 0;
}

.scene-map-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
  border: 2px solid var(--block-edge);
  border-radius: 3px;
  background: #f2f8ff;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.7), 0 2px 0 rgba(0, 0, 0, 0.12);
}

.scene-map-avatar,
.scene-map-island,
.scene-map-stars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.scene-map-islands {
  display: inline-flex;
  gap: 4px;
  padding: 0 4px;
  border-left: 2px dashed #9db4cc;
  border-right: 2px dashed #9db4cc;
}

.scene-map-island {
  padding: 1px;
  border: 2px solid transparent;
  border-radius: 3px;
  opacity: 0.55;
}

.scene-map-island.is-here {
  border-color: #e0a800;
  background: #fff4c2;
  opacity: 1;
}

.scene-map-island.is-pop {
  animation: scene-island-pop 0.45s ease-out;
}

.scene-map-star-count {
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}

@keyframes scene-island-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.25) rotate(-4deg); }
  100% { transform: scale(1); }
}

.scene-tower-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

.scene-tower {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  border: 2px solid var(--block-edge);
  border-radius: 3px;
  background: #f6fbef;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.7), 0 2px 0 rgba(0, 0, 0, 0.12);
}

.scene-tower.is-complete {
  border-color: #b8860b;
  background: #fff8d6;
}

.scene-tower-label {
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
}

.scene-tower.is-complete .scene-tower-label {
  color: #8a6100;
}

.scene-tower-row {
  display: inline-flex;
  gap: 3px;
}

.scene-tower-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 2px solid #8aa0b8;
  border-radius: 3px;
  background: #e8eef5;
  color: transparent;
  font-size: 10px;
  font-weight: 900;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.8), inset -1px -1px 0 rgba(0, 0, 0, 0.12);
}

.scene-tower-block.is-filled {
  border-color: #3f7a1c;
  background: linear-gradient(#93dd52, #6abe30);
  color: #1f3d0c;
}

.scene-tower.is-complete .scene-tower-block.is-filled {
  border-color: #b8860b;
  background: linear-gradient(#ffe27a, #ffcf33);
  color: #6b4f00;
}

.scene-tower-block.is-new {
  animation: scene-block-pop 0.45s ease-out;
}

@keyframes scene-block-pop {
  0% { transform: translateY(-12px) scale(0.6); }
  60% { transform: translateY(2px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
}

/* 문장·사회 패널의 씬 행 (캐릭터 + 미니 지도) */
.scene-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  min-height: 0;
}

.scene-row .scene-map {
  margin-bottom: 0;
}

/* 태블릿 가로 압축 모드: 학생 핵심 조작 한 화면 유지를 위해 씬 숨김 */
@media (min-width: 721px) and (max-height: 860px) and (orientation: landscape) {
  #sceneMapMath,
  #sceneMathTower {
    display: none;
  }

  .scene-row {
    margin-bottom: 4px;
  }
}

@media (max-width: 480px) {
  .scene-map-inner {
    gap: 5px;
    padding: 2px 6px;
  }

  .scene-tower-label {
    font-size: 11px;
  }

  .scene-tower-block {
    width: 17px;
    height: 17px;
    font-size: 9px;
  }
}

/* 조용한 모드·움직임 줄이기 */
.game-calm .scene-map-island.is-pop,
.game-calm .scene-tower-block.is-new,
.game-calm .scene-person.is-cheer {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .scene-map-island.is-pop,
  .scene-tower-block.is-new,
  .scene-person.is-cheer {
    animation: none;
  }
}

/* ---------- 표정 장면 (생활 문장·사회 상황) ---------- */
.scene-person {
  display: inline-flex;
  padding: 2px;
  border: 2px solid var(--block-edge);
  border-radius: 3px;
  background: #fff8e1;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.7), 0 2px 0 rgba(0, 0, 0, 0.12);
  line-height: 0;
}

.scene-person.is-cheer {
  animation: scene-person-cheer 0.5s ease-out;
}

@keyframes scene-person-cheer {
  0% { transform: translateY(0); }
  35% { transform: translateY(-6px) rotate(-3deg); }
  70% { transform: translateY(0) rotate(3deg); }
  100% { transform: translateY(0); }
}

/* 문장·사회 씬 행의 미니 지도 */
.scene-talk-map .scene-map-inner {
  padding: 1px 6px;
  gap: 5px;
}

/* 작은 화면(휴대폰): 씬을 줄여 학생 버튼이 한 화면에 남도록 한다.
   지도 정보는 상단 칩(캐릭터·별 수)이 대신한다. */
@media (max-width: 560px) {
  #sceneMapMath,
  .scene-talk-map {
    display: none;
  }

  .scene-person .bg-sprite {
    width: 32px;
    height: 32px;
  }

  .scene-row {
    margin-bottom: 4px;
  }
}

/* 좁은 화면 토스트 줄바꿈 (리뷰 지적: 360·375px에서 지도 안내 잘림) */
@media (max-width: 560px) {
  .game-toast {
    white-space: normal;
    max-width: calc(100vw - 16px);
    text-align: center;
  }
}

/* ---------- v2.7 3D 클레이 '블록이' 통합 아바타 & 꾸미기 ---------- */
.clay-avatar-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  vertical-align: middle;
  animation: clay-breathe 2.8s ease-in-out infinite;
}

.clay-avatar-fallback {
  display: none;
}

.clay-avatar-img {
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(45, 36, 30, 0.16));
}

.clay-sz-28 .clay-avatar-img { width: 28px; height: 28px; }
.clay-sz-40 .clay-avatar-img { width: 42px; height: 42px; }
.clay-sz-56 .clay-avatar-img { width: 52px; height: 52px; }
.clay-sz-72 .clay-avatar-img { width: 72px; height: 72px; }
.clay-sz-96 .clay-avatar-img { width: 96px; height: 96px; }

.clay-body-yellow .clay-avatar-img {
  filter: hue-rotate(-72deg) saturate(1.42) brightness(1.14) drop-shadow(0 2px 4px rgba(45, 36, 30, 0.16));
}
.clay-body-blue .clay-avatar-img {
  filter: hue-rotate(88deg) saturate(1.16) brightness(1.03) drop-shadow(0 2px 4px rgba(45, 36, 30, 0.16));
}
.clay-body-pink .clay-avatar-img {
  filter: hue-rotate(195deg) saturate(1.2) brightness(1.04) drop-shadow(0 2px 4px rgba(45, 36, 30, 0.16));
}

.clay-avatar-hat {
  position: absolute;
  top: -4%;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18));
}

.clay-sz-28 .clay-avatar-hat {
  top: -8%;
}

body:has(.game-praise:not([hidden])) .game-toast {
  opacity: 0 !important;
  animation: none !important;
}

@keyframes clay-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.04, 0.97); }
}

.game-calm .clay-avatar-wrap,
html.app-reduce-motion .clay-avatar-wrap {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .clay-avatar-wrap {
    animation: none;
  }
}

/* ---------- v2.8 참 잘했어요 10칸 도장판 ---------- */
.game-stamp-card {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 3px solid #E5C99B;
  border-radius: 20px;
  background: linear-gradient(180deg, #FFFDF5 0%, #FFF7E2 100%);
  box-shadow: 0 3px 0 #E5C99B;
}

.game-stamp-card.is-complete {
  border-color: #D97706;
  background: linear-gradient(180deg, #FEF9C3 0%, #FDE68A 100%);
}

.game-stamp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.game-stamp-title {
  font-size: 15px;
  font-weight: 900;
  color: #5C3B00;
}

.game-stamp-meta {
  padding: 2px 9px;
  border-radius: 999px;
  border: 2px solid #D97706;
  background: #FFFFFF;
  color: #92400E;
  font-size: 12px;
  font-weight: 900;
}

.game-stamp-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.game-stamp-slot {
  height: 36px;
  border-radius: 12px;
  border: 2px dashed #D6C3A5;
  background: #FFFFFF;
  color: #9CA3AF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
}

.game-stamp-slot.is-stamped {
  border-style: solid;
  border-color: #D97706;
  background: #FEF3C7;
  color: #92400E;
  box-shadow: inset 0 -2px 0 rgba(217, 119, 6, 0.25);
}

.game-stamp-sub {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 800;
  color: #785A32;
  text-align: center;
}


/* ---------- v3.0 마이룸 디오라마 · 8색 블록이 · 소품 · 단짝 펫 · 실로폰 · 배움 상장 ---------- */
.clay-sz-88 .clay-avatar-img { width: 88px; height: 88px; }

.clay-body-mint .clay-avatar-img {
  filter: hue-rotate(48deg) saturate(1.18) brightness(1.06) drop-shadow(0 2px 4px rgba(45, 36, 30, 0.16));
}
.clay-body-purple .clay-avatar-img {
  filter: hue-rotate(155deg) saturate(1.22) brightness(1.04) drop-shadow(0 2px 4px rgba(45, 36, 30, 0.16));
}
.clay-body-coral .clay-avatar-img {
  filter: hue-rotate(232deg) saturate(1.30) brightness(1.06) drop-shadow(0 2px 4px rgba(45, 36, 30, 0.16));
}
.clay-body-gold .clay-avatar-img {
  filter: hue-rotate(-84deg) saturate(1.75) brightness(1.12) contrast(1.04) drop-shadow(0 2px 6px rgba(180, 83, 9, 0.32));
}

.clay-avatar-img {
  position: relative;
  z-index: 1;
}
.clay-avatar-hat {
  z-index: 3;
}
.clay-avatar-acc {
  position: absolute;
  pointer-events: none;
  line-height: 0;
}
.clay-acc-back {
  z-index: 0;
  top: 16%;
  left: 50%;
  transform: translateX(-50%) scaleX(1.22);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
}
.clay-acc-side {
  z-index: 2;
  right: -14%;
  bottom: 4%;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18));
}
.clay-acc-balloon {
  top: -10%;
  bottom: auto;
  right: -18%;
}

.game-action.is-gold {
  border-color: #B45309;
  background: linear-gradient(180deg, #FDE047 0%, #F59E0B 100%);
  color: #3B1D00;
  box-shadow: 0 4px 0 #B45309;
}

.game-hero-art {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
}
.game-hero-pet {
  display: inline-flex;
  line-height: 0;
}

/* 6종 배경 테마 팔레트 (디오라마·상장·미니 스와치 공통) */
.room-theme-meadow {
  background: linear-gradient(180deg, #BAE6FD 0%, #E0F2FE 62%, #86EFAC 62%, #4ADE80 100%);
}
.room-theme-sakura {
  background: linear-gradient(180deg, #FCE7F3 0%, #FFF1F2 62%, #FBCFE8 62%, #F9A8D4 100%);
}
.room-theme-ocean {
  background: linear-gradient(180deg, #7DD3FC 0%, #BAE6FD 62%, #FDE68A 62%, #FCD34D 100%);
}
.room-theme-sunset {
  background: linear-gradient(180deg, #FDBA74 0%, #FED7AA 62%, #A7F3D0 62%, #6EE7B7 100%);
}
.room-theme-space {
  background: linear-gradient(180deg, #C7D2FE 0%, #E0E7FF 62%, #DDD6FE 62%, #C4B5FD 100%);
}
.room-theme-rainbow {
  background: linear-gradient(180deg, #FECDD3 0%, #FEF08A 34%, #BAE6FD 62%, #BBF7D0 62%, #86EFAC 100%);
}

.game-hero.room-theme-meadow, .game-hero.room-theme-sakura, .game-hero.room-theme-ocean,
.game-hero.room-theme-sunset, .game-hero.room-theme-space, .game-hero.room-theme-rainbow {
  border-width: 3px;
  border-color: #B48A5A;
}
.game-hero .game-hero-info {
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.90);
}

/* 마이룸 무대 */
.game-room-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 176px;
  padding: 46px 14px 12px;
  border: 3px solid #9A7B56;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 4px 12px rgba(92, 75, 63, 0.10);
}
.game-room-floor {
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 8px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 2px dashed rgba(146, 64, 14, 0.30);
  pointer-events: none;
}
.game-room-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  max-width: calc(100% - 20px);
  box-sizing: border-box;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 2px solid #B45309;
  background: rgba(255, 251, 235, 0.95);
  color: #5C3B00;
  font-size: 12px;
  font-weight: 900;
}
.game-room-props {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.game-room-prop {
  position: absolute;
  z-index: 1;
  min-width: 44px;
  min-height: 44px;
  padding: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.prop-slot-back-left { top: 10px; left: 12px; }
.prop-slot-back-center { top: 10px; left: 50%; transform: translateX(-50%); }
.prop-slot-back-right { top: 38px; right: 12px; }
.prop-slot-mid-left { bottom: 10px; left: 60px; }
.prop-slot-front-left { bottom: 8px; left: 8px; }
.prop-slot-front-right { bottom: 8px; right: 8px; }

.game-room-actors {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
}
.game-room-hero, .game-room-pet {
  min-width: 48px;
  min-height: 48px;
  padding: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
}
.game-room-hero.is-hop, .game-room-pet.is-hop, .game-room-prop.is-hop,
.game-room-actors.is-hop, .game-cert-stage.is-hop {
  animation: game-hop 0.45s ease-out;
}
.prop-slot-back-center.is-hop {
  animation: none;
}

/* 5음 무지개 실로폰 */
.game-xylo-box {
  margin-top: 8px;
  padding: 8px 10px;
  border: 2.5px solid #D9C39E;
  border-radius: 18px;
  background: #FFFDF7;
}
.game-xylo-locked {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: #6B5B45;
  text-align: center;
}
.game-xylo-head {
  text-align: center;
  margin-bottom: 6px;
}
.game-xylo-title {
  font-size: 13px;
  font-weight: 900;
  color: #5C3B00;
}
.game-xylo-keys {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.game-xylo-key {
  min-height: 44px;
  padding: 6px 4px;
  border-radius: 14px;
  border: 3px solid #78350F;
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  color: #1F2937;
  cursor: pointer;
  box-shadow: 0 3px 0 #78350F;
}
.game-xylo-key.xylo-1 { background: #FCA5A5; border-color: #991B1B; box-shadow: 0 3px 0 #991B1B; }
.game-xylo-key.xylo-2 { background: #FDBA74; border-color: #9A3412; box-shadow: 0 3px 0 #9A3412; }
.game-xylo-key.xylo-3 { background: #FDE047; border-color: #854D0E; box-shadow: 0 3px 0 #854D0E; }
.game-xylo-key.xylo-4 { background: #93C5FD; border-color: #1E40AF; box-shadow: 0 3px 0 #1E40AF; }
.game-xylo-key.xylo-5 { background: #D8B4FE; border-color: #6B21A8; box-shadow: 0 3px 0 #6B21A8; }
.game-xylo-key.is-hit {
  transform: translateY(2px) scale(0.97);
}

/* 꾸미기 5탭 */
.game-avatar-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}
.game-avatar-tab {
  min-height: 44px;
  padding: 6px 4px;
  border: 2.5px solid #CFC2B2;
  border-radius: 14px;
  background: #F8F4EE;
  color: #3D4852;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  word-break: keep-all;
}
.game-avatar-tab.is-active {
  border-color: #C2410C;
  background: #FFEDE3;
  color: #7C2D12;
  box-shadow: 0 2px 0 #C2410C;
}
.game-choice-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}
.game-choice-cost {
  font-size: 11px;
  font-weight: 900;
  color: #92400E;
}
.game-theme-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid #9A7B56;
}

/* 배움 상장 카드 */
.game-cert-card {
  padding: 16px 14px;
  border: 4px solid #D97706;
  border-radius: 24px;
  text-align: center;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.72), 0 6px 16px rgba(180, 83, 9, 0.16);
}
.game-cert-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  border: 2px solid #92400E;
  background: #FFFBEB;
  color: #78350F;
  font-size: 14px;
  font-weight: 900;
}
.game-cert-rank {
  margin: 10px 0 8px;
  padding: 6px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.90);
  color: #7C2D12;
  font-size: 21px;
  font-weight: 900;
  word-break: keep-all;
}
.game-cert-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin: 8px 0;
}
.game-cert-note {
  margin: 8px auto;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #1F2937;
  font-size: 15px;
  font-weight: 800;
}
.game-cert-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}
.game-cert-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid #D97706;
  background: #FFFBEB;
  color: #5C3B00;
  font-size: 12px;
  font-weight: 900;
}
.game-cert-next {
  margin: 8px 0 0;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  color: #4B5563;
  font-size: 12px;
  font-weight: 800;
}

html.app-high-contrast .game-room-stage,
html.app-high-contrast .game-cert-card,
html.app-high-contrast .game-xylo-box {
  background: #FFFFFF;
  border-color: #000000;
  color: #000000;
}
.game-calm .game-room-hero.is-hop,
.game-calm .game-room-pet.is-hop,
.game-calm .game-room-prop.is-hop,
.game-calm .game-room-actors.is-hop,
.game-calm .game-cert-stage.is-hop {
  animation: none;
}
@media (max-width: 480px) {
  .game-action { word-break: keep-all; white-space: nowrap; font-size: 16px; padding: 10px 10px; }
  .game-avatar-tab { font-size: 12px; padding: 4px 2px; white-space: nowrap; }
  .game-choice { min-width: 78px; padding: 6px; }
  .game-room-stage { min-height: 186px; padding-top: 52px; }
  .prop-slot-back-center { top: 34px; }
  .prop-slot-mid-left { left: auto; right: 8px; bottom: 52px; }
  .game-cert-rank { font-size: 18px; }
}
