/* =====================================================================
   연상 영단어 v2 — "단어를 먹고 자라는 버디" (VOCA ODYSSEY)
   저널 & 스크랩북 톤 · 카드 일러스트 외 이미지 에셋 의존 없음
   작성: 2026-06 전면 재설계 (legacy-v1 백업본 참조)
   ===================================================================== */

/* 앱 전용 서체: Pretendard 고딕 (로컬 번들 — 오프라인/모바일 포함) */
@font-face {
  font-family: "Pretendard Local";
  src: url("assets/fonts/pretendard-regular.otf") format("opentype");
  font-weight: 100 449;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pretendard Local";
  src: url("assets/fonts/pretendard-medium.otf") format("opentype");
  font-weight: 450 599;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pretendard Local";
  src: url("assets/fonts/pretendard-bold.otf") format("opentype");
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* 종이 팔레트 */
  --bg: #f5eee3;
  --paper: #fbf7ef;
  --paper-strong: #fffcf5;
  --ink: #4a4540;
  --ink-strong: #38342f;
  --ink-soft: #7a7268;
  --ink-faint: #a39a8d;
  --line: rgba(122, 114, 104, 0.26);
  --line-strong: rgba(122, 114, 104, 0.44);

  /* 저널 악센트 */
  --terracotta: #c97b5d;
  --terracotta-soft: rgba(201, 123, 93, 0.16);
  --dusty-blue: #8fa8bf;
  --dusty-blue-soft: rgba(143, 168, 191, 0.18);
  --sage: #9caf94;
  --sage-deep: #79886f;
  --sage-soft: rgba(156, 175, 148, 0.18);
  --mustard: #d9a94e;
  --mustard-soft: rgba(217, 169, 78, 0.18);
  --stamp-red: #c0563d;
  --tape: rgba(217, 169, 78, 0.3);
  --tape-blue: rgba(143, 168, 191, 0.3);

  --shadow-card: 0 14px 34px rgba(74, 69, 64, 0.09);
  --shadow-pop: 0 22px 54px rgba(74, 69, 64, 0.16);

  --font-title: "Pretendard Local", "Pretendard Variable", Pretendard, "Noto Sans KR", sans-serif;
  --font-body: "Pretendard Local", "Pretendard Variable", Pretendard, -apple-system,
    BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 부팅 스플래시 / 저작권 고지 — 앱셸 위(9000), 전역 에러가드(99999)보다 아래 */
.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: calc(24px + var(--safe-bottom)) 24px;
  background: #f5eee3;
  color: var(--ink-strong, #38342f);
  font-family: var(--font-title, sans-serif);
  text-align: center;
  transition: opacity 0.5s ease;
}
.boot-splash-center {
  margin: auto;
}
.boot-splash-wordmark {
  margin: 0;
  font-size: clamp(15px, 4.4vw, 20px);
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--terracotta, #c97b5d);
}
.boot-splash-sub {
  margin: 8px 0 0;
  font-size: clamp(13px, 3.6vw, 16px);
  font-weight: 300;
  letter-spacing: 0.02em;
  color: #000;
}
.boot-splash-copy {
  margin: 0;
  padding-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-faint, #a39a8d);
}
.boot-splash.is-hidden {
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .boot-splash {
    transition: none;
  }
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  color-scheme: light;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.5), transparent 30%),
    linear-gradient(180deg, #f7f1e6 0%, #f1e9da 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
.eyebrow,
.panel-kicker {
  font-family: var(--font-title);
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  padding:
    calc(var(--safe-top) + clamp(10px, 1.8svh, 20px))
    clamp(14px, 4vw, 20px)
    calc(var(--safe-bottom) + 86px);
  position: relative;
}

/* 뷰 전환 */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewIn 0.22s ease;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 공통 타이포 ---------- */
.eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--terracotta);
}

.panel-kicker {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.13em;
  color: var(--ink-faint);
}

/* ---------- 필 ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pill--accent {
  background: var(--terracotta-soft);
  color: var(--terracotta);
  border-color: transparent;
  font-weight: 700;
}

/* ---------- 마스킹테이프 ---------- */
.tape {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 86px;
  height: 24px;
  transform: translateX(-50%) rotate(2deg);
  background: var(--tape);
  opacity: 0.85;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(74, 69, 64, 0.1);
  clip-path: polygon(2% 0, 98% 4%, 100% 96%, 1% 100%, 0 55%, 2% 30%);
  pointer-events: none;
  z-index: 3;
}

/* ---------- 도장 ---------- */
.stamp {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 2.5px solid var(--stamp-red);
  border-radius: 50%;
  color: var(--stamp-red);
  font-family: var(--font-title);
  font-size: 12px;
  line-height: 1.1;
  text-align: center;
  transform: rotate(-8deg);
  opacity: 0.88;
  box-shadow: inset 0 0 0 1px rgba(192, 86, 61, 0.25);
}

.stamp--mini {
  width: 26px;
  height: 26px;
  border-width: 2px;
  font-size: 8px;
}

.stamp--pressed {
  animation: stampPress 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

@keyframes stampPress {
  0% {
    transform: rotate(-8deg) scale(2.2);
    opacity: 0;
  }
  60% {
    transform: rotate(-8deg) scale(0.94);
    opacity: 1;
  }
  100% {
    transform: rotate(-8deg) scale(1);
    opacity: 0.88;
  }
}

/* ---------- 공통 버튼 ---------- */
.cta-primary,
.primary,
.auth-submit,
.onboarding-next {
  display: block;
  width: 100%;
  padding: 16px 18px;
  background: var(--terracotta);
  color: #fffcf5;
  border: 1.5px solid var(--terracotta);
  border-radius: 16px;
  box-shadow: 3px 4px 0 rgba(74, 69, 64, 0.22);
  font-family: var(--font-title);
  font-size: 17px;
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease;
}

.cta-primary:active:not(:disabled),
.primary:active:not(:disabled),
.auth-submit:active,
.onboarding-next:active,
.cta-care:active,
.secondary:active,
.result-link:active,
.menu-mini-button:active {
  transform: translate(2px, 3px);
  box-shadow: 0 0 0 rgba(74, 69, 64, 0.22);
}

.primary:disabled {
  opacity: 0.55;
  box-shadow: none;
}

.cta-care,
.secondary,
.result-link,
.menu-mini-button {
  display: block;
  width: 100%;
  padding: 13px 16px;
  background: var(--paper);
  color: var(--ink-strong);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.18);
  font-family: var(--font-title);
  font-size: 15px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.cta-care {
  border-color: var(--dusty-blue);
  background: var(--dusty-blue-soft);
  color: #50708e;
}

.menu-mini-button {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
}

.back-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

/* ---------- 햄버거 / 계정 ---------- */
.utility-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-content: center;
  gap: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
}

.utility-icon span {
  width: 17px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.utility-icon span:nth-child(2) {
  width: 13px;
}

.account-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  padding: 0;
  overflow: hidden;
  /* 2026-07-19 베타: 로그인/계정 기능 미완성(betaAuthAdapter 스텁) → 숨김.
     visibility로 38px 자리를 남겨 헤더 제목 가운데 정렬 유지. 되살리려면 이 줄만 삭제. */
  visibility: hidden;
}

.account-avatar {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--ink-soft);
  position: relative;
  top: -3px;
}

.account-avatar::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  width: 26px;
  height: 12px;
  transform: translateX(-50%);
  border: 2px solid var(--ink-soft);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
}

/* =====================================================================
   홈 (버디)
   ===================================================================== */
.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.home-title {
  text-align: center;
}

.home-title h1 {
  margin: 2px 0 0;
  font-size: 20px;
  color: var(--ink-strong);
}

.buddy-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 16px 18px 14px;
  text-align: center;
}

/* 홈 버디 슬라이더 — 모험맵과 동일한 스크롤 스냅 페이지 (버디 상태 ↔ 기질 도감) */
.buddy-slider {
  position: relative;
  transform: rotate(-0.8deg); /* 스크랩북 기울임을 슬라이더 전체에 적용 */
  margin-bottom: 10px;
}

.buddy-deck {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  padding-top: 14px; /* 테이프(-10px)·프레임 그림자 여유 */
  padding-bottom: 8px;
}

.buddy-deck::-webkit-scrollbar {
  display: none;
}

.buddy-page {
  flex: 0 0 100%;
  box-sizing: border-box;
  scroll-snap-align: center;
}

/* 넘김 버튼 — 모험맵 map-nav와 동일 문법(카드 hero라 살짝 크게) */
.buddy-nav {
  position: absolute;
  top: 44%;
  transform: translateY(-50%);
  z-index: 4;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper-strong);
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.16);
  color: var(--ink-strong);
  font-family: var(--font-title);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease;
}

.buddy-nav:active {
  transform: translateY(-50%) translate(2px, 3px);
  box-shadow: none;
}

.buddy-nav--prev { left: -6px; }
.buddy-nav--next { right: -6px; }

.buddy-nav:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* 기질 도감 페이지 — 버디 카드와 같은 프레임, 내용 세로 중앙 정렬 */
.buddy-dex-page {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.buddy-dex-title {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--ink-strong);
}

.buddy-dex-hint {
  margin: 6px 0 0;
  font-size: 10px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.buddy-speech {
  display: inline-block;
  margin: 0 auto 6px;
  padding: 6px 13px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px 14px 14px 4px;
  background: var(--paper-strong);
  font-size: 13px;
  color: var(--ink);
  max-width: 86%;
}

.buddy-art {
  /* 단계별 성장 스케일(JS가 --buddy-stage-scale 설정): 알 0.72 → 최종형 1.0 */
  width: calc(clamp(118px, 32vw, 150px) * var(--buddy-stage-scale, 1));
  height: calc(clamp(118px, 32vw, 150px) * var(--buddy-stage-scale, 1));
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
  animation: buddyBreathe 3.2s ease-in-out infinite;
}

.buddy-art img,
.buddy-art svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes buddyBreathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.015);
  }
}

.buddy-art.is-sad {
  animation: none;
  filter: saturate(0.7);
  opacity: 0.92;
}

/* 배고픔 상태 — 배고픔 이미지 자체가 표정을 담으므로 호흡 애니메이션만 멈춰 축 처진 느낌 */
.buddy-art.is-hungry {
  animation: none;
}

.buddy-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.buddy-name-row h2 {
  margin: 0;
  font-size: 20px;
  color: var(--ink-strong);
}

.buddy-xp-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}

.xp-track {
  height: 9px;
  border-bottom: 2px dotted var(--ink-faint);
}

.xp-bar {
  position: relative;
  height: 5px;
  margin-top: 2px;
  border-radius: 3px;
  background: var(--mustard);
  transition: width 0.4s ease;
  min-width: 4px;
}

.xp-bar::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--terracotta);
}

/* 진화 게이트에 막힌 상태 — 가득 찼지만 잠김 */
.xp-bar.is-gated {
  background: var(--dusty-blue, #8fa8bf);
  opacity: 0.75;
}
.xp-bar.is-gated::after { background: var(--ink-soft, #8a8276); }

/* 일일 목표 줄 */
.daily-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin-bottom: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  font-size: 13px;
  color: var(--ink-soft);
}

.streak-flame {
  margin-left: auto;
  color: var(--terracotta);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.home-actions {
  display: grid;
  gap: 10px;
}

/* ---------- 홈 하단 현황 모듈 ---------- */
.home-modules {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.home-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 13px;
  box-shadow: var(--shadow-card);
}

.home-card:nth-of-type(odd) {
  transform: rotate(-0.4deg);
}

.home-card:nth-of-type(even) {
  transform: rotate(0.4deg);
}

.home-card-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.home-card-head h3 {
  margin: 0;
  font-size: 15px;
  color: var(--ink-strong);
}

/* 자주 틀리는 단어 */
.weak-words-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.weak-chip {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--terracotta);
  border-radius: 999px;
  background: var(--terracotta-soft);
  color: var(--ink-strong);
  font-family: var(--font-title);
  font-size: 13px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s ease, opacity 0.2s ease, background 0.2s ease;
}

.weak-chip i {
  font-style: normal;
  font-size: 11px;
  color: var(--terracotta);
  font-variant-numeric: tabular-nums;
}

/* 꾹 누르는 중 — 점점 줄어들며 삭제 임박 표시 */
.weak-chip.is-pressing {
  transform: scale(0.86);
  background: var(--terracotta);
  color: #fffcf5;
  transition: transform 0.55s ease, background 0.55s ease, color 0.2s ease;
}

.weak-chip.is-pressing i {
  color: rgba(255, 252, 245, 0.85);
}

.weak-chip.is-deleting {
  transform: scale(0.4);
  opacity: 0;
}

.weak-empty {
  margin: 2px 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.weak-hint {
  flex-basis: 100%;
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--ink-faint);
}

.home-card-btn {
  width: 100%;
  margin-top: 9px;
  padding: 9px;
  border: 1.5px solid var(--terracotta);
  border-radius: 12px;
  background: var(--paper);
  color: var(--terracotta);
  font-family: var(--font-title);
  font-size: 14px;
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.16);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.home-card-btn:active {
  transform: translate(2px, 3px);
  box-shadow: none;
}

/* 단어 숙련 요약 (컴팩트) */
.mastery-counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
  text-align: center;
}

.mastery-counts span {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-soft);
}

.mastery-counts b {
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

.mastery-copy {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--ink-soft);
  text-align: right;
}

/* ---------- 버디 카드 배경 = 현재 학습 지역 (맵과 동일한 손그림 풍경) ---------- */
.buddy-card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 19px; /* 카드 라운드에 맞춰 클립 (overflow:hidden은 테이프를 잘라서 금지) */
  object-fit: cover;
  object-position: center bottom;
  opacity: 0.45;
  z-index: 0;
  /* 상단 텍스트 가독성을 위해 위쪽을 종이색으로 페이드 */
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.9) 45%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.9) 45%);
  pointer-events: none;
}

.buddy-card > *:not(.buddy-card-bg) {
  position: relative;
  z-index: 1;
}

.buddy-card .buddy-art img,
.buddy-card .buddy-art svg {
  filter: drop-shadow(0 4px 3px rgba(74, 69, 64, 0.2));
}

/* =====================================================================
   모험 (학습 코어)
   ===================================================================== */
.study-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.study-title-block {
  text-align: center;
}

.study-title-block h1 {
  margin: 2px 0 0;
  font-size: 18px;
  color: var(--ink-strong);
}

.metrics-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.metric-item {
  text-align: center;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.metric-item strong {
  display: block;
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

.metric-item--streak strong {
  color: var(--terracotta);
}

.metric-item small {
  font-size: 10px;
  color: var(--ink-soft);
}

.progress-wrap {
  margin-bottom: 8px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 7px;
  border-bottom: 2px dotted var(--ink-faint);
  overflow: visible;
}

.progress-bar {
  position: relative;
  height: 3px;
  margin-top: 3px;
  border-radius: 2px;
  background: var(--ink);
  transition: width 0.25s ease;
}

.progress-bar::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--terracotta);
}

/* 보스 HUD */
.boss-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 9px;
  margin: 0 0 12px;
  border: 1.5px solid var(--ink);
  border-radius: 0 0 14px 14px;
  background: var(--paper-strong);
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.16);
}

.boss-hud-side {
  flex: 1;
  min-width: 0;
}

.boss-hud-name {
  display: block;
  font-family: var(--font-title);
  font-size: 12px;
  color: var(--ink-strong);
  margin-bottom: 4px;
}

.boss-hud-vs {
  font-family: var(--font-title);
  font-size: 13px;
  color: var(--stamp-red);
}

.hp-track {
  height: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}

.hp-bar {
  height: 100%;
  transition: width 0.35s ease;
}

.hp-bar--buddy {
  background: var(--sage);
}

.hp-bar--boss {
  background: var(--stamp-red);
}

/* ===================== 보스전 배틀 무대 ===================== */
.boss-stage {
  position: relative;
  height: 98px;
  margin: 0;
  border: 1.5px solid var(--ink);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  background: linear-gradient(180deg, #f6e3c8 0%, #f1d2b2 56%, #d8b189 100%);
  box-shadow: 2px 0 0 rgba(74, 69, 64, 0.16);
}
.boss-arena-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  z-index: 0;
}
/* 바닥선 */
.boss-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  height: 2px;
  z-index: 0;
  background: repeating-linear-gradient(90deg, rgba(74, 69, 64, 0.2) 0 6px, transparent 6px 12px);
}

/* 버디 (좌측, 오른쪽을 바라봄) — 단계·감정 무관 고정 크기 */
.boss-buddy {
  position: absolute;
  left: 8%;
  bottom: 12px;
  width: 68px;
  height: 76px;
  z-index: 2;
  transform-origin: center bottom;
}
.boss-buddy-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 2px rgba(74, 69, 64, 0.25));
}

/* 보스 (우측, 왼쪽을 바라봄) */
.boss-sprite {
  position: absolute;
  right: 7%;
  bottom: 13px;
  width: 24%;
  max-width: 88px;
  height: 70px; /* 버디(76px)와 동급 — 일반 보스가 더 작아 보이던 역전 해소 */
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform-origin: center bottom;
}
/* 계층별 크기 차등 — 중간보스/대마왕은 더 크게(placeholder·아트 공통) */
.boss-sprite.tier-mid {
  width: 27%;
  max-width: 100px;
  height: 78px;
}
.boss-sprite.tier-demon {
  width: 31%;
  max-width: 112px;
  height: 88px;
}
.boss-sprite-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 3px rgba(74, 69, 64, 0.28));
}
/* 아트 없을 때 귀여운 placeholder 실루엣 (.has-art면 숨김) */
.boss-sprite::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 78%;
  height: 84%;
  border-radius: 46% 46% 38% 38%;
  background: radial-gradient(circle at 38% 32%, #b6a0d2, #8f78b3 70%);
  box-shadow: inset -6px -6px 0 rgba(74, 69, 64, 0.12);
}
.boss-sprite::after {
  content: "";
  position: absolute;
  top: 32%;
  left: 38%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2c2733;
  box-shadow: 22px 0 0 #2c2733;
}
.boss-sprite.has-art::before,
.boss-sprite.has-art::after {
  display: none;
}

/* 투사체 */
.boss-projectile {
  position: absolute;
  bottom: 32px;
  left: 26%;
  width: 20px;
  height: 20px;
  z-index: 3;
  pointer-events: none;
  border-radius: 50%;
  transition: left 0.42s ease-in, bottom 0.42s ease-in;
}
.boss-projectile.proj-energy { background: radial-gradient(circle at 40% 38%, #fff7da, #e9c14e 70%, rgba(233, 193, 78, 0)); box-shadow: 0 0 12px #f2d27a; }
.boss-projectile.proj-slash { background: linear-gradient(120deg, #ffffff, #cfe0ec); border-radius: 62% 12% 62% 12%; }
.boss-projectile.proj-heart { background: radial-gradient(circle at 42% 38%, #f7b6cb, #e08aa0 72%); box-shadow: 0 0 10px #f3aac0; }
.boss-projectile.proj-food { background: radial-gradient(circle at 40% 40%, #ffffff, #e9d9b0 70%); border-radius: 42%; }
.boss-projectile.proj-boss { background: radial-gradient(circle at 42% 38%, #c9b3e0, #7d63a5 72%, rgba(125, 99, 165, 0)); box-shadow: 0 0 12px #9a86b5; }
.boss-projectile.is-crit { transform: scale(1.55); }
/* 아트 투사체 — CSS 도형 대신 PNG */
.boss-projectile.has-art {
  width: 32px;
  height: 32px;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  box-shadow: none;
  image-rendering: pixelated;
}
.boss-projectile.has-art.is-crit { width: 50px; height: 50px; transform: none; }

/* 임팩트 버스트 */
.boss-impact {
  position: absolute;
  bottom: 30px;
  width: 42px;
  height: 42px;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(circle, #fff7da 0%, #f2d27a 42%, rgba(242, 210, 122, 0) 72%);
}
.boss-impact.ko { width: 92px; height: 92px; }
.boss-impact.has-art {
  background-color: transparent;
  background-image: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  image-rendering: pixelated;
}
.boss-impact.show { animation: impactBurst 0.34s ease-out forwards; }
@keyframes impactBurst {
  0% { transform: scale(0.3); opacity: 0.2; }
  40% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* 콤보 팝업 */
.boss-combo {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 5;
  font-family: var(--font-title);
  font-size: 13px;
  color: #d9a94e;
  text-shadow: 0 1px 0 #fff;
  pointer-events: none;
}
.boss-combo.show { animation: comboPop 0.8s ease forwards; }
@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, 4px) scale(0.8); }
  30% { opacity: 1; transform: translate(-50%, -6px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -16px) scale(1); }
}

/* 동작 애니메이션 */
.boss-sprite.is-hurt { animation: bossHurt 0.4s ease; }
@keyframes bossHurt {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(7px); }
  40% { transform: translateX(-5px); }
  60% { transform: translateX(4px); }
  80% { transform: translateX(-3px); }
}
.boss-sprite.is-charge { animation: bossCharge 0.32s ease; }
@keyframes bossCharge {
  0% { transform: translateX(0) scale(1); }
  50% { transform: translateX(9px) scale(1.05); }
  100% { transform: translateX(0) scale(1); }
}
.boss-buddy.is-attack { animation: buddyAtk 0.3s ease; }
@keyframes buddyAtk {
  0% { transform: translateX(0); }
  40% { transform: translateX(10px) scaleX(1.05); }
  100% { transform: translateX(0); }
}
.boss-buddy.is-hurt { animation: buddyHurt 0.4s ease; }
@keyframes buddyHurt {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}
.boss-stage.shake { animation: stageShake 0.3s ease; }
@keyframes stageShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -2px); }
  75% { transform: translate(-2px, 1px); }
}

/* KO — 패배한 쪽이 비틀거리다 쓰러지며 사라짐 */
.boss-sprite.is-ko { animation: bossKO 1.1s ease forwards; }
@keyframes bossKO {
  0% { transform: translateX(0) rotate(0) scale(1); opacity: 1; }
  20% { transform: translateX(7px) rotate(5deg) scale(1.05); }
  45% { transform: translateX(-7px) rotate(-7deg) scale(0.96); opacity: 1; }
  100% { transform: translate(4px, 24px) rotate(-20deg) scale(0.35); opacity: 0; }
}
.boss-buddy.is-ko { animation: buddyKO 1.1s ease forwards; }
@keyframes buddyKO {
  0% { transform: translateX(0) rotate(0) scale(1); opacity: 1; }
  30% { transform: translateX(-6px) rotate(-9deg) scale(0.98); }
  100% { transform: translate(-4px, 18px) rotate(-24deg) scale(0.45); opacity: 0; }
}
/* KO 화면 섬광 */
.boss-stage.ko-flash::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  background: #fff;
  pointer-events: none;
  animation: koFlash 0.5s ease-out forwards;
}
@keyframes koFlash {
  0% { opacity: 0.7; }
  100% { opacity: 0; }
}

/* 제한시간 바 */
.quiz-timer {
  height: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
  margin-bottom: 10px;
}
.quiz-timer-bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, #9caf94, #d9a94e);
}
.quiz-timer.is-warning .quiz-timer-bar {
  background: var(--stamp-red);
  animation: timerPulse 0.5s ease-in-out infinite;
}
@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  .boss-stage.shake,
  .boss-sprite.is-hurt,
  .boss-sprite.is-charge,
  .boss-buddy.is-attack,
  .boss-buddy.is-hurt { animation: none; }
}

/* 학습 카드 — 3초 코어의 무대 */
.memory-card {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: clamp(6px, 1svh, 10px);
  min-height: clamp(360px, calc(100svh - 350px), 660px);
  padding: clamp(10px, 1.6svh, 16px) clamp(10px, 3vw, 16px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  transform: rotate(-0.8deg);
  margin-bottom: 10px;
}

.visual {
  display: grid;
  place-items: center;
  min-height: clamp(230px, 38svh, 420px);
  overflow: hidden;
  border-radius: 12px;
}

.visual svg {
  width: 100%;
  height: 100%;
  max-height: clamp(240px, 40svh, 440px);
}

.visual-card-art {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.visual-card-art img {
  width: 100%;
  max-height: clamp(240px, 40svh, 440px);
  object-fit: contain;
  border-radius: 22px;
  filter: drop-shadow(0 8px 12px rgba(70, 55, 40, 0.14));
  /* 카드 이미지의 흰 배경을 종이 카드 색에 녹임 — 모서리 흰 부분 제거 */
  mix-blend-mode: multiply;
}

.collection-silhouette {
  font-family: var(--font-title);
  font-size: clamp(40px, 9svh, 84px);
  color: var(--ink-faint);
}

.word-area {
  text-align: center;
  display: grid;
  gap: 4px;
  align-content: start;
}

.association {
  margin: 0;
  font-size: clamp(13px, 3.4vw, 15px);
  color: var(--terracotta);
  font-family: var(--font-title);
}

.word-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.word-head h2 {
  margin: 0;
  font-size: clamp(30px, 8.6vw, 40px);
  letter-spacing: 0.01em;
  color: var(--ink-strong);
  font-family: var(--font-title);
}

.word-head h2.word--long {
  font-size: clamp(24px, 7vw, 32px);
}

.word-head h2.word--xlong {
  font-size: clamp(20px, 6vw, 27px);
}

.word-head h2.word--xxlong {
  font-size: clamp(17px, 5vw, 22px);
}

.word-head h2.word--phrase {
  font-size: clamp(20px, 6vw, 28px);
}

.kind-badge {
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--mustard-soft);
  color: var(--ink);
  font-size: 12px;
}

.word-forms {
  width: 100%;
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.meaning {
  margin: 0;
  font-size: clamp(17px, 4.6vw, 20px);
  color: var(--ink-strong);
  font-weight: 700;
}

.example {
  margin: 0;
  font-size: clamp(13px, 3.5vw, 15px);
  color: var(--ink-soft);
  line-height: 1.55;
}

.example mark,
.example b,
.example strong {
  background: var(--mustard-soft);
  color: var(--ink-strong);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 700;
}

/* 퀴즈 */
.quiz-area {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-bottom: 12px;
}

/* 복습 체크 별표 — 카드/퀴즈 그림 모서리 */
/* 복습 버튼 — 홈의 버디 레벨 필(.pill--accent)과 같은 문법: 은은한 테라코타 배지.
   누르면(복습 등록) 진한 테라코타로 반전돼 눌린 상태가 또렷이 구분된다. */
.review-star {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  padding: 5px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: var(--terracotta);
  background: var(--terracotta-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.review-star:active {
  transform: scale(0.92);
}
.review-star.is-marked {
  color: #fffcf5;
  background: var(--terracotta);
}

.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.quiz-head h2 {
  margin: 2px 0 0;
  font-size: 17px;
  color: var(--ink-strong);
}

/* 퀴즈 그림 힌트 — 학습 때 본 연상 일러스트 */
.quiz-visual {
  display: grid;
  place-items: center;
  min-height: clamp(150px, 26svh, 240px);
  margin-bottom: 12px;
  border-radius: 14px;
  overflow: hidden;
}

.quiz-visual .visual-card-art img,
.quiz-visual svg {
  width: auto;
  max-width: 100%;
  max-height: clamp(150px, 26svh, 240px);
}

.quiz-prompt-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0 0 14px;
}

.quiz-question {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.65;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.quiz-hint {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--mustard-soft);
  color: var(--ink-soft);
  font-size: 11px;
}

.quiz-prompt-text {
  font-family: var(--font-title);
  color: var(--ink-strong);
  font-size: 15px;
}

.quiz-sentence {
  flex-basis: 100%;
  font-size: 13px;
  color: var(--ink-soft);
}

/* 답한 뒤에만 보이는 뜻 공개 피드백 */
.quiz-feedback {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-strong);
  animation: feedbackIn 0.2s ease;
}

.quiz-feedback b {
  font-family: var(--font-title);
}

.quiz-feedback.is-correct {
  background: var(--sage-soft);
  border: 1px solid var(--sage-deep);
}

.quiz-feedback.is-wrong {
  background: var(--terracotta-soft);
  border: 1px solid var(--terracotta);
}

@keyframes feedbackIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.choices {
  display: grid;
  gap: 9px;
}

.choice {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: var(--paper-strong);
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.12);
  color: var(--ink-strong);
  font-family: var(--font-title);
  font-size: 16px;
  text-align: center;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.choice:active:not(:disabled) {
  transform: translate(2px, 3px);
  box-shadow: 0 0 0 rgba(74, 69, 64, 0.12);
}

.choice-main {
  display: block;
}

.choice-form {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  font-family: var(--font-body);
  margin-top: 2px;
}

.choice.correct {
  background: var(--sage);
  border-color: var(--sage-deep);
  color: #fffcf5;
}

.choice.correct .choice-form {
  color: rgba(255, 252, 245, 0.85);
}

.choice.wrong {
  background: var(--terracotta-soft);
  border-color: var(--terracotta);
  animation: choiceShake 0.25s ease;
}

@keyframes choiceShake {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-4px);
  }
  60% {
    transform: translateX(4px);
  }
}

/* 결과 배너 */
.result-banner {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 12px;
}

.daily-stamp-ceremony {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.daily-stamp-ceremony b {
  font-family: var(--font-title);
  color: var(--ink-strong);
  font-size: 14px;
}

.result-buddy-art {
  width: 110px;
  height: 110px;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
}

.result-buddy-art img,
.result-buddy-art svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--terracotta);
  font-family: var(--font-title);
}

.result-copy strong {
  display: block;
  margin: 4px 0 6px;
  font-family: var(--font-title);
  font-size: 22px;
  color: var(--ink-strong);
}

.result-copy p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.result-xp-line {
  display: inline-block;
  margin: 12px auto 0;
  padding: 7px 14px;
  border: 1px dashed var(--mustard);
  border-radius: 12px;
  background: var(--mustard-soft);
  font-size: 13px;
  color: var(--ink-strong);
  font-family: var(--font-title);
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.result-stats span {
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-strong);
  font-size: 12px;
  color: var(--ink-soft);
}

.result-stats span:empty {
  display: none;
}

.result-links {
  margin-top: 14px;
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
  justify-content: center;
}

.result-link {
  width: auto;
  padding: 9px 18px;
  font-size: 13px;
}

.actions {
  display: grid;
  gap: 9px;
}

/* =====================================================================
   모험 맵
   ===================================================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.page-header h2 {
  margin: 2px 0 0;
  font-size: 20px;
  color: var(--ink-strong);
}

.map-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.map-summary article {
  text-align: center;
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.map-summary span {
  display: block;
  font-size: 10px;
  color: var(--ink-soft);
}

.map-summary strong {
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

/* ---------- 좌우 슬라이드 맵 ---------- */
.map-slider {
  position: relative;
}

.map-path {
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 6px 0 8px;
  overscroll-behavior-x: contain;
}

.map-path::-webkit-scrollbar {
  display: none;
}

/* 작은 양옆 넘김 버튼 */
.map-nav {
  position: absolute;
  top: 46%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper-strong);
  color: var(--ink-strong);
  font-size: 17px;
  line-height: 1;
  box-shadow: var(--shadow-card);
  z-index: 5;
  cursor: pointer;
}

.map-nav--prev { left: 3px; }
.map-nav--next { right: 3px; }

.map-nav:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* 맵 하단 여백 (지역 이동은 스와이프 + 양옆 버튼) */
.map-slider {
  padding-bottom: calc(var(--safe-bottom) + 16px);
}

/* ---------- 지역 챕터 (손그림 지도 타일) — 한 페이지 = 한 지역 ---------- */
.map-chapter {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  box-sizing: border-box;
  scroll-snap-align: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  padding: 14px 14px 16px;
}

/* 아트 미도착 시 지역별 폴백 워시 톤 */
.map-chapter--1 {
  background: linear-gradient(180deg, rgba(156, 175, 148, 0.14), transparent 70%), var(--paper);
}

.map-chapter--2 {
  background: linear-gradient(180deg, rgba(143, 168, 191, 0.16), transparent 70%), var(--paper);
}

.map-chapter--3 {
  background: linear-gradient(180deg, rgba(217, 169, 78, 0.13), transparent 70%), var(--paper);
}

.map-chapter--4 {
  background: linear-gradient(180deg, rgba(201, 123, 93, 0.13), transparent 70%), var(--paper);
}

.map-chapter-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  z-index: 0;
}

.map-chapter-head,
.map-chapter .map-nodes,
.map-chapter .map-boss-row {
  position: relative;
  z-index: 1;
}

.map-chapter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.map-chapter-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ink-strong);
}

/* [트랙2] 등급순 재배치: 지역 챕터마다 학습 등급(초/중/고/대학/심화) 배지 */
.map-chapter-head h3 .map-chapter-grade {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--sage-soft, #d6e8d2);
  color: var(--sage-deep, #4a7a52);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.map-chapter-head span {
  font-size: 11px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.map-chapter.is-done .map-chapter-head h3::after {
  content: " ✓";
  color: var(--sage-deep);
}

.map-nodes {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px 8px;
  padding: 12px 30px 0; /* 좌우 여백으로 양옆 넘김 버튼과 겹치지 않게 */
}

/* 구불구불한 길 느낌 — 노드를 번갈아 살짝 어긋나게 */
.map-nodes .map-node:nth-child(odd) {
  transform: translateY(5px) rotate(-1deg);
}

.map-nodes .map-node:nth-child(3n) {
  transform: translateY(-4px) rotate(1deg);
}

.map-nodes .map-node:nth-child(7) {
  transform: translateY(3px);
}

.map-boss-row {
  display: grid;
  place-items: center;
  margin-top: 12px;
}

.map-boss-row:empty {
  display: none;
}

.map-boss-node {
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 4px 10px 8px;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--stamp-red);
  font-family: var(--font-title);
  font-size: 14px;
  box-shadow: none;
  transition: transform 0.1s ease;
}

.map-boss-node:active:not(:disabled) {
  transform: scale(0.96);
}

.map-boss-node.is-locked {
  opacity: 0.45;
  color: var(--ink-faint);
}

.map-boss-node.is-cleared {
  color: var(--sage-deep);
}

.map-boss-node.is-active {
  animation: bossBob 1.8s ease-in-out infinite;
}

@keyframes bossBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* 보스 아이콘(랜드마크)을 크게 — 테두리 카드 없이 그림 자체로 강조 */
.map-boss-art {
  width: clamp(132px, 44vw, 184px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 5px 4px rgba(74, 69, 64, 0.22));
}

.map-boss-node.is-active .map-boss-art {
  filter: drop-shadow(0 6px 6px rgba(192, 86, 61, 0.32));
}

.map-boss-node.is-locked .map-boss-art {
  filter: grayscale(0.5) opacity(0.6);
}

.map-boss-label {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--paper-strong);
  border: 1.5px solid currentColor;
  font-size: 13px;
}

.map-boss-node.is-active .map-boss-label {
  background: var(--terracotta-soft);
}

.map-node {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--font-title);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  box-shadow: 1px 2px 0 rgba(74, 69, 64, 0.12);
  transition: transform 0.08s ease;
  padding: 0;
}

.map-node:active:not(:disabled) {
  transform: translate(1px, 2px);
  box-shadow: none;
}

.map-node.is-cleared {
  border-color: var(--sage-deep);
  background: var(--sage-soft);
  color: var(--sage-deep);
}

.map-node.is-active {
  border-color: var(--terracotta);
  border-width: 2px;
  background: var(--terracotta-soft);
  color: var(--terracotta);
  font-weight: 700;
}

.map-node-buddy {
  position: absolute;
  top: -30px;
  left: 50%;
  width: 34px;
  height: 34px;
  transform: translateX(-50%);
  pointer-events: none;
  animation: buddyBreathe 3.2s ease-in-out infinite;
  z-index: 2;
}

.map-node-buddy img,
.map-node-buddy svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 1.5px rgba(74, 69, 64, 0.25));
}

.map-node.is-locked {
  opacity: 0.38;
  box-shadow: none;
}

.map-node.is-boss {
  border-radius: 16px;
  border-width: 2px;
  border-color: var(--stamp-red);
  color: var(--stamp-red);
  font-size: 11px;
}

.map-node.is-boss.is-cleared {
  background: rgba(192, 86, 61, 0.12);
}

/* =====================================================================
   기록
   ===================================================================== */
.stats-shell {
  display: grid;
  gap: 12px;
  padding-bottom: calc(var(--safe-bottom) + 14px);
}

.paper-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.paper-panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--ink-strong);
}

.stats-counters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
}

.stats-counters article span {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
}

.stats-counters article strong {
  font-family: var(--font-title);
  font-size: 20px;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

.stats-heatmap {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  gap: 3px;
}

.stats-heatmap i {
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(122, 114, 104, 0.1);
}

.stats-heatmap i[data-l="1"] {
  background: #d8e0cd;
}

.stats-heatmap i[data-l="2"] {
  background: var(--sage);
}

.stats-heatmap i[data-l="3"] {
  background: var(--sage-deep);
}

.vocab-gauge {
  height: 10px;
  border-bottom: 2px dotted var(--ink-faint);
}

.vocab-gauge > div {
  position: relative;
  height: 5px;
  margin-top: 3px;
  border-radius: 3px;
  background: var(--ink);
  transition: width 0.4s ease;
}

.vocab-gauge > div::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--terracotta);
}

.vocab-gauge-copy {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.stats-weekly {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 8px;
  height: 96px;
}

.stats-weekly div {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  gap: 4px;
}

.stats-weekly b {
  display: block;
  width: 100%;
  background: var(--dusty-blue);
  border-radius: 4px 4px 0 0;
  height: calc(var(--v, 0) * 1%);
  min-height: 3px;
}

.stats-weekly small {
  font-size: 10px;
  color: var(--ink-soft);
}

/* =====================================================================
   하단 탭 (노트 인덱스 탭)
   ===================================================================== */
.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 430px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  padding: 0 clamp(10px, 3vw, 16px) calc(var(--safe-bottom) + 8px);
  border-top: 1px dashed var(--line-strong);
  background: linear-gradient(180deg, rgba(245, 238, 227, 0.6), rgba(245, 238, 227, 0.96) 40%);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.tab-button {
  min-height: 50px;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
  transform: translateY(5px);
  transition: transform 0.15s ease, background 0.15s ease;
}

.tab-button.active {
  background: var(--paper);
  color: var(--ink-strong);
  border-color: var(--line-strong);
  transform: translateY(0);
  box-shadow: 0 -3px 8px rgba(74, 69, 64, 0.06);
  font-family: var(--font-title);
}

.tab-button.active span::after {
  content: "";
  display: block;
  margin: 3px auto 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mustard);
}

/* =====================================================================
   상점 탭
   ===================================================================== */
.store-section {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}
.store-h {
  margin: 0 0 2px;
  font-size: 14px;
  font-family: var(--font-title);
  color: var(--ink-strong);
}
.store-h small { font-size: 10px; color: var(--ink-soft); font-family: var(--font-body); }
.store-sub {
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--ink-soft);
}
.store-paint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.store-paint {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 11px;
  background: var(--bg);
  box-shadow: 1px 2px 0 rgba(74, 69, 64, 0.12);
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease;
}
.store-paint:active:not(:disabled) { transform: translate(1px, 2px); box-shadow: none; }
.store-paint:disabled { opacity: 0.45; box-shadow: none; }
.store-paint .sp-sw { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line-strong); }
.store-paint .sp-mid { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.store-paint .sp-name { font-size: 12px; font-family: var(--font-title); color: var(--ink-strong); }
.store-paint .sp-tag { font-style: normal; font-size: 8.5px; color: var(--terracotta); margin-left: 3px; }
.store-paint.is-special { border-color: var(--terracotta); background: linear-gradient(180deg, #fdf3ee, var(--bg)); }
.store-paint .sp-own { font-size: 9.5px; color: var(--ink-soft); }
.store-paint .sp-buy { font-size: 11px; color: var(--mustard); font-family: var(--font-title); font-variant-numeric: tabular-nums; white-space: nowrap; }
.store-buy-canvas {
  width: 100%;
  padding: 11px;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink-strong);
  font-family: var(--font-title);
  font-size: 13px;
  box-shadow: 1px 2px 0 rgba(74, 69, 64, 0.12);
}
.store-buy-canvas:active:not(:disabled) { transform: translate(1px, 2px); box-shadow: none; }
.store-buy-canvas:disabled { opacity: 0.5; box-shadow: none; }
.store-section--soon { opacity: 0.66; border-style: dashed; }

/* =====================================================================
   메뉴 드로어
   ===================================================================== */
.app-menu,
.auth-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.menu-backdrop,
.auth-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(74, 69, 64, 0.35);
}

.menu-drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(86%, 340px);
  background: var(--bg);
  border-right: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  animation: drawerIn 0.22s ease;
}

@keyframes drawerIn {
  from {
    transform: translateX(-24px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 16px) 18px 12px;
  border-bottom: 1px dashed var(--line-strong);
}

.menu-header h2 {
  margin: 2px 0 0;
  font-size: 19px;
  color: var(--ink-strong);
}

.menu-close-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  font-size: 17px;
  color: var(--ink);
}

.menu-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px calc(var(--safe-bottom) + 16px);
  display: grid;
  gap: 12px;
  align-content: start;
}

.menu-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.menu-block:nth-of-type(odd) {
  transform: rotate(-0.4deg);
}

.menu-block:nth-of-type(even) {
  transform: rotate(0.4deg);
}

.menu-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.menu-section-head h3 {
  margin: 2px 0 0;
  font-size: 15px;
  color: var(--ink-strong);
}

.menu-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.menu-stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  background: var(--paper-strong);
}

.menu-stat--button {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.menu-stat--button:disabled {
  cursor: default;
  opacity: 0.55;
}
.menu-stat--button:not(:disabled):active {
  background: var(--paper);
}

.menu-stat span {
  display: block;
  font-size: 10px;
  color: var(--ink-soft);
}

.menu-stat strong {
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

.menu-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  font-size: 14px;
  color: var(--ink);
}

.menu-setting select {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper-strong);
  padding: 6px 10px;
  color: var(--ink-strong);
}

.menu-setting input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--terracotta);
}

.menu-reset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
  color: var(--ink);
}

.issue-pills {
  display: flex;
  flex-wrap: wrap; /* 유형 4종 — 좁은 화면(320px)에서 가로 넘침 방지 */
  gap: 6px;
  margin-bottom: 9px;
}

.issue-pill {
  padding: 6px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-strong);
  color: var(--ink-soft);
  font-size: 12px;
}

.issue-pill.is-active {
  background: var(--terracotta-soft);
  border-color: var(--terracotta);
  color: var(--terracotta);
  font-weight: 700;
}

.issue-draft {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper-strong);
  padding: 10px;
  resize: vertical;
  color: var(--ink);
  font-size: 13px;
}

.issue-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.issue-actions small {
  color: var(--ink-faint);
  font-size: 11px;
}

/* 전송 중 중복 제출 방지 상태 */
#issueSaveButton:disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* =====================================================================
   계정 다이얼로그
   ===================================================================== */
.auth-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-0.6deg);
  width: min(92%, 340px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
  padding: 18px;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.auth-header h2 {
  margin: 2px 0 0;
  font-size: 19px;
  color: var(--ink-strong);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.auth-tab {
  padding: 9px 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper-strong);
  color: var(--ink-soft);
  font-size: 13px;
}

.auth-tab.is-active {
  background: var(--terracotta-soft);
  border-color: var(--terracotta);
  color: var(--terracotta);
  font-weight: 700;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-soft);
}

.auth-field input,
.auth-field select {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper-strong);
  padding: 9px 10px;
  color: var(--ink-strong);
  font-size: 14px;
}

.auth-submit {
  margin-top: 4px;
  padding: 12px;
  font-size: 15px;
}

.auth-status {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
}

/* =====================================================================
   온보딩
   ===================================================================== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(74, 69, 64, 0.35);
  padding: 24px;
}

.onboarding-card {
  position: relative;
  width: min(100%, 320px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
  transform: rotate(-1deg);
  padding: 30px 22px 22px;
  text-align: center;
}

.onboarding-skip {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: none;
  color: var(--ink-faint);
  font-size: 12px;
  text-decoration: underline;
}

.onboarding-art {
  height: 130px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.onboarding-art img,
.onboarding-art svg {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.onboarding-art img {
  border-radius: 14px;
  mix-blend-mode: multiply;
}

.onboarding-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: var(--ink-strong);
}

.onboarding-card p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.onboarding-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
}

.onboarding-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}

.onboarding-dots i.active {
  background: var(--terracotta);
}

.onboarding-next {
  padding: 13px;
  font-size: 15px;
}

.onboarding-next:disabled {
  opacity: 0.5;
  box-shadow: none;
}

/* 베타 설문 — 온보딩 카드 톤 재사용 + 선택형 옵션(기존 버튼 문법) */
.survey-card {
  width: min(100%, 360px);
  max-height: 88vh;
  overflow-y: auto;
}

.survey-q {
  text-align: left;
  margin: 0 0 14px;
}

.survey-q-label {
  display: block;
  margin: 0 0 8px;
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--ink-strong);
}

.survey-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.survey-opt {
  padding: 9px 14px;
  background: var(--paper);
  color: var(--ink-strong);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.18);
  font-family: var(--font-title);
  font-size: 13px;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease, color 0.12s ease;
}

.survey-opt:active {
  transform: translate(2px, 3px);
  box-shadow: 0 0 0 rgba(74, 69, 64, 0.22);
}

.survey-opt.is-selected {
  background: var(--terracotta-soft);
  border-color: var(--terracotta);
  color: var(--terracotta);
}

.survey-q-label small {
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: normal;
}

.survey-scale .survey-opt {
  min-width: 44px;
  text-align: center;
}

.survey-hint {
  display: block;
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--ink-faint);
}

.survey-thanks {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--sage-deep);
  font-family: var(--font-title);
}

/* 스크롤 잠금 */
body.menu-open,
body.auth-open,
body.survey-open {
  overflow: hidden;
}

/* 좁은 화면 보정 */
@media (max-width: 360px) {
  .map-nodes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .word-head h2 {
    font-size: clamp(26px, 8vw, 34px);
  }
}

/* 결과 배너 상태 구분 (QC v2-3) */
.result-banner.result-banner--reward {
  border: 1.5px solid var(--mustard);
  background:
    radial-gradient(circle at 50% 0%, var(--mustard-soft), transparent 55%),
    var(--paper);
}

.result-banner.result-banner--failed {
  border: 1.5px dashed var(--terracotta);
}

.result-banner.result-banner--failed .result-copy strong {
  color: var(--terracotta);
}

/* =====================================================================
   키우기(다마고치) 탭 + 홈 상황판 — 종이 위의 도트
   ===================================================================== */

/* 홈 상황판 (좌우로 걷는 픽셀 버디) */
.buddy-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--paper-strong), var(--paper));
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
}

.buddy-strip-sprite {
  /* 키우기 탭과 같은 도트 에셋(assets/buddy/dot/)을 재사용 — 비율이 정사각형이 아니라 contain 필요. */
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  /* 문구(글리프) 직전까지의 빈 공간에서 놀기 — 범위는 JS가 실측해 --strip-range로 전달 */
  --strip-range: 22px;
  animation: stripPlay 10s ease-in-out infinite;
}

@keyframes stripPlay {
  0%, 10% { transform: translateX(0) translateY(0) scaleX(1); }
  13% { transform: translateX(calc(var(--strip-range) * 0.08)) translateY(-6px) scaleX(1); } /* 폴짝 */
  16% { transform: translateX(calc(var(--strip-range) * 0.15)) translateY(0) scaleX(1); }
  19% { transform: translateX(calc(var(--strip-range) * 0.22)) translateY(-5px) scaleX(1); } /* 폴짝 */
  22%, 32% { transform: translateX(calc(var(--strip-range) * 0.3)) translateY(0) scaleX(1); }
  42% { transform: translateX(var(--strip-range)) translateY(0) scaleX(1); }     /* 총총 — 문구 직전까지 */
  46%, 56% { transform: translateX(var(--strip-range)) translateY(0) scaleX(-1); } /* 뒤돌아보기 */
  60% { transform: translateX(var(--strip-range)) translateY(-6px) scaleX(-1); } /* 폴짝 */
  63%, 70% { transform: translateX(var(--strip-range)) translateY(0) scaleX(-1); }
  82% { transform: translateX(calc(var(--strip-range) * 0.12)) translateY(0) scaleX(-1); } /* 총총 복귀 */
  86%, 100% { transform: translateX(0) translateY(0) scaleX(1); }
}

.buddy-strip-sprite.is-still {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .buddy-strip-sprite {
    animation: none;
  }
}

.buddy-strip-text {
  flex: 1;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  z-index: 1;
}

.buddy-strip-go {
  font-size: 12px;
  color: var(--terracotta);
  font-family: var(--font-title);
  flex-shrink: 0;
  z-index: 1;
}

/* 키우기 무대 */
.care-stage {
  position: relative;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(183, 205, 220, 0.18), transparent 45%),
    var(--paper);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.care-scene {
  --care-ground-line: 80%;
  --care-buddy-height: 62%;
  --care-buddy-baseline-offset: 12px;
  position: relative;
  height: 168px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, transparent var(--care-ground-line), rgba(156, 175, 148, 0.16) var(--care-ground-line), rgba(156, 175, 148, 0.16) 92%, var(--bg) 92%);
  overflow: hidden;
}

/* 모험맵 톤의 도트 배경 (버디 뒤) */
.care-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  border-radius: 14px;
  z-index: 0;
  pointer-events: none;
}

.care-scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--care-ground-line);
  height: 1px;
  z-index: 0;
  background: repeating-linear-gradient(90deg, rgba(74, 69, 64, 0.22) 0 4px, transparent 4px 8px);
}

/* 버디 발밑 접지 그림자 — 버디를 땅에 고정시켜 소품과 같은 바닥으로 묶음 */
.care-scene::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(var(--care-ground-line) + 5px);
  width: var(--care-shadow-w, 32%); /* 버디 단계 크기에 맞춰 JS가 조정 */
  height: 11px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(74, 69, 64, 0.22), transparent 72%);
  z-index: 0;
  pointer-events: none;
  /* 호흡에 맞춰 그림자도 살짝 수축 — 땅에 살아있는 무게감 */
  animation: careShadowBreath 2.6s ease-in-out infinite;
}
.care-scene.buddy-still::before { animation: none; }

@keyframes careShadowBreath {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.82; }
}

.care-buddy {
  position: absolute;
  left: 50%;
  bottom: calc(100% - var(--care-ground-line) - var(--care-buddy-baseline-offset));
  z-index: 1;
  width: auto;
  height: var(--care-buddy-height);
  max-width: 58%;
  object-fit: contain;
  object-position: center bottom;
  transform: translateX(-50%);
  transform-origin: center bottom;
  animation: careBob var(--care-breath, 2.6s) ease-in-out infinite;
  cursor: pointer; /* 직접 탭하면 반응 */
  will-change: transform; /* 컴포지터 레이어로 승격 — 배경 등 메인스레드 작업과 분리되어 끊김↓ */
  backface-visibility: hidden;
}

.care-buddy.is-still {
  animation: none;
}

/* 기질 뱃지 — 버디 머리 위 오른쪽에 가깝게, 겹치지 않게 둥실둥실 */

/* 평소 호흡 — 들썩이며 살짝 기울이는 유기적 idle (정지 PNG가 '숨쉬게') */
@keyframes careBob {
  0%, 100% { transform: translateX(-50%) translateY(0) scaleX(1) scaleY(1) rotate(0deg); }
  25% { transform: translateX(-50%) translateY(-2%) scaleX(0.992) scaleY(1.014) rotate(-0.7deg); }
  50% { transform: translateX(-50%) translateY(0.4%) scaleX(1.016) scaleY(0.988) rotate(0deg); }
  75% { transform: translateX(-50%) translateY(-1%) scaleX(0.996) scaleY(1.006) rotate(0.7deg); }
}

/* idle 행동(성격에 따라 빈도가 다른 단발 동작) — careBob을 잠시 대체 */
.care-buddy.act-hop { animation: bdHop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.care-buddy.act-look { animation: bdLook 0.85s ease-in-out; }
.care-buddy.act-wiggle { animation: bdWiggle 0.62s ease-in-out; }
.care-buddy.act-strut { animation: bdStrut 0.72s ease-in-out; }
.care-buddy.act-yawn { animation: bdYawn 1.4s ease-in-out; }
.care-buddy.act-stretch { animation: bdStretch 1.3s ease-in-out; }
.care-buddy.act-sit { animation: bdSit 1.5s ease-in-out; }
.care-buddy.act-walk { animation: bdWalk 1.9s ease-in-out; }
.care-buddy.act-blink { animation: bdBlink 0.2s ease; }
.care-buddy.act-poke { animation: bdPoke 0.55s cubic-bezier(0.36, 1.7, 0.5, 1); }

/* 점프 — 예비동작(살짝 가라앉음)→도약→착지 스쿼시(탄성) */
@keyframes bdHop {
  0% { transform: translateX(-50%) translateY(0) scaleX(1) scaleY(1); }
  16% { transform: translateX(-50%) translateY(3%) scaleX(1.05) scaleY(0.92); }
  46% { transform: translateX(-50%) translateY(-18%) scaleX(0.95) scaleY(1.08); }
  74% { transform: translateX(-50%) translateY(0) scaleX(1.07) scaleY(0.9); }
  88% { transform: translateX(-50%) translateY(-3%) scaleX(0.98) scaleY(1.03); }
  100% { transform: translateX(-50%) translateY(0) scaleX(1) scaleY(1); }
}

@keyframes bdLook {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  28% { transform: translateX(-50%) rotate(-6deg); }
  64% { transform: translateX(-50%) rotate(6deg); }
}

@keyframes bdWiggle {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  20% { transform: translateX(-52%) rotate(-4deg); }
  50% { transform: translateX(-48%) rotate(4deg); }
  80% { transform: translateX(-51%) rotate(-2deg); }
}

@keyframes bdStrut {
  0%, 100% { transform: translateX(-50%) scaleX(1); }
  25% { transform: translateX(-46%) scaleX(1.03); }
  75% { transform: translateX(-54%) scaleX(1); }
}

/* 하품 — 천천히 위로 늘어났다(입 벌리듯) 가라앉음 */
@keyframes bdYawn {
  0%, 100% { transform: translateX(-50%) scaleX(1) scaleY(1) rotate(0deg); }
  35% { transform: translateX(-50%) translateY(-4%) scaleX(0.97) scaleY(1.06) rotate(-2deg); }
  60% { transform: translateX(-50%) translateY(-5%) scaleX(0.96) scaleY(1.07) rotate(0deg); }
  82% { transform: translateX(-50%) translateY(1%) scaleX(1.04) scaleY(0.95) rotate(0deg); }
}

/* 기지개 — 뒤로 젖혔다 쭉 펴기 */
@keyframes bdStretch {
  0%, 100% { transform: translateX(-50%) rotate(0deg) scaleY(1); }
  30% { transform: translateX(-50%) rotate(-7deg) scaleY(0.98); }
  58% { transform: translateX(-50%) rotate(4deg) translateY(-6%) scaleY(1.08); }
  80% { transform: translateX(-50%) rotate(0deg) scaleY(0.97); }
}

/* 앉기 — 폭 눌렀다 천천히 복귀 */
@keyframes bdSit {
  0%, 100% { transform: translateX(-50%) scaleX(1) scaleY(1); }
  24% { transform: translateX(-50%) scaleX(1.08) scaleY(0.84); }
  70% { transform: translateX(-50%) scaleX(1.06) scaleY(0.86); }
}

/* 산책 — 씬 안을 좌우로 뒤뚱뒤뚱 다녀옴(작은 발걸음 들썩) */
@keyframes bdWalk {
  0% { transform: translateX(-50%) rotate(0deg) translateY(0); }
  15% { transform: translateX(-86%) rotate(-3deg) translateY(-4%); }
  30% { transform: translateX(-94%) rotate(3deg) translateY(0); }
  45% { transform: translateX(-86%) rotate(-3deg) translateY(-4%); }
  55% { transform: translateX(-50%) rotate(2deg) translateY(0); }
  70% { transform: translateX(-14%) rotate(-3deg) translateY(-4%); }
  85% { transform: translateX(-10%) rotate(3deg) translateY(0); }
  100% { transform: translateX(-50%) rotate(0deg) translateY(0); }
}

/* 깜빡임 대용 틱 — 아주 빠른 스쿼시(살아있는 잔동작) */
@keyframes bdBlink {
  0%, 100% { transform: translateX(-50%) scaleY(1); }
  50% { transform: translateX(-50%) scaleY(0.93); }
}

/* 탭 반응 — 움찔하고 통통 튐 */
@keyframes bdPoke {
  0%, 100% { transform: translateX(-50%) translateY(0) scaleX(1) scaleY(1); }
  25% { transform: translateX(-50%) translateY(2%) scaleX(1.08) scaleY(0.9); }
  55% { transform: translateX(-50%) translateY(-12%) scaleX(0.94) scaleY(1.09); }
  80% { transform: translateX(-50%) translateY(0) scaleX(1.04) scaleY(0.96); }
}

/* ===== 기질 시그니처 동작 (지배 기질일 때만 등장 — 한눈에 다른 성격) ===== */
.care-buddy.act-slash { animation: bdSlash 0.7s cubic-bezier(0.3, 1.4, 0.5, 1); }     /* brave: 윈드업→돌진 */
.care-buddy.act-bounce { animation: bdBounce 0.95s cubic-bezier(0.3, 1.3, 0.5, 1); }  /* lively: 연속 통통 */
.care-buddy.act-nuzzle { animation: bdNuzzle 1.1s ease-in-out; }                       /* clingy: 화면 쪽으로 부비 */
.care-buddy.act-munch { animation: bdMunch 1s ease-in-out; }                           /* foodie: 냠냠 */

@keyframes bdSlash {
  0%, 100% { transform: translateX(-50%) rotate(0deg) scaleX(1); }
  20% { transform: translateX(-58%) rotate(-9deg) scaleX(0.95); }
  48% { transform: translateX(-38%) rotate(11deg) scaleX(1.07); }
  68% { transform: translateX(-45%) rotate(6deg) scaleX(1.02); }
}

@keyframes bdBounce {
  0%, 100% { transform: translateX(-50%) translateY(0) scaleY(1); }
  15% { transform: translateX(-50%) translateY(-17%) scaleY(1.07); }
  30% { transform: translateX(-50%) translateY(0) scaleY(0.92); }
  45% { transform: translateX(-50%) translateY(-12%) scaleY(1.05); }
  60% { transform: translateX(-50%) translateY(0) scaleY(0.94); }
  78% { transform: translateX(-50%) translateY(-6%) scaleY(1.03); }
}

@keyframes bdNuzzle {
  0%, 100% { transform: translateX(-50%) scale(1) rotate(0deg); }
  25% { transform: translateX(-52%) scale(1.09) rotate(-5deg); }
  55% { transform: translateX(-48%) scale(1.11) rotate(5deg); }
  80% { transform: translateX(-50%) scale(1.05) rotate(-2deg); }
}

@keyframes bdMunch {
  0%, 100% { transform: translateX(-50%) scaleX(1) scaleY(1); }
  15% { transform: translateX(-50%) scaleX(1.05) scaleY(0.93); }
  30% { transform: translateX(-50%) scaleX(0.99) scaleY(1.02); }
  45% { transform: translateX(-50%) scaleX(1.05) scaleY(0.93); }
  60% { transform: translateX(-50%) scaleX(0.99) scaleY(1.02); }
  78% { transform: translateX(-50%) scaleX(1.04) scaleY(0.95); }
}

/* ===== 기질별 호흡 템포 차등 — 변수(--care-breath)로만 줘서 단발 동작 animation과 충돌 안 함 ===== */
/* (animation-duration로 직접 주면 특이도가 .act-* 규칙을 이겨 동작이 중간에 잘림 — 반드시 변수로) */
.care-scene.temper-lively .care-buddy { --care-breath: 1.95s; }  /* 활발: 빠르고 활기참 */
.care-scene.temper-lively::before { animation-duration: 1.95s; }
.care-scene.temper-foodie .care-buddy { --care-breath: 3.1s; }   /* 먹보: 느긋·여유 */
.care-scene.temper-foodie::before { animation-duration: 3.1s; }
.care-scene.temper-clingy .care-buddy { --care-breath: 2.3s; }   /* 응석: 폭 큰 부드러운 호흡 */
.care-scene.temper-clingy::before { animation-duration: 2.3s; }
.care-scene.temper-brave .care-buddy { --care-breath: 2.4s; }    /* 용감: 절도있고 또렷 */
.care-scene.temper-brave::before { animation-duration: 2.4s; }

.care-speech {
  margin: 12px auto 0;
  display: inline-block;
  padding: 7px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px 14px 14px 4px;
  background: var(--paper-strong);
  font-size: 13px;
  color: var(--ink);
  max-width: 90%;
}


.care-temperament {
  margin: 8px auto 0;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.4;
}

.care-temperament b {
  color: var(--terracotta);
  font-family: var(--font-title);
}

/* 최종 엔딩 카드 */
.care-ending {
  margin-top: 14px;
  padding: 18px 16px;
  border: 1.5px solid var(--terracotta);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--terracotta-soft), var(--paper));
  box-shadow: var(--shadow-card);
  text-align: center;
}

.care-ending-eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--terracotta);
  font-family: var(--font-title);
}

.care-ending-art {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 2px auto 10px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
}

.care-ending h3 {
  margin: 0 0 8px;
  font-size: 19px;
  color: var(--ink-strong);
}

.care-ending p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* 상태 바 4종 */
.care-stats {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.care-stat {
  display: grid;
  grid-template-columns: 50px 1fr;
  align-items: center;
  gap: 10px;
}

.care-stat-label {
  font-size: 12px;
  color: var(--ink-soft);
  font-family: var(--font-title);
}

.care-bar {
  height: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--bg);
  overflow: hidden;
}

.care-bar i {
  display: block;
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease, background 0.3s ease;
}

#barFullness { background: var(--terracotta); }
#barHappiness { background: var(--mustard); }
#barHealth { background: var(--sage); }
#barEnergy { background: var(--dusty-blue); }
#barAffection { background: #e08aa0; }

.care-bar.is-low i {
  background: var(--stamp-red) !important;
}

/* 돌보기 버튼 */
.care-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.care-btn {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1px;
  padding: 5px 2px;
  border: 1.5px solid var(--line-strong);
  border-radius: 11px;
  background: var(--paper);
  box-shadow: 1px 2px 0 rgba(74, 69, 64, 0.14);
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease;
}

.care-btn:active:not(:disabled) {
  transform: translate(1px, 2px);
  box-shadow: none;
}

.care-btn:disabled {
  opacity: 0.45;
  box-shadow: none;
}

.care-btn-icon {
  font-size: 15px;
  line-height: 1.05;
}

.care-btn-name {
  font-size: 9.5px;
  color: var(--ink-strong);
  font-family: var(--font-title);
  white-space: nowrap;
}

.care-btn-cost {
  font-size: 8.5px;
  color: var(--mustard);
  font-variant-numeric: tabular-nums;
}

.care-btn.is-maxed .care-btn-cost {
  color: var(--ink-soft);
}

.care-btn--free .care-btn-cost {
  color: var(--sage-deep);
}

.care-btn.is-active {
  border-color: var(--dusty-blue);
  background: var(--dusty-blue-soft);
}

/* 부활 관문 */
/* ===================== 물감 퀘스트 패널 ===================== */
.paint-panel {
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-card);
}
.paint-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}
.paint-panel-head h3 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 12.5px;
  color: var(--ink-strong);
}
.paint-edit-btn {
  font-family: var(--font-title);
  font-size: 11px;
  padding: 4px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-strong);
  color: var(--ink-strong);
  box-shadow: 1px 2px 0 rgba(74, 69, 64, 0.16);
  cursor: pointer;
}
.paint-edit-btn:active { transform: translateY(1px); box-shadow: none; }

.paint-quests { list-style: none; margin: 0 0 7px; padding: 0; display: grid; gap: 4px; }
.paint-quest {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}
.paint-quest.is-done { opacity: 0.62; border-color: var(--sage); background: rgba(156, 175, 148, 0.12); }
.pq-swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(74, 69, 64, 0.3); flex: 0 0 auto; }
.pq-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.pq-body b { font-size: 12px; color: var(--ink-strong); }
.pq-body small { font-size: 10px; color: var(--ink-soft, #8a8276); }
.pq-reward { text-align: right; font-family: var(--font-title); font-size: 11px; color: var(--ink-strong); display: flex; flex-direction: column; line-height: 1.2; }
.pq-reward i { font-style: normal; font-size: 9px; color: var(--ink-soft, #8a8276); }

.paint-inventory { display: block; }
.paint-inv-label { display: block; font-size: 10.5px; color: var(--ink-soft, #8a8276); margin-bottom: 4px; }
.paint-swatches { display: grid; gap: 3px; } /* 열 수는 renderPaintPanel에서 색 개수로 설정 → 한 줄에 전부 */
.paint-sw { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.paint-sw i { width: 100%; max-width: 17px; aspect-ratio: 1 / 1; height: auto; border-radius: 4px; border: 1px solid rgba(74, 69, 64, 0.3); }
.paint-sw small { font-size: 8px; color: var(--ink); line-height: 1; }
.paint-sw.is-empty { opacity: 0.35; }

.paint-canvas-block { margin-top: 7px; }
.paint-canvas-block .paint-inv-label small { color: var(--ink-soft, #8a8276); }
.paint-canvases { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.paint-canvas-slot {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 3px; border: 1.5px solid var(--line-strong); border-radius: 8px;
  background: var(--paper-strong); cursor: pointer;
}
.paint-canvas-slot.is-active { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(156, 175, 148, 0.5); }
.paint-canvas-slot.is-locked { opacity: 0.5; cursor: default; background: var(--bg); }
.paint-canvas-slot small { font-size: 9px; color: var(--ink); font-family: var(--font-title); }
.pcs-thumb { width: 40px; height: 20px; border-radius: 3px; border: 1px solid rgba(74, 69, 64, 0.25); image-rendering: pixelated; display: block; }
.pcs-lock { font-size: 15px; line-height: 20px; }

/* 물감 획득 토스트 */
.paint-toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translate(-50%, 12px);
  z-index: 60;
  max-width: 88%;
  padding: 10px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-strong);
  color: var(--ink-strong);
  font-size: 13px;
  font-family: var(--font-title);
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.2);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.paint-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===================== 배경 에디터 ===================== */
.paint-editor {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(40, 36, 32, 0.5);
}
.paint-editor[hidden] { display: none; }
.paint-editor-card {
  width: 100%;
  max-width: 360px;
  padding: 16px;
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 4px 6px 0 rgba(74, 69, 64, 0.22);
}
.pe-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pe-head b { font-family: var(--font-title); font-size: 15px; color: var(--ink-strong); }
.pe-x {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--ink); background: var(--paper-strong);
  font-size: 14px; color: var(--ink-strong); cursor: pointer;
}
.pe-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  display: block;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  image-rendering: pixelated;
  background: #fffdf7;
  touch-action: none;
  cursor: crosshair;
}
.pe-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  justify-content: center;
}
.pe-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px; border: 2px solid transparent; border-radius: 9px; background: transparent; cursor: pointer;
}
.pe-swatch i { width: 26px; height: 26px; border-radius: 7px; border: 1px solid rgba(74, 69, 64, 0.3); display: block; }
.pe-swatch small { font-size: 10px; color: var(--ink); }
.pe-swatch.is-sel { border-color: var(--ink); background: var(--paper-strong); }
.pe-swatch.is-empty { opacity: 0.4; }
.pe-tools { display: flex; gap: 6px; margin-bottom: 12px; }
.pe-tool {
  flex: 1; padding: 8px 4px; font-size: 12px;
  font-family: var(--font-title);
  border: 1.5px solid var(--line-strong); border-radius: 10px;
  background: var(--paper-strong); color: var(--ink-strong); cursor: pointer;
}
.pe-tool.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pe-save {
  width: 100%; padding: 12px; font-size: 15px;
  font-family: var(--font-title);
  border: 1.5px solid var(--ink); border-radius: 12px;
  background: var(--sage); color: var(--ink-strong); cursor: pointer;
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.2);
}
.pe-save:active { transform: translateY(1px); box-shadow: none; }

.care-revival {
  text-align: center;
  padding: 18px 14px;
  border: 1.5px dashed var(--terracotta);
  border-radius: 16px;
  background: var(--terracotta-soft);
}

.care-revival p {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
}

/* 돌봄 효과 팝 애니메이션 */
@keyframes carePop {
  0% { transform: translateY(0); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(-26px); opacity: 0; }
}

.care-pop {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  font-size: 18px;
  pointer-events: none;
  animation: carePop 0.9s ease forwards;
  z-index: 2;
}

/* =====================================================================
   2026-07 상용화 1차 — 듣기·스펠링 퀴즈 + 데이터 지키기 + 공용 토스트
   신규 시각 언어 금지: :root 토큰 + 기존 버튼 문법(잉크 보더·오프셋 섀도우)만 사용
   ===================================================================== */

/* ---------- 공용 토스트 (저널 쪽지 톤) ---------- */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 96px);
  transform: translateX(-50%);
  z-index: 8000;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(92vw, 398px);
  padding: 11px 14px;
  background: var(--paper-strong);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  color: var(--ink-strong);
  font-size: 13px;
  line-height: 1.5;
  animation: feedbackIn 0.2s ease;
}

.app-toast-action {
  flex: none;
  padding: 6px 12px;
  background: var(--paper);
  color: var(--ink-strong);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.18);
  font-family: var(--font-title);
  font-size: 12px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.app-toast-action:active {
  transform: translate(2px, 3px);
  box-shadow: 0 0 0 rgba(74, 69, 64, 0.18);
}

/* ---------- 듣기 퀴즈: 다시 듣기 버튼 ---------- */
.quiz-speak {
  flex-shrink: 0;
  padding: 5px 10px;
  background: var(--paper);
  color: var(--ink-strong);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.18);
  font-family: var(--font-title);
  font-size: 13px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.quiz-speak:active {
  transform: translate(2px, 3px);
  box-shadow: 0 0 0 rgba(74, 69, 64, 0.18);
}

/* ---------- 스펠링 퀴즈: 빈칸 슬롯 + 글자 타일 ---------- */
.spelling-area {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.spelling-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.spelling-slot {
  width: 34px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--paper-strong);
  color: var(--ink-strong);
  font-family: var(--font-title);
  font-size: 18px;
  text-transform: lowercase;
}

.spelling-slot.is-given {
  border-style: solid;
  border-color: var(--line);
  background: transparent;
  color: var(--ink-soft);
}

.spelling-slot.is-filled {
  border-style: solid;
  border-color: var(--ink);
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.12);
}

.spelling-slot.is-correct {
  background: var(--sage);
  border-style: solid;
  border-color: var(--sage-deep);
  color: #fffcf5;
}

.spelling-slot.is-wrong {
  background: var(--terracotta-soft);
  border-style: solid;
  border-color: var(--terracotta);
  animation: choiceShake 0.25s ease;
}

.spelling-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.spelling-tile {
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper-strong);
  box-shadow: 2px 3px 0 rgba(74, 69, 64, 0.12);
  color: var(--ink-strong);
  font-family: var(--font-title);
  font-size: 17px;
  text-transform: lowercase;
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.08s ease;
}

.spelling-tile:active:not(:disabled) {
  transform: translate(2px, 3px);
  box-shadow: 0 0 0 rgba(74, 69, 64, 0.12);
}

.spelling-tile:disabled {
  opacity: 0.35;
  box-shadow: none;
}

/* ---------- 메뉴: 데이터 지키기 (백업) ---------- */
.backup-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.backup-status {
  display: block;
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.5;
}

/* ---------- 결과 화면: 버디 라인 (학습=돌봄 + 에너지 보상 배수 표시) ---------- */
.result-buddy-line {
  display: inline-block;
  margin: 10px auto 0;
  padding: 7px 14px;
  border: 1px dashed var(--sage-deep);
  border-radius: 12px;
  background: var(--sage-soft);
  font-size: 13px;
  color: var(--ink-strong);
  font-family: var(--font-title);
}

/* ---------- 키우기: 기질 특기 표시 ---------- */
.care-perk {
  color: var(--terracotta);
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- 모험맵: 온라인 모험 티저 (준비 중 — 잠금 카드) ---------- */
.online-teaser {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.online-teaser-head h3 {
  margin: 2px 0 0;
  font-size: 16px;
  color: var(--ink-strong);
}

/* 기존 크기의 컴팩트 카드 + 오너 제작 일러스트(assets/adventure/)를 반투명 배경으로 깐다.
   이미지는 카드 높이에 맞춰 cover로 크롭(리사이즈 아님) — 세로 여백은 잘리고 핵심 장면이 남는다. */
.online-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  width: 100%;
  padding: 12px 14px;
  background: var(--paper);
  border: 1.5px dashed var(--line-strong); /* 점선 — 아직 잠긴 카드라는 신호 */
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  text-align: left;
  transition: transform 0.08s ease;
}

.online-card:active {
  transform: scale(0.985);
}

/* 배경 그림 레이어 — 카드 자체가 아니라 이 레이어에만 불투명도를 걸어 글자는 선명하게 유지 */
.online-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center 60%; /* 하늘 여백보다 번개/마법진이 있는 아래쪽 장면을 남긴다 */
  opacity: 0.5;
}

#pvpTeaserButton::before {
  background-image: url("assets/adventure/vs-bg.png");
}

#coopTeaserButton::before {
  background-image: url("assets/adventure/coop-bg.png");
}

.online-card-copy {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.online-card-copy b {
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--ink-strong);
}

.online-card-copy small {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.online-lock {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-strong);
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

/* ---------- 키우기: 유대 질문 카드 (버디가 말을 건다) ---------- */
.care-question {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1.5px dashed var(--dusty-blue);
  border-radius: 16px;
  background: var(--dusty-blue-soft);
  box-shadow: var(--shadow-card);
}

.care-question-text {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--ink-strong);
  font-family: var(--font-title);
  line-height: 1.5;
}

.care-question-actions {
  display: flex;
  gap: 8px;
}

.care-question-actions .menu-mini-button {
  flex: 1;
}

/* ---------- 키우기: 기질 도감 ---------- */
/* 버디 도감 — 단계별 섹션 + 작은 카드 나열식(스크롤). 버디가 많아 컴팩트하게. */
.buddy-dex-grid {
  margin: 0 0 8px;
  max-height: 216px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  scrollbar-width: thin;
}

.buddy-dex-grid::-webkit-scrollbar { width: 5px; }
.buddy-dex-grid::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}

.buddy-dex-section {
  margin-bottom: 8px;
}

.buddy-dex-stage {
  display: block;
  margin: 0 0 5px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  font-family: var(--font-title);
}

.buddy-dex-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.buddy-dex-tile {
  flex: 0 0 calc(20% - 5px); /* 한 줄 5칸(기질 수와 정렬) */
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 6px 2px 4px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--paper-strong);
  font: inherit;
  color: inherit;
}

button.buddy-dex-tile {
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.buddy-dex-tile img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.buddy-dex-tile i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-style: normal;
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--ink-faint);
}

.buddy-dex-tile small {
  font-size: 9px;
  color: var(--ink-soft);
  line-height: 1.1;
}

.buddy-dex-tile.is-found {
  border-style: solid;
  border-color: var(--sage-deep);
  background: var(--sage-soft);
}

.buddy-dex-tile.is-found small {
  color: var(--ink-strong);
  font-weight: 700;
}

.buddy-dex-tile.is-found:active {
  transform: translate(1px, 2px);
}

/* 버디 도감 상세 팝업 (evo-overlay 톤) */
.dex-popup {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(74, 69, 64, 0.4);
}

.dex-popup-card {
  position: relative;
  width: min(100%, 300px);
  padding: 22px 18px 20px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
  text-align: center;
}

.dex-popup-x {
  position: absolute;
  top: 8px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--ink-soft);
  cursor: pointer;
}

.dex-popup-eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--sage-deep);
  font-family: var(--font-title);
}

.dex-popup-art {
  width: 128px;
  height: 128px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
}

.dex-popup-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dex-popup-name {
  margin: 0 0 6px;
  font-size: 20px;
  color: var(--ink-strong);
}

.dex-popup-summary {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.dex-popup-perk {
  display: inline-block;
  margin: 0;
  padding: 5px 12px;
  border: 1.5px solid var(--sage-deep);
  border-radius: 999px;
  background: var(--sage-soft);
  font-size: 12px;
  color: var(--ink-strong);
  font-family: var(--font-title);
}

/* ---------- 키우기: 2회차 새 알 + 추억 앨범 ---------- */
.care-rebirth {
  margin-top: 14px;
  padding: 18px 16px;
  border: 1.5px dashed var(--mustard);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--mustard-soft), var(--paper));
  box-shadow: var(--shadow-card);
  text-align: center;
}

.care-rebirth h3 {
  margin: 0 0 8px;
  font-size: 19px;
  color: var(--ink-strong);
}

.care-rebirth p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.care-rebirth .care-ending-eyebrow {
  color: var(--mustard);
}

.care-album {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow-card);
}

.care-album h3 {
  margin: 2px 0 10px;
  font-size: 16px;
  color: var(--ink-strong);
}

.care-album-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.care-album-list li {
  padding: 9px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--paper-strong);
  font-size: 13px;
  color: var(--ink-strong);
  font-family: var(--font-title);
}

.care-album-list li small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-soft);
  font-family: var(--font-body);
}

/* ---------- 진화 연출 (다마고치식: 어랏? → 빛 → 새 모습 공개) ---------- */
.evo-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(74, 69, 64, 0.4);
}

.evo-card {
  position: relative;
  width: min(100%, 320px);
  padding: 22px 18px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
  text-align: center;
  overflow: hidden;
}

.evo-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--mustard);
  font-family: var(--font-title);
}

.evo-speech {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink-strong);
  font-family: var(--font-title);
}

.evo-art {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
}

.evo-art img,
.evo-art svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.evo-art--shake {
  animation: evoShake 0.5s ease infinite;
}

.evo-art--reveal {
  animation: evoReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.evo-sparkle {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 22px;
  animation: evoSparkle 1.1s ease infinite;
}

.evo-sparkle--b {
  top: auto;
  right: auto;
  bottom: 10px;
  left: 4px;
  font-size: 16px;
  animation-delay: 0.4s;
}

/* 빛 터짐 — 카드 전체가 종이빛으로 차올랐다 사라진다 */
.evo-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--paper-strong);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.evo-overlay.evo-flash .evo-card::after {
  opacity: 1;
}

.evo-title {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--terracotta);
  font-family: var(--font-title);
  animation: feedbackIn 0.25s ease;
}

@keyframes evoShake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-3px) rotate(-2deg); }
  75% { transform: translateX(3px) rotate(2deg); }
}

@keyframes evoReveal {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes evoSparkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .evo-art--shake,
  .evo-art--reveal,
  .evo-sparkle {
    animation: none;
  }
}
