:root {
  /* 카드 비율(가로:세로) — 화면 방향과 무관하게 항상 고정 */
  --ratio: 5 / 7;
  --gap: 0.6vw;
  --card-w: min(9.2vw, 64px); /* 하단 더미 크기 기준 */
  --radius: clamp(4px, 1.3vw, 8px);
  --felt: #9a7be0;        /* 귀여운 보라(밝은 쪽) */
  --felt-dark: #4a3a7a;   /* 귀여운 보라(어두운 쪽) */
  --red: #d11e1e;
  --black: #1a1a1a;
  /* 실측 배너 높이의 기본 추정값(실기기 측정 64px) — ads.js가 광고 로드 뒤 실제 높이로 갱신하지만,
     시작값을 0이 아니라 이미 근접한 값으로 잡아둬서 "광고 뜨는 순간 버튼이 위로 홱 이동"하는
     현상을 없앰(사용자 지적: 홈 하단 메뉴 위치가 광고 유무와 무관하게 항상 같아야 함) */
  --banner-h: 64px;
}

/* ============ 확정 폰트 3종 (2026-07-03, 기존 백업 = assets/fonts-backup) ============
   [2026-07-03] 전체 폰트 = Jua로 통일(사용자 지시 "모든 폰트 적용") — 메뉴·보드·카드 랭크·HUD 전부.
   아래 픽셀 폰트 @font-face(PixelFont/PixelTown/RankFont)는 선언만 남김(미사용 = 다운로드 안 됨, 복귀용). */
/* Jua = 구글 폰트 CDN 대신 로컬 파일(www/jua.woff2, 원본 보관 reports-hub/fonts/Jua.woff2) —
   네트워크 요청 자체를 없애 첫 페인트가 폰트 다운로드를 기다리지 않게 함(오프라인에서도 동작). */
@font-face {
  font-family: 'Jua';
  src: url('jua.woff2?v=1') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'PixelFont';
  src: url('silkscreen.woff2?v=1') format('woff2');
  font-display: swap;
  unicode-range: U+0020-007E;           /* 라틴 전체(기본) */
}
@font-face {
  font-family: 'PixelFont';
  src: url('micro5.woff2?v=1') format('woff2');
  font-display: swap;
  unicode-range: U+0030-0039;           /* 숫자만 Micro 5로 덮어씀 */
}
@font-face {
  font-family: 'PixelTown';
  src: url('pixeltown14.woff2?v=9') format('woff2');
  font-display: swap;
}
/* 카드 랭크·모든 숫자 = Micro 5 (구 Roboto Black 대체) */
@font-face {
  font-family: 'RankFont';
  src: url('micro5.woff2?v=1') format('woff2');
  font-display: swap;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--felt-dark);
  font-family: 'Jua', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

body {
  display: flex;
  flex-direction: column;
  /* 노을→하늘 그라데이션(위는 어둡게 → 상단 메뉴 글씨 대비 유지). 픽셀 궁전 풍경은 JS가 아래에 깔음 */
  background: linear-gradient(180deg, #2e2550 0%, #4a3a82 20%, #7e9ad8 56%, #cfe0d0 80%, #aedd8a 100%);
  image-rendering: pixelated;
  /* 안전영역 대응 — 하단도 inset 확보(Android 15 edge-to-edge: 내비바 뒤로 안 깔리게). 비-edge-to-edge/에뮬은 0이라 무변화 */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- 상단바 ---------- */
#topbar, #bottombar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}
#topbar {
  justify-content: space-between;
  /* 실시간 변하는 하늘 위에서도 글씨가 보이게 옅은 패널 */
  background: linear-gradient(180deg, rgba(38,26,58,0.55), rgba(38,26,58,0));
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
/* 점수(좌) · 시각(중앙) · 이동(우) 을 가로로 고르게 펼침 */
#topbar .stats { flex: 1 1 auto; justify-content: space-between; }

/* 메뉴 아래 줄: 완성 세트(좌) + 스톡 더미(우) */
#stockbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: calc(var(--real-card-w, 44px) * 7 / 5 + 4px);
  padding: 2px 10px 0;
  gap: 8px;
}

/* 파운데이션: 완성한 세트 8칸 (게임판 카드와 같은 크기, 겹치지 않게 나란히 → 춤 모션 다 보이게) */
.foundations { display: flex; align-items: center; flex-wrap: nowrap; gap: 1px; }
.found-slot {
  position: relative;
  flex: 0 0 auto;
  width: var(--real-card-w, 44px);
  aspect-ratio: var(--ratio);
  border-radius: var(--radius);
  border: 1px dashed rgba(255,255,255,0.22);
}
.found-slot.filled {
  /* 순백 배경이면 흰색 계열 캐릭터(눈·털 등)가 안 보인다는 지적 — 중앙은 밝고 가장자리는 은은한 보라로
     가라앉는 그라데이션으로 교체(캐릭터에 테두리/베벨은 절대 안 씀 — 배경 쪽에서 대비만 확보) */
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #eee7f7 55%, #d8cdec 100%);
  border: 1px solid rgba(0,0,0,0.35);
  box-shadow: -1px 1px 3px rgba(0,0,0,0.45);
  overflow: hidden;
}
.found-king {
  position: absolute;
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  object-fit: contain;
  image-rendering: pixelated;
  transform-origin: 50% 92%;
}
.found-suit {
  position: absolute;
  top: 1px; left: 2px;
  font-size: clamp(8px, 2.6vw, 11px);
  font-weight: 800;
  line-height: 1;
}
.found-suit.red { color: var(--red); }
.found-suit.black { color: var(--black); }
/* K 댄스 — 여러 종류(서로 다른 동작 + 다른 길이), 출 때마다 무작위로 골라 재생 */
.found-king.d-sway   { animation: dSway 1.1s ease-in-out; }
.found-king.d-jump   { animation: dJump 0.9s ease-out; }
.found-king.d-spin   { animation: dSpin 1.0s ease-in-out; }
.found-king.d-shake  { animation: dShake 0.7s ease-in-out; }
.found-king.d-wobble { animation: dWobble 1.4s ease-in-out; }
.found-king.d-pop    { animation: dPop 0.85s cubic-bezier(.2,.8,.3,1.4); }
.found-king.d-tilt   { animation: dTilt 1.2s ease-in-out; }
.found-king.d-flip   { animation: dFlip 0.9s ease-in-out; }
@keyframes dTilt {
  0%,100% { transform: rotate(0deg) translateY(0); }
  30% { transform: rotate(-22deg) translateY(-6%); }
  55% { transform: rotate(-22deg) translateY(-6%); }
  80% { transform: rotate(18deg) translateY(-4%); }
}
@keyframes dFlip {
  0%,100% { transform: scaleX(1) rotate(0deg); }
  35% { transform: scaleX(-1) rotate(6deg); }
  70% { transform: scaleX(1) rotate(-6deg); }
}
@keyframes dSway {
  0%,100% { transform: rotate(0deg); }
  25% { transform: rotate(-15deg) translateY(-8%); }
  50% { transform: rotate(0deg); }
  75% { transform: rotate(15deg) translateY(-8%); }
}
@keyframes dJump {
  0%,100% { transform: translateY(0) scaleY(1); }
  15% { transform: translateY(2%) scaleY(0.85); }
  45% { transform: translateY(-40%) scaleY(1.12); }
  70% { transform: translateY(0) scaleY(0.92); }
  85% { transform: translateY(-15%) scaleY(1.04); }
}
@keyframes dSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes dShake {
  0%,100% { transform: translateX(0) rotate(0deg); }
  20% { transform: translateX(-18%) rotate(-6deg); }
  40% { transform: translateX(18%) rotate(6deg); }
  60% { transform: translateX(-12%) rotate(-4deg); }
  80% { transform: translateX(12%) rotate(4deg); }
}
@keyframes dWobble {
  0%,100% { transform: rotate(0deg); }
  20% { transform: rotate(-10deg); }
  40% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(4deg); }
}
@keyframes dPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.3, 0.8); }
  60% { transform: scale(0.9, 1.15) translateY(-12%); }
  100% { transform: scale(1, 1) translateY(0); }
}

/* 테두리 없음 — 이 프로젝트 아트 전체 규칙(오리·언덕·이글루 등과 일관), 반투명 배경만으로 탭 영역 표시 */
.icon-btn {
  background: rgba(0,0,0,0.28);
  color: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: clamp(16px, 4.6vw, 20px);
  line-height: 1;
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.94); background: rgba(0,0,0,0.45); }

.stats { display: flex; gap: clamp(8px, 4vw, 22px); }
.stat { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
/* 포인트 코인: 아이콘 옆에 숫자(가로 배치) */
.combo-stat { flex-direction: row; align-items: center; gap: 5px; }
/* 점수·시간·이동 스탯은 index.html에서 DOM째 제거됨(2026-07-03) — 게임 로직은 game.js 더미 요소로 동작 */
.stat .label { font-size: 10px; opacity: 0.7; }
.stat span:last-child { font-size: clamp(14px, 4vw, 18px); font-weight: 700; }
/* 공유 이미지 미리보기 폴백 오버레이 */
#shotOverlay { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,0.82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; }
#shotOverlay .shot-img { max-width: 90%; max-height: 64%; border-radius: 10px; box-shadow: 0 10px 36px rgba(0,0,0,0.6); -webkit-touch-callout: default; }
#shotOverlay .shot-hint { color: #fff; font-size: 15px; text-align: center; }
#shotOverlay .diff { width: auto; min-width: 160px; }
/* 콤보칸(점수 옆) — 콤보 쌓이면 강조, 갱신 시 통통 */
.combo-stat #combo, .combo-stat #homePoints { transition: color .2s, text-shadow .9s ease-out; }
.combo-stat #combo { color: #b8b0cc; }
.combo-stat.on #combo { color: #ffe24d; }
.combo-stat.on .label { color: #ffd45e; opacity: 0.95; }
/* 골드가 늘어나는 순간에만 반짝(상시 글로우였던 걸 이펙트로 전환, 2026-07-13 사용자 지적) —
   transition은 위 기본 규칙에 둬서 클래스가 빠질 때도 스르륵 꺼지게 함 */
.combo-stat.combo-glow #combo, .combo-stat.combo-glow #homePoints {
  text-shadow: 0 0 10px #ff9e3a, 0 0 20px #ffcf5c;
}
#combo { display: inline-block; transform-origin: center; font-size: clamp(24px, 7vw, 32px); font-weight: 800; } /* 홈화면 재화 숫자와 크기 통일(2026-07-12) — 일반 .stat 규칙(14~18px)을 안 쓰게 오버라이드 */
#combo.combo-bump { animation: comboBump 0.4s cubic-bezier(.2,1.6,.4,1); }
@keyframes comboBump { 0% { transform: scale(1); } 35% { transform: scale(1.5); } 100% { transform: scale(1); } }
#score { display: inline-block; transform-origin: center; }
#score.score-bump { animation: scoreBump 0.42s cubic-bezier(.2,1.6,.4,1); }
@keyframes scoreBump {
  0% { transform: scale(1); color: #fff; }
  35% { transform: scale(1.45); color: #ffe24d; text-shadow: 0 0 10px #ff9e3a; }
  100% { transform: scale(1); color: #fff; }
}

/* ---------- 게임판 ---------- */
#board {
  flex: 1 1 auto;
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: var(--gap);
  padding: 8px var(--gap) 0;
  align-content: start;
  min-height: 0;
  touch-action: none; /* 드래그 중 브라우저 스크롤/당겨서 새로고침 방지 */
}

/* ---------- 클론다이크(2026-07-13 추가) — #stockbar/#board와 같은 규칙을 7열/4파운데이션에 맞게 재사용 ---------- */
#kStockbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  min-height: calc(var(--real-card-w, 44px) * 7 / 5 + 4px); padding: 2px 10px 0; gap: 8px;
}
.k-foundations { display: flex; align-items: center; flex-wrap: nowrap; gap: 4px; }
.k-waste-stock-group { display: flex; align-items: center; gap: 8px; }
.k-fslot {
  position: relative; flex: 0 0 auto;
  width: var(--real-card-w, 44px); aspect-ratio: var(--ratio);
  border-radius: var(--radius); border: 1px dashed rgba(255,255,255,0.22);
}
.k-fslot.filled {
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #eee7f7 55%, #d8cdec 100%);
  border: 1px solid rgba(0,0,0,0.35); box-shadow: -1px 1px 3px rgba(0,0,0,0.45); overflow: hidden;
}
.k-waste, .k-stock {
  position: relative; flex: 0 0 auto;
  width: var(--real-card-w, 44px); aspect-ratio: var(--ratio);
  border-radius: var(--radius); cursor: pointer;
}
.k-stock { border: 1.5px dashed rgba(255,255,255,0.3); }
.k-stock.empty::after { content: "↺"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(14px, 4vw, 20px); color: rgba(255,255,255,0.6); }
#kBoard {
  flex: 1 1 auto; position: relative; display: grid;
  grid-template-columns: repeat(7, 1fr); gap: var(--gap);
  padding: 8px var(--gap) 0; align-content: start; min-height: 0;
  touch-action: none;
}
#kBoard .column.empty-target::before { content: ""; position: absolute; inset: 0; border: 1.5px dashed rgba(255,255,255,0.3); border-radius: var(--radius); }

/* ---------- 게임 선택 메뉴(2026-07-13, Play 진입 시 첫 화면) ---------- */
/* .dialog.game-select-dialog(클래스 2개)로 .dialog 단독 규칙보다 확실히 우선되게(파일 순서와 무관하게) */
/* 배경 전체를 카드무늬로 늘려쓰던 방식(줄무늬 흉내만 낸 가짜 패턴, 실제 카드가 아니었음) 대신
   단색 짙은 보라 바탕 + 실제 카드(진짜 거미 뒷면 아트) 몇 장을 소품처럼 배치(2026-07-13 사용자 지적 반영) */
/* 2026-07-19 — 나머지 화면 전부와 같은 화사한 파스텔로 통일(사용자 지시: "다 해") */
.dialog.game-select-dialog { background: linear-gradient(160deg, #fff0f6 0%, #f5ecff 45%, #e3f7fb 100%); color: #4a3f55; position: relative; }
.gs-overlay { background: linear-gradient(160deg, #fff0f6 0%, #f5ecff 45%, #e3f7fb 100%); backdrop-filter: none; }
/* 팝업 닫기 = 좌상단 뒤로가기 대신 우상단 원형 X(2026-07-14) — 뒤로가기 화살표는 "다른 화면으로 이동"
   처럼 보여 헷갈린다는 지적, 그냥 팝업만 닫는 X로 교체 */
.gs-close {
  /* 실측 지적(2026-07-14): 너무 작아 눈에 안 띔 — 옆 화살표(.gs-arrow, 40px)와 같은 크기로 키움 */
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.32); color: #fff; font-size: 28px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2;
}
.gs-close:active { transform: scale(0.9); background: rgba(0,0,0,0.5); }
.gs-carousel { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px 0 10px; }
.gs-arrow {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.32); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.gs-arrow:active { transform: scale(0.9); background: rgba(0,0,0,0.5); }
.gs-card-wrap { position: relative; width: 148px; height: 200px; }
/* 실제 카드 뒷면(.card.down)과 완전히 같은 무늬(2026-07-14, "우리가 쓰는 그 카드 배경이어야" 지적 반영
   — 흰 배경으로 바꿔뒀던 걸 되돌리되, 이번엔 다이얼로그 전체가 아니라 카드 모양 안에서만 씀).
   장식 카드는 1장만(2장 두면 실제 게임 2종+장식 1장=3장으로 보여 헷갈린다는 지적으로 1장 제거).
   빗금 간격(2026-07-14 재수정) — 실제 카드(.card.down)는 6px/12px 간격을 기본 카드 폭(--real-card-w
   기본값 46px)에 그려서 대각선에 약 10개가 보이는데, 이 화면의 카드는 훨씬 커서(118/148px) 같은 6px/12px을
   그대로 쓰면 빗금이 너무 촘촘하게(개수가 훨씬 많이) 보였음 — 카드 폭 비율만큼 간격도 키워 실제 카드와
   같은 개수(~10개)로 보이게 함(46px 기준 12px → 118px면 30px, 148px면 38px). */
.gs-deco-card {
  position: absolute; top: 10px; width: 118px; height: 160px; border-radius: 12px;
  background: repeating-linear-gradient(45deg, #4a3b8a 0 15px, #5d4ab0 15px 30px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.35); opacity: 0.7;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.gs-deco-card img { width: 66%; height: 66%; object-fit: contain; image-rendering: pixelated; }
.gs-deco-l { left: -22px; transform: rotate(-11deg); }
.gs-card {
  position: absolute; inset: 0; border-radius: 14px;
  background: repeating-linear-gradient(45deg, #4a3b8a 0 19px, #5d4ab0 19px 38px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  animation: gsCardIn 0.3s cubic-bezier(.2,1.4,.4,1);
}
@keyframes gsCardIn { 0% { transform: scale(0.8) rotate(-4deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.gs-card-icon { width: 92px; height: 92px; image-rendering: pixelated; object-fit: contain; }
.gs-card-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.gs-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.gs-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(74,63,85,0.25); }
.gs-dot.on { background: #ffe24d; }

/* 드래그 중 따라다니는 카드 묶음 */
.card-ghost {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  transform: rotate(2deg);
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.55));
}
.card-ghost .card { transition: none; }

.column {
  position: relative;
  border-radius: var(--radius);
  /* 실제 높이는 JS가 카드 수에 맞춰 지정 */
}
.column.empty-target::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px dashed rgba(255,255,255,0.25);
  border-radius: var(--radius);
}
.column.drop-ok::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px solid #ffe169;
  border-radius: calc(var(--radius) + 3px);
  pointer-events: none;
}
/* 자동 힌트: 목적지 열 / 출발 카드 강조 */
.column.hint-dst::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px dashed #7fffb0;
  border-radius: calc(var(--radius) + 3px);
  pointer-events: none;
  animation: pulse 0.8s ease-in-out infinite;
}
.card.hint-src { animation: pulse 0.8s ease-in-out infinite; box-shadow: 0 0 0 2px #7fffb0, 0 2px 6px rgba(0,0,0,0.5); }
.card.hint-dst-card { animation: pulse 0.8s ease-in-out infinite; box-shadow: 0 0 0 3px #45d0ff, 0 2px 6px rgba(0,0,0,0.5); z-index: 40; }
@keyframes pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }

/* 콤보 ×N 숫자 팝업 — tier(콤보 길이)가 클수록 크고 화려 */
.combo-tag {
  position: fixed; transform: translate(-50%, -50%);
  font-family: 'Jua', sans-serif; font-weight: 900;
  font-size: calc(14px + var(--tier, 1) * 4px);
  color: #ffe24d;
  -webkit-text-stroke: 2px #c0392b;
  text-shadow: 0 0 calc(5px + var(--tier, 1) * 3px) #ff9e3a, 0 2px 0 #b03048, 0 0 calc(8px + var(--tier, 1) * 4px) #ffd64a;
  pointer-events: none; z-index: 250; white-space: nowrap;
  animation: comboPop 1.15s cubic-bezier(.2, 1.7, .35, 1) forwards;
}
@keyframes comboPop {
  0%   { transform: translate(-50%, -50%) scale(.2) rotate(-14deg); opacity: 0; }
  22%  { transform: translate(-50%, -55%) scale(1.3) rotate(7deg);  opacity: 1; }
  50%  { transform: translate(-50%, -78%) scale(1) rotate(-3deg);   opacity: 1; }
  100% { transform: translate(-50%, -165%) scale(.92) rotate(2deg); opacity: 0; }
}

/* 목돈 획득 시 동전 쏟아지기 → 상단 골드 표시로 빨려들어감(사용자 요청) */
.coin-fly {
  position: fixed; width: 24px; height: 24px; z-index: 260; pointer-events: none;
  image-rendering: pixelated; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
  transition: transform 0.6s cubic-bezier(.25,.6,.3,1), opacity 0.55s ease-in 0.05s;
}

/* ---------- 카드 ---------- */
.card {
  position: absolute;
  left: 0;
  width: 100%;
  aspect-ratio: var(--ratio);   /* 높이는 폭에 비례 → 비율 항상 고정 */
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
  border: 1px solid rgba(0,0,0,0.22);   /* 겹쳤을 때 카드 경계 구분 */
  /* 카드가 위치 바뀔 때 스르륵 미끄러지지 않고 촥! 하고 붙게(맞고 스타일) — 짧고 급제동 곡선 */
  transition: top 0.1s cubic-bezier(.15,.85,.25,1), transform 0.08s cubic-bezier(.15,.85,.25,1), box-shadow 0.1s ease, filter 0.2s ease;
  will-change: top, transform;
  container-type: inline-size; /* cqw = 카드 폭의 1% */
}
.card .face {
  position: absolute;
  inset: 0;
  font-weight: 800;
}
/* 좌상단 인덱스 — 카드가 겹쳐도 보이는 부분(최대한 크게) */
.card .corner {
  position: absolute;
  top: 2%;        /* 위 여백 최소 */
  left: 8%;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.7;
}
/* 숫자·알파벳 — 레퍼런스처럼 '깔끔한 굵은 폰트'로 큼직하게(픽셀폰트는 여백 커서 작아보임).
   크기는 카드 폭 기준 calc(=cqw 미지원 대비 안전). */
.card .corner .r {
  font-family: 'Jua', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 900;
  /* 크기 제약(앱 실측 역산): 위여백 ≥2% + Q꼬리가 빡빡한 팬(0.36)·무늬에 안 닿는 최대치 = 0.48배(cap높이 ~25%) */
  font-size: calc(var(--real-card-w, 46px) * 0.48);
  line-height: 1; letter-spacing: -0.02em;
  margin-top: -0.14em; /* 가장 키 큰 글자 잉크 top을 카드 높이의 2%에 맞춤(실측) */
}
/* '10'은 두 글자지만 '같은 높이'로 — 폰트크기는 동일하게 두고 가로만 압축해 폭만 줄임 */
.card .corner .r.r-ten { display: inline-block; letter-spacing: -0.12em; transform: scaleX(0.82); transform-origin: left center; }
/* 그림카드(J/Q/K) 코너의 작은 무늬 배지 — 랭크 글자만으론 어느 무늬인지 구분이 안 돼(2026-07-13, 클론다이크
   파운데이션이 무늬별로 구분돼야 한다는 지적) 랭크 밑에 작게 추가. 숫자카드는 가운데 큰 무늬로 이미 충분해 안 씀 */
.card .corner .corner-suit { width: calc(var(--real-card-w, 46px) * 0.22); height: calc(var(--real-card-w, 46px) * 0.22); image-rendering: pixelated; margin-top: 1px; }
/* 가운데 큰 무늬 — 카드 빈 공간을 채움(아래쪽 보이는 카드에 표시) */
.card .big {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 92cqw;
  line-height: 1;
  opacity: 0.92;
}
/* 그림(무늬/캐릭터)은 카드 아래쪽 영역에만 → 좌상단 숫자/글자와 겹치지 않음 */
.card .big.art { inset: 46% 8% 7% 8%; opacity: 1; }
/* 진짜 픽셀아트: 비트맵을 흐림 없이 블록 그대로 확대 */
.card .big.art .pix {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.card.red { color: var(--red); }
.card.black { color: var(--black); }
.card.joker-card { color: #8b5cf6; } /* 조커(와일드) — 보라 ★ */
/* 보드 포인트카드(bm-screen-spec.html §E) — 골드카드로 위장, 탭하면 원래 카드로(밸런스 무영향) */
.card.goldwrap {
  background: linear-gradient(160deg, #ffe27a, #f7b733 55%, #e2952e);
  border: 2px solid #c97a12;
  box-shadow: 0 0 10px rgba(255,201,64,0.65), inset 0 0 8px rgba(255,255,255,0.4);
  animation: goldwrapPulse 1.1s ease-in-out infinite;
  cursor: pointer;
}
.goldwrap-face { display: flex; align-items: center; justify-content: center; }
.goldwrap-face .coin-ico { width: 54cqw; height: 54cqw; }
@keyframes goldwrapPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }
/* 알려줄 카드 없을 때 우상단 스톡 더미 강조(통통) */
.stock.stock-attn { animation: stockPulse 0.65s ease-in-out 3; }
@keyframes stockPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); filter: drop-shadow(0 0 8px rgba(127,255,176,0.9)); } }

/* ---------- 캐릭터 idle 모션: 가끔씩 짧게, 캐릭터마다 다르게 ---------- */
.card.facecard .pix { transform-origin: 50% 100%; }
.card .back-art { transform-origin: 50% 50%; }
/* J — 장난꾸러기 소년: 깡총 두 번 뛰며 까딱 */
.card.c-j .pix { animation: jackHop 5s ease-in-out infinite; }
@keyframes jackHop {
  0%, 78%, 100% { transform: translateY(0) rotate(0deg); }
  84% { transform: translateY(-13%) rotate(-6deg); }
  89% { transform: translateY(0) rotate(0deg); }
  93% { transform: translateY(-7%) rotate(5deg); }
  97% { transform: translateY(0) rotate(0deg); }
}
/* Q — 우아한 공주: 드레스 자락처럼 좌우로 살랑 */
.card.c-q .pix { animation: queenSway 6.5s ease-in-out infinite; }
@keyframes queenSway {
  0%, 76%, 100% { transform: rotate(0deg); }
  84% { transform: rotate(6deg) translateY(1%); }
  92% { transform: rotate(-6deg) translateY(1%); }
  100% { transform: rotate(0deg); }
}
/* K — 근엄한 왕: 느릿하게 위엄 있는 끄덕 + 가슴 으쓱 */
.card.c-k .pix { animation: kingNod 8s ease-in-out infinite; }
@keyframes kingNod {
  0%, 80%, 100% { transform: scale(1) translateY(0) rotate(0deg); }
  87% { transform: scale(1.06) translateY(-3%) rotate(0deg); }
  94% { transform: scale(1) translateY(3%) rotate(1.5deg); }
}
/* 거미(뒷면) — 다리 꼼지락 + 폴짝 (가려지지 않은 맨 아래 카드에서만) */
.card .back-art.live { animation: spiderWiggle 4.5s ease-in-out infinite; }
@keyframes spiderWiggle {
  0%, 72%, 100% { transform: translateY(0) rotate(0deg); }
  78% { transform: rotate(-5deg); }
  83% { transform: rotate(5deg); }
  88% { transform: translateY(-10%) rotate(-3deg); }
  94% { transform: translateY(0) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .card.c-j .pix, .card.c-q .pix, .card.c-k .pix, .card .back-art.live { animation: none; }
}

.card.down {
  background: repeating-linear-gradient(45deg, #4a3b8a 0 6px, #5d4ab0 6px 12px);
  border: 1px solid rgba(255,255,255,0.25);
}
.card.down .face { display: none; }

/* ---------- 시작 로딩화면: 카드 뒷면 한 장(무늬+거미)을 처음부터 그대로 전체화면에 ---------- */
/* height를 100svh(작은 뷰포트 높이, 시스템 바 애니메이션에 영향 안 받음)로 고정 —
   inset:0/100vh는 스플래시 해제 직후 안드로이드가 상태바·제스처바 인셋을 몇 차례 나눠서
   전달할 때마다 실시간 재계산되어 flex 중앙정렬 기준점이 흔들리고, 그 결과 거미가
   프레임마다 위치를 옮겨다니는 것처럼(순간이동) 보이는 원인이었음(픽셀 좌표 추적으로 확인:
   X는 고정인데 Y만 여러 값 사이를 뚝뚝 끊기며 오갔음). 100svh를 쓰면 그 재계산 자체가 없어짐. */
#loadingScreen {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 999;
  height: 100vh; height: 100svh; /* svh 미지원 구형 엔진 대비 100vh를 폴백으로 먼저 선언 */
  /* 카드 뒷면(.card.down)과 같은 무늬를 화면 전체 크기로 "확대"한 느낌이 나게 —
     카드 뒷면 그대로(6px/12px)를 전체화면에 쓰면 줄무늬가 너무 촘촘해져서 카드와 다른 무늬처럼 보임.
     화면 가로+세로 합의 1/5을 한 칸(=카드에서 보이던 약 5줄)으로 스케일. */
  background: repeating-linear-gradient(45deg, #4a3b8a 0 calc(10vw + 10vh), #5d4ab0 calc(10vw + 10vh) calc(20vw + 20vh));
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease;
}
#loadingScreen.hide { opacity: 0; pointer-events: none; }
/* 보라 단색(네이티브 스플래시와 동일 색) → 뷰포트 안정 확인 후 페이드아웃 → 카드무늬+거미 드러남.
   viewportStable(JS)이 이 안정 확인을 담당 — 안정되기 전엔 이 단색이 흔들림을 전부 가려줌. */
#loadingScreen::before {
  content: ""; position: absolute; inset: 0; z-index: 2;
  background: #7a5fc0;
  opacity: 1;
  transition: opacity 0.45s ease;
  pointer-events: none;
}
#loadingScreen.pattern-ready::before { opacity: 0; }
#loadingSpider {
  position: relative; z-index: 1; /* ::before 무늬 오버레이보다 위에 그려지게 */
  width: 46%; max-width: 320px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.35));
  opacity: 0; /* 뷰포트가 안정된 뒤 JS가 .ready를 붙이기 전까진 숨김(등장 애니메이션 중 위치 흔들림 방지) */
}
#loadingSpider.ready { animation: loadingSpiderIn 0.5s cubic-bezier(.2,.8,.3,1) forwards; }
@keyframes loadingSpiderIn {
  0% { opacity: 0; transform: scale(0.7) rotate(-6deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
/* 카드 뒷면 거미 픽셀아트 — 가운데 */
.card .back-art {
  position: absolute;
  inset: 0;
  margin: auto;            /* transform 안 쓰고 정중앙 정렬(흔들림 애니와 충돌 방지) */
  width: 60%;
  height: 60%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.card.movable { cursor: pointer; }
/* 배분 직후, 못 옮기는 맨 위 카드는 살짝 회색 */
.card.dim { filter: brightness(0.78) saturate(0.8); }

/* 갈 곳 없는 카드 탭 → 짧게 도리도리(고개 젓기) */
.card.shake { animation: noShake 0.34s ease-in-out; z-index: 56; }
@keyframes noShake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  10% { transform: translateX(-11%) rotate(-4deg); }
  22% { transform: translateX(9%) rotate(3.5deg); }
  34% { transform: translateX(-9%) rotate(-3.5deg); }
  46% { transform: translateX(7%) rotate(3deg); }
  58% { transform: translateX(-6%) rotate(-2.5deg); }
  70% { transform: translateX(4%) rotate(1.5deg); }
  82% { transform: translateX(-2%) rotate(-0.8deg); }
}

/* 착지 임팩트: 쫙! 스쿼시 바운스 */
.card.land { animation: landSquash 0.3s cubic-bezier(.2,.8,.3,1); z-index: 50; }
@keyframes landSquash {
  0% { transform: scale(1.16, 0.82); }   /* 닿는 순간 납작 */
  45% { transform: scale(0.95, 1.07); }  /* 튕겨 늘어남 */
  75% { transform: scale(1.03, 0.98); }
  100% { transform: scale(1, 1); }
}
/* 연속 런 카스케이드: 카드 팝(아래로 갈수록 --pop-s 커짐) */
.card.pop { animation: cardPop 0.42s cubic-bezier(.2,.9,.3,1.5); z-index: 58; }
@keyframes cardPop {
  0% { transform: scale(1); }
  38% { transform: scale(var(--pop-s, 1.3)); filter: brightness(1.5); }
  100% { transform: scale(1); filter: brightness(1); }
}
/* 픽셀 파편 — 고정 3px 사각(네모 안 커짐), 이동+페이드만(중력 아치) */
.px-spark {
  position: fixed;
  width: 3px; height: 3px;
  border-radius: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  /* #winOverlay.win(z-index:120)보다 낮아서 승리창 뒤에서 터지던 문제 수정(2026-07-13) —
     승리창 앞에서 터지게 위로 올림 */
  z-index: 122;
  image-rendering: pixelated;
  animation: pxBurst var(--dur, 0.9s) cubic-bezier(.15,.7,.5,1) forwards;
}
@keyframes pxBurst {
  0%   { transform: translate(-50%, -50%); opacity: 1; }
  60%  { transform: translate(calc(-50% + var(--mx, 0px)), calc(-50% + var(--my, 0px))); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))); opacity: 0; }
}
/* 중앙 픽셀 팝 — 고정 4px +모양(섬광 대신) */
.px-pop {
  position: fixed;
  width: 4px; height: 4px;
  border-radius: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 123;
  image-rendering: pixelated;
  animation: pxPopFade 0.28s steps(3) forwards;
}
@keyframes pxPopFade { 0% { opacity: 1; } 100% { opacity: 0; } }
/* 세트 완성마다 차오르는 에너지 글로우(터질 듯 말 듯) */
.charge-glow {
  position: fixed;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,231,105,0.55), rgba(255,143,176,0.25) 55%, transparent 72%);
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0.85;
  pointer-events: none;
  z-index: 100;
  animation: chargeGlow 0.72s ease-out forwards;
}
@keyframes chargeGlow {
  to { transform: translate(-50%, -50%) scale(var(--cg, 5)); opacity: 0; }
}

/* 마지막 카드 화면 번쩍 */
.screen-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,231,105,0.22), rgba(255,143,176,0.12) 55%, transparent 75%);
  opacity: 0;
  pointer-events: none;
  z-index: 105;
  animation: screenFlash 0.32s ease-out forwards;
}
@keyframes screenFlash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* 귀여운 픽셀 해님 — 동(우)에서 떠서 서(좌)로 지는 궤도. 궤도=위치, #sun=표정/모션 */
#sunOrbit {
  position: fixed;
  top: 0; left: 0;
  width: 17vmin; height: 17vmin;
  z-index: 1;             /* 하늘(배경) 앞, 풍경(#scene,z:2) 뒤 → 집 뒤에서 뜸 */
  pointer-events: none;
  animation: sunArc 60s linear infinite;
}
/* 떠다니는 구름 레이어 — 하늘(배경) 앞, 카드/풍경 뒤. 느리게 흐름 */
#skyclouds { position: fixed; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: hidden; }
.skycloud { position: absolute; image-rendering: pixelated; filter: drop-shadow(0 2px 2px rgba(120,140,180,0.25)); }
/* 픽셀 궁전 풍경(별도 레이어): 해/달 앞, UI 뒤 */
#scene {
  position: fixed;
  left: 0; bottom: 104px;
  width: 100%;
  image-rendering: pixelated;
  z-index: 2;
  pointer-events: none;
  transform-origin: 50% 100%;
}
/* 플레이 진입 시 마을(집·나무 등 그동안 모은 배경들)이 실제 오브젝트 단위로 하나씩 팝인하며 등장.
   (2026-07-13 2차 재작업 — 세로 스트립을 순차 리빌하는 1차 버전은 "가리개가 걷히는 파도타기"처럼 보인다는
   지적을 받음. 기본판(성·언덕·잔디, #scene에 즉시 표시)은 그대로 두고, 그 위에 집·나무·벤치 등 각 오브젝트의
   실제 자리를 정확히 크롭한 <img> 클론을 스태거된 딜레이로 하나씩 튀어오르게 함 — 다 끝나면 완성판으로
   깜빡임 없이 전환) */
.scene-grow-layer { position: fixed; z-index: 3; pointer-events: none; }
.scene-obj-clip {
  position: absolute; overflow: hidden; transform-origin: 50% 100%;
  opacity: 0; transform: translateY(35%) scale(0.75);
  animation: sceneObjIn 0.42s cubic-bezier(.2,.9,.35,1.15) forwards;
}
.scene-obj-clip img { position: absolute; image-rendering: pixelated; }
@keyframes sceneObjIn {
  0%   { opacity: 0; transform: translateY(35%) scale(0.75); }
  65%  { opacity: 1; transform: translateY(-4%) scale(1.05); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sunArc {
  0%   { transform: translate(86vw, 66vh); opacity: 0; }   /* 동쪽 지평선에서 떠오름 */
  7%   { opacity: 1; }
  28%  { transform: translate(64vw, 22vh); }
  50%  { transform: translate(42vw, 5vh); }                /* 정오(가장 높이) */
  72%  { transform: translate(20vw, 22vh); }
  93%  { opacity: 1; }
  100% { transform: translate(2vw, 66vh); opacity: 0; }    /* 서쪽으로 짐 */
}
#sun {
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
  transform-origin: 50% 50%;
}
/* 해님이 UI 뒤(빈 영역)에 보이도록 주요 바들을 위 레이어로 */
#topbar, #stockbar, #board, #bottombar { position: relative; z-index: 5; } /* 풍경·해달 앞 */
#sun.s-bounce { animation: sunBounce 0.9s ease-in-out; }
#sun.s-spin   { animation: sunSpin 1.0s ease-in-out; }
#sun.s-wobble { animation: sunWobble 1.0s ease-in-out; }
#sun.s-jump   { animation: sunJump 0.8s ease-out; }
#sun.s-pop    { animation: sunPop 0.7s cubic-bezier(.2,.8,.3,1.45); }
#sun.s-sparkle { animation: sunSparkle 0.85s ease-in-out; }
@keyframes sunSparkle {
  0%,100% { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25)) brightness(1); transform: scale(1); }
  40% { filter: drop-shadow(0 0 12px rgba(255,243,160,0.95)) brightness(1.55); transform: scale(1.12); }
}
/* 반짝이 별 */
.sparkle {
  position: fixed;
  width: 9px; height: 9px;
  background: #fff7c0;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  z-index: 4;
  animation: sparkleTwinkle 0.7s ease-out forwards;
}
@keyframes sparkleTwinkle {
  0% { transform: translate(-50%,-50%) scale(0) rotate(0deg); opacity: 0; }
  45% { transform: translate(-50%,-50%) scale(1.2) rotate(45deg); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(0.2) rotate(90deg); opacity: 0; }
}
/* 비 오는 날(2026-07-16, isRainingToday() 참고) — 하루 단위 결정론, 연잎개구리가 우산 쓴 이유가
   화면에서도 보이게 하는 가벼운 빗줄기 연출. pointer-events:none이라 터치 방해 없음 */
#rainLayer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 3; }
.raindrop {
  position: absolute; top: -6%; width: 2px; height: 16px;
  background: linear-gradient(180deg, rgba(180,210,255,0) 0%, rgba(180,210,255,0.55) 100%);
  animation-name: raindropFall; animation-timing-function: linear; animation-iteration-count: infinite;
}
@keyframes raindropFall { 0% { transform: translateY(0); opacity: 0; } 8% { opacity: 1; } 100% { transform: translateY(112vh); opacity: 0.6; } }
@keyframes sunBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-22%); } }
@keyframes sunSpin { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
@keyframes sunWobble { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-15deg); } 75% { transform: rotate(15deg); } }
@keyframes sunJump { 0%,100% { transform: translateY(0) scaleY(1); } 30% { transform: translateY(-30%) scaleY(1.1); } 60% { transform: translateY(0) scaleY(0.9); } 80% { transform: translateY(-12%); } }
@keyframes sunPop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* 승리 축하 공연 무대 */
.win-stage {
  position: fixed;
  inset: 0;
  z-index: 108;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.win-spot {
  position: absolute;
  left: 50%; top: 50%;
  width: 80vw; height: 80vw;
  max-width: 520px; max-height: 520px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,231,105,0.30), rgba(255,143,176,0.12) 45%, transparent 68%);
  animation: winSpot 1.6s ease-in-out infinite;
}
@keyframes winSpot { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }
.win-char {
  position: relative;
  width: 42vw; max-width: 230px;
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.45));
  transform-origin: 50% 90%;
  animation: winDance 0.62s ease-in-out infinite;
}
.win-buddy {
  position: absolute;
  width: 20vw; max-width: 110px;
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: pixelated;
  bottom: 14%;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
  transform-origin: 50% 90%;
  animation: winHop 0.5s ease-in-out infinite;
}
/* 랜덤 위치 댄서(인라인 left/top 사용) — 크기 약간 작게, 다양한 박자 */
.win-buddy.rnd { bottom: auto; right: auto; width: 15vw; max-width: 84px; animation-duration: .46s; animation-delay: calc(var(--d, 0) * 1ms); }
.win-buddy.rnd:nth-child(3n) { animation-duration: .54s; }
.win-buddy.rnd:nth-child(2n) { animation-duration: .5s; }
.win-buddy.d1 { left: 4%;  bottom: 20%; animation-delay: 0s; }
.win-buddy.d2 { right: 4%; bottom: 20%; animation-delay: .12s; animation-duration: .46s; }
.win-buddy.d3 { left: 20%; bottom: 6%;  animation-delay: .25s; animation-duration: .54s; }
.win-buddy.d4 { right: 20%; bottom: 6%; animation-delay: .37s; animation-duration: .5s; }
@keyframes winDance {
  0%,100% { transform: translateY(0) rotate(-7deg) scale(1); }
  25% { transform: translateY(-9%) rotate(0deg) scale(1.06); }
  50% { transform: translateY(0) rotate(7deg) scale(1); }
  75% { transform: translateY(-9%) rotate(0deg) scale(1.06); }
}
@keyframes winHop {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-22%) rotate(6deg); }
}
/* 팝업 안 랜덤 위치 캐릭터(가장자리) */
.win-dialog { position: relative; }
.win-pop {
  position: absolute; width: 12%; max-width: 50px; aspect-ratio: 1;
  object-fit: contain; image-rendering: pixelated; pointer-events: none; z-index: 3;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.35));
  animation: winPopHop 0.5s ease-in-out infinite;
}
@keyframes winPopHop {
  0%,100% { transform: translate(-50%, -50%) rotate(-6deg); }
  50% { transform: translate(-50%, -64%) rotate(6deg); }
}
/* 승리/패배 캐릭터 고유 대사 말풍선 */
.win-bubble {
  position: absolute; transform: translate(-50%, 0); /* 캐릭터 아래에 매달림(꼬리는 위) */
  background: #fff; color: #6a533a; border: 2px solid #ffd592;
  border-radius: 11px; padding: 2px 7px; font-size: 11px; font-weight: 700;
  white-space: nowrap; max-width: 40vw; overflow: hidden; text-overflow: ellipsis;
  z-index: 6; pointer-events: none; box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  animation: winBubblePop 0.45s ease-out both;
}
.win-bubble::after { /* 위를 가리키는 꼬리 */
  content: ""; position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%);
  border: 5px solid transparent; border-bottom-color: #fff;
}
@keyframes winBubblePop {
  from { opacity: 0; transform: translate(-50%, 8px) scale(0.6); }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
/* 픽셀 폭죽(제목 양옆) */
.win-fw { width: 15%; max-width: 56px; image-rendering: pixelated; pointer-events: none; z-index: 4; animation: fwTwinkle 1.1s ease-in-out infinite; }
@keyframes fwTwinkle { 0%,100% { transform: scale(0.85) rotate(0deg); opacity: 0.8; } 50% { transform: scale(1.12) rotate(22deg); opacity: 1; } }
.win-stage.bow .win-char { animation: winBow 0.8s ease-out forwards; }
@keyframes winBow {
  0% { transform: translateY(0) rotate(0); }
  40% { transform: translateY(8%) rotate(0) scaleY(0.9); }
  100% { transform: translateY(0) rotate(0) scale(1.1); }
}

/* 첫 배분 — 카드 착지 반짝 별 */
.deal-spark {
  position: fixed;
  width: 3px; height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 0;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 70;
  animation: dealSpark 0.36s steps(3) forwards;
}
@keyframes dealSpark { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }

/* 축하 컨페티 — 아래에서 위로 솟구쳤다가 다시 아래로 흩날림 */
.confetti {
  position: fixed;
  width: 8px; height: 12px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 121; /* 승리창(z-index:120)보다 낮아 뒤에서 흩날리던 문제 같이 수정(2026-07-13) */
  animation: confettiPop 2.8s cubic-bezier(.25,.7,.5,1) forwards;
}
@keyframes confettiPop {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  35%  { opacity: 1; transform: translate(calc(var(--cx, 0px) * 0.5), var(--up, -60vh)) rotate(calc(var(--rot, 360deg) * 0.5)); }
  100% { opacity: 0; transform: translate(var(--cx, 0px), 16vh) rotate(var(--rot, 360deg)); }
}

/* 충격 파동 링 */
.impact-ripple {
  position: fixed;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.9);
  transform: translate(-50%, -50%) scale(0.3);
  opacity: 0.9;
  pointer-events: none;
  z-index: 95;
  animation: ripple 0.44s ease-out forwards;
}
@keyframes ripple {
  to { transform: translate(-50%, -50%) scale(5); opacity: 0; }
}

/* 완성된 한 벌이 좌상단으로 모여 사라지는 클론 */
.card.fly-complete {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  transition: transform 0.55s cubic-bezier(.4,.1,.2,1), opacity 0.55s ease;
  box-shadow: 0 6px 14px rgba(0,0,0,0.5);
}
.card.complete-fly {
  transition: top 0.35s ease, left 0.35s ease, opacity 0.35s ease;
  opacity: 0;
}

/* ---------- 스톡(우측 상단): 남은 배분을 가로로 겹친 카드 뒷면으로 표시 ---------- */
.right { display: flex; align-items: center; gap: 8px; }
.stock {
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
}
.stock.empty {
  width: var(--real-card-w, 44px);
  aspect-ratio: var(--ratio);
  height: auto;
  border: 1.5px dashed rgba(255,255,255,0.3);
  border-radius: var(--radius);
  cursor: default;
}
.stock:active:not(.empty) { transform: scale(0.95); }
.mini-back {
  position: absolute;
  top: 0;
  width: var(--real-card-w, 44px);
  aspect-ratio: var(--ratio);
  border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, #4a3b8a 0 6px, #5d4ab0 6px 12px);
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 1px 0 2px rgba(0,0,0,0.45);
  overflow: hidden;
}
.mini-back .mini-spider {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 60%;
  height: 60%;
  object-fit: contain;
  image-rendering: pixelated;
  transition: opacity 0.15s ease;
}
/* Play 진입 시 홈 마스코트 거미가 여기까지 날아와 "붙기" 전까지는 줄무늬 카드뒷면만 보이게 숨김
   (2026-07-13) — flySpiderToStock()가 도착 순간 이 클래스를 떼서 드러냄 */
#stock.spider-pending .mini-spider { opacity: 0; }
.fly-spider {
  position: fixed; z-index: 200; pointer-events: none; image-rendering: pixelated;
  will-change: transform;
}

/* ---------- 하단 액션 메뉴 ---------- */
#bottombar {
  flex-direction: column;
  gap: 4px;
  padding-bottom: 4px; /* 광고가 바로 아래에 붙으므로 safe-area 중복 제거(빈공간 방지) */
  /* 메뉴 뒤 흐린 네모 패널 제거(투명) — 배경은 메뉴 위에서만 보임 */
  background: transparent;
  /* 항상 표시 */
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
#bottombar.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
/* 힌트/조커 설명글은 absolute로 띄워 #bottombar 높이에 영향 주지 않음 → 배경 위치 안 흔들림 */
.hint {
  position: absolute; left: 10px; right: 10px; bottom: 100%; margin-bottom: 3px;
  font-size: clamp(11px, 3.2vw, 14px); opacity: 0.9; text-align: center;
  text-transform: uppercase; pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
}
/* 튜토리얼(2026-07-14) — 전체화면을 막지 않는 하단 안내 박스(보드는 계속 조작 가능) */
.tutorial-box {
  position: fixed; left: 50%; bottom: calc(112px + var(--banner-h, 0px)); transform: translateX(-50%) translateY(16px);
  width: min(88vw, 380px); background: #143d22; border: 1px solid rgba(255,255,255,0.18); border-radius: 16px;
  padding: 16px 18px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.tutorial-box.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.tutorial-text { margin: 0 0 12px; font-size: 15px; line-height: 1.5; text-align: center; }
.tutorial-btns { display: flex; gap: 8px; }
.tutorial-btns .diff { flex: 1; margin: 0; }
.tutorial-btns .diff.hide { display: none; }
/* 튜토리얼이 가리키는 카드/열에 노란 발광 테두리 + 은은한 펄스 */
.tutorial-highlight { position: relative; z-index: 45; box-shadow: 0 0 0 4px #ffe24d, 0 0 22px 8px rgba(255,226,77,0.7) !important; animation: tutorialPulse 1s ease-in-out infinite; }
@keyframes tutorialPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.3); } }
.actions { display: flex; justify-content: space-around; align-items: stretch; gap: 8px; width: 100%; max-width: 460px; }
.act {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.28);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  padding: 8px 4px;
  cursor: pointer;
}
.act:active { transform: scale(0.95); background: rgba(0,0,0,0.45); }
.act:disabled { opacity: 0.38; }
.act .ico { font-size: clamp(18px, 5.4vw, 24px); line-height: 1; display: flex; align-items: center; justify-content: center; }
.act .lbl { font-size: clamp(10px, 3vw, 13px); font-weight: 600; text-transform: uppercase; }
.ico-img { width: clamp(22px, 6.4vw, 28px); height: clamp(22px, 6.4vw, 28px); object-fit: contain; image-rendering: pixelated; }
.gift-ico { width: 1.15em; height: 1.15em; object-fit: contain; image-rendering: pixelated; vertical-align: -0.18em; }
.coin-ico { width: 1.25em; height: 1.25em; object-fit: contain; image-rendering: pixelated; vertical-align: -0.2em; }
/* 좌상단·홈화면 포인트 코인 — 옆 숫자 글씨 크기(clamp 24~32px)와 맞춤(2026-07-13, 너무 작다는 지적) */
#comboLabel .coin-ico, #homeCoinLabel .coin-ico { width: clamp(24px, 7vw, 32px); height: clamp(24px, 7vw, 32px); display: block; }
.wp-total .coin-ico { width: 1.05em; height: 1.05em; vertical-align: -0.1em; }
.dialog.gacha h1 .gift-ico { width: 1em; height: 1em; }
.act .badge {
  position: absolute;
  top: 2px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e8483f;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.act.armed { box-shadow: 0 0 0 2px #ffe169; background: rgba(255,225,105,0.18); }

/* ---------- 오버레이/다이얼로그 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  /* 2026-07-18 재지시 — 캐릭터 상세카드에서 호평받은 화사한 파스텔 컨셉을 전 메뉴로 통일 확장.
     어두운 반투명 대신 밝은 그라데이션 백드롭(불투명에 가깝게 — 뒤 게임화면이 반투명으로 비치던
     느낌 대신 카드 화면처럼 깔끔하게) */
  background: linear-gradient(160deg, #fff0f6 0%, #f5ecff 45%, #e3f7fb 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(3px);
  /* 하단 네이티브 배너(광고)는 WebView 위에 별도로 그려져서 DOM z-index로 안 가려짐 —
     실측 배너 높이(--banner-h, ads.js가 채움)만큼 여백을 둬서 다이얼로그가 배너 위로 올라오게 함 */
  padding-bottom: var(--banner-h, 0px);
}
.overlay.show { display: flex; }
/* 메뉴 폰트 = Jua(한글·라틴·숫자 전부 Jua 글리프).
   Jua가 U+0020-007E를 자체 포함하므로 unicode-range 픽셀폰트(Micro5/Silkscreen)보다 우선됨.
   보드(카드 랭크·상단 HUD)는 body 스택의 픽셀 폰트 유지. */
.dialog, .dialog button, .dialog select, .dialog input,
.act { font-family: 'Jua', sans-serif; }
.dialog {
  /* 2026-07-18 — 어두운 카드 대신 캐릭터 상세카드와 같은 화사한 크림톤 + 은은한 보라 테두리 */
  background: #fff8f3;
  color: #4a3f55;
  border: 1px solid rgba(176,111,214,0.28);
  border-radius: 18px;
  padding: 26px 22px;
  width: min(86vw, 360px);
  text-align: center;
  box-shadow: 0 10px 30px rgba(120,90,180,0.22);
  max-height: calc(90vh - var(--banner-h, 0px));
  overflow-y: auto;
}
/* 2026-07-19 — 길건너친구들(Crossy Road) 참고: 라이트 테마여도 글씨는 흰색 유지하되, 시그니처 메인컬러(보라)
   칩/배지 위에만 올려서 가독성 확보(사용자 지시: "글씨 주변에 우리 시그니처 컬러를 적용해라") */
.dialog h1 { margin: 0 0 8px; font-size: clamp(20px, 5.4vw, 26px); color: #fff; background: #7a5fc0; display: inline-block; padding: 5px 20px; border-radius: 999px; box-shadow: 0 3px 0 #5d4ab0; }
.dialog .sub { margin: 0 0 18px; opacity: 0.75; font-size: 14px; }
.diff {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: #1f6e3a;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.diff:active { transform: scale(0.97); background: #28854a; }
.diff:disabled { opacity: 0.55; cursor: default; }
.diff:disabled:active { transform: none; }
.diff.again { background: #c9a227; color: #1a1a1a; }
/* 보상형 광고 CTA(승리창 골드2배·게임오버 이어하기) — 눈에 띄게 펄스 */
.diff.double { background: linear-gradient(135deg, #ff8a3d, #ff5f7a); color: #fff; animation: doublePulse 1.4s ease-in-out infinite; }
.diff.double:active { transform: scale(0.97); animation: none; }
@keyframes doublePulse { 0%, 100% { box-shadow: 0 0 0 rgba(255,138,61,0.5); } 50% { box-shadow: 0 0 20px rgba(255,138,61,0.95); } }
/* 등장 임팩트(2026-07-16) — 광고 CTA opt-in율 개선 목적, 나타날 때 통통 튀며 팝인 후 기존 펄스로 이어짐.
   JS에서 표시 직전 클래스를 remove→reflow→add로 재트리거(popCard 등 기존 관례와 동일 패턴). */
@keyframes ctaPopIn { 0% { transform: scale(0.3); opacity: 0; } 55% { transform: scale(1.15); opacity: 1; } 75% { transform: scale(0.95); } 100% { transform: scale(1); opacity: 1; } }
.diff.double.cta-pop { animation: ctaPopIn 0.45s cubic-bezier(.34,1.56,.64,1) both, doublePulse 1.4s ease-in-out infinite 0.45s; }
/* 사망/종료 화면 가챠 진입 배너(길건너친구들 "Get a Prize" 참고) — 소지금이 뽑기비용 이상일 때만 노출 */
.diff.prize { background: linear-gradient(135deg, #7a5fc0, #b06fd6); color: #fff; }
.diff.prize:active { transform: scale(0.97); }
/* 무료선물 알림 탭 → 스토어 데일리선물 카드 강조(2026-07-16) — "알림 눌러서 들어가면 그 화면이
   눈에 띄게" 요청. 테두리 골드 글로우가 3번 크게 펄스한 뒤 저절로 꺼짐(영구 강조는 산만해서 제외). */
@keyframes giftCardSpotlight {
  0%, 100% { box-shadow: 0 3px 12px rgba(20,32,44,.06); outline-color: rgba(232,160,28,0); }
  50% { box-shadow: 0 0 0 4px rgba(232,160,28,.55), 0 0 26px rgba(232,160,28,.75); outline-color: rgba(232,160,28,.9); }
}
.store-card-daily.gift-spotlight { outline: 3px solid rgba(232,160,28,.9); outline-offset: 2px; animation: giftCardSpotlight 1s ease-in-out 3; }
/* 무료선물 배너(승리/게임오버창) — 상단 상시아이콘 대신 게임 전후에만 노출(길건너친구들 참고, 선물아이콘과 컬렉션아이콘 중복 문제로 변경) */
.diff.gift { background: linear-gradient(135deg, #ff6b9d, #ffb347); color: #fff; animation: doublePulse 1.4s ease-in-out infinite; }
.diff.gift:active { transform: scale(0.97); animation: none; }
/* 무료선물 받은 직후 "광고보고 2배" 제안(CR 실기기 확인: WATCH AD FOR 2X) — 잠깐 더 강조 */
/* 무료선물 대기중 — CR 실기기 확인("FREE GIFT IN 03H 1M")처럼 카운트다운 텍스트로, 클릭 불가·수수한 톤 */
.diff.gift.gift-countdown { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.75); animation: none; cursor: default; font-size: 0.92em; }

/* 승리 팝업 — 배경 안 어둡게/안 흐리게, 댕청미 가득한 귀여운 창 */
#winOverlay.win { background: transparent; backdrop-filter: none; z-index: 120; pointer-events: none; }
#winOverlay.win .win-dialog { pointer-events: auto; }
/* 팝업 바깥 빈공간 탭 = 구경하기(2026-07-11, Keep Watching 버튼 대체) — 부모(winOverlay)는
   여전히 pointer-events:none이라 이 자식만 auto로 별도 지정해 탭을 받는다 */
.win-backdrop-tap { position: absolute; inset: 0; pointer-events: auto; }
.win-dialog {
  /* 2026-07-19 — 나머지 메뉴 전부와 같은 화사한 파스텔 컨셉으로 통일(사용자 지시: "다 해") */
  background: linear-gradient(165deg, #fff0f6 0%, #f5ecff 45%, #e3f7fb 100%);
  border: 3px solid rgba(176,111,214,0.3);
  box-shadow: 0 16px 52px rgba(120,90,180,0.28);
  color: #4a3f55;
  animation: winPop .5s cubic-bezier(.18,1.55,.4,1) both;
  overflow: visible; /* 가장자리 캐릭터가 팝업 테두리에 안 잘리고 앞으로 보이게(.dialog의 overflow-y:auto 덮어씀) */
}
@keyframes winPop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
/* 팝업 속 랜덤 캐릭터 무리(이모지 대신) */
.win-troupe, .over-troupe { display: flex; justify-content: center; align-items: flex-end; gap: 6px; min-height: 60px; margin-bottom: 6px; }
.troupe-char { width: 46px; height: 58px; object-fit: contain; object-position: bottom; image-rendering: pixelated; transform-origin: 50% 100%; filter: drop-shadow(0 3px 3px rgba(0,0,0,0.3)); }
.troupe-dance { animation: troupeDance 0.6s ease-in-out infinite; }
@keyframes troupeDance { 0%,100% { transform: translateY(0) rotate(-9deg) scale(1); } 50% { transform: translateY(-22%) rotate(9deg) scale(1.05); } }
.troupe-droop { animation: troupeDroop 1.8s ease-in-out infinite; filter: grayscale(0.3) brightness(0.96) drop-shadow(0 3px 3px rgba(0,0,0,0.3)); }
@keyframes troupeDroop { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(4px) rotate(3deg); } }
.win-dialog h1 { color: #f0913c; text-shadow: 0 2px 0 #fff; font-size: clamp(26px, 7.5vw, 38px); }
.win-sub { margin: 4px 0 16px; font-size: 14px; color: #a9865c; font-weight: 600; }
.win-stats { display: flex; justify-content: center; gap: 8px; margin: 0 0 18px; }
.win-stats .ws {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(255,255,255,0.78);
  border: 2px solid #ffe1ad;
  border-radius: 14px;
  padding: 8px 10px; min-width: 62px;
}
.win-stats .ws span { font-size: 11px; color: #b59169; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.win-stats .ws b { font-size: clamp(16px, 5vw, 22px); color: #ee8a2f; }
.win-dialog .diff.again { background: #ffb259; color: #fff; }
.win-dialog .diff.again:active { background: #f59f3c; }
.win-dialog .diff.ghost { background: rgba(240,145,60,0.16); color: #d8801f; }
.win-dialog .diff.gift.gift-countdown { background: rgba(106,84,54,0.1); color: #8a6d4a; }
/* 승리창 재구성(2026-07-11): Keep Watching 버튼 제거 → X/빈공간 탭으로 대체 */
.win-close-x {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px;
  border: none; border-radius: 50%; background: rgba(106,84,54,0.12); color: #a9865c;
  font-size: 16px; line-height: 1; cursor: pointer; z-index: 1;
}
.win-close-x:active { background: rgba(106,84,54,0.22); transform: scale(0.94); }
/* Play Again = 시각적 1순위(가장 크게, 단 맨 위는 아님 — 보상 CTA들 다음 순서) */
.win-dialog .diff.win-primary { font-size: 21px; padding: 18px; margin-top: 14px; box-shadow: 0 6px 16px rgba(255,178,89,0.45); }
/* 공유 버튼 = 컬렉션 캐릭터 카드 느낌의 작은 타일(다른 풀폭 버튼과 구분되는 보조 액션) */
.win-share-card {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: auto; margin: 10px auto 0; padding: 8px 18px;
  border: 2px solid #ffe1ad; border-radius: 14px; background: rgba(255,255,255,0.7);
  color: #b59169; font-size: 13px; font-weight: 700; cursor: pointer;
}
.win-share-card:active { transform: scale(0.96); background: rgba(255,255,255,0.9); }
.win-share-card .wsc-ico { font-size: 15px; display: inline-flex; align-items: center; }
.win-share-card .wsc-ico img { width: 16px; height: 16px; image-rendering: pixelated; object-fit: contain; }
/* 미션 클레임 배너 = 반짝이며 유혹하는 CTA(Win a Prize! 대체, 2026-07-11) — 펄스+살짝 확대+흔들림+빛 */
.mission-bar.claimable {
  animation: missionClaimPulse 1.1s ease-in-out infinite, missionClaimGlow 1.1s ease-in-out infinite, missionClaimWiggle 2.4s ease-in-out infinite;
}
@keyframes missionClaimGlow {
  0%, 100% { filter: brightness(1); transform: scale(1); }
  50% { filter: brightness(1.18); transform: scale(1.025); }
}
@keyframes missionClaimWiggle {
  0%, 92%, 100% { rotate: 0deg; }
  94% { rotate: -1.5deg; }
  96% { rotate: 1.5deg; }
  98% { rotate: -1deg; }
}

/* 게임오버 — 귀엽게 풀죽은 캐릭터 */
.dialog.over { position: relative; }
.over-face { position: relative; width: 88px; height: 88px; margin: 0 auto 6px; }
.over-face img {
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: grayscale(0.35) brightness(0.95);
  animation: overBob 1.6s ease-in-out infinite;
  transform-origin: 50% 80%;
}
.over-tear {
  position: absolute;
  left: 62%; top: 46%;
  font-size: 16px;
  animation: overTear 1.8s ease-in infinite;
}
@keyframes overBob {
  0%,100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(4px) rotate(4deg); }
}
@keyframes overTear {
  0% { opacity: 0; transform: translateY(-2px) scale(0.7); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(16px) scale(1); }
}
.diff.ghost { background: rgba(74,63,85,0.1); color: #7a6f8a; }
/* 어두운 배경 유지 화면(튜토리얼 힌트박스)에서는 원래대로 밝은 유령버튼 */
.tutorial-box .diff.ghost { background: rgba(255,255,255,0.12); color: #fff; }

/* 설정 패널 */
/* 설정도 컬렉션처럼 전체 페이지(팝업 아님) + 좌상단 뒤로가기 */
.dialog.settings {
  position: fixed; inset: 0; width: 100%; height: 100%;
  max-width: none; max-height: none; margin: 0; border: none; border-radius: 0; box-shadow: none;
  /* 2026-07-18 — 설정 화면도 카드 컨셉과 통일된 화사한 파스텔로 */
  background: linear-gradient(160deg, #fff0f6 0%, #f5ecff 45%, #e3f7fb 100%);
  color: #4a3f55;
  display: flex; flex-direction: column; align-items: stretch;
  /* 전체화면 다이얼로그라 부모 .overlay의 padding-bottom(--banner-h)이 안 먹힘 — 여기 직접 더함 */
  padding: max(56px, calc(env(safe-area-inset-top) + 44px)) 18px calc(24px + var(--banner-h, 0px));
  overflow-y: auto; text-align: left;
}
.dialog.settings > *:not(.gacha-back) { width: 100%; max-width: 420px; margin-left: auto; margin-right: auto; }
.dialog.settings h1 { text-align: center; margin-bottom: 18px; color: #fff; background: #7a5fc0; display: inline-block; padding: 5px 20px; border-radius: 999px; box-shadow: 0 3px 0 #5d4ab0; text-shadow: none; }
.dialog.settings .row-label, .dialog.settings .toggle-row span, .dialog.settings .diff-note { font-family: 'Jua', sans-serif; }
.row { margin: 14px 0 6px; }
.row-label { font-size: 13px; opacity: 0.8; font-weight: 600; }
.seg {
  display: flex;
  gap: 6px;
}
.seg-btn {
  flex: 1 1 0;
  padding: 10px 4px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.seg-btn.on { background: #1f6e3a; border-color: #2fae5f; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px;
  font-size: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.toggle-row input { width: 20px; height: 20px; accent-color: #2fae5f; }
/* 언어 드롭다운(많은 언어 수용) */
.lang-select {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18); background: rgba(0,0,0,0.35);
  color: #fff; font-size: 15px; font-weight: 600; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'><path d='M3 5l4 4 4-4' fill='none' stroke='white' stroke-width='2'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
.lang-select option { color: #000; }
/* 설정 아이콘 그리드(CR 설정 화면 참고 — 항목마다 아이콘 타일, 탭하면 서브화면 이동 또는 즉시 토글) */
.set-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.set-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 76px; padding: 10px 4px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18); background: rgba(0,0,0,0.28);
  color: #fff; font-size: 13px; font-weight: 700; text-align: center; line-height: 1.25;
  cursor: pointer; font-family: 'Jua', sans-serif;
}
.set-tile:active { transform: scale(0.95); }
.set-ico { font-size: 25px; line-height: 1; }
.set-tile.toggle-tile.on { background: #1f6e3a; border-color: #2fae5f; }
/* 설정 카테고리 라벨(2026-07-11 재구성) — 접기 없이 그리드 안에서 풀폭 라벨로만 구분(추가 탭 불필요) */
.set-section-h { grid-column: 1 / -1; font-weight: 800; color: #fff; background: #7a5fc0; display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 12.5px; margin: 6px 0 -2px; text-shadow: none; justify-self: start; }
.set-section-h:first-child { margin-top: 0; }
/* pgsRow/iapRow/lbRow/achRow: JS가 display:none/""으로 노출 여부만 제어 → 보일 때는 그리드 셀 자체가 타일이 되도록 래퍼를 투명화 */
.set-tile-cell { display: contents; }
/* 부모용 보상형 광고 끄기(CR PARENTAL CONTROLS "DISABLE VIDEO ADS" 참고) — 켜지면 선택적 보상형 광고 버튼들을 화면에서 완전히 숨김(유료 광고제거 IAP와 별개, 무료 토글) */
body.no-video-ads #gachaFreeSpin, body.no-video-ads #winDouble, body.no-video-ads #overContinue, body.no-video-ads #adOfferOverlay { display: none !important; }
/* 보호자 설정: 인앱결제 끄기(CR PARENTAL CONTROLS 참고) — 스토어의 실제 구매 버튼을 전부 숨김(무료 토글, 2026-07-07) */
body.no-iap #storeIapRow, body.no-iap #storeSpecialHeader,
body.no-iap #storeHotHeader, body.no-iap #storeHotCard, body.no-iap #storeFeaturedCard { display: none !important; }
/* 설정 그리드에서 아직 준비 안 된 항목(리더보드/업적/클라우드저장/커뮤니티 — Play Console·Discord 설정 전)은 흐리게만 표시, 숨기지 않음 */
.set-tile-dim { opacity: 0.55; }
/* 홈 화면이 떠 있는 동안엔 실제 게임 HUD/보드/하단바만 숨김(성·마을·하늘 등 배경 장식은 그대로 비쳐 보이게 둠, CR 홈 화면 참고) */
body.home-active #topbar, body.home-active #stockbar, body.home-active #board, body.home-active #bottombar, body.home-active #adspace,
body.home-active #kStockbar, body.home-active #kBoard {
  visibility: hidden; pointer-events: none;
}
/* 오디오 서브화면: MUTE ALL(그리드 타일 재사용, 폭 100%) + Music/SFX/UI 개별 슬라이더(CR AUDIO 화면 참고) */
.audio-mute-all { width: 100%; margin-bottom: 6px; min-height: 56px; flex-direction: row; gap: 10px; }
.audio-mute-all .set-ico { font-size: 20px; }
.vol-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; }
.vol-ico { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }
.vol-label { width: 52px; font-size: 13px; font-weight: 700; flex-shrink: 0; font-family: 'Jua', sans-serif; }
.vol-slider {
  flex: 1 1 auto; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.18);
  appearance: none; -webkit-appearance: none; outline: none;
}
.vol-slider::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #ffe24d; cursor: pointer;
}
.vol-slider::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #ffe24d; border: none; cursor: pointer; }
/* ===== 콜렉션: 전체화면 픽셀아트 페이지 ===== */
.dialog.gacha {
  position: fixed; inset: 0; width: 100%; height: 100%;
  max-width: none; max-height: none; margin: 0; border: none; border-radius: 0; box-shadow: none;
  /* 2026-07-18 — 컬렉션/랭킹/기록/스토어/미션 공용 배경, 캐릭터 상세카드와 같은 화사한 파스텔로 통일 */
  background: linear-gradient(160deg, #fff0f6 0%, #f5ecff 45%, #e3f7fb 100%);
  color: #4a3f55;
  display: flex; flex-direction: column; align-items: center;
  /* 전체화면 다이얼로그라 부모 .overlay의 padding-bottom(--banner-h)이 안 먹힘 — 여기 직접 더함.
     하단 5탭 네비(고정, 2026-07-09)가 이 위에 항상 떠 있으므로 그만큼(--home-nav-h) 추가로 확보해
     스크롤 콘텐츠 맨 아래가 네비에 가리지 않게 함 */
  padding: max(18px, env(safe-area-inset-top)) 14px calc(20px + var(--banner-h, 0px) + var(--home-nav-h, 76px));
  overflow-y: auto; text-align: center;
  font-family: 'Jua', sans-serif; image-rendering: pixelated;
}
/* 메뉴 폰트 = Jua (2026-07-03 변경) — 보드/카드는 픽셀 폰트 유지 */
.dialog.gacha h1, .gacha-cat-h, .gacha-cell span, .gacha-points, .gacha-got { font-family: 'Jua', sans-serif; }
.gacha-cat-h { font-size: 17px; }
.gacha-cell span { font-size: 13px; letter-spacing: 0.3px; }
/* 돌아가기 = 좌상단 고정 위치, 크기·룩은 설정/선물 버튼(.icon-btn)과 완전히 동일(JS가 픽셀아트 아이콘으로 채움).
   ".dialog.settings > *"의 width:100% 규칙에서 :not(.gacha-back)으로 제외해뒀기 때문에 .icon-btn 자체 크기 규칙이 그대로 적용됨.
   실측(2026-07-14): #topbar/.home-top의 padding(6px 10px)과 여기 top/left가 12px/12px로 어긋나 화면 전환 시
   버튼이 살짝 튀어보였음(사용자 지적) — #topbar와 완전히 같은 좌표(6px, 10px)로 맞춤. */
.gacha-back { position: absolute; top: max(6px, env(safe-area-inset-top)); left: 10px; z-index: 2; }
.dialog.gacha h1 { color: #fff; background: #7a5fc0; display: inline-block; padding: 5px 20px; border-radius: 999px; box-shadow: 0 3px 0 #5d4ab0; text-shadow: none; letter-spacing: 1px; margin: 2px 0 6px; }
.gacha-points { font-size: 16px; margin: 2px 0 12px; color: #4a3f55; }
.gacha-points b { color: #fff; font-size: 18px; background: #ffb259; padding: 2px 12px; border-radius: 999px; box-shadow: 0 2px 0 #e08a3a; }
/* 일일 미션(길건너친구들 §5 참고 — 짧은 과제로 매일 복귀 훅) */
.mission-bar { background: rgba(0,0,0,0.24); border: 2px solid rgba(255,255,255,0.14); border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; font-size: 13px; color: #fff; text-align: left; }
.mission-bar .m-title { font-weight: 800; color: #ffd45e; margin-bottom: 3px; }
.mission-bar .m-track { background: rgba(255,255,255,0.18); border-radius: 6px; height: 8px; margin-top: 5px; overflow: hidden; }
.mission-bar .m-fill { background: linear-gradient(90deg,#ffb259,#ffe24d); height: 100%; transition: width 0.3s ease; }
.mission-bar.done .m-title { color: #7fe0a0; }
/* 결과화면 미션 클레임 배너 — 안 받았으면 눈에 띄게 펄스+살짝 확대, 탭 유도(사용자 요청) */
.mission-bar.claimable {
  cursor: pointer; border-color: #ffe24d; background: rgba(255,226,77,0.16);
  animation: missionClaimPulse 1.1s ease-in-out infinite;
}
.mission-bar.claimable .m-claim-cta { color: #ffe24d; font-weight: 800; }
.mission-bar.claimable:active { transform: scale(0.97); }
/* 데일리 탭 안 미션 목록 — 미션 여러개+마일스톤 체크리스트를 한 패널 안에(2026-07-11) */
.mission-section-h { font-weight: 800; color: #fff; background: #7a5fc0; display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 13px; margin: 10px 0 6px; text-shadow: none; }
.mission-section-h:first-child { margin-top: 2px; }
.m-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.m-row:last-child { border-bottom: none; }
.m-row-main { flex: 1 1 auto; min-width: 0; }
.m-row-title { font-size: 12.5px; font-weight: 700; margin-bottom: 3px; }
.m-row-progress { font-size: 13px; opacity: 0.8; margin-top: 2px; }
.m-row.claimed .m-row-title { opacity: 0.55; }
.m-row-claim {
  flex: 0 0 auto; background: linear-gradient(180deg,#ffe24d,#ffb259); color: #2a2230; font-weight: 800;
  font-size: 12px; border: none; border-radius: 8px; padding: 7px 12px; animation: missionClaimPulse 1.1s ease-in-out infinite;
}
.m-row-claim:active { transform: scale(0.95); }
.m-row-done { flex: 0 0 auto; font-size: 15px; }
@keyframes missionClaimPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,226,77,0.5); }
  50% { box-shadow: 0 0 0 8px rgba(255,226,77,0); }
}
.dialog.gacha #gachaDraw, .dialog.gacha #gachaClose { width: 100%; max-width: 360px; border-radius: 4px; border: 3px solid #2a2230; font-family: inherit; }
/* 기본 .diff.again(#c9a227, 탁한 겨자색)이 스토어 버튼(밝은 주황~노랑 그라디언트)보다 어두워
   "비활성화된 것처럼" 보인다는 지적(2026-07-13) — Collect 버튼만 스토어와 같은 톤으로 밝게 */
.dialog.gacha #gachaDraw:not(:disabled) { background: linear-gradient(135deg, #ffb259, #ffe24d); color: #2a2230; }
#gachaDraw:disabled { opacity: 0.5; }
.gacha-result { min-height: 0; margin: 6px 0; color: #4a3f55; width: 100%; flex-shrink: 0; } /* width 명시 안 하면 flex(align-items:center) 부모에서 내용물 크기로 쪼그라들어 자식 버튼의 100%가 같이 좁아짐. flex-shrink:0 없으면 flex 부모가 내용물 실제 높이보다 낮게 짜부러뜨려서(min-height 무시) 재도전 버튼이 아래 컬렉션 그리드 위로 삐져나옴 */
.gacha-result:not(:empty) { min-height: 72px; margin: 10px 0; }
.gacha-win-img { width: 60px; height: 60px; image-rendering: pixelated; object-fit: contain; display: block; margin: 0 auto 4px; animation: gachaWinPop .5s cubic-bezier(.2,1.7,.4,1); }
@keyframes gachaWinPop { 0% { transform: scale(.2); } 100% { transform: scale(1); } }
.gacha-grid { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 12px 0 16px; width: 100%; }
.gacha-cat { width: 100%; max-width: 380px; margin: 2px 0 10px; }
.gacha-cat-h { font-size: 16px; color: #fff; background: #7a5fc0; display: inline-block; padding: 3px 12px; border-radius: 8px; text-align: left; margin: 8px 2px 8px; letter-spacing: 1px; text-shadow: none; }
.gacha-cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gacha-cell { background: rgba(255,255,255,0.8); border: 3px solid rgba(176,111,214,0.3); border-radius: 4px; padding: 10px 4px; min-height: 86px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.gacha-cell img { width: 48px; height: 48px; image-rendering: pixelated; object-fit: contain; }
.gacha-cell span { font-size: 13px; color: #4a3f55; }
.gacha-cell.owned { border-color: #ffb84d; background: rgba(255,226,150,0.45); }
.gacha-cell.locked { cursor: pointer; } /* 카드 눌러야 구매 상세가 뜸(사용자 요청) */
.gacha-cell.locked img { filter: grayscale(1) opacity(0.75); } /* 미보유 = 흑백(사용자 요청, "?"였던 것 대체) */
.gacha-cell.locked span { opacity: 0.75; }
/* 카드세트 등장 on/off 토글(보유 캐릭터 셀, 탭으로 전환) */
.gacha-cell.owned { position: relative; cursor: pointer; }
.set-toggle { font-size: 10px; font-weight: 700; color: #2a2230; background: #ffe24d; border-radius: 999px; padding: 3px 9px; margin-top: 1px; cursor: pointer; }
.set-toggle:active { transform: scale(0.92); }
/* 캐릭터 등장 횟수(CR 컬렉션 카드 "RUNS" 참고) */
.char-runs { font-size: 9.5px; opacity: 0.7; margin-top: -2px; }
.gacha-cell.set-off { border-color: #6a6470; background: rgba(0,0,0,0.3); }
.gacha-cell.set-off img { filter: grayscale(0.85) opacity(0.55); }
.gacha-cell.set-off span { opacity: 0.5; }
.gacha-cell.set-off .set-toggle { background: #6a6470; color: #fff; }
.gacha-pop { animation: gachaBigPop .6s cubic-bezier(.2,1.8,.4,1) !important; }
@keyframes gachaBigPop { 0% { transform: scale(.3) rotate(-14deg); } 55% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
.gacha-got { font-size: 16px; font-weight: 800; color: #fff; background: #ffb259; display: inline-block; padding: 4px 16px; border-radius: 999px; box-shadow: 0 2px 0 #e08a3a; margin-top: 4px; text-shadow: none; animation: gachaGot .5s ease-out; }
@keyframes gachaGot { from { opacity: 0; transform: translateY(8px) scale(.8); } to { opacity: 1; transform: translateY(0) scale(1); } }
/* 뽑은 자리에서 바로 재도전(CR 실기기 확인: 카드 아래 "100c 다시 뽑기" 버튼) */
.gacha-redraw { margin-top: 10px; width: 100%; animation: gachaGot .5s ease-out; }
/* 획득 연출 전체화면(CR 참고 — 뽑기 결과가 콜렉션 그리드와 분리된 별도 화면으로 뜸) */
/* 완전 불투명 — CR처럼 뽑기 버튼이 있던 화면 자체를 이 화면이 통째로 대체(반투명 겹침 금지, 뒤 화면 버튼 비쳐보임 방지).
   2026-07-06: 단색 검정 대신 은은한 보라~복숭아 방사형 그라데이션 + 반짝임 파티클로 더 귀엽게(사용자 피드백: "더 귀엽고 예쁘게"). */
.reveal-overlay {
  z-index: 60;
  /* 2026-07-19 — 나머지 화면 전부와 같은 화사한 파스텔로 통일(사용자 지시: "다 해") */
  background:
    radial-gradient(circle at 50% 38%, rgba(255,214,140,0.3), transparent 55%),
    linear-gradient(165deg, #fff0f6 0%, #f5ecff 45%, #e3f7fb 100%);
  overflow: hidden;
}
.dialog.reveal {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; border: none; border-radius: 0; box-shadow: none; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 18px 22px calc(24px + var(--banner-h, 0px));
  overflow-y: auto; /* 가로모드 등 짧은 화면에서 버튼이 잘리지 않고 스크롤되게 */
  font-family: 'Jua', sans-serif;
  z-index: 1; /* .reveal-glow/.reveal-fx(z-index:0) 위에 오도록 — position은 위의 fixed 유지 */
}
/* 캐릭터·후광·반짝이 스테이지 — 화면 안 고정된 자리(top 38%)에 절대배치해서 스핀 중이든 공개 후든
   위치가 절대 안 바뀌게 함(사용자 지적: "돌 때는 가운데, 나오면 위로 감 — 통일해") */
.reveal-stage {
  position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%);
  width: min(70vw, 340px); height: min(70vw, 340px);
  display: flex; align-items: center; justify-content: center; z-index: 1;
}
/* 뒤에서 은은하게 도는 후광(캐릭터 뒤 스포트라이트) — 스테이지 정중앙에 고정 */
.reveal-glow {
  position: absolute; inset: 0; margin: auto; border-radius: 50%; z-index: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255,226,140,0.45) 0%, rgba(255,226,140,0.12) 45%, transparent 70%);
  animation: revealGlowPulse 2.6s ease-in-out infinite;
}
@keyframes revealGlowPulse { 0%, 100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.12); opacity: 1; } }
/* 기울기 시차 반짝임(캐릭터 상세와 동일 효과, 가챠 획득·캐릭터 구매상세에도 적용해 일관성 부여, 2026-07-11) —
   원형 스테이지에 맞춰 clip(overflow:hidden+border-radius)해서 사각 패턴이 밖으로 안 삐져나가게 함 */
.reveal-parallax {
  position: absolute; inset: -16%; z-index: 0; pointer-events: none; border-radius: 50%; overflow: hidden;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.16) 0 18px, transparent 18px 36px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.1) 0 22px, transparent 22px 44px);
  transition: transform 0.06s linear;
}
/* 반짝이는 별 파티클(픽셀 감성 — 작은 다이아 모양) — 스테이지 기준(약간 더 넓게 퍼지게 -25%) */
.reveal-fx { position: absolute; inset: -25%; z-index: 0; pointer-events: none; }
.reveal-spark {
  position: absolute; width: 10px; height: 10px; background: #fff6cf;
  clip-path: polygon(50% 0%, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0% 50%, 35% 35%);
  animation: revealSparkTwinkle 1.6s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgba(255,246,207,0.8));
}
.reveal-spark.s1 { top: 18%; left: 16%; width: 14px; height: 14px; animation-delay: 0s; }
.reveal-spark.s2 { top: 28%; left: 78%; width: 9px; height: 9px; animation-delay: 0.3s; }
.reveal-spark.s3 { top: 62%; left: 10%; width: 8px; height: 8px; animation-delay: 0.6s; }
.reveal-spark.s4 { top: 68%; left: 84%; width: 12px; height: 12px; animation-delay: 0.9s; }
.reveal-spark.s5 { top: 10%; left: 52%; width: 7px; height: 7px; animation-delay: 1.1s; }
.reveal-spark.s6 { top: 78%; left: 46%; width: 10px; height: 10px; animation-delay: 0.45s; }
@keyframes revealSparkTwinkle { 0%, 100% { opacity: 0.15; transform: scale(0.6) rotate(0deg); } 50% { opacity: 1; transform: scale(1) rotate(25deg); } }
/* 캐릭터 크기 = 마을 캐릭터(.villager, 8.6vw)와 비슷한 체감 스케일로 축소(사용자 피드백: "캐릭터가 너무 커") —
   다만 뽑기 연출의 임팩트를 위해 스테이지(후광+반짝이)는 크게 유지하고 캐릭터 자체만 줄임 */
.reveal-img { position: relative; z-index: 1; width: min(24vw, 108px); height: min(24vw, 108px); image-rendering: pixelated; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(0,0,0,0.5)); }
/* 스핀/공개 텍스트+버튼 — 스테이지와 완전히 분리된 별도 블록(화면 하단에 고정), 스테이지 위치에 영향 안 줌 */
.reveal-info { display: flex; flex-direction: column; align-items: center; width: 100%; z-index: 1; }
.reveal-got { font-size: 18px; font-weight: 800; color: #fff; background: #ffb259; display: inline-block; padding: 6px 20px; border-radius: 999px; box-shadow: 0 3px 0 #e08a3a; margin: 0 0 26px; text-shadow: none; text-align: center; animation: gachaGot .5s ease-out; min-height: 1.4em; }
.reveal-again, .reveal-close { width: min(320px, 100%); }
/* 잠긴 캐릭터 구매 상세(CR 참고: 캐릭터는 위 고정, 가격버튼은 아래에서 제자리로 올라옴) —
   배경은 가챠 획득연출(.reveal-overlay)과 동일 재사용(사용자 요청) */
/* char-buy-img/.char-buy-name(2026-07-16 삭제) — 아이템 상세뷰를 캐릭터 카드와 완전히 같은 형식으로
   통일하면서 char-detail-img/.char-detail-name을 그대로 재사용하게 됨(카드 밖 재지시 참고) */
.char-buy-btn { width: min(320px, 100%); font-family: 'Jua', sans-serif; } /* 가격 텍스트 폰트 명시(2026-07-16 재지시) */
.buy-lock-ico { width: 1.1em; height: 1.1em; vertical-align: -0.2em; image-rendering: pixelated; margin-right: 2px; } /* 이모지 대신 픽셀 자물쇠(2026-07-16) */
@keyframes charBuyBtnRise { from { transform: translateY(70px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.char-buy-btn.rise { animation: charBuyBtnRise 0.45s cubic-bezier(.2,.8,.3,1); }

/* ===== 홈 화면(길건너친구들 참고: 별도 타이틀 화면 + 하단 5탭 네비, 2026-07-06) ===== */
.home-overlay {
  /* z-index 명시 안 함 — DOM 순서(다른 오버레이들보다 먼저 등장)만으로 항상 맨 아래에 깔림.
     설정/랭킹/기록/스토어/컬렉션 등은 전부 DOM에서 더 뒤에 있어 자동으로 홈 위에 그려짐(스택 규칙 참고: style.css 상단 주석 없음, z-index:auto 형제간은 DOM 순서로 페인트). */
  /* 배경 없음(투명) — CR 홈 화면처럼 실제 게임 장면(성·마을·거미 등 캐릭터, #scene/#village)이 뒤에서 그대로 비쳐 보이게(2026-07-07 수정: 예전엔 불투명 그라데이션으로 다 가려버렸음) */
  background: transparent;
  backdrop-filter: none; /* .overlay 기본 blur(3px)를 취소 — CR처럼 배경 장면이 또렷하게 보여야 함(투명화하니 blur가 그제야 드러남) */
  flex-direction: column; align-items: stretch; justify-content: space-between;
  /* safe-area-top에 14px 최소값을 더 얹었었는데, 인게임 #topbar는 body의 safe-area-top 패딩 위에
     자기 패딩(6px)만 더하는 구조라 최소값이 없음 — 그래서 인셋이 작은 기기에서 홈 설정/골드 위치가
     인게임보다 아래로 밀려 보였음(사용자 실측 지적, 2026-07-13). 최소값 제거해 정확히 같은 공식으로 맞춤. */
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
/* 예전엔 검정 그라디언트 패널이 있었는데 하늘색과 안 어우러져 딱 잘린 가로줄처럼 보였음(사용자 지적,
   플레이 화면 #topbar처럼 배경 없이 하늘이 그대로 비치게) — 패널 자체를 없앰 */
/* #topbar와 정확히 같은 패딩(6px 10px)으로 맞춰 설정버튼·골드 위치가 인게임과 동일한 자리에 오게 함(2026-07-13) */
.home-top { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; }
.home-currency { color: #fff; }
.home-currency .label { margin-right: 4px; }
/* CR 홈화면 재화 숫자 참고 — 눈에 확 띄게 크게(기본 .stat 18px보다 훨씬 큼) */
.home-currency span:last-child { font-size: clamp(24px, 7vw, 32px); font-weight: 800; text-shadow: 1px 2px 0 rgba(0,0,0,0.35); }
.home-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 6px; pointer-events: none; }
.home-logo { font-size: clamp(22px, 7vw, 34px); font-weight: 800; color: #fff; text-shadow: 3px 3px 0 #2a2230; font-family: 'Jua', sans-serif; letter-spacing: 1px; }
/* 브랜드명(위, 크게) 아래에 장르 서브타이틀(작게) — 홈화면에 풀네임이 다 보이게(2026-07-13, 브랜드만 있던 걸 수정) */
.home-logo-sub { font-size: clamp(13px, 4vw, 19px); font-weight: 700; color: #fff; text-shadow: 2px 2px 0 #2a2230; font-family: 'Jua', sans-serif; letter-spacing: 0.5px; margin-top: 2px; opacity: 0.92; }
@keyframes homeSpiderBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
/* 독립 요소로 분리(2026-07-09) — 홈 화면뿐 아니라 콜렉션/랭킹/기록/스토어 어디서든 항상 위에 떠서 탭 전환 가능.
   home-active일 때만(게임 플레이 중엔 숨김) — 이 프로젝트는 명시적 z-index를 웬만하면 안 쓰지만(DOM 순서로 스택),
   이 nav만은 body 어디에 있든 항상 최상단이어야 해서 fixed+z-index가 유일하게 정당한 예외. */
body:not(.home-active) .home-nav { display: none; }
/* 네비는 z-index 최상단이라(위 주석) 설정·크레딧·캐릭터 구매상세 등 그 위에 뜨는 서브화면의 내용(특히
   하단에 붙는 닫기/확인 버튼)을 가려버림(실측: 캐릭터 구매상세의 "OK" 버튼이 네비에 잘려 안 보이고
   눌리지도 않던 사건, 2026-07-11) — 이런 서브화면이 열려있는 동안엔 네비 자체를 숨김 */
body:has(#settingsOverlay.show, #parentalSubOverlay.show, #communitySubOverlay.show, #langSubOverlay.show,
  #orientSubOverlay.show, #audioSubOverlay.show, #creditsOverlay.show, #howOverlay.show,
  #charDetailOverlay.show, #charBuyOverlay.show, #gachaRevealOverlay.show, #rankOverlay.show) .home-nav { display: none; }
.home-nav {
  /* 네이티브 광고배너(ads.js)는 웹뷰 밖 별도 레이어라 CSS z-index로 못 가려짐 — bottom:0 그대로 두면
     배너가 네비 위(정확히는 같은 화면 영역)에 그려져서 탭이 배너로 가로채짐(실측 확인: Collection 탭인 줄
     알고 눌렀는데 광고가 열림) → 네비 전체를 배너 높이(--banner-h)만큼 위로 띄워서 겹침 자체를 없앰 */
  position: fixed; left: 0; right: 0; bottom: var(--banner-h, 0px); z-index: 150;
  /* align-items:stretch(기본값) — 버튼마다 내용물 높이로 제각각 늘어나면 구분선 길이도 들쭉날쭉해짐
     (사용자 지적) → 5칸 전부 같은 행 높이로 꽉 채워서 구분선이 끊김 없이 위아래 끝까지 똑같이 그어지게 */
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 6px 10px;
  /* 반투명 그라디언트 대신 완전 불투명(사용자 지적: 메뉴 뒤가 비치지 않게) */
  background: #2a2230;
}
.home-nav-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; color: #fff; font-family: 'Jua', sans-serif;
  font-size: 10.5px; padding: 8px 2px; cursor: pointer; opacity: 0.88;
  transition: transform 0.08s ease, opacity 0.08s ease; /* CR 참고: 눌렀을 때 스냅있게 눌리는 모션 */
}
/* 안 받은 보상 알림(2026-07-11): 승리창에서 미션 보상을 안 받고 넘어갔을 때 홈 하단 메뉴에서 다시 유도 */
.nav-badge-dot {
  position: absolute; top: 4px; right: 22%; width: 9px; height: 9px; border-radius: 50%;
  background: #ff4d4f; border: 1.5px solid #2a2230; display: none;
}
.home-nav-btn.has-badge .nav-badge-dot { display: block; }
.home-nav-btn.has-badge .home-nav-ico { animation: navBellShake 1.8s ease-in-out infinite; }
@keyframes navBellShake {
  0%, 80%, 100% { transform: rotate(0deg); }
  82% { transform: rotate(-14deg); } 84% { transform: rotate(12deg); }
  86% { transform: rotate(-10deg); } 88% { transform: rotate(8deg); }
  90% { transform: rotate(-4deg); } 92% { transform: rotate(0deg); }
}
/* 메뉴 사이 구분선(픽셀아트풍 — 부드러운 그라디언트 없이 딱 떨어지는 단색 세로선, 버튼이 행 전체 높이로
   꽉 차 있어야(위 stretch) 구분선도 위아래 끝까지 끊김 없이 일정하게 그어짐, 사용자 요청) */
.home-nav-btn:not(:first-child) { border-left: 3px solid #453a5c; }
.home-nav-btn:active { transform: scale(0.88); opacity: 1; }
.home-nav-ico { font-size: 22px; line-height: 1; position: relative; transition: transform 0.22s cubic-bezier(.34,1.56,.64,1); }
.home-nav-ico img, .home-nav-play-ico img { transition: transform 0.08s ease; }
/* CR 참고: 현재 열려있는 화면의 탭은 아이콘이 위로 튀어올라 회전하며 살짝 커지고, 뒤에 원형 하이라이트가
   생기고 글씨색이 포인트색으로 바뀜(2026-07-13) — 오버레이 자체의 .show 클래스를 body:has()로 그대로
   참조해 별도 JS 상태 관리 없이 항상 실제 화면 상태와 일치하게 함 */
body:has(#gachaOverlay.show) #navCollection,
body:has(#missionsOverlay.show) #navMissions,
body:has(#statsOverlay.show) #navStats,
body:has(#storeOverlay.show) #navStore {
  color: #ffd76a;
}
body:has(#gachaOverlay.show) #navCollection .home-nav-ico,
body:has(#missionsOverlay.show) #navMissions .home-nav-ico,
body:has(#statsOverlay.show) #navStats .home-nav-ico,
body:has(#storeOverlay.show) #navStore .home-nav-ico {
  transform: translateY(-11px) rotate(-10deg) scale(1.18);
}
body:has(#gachaOverlay.show) #navCollection .home-nav-ico::before,
body:has(#missionsOverlay.show) #navMissions .home-nav-ico::before,
body:has(#statsOverlay.show) #navStats .home-nav-ico::before,
body:has(#storeOverlay.show) #navStore .home-nav-ico::before {
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,215,106,0.45), rgba(255,215,106,0) 70%);
  z-index: -1;
}
/* 플레이 버튼 = 다른 4개와 완전히 같은 스타일(배경 박스 없이, 사용자 지적으로 강조 배경 제거, 2026-07-10) —
   다른 4개 버튼과 마찬가지로 아이콘+라벨만, 특별 취급 없음 */
.home-nav-play { opacity: 1; }
.home-nav-play:active { transform: scale(0.9); }
/* 하단중앙 플레이 버튼 = 홈 화면 거미 마스코트 자체(CR 참고: 치킨 아이콘이 하단중앙 플레이 버튼) —
   예전엔 위쪽에 큰 거미가 따로 떠있고 버튼엔 삼각형 아이콘이었는데, 거미를 버튼 아이콘 자리로 옮김 */
.home-nav-play-ico { width: clamp(30px, 9vw, 40px); image-rendering: pixelated; animation: homeSpiderBob 2.2s ease-in-out infinite; }

/* ===== 개인 기록 / 스토어 (홈 하단 탭 화면) ===== */
/* 승리/패배 도넛(다른 솔리테어 앱 "통계" 화면 참고, 2026-07-07) */
.stats-donuts { display: flex; gap: 12px; width: 100%; max-width: 380px; margin: 6px 0 4px; }
.stats-donut-card { flex: 1; background: #eef1ee; border-radius: 14px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.stats-donut {
  width: 76px; height: 76px; border-radius: 50%; position: relative; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(#2fce7f calc(var(--pct, 0) * 1%), rgba(0,0,0,0.12) 0);
}
.stats-donut.loss { background: conic-gradient(#ff5f7a calc(var(--pct, 0) * 1%), rgba(0,0,0,0.12) 0); }
.stats-donut::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: #eef1ee; }
.stats-donut span { position: relative; z-index: 1; font-family: 'Jua', sans-serif; font-size: 12px; font-weight: 800; color: #2a2230; text-align: center; line-height: 1.3; }
.sd-label { font-family: 'Jua', sans-serif; font-size: 12px; color: #2a2230; opacity: 0.75; }
.stats-grid { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 380px; margin-top: 6px; }
.stats-row {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.7); border-radius: 12px; padding: 12px 16px; color: #4a3f55;
}
.stats-row .sr-label { font-size: 13.5px; opacity: 0.85; color: #4a3f55; }
.stats-row .sr-value { font-size: 15px; font-weight: 800; color: #fff; background: #ffb259; padding: 2px 10px; border-radius: 999px; }
/* 상위 3개 강조 카드(2026-07-11) — 최고점수·연승·플레이판수를 도넛 옆에 시각적으로 띄움 */
.stats-highlights { display: flex; gap: 10px; width: 100%; max-width: 380px; margin: 4px 0 8px; }
.stats-hi-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: linear-gradient(160deg, rgba(255,178,59,0.18), rgba(255,178,59,0.05));
  border: 1.5px solid rgba(255,178,59,0.4); border-radius: 14px; padding: 10px 6px; color: #4a3f55;
}
.stats-hi-card .shi-ico { font-size: 20px; line-height: 1; }
.stats-hi-card .shi-val { font-size: 16px; font-weight: 900; color: #fff; background: #ffb259; padding: 1px 10px; border-radius: 999px; display: inline-block; }
.stats-hi-card .shi-label { font-size: 10px; opacity: 0.8; text-align: center; line-height: 1.2; }
/* 나머지 상세 기록은 탭 없이 스크롤로만 — 라벨 하나만 두고 압축된(더 작은) 행으로 계속 이어짐 */
.stats-detail-h { width: 100%; max-width: 380px; font-size: 11.5px; font-weight: 800; color: rgba(74,63,85,0.6); text-transform: uppercase; letter-spacing: .5px; margin: 4px 0 2px; }
.stats-grid-compact { gap: 4px; }
.stats-grid-compact .stats-row { padding: 7px 14px; border-radius: 8px; background: rgba(255,255,255,0.6); }
.stats-grid-compact .sr-label { font-size: 12px; opacity: 0.75; color: #4a3f55; }
.stats-grid-compact .sr-value { font-size: 12.5px; font-weight: 700; color: #fff; background: #ffb259; padding: 1px 9px; border-radius: 999px; }
.store-dialog .gacha-points { margin-bottom: 18px; }
.store-desc { color: #4a3f55; opacity: 0.75; font-size: 14px; text-align: left; margin: 4px 0 14px; line-height: 1.4; }

/* ===== 스토어 카드(CR STORE 탭 실측 구조 참고: 섹션헤더+아트+제목+설명+가격버튼, 2026-07-09) ===== */
.store-dialog .store-sec-h {
  width: 100%; max-width: 380px; font-size: 14px; color: #ffe24d; text-align: left;
  margin: 16px 2px 8px; letter-spacing: 1px; text-shadow: 2px 2px 0 #2a2230;
}
.store-dialog .store-sec-h:first-of-type { margin-top: 2px; }
.store-card {
  width: 100%; max-width: 380px; background: rgba(0,0,0,0.28); border: 3px solid #2a2230; border-radius: 10px;
  padding: 14px; margin: 0 0 12px; text-align: left; position: relative;
}
.store-card-badge {
  position: absolute; top: -10px; left: 12px; background: #e05a7a; color: #fff; font-size: 11px; font-weight: 800;
  padding: 3px 8px; border-radius: 6px; border: 2px solid #2a2230; letter-spacing: 0.3px;
}
/* 신규유저 스타터팩(2026-07-11) — 축하하는 느낌의 금색 강조 테두리로 다른 카드와 구분 */
.store-card-starter { border-color: #ffd45e; box-shadow: 0 0 0 2px rgba(255,212,94,0.35); }
.store-card-starter .store-card-badge { background: #ffb259; color: #2a2230; }
.store-card-art { display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.store-card-art img { width: 60px; height: 60px; image-rendering: pixelated; object-fit: contain; }
.store-card-art-emoji { font-size: 40px; text-align: center; line-height: 1; }
/* 스토어 동적 연출(2026-07-13 사용자 지적: "너무 정적") — Hot Stuff는 급박함이 느껴지게 아이콘 펄스+뱃지 펄스.
   실측 버그: filter(drop-shadow) 애니메이션 + overflow:hidden 조합이 이 웹뷰에서 카드 내용 전체가
   렌더링 안 되는(DOM엔 있는데 화면엔 안 보이는) 페인트 버그를 일으켜서 transform만 쓰는 방식으로 교체. */
.store-card-hot .store-card-art img { animation: hotArtPulse 1.6s ease-in-out infinite; }
@keyframes hotArtPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.store-card-hot .store-card-badge { animation: missionClaimPulse 1s ease-in-out infinite; }
.store-card-title { font-family: 'Jua', sans-serif; font-size: 15px; font-weight: 800; color: #fff; text-align: center; margin-bottom: 4px; }
.store-card-desc { color: #fff; opacity: 0.75; font-size: 14px; line-height: 1.4; margin: 0 0 10px; text-align: center; }
/* 패키지 구성요소 미리보기(2026-07-13, CR 참고) — 골드/캐릭터 등 실제로 뭐가 들어있는지 그림으로 */
.store-card-contents { display: flex; justify-content: center; gap: 8px; margin: 0 0 10px; }
.store-card-contents img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; background: rgba(0,0,0,0.25); border-radius: 8px; padding: 4px; }
/* 완주 임박 위시리스트 배너(2026-07-11) — 남은 개수가 적을 때만 스토어 최상단에 노출 */
.wishlist-banner {
  background: linear-gradient(135deg, rgba(255,178,89,0.28), rgba(255,226,77,0.14));
  border: 2px solid #ffd45e; border-radius: 12px; padding: 10px 12px; margin: 4px 0 14px; text-align: center;
}
.wl-text { color: #fff; background: #ffb259; display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 800; font-size: 13.5px; margin-bottom: 8px; }
.wl-icons { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.wl-icons img { width: 32px; height: 32px; image-rendering: pixelated; object-fit: contain; filter: brightness(0) saturate(100%) invert(1); opacity: 0.85; }
/* 데일리 선물 7일 스트릭 캘린더(2026-07-11) — Coin Master류 로그인 캘린더를 소박한 톤으로 축소 적용 */
.dg-calendar { display: flex; gap: 4px; justify-content: center; margin: 0 0 10px; }
.dg-day {
  flex: 1; max-width: 42px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(74,63,85,0.08); border: 1.5px solid rgba(74,63,85,0.18); border-radius: 8px; padding: 5px 2px;
  color: #4a3f55; opacity: 0.65;
}
.dg-day.done { background: rgba(47,174,95,0.35); border-color: #2fae5f; opacity: 1; }
.dg-day.next { background: rgba(255,226,77,0.22); border-color: #ffe24d; opacity: 1; animation: missionClaimPulse 1.3s ease-in-out infinite; }
.dg-day-n { font-size: 9.5px; opacity: 0.8; }
.dg-day-r { font-size: 10.5px; font-weight: 800; color: #ffe24d; }
.store-card-buy {
  display: block; margin: 0 auto; background: linear-gradient(135deg, #ffb259, #ffe24d); color: #2a2230;
  font-weight: 800; border: 3px solid #2a2230; border-radius: 8px; padding: 8px 18px; font-size: 14px;
  font-family: 'Jua', sans-serif; cursor: pointer; min-width: 120px;
}
.store-card-buy:active { transform: scale(0.97); }
.store-card-buy:disabled { opacity: 0.55; }
.store-card-buy s { opacity: 0.6; margin-right: 6px; font-weight: 600; font-size: 11.5px; }
.store-card-buy-wide { display: block; width: 100%; }
/* 데일리 선물 광고 더블업(2026-07-17) — 무료 클레임보다 항상 작고 은은하게(승리창 스택킹 실수 재발 방지,
   무료 쪽이 시각적으로 우세해야 함) */
.store-daily-double { margin-top: 6px; padding: 5px 14px; font-size: 12px; min-width: 0; background: linear-gradient(135deg, #8a7fb0, #a89fd0); opacity: 0.92; }
/* 프라이즈머신 가격 — "100G" 문자 대신 홈 우상단 재화 표시와 같은 톤(굵은 비-Jua 폰트 + 코인 아이콘, 2026-07-16) */
.store-card-buy .coin-ico { width: 1.15em; height: 1.15em; vertical-align: -0.18em; margin-right: 3px; }
.store-price-num { font-family: -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif; font-weight: 800; font-size: 1.3em; }
.store-featured { padding-bottom: 8px; }
.store-feat-row { display: flex; gap: 10px; justify-content: space-between; }
.store-feat-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
/* 피처 캐릭터도 가만히 있지 않고 살짝 흔들어서 눈길이 가게(2026-07-13, "너무 정적" 지적) — 카드마다 타이밍 어긋나게 */
.store-feat-item img { width: 48px; height: 48px; image-rendering: pixelated; object-fit: contain; animation: featBounce 1.8s ease-in-out infinite; }
.store-feat-item:nth-child(2) img { animation-delay: 0.3s; }
.store-feat-item:nth-child(3) img { animation-delay: 0.6s; }
@keyframes featBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.store-feat-buy {
  background: linear-gradient(135deg, #ffb259, #ffe24d); color: #2a2230; font-weight: 800; border: 2px solid #2a2230;
  border-radius: 999px; padding: 4px 10px; font-size: 11.5px; font-family: 'Jua', sans-serif; cursor: pointer;
}
.store-feat-buy:disabled { opacity: 0.55; }
.store-card.store-featured .store-sec-h { margin: 10px 2px 0; }
.rank-dialog .how-body { color: #4a3f55; opacity: 0.75; margin-top: 10px; }

/* ===== 캐릭터 상세 카드(CR 컬렉션 카드 참고: 이름+아트+RUNS/TOP SCORE+찜+공유+좌우 넘기기+3D 시차, 2026-07-06) ===== */
.char-detail-overlay {
  /* 2026-07-18 재지시 — 어두운 배경 대신 화사하고 귀여운 파스텔 그라데이션으로 */
  background: linear-gradient(160deg, #fff0f6 0%, #f5ecff 45%, #e3f7fb 100%);
  padding: 0; /* 2026-07-16 레이아웃 재설계 — 아래 고정 헤더/스크롤/고정 푸터가 각자 여백을 전담 */
} /* z-index 명시 안 함 — DOM상 컬렉션(gachaOverlay)보다 뒤에 있어 자동으로 그 위에 그려짐 */
/* 상단 고정 헤더(뒤로가기·찜·공유/닫기) — 카드 길이와 무관하게 항상 같은 자리(2026-07-16 재지시:
   "카드 길이가 달라진다고 버튼 위치가 달라질 일 없게") */
.char-detail-fixed-back, .char-detail-fixed-fav, .char-detail-fixed-share {
  position: absolute; top: max(12px, env(safe-area-inset-top)); z-index: 5;
}
.char-detail-fixed-back { left: 12px; }
.char-detail-fixed-fav { right: 68px; font-size: 18px; }
.char-detail-fixed-share { right: 12px; }
/* 2026-07-19 재지시("공썸처럼 슬라이드 제대로 구현") — gongssum(Expo 프로젝트)의 FlatList
   snapToInterval+decelerationRate 패턴을 웹 등가물(CSS scroll-snap + 네이티브 관성 스크롤)로 이식.
   커스텀 포인터 트래킹·고정시간 CSS 트랜지션을 전부 걷어내고 브라우저 자체 스크롤 물리에 맡김 —
   손가락 추적/관성/스냅 전부 브라우저가 처리하므로 구조적으로 끊김·점프가 있을 수 없음.
   이전/현재/다음 3칸(cd-slot)짜리 가로 트랙, 가운데 칸에서 시작 → scrollend에서 내용 교체 후
   가운데로 즉시 리센터(무한 캐러셀 표준 기법) */
.char-detail-hscroll {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.char-detail-hscroll::-webkit-scrollbar { display: none; }
.cd-slot { flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: start; overflow: hidden; }
.cd-slot-cur { overflow: visible; } /* 안쪽 .char-detail-scroll이 세로 스크롤을 직접 담당 */
/* 옆칸 미리보기(스와이프 중에만 살짝 보임) — 무거운 미니씬/배지 없이 이미지+이름만(실제 카드로 정착된
   뒤에야 showDetailAt()이 무거운 진짜 카드를 그림) */
.cd-slot-peek { display: flex; align-items: flex-start; justify-content: center; padding: 92px 0 0; }
.cd-slot-peek .char-detail-wrap { width: min(84vw, 340px); margin: 0 auto; }
.cd-slot-peek .char-detail-bio { display: none; }
/* 카드 스크롤 영역 — 고정 헤더 밑에서 시작, 고정 하단 버튼 자리를 항상 비워둠(2026-07-18: 상단 버튼과
   살짝 겹치던 것 지적 반영 — 64px→92px로 여유 확대) */
.char-detail-scroll {
  height: 100%; overflow-y: auto;
  padding: 92px 0 calc(88px + var(--banner-h, 0px));
}
/* 카드 래퍼(2026-07-16) — 구매버튼은 이제 오버레이 하단에 고정되는 별도 형제 요소라 여기엔 카드 하나만 */
.char-detail-wrap { width: min(84vw, 340px); margin: 0 auto; }
/* 2026-07-18 재지시 — 카드 자체 배경(.dialog 기본값 #143d22 짙은 초록)도 어둡지 않게, 화사한 크림톤 + 은은한
   보라 테두리로. 그림자도 검정 대신 스테이지 그라데이션과 어울리는 보라 톤으로 */
.char-detail {
  position: relative; width: 100%; padding: 18px; perspective: 700px;
  background: #fff8f3; border: 1px solid rgba(176,111,214,0.28);
  box-shadow: 0 10px 30px rgba(120,90,180,0.22);
}
/* 하단 고정 구매버튼 — 배너 광고 위, 카드 길이와 무관하게 항상 같은 자리(2026-07-16 재지시) */
.char-detail-fixed-buy {
  position: absolute; left: 50%; bottom: calc(14px + var(--banner-h, 0px)); transform: translateX(-50%);
  width: min(84vw, 340px); margin: 0; z-index: 5;
}
/* 실측 버그: .icon-btn 실제 너비(~50px)가 fav/share 사이 간격(54-12=42px)보다 커서 겹쳤음 — 간격 확대 */
.char-fav-btn { font-size: 18px; }
/* 선택 전후 가시성 개선(2026-07-16, "선택 전에도 찜한 것처럼 보임" 지적) — 하트 아이콘 자체가 이미
   분홍색 픽셀아트(ICON_PAL.P #ff6b9d)라 예전엔 opacity(0.65)만으로 껐다 켰다 해서 꺼진 상태도 여전히
   "찜된 것처럼" 보였음. "옆 공유 버튼과 같은 색으로" 재지시 — 공유 아이콘은 ICON_PAL.A(#ffffff, 순백)라,
   brightness(0)로 전부 검게 만든 뒤 invert(1)로 뒤집어 원본 색상과 무관하게 정확히 순백으로 맞춤
   (grayscale+brightness 근사치 대신 공유 아이콘과 완전히 동일한 흰색 보장). */
.char-fav-btn img { filter: brightness(0) invert(1); }
.char-fav-btn.on img { filter: none; }
.char-fav-btn.on { background: rgba(255,95,122,0.28); }
.char-share-btn { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 2; }
.char-detail-stage {
  position: relative; width: 100%; aspect-ratio: 4/3; border-radius: 16px; overflow: hidden;
  background: linear-gradient(135deg, #4fd1e0 0%, #6c8cf0 55%, #b06fd6 100%);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.char-detail-parallax {
  position: absolute; inset: -22%; z-index: 0; pointer-events: none;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.10) 0 18px, transparent 18px 36px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.07) 0 22px, transparent 22px 44px);
  transition: transform 0.06s linear;
}
.char-detail-name {
  position: absolute; top: 10px; left: 10px; z-index: 1; background: #fff; color: #2a2230;
  font-family: 'Jua', sans-serif; font-size: 14px; font-weight: 800; padding: 6px 12px; border-radius: 8px;
}
.char-detail-img {
  position: relative; z-index: 1; width: 46%; max-width: 130px; image-rendering: pixelated; object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,0.35));
  /* 등장 팝인(1회) + 계속 반복되는 숨쉬기 모션(2026-07-16 재지시 — "가만히 있지 말고") — 팝인 끝난 뒤 시작 */
  animation: charDetailPop .4s cubic-bezier(.2,1.6,.4,1), charDetailIdle 2.6s ease-in-out .4s infinite;
}
@keyframes charDetailPop { 0% { transform: scale(.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes charDetailIdle { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4%) scale(1.015); } }
/* 미보유 캐릭터 상세뷰 — 그리드 셀의 흑백 처리(.gacha-cell.locked img)와 동일 원칙(2026-07-16) */
.char-detail-img.char-detail-img-locked { filter: grayscale(1) opacity(0.8) drop-shadow(0 10px 14px rgba(0,0,0,0.35)); }
/* 카드 밖으로 뺀 구매버튼(2026-07-16, 가격표시가 카드 안에 있는 게 어색하다는 재지시) — .char-detail-wrap의
   너비를 그대로 물려받아 카드와 폭이 맞음 */
.char-detail-buy { margin: 0; width: 100%; font-family: 'Jua', sans-serif; }
/* 캐릭터 소개 문구(2026-07-16) — 카드 아래 상시 노출, 공유 캡처에도 포함되도록 #charDetailCard 안에 배치 */
.char-detail-bio {
  margin: 10px 0 0; background: rgba(255,255,255,0.9); border-radius: 12px; padding: 12px 16px;
  font-family: 'Jua', sans-serif; color: #4a3f55; font-size: 13px; line-height: 1.55; text-align: center;
}
/* Runs/Top Score 기록칸 삭제 + 구매버튼까지 카드 밖으로 빼서 생긴 공간을 소개글에 몰아줌(2026-07-16) —
   카드 폭(~304px) 안에서 문구가 안 잘리고 넉넉히 읽히는 최대치로 키움 */
.char-detail-bio-lg { padding: 18px 18px; font-size: 19px; line-height: 1.65; }
/* 좌우 넘기기 버튼(2026-07-18 재설계) — 카드 안이 아니라 오버레이(=화면 전체) 기준 세로 가운데 고정.
   카드 길이나 스크롤 위치가 달라져도 항상 같은 자리 */
.char-detail-nav { position: absolute; top: 50%; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 10px; transform: translateY(-50%); z-index: 4; pointer-events: none; }
.char-nav-btn { pointer-events: auto; }
#charDetailNext .ico-img, #charBuyNext .ico-img { transform: scaleX(-1); } /* 뒤로가기 화살표(‹) 재사용 → 다음 버튼은 좌우 반전해서 › 모양으로(2026-07-18: 아이템 상세뷰도 통일) */
/* 승리 팝업 포인트 + 난이도 설명 */
.win-points { font-size: 15px; font-weight: 800; color: #f0913c; margin: -6px 0 12px; }
/* 포인트 단계별 연출(쿵쿵쿵 → 쿠웅) */
.win-points.revealing { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 96px; }
.wp-rows { display: flex; flex-direction: column; gap: 5px; width: min(252px, 76vw); }
.wp-row { display: flex; align-items: center; gap: 8px; padding: 5px 13px;
  background: rgba(255,255,255,0.74); border: 2px solid #ffe1ad; border-radius: 12px;
  opacity: 0; transform: translateY(8px) scale(.8); transform-origin: 50% 50%; }
.wp-row.show { opacity: 1; transform: none; }
.wp-row .wp-ico { font-size: 16px; line-height: 1; }
.wp-row .wp-lbl { font-size: 13px; color: #b07b3a; font-weight: 800; flex: 1; text-align: left; }
.wp-row .wp-val { font-size: 18px; font-weight: 900; color: #ee8a2f; }
.wp-row.wp-pump { animation: wpPump .42s cubic-bezier(.18,1.7,.4,1); }
@keyframes wpPump { 0% { transform: scale(1.5); } 58% { transform: scale(.93); } 100% { transform: scale(1); } }
.wp-total { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 4px;
  opacity: 0; transform: scale(.6); transition: opacity .18s ease, transform .18s ease; }
.wp-total.show { opacity: 1; transform: none; }
.wp-total .wp-total-num { font-size: clamp(32px, 11vw, 50px); font-weight: 900; color: #ff7a1a;
  line-height: 1; text-shadow: 0 2px 0 #fff, 0 0 16px rgba(255,150,40,0.55); }
.wp-total .wp-total-suffix { font-size: 16px; font-weight: 800; color: #f0913c; }
.wp-total .gift-ico { width: 1.35em; height: 1.35em; vertical-align: -0.28em; }
.wp-total.wp-boom { animation: wpBoom .62s cubic-bezier(.2,1.8,.35,1); }
@keyframes wpBoom { 0% { transform: scale(2.05); filter: brightness(1.9); } 44% { transform: scale(.86); } 70% { transform: scale(1.12); } 100% { transform: scale(1); filter: none; } }
.win-dialog.shake { animation: winShake .62s cubic-bezier(.36,.07,.19,.97); }
@keyframes winShake {
  0%,100% { transform: translate(0,0) rotate(0); }
  10% { transform: translate(-8px,4px) rotate(-1.5deg); }
  22% { transform: translate(9px,-5px) rotate(1.5deg); }
  36% { transform: translate(-7px,5px) rotate(-1deg); }
  52% { transform: translate(7px,-4px) rotate(1deg); }
  68% { transform: translate(-5px,3px) rotate(-.6deg); }
  84% { transform: translate(4px,-2px) rotate(.4deg); }
}
.wp-flash { position: fixed; inset: 0; z-index: 99; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(255,240,200,0.85), rgba(255,220,150,0) 62%);
  animation: wpFlash .42s ease-out forwards; }
@keyframes wpFlash { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }
.wp-spark { position: fixed; width: 8px; height: 8px; border-radius: 50%; z-index: 100; pointer-events: none;
  animation: wpSpark .55s ease-out forwards; }
@keyframes wpSpark { 0% { transform: translate(0,0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
.diff-note { font-size: 14px; opacity: 0.78; margin: 7px 2px 0; line-height: 1.45; }

/* 게임방법(튜토리얼) */
.dialog.how { position: relative; }
.how-emoji { font-size: 64px; line-height: 1; margin: 6px 0 8px; }
.rate-emoji { font-size: 56px; line-height: 1; margin: 6px 0 8px; }
.remind-emoji { font-size: 56px; line-height: 1; margin: 6px 0 8px; }
.how-img { width: 100%; border-radius: 10px; image-rendering: pixelated; margin: 0 0 10px; display: block; }
.how-body { font-size: 15px; line-height: 1.5; opacity: 0.92; min-height: 4.2em; margin: 6px 0 12px; }
/* 크레딧 화면(2026-07-13, CR 참고 재설계) — 마스코트+타이틀카드+섹션별 카드리스트로 재구성(예전엔 통 텍스트 한 덩이) */
.credits-dialog { overflow-y: auto; max-height: 82vh; }
.credits-mascot { width: 72px; height: 72px; image-rendering: pixelated; object-fit: contain; margin: 4px auto 2px; display: block; }
.credits-titlecard { text-align: center; font-weight: 800; opacity: 0.85; font-size: 13px; margin: 2px 0 14px; line-height: 1.5; white-space: pre-line; }
.credits-list { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; text-align: left; }
.credits-section-h { font-family: 'Jua', sans-serif; font-size: 13px; color: #fff; background: #7a5fc0; display: inline-block; padding: 3px 10px; border-radius: 8px; letter-spacing: 0.5px; margin: 10px 0 2px; opacity: 1; }
.credits-section-h:first-child { margin-top: 0; }
.credits-entry { background: rgba(74,63,85,0.06); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.45; opacity: 0.85; }
.credits-entry b { color: #3a2e4a; opacity: 1; }
/* 빌드번호 옆 복사 버튼(2026-07-13) — 버그 리포트 시 사용자가 정확한 빌드번호를 쉽게 전달할 수 있게 */
.build-row { display: flex; align-items: center; gap: 8px; opacity: 0.75; font-size: 12px; margin: -4px 0 12px; }
.build-copy-btn { background: rgba(74,63,85,0.1); border: none; border-radius: 7px; color: #4a3f55; font-size: 13px; padding: 3px 8px; cursor: pointer; line-height: 1.4; }
.build-copy-btn:active { transform: scale(0.92); }
.how-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.how-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.3); }
.how-dots .dot.on { background: #2fae5f; }
.how-nav { display: flex; gap: 8px; }
.how-nav .diff { margin-top: 0; }
.how-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  opacity: 0.7;
  cursor: pointer;
}

@media (orientation: landscape) {
  :root { --card-w: min(7vw, 70px); }
}

/* ===== 개발자 갓 모드 ===== */
.god-fab {
  /* 고정 132px이었다가 광고배너 실측 높이(--banner-h)+네비 실측 높이(--home-nav-h)를 못 따라가 하단이
     가려지던 버그 수정(2026-07-13, 사용자 실기기 재확인) — 실측 변수 기반으로 항상 네비+배너 위에 뜨게 */
  position: fixed; left: 10px; bottom: calc(var(--home-nav-h, 76px) + var(--banner-h, 0px) + 8px);
  width: 44px; height: 44px; border-radius: 50%;
  border: none; background: rgba(40,30,60,0.82); color: #fff;
  font-size: 21px; line-height: 1; z-index: 140;
  display: flex; align-items: center; justify-content: center;   /* 기본 항상 표시 */
  box-shadow: 0 4px 14px rgba(0,0,0,0.4); cursor: pointer;
}
.god-fab:active { transform: scale(0.92); }
/* 갓모드 = 전체 페이지(팝업 아님) */
.god-panel {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: 141;
  /* 하단 5탭 네비(z-index:150)+광고배너가 항상 이 위에 떠 있어서 맨 아래로 스크롤해도 버튼이 가려지던
     문제 수정(사용자 실기기 확인, 2026-07-13) — .dialog.gacha와 같은 패턴으로 그만큼 바닥 여백 확보 */
  padding: max(54px, calc(env(safe-area-inset-top) + 44px)) 16px calc(28px + var(--banner-h, 0px) + var(--home-nav-h, 76px));
  background: linear-gradient(180deg, #1c1628, #2a2240);
  border: none; border-radius: 0; box-shadow: none;
  display: none; flex-direction: column; gap: 8px;
  overflow-y: auto;
}
.god-panel.show { display: flex; }
.god-panel > * { width: 100%; max-width: 440px; margin-left: auto; margin-right: auto; }
.god-title { color: #ffd27a; font-weight: 800; font-size: 15px; text-align: center; margin: 6px auto 2px; }
.god-panel button {
  border: none; border-radius: 9px; padding: 12px 12px;
  background: #34406a; color: #fff; font-size: 14px; font-weight: 700;
  text-align: left; cursor: pointer;
}
.god-panel button:active { transform: scale(0.97); }
.god-panel .god-close { background: rgba(255,255,255,0.12); text-align: center; }
.god-toast {
  position: fixed; left: 50%; top: 18%; transform: translateX(-50%);
  background: rgba(20,16,30,0.92); color: #ffe08a;
  padding: 10px 18px; border-radius: 999px; font-weight: 800; font-size: 14px;
  z-index: 200; pointer-events: none; animation: godToast 1.4s ease forwards;
}
@keyframes godToast {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  15%,75% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}
.sponsor-toast {
  position: fixed; left: 50%; bottom: 14%; transform: translateX(-50%) translateY(10px);
  max-width: 86vw; text-align: center;
  background: rgba(20,16,30,0.94); color: #bfe8ff;
  padding: 10px 16px; border-radius: 14px; font-weight: 700; font-size: 13px; line-height: 1.35;
  z-index: 300; pointer-events: none; opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.sponsor-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* CR 타이틀화면 참고: 상시 순위 표시·평점 배너·행동누적 게이지(컬렉션 화면에 배치) */
.rank-pill {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; background: rgba(255,255,255,0.1);
  color: #ffd76a; font-weight: 800; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; margin: 2px 0 6px;
}
.rate-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-shrink: 0; width: 100%;
  background: linear-gradient(180deg, #ffcf4d, #f2b012); color: #4a3200; font-weight: 800; font-size: 13px;
  border-radius: 10px; padding: 8px 10px; margin: 6px 0; position: relative;
}
/* 승리창 배치용(2026-07-13 최종 이동) — .dialog 기본 패딩(26px 22px) 안에 들어가므로 폭 100%로 충분 */
.win-rate-banner { margin: 4px 0 10px; }
.rate-thumb { border: none; background: #2fa8ef; color: #fff; border-radius: 8px; padding: 4px 10px; font-size: 14px; cursor: pointer; }
.rate-close { position: absolute; right: 6px; top: 6px; border: none; background: transparent; color: #4a3200; opacity: 0.6; font-size: 12px; cursor: pointer; padding: 2px 4px; }
/* ===== 마을(풍경 속에서 사는 캐릭터들) ===== */
#village {
  position: fixed;
  z-index: 3;               /* 풍경(z2) 앞, UI(z5) 뒤 */
  pointer-events: none;
  overflow: visible;
}
.villager {
  position: absolute;
  bottom: 0;
  /* 배경(씬)과 같은 픽셀 크기: 씬 픽셀=100vw/128, 캐릭터 아트 11px → 11*100vw/128 ≈ 8.6vw */
  width: 8.6vw;
  aspect-ratio: 11 / 14;
  transform-origin: 50% 100%;
  /* 탭은 문서 레벨 히트테스트(setupVillageTap)로 처리 → 드래그 방해 안 함 */
}
.villager.cat { width: 8.6vw; aspect-ratio: 11 / 11; }
/* 파운데이션(가챠 자리) → 마을 점프 클론 (보드 위로 보이게 최상위) */
.villager-fly {
  position: fixed;
  z-index: 130;
  pointer-events: none;
  object-fit: contain;
  image-rendering: pixelated;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.4));
}
/* 그 자리에서 살짝 떴다가(ease-out) 바닥으로 가속해 떨어짐(ease-in) */
.villager-fly.hop { animation: villagerHop .8s both; }
@keyframes villagerHop {
  0%   { transform: translate(0,0) scale(1); animation-timing-function: ease-out; }
  32%  { transform: translate(calc(var(--dx) * 0.34), -46px) scale(calc((1 + var(--s)) / 2)); animation-timing-function: ease-in; }
  100% { transform: translate(var(--dx), var(--dy)) scale(var(--s)); }
}
.vflip { width: 100%; height: 100%; transform-origin: 50% 100%; } /* 좌우반전 전용(말풍선 글자는 밖이라 안 뒤집힘) */
.villager .vsprite {
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: bottom;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35));
  transform-origin: 50% 100%;
}
/* 캐릭터별 고유 아이들 모션(가만히 서 있을 때, walking/dancing 등 다른 상태 아닐 때만 — 뒤에 나오는
   상태별 규칙이 소스 순서로 이걸 덮어씀) — 사용자 요청: 개구리 폴짝 등 캐릭터마다 고유 동작 */
.villager[data-kind="frog"] .vsprite { animation: idleFrogHop 1.7s ease-in-out infinite; }
@keyframes idleFrogHop {
  0%, 55%, 100% { transform: translateY(0) scaleY(1); }
  62% { transform: translateY(2%) scaleY(0.86); }     /* 웅크림 */
  74% { transform: translateY(-28%) scaleY(1.08); }   /* 폴짝! */
  86% { transform: translateY(0) scaleY(0.92); }       /* 착지 */
}
.villager[data-kind="rabbit"] .vsprite { animation: idleRabbitHop 2.1s ease-in-out infinite; }
@keyframes idleRabbitHop {
  0%, 60%, 100% { transform: translateY(0) rotate(0deg); }
  68% { transform: translateY(-16%) rotate(-4deg); }
  78% { transform: translateY(0) rotate(3deg); }
}
.villager[data-kind="dino"] .vsprite { animation: idleDinoStomp 2.4s ease-in-out infinite; }
@keyframes idleDinoStomp {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-4%) rotate(-2deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-4%) rotate(2deg); }
}
.villager[data-kind="bear"] .vsprite { animation: idleBearSway 2.8s ease-in-out infinite; }
@keyframes idleBearSway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
.villager[data-kind="chick"] .vsprite { animation: idleChickPeck 1.9s ease-in-out infinite; }
@keyframes idleChickPeck {
  0%, 40%, 100% { transform: translateY(0) rotate(0deg); }
  48% { transform: translateY(6%) rotate(-8deg); }
  56% { transform: translateY(0) rotate(0deg); }
}
.villager[data-kind="robot"] .vsprite { animation: idleRobotTwitch 2.6s steps(1) infinite; }
@keyframes idleRobotTwitch {
  0%, 92%, 100% { transform: translateY(0); }
  94% { transform: translateY(-3%); }
  96% { transform: translateY(0); }
  98% { transform: translateY(-2%); }
}
/* 걷기 — 통통 발걸음 (좌우반전은 바깥 .villager의 scaleX, 모션은 안쪽 .vsprite transform → 충돌 없음) */
.villager.walking .vsprite { animation: vBob 0.34s ease-in-out infinite; }
@keyframes vBob {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-10%); }
}
/* 같이/혼자 춤 */
/* 잡혀서 신나게 대롱대롱 흔들림(좋아함) */
.villager.grabbed { filter: drop-shadow(0 8px 6px rgba(0,0,0,0.35)); }
.villager.grabbed .vsprite { animation: vGrab 0.3s ease-in-out infinite; }
@keyframes vGrab { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
.villager.dancing .vsprite { animation: vDance 0.5s ease-in-out infinite; }
/* 조커 저글링 — 몸은 살짝 흔들, 머리 위 공 3개가 번갈아 오르내림 */
.villager.juggling .vsprite { animation: vJuggle 0.55s ease-in-out infinite; }
@keyframes vJuggle { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6%) rotate(4deg); } }
.vjuggle { position: absolute; left: 50%; bottom: 90%; width: 70%; height: 45%; transform: translateX(-50%); pointer-events: none; z-index: 3; }
/* 공 픽셀 = 조커/씬 픽셀과 동일 크기: 공 5px × (100vw/128) = 3.9vw */
.jball { position: absolute; left: 50%; top: 60%; width: 3.9vw; aspect-ratio: 1; margin-left: -1.95vw; image-rendering: pixelated; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3)); animation: jbob 0.55s ease-in-out infinite; }
.jb0 { --jx: -120%; }
.jb1 { --jx: 0%; animation-delay: -0.18s; }
.jb2 { --jx: 120%; animation-delay: -0.37s; }
@keyframes jbob { 0%,100% { transform: translate(var(--jx), 20%); } 50% { transform: translate(var(--jx), -120%); } }
@keyframes vDance {
  0%,100% { transform: rotate(-10deg) translateY(0); }
  25% { transform: rotate(0deg) translateY(-14%); }
  50% { transform: rotate(10deg) translateY(0); }
  75% { transform: rotate(0deg) translateY(-14%); }
}
/* 걸려 넘어짐(당근토끼/살금여우, 2026-07-16) — 휘청하고 한 바퀴 돌았다 제자리로 */
.villager.stumble .vsprite { animation: vStumble 0.85s ease-in-out; }
@keyframes vStumble {
  0% { transform: rotate(0deg) translateY(0); }
  25% { transform: rotate(-18deg) translateY(4%); }
  50% { transform: rotate(35deg) translateY(10%); }
  75% { transform: rotate(-8deg) translateY(2%); }
  100% { transform: rotate(0deg) translateY(0); }
}
/* 살금살금 걷기(살금여우, 2026-07-16) — 낮게 웅크려 살짝살짝 이동 */
.villager.sneaking .vsprite { animation: vSneak 0.5s ease-in-out infinite; transform-origin: bottom center; }
@keyframes vSneak {
  0%,100% { transform: scaleY(0.88) translateY(2%); }
  50% { transform: scaleY(0.94) translateY(0); }
}
/* 썰매 슬라이딩(썰매펭귄, 2026-07-16) — 배를 깔고 눕듯 기울여 빠르게 미끄러짐 */
.villager.sledding .vsprite { animation: vSled 0.3s ease-in-out infinite; transform-origin: center; }
@keyframes vSled {
  0%,100% { transform: rotate(78deg) translateY(28%); }
  50% { transform: rotate(82deg) translateY(30%); }
}
/* 지붕 위(빵댕이, 2026-07-16) — 개집(식빵) 윗면 높이만큼 들어올려서 그 위에 누운 것처럼 */
.villager.on-roof { transform: translateY(-58%); transition: transform .4s ease; }
/* 냥냥펀치(황치즈냥이, 2026-07-16) — 좌우로 빠르게 잽 날리듯 흔들림 */
.villager.punching .vsprite { animation: vPunch 0.28s ease-in-out 3; }
@keyframes vPunch {
  0%,100% { transform: translateX(0) rotate(0deg); }
  50% { transform: translateX(8%) rotate(-8deg); }
}
/* 잠 — 살짝 기울여 쿨쿨 */
/* 누워서 잠 — 깬 상태와 크기 비슷하게(긴 축이 가로가 되며 커 보이던 것 보정) */
/* 잠 — 크기 그대로(회전/스케일 없음). 눈감김 스프라이트 + Zzz로만 표현 */
.villager.sleeping .vsprite { transform: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35)) brightness(0.97); }
/* 성문으로 쏙 들어감/나옴 */
/* 성문 안으로 들어감 — 떠오르지 않고 제자리에서 작아지며(문 안으로) 사라짐 */
.villager.toGate { animation: villagerToGate 1.1s ease-in forwards; }
@keyframes villagerToGate {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  55%  { transform: translate(0, 4%) scale(0.7); opacity: 1; }     /* 문으로 다가가 살짝 작아짐 */
  100% { transform: translate(0, 8%) scale(0.34); opacity: 0; }    /* 문 안으로 쏙 사라짐 */
}
/* 말풍선 */
.vbubble {
  position: absolute;
  left: 50%; bottom: 102%;
  transform: translateX(-50%) scale(0);
  background: #fff; color: #5a3a5a;
  font-size: 10px; font-weight: 800; white-space: nowrap;
  padding: 3px 7px; border-radius: 9px;
  border: 1.5px solid #ffb3d9;
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
  transform-origin: 50% 120%;
  opacity: 0;
  transition: transform .2s cubic-bezier(.2,1.4,.4,1), opacity .2s;
}
.vbubble::after {
  content: ""; position: absolute; left: 50%; top: 100%;
  transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: #fff;
}
.vbubble.show { transform: translateX(-50%) scale(1); opacity: 1; }
/* 잠잘 때 Zzz (픽셀아트) */
.vzzz {
  position: absolute;
  left: 82%; bottom: 68%;
  display: flex; align-items: flex-end; gap: 1px;
  opacity: 0; pointer-events: none;
}
.vzzz .zpix { image-rendering: pixelated; display: block; }
.vzzz .z0 { width: 5px; }
.vzzz .z1 { width: 7px; }
.vzzz .z2 { width: 9px; }
.vzzz.show { opacity: 1; animation: vZzz 1.8s ease-in-out infinite; }
/* 고양이가 캣타워 발판에 가로로 누워 잠(식빵 포즈) */
/* 자는 고양이(식빵) — 깬 고양이와 얼굴 크기 비슷하게(평소보다 커지던 것 보정) */
/* 자는 고양이도 평소와 같은 크기(식빵 안 씀) */
.villager.cat.catsleep { width: 8.6vw; aspect-ratio: 11 / 11; }
/* 강아지는 살짝 작게(다른 캐릭터보다 아담) */
.villager.vdog { width: 6.8vw; }
/* 낙하산(위로 던지면 타고 내려옴) */
.villager .vchute { position: absolute; left: 50%; bottom: 92%; width: 135%; transform: translateX(-50%); image-rendering: pixelated; pointer-events: none; z-index: 2; }
/* 공룡 불뿜기 — 머리(오른쪽) 앞으로 확 커지며 길게 뻗었다 사라짐(크고 화려) */
.villager .vflame { position: absolute; left: 84%; top: 4%; width: 78%; height: 78%; image-rendering: pixelated; pointer-events: none; transform-origin: left center; animation: vFlame 1.3s cubic-bezier(.2,.7,.3,1) forwards; z-index: 3; filter: drop-shadow(0 0 6px rgba(255,140,40,0.8)); }
@keyframes vFlame { 0% { transform: scaleX(.2) scaleY(.6); opacity: 0; } 18% { transform: scaleX(1.5) scaleY(1.12); opacity: 1; } 55% { transform: scaleX(1.85) scaleY(1); opacity: 1; } 100% { transform: scaleX(2.2) scaleY(.8); opacity: 0; } }
.villager .vflame.f-b { top: 16%; width: 62%; height: 62%; animation-duration: 1.15s; }
.villager .vflame.f-c { top: -6%; width: 56%; height: 56%; animation-duration: 1.0s; }
/* 어지러움 별(빙글빙글 돌리다 놓으면) */
.villager .vdizzy { position: absolute; left: 50%; bottom: 86%; width: 75%; transform: translateX(-50%); image-rendering: pixelated; pointer-events: none; animation: dizzySpin 0.9s linear infinite; }
@keyframes dizzySpin { to { transform: translateX(-50%) rotate(360deg); } }
.villager.dizzy .vflip { transform: rotate(74deg); transform-origin: 50% 80%; animation: dizzyWobble 0.7s ease-in-out infinite; }
@keyframes dizzyWobble { 0%, 100% { transform: rotate(68deg); } 50% { transform: rotate(82deg); } }
/* 가로등 불빛(2026-07-16) — #scene 좌표계에 맞춰 fixed 배치, 밤에만 보이고 가끔 깜빡임 */
#lampGlow { position: fixed; transform: translate(-50%, -50%); image-rendering: pixelated; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .5s ease; }
#lampGlow.lit { opacity: 1; animation: lampFlicker 4.6s ease-in-out infinite; }
@keyframes lampFlicker { 0%, 87%, 93%, 100% { opacity: 1; } 90% { opacity: .5; } }
/* 분수대 물줄기(2026-07-17) — 밤낮 무관 항상 보임, 물방울 3개가 각기 다른 타이밍으로 솟았다 떨어짐 */
#fountainSpray { position: fixed; width: 0; height: 0; pointer-events: none; z-index: 2; }
.spray-drop { position: absolute; left: 0; bottom: 0; width: 4px; height: 4px; margin-left: -2px; background: #cdeeff; border-radius: 50%; opacity: 0; animation: sprayDrop 1.1s ease-in infinite; }
.spray-drop.sd0 { animation-delay: 0s; }
.spray-drop.sd1 { left: -5px; animation-delay: .35s; }
.spray-drop.sd2 { left: 5px; animation-delay: .7s; }
@keyframes sprayDrop { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 55% { transform: translateY(-14px); opacity: 1; } 100% { transform: translateY(6px); opacity: 0; } }
/* 아이템 상세카드 데모 이펙트(2026-07-17) — 가로등 카드는 랜덤 깜빡임, 분수대 카드는 물줄기 */
.card-lamp-glow { position: absolute; left: 50%; top: 22%; width: 12%; aspect-ratio: 1; transform: translate(-50%, -50%); background: radial-gradient(circle, #fff6d0, #ffd64a 55%, transparent 72%); border-radius: 50%; pointer-events: none; transition: opacity .15s; }
.card-fountain-spray { position: absolute; left: 50%; top: 30%; width: 0; height: 0; pointer-events: none; }
.card-fountain-spray .spray-drop { width: 6px; height: 6px; margin-left: -3px; }
/* 분수대 동전(2026-07-17) — 던지는 애니메이션은 JS(Web Animations API)가 담당, 여긴 위치·크기만 */
.vcoin { position: fixed; width: 6px; image-rendering: pixelated; pointer-events: none; z-index: 136; }
/* 겨자지붕집 굴뚝 연기(2026-07-17) — 가로등과 같은 fixed 오버레이 좌표계, 밤에만 뭉게뭉게 */
#chimneySmoke { position: fixed; width: 0; height: 0; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .5s ease; }
#chimneySmoke.lit { opacity: 1; }
.chimney-puff { position: absolute; left: 0; bottom: 0; width: 22px; transform: translateX(-50%); image-rendering: pixelated; animation: chimneyPuff 1.7s ease-out forwards; }
@keyframes chimneyPuff { 0% { transform: translate(-50%, 0) scale(.5); opacity: 0; } 20% { opacity: .85; } 100% { transform: translate(-50%, -160%) scale(1.4); opacity: 0; } }
/* 아기용 콧바람 연기(2026-07-16) — 불꽃과 달리 위로 둥실 떠오르며 옅어짐(실패한 불뿜기) */
.villager .vsmoke { position: absolute; left: 82%; top: 6%; width: 55%; image-rendering: pixelated; pointer-events: none; z-index: 3; animation: vSmoke 0.95s ease-out forwards; }
@keyframes vSmoke { 0% { transform: translateY(0) scale(.6); opacity: 0; } 25% { opacity: .9; } 100% { transform: translateY(-70%) scale(1.3); opacity: 0; } }
/* 불뿜기 시도(아기용, 2026-07-16) — 낑낑 힘주는 느낌으로 살짝 부들부들 */
.villager.straining .vsprite { animation: vStrain 0.22s ease-in-out infinite; }
@keyframes vStrain { 0%,100% { transform: scale(1,1) translateX(0); } 50% { transform: scale(1.05,0.96) translateX(1%); } }
/* 공룡이 아기용 쓰다듬기(2026-07-16) — 고개 숙이듯 살짝 끄덕 */
.villager.petting .vsprite { animation: vPet 0.65s ease-in-out; }
@keyframes vPet { 0%,100% { transform: rotate(0deg) translateY(0); } 40% { transform: rotate(-6deg) translateY(4%); } 70% { transform: rotate(2deg) translateY(0); } }
/* 망원경(우주비행사, 2026-07-16) — 남색지붕집 위에서 하늘을 관측하는 동안 살짝살짝 각도 조정 */
.villager .vtelescope { position: absolute; left: 78%; top: -18%; width: 62%; image-rendering: pixelated; pointer-events: none; z-index: 3; transform-origin: 20% 90%; animation: vScope 2.4s ease-in-out infinite; }
@keyframes vScope { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(4deg); } }
/* 남색지붕집 지붕 위(우주비행사, 2026-07-16) — 일반 집이라 개집보다 더 높이 들어올림 */
.villager.on-navyroof { transform: translateY(-92%); transition: transform .45s ease; }
/* 조약돌(해적, 2026-07-16) — 발견해서 들어 보이는 소품, 살짝 위아래로 까닥 */
.villager .vpebble { position: absolute; left: 68%; top: 14%; width: 24%; image-rendering: pixelated; pointer-events: none; z-index: 3; animation: vPebbleBob 0.9s ease-in-out infinite; }
@keyframes vPebbleBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12%); } }
/* 두리번거림(해적, 이정표, 2026-07-16) — 좌우로 고개 돌리듯 */
.villager.looking-around .vsprite { animation: vLook 0.5s ease-in-out infinite; }
@keyframes vLook { 0%,100% { transform: rotate(0deg); } 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
/* 닌자(2026-07-16) — "뒤에 있는 배경이 뭐건 간에 몸 절반은 항상 배경 속에 숨어 있게" 해달라는 요청을
   실제 오클루전 대신 방향에 따라 절반이 그림자 속으로 옅어지는 마스크로 표현(항상 적용, 조건 없음) */
.villager[data-kind="ninja"] .vsprite {
  mask-image: linear-gradient(to right, rgba(0,0,0,1) 0 48%, rgba(0,0,0,0.16) 52% 100%);
  -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,1) 0 48%, rgba(0,0,0,0.16) 52% 100%);
}
/* ===== 2026-07-17: 소개글 기반 신규 모션 일괄 추가 ===== */
/* 왕관 확인 거울(왕)/카드정리(여왕)은 이모지 말풍선만이라 별도 CSS 불필요. 발끝 톡톡(여왕) */
.villager.toe-tap .vsprite { animation: vToeTap 0.3s ease-in-out 4; }
@keyframes vToeTap { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8%); } }
.villager.sorting .vsprite { animation: vSort 0.4s ease-in-out 3; }
@keyframes vSort { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-6deg); } }
/* 손가락 튕겨 카드 뒤집기(조커) */
.villager.snap-flip .vsprite { animation: vSnapFlip 0.5s ease-in-out; }
@keyframes vSnapFlip { 0%,100% { transform: scale(1); } 40% { transform: scale(1.12) rotate(-4deg); } 60% { transform: scale(1.12) rotate(4deg); } }
/* 주문 시전(마법사) */
.villager.casting .vsprite { animation: vCast 0.3s ease-in-out 2; }
@keyframes vCast { 0%,100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.08) rotate(6deg); } }
/* 뒤척이다 잠듦(양) */
.villager.tossing .vsprite { animation: vToss 0.35s ease-in-out infinite; }
@keyframes vToss { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
/* 까치발(공룡, 2026-07-17) — 걷는 동안 항상 다소곳한 종종걸음 느낌 */
.villager[data-kind="dino"].walking .vsprite { animation: vTiptoe 0.4s ease-in-out infinite; }
@keyframes vTiptoe { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6%); } }
/* 깃대 감아올리기(파워봇) */
.villager.winding .vsprite { animation: vWind 0.35s linear infinite; }
@keyframes vWind { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
/* 발차기 시범(태권소년, 2026-07-17) — 전용 픽셀아트 프레임 나오기 전까지 CSS 모션으로 임시 대체 */
.villager.kicking .vsprite { animation: vKick 0.5s ease-out; }
@keyframes vKick { 0%,100% { transform: rotate(0deg) translateX(0); } 40% { transform: rotate(-18deg) translateX(6%); } 70% { transform: rotate(10deg) translateX(-3%); } }
.villager.kicking.wobble-end .vsprite { animation: vWobbleEnd 0.6s ease-in-out; }
@keyframes vWobbleEnd { 0%,100% { transform: rotate(0deg); } 30% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } }
/* 카드 상세뷰 연동 상대 배지(2026-07-17) — "캣타워면 고양이뱃지" 요청, 탭하면 그 카드로 이동 */
/* ===== 2026-07-18: 카드 안에서 소개글 이벤트를 실제로 계속 보여주는 미니씬(사용자 요청 — "관련된 모든
   요소들을 카드에서 보여줘, 소나무 아래서 자면 소나무도 표시하고 자는 것도 표시") ===== */
/* 기존 마을 전용이던 모션 애니메이션을 카드 어디에나 붙일 수 있는 범용 클래스로 재사용(cm-=card motion) */
.cm-toss { animation: vToss 0.35s ease-in-out infinite; }
.cm-kick { animation: vKick 0.5s ease-out infinite; }
.cm-look { animation: vLook 0.5s ease-in-out infinite; }
.cm-sneak { animation: vSneak 0.5s ease-in-out infinite; }
.cm-sled { animation: vSled 0.3s ease-in-out infinite; }
.cm-punch { animation: vPunch 0.28s ease-in-out infinite; }
.cm-cast { animation: vCast 0.3s ease-in-out infinite; }
.cm-wind { animation: vWind 0.35s linear infinite; }
.cm-toetap { animation: vToeTap 0.3s ease-in-out infinite; }
.cm-sort { animation: vSort 0.4s ease-in-out infinite; }
.cm-snap { animation: vSnapFlip 0.5s ease-in-out infinite; }
.cm-stumble { animation: vStumble 0.85s ease-in-out infinite; }
.cm-strain { animation: vStrain 0.22s ease-in-out infinite; }
.cm-pet { animation: vPet 0.65s ease-in-out infinite; }
.cm-juggle { animation: vJuggle 0.55s ease-in-out infinite; }
/* 캐릭터 카드: 관련 배경을 스테이지 뒤쪽에 흐릿하게 깔아줌(그 배경 아래서/옆에서 벌어지는 일이라는 신호) */
.card-scene-bg { position: absolute; right: 8%; bottom: 6%; width: 30%; max-width: 64px; image-rendering: pixelated; opacity: .55; pointer-events: none; z-index: 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.card-scene-bg.frog-pond-bg { opacity: 0; transition: opacity .3s; }
/* 배경 카드: 그 배경을 찾아오는 캐릭터를 작게 오버레이(반대 방향 — "소나무 카드에서도 부엉이가 자는 걸 보여줘") */
.card-scene-char { position: absolute; left: 10%; bottom: 8%; width: 34%; max-width: 72px; image-rendering: pixelated; pointer-events: none; z-index: 1; filter: drop-shadow(0 3px 5px rgba(0,0,0,.3)); }
.card-scene-zzz { position: absolute; left: 50%; top: 8%; transform: translateX(-50%); font-size: 20px; z-index: 2; animation: cardZzzFloat 1.8s ease-in-out infinite; pointer-events: none; }
@keyframes cardZzzFloat { 0%,100% { transform: translateX(-50%) translateY(0); opacity: .5; } 50% { transform: translateX(-50%) translateY(-8px); opacity: 1; } }
.card-scene-bubble { position: absolute; left: 50%; top: 8%; transform: translateX(-50%) scale(0); font-size: 22px; z-index: 3; transition: transform .2s cubic-bezier(.2,1.4,.4,1); pointer-events: none; }
.card-scene-bubble.show { transform: translateX(-50%) scale(1); }
/* 비(연잎개구리 우산 프레임에서만) — 실제 게임 #rainLayer와 같은 느낌의 빗줄기를 스테이지 안에서만 */
.card-scene-rain { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .3s; }
.card-scene-rain.show { opacity: 1; }
.card-scene-rain i { position: absolute; top: -10%; width: 2px; height: 14px; background: rgba(200,225,255,0.75); transform: rotate(16deg); animation: cardRainFall 0.6s linear infinite; }
@keyframes cardRainFall { from { transform: translate(0, -10%) rotate(16deg); } to { transform: translate(-48%, 220%) rotate(16deg); } }
/* 점술사 우물 앞 손님 줄(포춘텔러 전용) — 작은 방문객 아이콘이 걸어와서 잠깐 머물다 사라짐 */
.card-scene-visitor { position: absolute; bottom: 6%; width: 26%; max-width: 56px; image-rendering: pixelated; z-index: 1; pointer-events: none; opacity: 0; }
.card-scene-visitor.walk-in { animation: visitorWalkIn 1.1s ease-out forwards; }
.card-scene-visitor.walk-out { animation: visitorWalkOut 0.9s ease-in forwards; }
@keyframes visitorWalkIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes visitorWalkOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(-60px); } }
/* 2026-07-19 재지시 — 배지를 우상단으로, 우상단에 있던 이벤트 모션(ZZZ 등)은 중앙 상단으로 옮겨 겹치지 않게 */
.partner-badges { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; z-index: 4; flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
.partner-badge { width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; border-radius: 10px; background: rgba(255,255,255,0.88); padding: 3px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.35); } /* 2026-07-18: 기존의 2배로 확대 */
/* 포옹/부딪힘 하트(가운데 뿅 떠오름) */
.fxheart { position: fixed; width: 26px; image-rendering: pixelated; pointer-events: none; z-index: 136; animation: fxHeart 1.6s ease-out forwards; }
@keyframes fxHeart {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.4); }
  22% { opacity: 1; transform: translate(-50%, -60%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -180%) scale(0.95); }
}
/* 포옹 중 살짝 통통 */
.villager.hugging .vsprite { animation: hugBob 0.5s ease-in-out infinite alternate; }
@keyframes hugBob { from { transform: translateY(0) scale(1, 1); } to { transform: translateY(-2px) scale(1.06, 0.94); } }
@keyframes vZzz {
  0% { opacity: 0; transform: translate(0, 4px) scale(0.7); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translate(8px, -10px) scale(1.1); }
}

/* 갓 모드 진입 버튼 (DEV 전용 — 사용자 배포 시 JS에서 미생성) */
.god-entry {
  position: fixed;
  left: 6px; bottom: 6px;
  z-index: 142;
  background: rgba(40,30,60,0.7);
  color: #ffd27a;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11px; font-weight: 800;
  cursor: pointer;
}
.god-entry:active { transform: scale(0.94); background: rgba(40,30,60,0.9); }

/* ===== 가챠 — 좌상단 캐릭터 슬롯머신 공개 ===== */
.found-slot.gacha-active { overflow: visible; z-index: 8; }
.found-king.gacha-spin { animation: gachaSpin .12s linear infinite; }
@keyframes gachaSpin {
  0%,100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-9%) scale(1.07); }
}
.found-king.gacha-win { animation: gachaWin .6s cubic-bezier(.2,1.7,.4,1); }
@keyframes gachaWin {
  0% { transform: scale(.5); }
  55% { transform: scale(1.5); filter: drop-shadow(0 0 10px rgba(255,210,120,0.95)) brightness(1.3); }
  100% { transform: scale(1); }
}
.gacha-badge {
  position: fixed;
  transform: translate(-50%, 0);
  z-index: 135;
  background: #fff;
  color: #e08a1e;
  font-size: 13px; font-weight: 900; white-space: nowrap;
  padding: 4px 12px; border-radius: 999px;
  border: 2px solid #ffd592;
  box-shadow: 0 4px 12px rgba(150,110,40,0.4);
  pointer-events: none;
  animation: gachaBadge 1.5s ease forwards;
}
@keyframes gachaBadge {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(.5); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.12); }
  30% { transform: translate(-50%, 0) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(1); }
}

/* 갓 모드 캐릭터 소환 버튼 그리드 */
.god-spawn { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.god-spawn button { text-align: center; padding: 8px 0; font-size: 13px; }
.god-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }

/* 구글 광고 자리(메뉴 바로 아래) — 항상 비워둠. 배너 로드되면 실제 높이로 맞춰짐(ads.js). 메뉴는 이 위에 뜸 */
#adspace {
  flex: 0 0 60px;
  height: 60px;            /* 적응형 배너 안전 기본값 — 로드 전에도 메뉴가 안 가리게 확보 */
  width: 100%;
  position: relative;
  z-index: 5;
  overflow: hidden;
}

/* 자동완성 버튼 — 엔드게임에 메뉴 위로 떠오름(강제 자동 X, 눌러서 실행) */
.auto-btn {
  position: absolute; left: 50%; bottom: 100%; margin-bottom: 16px; /* 메뉴(#bottombar) 바로 위 — 겹침 없음 */
  transform: translateX(-50%) translateY(16px);
  z-index: 30;
  background: #ffb259; color: #fff; border: 2px solid #fff;
  border-radius: 999px; padding: 10px 22px;
  font-size: clamp(13px, 4vw, 16px); font-weight: 800;
  box-shadow: 0 5px 16px rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; cursor: pointer;
  transition: opacity .25s ease, transform .25s cubic-bezier(.2,1.4,.4,1);
}
.auto-btn.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); animation: autoPulse 1.4s ease-in-out infinite; }
@keyframes autoPulse { 0%,100% { box-shadow: 0 5px 16px rgba(255,178,89,0.5); } 50% { box-shadow: 0 5px 22px rgba(255,178,89,0.95); } }
.auto-btn:active { transform: translateX(-50%) scale(0.95); }

/* ===== 가로모드(가로가 길고 세로가 짧은 폰) — 크롬 압축 + 카드를 높이 기준으로 ===== */
@media (orientation: landscape) and (max-height: 560px) {
  #topbar { padding: 1px 10px; }
  .stat .label { font-size: 8px; }
  .stat span:last-child { font-size: 13px; }
  .icon-btn { width: clamp(28px, 7vh, 38px); height: clamp(28px, 7vh, 38px); font-size: clamp(14px, 4.4vh, 18px); display: flex; align-items: center; justify-content: center; padding: 0; }
  /* 실측 버그(사용자 실기기 스크린샷 확인): 아이콘 이미지가 vw 기준이라 넓고 낮은 가로모드 화면에서
     vh 기준인 버튼 박스보다 훨씬 커져 옆 버튼과 겹쳐 뭉개져 보였음 — 버튼과 같은 vh 기준으로 통일 */
  .ico-img { width: clamp(16px, 4.4vh, 24px); height: clamp(16px, 4.4vh, 24px); }
  /* 가로모드는 세로 공간이 빠듯한데 조커/다시하기/힌트/실행취소를 아래 가로줄로 두면 보드가 더 좁아짐 —
     사용자가 준 다른 솔리테어 앱 레퍼런스처럼 왼쪽 세로 사이드바로 옮겨 아래쪽 공간을 확보 */
  #topbar, #stockbar, #board, #adspace { margin-left: 68px; }
  #bottombar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 30;
    width: 68px; flex-direction: column; justify-content: center; align-items: center;
    padding: 6px 4px; background: linear-gradient(90deg, rgba(0,0,0,0.32), transparent);
  }
  .actions { flex-direction: column; width: 100%; gap: 6px; max-width: none; }
  #stockbar { min-height: calc(var(--real-card-w, 34px) * 7 / 5); padding: 1px 8px 0; }
  /* 카드를 세로(vh) 기준으로 작게 → 10열이 가운데 모이고 각 열이 메뉴 직전까지 펼쳐짐 */
  #board { grid-template-columns: repeat(10, minmax(0, 12.5vh)); justify-content: center; padding-top: 3px; }
  /* 세로 사이드바 안 버튼 컴팩트 */
  .act { width: 100%; padding: 5px 2px; }
  .act .ico { font-size: clamp(14px, 4vh, 18px); }
  .act .lbl { font-size: clamp(7.5px, 2vh, 10px); }
  #adspace { flex: 0 0 34px; height: 34px; } /* 가로에선 배너 공간도 슬림하게 */
  /* .hint은 원래 #bottombar 바로 위(bottom:100%)에 뜨는데, 사이드바가 이제 화면 전체 높이라 그 기준이
     안 맞음 — 화면 상단에 고정 배치로 대체 */
  .hint { position: fixed; left: 76px; right: 10px; top: 4px; bottom: auto; margin-bottom: 0; }
  /* 갓모드 진입 버튼(개발자용)이 왼쪽 세로 사이드바와 겹쳤음 — 반대쪽 구석(광고 위)으로 이동 */
  .god-fab { left: auto; right: 10px; bottom: calc(10px + var(--banner-h, 0px)); }
}

/* ===== 일일 미션 완료 전용 팝업(2026-07-09) — flashHint 토스트 대신 확실한 축하 팝업 ===== */
.mission-complete-dialog { text-align: center; }
.mc-badge { font-size: 46px; animation: mcBadgePop .5s cubic-bezier(.3,1.5,.4,1); margin-bottom: 4px; }
@keyframes mcBadgePop { 0% { transform: scale(0) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.mc-reward { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 26px; font-weight: 800; color: #ffe24d; text-shadow: 1px 2px 0 #7a4a10; margin: 10px 0 18px; }
.mc-reward img { width: 28px; height: 28px; }
