/* style.css - 비난 게임 전체 스타일 */

/* ── 웹 폰트 로드 ── */
@font-face {
  font-family: 'DungGeunMo';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/DungGeunMo.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ── 리셋 & 기본 ── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

:root {
  --color-bg: #1c1814;
  --color-panel: #231f18;
  --color-accent: #c9926a;
  --color-accent-soft: #d4ae8c;
  --color-text: #f0e6d6;
  --color-text-dim: #8a7d6c;
  --color-bar: #7aa87e;
  --color-bar-stress: #b86050;
  --color-border: #3c3428;
  --color-surface: #2c2820;
  --font-title: 'DungGeunMo', monospace;
  --font-body: 'DungGeunMo', monospace;
  --font-pixel: 'DungGeunMo', monospace;
  --ui-opacity: 0.55;   /* UI 투명도 (설정에서 조정, JS가 덮어씀) */
}

/* ── UI 숨김 토글 버튼 (우상단 floating) ── */
#ui-hide-btn {
  position: fixed;
  top: 88px;          /* top-bar 아래 */
  right: 10px;
  z-index: 50;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(35, 31, 24, var(--ui-opacity));
  border: 1px solid #3a3228;
  border-radius: 6px;
  color: var(--color-text);
  cursor: pointer;
  padding: 0;
  transition: opacity 0.3s ease, transform 0.15s ease;
}
#ui-hide-btn svg { width: 14px; height: 14px; }
#ui-hide-btn:active { transform: scale(0.92); }

/* ── UI 숨김 모드 (3단계: normal → glass → hidden) ── */
/* 1단계 glass: 상하단 블러/배경 제거, 글씨에 검은 외곽선 */
body.ui-glass #top-bar,
body.ui-glass #bottom-menu {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: transparent !important;
}
body.ui-glass #top-nickname,
body.ui-glass #top-level,
body.ui-glass #top-money,
body.ui-glass #top-diamond,
body.ui-glass #top-weather .weather-text,
body.ui-glass #bottom-menu .bm-label {
  color: #fff !important;
  text-shadow:
    -1px 0 0 #000,
    1px 0 0 #000,
    0 -1px 0 #000,
    0 1px 0 #000;
}
body.ui-glass #top-weather .weather-emoji {
  text-shadow: none !important;
}

/* 2단계 hidden: 완전히 숨김 */
body.ui-hidden #top-bar,
body.ui-hidden #bottom-menu {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
body.ui-hidden #ui-hide-btn {
  opacity: 0.4;
  background: rgba(35, 31, 24, 0.3);
}
body.ui-hidden #ui-hide-btn:hover {
  opacity: 1;
}
#top-bar, #bottom-menu {
  transition: opacity 0.3s ease, background 0.3s ease;
}

/* ── 화분뷰 UI 숨김 토글 버튼 ── */
#pot-ui-hide-btn {
  position: fixed;
  top: 16px;
  right: 10px;
  z-index: 50;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(35, 31, 24, var(--ui-opacity));
  border: 1px solid #3a3228;
  border-radius: 6px;
  color: var(--color-text);
  cursor: pointer;
  padding: 0;
  transition: opacity 0.3s ease, transform 0.15s ease;
}
#pot-ui-hide-btn svg { width: 14px; height: 14px; }
#pot-ui-hide-btn:active { transform: scale(0.92); }

/* 화분뷰 UI 숨김 모드: 양파 영역(배경)을 블러로, UI/상호작용은 모두 유지 */
body.pot-ui-hidden #pot-view {
  background: rgba(20, 16, 12, 0.25) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
body.pot-ui-hidden #pot-ui-hide-btn {
  opacity: 0.6;
  background: rgba(35, 31, 24, 0.3);
}
/* 뒤의 메인 화면 게임 배경이 보이게 */
body.pot-ui-hidden #main-screen {
  display: flex !important;
}
body.pot-ui-hidden #main-screen #top-bar,
body.pot-ui-hidden #main-screen #bottom-menu,
body.pot-ui-hidden #main-screen #pots-container,
body.pot-ui-hidden #main-screen #ui-hide-btn,
body.pot-ui-hidden #ui-hide-btn {
  display: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;            /* 동적 viewport — 인앱 브라우저 상하단 UI 변화 대응 (미지원 시 위 100% 폴백) */
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  overflow: hidden;
}

.pixelated {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hidden { display: none !important; }
/* 자기개발 화분 모드 전용 hide — 일반 .hidden과 분리해서 충돌 방지 */
.selfdev-hidden { display: none !important; }

/* ── 공통 화면 래퍼 ── */
.screen {
  position: fixed;
  inset: 0;
  height: 100dvh;           /* 인앱 브라우저 viewport 대응 */
  display: flex;
  flex-direction: column;
  max-width: 430px;
  margin: 0 auto;
  /* 노치·홈바 안전영역 (viewport-fit=cover) — 상단바/하단메뉴 잘림 완화 */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
}

/* ── 로딩 화면 ── */
#loading-screen {
  background: var(--color-bg);
  justify-content: center;
  align-items: center;
  gap: 24px;
  transition: opacity 0.5s;
}

#loading-screen.fade-out { opacity: 0; }
#loading-screen.hidden { display: none !important; }
/* 재표시 시 hidden + fade-out 해제 + 베일 재진입 효과 */
#loading-screen.reopen { display: flex !important; opacity: 1; animation: loading-fade-in 0.25s ease; }
@keyframes loading-fade-in { from { opacity: 0; } to { opacity: 1; } }

#loading-onion {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin: 2px 0 -6px;
  filter: drop-shadow(0 6px 14px rgba(240, 200, 80, 0.25));
  animation: loading-onion-bob 2.2s ease-in-out infinite;
}
@keyframes loading-onion-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.loading-logo {
  font-size: 2.4rem;
  color: var(--color-accent);
  letter-spacing: 4px;
}

.loading-bar-wrap {
  width: 60%;
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
}

#loading-bar {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  transition: width 0.2s ease;
  border-radius: 4px;
}

.loading-hint {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  min-height: 2.4em;
  line-height: 1.5;
  text-align: center;
  white-space: pre-line;
  opacity: 1;
  transition: opacity 0.3s ease;
}
.loading-hint.tip-fade { opacity: 0; }

/* ── 오프닝 화면 ── */
#opening-screen {
  background: #0a0a0a;
  justify-content: center;
  align-items: center;
  transition: opacity 0.8s;
}

#opening-screen.fade-out { opacity: 0; }

#opening-seed {
  width: 80px;
  height: 80px;
  cursor: pointer;
}

/* ── 메인 화면 ── */
#main-screen {
  background: var(--color-bg);
}

/* ── 사이드바 ── */
#sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: rgba(28, 24, 20, var(--ui-opacity));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-right: 1px solid #3a3228;
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 0 0 24px;
  transform: translateX(0);
  transition: transform 0.25s ease;
}

#sidebar.hidden {
  display: flex !important;
  transform: translateX(-100%);
}

#sidebar-backdrop.hidden { display: none !important; }

#sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #3a3228;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--color-text-dim);
}

#sidebar-header button {
  background: none;
  border: none;
  color: var(--color-text-dim);
  font-size: 1rem;
  cursor: pointer;
}

.sidebar-btn {
  background: none;
  border: none;
  color: var(--color-text);

  font-size: 0.82rem;
  padding: 14px 20px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}

.sidebar-btn:hover, .sidebar-btn:active { background: #272318; }
.sidebar-btn-danger { color: #cc5555; margin-top: auto; }

.sidebar-divider {
  height: 1px;
  background: #3a3228;
  margin: 8px 16px;
}
.mail-badge {
  display: inline-block;
  background: #e05050;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* 상단바 */
#top-bar {
  display: flex;
  flex-direction: column;
  padding: 16px 12px 6px;  /* 상단 6 → 16: 시스템 UI 숨겨도 콘텐츠가 너무 위에 붙지 않게 */
  background: rgba(35, 31, 24, var(--ui-opacity));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(58, 50, 40, var(--ui-opacity));
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  gap: 4px;
}

#top-bar-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#top-left-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

#top-profile-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-accent);
  background: #2a2520;
  cursor: pointer;
  flex-shrink: 0;
  object-fit: contain;
}

#top-profile {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  gap: 2px;
}

#top-profile-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

#top-nickname {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  cursor: pointer;
  flex-shrink: 1;
}

#top-level {
  font-size: 0.68rem;
  color: var(--color-accent);
  font-weight: 700;
  white-space: nowrap;
}

#top-exp-bar-wrap {
  width: 100%;
  height: 3px;
  background: #3a3228;
  border-radius: 2px;
  overflow: hidden;
}

#top-exp-bar {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

#top-currency {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#top-money, #top-diamond {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

#top-diamond { color: #88ccff; }

/* 상단바 2행: 사이드바, 이벤트, 날씨, 채팅 */
#top-bar-row2 {
  display: flex;
  align-items: center;
  gap: 6px;
}

#sidebar-toggle-btn {
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.25rem;          /* 1.1 → 1.25 살짝 크게 */
  cursor: pointer;
  padding: 4px 8px;
}
/* 사이드바 새 이슈 — 느린 깜빡임 (mail/환경편집 등) */
#sidebar-toggle-btn.sidebar-alert {
  color: #e53e3e;
  animation: sidebar-blink 1.6s ease-in-out infinite;
}
@keyframes sidebar-blink {
  0%, 100% { color: #e53e3e; text-shadow: 0 0 8px rgba(229,62,62,0.5); }
  50%      { color: #ff8888; text-shadow: 0 0 14px rgba(229,62,62,0.9); }
}

/* 사이드바 메뉴 항목 빨간 점 (환경 편집 등 신규 알림용) */
.sidebar-new-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e53e3e;
  margin-left: 6px;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(229,62,62,0.6);
}
.sidebar-new-dot.hidden { display: none; }

#event-star-btn {
  background: linear-gradient(135deg, #e6a020, #f0c040);
  border: 1.5px solid #c08818;
  border-radius: 6px;
  font-size: 0.78rem;          /* 0.7 → 0.78 살짝 크게 */
  cursor: pointer;
  padding: 3px 10px;
  color: #fff;
  position: relative;
}
#event-star-btn .event-badge {
  position: absolute; top: -4px; right: -4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #e53e3e; border: 1.5px solid var(--color-panel);
}

.top-bar-spacer { flex: 1; }

#top-weather {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
}

#top-sprout-countdown {
  font-size: 0.62rem;
  color: rgba(220,220,255,0.78);
  white-space: nowrap;
  padding: 1px 4px;
}

#top-golden-hour {
  font-size: 0.62rem;
  color: #1a1a2e;
  background: linear-gradient(135deg, #f7c948, #f0a020);
  border: 1px solid #c08818;
  border-radius: 4px;
  white-space: nowrap;
  padding: 1px 5px;
  font-weight: 700;
}

#top-chat-btn {
  background: none;
  border: 1.5px solid #3a3228;
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.95rem;          /* 0.85 → 0.95 살짝 크게 */
  cursor: pointer;
  padding: 3px 10px;
  position: relative;
}

#chat-unread-badge {
  position: absolute;
  top: -6px; right: -8px;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  background: #e53e3e;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1.5px solid var(--color-panel);
  line-height: 1;
}

/* 게임 배경 */
#game-bg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-bottom: 0;
  background-image: url('images/bg_room_night.png'); /* applyBackground()가 동적으로 교체 */
  background-size: cover;
  background-position: center bottom;
  transition: filter 1s ease, background-color 0.6s ease;
  overflow: hidden;
  z-index: 1;
}

#game-bg.mood-happy  { filter: brightness(1.1) sepia(0.2) hue-rotate(-20deg); }
#game-bg.mood-sad    { filter: brightness(0.8) sepia(0.4) hue-rotate(180deg); }
#game-bg.mood-stress { filter: brightness(0.9) saturate(1.4); }
#game-bg.mood-neglect { filter: grayscale(0.6) brightness(0.7); }

/* ── 배경 애니메이션 레이어 ───────────────────────── */
.bg-anim-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  will-change: transform, opacity;
}
.bg-anim-layer.hidden { display: none; }

/* 프레임 크로스페이드 — 항상 bottom layer(B) opacity 1 유지, top layer(A)만 0↔1 페이드 */
/* 합산 alpha 항상 1 → game-bg의 정적 base 이미지(frame 1) 새어나옴 방지 */
.bg-frame-layer {
  opacity: 1;
}
#bg-anim-frame-b { z-index: 0; }   /* bottom, always opacity 1 — 가장 아래 */
#bg-anim-frame-a { z-index: 1; }   /* top frame, opacity 0↔1 페이드 */

/* 옥탑방 레이어 — frame > cloud > building 순서로 위로 쌓아 cloud가 frame fade 영향 안 받게 */
/* 구름은 contain(전체 보이도록)으로 horizontal crop 방지 — 다른 레이어는 cover 유지 */
#bg-cloud    { z-index: 2; transform: translateX(-100%); animation: cloud-drift 95s linear infinite; background-size: contain !important; background-position: center 4px !important; }
#bg-building { z-index: 3; }

@keyframes cloud-drift {
  0%   { transform: translateX(-100%); }   /* 완전 off-left */
  100% { transform: translateX(100%); }    /* 완전 off-right → 다음 사이클 시작점은 -100% */
}

/* 옥탑방 — 배경을 하단 UI(메뉴) 바로 위에 맞춤. 화면 전체가 아니라 메뉴 위 영역에 배경을 채워 갈색 빈 공간 제거 */
body[data-bg-theme="citypop_rooftop"] #game-bg {
  bottom: var(--bottom-menu-h, 64px);
  background-position: center bottom;
}
body[data-bg-theme="citypop_rooftop"] .bg-anim-layer {
  background-position: center bottom;
}
body[data-bg-theme="citypop_rooftop"] #pots-container { bottom: 6%; }
/* 옥탑방 — 하단 메뉴는 항상 uiOpacity=1 (완전 불투명) 상태로 강제 유지 */
/* uiOpacity 슬라이더, ui-glass, ui-hidden 모두 무시 (위쪽 top-bar만 사용자 설정에 반응) */
body[data-bg-theme="citypop_rooftop"] #bottom-menu,
body.ui-glass[data-bg-theme="citypop_rooftop"] #bottom-menu {
  background: rgba(35, 31, 24, 1) !important;
  border-top-color: rgba(58, 50, 40, 1) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}
/* ui-hidden(눈 표시 2번 누름) — UI 완전 숨김 시 배경이 화면 전체를 채우도록 원복 + bottom-menu 정상 숨김 */
body.ui-hidden[data-bg-theme="citypop_rooftop"] #game-bg {
  bottom: 0;
  background-position: center bottom;
}
body.ui-hidden[data-bg-theme="citypop_rooftop"] .bg-anim-layer {
  background-position: center bottom;
}
body.ui-hidden[data-bg-theme="citypop_rooftop"] #pots-container {
  bottom: 6%;
}
/* 화분뷰 UI 숨김 시에도 배경이 화면 전체를 채우도록 원복 */
body.pot-ui-hidden[data-bg-theme="citypop_rooftop"] #game-bg {
  bottom: 0;
}

/* 날씨 인디케이터 (top-bar-row2로 이동) */

/* 날씨 이펙트 레이어 */
#weather-effect {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

#weather-effect.weather-cloud {
  background: rgba(100, 110, 140, 0.18);
}

#weather-effect.weather-rain-bg {
  background: rgba(60, 80, 120, 0.12);
}

/* 빗방울 */
.rain-drop {
  position: absolute;
  top: -10px;
  width: 1.5px;
  height: 14px;
  background: linear-gradient(to bottom, transparent, rgba(160, 200, 255, 0.7));
  border-radius: 2px;
  animation: rain-fall linear forwards;
}

@keyframes rain-fall {
  to { transform: translateY(105vh); opacity: 0.3; }
}

/* 눈송이 */
.snow-flake {
  position: absolute;
  top: -20px;
  font-size: 0.75rem;
  color: rgba(220, 240, 255, 0.85);
  animation: snow-fall linear forwards;
}

@keyframes snow-fall {
  to {
    transform: translateY(105vh) rotate(360deg);
    opacity: 0.2;
  }
}

/* 파티클 컨테이너 — 모든 화면 위에 고정 */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.particle {
  position: absolute;
  font-size: 0.95rem;
  color: var(--color-accent-soft);
  animation: float-up ease-out forwards;
  pointer-events: none;
  opacity: 0.85;
}

.tap-particle {
  font-size: 0.65rem;
  opacity: 0.55;
  color: var(--color-text-dim);
}

/* 화분들 — 배경 책상/바닥 영역에 절대 위치로 고정 */
/* 화분 PNG 원본 64×88px, 1.75x 표시 = 112×154px (픽셀아트는 image-rendering: pixelated로 유지) */
/* 3개 가로 배치: 112×3 + gap 8×2 = 352px (모바일 360~430 viewport에 안정 fit) */
#pots-container {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16%;             /* 기본값 — 테마별로 아래 [data-bg-theme]에서 override */
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  padding: 0 8px;
  pointer-events: none;    /* slot에서 다시 활성화 */
  transition: bottom 0.3s ease, justify-content 0.3s ease;
  z-index: 5;
}
#pots-container .pot-slot { pointer-events: auto; }

/* 테마별 책상/바닥 높이 분기 — 배경 PNG 270×480 기준, 책상 윗면 위치 추정 */
/* 화분이 책상 중앙(=책상 두께 영역)에 박힌 듯 보이도록 미세 조정 */
body[data-bg-theme="room"]              #pots-container { bottom: 21%; }  /* 창가 — 책상이 가장 높음 (현재 OK) */
/* 옥탑방 화분 위치 — 위쪽 룰(line 609)에서 7%로 정의 */
body[data-bg-theme="glass_greenhouse"]  #pots-container { bottom: 17%; }  /* 온실 — 책상 안쪽으로 더 내림 (20→17) */

/* 화분 레이아웃 (정렬 옵션 — 환경 편집에서 변경 가능) */
#pots-container[data-layout="left"]   { justify-content: flex-start; padding-left: 24px; }
#pots-container[data-layout="right"]  { justify-content: flex-end;   padding-right: 24px; }
#pots-container[data-layout="spread"] { justify-content: space-between; padding: 0 16px; }

.pot-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex: 0 0 auto;
}
/* 기본·스테로이드 화분만 살짝 위로 (자기개발은 그대로) */
.pot-slot-daily, .pot-slot-steroid { transform: translateY(-3px); }

.pot-wrap {
  position: relative;
  width: 112px;
  height: 160px;            /* 화분 154px + 양파 위쪽 여유 6px (클릭 영역 = 시각적 영역) */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

/* 단계별 양파 위치 (화분 폭 112 기준 비례) */
/* 화분 PNG height 154px 기준 흙 영역 ≈ bottom 110~130px 사이 (화분 위쪽 약 25%) */
.onion-thumb {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  transition: transform 0.15s;
  overflow: hidden;
  image-rendering: pixelated;
}
/* 씨앗·새싹: 흙 영역 중앙에 박힌 형태 — 화분 윗면(흙)에 살짝 묻힘 */
/* 기본 (베이직 화분, daily): 흙 위치 baseline */
/* 씨앗·새싹은 흙에 더 깊이 박힘 / 어른·독립은 화분 흙 위 */
/* 씨앗 15% 축소: 30×36 → 26×30 */
/* 씨앗 흙 라인 84px baseline — 새싹은 sprite 하단 여백 보정으로 80px */
.onion-thumb.stage-seed        { bottom: 84px;  width: 26px; height: 30px; }
.onion-thumb.stage-sprout      { bottom: 80px;  width: 56px; height: 56px; }
.onion-thumb.stage-grown       { bottom: 84px;  width: 56px; height: 56px; }
.onion-thumb.stage-independent { bottom: 84px;  width: 22px; height: 22px; opacity: 0.5; }

/* 카테고리별 흙 위치 미세 차이 — 각 화분 PNG의 개구부 디자인 차이 보정 */
/* baseline은 daily(베이직), steroid·selfdevelop은 +/- 오프셋 */
.pot-slot-steroid .onion-thumb.stage-seed     { bottom: 86px; }
.pot-slot-steroid .onion-thumb.stage-sprout   { bottom: 80px; }  /* 기본 화분 새싹과 동일 위치 */
.pot-slot-steroid .onion-thumb.stage-grown    { bottom: 86px; }
.pot-slot-steroid .onion-thumb.stage-independent { bottom: 86px; }

/* 자기개발 화분 PNG가 4px 아래로 + 6% 축소되었으므로 양파 위치도 같이 보정 */
/* 씨앗은 위로, 새싹은 씨앗보다 덜 위로 */
.pot-slot-selfdevelop .onion-thumb.stage-seed     { bottom: 92px; }
.pot-slot-selfdevelop .onion-thumb.stage-sprout   { bottom: 82px; }
.pot-slot-selfdevelop .onion-thumb.stage-grown    { bottom: 92px; }
.pot-slot-selfdevelop .onion-thumb.stage-independent { bottom: 92px; }

/* 썸네일 새싹 스프라이트 크기 맞춤 */
.onion-thumb.stage-sprout .sprout-sprite {
  --frame-w: 56px;
  --frame-h: 48px;
}

/* 썸네일 양파 이미지 — 컨테이너 꽉 채움 */
.onion-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  image-rendering: pixelated;
}

/* 화분 이미지 — PNG 원본 64×88 → 1.75x 표시 (112×154) */
.pot-img {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 112px;
  height: 154px;
  object-fit: contain;
  image-rendering: pixelated;
  z-index: 0;
}
/* 카테고리별 미세 조정 */
.pot-img-daily      { width: 112px; height: 154px; }
.pot-img-steroid    { width: 112px; height: 154px; }
/* 자기개발 화분 — 6% 축소만 유지. bottom: -4px 제거 (양파와 분리되어 보이는 버그) */
.pot-img-selfdevelop { width: 104px; height: 144px; }

.pot-slot:active .onion-thumb { transform: translateX(-50%) scale(0.88); }
.pot-slot:active .onion-thumb.stage-independent { opacity: 0.5; }

/* 화분 클릭 이펙트 */

.pot-tap-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%) scale(0);
  border: 2px solid rgba(255, 255, 200, 0.8);
  border-radius: 50%;
  pointer-events: none;
  animation: tap-ring 0.4s ease-out forwards;
  z-index: 10;
}

@keyframes tap-ring {
  0%   { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

.stage-label {
  font-size: 0.7rem;
  color: var(--color-text-dim);
  margin-top: 4px;
}

/* ── 감정 선택 버튼 (top-bar 안) ── */
#emotion-btn {
  background: none;
  border: 1px solid #4a4236;
  border-radius: 10px;
  color: #f0e6d6;
  font-size: 0.65rem;
  padding: 3px 9px;
  cursor: pointer;
}

/* ── 감정 바텀시트 ── */
#emotion-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
}

#emotion-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #272318;
  border-top: 1px solid #4a4236;
  border-radius: 20px 20px 0 0;
  padding: 12px 20px 32px;
  z-index: 101;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
}

#emotion-sheet.open { transform: translateY(0); }

#emotion-sheet-handle {
  width: 36px;
  height: 4px;
  background: #4a4236;
  border-radius: 2px;
  margin: 0 auto 16px;
}

#emotion-sheet-title {

  font-size: 0.85rem;
  text-align: center;
  color: var(--color-text);
  margin-bottom: 16px;
}

#emotion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.emotion-pill {
  background: #3a3228;
  border: 1px solid #4a4236;
  border-radius: 20px;
  color: var(--color-text);
  font-size: 0.75rem;
  padding: 8px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.emotion-pill span { font-size: 1.1rem; }

.emotion-pill.selected {
  background: #3a2a5e;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

#emotion-confirm {
  width: 100%;
  padding: 12px;
  background: var(--color-accent);
  color: #2a1e10;
  border: none;
  border-radius: 10px;

  font-size: 0.8rem;
  cursor: pointer;
}

/* 하단 메뉴 */
#bottom-menu {
  display: flex;
  justify-content: space-around;
  padding: 6px 0 18px;  /* 14 → 18: 살짝만 위로 — 너무 들리지 않게 */
  background: rgba(35, 31, 24, var(--ui-opacity));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid rgba(58, 50, 40, var(--ui-opacity));
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
}

#bottom-menu button {
  background: none;
  border: none;
  color: var(--color-text-dim);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 6px 6px 4px;
  flex: 1;
  border-radius: 10px;
  position: relative;
  overflow: visible;
  transition: color 0.15s;
}

#bottom-menu .bm-icon {
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}
#bottom-menu .bm-icon img {
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
  object-fit: contain;
  display: block;
}

#bottom-menu .bm-label {
  font-size: 0.62rem;
  font-weight: 700;
}

/* 빨간 점 뱃지 (새 항목 알림) */
#bottom-menu .bm-dot {
  position: absolute;
  top: 2px; right: 12px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #e53e3e;
  border: 1.5px solid var(--color-panel);
}

#bottom-menu button:active {
  color: var(--color-accent);
}

#bottom-menu button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(201,146,106,0.18) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: 10px;
  pointer-events: none;
}

#bottom-menu button:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* 강화 배지 — 화분 라벨로 살짝 위쪽에 */
.enh-badge {
  font-size: 0.6rem;
  font-weight: bold;
  margin-top: -10px;
  min-height: 1em;
  position: relative;
  z-index: 2;
}

/* v20.1: 1~50강 색상 일관성 — 초록→파랑→보라→빨강→황금→마젠타→무지개 진행 */
.enh-0 { color: var(--color-text-dim); }

/* 1~10강: 초록 (시작, 안전 톤) */
.enh-1, .enh-2, .enh-3, .enh-4, .enh-5      { color: #66ff66; }
.enh-6, .enh-7, .enh-8, .enh-9, .enh-10     { color: #00cc66; }

/* 11~20강: 파랑 */
.enh-11, .enh-12, .enh-13, .enh-14, .enh-15 { color: #33aaff; }
.enh-16, .enh-17, .enh-18, .enh-19, .enh-20 { color: #0066ff; }

/* 21~30강: 보라 (16강+ 하락 시작 영역, 위험 톤) */
.enh-21, .enh-22, .enh-23, .enh-24, .enh-25 { color: #cc66ff; }
.enh-26, .enh-27, .enh-28, .enh-29, .enh-30 { color: #9933ff; }

/* 31~40강: 빨강 (비용 점프, 위험 ↑) */
.enh-31, .enh-32, .enh-33, .enh-34, .enh-35 { color: #ff5533; }
.enh-36, .enh-37, .enh-38, .enh-39, .enh-40 { color: #ff2200; }

/* 41~49강: 황금 → 마젠타 (엔드게임, 보상 +10%/강) */
.enh-41, .enh-42, .enh-43, .enh-44, .enh-45 {
  color: #f0c040;
  text-shadow: 0 0 4px rgba(240, 192, 64, 0.4);
}
.enh-46, .enh-47, .enh-48, .enh-49 {
  color: #ff66cc;
  text-shadow: 0 0 6px rgba(255, 102, 204, 0.5);
}

/* 50강: 풀강 영광 — 무지개 네온 글로우 */
.enh-50 {
  color: #ffd84a;
  animation: enh-glow-50 1.6s ease-in-out infinite alternate;
}
@keyframes enh-glow-50 {
  from {
    text-shadow:
      0 0 6px #ff66cc,
      0 0 12px #f0c040,
      0 0 18px #66ff66;
  }
  to {
    text-shadow:
      0 0 12px #ffaa00,
      0 0 22px #ff66cc,
      0 0 32px #00ddff;
  }
}

/* ── 화분 상세 화면 ── */
#pot-view {
  background: var(--color-bg);
  isolation: isolate;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#pot-header, #onion-display, #interaction-btns, #chat-area, #accelerator-area, #nutrient-area, #stack-display {
  position: relative;
  z-index: 1;
}

#pot-header {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--color-panel);
  border-bottom: 2px solid #3a3228;
  gap: 10px;
}

/* i 정보 버튼 슬롯 — 타이틀 span 안에 인라인. 부모(타이틀 span)가
   pointer-events: none이라 명시적으로 풀어줌 */
#pot-info-btn-slot,
#shop-info-btn-slot,
#gamble-info-btn-slot,
#adventure-info-btn-slot,
#market-info-btn-slot,
#lottery-info-btn-slot,
#guild-info-btn-slot,
#ranking-info-btn-slot {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  pointer-events: auto !important;
  margin-left: 4px;
}

#pot-header button {
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: 1rem;
  cursor: pointer;
}

/* 양파 표시 영역 */
#onion-display {
  flex: 1;
  min-height: 0;       /* flex 자식 축소 허용 — 키보드 활성 시 chat-area 보존 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
/* 키보드 비활성 (input focus 아닐 때)만 최소 150px 보장 — :focus-within으로 토글 */
#pot-view:not(:focus-within) #onion-display {
  min-height: 150px;
}

#onion-display-el {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
}

#onion-display-el img {
  width: 128px;
  height: 128px;
  object-fit: contain;
}

#onion-img {
  width: 128px;
  height: 128px;
  object-fit: contain;
  transition: transform 0.2s;
}

/* ── 새싹 스프라이트 애니메이션 ── */
/* 프레임 3개가 가로로 나란히 있는 스프라이트 시트 (신규 PNG는 정사각 한 프레임) */
/* --frame-w, --frame-h: 한 프레임의 표시 크기 (이미지 비율 안 맞으면 여기서 조정) */
.sprout-sprite {
  --frame-w: 64px;
  --frame-h: 56px;
  width: var(--frame-w);
  height: var(--frame-h);
  background-image: url('images/sprout_basic.png');
  background-repeat: no-repeat;
  background-size: calc(var(--frame-w) * 3) var(--frame-h);
  background-position: 0 0;
  animation: sprout-frames 1.55s steps(3) infinite;
  image-rendering: pixelated;
}

/* 씨앗·어른양파 — 살아있음만 느껴지게, 거슬리지 않는 매우 천천한 미세 움직임 */
/* 스케일 변화 작게 (1 → 1.022) + 사이클 길게 (5.5초) */
@keyframes onion-breath {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.022); }
}
#pots-container .onion-thumb.stage-seed img,
#pots-container .onion-thumb.stage-grown img,
#onion-display-el img {
  animation: onion-breath 5.5s ease-in-out infinite;
  transform-origin: center bottom;
}

/* 화분 상세 화면용 (더 크게) */
.sprout-sprite.large {
  --frame-w: 105px;  /* 110 → 105: -5% (사용자 피드백) */
  --frame-h: 91px;   /* 96 → 91:  -5% */
}

@keyframes sprout-frames {
  to { background-position-x: calc(var(--frame-w) * -3); }
}

#onion-name {
  font-size: 0.9rem;
  color: var(--color-accent);
  text-align: center;
  margin-top: 4px;
  min-height: 1.2em;
}

#chat-bubble {
  position: absolute;
  top: 30px;
  background: rgba(18, 18, 32, 0.85);
  color: rgba(255,255,255,0.9);
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 0.75rem;
  max-width: 70%;
  text-align: center;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-pixel);
}
.bubble-sys-italic { font-style: italic; opacity: 0.75; }
.bubble-sys-bold   { font-weight: 600; opacity: 0.9; }

/* 화분 상세창 무드 오버레이 */
#pot-mood-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  transition: background 1.2s ease;
}

/* 특수 무드 오버레이 */
#pot-mood-overlay.mood-stress-max {
  animation: mood-pulse 2.5s ease-in-out infinite;
}
#pot-mood-overlay.mood-toxic {
  box-shadow: inset 0 0 40px rgba(80, 30, 120, 0.08);
}
#pot-mood-overlay.mood-narcissist {
  box-shadow: inset 0 0 30px rgba(255, 220, 160, 0.08);
}

@keyframes mood-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* ambient 파티클 — 잔잔히 떠오르는 배경 파티클 */
.ambient-particle {
  font-size: 0.85rem;
  opacity: 0;
  animation: ambient-float linear forwards !important;
}

@keyframes ambient-float {
  0%   { opacity: 0;    transform: translateY(0) scale(0.8); }
  15%  { opacity: 0.3; }
  80%  { opacity: 0.25; }
  100% { opacity: 0;    transform: translateY(var(--y-end, -80px)) scale(1.0); }
}

/* 상호작용 버튼 */
#interaction-btns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px 12px;
}

#interaction-btns button {
  background: var(--color-panel);
  border: 1px solid #3a3228;
  color: var(--color-text);

  font-size: 0.7rem;
  padding: 7px 4px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}

#interaction-btns button:active {
  background: #3a3228;
  transform: scale(0.93);
  transition: transform 0.06s ease, background 0.06s;
}
#interaction-btns button:disabled { cursor: default; }

/* 쿨타임 이펙트 — 위에서 아래로 어둠이 걷히며 색이 돌아옴 */
#interaction-btns button.cooldown,
#accelerator-btn.cooldown {
  position: relative;
  overflow: hidden;
}

#interaction-btns button.cooldown::after,
#accelerator-btn.cooldown::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  animation: cd-wipe var(--cd-duration, 3000ms) linear forwards;
  border-radius: inherit;
  pointer-events: none;
}

@keyframes cd-wipe {
  from { clip-path: inset(0% 0% 0% 0%); }
  to   { clip-path: inset(100% 0% 0% 0%); }
}

/* Q&A 질문 버블 */
#qa-question {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 4px;
  padding: 8px 12px;
  background: #28221a;
  border: 1px solid #9a7a50;
  border-radius: 12px;
  font-size: 0.78rem;
  color: #dfc8a0;
  position: relative;
  z-index: 1;
}

#qa-question-text { flex: 1; line-height: 1.5; }

#qa-question button {
  background: none;
  border: none;
  color: #9a7a50;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  padding: 2px 4px;
}

#qa-cooldown-bar {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  padding: 0;
  font-size: 0.7rem;
  border-top: 1px solid #3e3258;
  border-bottom: 1px solid #3e3258;
  position: relative;
  z-index: 1;
  background: #1c1830;
}

/* 절반씩 분할 — 둘 다 활성이면 50:50, 하나만 활성이면 그 쪽이 풀폭 (flex:1) */
.cd-half {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 12px;
}
.cd-half.hidden { display: none; }

/* QA 절반 — 보라톤 */
.cd-half-qa {
  background: linear-gradient(90deg, #2a2440, #322a4c);
  color: #c0b0d8;
}
.cd-half-qa .qa-cooldown-icon { font-size: 0.85rem; color: #b88cf0; }
#qa-cooldown-label { opacity: 0.85; color: #c0b0d8; }
#qa-cooldown-timer {
  font-size: 0.78rem; font-weight: 700; color: #d4baf0;
  font-family: 'DungGeunMo', monospace; letter-spacing: 0.05em;
}

/* 채팅 절반 — 갈색톤 */
.cd-half-chat {
  background: linear-gradient(90deg, #3a2a20, #4a3424);
  color: #d8b890;
}
.cd-half-chat .chat-cooldown-icon { font-size: 0.85rem; color: #f0a060; }
#chat-cooldown-label { opacity: 0.85; color: #d8b890; }
#chat-cooldown-timer {
  font-size: 0.78rem; font-weight: 700; color: #f0c890;
  font-family: 'DungGeunMo', monospace; letter-spacing: 0.05em;
}

/* 둘 다 활성 시 가운데 구분선 */
.cd-half-qa:not(.hidden) + .cd-half-chat:not(.hidden) {
  border-left: 1px solid #3e3258;
}

/* 채팅 영역 */
#chat-area {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 12px 12px;
  border-top: 1px solid #3a3228;
}

.chat-skip-ad {
  width: 100%;
  background: rgba(80, 60, 30, 0.5);
  border: 1px solid rgba(200, 160, 80, 0.3);
  border-radius: 8px;
  color: #d4ae8c;
  font-size: 0.7rem;
  padding: 6px 12px;
  cursor: pointer;
  order: 10;
}
.chat-skip-ad:active { background: rgba(80, 60, 30, 0.8); }

.chat-input-wrap {
  flex: 1;
  position: relative;
}

.chat-input-wrap input {
  width: 100%;
  padding-right: 44px;
  box-sizing: border-box;
}

#chat-char-count {
  position: absolute;
  right: 8px;
  bottom: 7px;
  font-size: 0.6rem;
  color: var(--color-text-dim);
  pointer-events: none;
}

#chat-input {
  flex: 1;
  background: var(--color-panel);
  border: 1px solid #3a3228;
  border-radius: 8px;
  color: var(--color-text);

  font-size: 0.8rem;
  padding: 8px 12px;
  outline: none;
}

#chat-input::placeholder { color: var(--color-text-dim); }

#chat-send {
  background: var(--color-accent);
  border: none;
  border-radius: 8px;
  color: #2a1e10;

  font-size: 0.8rem;
  padding: 8px 14px;
  cursor: pointer;
}

/* ── 설정 패널 (오버레이) ── */
#settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 299;
}

#settings-backdrop.hidden { display: none !important; }

#settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, calc(100vw - 24px));
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #1c1814;
  border: 1px solid #4a4236;
  border-radius: 16px;
  padding: 18px 18px 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* 설정 패널 스크롤바 — 어두운 톤에 맞게 */
#settings-panel::-webkit-scrollbar { width: 6px; }
#settings-panel::-webkit-scrollbar-track { background: #1c1814; }
#settings-panel::-webkit-scrollbar-thumb { background: #4a4236; border-radius: 3px; }
#settings-panel::-webkit-scrollbar-thumb:hover { background: #6a6050; }

.settings-title {
  font-size: 0.9rem;
  color: var(--color-accent);
  text-align: center;
  padding-bottom: 4px;
  border-bottom: 1px solid #3a3228;
}

.settings-close-btn {
  background: #3a3228;
  border: none;
  border-radius: 8px;
  color: var(--color-text);

  font-size: 0.75rem;
  padding: 8px;
  cursor: pointer;
  margin-top: 4px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.settings-row input[type="range"] {
  width: 120px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #3a3228;
  border-radius: 2px;
  outline: none;
}
.settings-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
}

.settings-row button {
  background: #3a3228;
  border: 1px solid #4a4236;
  border-radius: 8px;
  color: var(--color-text);

  font-size: 0.72rem;
  padding: 5px 12px;
  cursor: pointer;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-label {
  font-size: 0.8rem;
  color: var(--color-text-dim);
}

#bg-theme-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bg-theme-btn {
  background: #3a3228;
  border: 1px solid #4a4236;
  border-radius: 8px;
  color: var(--color-text);

  font-size: 0.75rem;
  padding: 6px 12px;
  cursor: pointer;
}

.bg-theme-btn.active {
  background: var(--color-accent);
  color: #2a1e10;
  border-color: var(--color-accent);
}

/* ── 성장 촉진제 ── */
#accelerator-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-top: 1px solid #3a3228;
}

#accelerator-btn {
  background: #2a4e3a;
  border: 1px solid #3a7a5a;
  border-radius: 8px;
  color: #7fffb0;

  font-size: 0.75rem;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}

#accelerator-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.accelerator-info {
  font-size: 0.7rem;
  color: var(--color-text-dim);
}

/* ── 영양제 ── */
#nutrient-area {
  padding: 6px 12px;
  border-top: 1px solid #3a3228;
}
.nutrient-label {
  font-size: 0.68rem;
  color: var(--color-text-dim);
  margin-bottom: 4px;
}
.nutrient-btns {
  display: flex;
  gap: 8px;
}
.nutrient-btn {
  flex: 1;
  border-radius: 8px;
  font-size: 0.72rem;
  padding: 8px 10px;
  cursor: pointer;
  border: 1px solid;
}
.nutrient-legend {
  background: #2a2a4e;
  border-color: #5a5aaa;
  color: #a0a0ff;
}
.nutrient-normal {
  background: #2a3e2a;
  border-color: #4a7a4a;
  color: #7eca84;
}
.nutrient-applied {
  font-size: 0.72rem;
  color: #d4ae8c;
  text-align: center;
  padding: 4px 0;
}

/* ── 인벤토리 ── */
#inventory-panel {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  height: 100%;
}

#inventory-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #3a3228;

  font-size: 0.9rem;
}

#inventory-header button {
  background: none;
  border: none;
  color: var(--color-text);

  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
}

#inventory-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.inv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #272318;
  border: 1px solid #3a3228;
  border-radius: 10px;
  padding: 12px 14px;
}

.inv-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.inv-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.inv-name {

  font-size: 0.8rem;
  color: var(--color-text);
}

.inv-desc {
  font-size: 0.68rem;
  color: var(--color-text-dim);
  line-height: 1.4;
}

.inv-count {

  font-size: 1rem;
  color: var(--color-accent);
  flex-shrink: 0;
}

/* ── 도감 ── */
#dex-panel {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  height: 100%;
}

#dex-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: none;

  font-size: 0.9rem;
  flex-shrink: 0;
}

#dex-tabs {
  display: flex;
  border-bottom: 1px solid #3a3228;
  flex-shrink: 0;
}

.dex-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-dim);

  font-size: 0.75rem;
  padding: 9px 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.dex-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

#dex-header button {
  background: none;
  border: none;
  color: var(--color-text);

  font-size: 0.85rem;
  cursor: pointer;
}

#dex-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 24px;
}

.dex-section {
  margin-bottom: 20px;
}

.dex-grade-label {

  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 10px;
}

.grade-normal     { background: #2a3a2a; color: #88cc88; }
.grade-rare       { background: #1a2a4a; color: #88aadd; }
.grade-legendary  { background: #2a1a4a; color: #c8a870; }
.grade-hidden     { background: #3a1a1a; color: #ffaa44; }

.dex-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.dex-card {
  background: #16162a;
  border-radius: 8px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid #3a3228;
}

.dex-card.owned {
  border-color: #5c5040;
}

.dex-card-img {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dex-card-img img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.dex-unknown {
  font-size: 1.8rem;
  color: #3a3a6a;
  line-height: 1;
}

/* 도감 미보유 양파 — 검은 실루엣 처리 */
.dex-silhouette {
  filter: brightness(0) opacity(0.55);
}

.img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 40px;
  font-size: 0.6rem;
  color: #8888aa;
  text-align: center;
  background: rgba(30, 30, 60, 0.3);
  border-radius: 8px;
  padding: 4px;
}

.dex-card-name {
  font-size: 0.55rem;
  color: var(--color-text-dim);
  text-align: center;
  line-height: 1.3;
  word-break: keep-all;
}

.dex-card.owned .dex-card-name {
  color: var(--color-text);
}

/* ── 도감 등록 이펙트 ── */
.dex-entry-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.3s ease;
}

.dex-entry-card {
  background: #1c1814;
  border-radius: 16px;
  padding: 28px 24px 24px;
  width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  animation: dex-card-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes dex-card-pop {
  from { transform: scale(0.6) translateY(40px); opacity: 0; }
  to   { transform: scale(1) translateY(0);      opacity: 1; }
}

.grade-border-normal    { border: 2px solid #88cc88; box-shadow: 0 0 18px rgba(136,204,136,0.35); }
.grade-border-rare      { border: 2px solid #88aadd; box-shadow: 0 0 18px rgba(136,170,255,0.40); }
.grade-border-legendary  { border: 2px solid #c8a870; box-shadow: 0 0 18px rgba(204,136,255,0.45); }
.grade-border-hidden    { border: 2px solid #ffaa44; box-shadow: 0 0 22px rgba(255,170,68,0.55); }

.dex-entry-new {
  position: absolute;
  top: -12px;
  right: 16px;
  background: #ff6666;
  color: #fff;

  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 20px;
  animation: dex-new-pulse 0.6s ease infinite alternate;
}

@keyframes dex-new-pulse {
  from { transform: scale(1);    box-shadow: 0 0 0 0 rgba(255,100,100,0.6); }
  to   { transform: scale(1.08); box-shadow: 0 0 8px 3px rgba(255,100,100,0); }
}

.dex-entry-grade-tag {

  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 20px;
}

.dex-entry-img {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dex-img-shine 1.2s ease 0.3s both;
}

.dex-entry-img img {
  width: 88px;
  height: 88px;
  object-fit: contain;
}

@keyframes dex-img-shine {
  0%   { filter: brightness(3) saturate(0); transform: scale(0.7); }
  40%  { filter: brightness(1.8) saturate(1.5); transform: scale(1.1); }
  100% { filter: brightness(1) saturate(1); transform: scale(1); }
}

.dex-entry-name {

  font-size: 0.9rem;
  color: #e8e8ff;
  text-align: center;
}

.dex-entry-sub {
  font-size: 0.7rem;
  color: var(--color-text-dim);
}

.dex-card-count {
  font-size: 0.5rem;
  color: #7a6a58;
  text-align: center;
  margin-top: -2px;
}

/* ── 수식언 교체 프롬프트 ── */
.dex-update-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.25s ease;
}

.dex-update-card {
  background: #1c1814;
  border: 1px solid #5c5040;
  border-radius: 14px;
  padding: 24px 20px;
  width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.dex-update-title {

  font-size: 0.85rem;
  color: #c8c8ff;
}

.dex-update-body {
  display: flex;
  align-items: center;
  gap: 8px;

  font-size: 0.8rem;
}

.dex-adj.old  { color: #7a6a58; }
.dex-adj.new  { color: #aaddff; }
.dex-adj-arrow { color: #5c5040; }

.dex-update-sub {
  font-size: 0.7rem;
  color: var(--color-text-dim);
}

.dex-update-btns {
  display: flex;
  gap: 10px;
}

.dex-btn-yes, .dex-btn-no {

  font-size: 0.75rem;
  padding: 6px 16px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
}

.dex-btn-yes { background: #4466cc; color: #fff; }
.dex-btn-no  { background: #3a3228; color: #aaa; }

/* ── 독립 시퀀스 메시지 오버레이 ── */
.indep-seq-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 32px;
  opacity: 0;
  animation: indep-seq-fadein 0.4s ease forwards;
}
.indep-seq-overlay.dismissing {
  animation: indep-seq-fadeout 0.3s ease forwards;
}
.indep-seq-msg {

  font-size: 1rem;
  color: #e0d4c0;
  text-align: center;
  line-height: 1.8;
  background: #1c1814;
  border: 1px solid #5c5040;
  border-radius: 12px;
  padding: 24px 20px;
  max-width: 280px;
}
.indep-seq-hint {
  margin-top: 14px;
  font-size: 0.68rem;
  color: #666;
  text-align: center;
}
@keyframes indep-seq-fadein  { from { opacity: 0 } to { opacity: 1 } }
@keyframes indep-seq-fadeout { from { opacity: 1 } to { opacity: 0 } }

/* ── 독립 보상 모달 ── */
.reward-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1210;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: modalFadeIn 0.35s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.reward-modal-card {
  background: linear-gradient(160deg, #1e1a16, #16141a);
  border: 1px solid rgba(247, 215, 122, 0.15);
  border-radius: 18px;
  padding: 32px 28px;
  max-width: 280px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 60px rgba(247,215,122,0.04);
  animation: modalCardPop 0.4s cubic-bezier(.2,.8,.3,1.1);
}
@keyframes modalCardPop {
  0%   { opacity: 0; transform: scale(0.88) translateY(16px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.reward-modal-title {

  font-size: 0.82rem;
  color: #8a8a9a;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}
.reward-modal-amount {

  font-size: 1.8rem;
  color: #f7d77a;
  margin-bottom: 24px;
  text-shadow: 0 0 18px rgba(247,215,122,0.25);
}
.reward-modal-luck {
  color: #7eca84;
  font-size: 0.75rem;
  margin-bottom: 16px;
  letter-spacing: 0.03em;
}
.reward-modal-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reward-btn-ad {
  background: linear-gradient(135deg, #1a3520, #1e3a1f);
  color: #7eca84;
  border: 1px solid rgba(74,142,74,0.4);
  border-radius: 12px;
  padding: 13px;

  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}
.reward-btn-ad:hover { background: linear-gradient(135deg, #1e4025, #234a28); }
.reward-btn-ad:disabled {
  opacity: 0.5;
  cursor: default;
}
.reward-btn-confirm {
  background: rgba(60,50,40,0.6);
  color: #a09282;
  border: 1px solid rgba(80,70,60,0.4);
  border-radius: 12px;
  padding: 12px;

  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}
.reward-btn-confirm:hover { background: rgba(70,60,50,0.7); }

/* ── 도감 신규 등록 모달 ── */
.dex-new-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1220;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: modalFadeIn 0.35s ease;
}
.dex-new-modal-card {
  background: linear-gradient(160deg, #1e1a16, #16141a);
  border: 1px solid rgba(247, 215, 122, 0.25);
  border-radius: 18px;
  padding: 32px 28px;
  max-width: 280px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 40px rgba(247,215,122,0.06);
  animation: modalCardPop 0.4s cubic-bezier(.2,.8,.3,1.1);
}
.dex-new-badge {

  font-size: 0.75rem;
  color: #f7d77a;
  background: rgba(45,42,16,0.6);
  border: 1px solid rgba(247,215,122,0.3);
  border-radius: 8px;
  padding: 5px 16px;
  display: inline-block;
  margin-bottom: 14px;
  letter-spacing: 0.05em;
}
.dex-new-name {

  font-size: 1.05rem;
  color: #f0e8d8;
  margin-bottom: 6px;
}
.dex-new-grade {
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 18px;
}
.dex-new-reward-label {

  font-size: 0.78rem;
  color: #aaa;
  margin-bottom: 4px;
}
.dex-new-reward-amount {

  font-size: 1.7rem;
  color: #f7d77a;
  margin-bottom: 22px;
}

/* ── 범용 모달 오버레이 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: fade-in 0.4s ease;
}
.modal-overlay p {

  font-size: 1rem;
  color: #e0d4c0;
  text-align: center;
  line-height: 1.8;
  background: #1c1814;
  border: 1px solid #5c5040;
  border-radius: 12px;
  padding: 24px 20px;
  max-width: 280px;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── 토스트 ── */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 18, 32, 0.92);
  color: #e0e0f0;
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  z-index: 10000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: toastSlideUp 2s forwards;
}
@keyframes toastSlideUp {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  85%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

/* ── 성장 진화 이펙트 ── */
.evo-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  background: #e8d8c0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* ── 성장 로딩 화면 ── */
.evo-loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5ead6 0%, #e8d8c0 50%, #dcc9a8 100%);
}
.evo-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}
.evo-loading-icon {
  width: 96px;
  height: 96px;
  object-fit: contain;
  image-rendering: pixelated;
  animation: evo-icon-bounce 1.2s ease-in-out infinite;
}
@keyframes evo-icon-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.1); }
}
.evo-loading-title {
  font-family: var(--font-pixel);
  font-size: 1.1rem;
  color: #5a4a3a;
  letter-spacing: 1px;
}
.evo-loading-bar-wrap {
  width: 200px;
  height: 8px;
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
  overflow: hidden;
}
.evo-loading-bar {
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, #b89a6a, #d4b87a, #b89a6a);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: evo-bar-slide 1.5s ease-in-out infinite;
}
@keyframes evo-bar-slide {
  0%   { width: 20%; margin-left: 0; }
  50%  { width: 40%; margin-left: 30%; }
  100% { width: 20%; margin-left: 80%; }
}
.evo-loading-tip {
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  color: #8a7a6a;
  text-align: center;
  max-width: 260px;
  line-height: 1.6;
  transition: opacity 0.4s ease;
}
.evo-loading-tip::before {
  content: '💡 ';
}

.evo-ring {
  position: fixed;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(210, 170, 110, 0.9);
  pointer-events: none;
  z-index: 899;
  transform: translate(-50%, -50%) scale(0);
  animation: evo-ring-expand 0.9s cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
  box-shadow: 0 0 10px 3px rgba(210, 160, 80, 0.35),
              inset 0 0 6px rgba(255, 220, 140, 0.25);
}

@keyframes evo-ring-expand {
  0%   { transform: translate(-50%, -50%) scale(0.1); opacity: 1;   }
  60%  { opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(5.5); opacity: 0;   }
}

.evo-tip {
  position: absolute;
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  color: #8a7a6a;
  text-align: center;
  max-width: 280px;
  width: 85%;
  line-height: 1.6;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.evo-tip::before {
  content: '💡 ';
}

/* 변신 실루엣 — 로딩 중 중앙에 모프 애니메이션 */
.evo-morph-silhouette {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  opacity: 0;
  transition: opacity 0.6s ease-in;
  background: radial-gradient(ellipse, rgba(180,140,100,0.5) 0%, transparent 70%);
  border-radius: 50%;
  animation: evo-morph 2.4s ease-in-out infinite;
}
@keyframes evo-morph {
  0%   { border-radius: 50% 50% 50% 50%; transform: translate(-50%,-50%) scale(0.8); filter: brightness(1.2); }
  15%  { border-radius: 40% 60% 55% 45%; transform: translate(-50%,-50%) scale(0.9) rotate(5deg); }
  30%  { border-radius: 55% 45% 40% 60%; transform: translate(-50%,-50%) scale(1.05) rotate(-3deg); filter: brightness(1.5); }
  50%  { border-radius: 45% 55% 60% 40%; transform: translate(-50%,-50%) scale(1.1) rotate(2deg); filter: brightness(1.8); }
  65%  { border-radius: 60% 40% 45% 55%; transform: translate(-50%,-50%) scale(1.0) rotate(-5deg); filter: brightness(1.4); }
  80%  { border-radius: 50% 50% 55% 45%; transform: translate(-50%,-50%) scale(0.95) rotate(3deg); filter: brightness(1.2); }
  100% { border-radius: 50% 50% 50% 50%; transform: translate(-50%,-50%) scale(0.8); filter: brightness(1.2); }
}

/* ── 애니메이션 ── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes float-up {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(var(--y-end, -80px)) scale(0.6); }
}

@keyframes fade-in-out {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  40%       { transform: translateY(-18px); }
  70%       { transform: translateY(-8px); }
}

@keyframes wobble {
  0%, 100% { transform: rotate(0deg); }
  25%       { transform: rotate(-6deg); }
  75%       { transform: rotate(6deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-8px); }
  75%       { transform: translateX(8px); }
}

@keyframes shrink {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.82); }
  100% { transform: scale(1); }
}

@keyframes sway {
  0%, 100% { transform: rotate(0deg) scale(1); }
  20%  { transform: rotate(-4deg) scale(1.03); }
  40%  { transform: rotate(3deg) scale(1.05); }
  60%  { transform: rotate(-2deg) scale(1.03); }
  80%  { transform: rotate(1deg) scale(1.01); }
}

@keyframes independence-fly {
  0%   { filter: brightness(1); opacity: 1; transform: translateY(0) scale(1); }
  40%  { filter: brightness(1.5) saturate(1.2); opacity: 1; transform: translateY(-10px) scale(1.05); }
  70%  { filter: brightness(2.5); opacity: 0.8; transform: translateY(-40px) scale(0.9); }
  100% { filter: brightness(4); opacity: 0; transform: translateY(-80px) scale(0.6); }
}

.anim-bounce { animation: bounce 0.7s ease; }
.anim-wobble { animation: wobble 0.6s ease; }
.anim-shake  { animation: shake 0.5s ease; }
.anim-shrink { animation: shrink 0.5s ease; }
.anim-sway   { animation: sway 0.6s ease; }
.independence-anim { animation: independence-fly 2s ease forwards; }

@keyframes grow-sprout {
  0%   { transform: scale(0.4) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.anim-grow { animation: grow-sprout 0.8s ease forwards; }

/* ── 환경 편집 패널 ── */
#env-panel {
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
}

#env-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-panel);
  border-bottom: 2px solid #3a3228;
  font-size: 0.9rem;
  flex-shrink: 0;
}

#env-header button {
  background: none;
  border: none;
  color: var(--color-accent);

  font-size: 1rem;
  cursor: pointer;
}

#env-tabs {
  display: flex;
  border-bottom: 1px solid #3a3228;
  flex-shrink: 0;
}

.env-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-dim);

  font-size: 0.72rem;
  padding: 10px 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.env-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

#env-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.env-hint {
  font-size: 0.68rem;
  color: var(--color-text-dim);
  text-align: center;
  padding: 6px 0;
}

.env-empty {
  text-align: center;
  font-size: 0.75rem;
  color: #4a4a7a;
  padding: 40px 20px;
  line-height: 1.8;
}

.env-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1e1b14;
  border: 1px solid #3a3228;
  border-radius: 12px;
  padding: 14px;
  transition: border-color 0.15s;
}

.env-item-card.env-item-equipped {
  border-color: var(--color-accent);
  background: #1e1e3a;
}

.env-item-card.env-item-locked {
  opacity: 0.5;
}

.env-item-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.env-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.env-item-name {
  font-size: 0.82rem;
  color: var(--color-text);
}

.env-item-desc {
  font-size: 0.66rem;
  color: var(--color-text-dim);
}

.env-equip-btn {
  background: #2a3a2e;
  border: 1px solid #3a7a5a;
  border-radius: 8px;
  color: #7fffb0;

  font-size: 0.7rem;
  padding: 6px 10px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.env-unequip-btn {
  background: #3a2a2a;
  border-color: #7a3a3a;
  color: #ffaaaa;
}

.env-badge-on {
  font-size: 0.65rem;
  color: var(--color-accent);
  flex-shrink: 0;
  white-space: nowrap;
}

.env-badge-lock {
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── 화분 위치 드래그 리스트 ── */
.layout-pot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layout-pot-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1e1b14;
  border: 1px solid #3a3228;
  border-radius: 12px;
  padding: 12px;
  cursor: default;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  touch-action: pan-y;
  user-select: none;
}

.layout-pot-card.layout-dragging {
  opacity: 0.55;
  background: #2a2a50;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  border-color: var(--color-accent);
}

.layout-pot-drag-handle {
  font-size: 1.2rem;
  color: var(--color-text-dim);
  cursor: grab;
  padding: 4px 6px;
  flex-shrink: 0;
  line-height: 1;
}

.layout-pot-thumb {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.layout-pot-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.layout-pot-name {
  font-size: 0.78rem;
  color: var(--color-text);
}

.layout-pot-stage {
  font-size: 0.65rem;
  color: var(--color-text-dim);
}

.layout-pot-order {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3a3228;
  color: var(--color-text-dim);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── 환경 편집 화분 선택 버튼 ── */
.env-pot-select-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.env-pot-select-btn {
  flex: 1;
  min-width: 100px;
  background: #272318;
  border: 1px solid #4a4236;
  border-radius: 8px;
  color: var(--color-text-dim);

  font-size: 0.7rem;
  padding: 8px 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.env-pot-select-btn.selected {
  background: #3a3228;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.inv-use-btn {
  background: #2a3a4e;
  border: 1px solid #3a6a8e;
  border-radius: 6px;
  color: #88ccff;

  font-size: 0.65rem;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
}

/* ── 상점 패널 ── */
/* ── 상점 패널 ── */
#shop-panel {
  background: #12100c;
  display: flex;
  flex-direction: column;
}

#shop-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #1a1610;
  border-bottom: 2px solid #2a2418;
  flex-shrink: 0;
}

#shop-header button {
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: 1rem;
  cursor: pointer;
}

#shop-header > span {
  font-size: 0.9rem;
  flex: 1;
  color: #fff;
}

#shop-balance {
  display: flex;
  gap: 8px;
  font-size: 0.78rem;
  color: #fff;
  justify-content: flex-start;
}

#shop-tabs {
  display: flex;
  border-bottom: 1px solid #2a2418;
  flex-shrink: 0;
  background: #1a1610;
}

.shop-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-dim);
  font-size: 0.78rem;
  padding: 10px 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.shop-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

#shop-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-section-label {
  font-size: 0.72rem;
  color: #b0a090;
  padding: 6px 0 4px;
  border-bottom: 1px solid #2a2418;
  margin-bottom: 2px;
}

.shop-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #241f18;
  border: 1px solid #3a3228;
  border-radius: 12px;
  padding: 14px;
}

.shop-item-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}
/* 화분/스킨 미리보기 — 정사각형에 눌려 납작해지지 않게 비율 보존 */
.shop-item-icon img {
  object-fit: contain;
}

.shop-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.shop-item-name {
  font-size: 0.82rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shop-item-desc {
  font-size: 0.68rem;
  color: var(--color-text-dim);
  line-height: 1.4;
}

.shop-item-rate {
  font-size: 0.62rem;
  color: #7a6a58;
}

.shop-buy-btn {
  background: var(--color-accent);
  border: none;
  border-radius: 8px;
  color: #1a1208;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.shop-buy-btn:disabled {
  background: #2a2520;
  color: #5a5044;
  cursor: default;
}

.shop-buy-btn.shop-ad-btn {
  background: #5a8a5a;
  color: #fff;
}
.shop-buy-btn.shop-ad-btn:disabled {
  background: #2a3a2a;
  color: #4a5a4a;
}

.shop-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3a3228;
  color: #b0a090;
  font-size: 0.6rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
  line-height: 1;
}

.shop-diamond-notice {
  text-align: center;
  font-size: 0.72rem;
  color: #88ccff;
  line-height: 1.8;
  padding: 12px;
  background: #0e1520;
  border: 1px solid #1a2a40;
  border-radius: 10px;
  margin-top: 4px;
}
.shop-diamond-info {
  font-size: 0.72rem; color: #88ccff; text-align: center;
  padding: 4px 0 8px;
}
.shop-item-owned { opacity: 0.5; }

.shop-coming-soon {
  text-align: center;
  font-size: 0.72rem;
  color: #4a4a7a;
  padding: 20px;
}

/* ── 박스 오픈 오버레이 ── */
#box-open-overlay {
  position: fixed; inset: 0;
  background: rgba(6, 4, 14, 0.92);
  z-index: 9100;
  display: flex; align-items: center; justify-content: center;
  animation: box-overlay-in 0.4s ease both;
}
@keyframes box-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#box-open-overlay.hidden { display: none !important; }

/* ── 상자 (1단계) — icon_random_box.png 사용 ── */
#box-chest {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#box-chest.hidden { display: none; }
.box-chest-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}
.box-chest-glow {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 6px;
  opacity: 0;
  background: radial-gradient(ellipse, rgba(230,200,100,0.6), transparent);
  border-radius: 50%;
  pointer-events: none;
}

/* 흔들림 */
#box-chest.box-shaking {
  animation: box-appear 0.4s ease both, box-wobble 0.4s ease-in-out 0.5s 2;
}
#box-chest.box-shaking-rare {
  animation: box-appear 0.4s ease both, box-wobble-rare 0.35s ease-in-out 0.4s 3;
}
#box-chest.box-shaking-rare .box-chest-glow {
  animation: box-glow-hint 0.35s ease-in-out 0.4s 3;
}
@keyframes box-appear {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes box-wobble {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-4deg); }
  75%      { transform: rotate(4deg); }
}
@keyframes box-wobble-rare {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25%      { transform: rotate(-6deg) scale(1.04); }
  75%      { transform: rotate(6deg) scale(1.04); }
}
@keyframes box-glow-hint {
  0%, 100% { opacity: 0; }
  50%      { opacity: 1; }
}

/* 열림 */
#box-chest.box-opening .box-chest-lid {
  animation: lid-open 0.5s ease-in-out both;
}
#box-chest.box-opening .box-chest-glow {
  animation: box-glow-burst 0.6s ease both;
}
#box-chest.box-opening {
  animation: box-fade-up 0.6s ease 0.3s both;
}
@keyframes lid-open {
  0%   { transform: rotateX(0deg); }
  100% { transform: rotateX(-110deg) translateY(-8px); }
}
@keyframes box-glow-burst {
  0%   { opacity: 0; width: 80px; height: 4px; }
  50%  { opacity: 1; width: 120px; height: 20px; }
  100% { opacity: 0; width: 160px; height: 40px; }
}
@keyframes box-fade-up {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-20px) scale(0.8); }
}

/* ── 결과 카드 (2단계) ── */
#box-open-card {
  background: linear-gradient(170deg, #1e1a28, #161222);
  border: 1.5px solid #2e2848;
  border-radius: 16px;
  padding: 28px 24px 22px;
  width: 260px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: box-card-in 0.5s cubic-bezier(.2,.8,.3,1.1) both;
}
#box-open-card.hidden { display: none; }
@keyframes box-card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
#box-open-card.box-card-rare {
  border-color: rgba(230,160,32,0.5);
  box-shadow: 0 0 24px rgba(230,160,32,0.12), inset 0 0 30px rgba(230,160,32,0.04);
}

#box-open-tier {
  font-size: 0.58rem; letter-spacing: 3px; text-transform: uppercase;
  color: #5a4a78; padding: 2px 12px;
  border: 1px solid #2e2848; border-radius: 10px;
}
#box-open-tier.tier-rare {
  color: #e6a020; border-color: rgba(230,160,32,0.3);
}

#box-open-icon-wrap {
  width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle, #1e1a30, #14101e);
  border: 1.5px solid #2e2848;
}
#box-open-card.box-card-rare #box-open-icon-wrap {
  border-color: rgba(230,160,32,0.3);
  background: radial-gradient(circle, #221a18, #18120e);
}
#box-open-icon {
  font-size: 1.8rem;
  animation: box-icon-in 0.4s cubic-bezier(.2,.8,.3,1.2) 0.1s both;
}
@keyframes box-icon-in {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

#box-open-name {
  font-size: 0.95rem; color: #e8d8c8;
  text-align: center; font-weight: bold;
  animation: box-name-in 0.4s ease 0.15s both;
}
@keyframes box-name-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

#box-open-sub {
  font-size: 0.65rem; color: #6a5a80;
  text-align: center; line-height: 1.5;
}

#box-open-close {
  margin-top: 6px;
  background: #1e1a30; border: 1px solid #2e2848;
  border-radius: 10px;
  color: #a090c0; font-family: var(--font-pixel);
  font-size: 0.72rem; padding: 8px 28px;
  cursor: pointer; transition: all 0.15s;
}
#box-open-close:active { background: #2a2440; color: #d0c0e0; }
#box-open-close.hidden { display: none; }

/* ── 도박 패널 ── */
#gamble-panel {
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
}

#gamble-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-panel);
  border-bottom: 2px solid #3a3228;
  font-size: 0.9rem;
  flex-shrink: 0;
}

#gamble-header button {
  background: none;
  border: none;
  color: var(--color-accent);

  font-size: 1rem;
  cursor: pointer;
}

#gamble-content {
  flex: 1;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.gamble-info {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  text-align: center;
}

.gamble-balance {
  text-align: center;
  font-size: 1rem;
  color: var(--color-accent);
}

.gamble-onion-art {
  text-align: center;
  animation: gamble-pulse 2s ease-in-out infinite alternate;
}
.gamble-onion-art img {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  object-fit: contain;
}

@keyframes gamble-pulse {
  from { transform: scale(1); filter: brightness(1); }
  to   { transform: scale(1.08); filter: brightness(1.2); }
}

.gamble-pick-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.gamble-pick-btn {
  flex: 1;
  max-width: 120px;
  padding: 20px 10px;
  background: #272318;
  border: 2px solid #4a4236;
  border-radius: 12px;
  color: var(--color-text);

  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.gamble-pick-btn.selected {
  background: #3a3228;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.gamble-stake-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.gamble-stake-btn {
  padding: 8px 16px;
  background: #272318;
  border: 1px solid #4a4236;
  border-radius: 8px;
  color: var(--color-text);

  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}

.gamble-stake-btn.selected {
  background: #2a3a2e;
  border-color: #4a8a5a;
  color: #88ddaa;
}

.gamble-confirm-btn {
  width: 100%;
  padding: 14px;
  background: #c0a050;
  border: none;
  border-radius: 10px;
  color: #2a1e10;

  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.gamble-confirm-btn:disabled {
  background: #3a3a5e;
  color: #6a6a8e;
  cursor: default;
}

.gamble-result {
  text-align: center;

  font-size: 1.1rem;
  padding: 16px;
  border-radius: 12px;
  animation: fade-in 0.4s ease;
}

.gamble-result.win  { background: #1a3a2a; color: #88ff88; border: 1px solid #4a8a5a; }
.gamble-result.lose { background: #3a1a1a; color: #ff8888; border: 1px solid #8a4a4a; }

/* ── 강화 패널 ── */
#enhancement-panel {
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
}

#enhancement-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-panel);
  border-bottom: 2px solid #3a3228;
  font-size: 0.9rem;
  flex-shrink: 0;
}

#enhancement-header button {
  background: none;
  border: none;
  color: var(--color-accent);

  font-size: 1rem;
  cursor: pointer;
}

#enhancement-content {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.enh-balance {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-accent);
}

.enh-pot-card {
  background: #1e1b14;
  border: 1px solid #3a3228;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.enh-pot-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.enh-pot-img {
  width: 56px;
  height: 40px;
  object-fit: contain;
}

.enh-pot-info {
  flex: 1;
}

.enh-pot-name {
  font-size: 0.82rem;
  color: var(--color-text);
  margin-bottom: 4px;
}

.enh-pot-level {
  font-size: 1.1rem;
  font-weight: bold;
}

.enh-pot-stats {
  font-size: 0.7rem;
  color: var(--color-text-dim);
  line-height: 1.8;
}

.enh-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;

  font-size: 0.8rem;
  cursor: pointer;
  background: #2a4e3a;
  color: #7fffb0;
  border: 1px solid #3a7a5a;
  transition: background 0.15s;
}

.enh-btn:disabled {
  background: #2a2a3e;
  color: #6a5a4c;
  border-color: #3a3a5e;
  cursor: default;
}

.enh-maxed {
  text-align: center;
  font-size: 0.8rem;
  color: #ffaa44;
  padding: 8px;
}

/* ── 우편함 패널 ── */
#mailbox-panel {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}
#mailbox-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #3a3228;
}
#mailbox-header button {
  background: none;
  border: none;
  color: var(--color-text-dim);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
}
#mailbox-header span {
  flex: 1;
  text-align: center;
  font-size: 0.88rem;
  color: var(--color-text);
  font-weight: 600;
}
#mailbox-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.mail-card {
  background: #272318;
  border: 1px solid #4a4236;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.mail-card.mail-claimed {
  opacity: 0.55;
}
.mail-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.mail-title {
  font-size: 0.88rem;
  color: var(--color-text);
  font-weight: 600;
  flex: 1;
}
.mail-date {
  font-size: 0.68rem;
  color: var(--color-text-dim);
  white-space: nowrap;
  margin-left: 10px;
}
.mail-body {
  font-size: 0.78rem;
  color: #c8b890;
  line-height: 1.7;
  margin-bottom: 12px;
}
.mail-reward-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(247, 215, 122, 0.06);
  border: 1px solid rgba(247, 215, 122, 0.15);
  border-radius: 8px;
}
.mail-reward-label {
  font-size: 0.72rem;
  color: var(--color-text-dim);
}
.mail-reward-items {
  font-size: 0.78rem;
  color: #f7d77a;
  font-weight: 600;
}
.mail-claim-btn {
  display: block;
  width: 100%;
  background: #2d4a2e;
  border: 1px solid #4a8e4a;
  border-radius: 10px;
  padding: 12px;
  font-size: 0.85rem;
  color: #7eca84;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.mail-claim-btn:active {
  background: #3a5e3a;
}
.mail-claimed-label {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-dim);
  padding: 8px 0;
}
.mail-expired-label {
  text-align: center;
  font-size: 0.75rem;
  color: #c87070;
  padding: 8px 0;
}
.mail-empty {
  text-align: center;
  padding: 48px 16px;
  font-size: 0.82rem;
  color: var(--color-text-dim);
}

/* ── 모험 패널 ── */
#adventure-panel {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  overflow: hidden;
}
#adventure-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #3a3228;
}
#adventure-header button {
  background: none;
  border: none;
  color: var(--color-text-dim);

  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
}
#adventure-header span {
  flex: 1;

  font-size: 1rem;
}
#adventure-daily-count {
  font-size: 0.75rem;

  flex-shrink: 0;
}
#adventure-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* 양파 선택 카드 */
.adv-section-title {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  margin-bottom: 14px;
  text-align: center;
}
.adv-onion-card {
  background: #272318;
  border: 1px solid #4a4236;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.adv-onion-card:active { background: #302a20; }
.adv-onion-name {

  font-size: 0.95rem;
  color: var(--color-text);
  margin-bottom: 5px;
}
.adv-onion-grade {
  font-size: 0.72rem;

  display: inline-block;
  border-radius: 6px;
  padding: 2px 10px;
  margin-bottom: 8px;
}
.adv-grade-normal     { background: #3a3228; color: #aaa; border: 1px solid #4a4a7e; }
.adv-grade-rare       { background: #1e3040; color: #6ab0e0; border: 1px solid #3a6080; }
.adv-grade-legendary  { background: #2a2040; color: #c07ee0; border: 1px solid #6a4a90; }
.adv-grade-hidden     { background: #2d2a10; color: #f7d77a; border: 1px solid #a08030; }
.adv-onion-stat {
  font-size: 0.68rem;
  color: var(--color-text-dim);
}

/* 이세계 인트로 */
.adv-isekai-intro {
  text-align: center;
  padding: 24px 8px;
}
.adv-isekai-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  animation: adv-pulse 1s ease infinite alternate;
}
@keyframes adv-pulse { from { opacity: 0.6 } to { opacity: 1 } }
.adv-isekai-text {

  font-size: 0.9rem;
  color: #e8d8a0;
  line-height: 1.8;
  margin-bottom: 28px;
}

/* 스테이지 */
.adv-stage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.adv-stage-num {
  font-size: 0.75rem;
  color: var(--color-text-dim);

}
.adv-isekai-badge {
  font-size: 0.68rem;
  background: #2d2a10;
  color: #f7d77a;
  border: 1px solid #a08030;
  border-radius: 6px;
  padding: 2px 8px;

}
/* 이벤트 화면 — 전체 높이 사용: HUD + 카드(중앙 확장) + 선택지(하단) */
.adv-event-screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
.adv-event-card {
  background: #272318;
  border: 1px solid #4a4236;
  border-radius: 12px;
  padding: 18px 16px;
  margin-bottom: 16px;
}
/* 카드는 상단에 작게, 선택지는 하단에 — 사이는 빈 배경 공간 */
.adv-event-screen .adv-event-card {
  flex: none;
  padding: 14px 14px;
  margin-bottom: 0;
}
.adv-event-screen .adv-choices { margin-top: auto; }
.adv-event-title {
  font-size: 0.9rem;
  color: var(--color-accent);
  margin-bottom: 10px;
  font-weight: 700;
}
.adv-event-screen .adv-event-title { margin-bottom: 6px; text-align: center; font-size: 0.86rem; }
.adv-event-desc {
  font-size: 0.82rem;
  color: #e0d4c0;
  line-height: 1.7;
}
.adv-event-screen .adv-event-desc { text-align: center; font-size: 0.78rem; }
.adv-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.adv-choice-btn {
  background: #302a20;
  border: 1px solid #5c5040;
  border-radius: 10px;
  padding: 15px 16px;
  font-size: 0.88rem;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.adv-choice-btn:active {
  background: #3a3228;
  border-color: #9a8a70;
}

/* 결과 */
.adv-result-card {
  text-align: center;
  padding: 28px 8px;
}
.adv-result-title {

  font-size: 0.85rem;
  color: var(--color-text-dim);
  margin: 10px 0 4px;
}
.adv-result-name {

  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 16px;
}
.adv-result-earned {

  font-size: 2rem;
  color: #f7d77a;
  margin-bottom: 28px;
}
.adv-btn-primary {
  background: #2d4a2e;
  border: 1px solid #4a8e4a;
  border-radius: 12px;
  padding: 14px 32px;

  font-size: 0.88rem;
  color: #7eca84;
  cursor: pointer;
}
.adv-btn-primary:active { background: #3a5e3a; }
.adv-empty {
  text-align: center;
  padding: 40px 16px;
  font-size: 0.82rem;
  color: var(--color-text-dim);
  line-height: 2;
}

.adv-result-diamond {

  font-size: 1.2rem;
  color: #a0d8ff;
  margin-bottom: 8px;
}

/* ── 모험 HUD (v22 개편) ── */
.adv-hud {
  background: linear-gradient(180deg, #221d16, #1a1610);
  border-bottom: 1px solid #3a3228;
  padding: 11px 16px 12px;
  margin: -16px -16px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.adv-hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.adv-hud-floor {
  font-size: 1.05rem;
  color: #f0e2c4;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.adv-hud-floor-total { font-size: 0.72rem; color: #8a7c64; font-weight: 600; }
.adv-hud-hearts { display: flex; gap: 3px; }
/* 층 진행 바 */
.adv-hud-bar {
  display: flex;
  gap: 3px;
}
.adv-hud-seg {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: #342c20;
}
.adv-hud-seg.done { background: #6a5a3a; }
.adv-hud-seg.cur  { background: #f7d77a; box-shadow: 0 0 5px rgba(247,215,122,0.6); }
.adv-hud-row2 { min-height: 18px; }
.adv-hud-badges { display: flex; gap: 5px; }
.adv-hud-earned {
  font-size: 0.74rem;
  color: var(--color-text-dim);
  white-space: nowrap;
}
.adv-hud-earned span {
  color: #f7d77a;
  font-weight: 700;
  font-size: 0.86rem;
}

/* ── 모험 트랜지션 ── */
.adv-transition {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  text-align: center;
  min-height: 200px;
}
.adv-transition-onion {
  width: 80px;
  height: 80px;
  object-fit: contain;
  image-rendering: pixelated;
  animation: adv-walk 0.4s ease infinite;
}
@keyframes adv-walk {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-6px) rotate(-3deg); }
  75% { transform: translateY(-6px) rotate(3deg); }
}
.adv-transition-text {
  font-size: 0.82rem;
  color: #c8b890;
  margin-top: 20px;
  line-height: 1.6;
  opacity: 0;
  animation: adv-fade-in 0.5s ease 0.3s forwards;
}
@keyframes adv-fade-in {
  to { opacity: 1; }
}

/* ── 모험 선택지 강조 ── */
.adv-choice-high {
  border-color: #6a8a6a;
  background: #28301e;
}
.adv-choice-high:active {
  background: #354428;
  border-color: #8aaa7a;
}
.adv-choice-hidden {
  border-color: #a08030;
  background: #2d2a10;
  color: #f7d77a;
  position: relative;
  box-shadow: 0 0 12px rgba(247, 215, 122, 0.15), inset 0 0 8px rgba(247, 215, 122, 0.05);
}
.adv-choice-hidden:active {
  background: #3a3418;
  border-color: #c8a040;
  box-shadow: 0 0 18px rgba(247, 215, 122, 0.25);
}

/* ── 보스 뱃지 ── */
.adv-boss-badge {
  text-align: center;
  font-size: 0.78rem;
  color: #e06060;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding: 6px 0;
  background: rgba(224, 96, 96, 0.08);
  border: 1px solid rgba(224, 96, 96, 0.2);
  border-radius: 8px;
  animation: adv-boss-pulse 1.5s ease infinite alternate;
}
@keyframes adv-boss-pulse {
  from { opacity: 0.7; border-color: rgba(224, 96, 96, 0.15); }
  to { opacity: 1; border-color: rgba(224, 96, 96, 0.4); }
}

/* ── 오아시스 ── */
.adv-oasis {
  text-align: center;
  padding: 32px 12px;
}
.adv-oasis-icon {
  font-size: 2.8rem;
  margin-bottom: 16px;
  animation: adv-pulse 1.5s ease infinite alternate;
}
.adv-oasis-title {
  font-size: 0.92rem;
  color: #7ecaa0;
  font-weight: 600;
  margin-bottom: 10px;
}
.adv-oasis-desc {
  font-size: 0.78rem;
  color: var(--color-text-dim);
  line-height: 1.7;
  margin-bottom: 24px;
}

/* ── 보너스 층 ── */
.adv-bonus {
  text-align: center;
  padding: 32px 12px;
}
.adv-bonus-icon {
  font-size: 2.8rem;
  margin-bottom: 16px;
  animation: adv-pulse 1s ease infinite alternate;
}
.adv-bonus-title {
  font-size: 0.95rem;
  color: #f7d77a;
  font-weight: 700;
  margin-bottom: 10px;
}
.adv-bonus-desc {
  font-size: 0.82rem;
  color: #e0d4c0;
  line-height: 1.7;
  margin-bottom: 20px;
}

/* ── 게임오버 ── */
.adv-gameover {
  text-align: center;
  padding: 32px 12px;
}
.adv-gameover-icon {
  font-size: 2.8rem;
  margin-bottom: 16px;
  opacity: 0.8;
}
.adv-gameover-title {
  font-size: 1rem;
  color: #e06060;
  font-weight: 700;
  margin-bottom: 10px;
}
.adv-gameover-desc {
  font-size: 0.78rem;
  color: var(--color-text-dim);
  line-height: 1.8;
  margin-bottom: 20px;
}

/* ── 모험 결과 로그 ── */
.adv-result-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #2a2418;
  font-size: 0.76rem;
}
.adv-result-stage:last-child {
  border-bottom: none;
}
.adv-result-log {
  flex: 1;
  color: var(--color-text-dim);
}
.adv-log-success {
  color: #7eca84;
}
.adv-log-fail {
  color: #c87070;
}
.adv-log-hidden {
  color: #f7d77a;
}
.adv-result-reward {
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── 튜토리얼 패널 ── */
#tutorial-panel {
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}
#tutorial-content {
  width: 100%;
  max-width: 360px;
  padding: 0 24px;
}
.tut-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 32px 0 32px;
  justify-content: center;
  flex: 1;
}
.tut-center {
  align-items: center;
  text-align: center;
}
.tut-step-label {
  font-size: 0.72rem;
  color: var(--color-text-dim);
  margin-bottom: 32px;
  text-align: center;
}
.tut-seed-img,
.tut-interact-icon,
.tut-question-icon,
.tut-grown-icon {
  font-size: 3.5rem;
  margin-bottom: 20px;
  text-align: center;
}
.tut-generate-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  animation: adv-pulse 1s ease infinite alternate;
}
.tut-title {

  font-size: 1.1rem;
  color: var(--color-text);
  margin-bottom: 14px;
  text-align: center;
}
.tut-desc {
  font-size: 0.82rem;
  color: var(--color-text-dim);
  line-height: 1.9;
  text-align: center;
  margin-bottom: 32px;
}
.tut-btn {
  background: #2d4a2e;
  border: 1px solid #4a8e4a;
  border-radius: 12px;
  padding: 15px;

  font-size: 0.88rem;
  color: #7eca84;
  cursor: pointer;
  width: 100%;
  margin-top: auto;
}
.tut-btn:active { background: #3a5e3a; }
.tut-btn-start {
  background: #2d3a6e;
  border-color: #4a6aae;
  color: #a0b8f0;
}
.tut-btn-start:active { background: #3a4a8e; }
.tut-water-btn {
  background: #1e2e4e;
  border-color: #3a6aae;
  color: #7ab0f0;
}

/* 프로그레스 바 */
.tut-progress-wrap {
  width: 100%;
  height: 6px;
  background: #3a3228;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 24px;
}
.tut-progress-bar {
  height: 100%;
  width: 0%;
  background: #4a8e4a;
  border-radius: 3px;
  transition: width 0.1s linear;
}

/* 옵션 버튼 */
.tut-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}
.tut-option-btn {
  background: #272318;
  border: 1px solid #4a4236;
  border-radius: 10px;
  padding: 14px;

  font-size: 0.85rem;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
}
.tut-option-btn:active {
  background: #3a3228;
  border-color: #9a8a70;
}

/* 결과 */
.tut-result-badge {

  font-size: 0.75rem;
  color: #f7d77a;
  background: #2d2a10;
  border: 1px solid #f7d77a;
  border-radius: 8px;
  padding: 4px 14px;
  display: inline-block;
  margin-bottom: 20px;
}
.tut-result-name {

  font-size: 1.1rem;
  color: #f7d77a;
  line-height: 1.6;
  text-align: center;
}

/* ── 레벨업 모달 ── */
.levelup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: fade-in 0.3s ease;
}
.levelup-card {
  background: #1c1814;
  border: 2px solid var(--color-accent);
  border-radius: 18px;
  padding: 32px 28px;
  max-width: 280px;
  width: 100%;
  text-align: center;
}
.levelup-badge {

  font-size: 0.72rem;
  color: var(--color-accent);
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}
.levelup-level {

  font-size: 2.6rem;
  color: var(--color-accent);
  margin-bottom: 10px;
}
.levelup-reward {

  font-size: 1.1rem;
  color: #f7d77a;
  margin-bottom: 14px;
}
.levelup-unlock {
  font-size: 0.82rem;
  color: #7eca84;
  background: #1e3a20;
  border: 1px solid #4a8e4a;
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 20px;
}
.levelup-confirm {
  background: #2d4a2e;
  border: 1px solid #4a8e4a;
  border-radius: 12px;
  padding: 12px 36px;

  font-size: 0.85rem;
  color: #7eca84;
  cursor: pointer;
}
.levelup-confirm:active { background: #3a5e3a; }

/* ── 용도별 폰트 적용 ── */

/* 타이틀/로고/패널 제목: 카페24 써라운드 */
.loading-logo,
.dex-entry-name,
.dex-grade-label,
.indep-card-title,
.levelup-title {
  font-family: var(--font-title);
}

/* 폰트: 전체 DungGeunMo 통일 — 별도 오버라이드 불필요 */
