* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f2f5ff;
  --card: #ffffff;
  --primary: #5b6cff;
  --primary-dark: #4353e8;
  --secondary: #ff8a3d;
  --text: #262b40;
  --muted: #7a80a0;
  /* 협동 플레이어 색: 1 빨강 / 2 파랑 / 3 초록 / 4 분홍 */
  --p1: #e5484d;
  --p2: #2f6bff;
  --p3: #17a34a;
  --p4: #e8489f;
  --radius: 16px;
  --shadow: 0 4px 16px rgba(60, 70, 140, 0.12);
}

html { height: 100%; }

/* 앱 셸: 상단바 / 콘텐츠 / 광고배너를 세로 플렉스로 고정 배치.
   게임 화면은 남은 공간에 정확히 맞춰지므로 어떤 기기에서도 스크롤·잘림이 없다. */
body {
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  background: linear-gradient(160deg, #eef2ff 0%, #fdf3ff 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  /* iOS 노치·다이내믹 아일랜드: viewport-fit=cover라 콘텐츠가 상태바 밑으로 파고든다.
     상단바(#topbar)·게임 상단(.game-top)이 시계와 겹치지 않게 안전영역만큼 밀어준다.
     좌우는 가로 모드 노치용(세로에서는 0). 하단은 광고배너·시트가 개별 처리하므로 두지 않는다.
     .home-bg 는 position:fixed 라 이 여백과 무관하게 화면 전체를 계속 덮는다. */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  /* 꾹 눌러도 이미지/텍스트가 선택·복사·저장되지 않게 (게임 앱 표준) */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 입력창은 선택/편집이 필요하므로 예외 */
input, textarea { -webkit-user-select: text; user-select: text; }

/* 이미지·보드는 드래그도 금지 */
img, svg { -webkit-user-drag: none; user-drag: none; }

/* ===== 상단바 — 게임 HUD 스타일 (프로필 + 재화) ===== */
#topbar {
  position: relative; /* 프로필 안내 말풍선의 기준점 */
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 4px;
  background: transparent;
  z-index: 20;
}

/* 좌측 프로필: 금테 아바타 + 닉네임 */
.profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 2px solid #fffdf2;
  border-radius: 999px;
  padding: 3px 14px 3px 3px;
  background: rgba(255, 253, 242, 0.88);
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(150, 125, 70, 0.28), 0 6px 12px rgba(50, 70, 60, 0.16);
  transition: transform 0.1s;
}
.profile-chip:active { transform: scale(0.97); }
.profile-avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid #ffd166;
  box-shadow: 0 0 0 2px #d99a2b;
  background: linear-gradient(160deg, #8a5bff, #5b6cff);
  color: #fff;
  font-weight: 900;
  font-size: 1.05rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  gap: 1px;
}
.profile-avatar small {
  font-size: 0.46rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  opacity: 0.9;
}
.profile-avatar b {
  font-size: 0.92rem;
  font-weight: 900;
}
.profile-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-width: 0;
  text-align: left;
  line-height: 1.25;
}
.profile-meta b {
  font-size: 0.86rem;
  color: #2b3566;
  /* 닉네임 최대 길이(10자)에 맞춘 고정 폭 — 이름 길이에 따라 칩 크기가 출렁이지 않게 */
  width: 10.2em;
  max-width: 10.2em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-meta small { font-size: 0.6rem; color: #9a8f6e; font-weight: 700; }

.topbar-right { display: flex; gap: 6px; min-width: 0; align-items: flex-start; }

/* 프로필 칩이 '눌러서 여는 메뉴'임을 알리는 표시들 —
   화살표는 항상, 말풍선은 계정 화면을 한 번도 안 열어본 사람에게만 */
/* 닉네임 아래 줄: '게스트 · 내정보 ▾' — 눌러서 여는 메뉴임을 글자로 알린다.
   이 줄은 닉네임 줄보다 짧아 칩 폭이 늘지 않는다 (좁은 폰의 상단바를 지킨다) */
.profile-sub { display: flex; align-items: center; gap: 4px; min-width: 0; }
.profile-sub #hud-role {
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-open {
  flex: none;
  font-weight: 900;
  font-size: 0.94em; /* 신분 표기보다 살짝 작게 — 상단바 폭을 아끼려 점 구분자 대신 간격만 둔다 */
  color: #5b6cff;
  white-space: nowrap;
}
.profile-open em { font-style: normal; }
.profile-chip.nudge { animation: chipNudge 1.5s ease-in-out 3; }
@keyframes chipNudge {
  0%, 100% { transform: scale(1); }
  8% { transform: scale(1.05) rotate(-1.5deg); }
  16% { transform: scale(1.05) rotate(1.5deg); }
  24% { transform: scale(1); }
}
.profile-hint {
  position: absolute;
  top: 100%;
  left: 12px;
  z-index: 20; /* 재화 칩(21)보다 아래 — 혹시 겹쳐도 칩이 위에 보이게 */
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #fffdf2;
  border: 2px solid #ffd45c;
  color: #6b5200;
  font-size: 0.78rem;
  font-weight: 800;
  /* 한 줄 통짜(nowrap)면 폰에서 오른쪽 재화 칩(💎·⏰)까지 덮는다 — 프로필 칩 아래 폭으로
     제한하고 어절 단위로 줄바꿈 (대표 신고 2026-08-26) */
  white-space: normal;
  word-break: keep-all;
  line-height: 1.45;
  max-width: min(230px, 52vw);
  box-shadow: 0 4px 0 rgba(160, 120, 30, 0.3), 0 8px 18px rgba(10, 12, 50, 0.3);
  cursor: pointer;
  animation: hintIn 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
/* 말풍선 꼬리 — 프로필 칩을 가리킨다 */
.profile-hint::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 26px;
  border: 6px solid transparent;
  border-bottom-color: #ffd45c;
}
@keyframes hintIn {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 돋보기 아래 시간 정지 개수: 상단바 높이를 늘리지 않게 겹쳐서 배치 */
.chip-col { position: relative; display: inline-flex; }
.chip-sub {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 21;
  box-shadow: 0 4px 10px rgba(15, 18, 38, 0.35);
}

/* 하트 칩 아래 남은 충전 시간 (10분마다 1개). 가득 차면 숨긴다.
   .chip-sub 와 달리 넓은 화면에서도 계속 아래에 붙여 둔다 — 상단바 폭을 늘리지 않게. */
.heart-timer {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 21;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: #ffd7de;
  background: rgba(20, 24, 52, 0.82);
  border: 1px solid rgba(255, 140, 165, 0.45);
  white-space: nowrap;
  pointer-events: none;
}

/* 재화 알약: 짙은 남색 + 금색 숫자 + 초록 ＋ (누르면 상점) */
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(30, 40, 72, 0.82);
  border-radius: 999px;
  padding: 5px 5px 5px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  color: #fff;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(30, 40, 80, 0.28);
  transition: transform 0.1s;
}
.chip:active { transform: scale(0.95); }
.chip b { color: #ffe08a; font-weight: 800; }
/* CSS로 그린 금화 — 🪙 이모지가 기기마다 은색 달처럼 보이는 문제 대체 */
.coin {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.16em;
  border-radius: 50%;
  box-sizing: border-box;
  background: radial-gradient(circle at 35% 28%, #ffe98a, #ffc93d 52%, #e8a20c);
  border: 2px solid #c8860a;
  box-shadow: inset 0 0 0 2.5px rgba(255, 246, 200, 0.6), 0 1px 2px rgba(90, 60, 0, 0.35);
}
.chip-plus {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #6fdc7f, #2fae4d);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}

/* ===== 메인 ===== */
#app {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  z-index: 1; /* 밤하늘 배경 위 (flex item이라 position 없이 z-index 적용됨) */
}

.view { text-align: center; flex: 0 0 auto; }
.hidden { display: none !important; }

/* 스크롤바 숨김 — 게임 UI답게 스크롤 기능은 유지하고 바만 감춘다 */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* 모바일 더블탭 확대 방지 (스크롤·탭은 그대로, PC에는 영향 없음) */
html, body { touch-action: manipulation; }

/* 화면을 꽉 채우는 뷰 (홈/솔로/협동) */
#view-home, #view-solo, #view-coop {
  flex: 1 1 0;
  min-height: 0;
}
#view-home { display: flex; flex-direction: column; justify-content: center; overflow-y: auto; }
#view-solo { display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
#view-coop { display: flex; flex-direction: column; overflow-y: auto; }
#coop-menu, #coop-searching, #coop-lobby { margin-top: auto; margin-bottom: auto; }
#coop-game { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }

.title { font-size: clamp(1.6rem, 6vw, 2.2rem); color: var(--primary-dark); }
.subtitle { color: var(--muted); margin: 6px 0 18px; font-size: 0.9rem; }

.section-title { font-size: 1.4rem; margin: 10px 0 16px; }

/* ===== 앱 게임 타이틀 화면 (홈) — 밤하늘 탐정 일러스트 ===== */

/* 게임 플레이 중에는 배경 일러스트를 숨겨 사진에 집중 */
body.in-game .home-bg { display: none; }

/* 배경: 인디고 밤하늘(브랜드 색) + 별·달·유성 + 도시 실루엣 + 폴라로이드·돋보기
   (body 레벨 공통 배경 — 홈·협동·랭킹·상점 모두 이 위에 얹힌다) */
.home-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, #262a63 0%, #3d448f 34%, #5b6cff 68%, #8d8af0 88%, #b9a8ef 100%);
  background-size: 100% 200%;
  animation: bgFlow 18s ease-in-out infinite alternate;
}
/* 초승달 */
.home-bg .moon {
  position: absolute;
  top: 13.5%;
  right: 19%;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  box-shadow: inset -13px 9px 0 0 #ffeebc, 0 0 26px rgba(255, 238, 188, 0.35);
  transform: rotate(-16deg);
  animation: moonGlow 4s ease-in-out infinite alternate;
}
/* 이따금 떨어지는 유성 */
.home-bg .shoot {
  position: absolute;
  top: 12%;
  left: -12%;
  width: 84px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #fff);
  transform: rotate(16deg);
  opacity: 0;
  animation: shootAcross 8s ease-in 2.5s infinite;
}
/* 반짝이는 별 */
.home-bg .star {
  --s: 1;
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 7px rgba(255, 255, 255, 0.9);
  transform: scale(var(--s));
  animation: twinkle 2.4s ease-in-out infinite alternate;
}
.home-bg .spark {
  position: absolute;
  bottom: -6%;
  font-size: 0.9rem;
  color: #ffe9a9;
  text-shadow: 0 0 8px rgba(255, 233, 169, 0.9);
  opacity: 0;
  animation-name: sparkUp;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
/* 도시 실루엣 */
.home-bg .skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: max(140px, 21vh);
}
/* 폴라로이드 두 장 + 돋보기 (좌하단) */
.home-bg .photo-scene {
  position: absolute;
  /* 📐 좌하단 장식 자리 (대표 지시 2026-08-27, 실기기 실측)
     예전엔 left:-20px · bottom:-14px · 202px 였다. 그러면 세 가지가 한꺼번에 어긋난다 —
     ① 아래 64px 가 하단 광고 배너에 가리고 ② 왼쪽이 화면 밖으로 잘리고 ③ 상점 아이콘 줄과 겹친다.
     실측(갤럭시 S9+ 411x773): 아이콘 줄 바닥 658 · 배너 위 724 → 쓸 수 있는 세로가 66px 뿐이다.
     그래서 62px 로 줄여 그 사이(위 6px · 아래 6px 여유)에 앉히고 왼쪽도 화면 안으로 들였다. */
  left: 8px;
  bottom: calc(var(--ad-slot-h) + 6px + env(safe-area-inset-bottom));
  width: min(15vw, 62px);
  filter: drop-shadow(0 10px 18px rgba(15, 18, 60, 0.5));
  animation: sceneIn 0.8s 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.home-bg .photo-scene .scene-mag {
  transform-box: fill-box;
  transform-origin: center;
  animation: magHover 3.2s 1.4s ease-in-out infinite alternate;
}
@keyframes bgFlow {
  from { background-position: 0 0%; }
  to { background-position: 0 100%; }
}
@keyframes moonGlow {
  from { box-shadow: inset -13px 9px 0 0 #ffeebc, 0 0 18px rgba(255, 238, 188, 0.25); }
  to { box-shadow: inset -13px 9px 0 0 #fff4d4, 0 0 34px rgba(255, 238, 188, 0.5); }
}
@keyframes shootAcross {
  0%, 74% { opacity: 0; transform: translate(0, 0) rotate(16deg); }
  76% { opacity: 1; }
  88%, 100% { opacity: 0; transform: translate(130vw, 38vw) rotate(16deg); }
}
@keyframes twinkle {
  from { opacity: 0.25; transform: scale(calc(var(--s) * 0.8)); }
  to { opacity: 1; transform: scale(var(--s)); }
}
@keyframes sparkUp {
  0% { transform: translateY(0) scale(0.7); opacity: 0; }
  15% { opacity: 0.9; }
  80% { opacity: 0.5; }
  100% { transform: translateY(-105vh) scale(1.2); opacity: 0; }
}
@keyframes sceneIn {
  from { transform: translateY(80px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes magHover {
  from { transform: translate(0, 0) rotate(0deg); }
  to { transform: translate(7px, -8px) rotate(6deg); }
}

#view-home { position: relative; z-index: 1; }

/* 게임 로고: 글자마다 색·기울기가 다른 말풍선 타이틀 */
.game-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.logo-bubble {
  display: flex;
  align-items: baseline;
  justify-content: center;
}
.bl {
  position: relative;
  display: inline-block;
  /* --logo-scale: 글자 수가 많은 언어(CatchHour 9자)에서 넘치지 않게 i18n 이 낮춘다.
     한국어(4자)는 1 이라 예전 크기 그대로다. */
  font-size: calc(clamp(2.9rem, 15.5vw, 4.2rem) * var(--logo-scale, 1));
  font-weight: 900;
  line-height: 1.15;
  color: var(--c);
  transform: rotate(var(--r));
  z-index: 1;
  animation: blPop 0.55s var(--d) cubic-bezier(0.2, 1.6, 0.4, 1) both,
             blBob 2.6s calc(1s + var(--d) * 3) ease-in-out infinite alternate;
}
.bl:nth-child(even) { top: 0.12em; } /* 지그재그 배치 */
/* 두꺼운 흰 테두리 + 바닥 그림자 레이어 (본문 글자 뒤에 깔림)
   ※ text-stroke 대신 16방향 text-shadow — iOS 사파리에서 두꺼운 stroke가
     회색 얼룩(자기교차 패스)으로 깨지는 문제를 피한다 */
.bl::before {
  content: attr(data-ch);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: #fff;
  text-shadow:
    0.085em 0 #fff, -0.085em 0 #fff, 0 0.085em #fff, 0 -0.085em #fff,
    0.06em 0.06em #fff, -0.06em 0.06em #fff, 0.06em -0.06em #fff, -0.06em -0.06em #fff,
    0.078em 0.033em #fff, -0.078em 0.033em #fff, 0.078em -0.033em #fff, -0.078em -0.033em #fff,
    0.033em 0.078em #fff, -0.033em 0.078em #fff, 0.033em -0.078em #fff, -0.033em -0.078em #fff,
    0 0.17em 0 rgba(25, 28, 80, 0.45),
    0 0.32em 0.55em rgba(10, 12, 50, 0.5);
}
.logo-sub {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-indent: 0.22em; /* letter-spacing 보정 */
  color: #b5893a;
  background: #fffdf2;
  padding: 5px 16px;
  border-radius: 999px;
  box-shadow: 0 3px 0 rgba(160, 120, 60, 0.28), 0 6px 12px rgba(90, 70, 20, 0.12);
  animation: fadeUp 0.6s 0.55s both;
}
@keyframes blPop {
  from { transform: scale(0) rotate(var(--r)); opacity: 0; }
  to { transform: scale(1) rotate(var(--r)); opacity: 1; }
}
@keyframes blBob {
  from { transform: rotate(var(--r)) translateY(0); }
  to { transform: rotate(var(--r)) translateY(-0.1em); }
}
@keyframes fadeUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 세로 메뉴 스택 — 앱 게임 메뉴 버튼 */
.menu-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(340px, 88%);
  margin: 0 auto;
}
.menu-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 3px solid #fffdf2;
  border-radius: 24px;
  padding: 12px 17px;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 6px 0 var(--mb-dark), 0 12px 20px rgba(50, 90, 50, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
  animation: menuIn 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.mb-solo { --mb-dark: #2c50c8; background: linear-gradient(180deg, #6d9cff, #4f8df9); animation-delay: 0.2s; }
.mb-hard { --mb-dark: #a03123; background: linear-gradient(180deg, #ff7a5c, #e2564a); animation-delay: 0.28s; }
.mb-challenge { --mb-dark: #6a2fc8; background: linear-gradient(180deg, #b98cff, #9b5cff); animation-delay: 0.29s; }
.mb-coop { --mb-dark: #cf6a10; background: linear-gradient(180deg, #ffb25e, #ff9432); animation-delay: 0.3s; }
/* 랭크 대전: 주홍(구 하드 도전 색) — 대전의 긴장감 + 흰 글씨 대비 (대표 지시 2026-08-25 저녁) */
.mb-versus { --mb-dark: #a03123; background: linear-gradient(180deg, #ff7a5c, #e2564a); animation-delay: 0.31s; }
.mb-rank { --mb-dark: #d29200; background: linear-gradient(180deg, #ffd45c, #ffbe2e); animation-delay: 0.4s; }
.mb-shop { --mb-dark: #1d8a4e; background: linear-gradient(180deg, #5cd694, #34c470); animation-delay: 0.5s; }
/* 대표 버튼(솔로)은 은은하게 숨쉬는 글로우 */
.mb-solo { animation: menuIn 0.5s 0.2s cubic-bezier(0.2, 1.4, 0.4, 1) both, soloGlow 1.8s 1s ease-in-out infinite alternate; }
.menu-btn:hover { filter: brightness(1.06); }
.menu-btn:active {
  transform: translateY(4px) scale(0.99);
  box-shadow: 0 2px 0 var(--mb-dark), 0 5px 10px rgba(50, 90, 50, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
/* 버튼을 주기적으로 스치는 빛 */
.menu-btn::after {
  content: '';
  position: absolute;
  top: -40%;
  left: -60%;
  width: 34%;
  height: 190%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: rotate(16deg);
  animation: cardShine 5s ease-in-out infinite;
}
.mb-coop::after { animation-delay: 1.2s; }
.mb-rank::after { animation-delay: 2.4s; }
.mb-shop::after { animation-delay: 3.6s; }
.mb-icon {
  font-size: 1.7rem;
  flex: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
  animation: iconBob 2.6s ease-in-out infinite;
}
.mb-coop .mb-icon { animation-delay: 0.6s; }
.mb-rank .mb-icon { animation-delay: 1.2s; }
.mb-shop .mb-icon { animation-delay: 1.8s; }
.mb-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mb-text b { font-size: 1.02rem; font-weight: 800; text-shadow: 0 2px 3px rgba(0, 0, 0, 0.22); }
.mb-text small { font-size: 0.72rem; color: rgba(255, 255, 255, 0.85); }
.mb-arrow { flex: none; font-size: 0.8rem; opacity: 0.8; animation: arrowNudge 1.4s ease-in-out infinite; }
@keyframes menuIn {
  from { transform: translateX(-40px) scale(0.9); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes soloGlow {
  from { filter: brightness(1); }
  to { filter: brightness(1.12) drop-shadow(0 0 10px rgba(79, 141, 249, 0.55)); }
}
@keyframes cardShine {
  0%, 55% { left: -60%; }
  78%, 100% { left: 150%; }
}
@keyframes iconBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes arrowNudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

/* 설정 · 정보 모달 — 게임 판때기 스타일 */
.settings-modal {
  text-align: left;
  border: 3px solid #fffdf2;
  border-radius: 22px;
  box-shadow: 0 7px 0 rgba(20, 24, 80, 0.45), 0 18px 32px rgba(10, 12, 50, 0.45);
}
.settings-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.settings-header h3 { margin: 0; flex: 1; text-align: left; }
/* 모달 헤더용 뒤로가기: 게임 화면과 같은 버튼을 헤더 크기에 맞게 */
.settings-header .back-btn {
  width: 38px;
  height: 38px;
  box-shadow: 0 3px 0 #2c50c8, 0 6px 10px rgba(10, 12, 50, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
.settings-header .back-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #2c50c8, inset 0 2px 0 rgba(255, 255, 255, 0.35); }
/* 모달 헤더용 닫기 ✕: 계정 시트와 같은 흰 ✕ — 흰 카드 위에서도 보이게 보라 원판 */
.settings-header .account-close {
  position: static;
  transform: none;
  flex: none;
  width: 34px;
  height: 34px;
  border: 2px solid #fffdf2;
  background: linear-gradient(135deg, var(--primary) 0%, #7f6bff 100%);
  box-shadow: 0 3px 0 #3a49c9, 0 6px 10px rgba(10, 12, 50, 0.2);
  font-size: 1rem;
  transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
}
.settings-header .account-close:hover { filter: brightness(1.08); }
.settings-header .account-close:active { transform: translateY(3px); box-shadow: 0 0 0 #3a49c9; }
.settings-menu {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.settings-menu a {
  display: flex;
  text-decoration: none;   /* 링크로 바뀌었지만 버튼처럼 보이게 (밑줄 제거) */
  align-items: center;
  gap: 11px;
  border: 2px solid #e4e8ff;
  background: linear-gradient(180deg, #fff, #eef1ff);
  border-radius: 14px;
  padding: 10px 13px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 3px 0 #ccd3f2;
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}
.settings-menu a:hover { background: linear-gradient(180deg, #fff, #e6ebff); }
.settings-menu a:active { transform: translateY(3px); box-shadow: 0 0 0 #ccd3f2; }
/* 아이콘은 버튼마다 다른 색의 칩 안에 */
.settings-menu a span {
  flex: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  border-radius: 10px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.settings-menu a:nth-child(1) span { background: linear-gradient(180deg, #8db3ff, #5b8df6); }
.settings-menu a:nth-child(2) span { background: linear-gradient(180deg, #ffb25e, #ff9432); }
.settings-menu a:nth-child(3) span { background: linear-gradient(180deg, #ffd45c, #ffbe2e); }
.settings-menu a:nth-child(4) span { background: linear-gradient(180deg, #5cd694, #34c470); }
.settings-menu a:nth-child(5) span { background: linear-gradient(180deg, #b9c2d8, #96a2c0); }
.settings-menu a:nth-child(6) span { background: linear-gradient(180deg, #c9a4ff, #a678f0); }
.settings-menu a:nth-child(7) span { background: linear-gradient(180deg, #ff9b8f, #ef6a5a); }
.settings-company {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #e7eaf5);
  font-size: 0.7rem;
  color: var(--muted);
}
.settings-company a { color: var(--muted); text-decoration: none; font-weight: 700; }

/* 낮은 화면: 로고·간격 축소로 스크롤 없이 들어가게 */
@media (max-height: 660px) {
  .bl { font-size: clamp(2.3rem, 12vw, 3rem); }
  .game-logo { margin-bottom: 10px; gap: 6px; }
  .logo-sub { padding: 3px 12px; font-size: 0.8rem; }
  .menu-stack { gap: 8px; }
  .menu-btn { padding: 10px 16px; }
  .home-bg .photo-scene { width: min(46vw, 185px); }
}

@media (max-height: 560px) {
  .subtitle { display: none; }
}

/* ===== 버튼 ===== */
.btn {
  font-family: inherit;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover:not(:disabled) { filter: brightness(0.95); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-big { padding: 13px 26px; font-size: 1rem; }
.btn-small { padding: 7px 14px; font-size: 0.85rem; background: #eef0fc; color: var(--primary-dark); }
.btn-hint { background: #ffd54d; color: #6b5200; }
.btn-hint:hover:not(:disabled) { filter: brightness(0.97); }

/* ===== 게임 상단 바 (HUD + 버튼 한 줄) ===== */
.game-top {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.hud-item {
  background: var(--card);
  border-radius: 8px;
  padding: 5px 10px;
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  white-space: nowrap;
}
/* 레벨·점수가 자릿수를 넘길 때마다 칸이 밀리던 문제.
   ① 숫자를 고정폭(tabular-nums)으로 — 9 와 1 의 폭이 달라 매 점수마다 흔들렸다
   ② 자릿수만큼 최소폭을 잡아 두 자리 → 세 자리로 넘어가도 칸 크기가 그대로다
   ③ 줄바꿈 금지 — 한 칸이라도 넘치면 통째로 아랫줄로 떨어져 배치가 확 바뀐다 */
.game-top { flex-wrap: nowrap; }
.hud-item b {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
#solo-level, #coop-level { min-width: 1.6em; }   /* Lv 1 ~ 99 */
#solo-score, #coop-score { min-width: 3.4em; }   /* 점수 네 자리까지 */
#solo-found, #coop-found { min-width: 2.4em; }   /* 0/5 */
.hud-item.timer { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--primary-dark); min-width: 62px; }
.hud-item.timer.low { color: #e53935; animation: pulse 0.6s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.07); } }
.game-top .btn { padding: 5px 12px; font-size: 0.82rem; border-radius: 8px; }

/* 협동 상단바는 칸이 하나 더 많다 — 뒤로가기·Lv·점수·정답·😊핑·🔍돋보기·⏰시간추가 일곱 개.
   nowrap 이라 넘치면 줄바꿈 대신 마지막 버튼이 화면 밖으로 잘려 나간다 (실측: 360px 폭에서
   ⏰ 추가 전에도 이미 15px 넘쳤다). 협동에서만 여백을 줄여 일곱 칸이 들어가게 한다.
   ⚠️ 솔로 상단바는 여섯 칸이라 여유가 있으므로 건드리지 않는다. */
#coop-game .game-top { gap: 4px; }
#coop-game .game-top .hud-item { padding: 5px 7px; }
#coop-game .game-top .btn { padding: 5px 8px; }
/* 작은 화면(구형 안드로이드 360px 이하)에서는 한 번 더 조인다 */
@media (max-width: 380px) {
  #coop-game .game-top { gap: 3px; }
  #coop-game .game-top .hud-item { padding: 4px 5px; font-size: 0.78rem; }
  #coop-game .game-top .btn { padding: 4px 6px; font-size: 0.78rem; }
  #coop-game .game-top .back-btn { width: 30px; height: 30px; }
}
/* 320px (아주 오래된 기기) 에서는 위 설정으로도 10px 이 모자란다 — 숫자칸 최소폭까지 줄인다.
   점수·정답은 자릿수가 늘어도 tabular-nums 라 흔들리지 않으므로 최소폭만 좁혀도 안전하다. */
@media (max-width: 340px) {
  #coop-game .game-top { gap: 2px; }
  #coop-game .game-top .hud-item { padding: 4px 4px; font-size: 0.74rem; }
  #coop-game .game-top .btn { padding: 4px 5px; font-size: 0.74rem; }
  #coop-game #coop-score { min-width: 2.9em; }
  #coop-game #coop-found { min-width: 2.1em; }
}

/* ===== 보드: 남은 공간을 전부 쓰되 절대 넘치지 않음 =====
   세로 화면: 위아래 배치 / 가로 화면: 좌우 배치.
   svg는 컨테이너 안에서 비율 유지 축소(letterbox)되므로 잘림 없음. */
.boards {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative; /* 별 잡기 레이어·보너스 배지 오버레이 기준 */
}
@media (orientation: landscape) {
  .boards { flex-direction: row; }
}
/* JS(board.js)가 사진 비율에 맞춰 이미지가 더 커지는 방향을 계산해 지정 (미디어쿼리보다 우선) */
.boards.dir-row { flex-direction: row; }
.boards.dir-col { flex-direction: column; }

/* 게임 중에는 상단바를 항상 숨겨 보드에 최대 공간을 준다 */
body.in-game #topbar { display: none; }

/* 게임 중에는 좌우/상하 여백을 최소화해 사진을 최대한 크게 보여준다 */
body.in-game #app { padding: 4px 2px 6px; }

/* PC: 게임 중 가로 폭 제한(1100px)을 풀어 사진 두 장이 화면을 꽉 채우게 */
@media (min-width: 1024px) {
  body.in-game #app { max-width: none; padding: 8px 16px 12px; }

  /* 상단바(프로필·재화)를 내용 폭에 맞춰 가운데로 — 넓은 화면에서 양끝으로 흩어지지 않게 */
  #topbar { max-width: 1100px; width: 100%; margin: 0 auto; }

  /* 게임 HUD를 한 덩어리로 가운데 정렬 + 크게 */
  body.in-game .game-top { justify-content: center; gap: 10px; }
  body.in-game .game-top .back-btn { margin-right: 14px; width: 40px; height: 40px; font-size: 1.2rem; }
  body.in-game .game-top .hud-item { font-size: 0.98rem; padding: 7px 15px; border-radius: 10px; }
  body.in-game .game-top .btn { font-size: 0.95rem; padding: 7px 16px; }

}

/* ===== 가로 화면 게임 레이아웃: HUD를 왼쪽 세로 열로 옮겨 사진이 화면 높이를 꽉 쓴다 ===== */
@media (orientation: landscape) and (max-height: 620px) {
  body.in-game #view-solo,
  body.in-game #coop-game { flex-direction: row; align-items: stretch; gap: 6px; }

  body.in-game .game-top {
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 92px;
    flex: 0 0 auto;
    overflow-y: auto;
  }
  body.in-game .game-top .back-btn { margin: 0 0 2px; }
  body.in-game .game-top .hud-item,
  body.in-game .game-top .btn {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    justify-content: center;
  }
  body.in-game .game-top .hud-item.timer { min-width: 0; }

  /* 협동 플레이어 상태창도 세로 열로 (HUD 열 옆) */
  body.in-game #coop-game .player-bar {
    flex-direction: column;
    justify-content: flex-start;
    width: 108px;
    flex: 0 0 auto;
    margin: 0;
    overflow-y: auto;
  }
  body.in-game #coop-game .player-bar .pcard {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* 두 장을 한눈에 구분하는 색 —
   사진이 복잡하면 어느 쪽을 보고 있었는지 놓치기 쉬워, 사진 둘레(레터박스)에
   서로 다른 색을 깔아 위·아래를 구별한다. 위(A)는 원본이라 흰색, 아래(B)는 민트색.
   정답 위치와는 무관하므로 난이도에 영향을 주지 않는다. */
.board {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #fdfdff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
  /* 퍼즐 사진 복사 방지: 선택·길게 눌러 저장 차단 (우클릭/드래그는 board.js에서) */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.board svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: manipulation;
}
.board svg image {
  -webkit-user-drag: none;
}

/* 두 사진 사이 구분선 — 세로 배치면 가로선, 가로 배치면 세로선 */
/* 아래(B)는 바뀐 그림 — 다른 색을 깔아 위와 헷갈리지 않게 한다.
   (:last-of-type 대신 id 로 짚는다 — .boards 에 요소가 하나 늘면 조용히 어긋난다) */
#solo-board-b, #coop-board-b {
  background: #dff7ec;
  box-shadow: 0 0 0 3px #5cd694;
}

.board-divider { flex: none; border-radius: 2px; }
.boards:not(.dir-row) .board-divider {
  height: 3px;
  width: 94%;
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--primary) 18%, var(--primary) 82%, transparent);
}
.boards.dir-row .board-divider {
  width: 3px;
  height: 94%;
  margin: auto 0;
  background: linear-gradient(180deg, transparent, var(--primary) 18%, var(--primary) 82%, transparent);
}
@media (orientation: landscape) {
  .boards:not(.dir-col) .board-divider {
    width: 3px;
    height: 94%;
    margin: auto 0;
    background: linear-gradient(180deg, transparent, var(--primary) 18%, var(--primary) 82%, transparent);
  }
}

/* 보드 오버레이 마크 */
.mark-found {
  fill: none;
  stroke: #e53935;
  stroke-width: 7;
  transform-box: fill-box;
  transform-origin: center;
  animation: foundPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
/* 정답 순간 퍼져나가는 링 (JS가 잠시 추가했다 제거) */
.mark-ripple {
  fill: none;
  stroke: #e53935;
  transform-box: fill-box;
  transform-origin: center;
  animation: rippleOut 0.7s ease-out forwards;
}
.mark-ripple.p1 { stroke: var(--p1); }
.mark-ripple.p2 { stroke: var(--p2); }
.mark-ripple.p3 { stroke: var(--p3); }
.mark-ripple.p4 { stroke: var(--p4); }
/* 정답 순간 중심에서 반짝 터지는 별 */
.mark-flash {
  fill: #fff176;
  stroke: #f59e0b;
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: flashPop 0.55s ease-out forwards;
}
@keyframes foundPop {
  0% { transform: scale(2); opacity: 0; }
  55% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes rippleOut {
  0% { transform: scale(0.55); opacity: 0.95; stroke-width: 7; }
  100% { transform: scale(1.7); opacity: 0; stroke-width: 1; }
}
@keyframes flashPop {
  0% { transform: scale(0.2) rotate(0deg); opacity: 1; }
  60% { transform: scale(1.2) rotate(40deg); opacity: 0.9; }
  100% { transform: scale(1.6) rotate(70deg); opacity: 0; }
}
/* 협동: 찾아낸 사람(1~4번)별 색. 상단 상태창 색과 같은 값이다 */
.mark-found.p1, .mark-miss.p1 { stroke: var(--p1); }
.mark-found.p2, .mark-miss.p2 { stroke: var(--p2); }
.mark-found.p3, .mark-miss.p3 { stroke: var(--p3); }
.mark-found.p4, .mark-miss.p4 { stroke: var(--p4); }
.mark-hint { fill: rgba(255, 213, 77, 0.25); stroke: #ffb300; stroke-width: 3; stroke-dasharray: 8 6; animation: hintPulse 1s infinite alternate; }
@keyframes hintPulse { from { opacity: 0.5; } to { opacity: 1; } }
/* 라운드 종료 정답 공개: 파란 점선 원 — 팝 등장 후 점선이 천천히 돈다 */
.mark-reveal {
  fill: rgba(47, 125, 246, 0.14);
  stroke: #2f7df6;
  stroke-width: 6;
  stroke-dasharray: 15 11;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: center;
  animation: revealIn 0.55s cubic-bezier(0.2, 1.6, 0.4, 1) both,
             revealDash 5s linear infinite;
}
@keyframes revealIn {
  0% { transform: scale(1.9); opacity: 0; }
  60% { transform: scale(0.92); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes revealDash {
  to { stroke-dashoffset: -104; }
}
/* 탭 즉시 피드백 링: 서버 판정 전에 "눌렸다"는 반응을 바로 보여준다 */
.mark-tap {
  fill: none;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 4;
  pointer-events: none;
  animation: tapRipple 0.35s ease-out forwards;
}
@keyframes tapRipple {
  0% { transform: scale(0.4); opacity: 0.95; }
  100% { transform: scale(1.6); opacity: 0; }
}

.mark-miss {
  stroke: #e53935;
  stroke-width: 9;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: center;
  animation: missSlam 0.3s cubic-bezier(0.2, 1.5, 0.4, 1) both, missShake 0.3s 0.3s ease-in-out, missFade 0.25s 0.75s ease-in forwards;
  filter: drop-shadow(0 0 6px rgba(229, 57, 53, 0.7));
}
@keyframes missSlam {
  0% { transform: scale(2.6) rotate(-18deg); opacity: 0; }
  70% { transform: scale(0.9) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes missShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-4px, 0); }
  50% { transform: translate(4px, 0); }
  75% { transform: translate(-3px, 0); }
}
@keyframes missFade {
  to { transform: scale(0.85); opacity: 0; }
}

.game-actions { margin-top: 10px; display: flex; justify-content: center; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ===== 협동 ===== */
.coop-options { display: flex; flex-direction: column; gap: 12px; max-width: 380px; margin: 0 auto 14px; }
/* 밤하늘 배경 위 게임 버튼 스타일 */
.coop-options .btn {
  border: 2px solid #fffdf2;
  box-shadow: 0 5px 0 rgba(20, 24, 80, 0.45), 0 10px 18px rgba(10, 12, 50, 0.35);
}
.coop-options .btn-big { border-radius: 18px; }
.coop-options .btn-primary { background: linear-gradient(180deg, #6d9cff, #4f8df9); }
.coop-options .btn-secondary { background: linear-gradient(180deg, #ffb25e, #ff9432); }
#coop-menu .hint-text, #coop-searching .hint-text { color: #c9cdf0; }

/* '랜덤' 매칭 진행 표시 — 몇 인을 찾는 중이고 언제 넓어지는지 (스피너만 돌면 고장으로 보인다) */
.search-step {
  margin: 14px auto 4px;
  padding: 8px 16px;
  max-width: min(88vw, 360px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffd9a8;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.join-row { display: flex; gap: 8px; }
.join-row input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border: 2px solid #dde1f5;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  outline: none;
}
.join-row input:focus { border-color: var(--primary); }

/* ===== 무작위 매칭 인원 고르기 (2·3·4인 / 랜덤) ===== */
.match-size { margin-top: 4px; }
.match-size-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #c9cdf0;
}
.match-size-opts { display: flex; gap: 6px; }
.size-opt {
  flex: 1;
  min-width: 0;
  padding: 10px 4px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  color: #dfe3ff;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.size-opt:active { transform: scale(0.96); }
.size-opt.on {
  color: #21254a;
  background: linear-gradient(180deg, #ffd08a, #ffb25e);
  border-color: #ffdca8;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}
#coop-search-size { color: #ffc27a; }

.invite-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  max-width: 360px;
  margin: 0 auto 14px;
}
.invite-code-label { color: var(--muted); font-size: 0.85rem; }
.invite-code { font-size: 1.8rem; font-weight: 800; letter-spacing: 6px; color: var(--primary-dark); margin: 6px 0 10px; }
.invite-actions { display: flex; justify-content: center; gap: 8px; margin-bottom: 10px; }
.qr { width: min(160px, 34vh); height: auto; border-radius: 8px; }
/* 📷 인앱 QR 스캐너 오버레이 — 카메라 화면 위 조준 틀·안내·닫기 */
.qr-scan {
  position: fixed; inset: 0; z-index: 9000; background: #000;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.qr-scan video { width: 100%; height: 100%; object-fit: cover; }
.qr-scan-frame {
  position: absolute; width: min(66vw, 300px); aspect-ratio: 1;
  border: 3px solid rgba(255, 255, 255, 0.95); border-radius: 22px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5); /* 틀 밖을 어둡게 */
}
.qr-scan-hint {
  position: absolute; left: 16px; right: 16px;
  top: calc(50% + min(33vw, 150px) + 20px); text-align: center;
  color: #fff; font-size: 0.95rem; font-weight: 700; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.qr-scan-close {
  position: absolute; bottom: calc(28px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  padding: 12px 34px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.16); border: 2px solid rgba(255, 255, 255, 0.5);
  color: #fff; font-size: 1rem; font-weight: 800;
}

.player-list { list-style: none; max-width: 360px; margin: 0 auto 14px; display: flex; flex-direction: column; gap: 8px; }
.player-list li {
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  display: flex;
  justify-content: center; /* 색 점·이름·방장 배지를 항상 가운데 정렬 */
  gap: 8px;
  align-items: center;
}
.player-list .host-badge { font-size: 0.75rem; background: #ffe9a8; color: #6b5200; border-radius: 6px; padding: 2px 8px; }
.player-list.compact { flex-direction: row; flex-wrap: wrap; justify-content: center; max-width: none; margin: 0; gap: 6px; }
.player-list.compact li { padding: 4px 10px; font-size: 0.78rem; gap: 6px; }

/* 대기실: 순번 색 점 */
.pdot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-right: 8px; display: inline-block; }
.player-list li > span:first-child { display: flex; align-items: center; }
.pdot.p1 { background: var(--p1); }
.pdot.p2 { background: var(--p2); }
.pdot.p3 { background: var(--p3); }
.pdot.p4 { background: var(--p4); }

/* ===== 협동 게임 상단 플레이어 상태창 (최대 4명 한 줄) ===== */
.player-bar {
  flex: none;
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0 0 2px;
  width: 100%;
  /* 카드를 가운데로 모아 팀 점수판처럼 — 좌우로 퍼지면 각자 보드 주인처럼 오해된다 */
  justify-content: center;
  align-items: center;
}
.player-bar::before { content: '🤝'; flex: none; font-size: 1rem; }
/* ⚔️ 경쟁전은 협동이 아니므로 손잡는 아이콘 대신 검을 보여준다 (대표 신고) */
body.versus-game .player-bar::before { content: '⚔️'; }
.pcard {
  flex: 0 1 200px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--muted);
  padding: 5px 8px;
  font-size: 0.76rem;
  line-height: 1.2;
}
.pcard.me { outline: 2px solid rgba(91, 108, 255, 0.35); }
/* 장착 캐릭터: 좁아도 절대 잘리지 않게 별도 요소로 */
.pcard .pchar { flex: none; font-size: 0.95rem; line-height: 1; }
.pcard .pname {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pcard .pfinds { flex: none; font-weight: 800; font-size: 0.9rem; }
.pcard .pfinds i { font-style: normal; font-size: 0.7rem; font-weight: 600; margin-left: 1px; }
/* 돋보기: 이번 게임에 쓸 수 있으면 또렷하게, 없거나 이미 썼으면 흐리게.
   숫자는 소지 개수가 아니라 1/0 (게임당 1개라 개수는 뜻이 없다) */
.pcard .pmag { flex: none; color: var(--muted); font-weight: 700; }
.pcard .pmag.off { opacity: 0.38; filter: grayscale(1); }
/* 게임 도중 이탈한 플레이어: 흐리게 + ✗ 표기 */
.pcard.out { opacity: 0.55; filter: grayscale(0.7); }
.pcard.out .pname { text-decoration: line-through; }
.pcard .pout { flex: none; color: #e2504a; font-weight: 900; font-size: 1rem; }
.pcard.p1 { border-left-color: var(--p1); }
.pcard.p2 { border-left-color: var(--p2); }
.pcard.p3 { border-left-color: var(--p3); }
.pcard.p4 { border-left-color: var(--p4); }
.pcard.p1 .pname, .pcard.p1 .pfinds { color: var(--p1); }
.pcard.p2 .pname, .pcard.p2 .pfinds { color: var(--p2); }
.pcard.p3 .pname, .pcard.p3 .pfinds { color: var(--p3); }
.pcard.p4 .pname, .pcard.p4 .pfinds { color: var(--p4); }

/* ===== 우편함 ===== */
.mail-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(120, 20, 20, 0.45);
}
.mail-tabs { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
/* 탭 줄 우측에 [모두 받기] — 받을 무료 우편이 없으면 흐려진다.
   좁은 화면에서는 글자가 꺾이지 않게 버튼이 다음 줄로 내려간다 */
.mail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; margin-bottom: 8px; }
.mail-head .mail-tabs { margin-bottom: 0; flex-wrap: nowrap; }
.mail-head .mail-tab, #mail-claim-all { white-space: nowrap; }
#mail-claim-all { margin-left: auto; }
#mail-claim-all:disabled { opacity: 0.45; cursor: default; }
/* 수령 완료 우편 정리용 삭제 버튼 — 눈에 띄지 않게 옅은 아이콘만 */
.mail-del {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  opacity: 0.45;
  padding: 4px 2px 4px 6px;
}
.mail-del:hover { opacity: 0.9; }
.mail-tab {
  border: none;
  background: rgba(91, 108, 255, 0.08);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}
.mail-tab.on { background: #5b6cff; color: #fff; }
/* 우편 수와 무관하게 모달 크기 고정 — 리스트만 스크롤 (대표 지시 2026-08-27) */
.mail-list { height: 46vh; overflow-y: auto; margin: 2px 0 8px; }
.modal.modal-mail { max-width: 460px; position: relative; }
/* 제목 우측 ? 도움말 버튼 — 누르기 전엔 안내문이 화면에 안 보인다 */
.mail-help {
  position: absolute; top: 18px; right: 18px; width: 30px; height: 30px;
  border: 2px solid #dfe4fb; border-radius: 50%; background: #f1f3fd;
  color: #5a6090; font-size: 0.95rem; font-weight: 900; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mail-help:hover { background: #e6eafc; }
/* 도움말 — 리스트 위 카드로. 평소 숨김, [?] 로 토글 */
.mail-tip { display: none; }
.mail-tip.show {
  display: block; margin: 4px 0 10px; padding: 11px 14px;
  background: #f4f6ff; border: 2px solid #dfe4fb; border-radius: 12px;
  color: #5a6090; font-size: 0.8rem; font-weight: 700; line-height: 1.7;
  text-align: left; word-break: keep-all; overflow-wrap: break-word;
}
.mail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 6px;
  border-bottom: 1px solid rgba(120, 128, 200, 0.18);
}
.mail-row:last-child { border-bottom: none; }
.mail-row.claimed { opacity: 0.55; }
.mail-ico { flex: none; font-size: 1.35rem; }
.mail-info { flex: 1 1 auto; min-width: 0; text-align: left; }
.mail-info b { display: block; font-size: 0.86rem; }
.mail-info small { display: block; font-size: 0.7rem; color: var(--muted); line-height: 1.35; }
.mail-exp { display: block; font-size: 0.66rem; font-weight: 700; color: var(--muted); }
.mail-exp.soon { color: #e5484d; }      /* 오늘·내일 만료 */
.mail-exp.keep { color: #2f9e5f; }      /* 구매 상품 — 기한 없음 */
.mail-amt { flex: none; font-weight: 800; font-size: 0.82rem; color: #5b6cff; }
.mail-claim { flex: none; }
.mail-done { flex: none; font-size: 0.74rem; font-weight: 700; color: var(--muted); }
.mail-empty { text-align: center; color: var(--muted); padding: 18px 0; font-size: 0.88rem; }
.mail-tip { font-size: 0.72rem; color: var(--muted); line-height: 1.5; margin: 0; }

/* ===== 협동 이모지 핑: 팔레트 + 이름표 위로 떠오르는 팝 ===== */
.ping-palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 480px;
  margin: 4px auto;
  padding: 6px 8px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.ping-opt {
  border: none;
  background: rgba(91, 108, 255, 0.08);
  border-radius: 10px;
  padding: 5px 9px;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.ping-opt.text { font-size: 0.78rem; font-weight: 800; color: #5b6cff; padding: 8px 10px; }
.ping-opt:active { transform: scale(0.92); }

.pcard { position: relative; } /* 핑 팝 기준점 */
.ping-pop {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.3rem;
  line-height: 1;
  pointer-events: none;
  z-index: 5;
  animation: pingPop 1.6s ease-out forwards;
}
.ping-pop.text {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  background: #5b6cff;
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(20, 24, 80, 0.35);
}
@keyframes pingPop {
  0%   { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.6); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(-4px) scale(1.15); }
  24%  { transform: translateX(-50%) translateY(-2px) scale(1); }
  75%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(0.9); }
}

/* ===== 꾸미기: 협동 상태창 이름표 테두리 (상점 미리보기 칩과 공용) =====
   슬롯 색(border-left)은 그대로 두고 박스섀도 링으로 감싼다 */
.b-gold { box-shadow: 0 0 0 2px #ffc93c, 0 2px 10px rgba(255, 190, 40, 0.55); }
.b-neon { box-shadow: 0 0 0 2px #c44dff, 0 0 12px rgba(196, 77, 255, 0.75); }
.b-rainbow { animation: bdRainbow 3s linear infinite; }
@keyframes bdRainbow {
  0%   { box-shadow: 0 0 0 2px #ff5b5b, 0 0 10px rgba(255, 91, 91, 0.6); }
  25%  { box-shadow: 0 0 0 2px #ffc93c, 0 0 10px rgba(255, 201, 60, 0.6); }
  50%  { box-shadow: 0 0 0 2px #39d98a, 0 0 10px rgba(57, 217, 138, 0.6); }
  75%  { box-shadow: 0 0 0 2px #4d9fff, 0 0 10px rgba(77, 159, 255, 0.6); }
  100% { box-shadow: 0 0 0 2px #ff5b5b, 0 0 10px rgba(255, 91, 91, 0.6); }
}
.b-fire { animation: bdFire 1.1s ease-in-out infinite alternate; }
@keyframes bdFire {
  from { box-shadow: 0 0 0 2px #ff7a1a, 0 0 8px rgba(255, 122, 26, 0.7); }
  to   { box-shadow: 0 0 0 3px #ffb02e, 0 0 16px rgba(255, 64, 0, 0.85); }
}
.b-crown { position: relative; box-shadow: 0 0 0 2px #ffd700, 0 0 0 4px #b8860b, 0 2px 12px rgba(255, 215, 0, 0.6); }
.b-crown::after { content: '👑'; position: absolute; top: -11px; right: -5px; font-size: 0.85rem; line-height: 1; pointer-events: none; }
.b-galaxy { animation: bdGalaxy 4s ease-in-out infinite; }
@keyframes bdGalaxy {
  0%, 100% { box-shadow: 0 0 0 2px #7b7ff2, 0 0 10px rgba(120, 100, 255, 0.7); }
  50%      { box-shadow: 0 0 0 2px #4dd7ff, 0 0 16px rgba(77, 215, 255, 0.8); }
}
@media (max-width: 420px) {
  .pcard { font-size: 0.7rem; padding: 4px 6px; gap: 4px; border-left-width: 4px; }
  .pcard .pfinds { font-size: 0.82rem; }
}

/* 협동 게임 종료 → 랭킹 화면 상단 요약 배너 */
.rank-result {
  max-width: 480px;
  margin: 0 auto 12px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  font-size: 0.95rem;
}
#rank-action { display: block; margin: 4px auto 12px; }
.rank-result .rank-miss { display: inline-block; margin-top: 4px; color: #8a5bff; font-weight: 800; }

.spinner {
  width: 44px; height: 44px;
  border: 5px solid #dde1f5;
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 20px auto;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* 🎲 상대 찾는 중 — 밤하늘 배경 위 게임 톤: 빛나는 링 + 안내 밝게 */
#coop-searching .spinner {
  width: 64px; height: 64px; border-width: 6px;
  border-color: rgba(255, 255, 255, 0.18); border-top-color: #8ea0ff;
  box-shadow: 0 0 28px rgba(120, 140, 255, 0.55);
  margin: 26px auto;
}
#coop-searching .hint-text, #coop-searching .search-step { color: #c9cfff; }

.hint-text { color: var(--muted); font-size: 0.82rem; margin: 8px 0 12px; line-height: 1.6; }

/* ===== 랭킹 — 밤하늘 배경 위 게임 스타일 ===== */
.tabs { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }

/* 협동 랭킹 인원별 하위 필터 — 상위 탭보다 작고 옅게 (계층이 보여야 한다) */
.subtabs { display: flex; justify-content: center; gap: 6px; margin: -6px 0 14px; }
.subtab {
  padding: 5px 14px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #b9c0ea;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  cursor: pointer;
}
.subtab.active {
  color: #21254a;
  background: linear-gradient(180deg, #ffd08a, #ffb25e);
  border-color: #ffdca8;
}
.tab {
  font-family: inherit;
  border: 2px solid rgba(255, 253, 242, 0.35);
  background: rgba(255, 253, 242, 0.16);
  color: #dfe2ff;
  border-radius: 999px;
  padding: 8px 24px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.tab.active {
  background: linear-gradient(180deg, #6d9cff, #4f8df9);
  color: #fff;
  border-color: #fffdf2;
  box-shadow: 0 3px 0 rgba(20, 24, 80, 0.4);
}

.rank-list { list-style: none; max-width: 560px; margin: 0 auto 16px; display: flex; flex-direction: column; gap: 8px; }
.rank-list li {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(10, 12, 50, 0.3);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  animation: rankIn 0.35s both;
}
/* 순위별 스태거 등장 딜레이는 JS(Rank.load)가 전 순위에 균일하게 지정 */
@keyframes rankIn {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
/* TOP 3: 금·은·동 카드 */
.rank-list li:nth-child(1) { background: linear-gradient(90deg, #fff3cd, #fffdf4); outline: 2px solid #ffcf4d; }
.rank-list li:nth-child(2) { background: linear-gradient(90deg, #eef2f8, #fbfdff); outline: 2px solid #b9c4d6; }
.rank-list li:nth-child(3) { background: linear-gradient(90deg, #fdeada, #fffaf5); outline: 2px solid #e2a06a; }
.rank-list li:nth-child(-n+3) .rank-num { font-size: 1.45rem; }
/* ===== 게임 종료 TIME OVER 연출 ===== */
#timeover {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* 순수 연출 — 앱 백그라운드로 제거 타이머가 끊겨 남아도 터치를 삼키지 않게 */
  pointer-events: none;
  animation: toBackdrop 1.8s ease forwards;
}
.timeover-text {
  font-size: clamp(2.8rem, 14vw, 5.5rem);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
  color: #fff;
  -webkit-text-stroke: 2px #e53935;
  text-shadow: 0 5px 0 #9c1c24, 0 0 34px rgba(229, 57, 53, 0.85);
  animation:
    toSlam 0.5s cubic-bezier(0.15, 1.6, 0.4, 1) both,
    toShake 0.45s 0.5s ease-in-out,
    toOut 0.3s 1.5s ease-in forwards;
}
@keyframes toSlam {
  from { transform: scale(4.5) rotate(-6deg); opacity: 0; }
  70% { transform: scale(0.92) rotate(1deg); opacity: 1; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes toShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-7px, 4px); }
  40% { transform: translate(6px, -5px); }
  60% { transform: translate(-5px, 3px); }
  80% { transform: translate(4px, -2px); }
}
@keyframes toOut {
  to { transform: scale(0.8); opacity: 0; }
}
@keyframes toBackdrop {
  0% { background: rgba(8, 10, 26, 0); }
  15% { background: rgba(8, 10, 26, 0.62); }
  80% { background: rgba(8, 10, 26, 0.62); }
  100% { background: rgba(8, 10, 26, 0); }
}

/* ===== 라이프 소진 GAME OVER 연출 ===== */
#gameover {
  position: fixed;
  inset: 0;
  z-index: 310;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none; /* 순수 연출 — 잔류해도 터치를 막지 않는다 */
  animation: goBackdrop 2.4s ease forwards;
}
.gameover-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.gameover-text {
  font-size: clamp(2.6rem, 13vw, 5.2rem);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.06em;
  color: #ff5252;
  -webkit-text-stroke: 2px #7f0f14;
  text-shadow: 0 6px 0 #4a090c, 0 0 40px rgba(229, 57, 53, 0.95);
  animation: goDrop 0.6s cubic-bezier(0.3, 1.3, 0.5, 1) both, goFlicker 0.9s 0.6s steps(2, start) 2, goOut 0.4s 2s ease-in forwards;
}
.gameover-sub {
  font-weight: 800;
  font-size: clamp(0.95rem, 4vw, 1.3rem);
  color: #ffd9d9;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  animation: sfxRise 0.5s 0.5s both, goOut 0.4s 2s ease-in forwards;
}
.gameover-stats {
  font-weight: 900;
  font-size: 1.05rem;
  color: #ffd54d;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}
@keyframes goDrop {
  0% { transform: translateY(-70vh) scale(1.4); opacity: 0; }
  60% { transform: translateY(4px) scale(0.96); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes goFlicker {
  50% { opacity: 0.55; }
}
@keyframes goOut {
  to { transform: scale(0.85); opacity: 0; }
}
@keyframes goBackdrop {
  0% { background: rgba(10, 4, 8, 0); }
  18% { background: rgba(10, 4, 8, 0.8); }
  82% { background: rgba(10, 4, 8, 0.8); }
  100% { background: rgba(10, 4, 8, 0); }
}

/* 게임 중 우측 세로 라이프 바 (남은 ❤️ / 잃은 🖤) */
#lives-bar {
  position: fixed;
  /* position:fixed 라 body 안전영역 여백이 먹지 않는다 — 가로 모드 노치용으로 직접 더한다 */
  right: calc(3px + env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  z-index: 150;
  display: none;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}
body.in-game #lives-bar { display: flex; }
#lives-bar span { font-size: 1.05rem; line-height: 1; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45)); }
/* PC(넓은 화면): 보드 두 장이 화면 폭을 꽉 채워 우측 세로 하트가 사진을 가린다 —
   상단 HUD 줄 오른쪽으로 옮겨 가로로 눕힌다. 하트 칸 수는 updateLives 가 항상
   최대 라이프만큼(잃은 하트는 🖤로) 그려서, 얻거나 깎여도 자리가 밀리지 않는다.
   오른쪽 끝 고정(right)이라 혹시 최대치가 변해도 왼쪽으로만 자라 사진을 안 가린다. */
@media (min-width: 1024px) {
  #lives-bar {
    top: calc(10px + env(safe-area-inset-top));
    right: 24px;
    transform: none;
    flex-direction: row;
    align-items: center;
    height: 44px; /* PC 상단 HUD 줄(뒤로가기 40px)과 세로 중앙을 맞춘다 */
    gap: 8px;
  }
  #lives-bar span { font-size: 1.7rem; }
  /* 기본 흔들림 keyframe 은 세로 중앙용 translateY(-50%)를 포함한다 — 상단 배치에서
     그대로 쓰면 바가 위로 튄다. 기본 규칙(#lives-bar.hurt)이 소스상 이 블록 뒤에 있어
     같은 특이도로는 지므로 body.in-game 을 붙여 확실히 이긴다 */
  body.in-game #lives-bar.hurt { animation: livesHurtTop 0.6s ease-in-out; }
}
@keyframes livesHurtTop {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
#lives-bar span.lost { opacity: 0.4; }
#lives-bar.hurt { animation: livesHurt 0.6s ease-in-out; }
/* 하트가 터지며 꺼지는 순간 */
#lives-bar span.dying { animation: heartDie 0.38s ease-in both; }
@keyframes heartDie {
  0% { transform: scale(1); filter: none; }
  35% { transform: scale(1.7) rotate(-12deg); filter: drop-shadow(0 0 8px rgba(255, 60, 60, 0.9)); }
  70% { transform: scale(0.7) rotate(10deg); }
  100% { transform: scale(1); opacity: 0.4; }
}
/* 주의: #lives-bar 기본 위치가 translateY(-50%)라 keyframe에도 반드시 포함해야 한다.
   빠뜨리면 애니메이션 동안 세로 중앙 정렬이 풀려 바 전체가 아래로 튀는 버그가 된다. */
/* 바 전체 확대(scale)는 위치가 움직여 보여서 뺐다 — 좌우 흔들림만, 팝은 하트별 heartDie가 담당 */
@keyframes livesHurt {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  20% { transform: translateY(-50%) translateX(-4px); }
  40% { transform: translateY(-50%) translateX(4px); }
  60% { transform: translateY(-50%) translateX(-3px); }
  80% { transform: translateY(-50%) translateX(2px); }
}

/* ===== 스테이지 클리어 / 시작 연출 ===== */
#stagefx {
  position: fixed;
  inset: 0;
  z-index: 290;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}
#stagefx.clear { animation: sfxDim 2.2s ease forwards; }
/* 사진 위에 바로 얹히면 배경이 밝을 때 글자가 묻힌다 (대표 보고 — 크리스마스 트리 사진).
   문구 뒤에만 부드럽게 어두운 판을 깔아 어떤 사진에서도 읽히게 한다.
   화면 전체를 덮지 않는 것이 핵심 — 사진이 안 보이면 게임이 멈춘 것처럼 느껴진다. */
.stagefx-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 34px;
  border-radius: 28px;
  background: radial-gradient(ellipse at center,
    rgba(10, 12, 34, 0.82) 0%, rgba(10, 12, 34, 0.66) 55%, rgba(10, 12, 34, 0) 78%);
}
.stagefx-main {
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
  color: #fff;
  /* 한국어 제목이 좁은 기기에서 '성/공', '스테이/지'처럼 낱말 중간에서 잘리지 않게 한다.
     줄바꿈은 낱말 사이(공백)에서만 — 그래도 넘치면 화면을 벗어나지 않도록 폭을 제한한다. */
  text-align: center;
  word-break: keep-all;
  overflow-wrap: break-word;
  max-width: 94vw;
}
.stagefx-sub {
  font-weight: 800;
  font-size: clamp(1.1rem, 5vw, 1.55rem);
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  /* 설명 문구도 낱말 중간에서 잘리지 않게 — '받았어요!'가 '받았/어요!'로 쪼개지던 문제 */
  text-align: center;
  word-break: keep-all;
  overflow-wrap: break-word;
  max-width: 94vw;
}

/* 클리어: 금색 슬램 + 반짝 + 파티클 */
#stagefx.clear .stagefx-main {
  /* 'STAGE CLEAR!' 는 12자라 폰에서는 두 줄로 접힌다.
     한 줄에 맞추려면 예전 크기와 별 차이가 없어져(4%) '더 크게' 라는 요구를 못 채운다.
     그래서 두 줄을 그대로 두되 줄간격을 조여 <b>의도한 스택</b>으로 보이게 한다. */
  font-size: clamp(2.6rem, 13.5vw, 5.4rem);
  line-height: 0.92;
  text-align: center;
  -webkit-text-stroke: 2px #f59e0b;
  text-shadow: 0 5px 0 #b45309, 0 0 32px rgba(255, 200, 60, 0.9);
  animation: sfxSlam 0.5s cubic-bezier(0.15, 1.6, 0.4, 1) both, sfxOut 0.35s 1.8s ease-in forwards;
}
#stagefx.clear .stagefx-sub { animation: sfxRise 0.45s 0.3s both, sfxOut 0.35s 1.8s ease-in forwards; }

/* 시작: 파란 줌 인 → 아웃 (다음 스테이지 안내) */
#stagefx.start .stagefx-main {
  font-size: clamp(2.9rem, 14vw, 5.6rem);
  -webkit-text-stroke: 2px var(--primary);
  text-shadow: 0 5px 0 var(--primary-dark), 0 0 30px rgba(91, 108, 255, 0.85);
  animation: sfxZoomIn 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both, sfxOut 0.3s 1.25s ease-in forwards;
}
#stagefx.start .stagefx-sub { animation: sfxRise 0.4s 0.2s both, sfxOut 0.3s 1.25s ease-in forwards; }

/* 보너스 스테이지 안내: 목표 문구를 읽을 시간을 줘야 해서 더 오래 유지 (약 3.7초) */
#stagefx.bonus-hold .stagefx-main {
  animation: sfxZoomIn 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both, sfxOut 0.3s 3.4s ease-in forwards;
}
#stagefx.bonus-hold .stagefx-sub {
  animation: sfxRise 0.4s 0.2s both, sfxOut 0.3s 3.4s ease-in forwards;
}

/* ===== 보너스 스테이지 안내 — 홈 로고처럼 크고 알록달록하게 =====
   글자마다 색·기울기가 다르고, 하나씩 통통 튀어나온 뒤 계속 흔들린다.
   규칙 설명을 읽을 시간이 필요해 제목을 3초 넘게 세워 둔다. */
#stagefx.bonus-intro { animation: sfxDim 4.5s ease forwards; }
/* ⚠️ #stagefx.start .stagefx-main 이 파란 테두리·그림자를 먹이므로 특정도를 맞춰 되돌린다.
   (그냥 .stagefx-main.colorful 로 두면 파란 stroke 가 이겨서 글자색이 다 파랗게 보인다) */
#stagefx .stagefx-main.colorful {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  max-width: 96vw;
  font-style: normal;
  letter-spacing: 0;
  -webkit-text-stroke: 0;
  text-shadow: none;
}
.sfx-space { display: inline-block; width: 0.32em; }
/* 같은 낱말의 글자 묶음 — 내부는 절대 줄바꿈되지 않고, 넘치면 낱말 통째로 다음 줄로 내려간다.
   (알록달록 제목 '보너스 스테이지'가 '스테이/지'로 잘리던 문제를 없앤다) */
.sfx-word {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.sfx-ch {
  position: relative;
  display: inline-block;
  font-size: clamp(2.5rem, 13vw, 5rem);
  font-weight: 900;
  line-height: 1.12;
  color: var(--c);
  transform: rotate(var(--r));
  z-index: 1;
  animation: sfxChPop 0.5s var(--d) cubic-bezier(0.2, 1.7, 0.4, 1) both,
             sfxChBob 1.4s calc(0.7s + var(--d)) ease-in-out infinite alternate;
}
.sfx-ch:nth-child(even) { top: 0.1em; } /* 지그재그 */
/* 두꺼운 흰 테두리 — 홈 로고와 같은 16방향 text-shadow 방식
   (iOS 사파리에서 두꺼운 text-stroke 가 회색 얼룩으로 깨진다) */
.sfx-ch::before {
  content: attr(data-ch);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: #fff;
  text-shadow:
    0.085em 0 #fff, -0.085em 0 #fff, 0 0.085em #fff, 0 -0.085em #fff,
    0.06em 0.06em #fff, -0.06em 0.06em #fff, 0.06em -0.06em #fff, -0.06em -0.06em #fff,
    0.078em 0.033em #fff, -0.078em 0.033em #fff, 0.078em -0.033em #fff, -0.078em -0.033em #fff,
    0.033em 0.078em #fff, -0.033em 0.078em #fff, 0.033em -0.078em #fff, -0.033em -0.078em #fff,
    0 0.17em 0 rgba(25, 28, 80, 0.5),
    0 0.32em 0.55em rgba(10, 12, 50, 0.55);
}
@keyframes sfxChPop {
  from { transform: scale(0) rotate(var(--r)); opacity: 0; }
  60% { transform: scale(1.18) rotate(var(--r)); opacity: 1; }
  to { transform: scale(1) rotate(var(--r)); opacity: 1; }
}
@keyframes sfxChBob {
  from { transform: translateY(0) rotate(var(--r)); }
  to { transform: translateY(-9px) rotate(calc(var(--r) * -0.6)); }
}
/* 제목은 글자들이 알아서 등장하므로 부모는 사라질 때만 움직인다 */
#stagefx.bonus-intro .stagefx-main { animation: sfxOut 0.4s 4s ease-in forwards; }
#stagefx.bonus-intro .stagefx-sub { animation: sfxRise 0.45s 0.5s both, sfxOut 0.4s 4s ease-in forwards; }

/* 보너스 게임 제목: '보너스 스테이지' 바로 아래에 크고 또렷하게.
   어두운 남색 배경 위에서 가장 튀는 형광 시안 + 흰 테두리 + 네온 글로 —
   금색은 알록달록한 제목·보상 하트와 섞여 묻힌다는 대표 의견으로 교체 */
.stagefx-game {
  font-weight: 900;
  font-style: normal;
  font-size: clamp(1.7rem, 8vw, 3rem);
  line-height: 1.2;
  color: #35e6ff;
  letter-spacing: 0.02em;
  text-shadow:
    0.05em 0 #fff, -0.05em 0 #fff, 0 0.05em #fff, 0 -0.05em #fff,
    0.038em 0.038em #fff, -0.038em 0.038em #fff, 0.038em -0.038em #fff, -0.038em -0.038em #fff,
    0 0 0.55em rgba(53, 230, 255, 0.85),
    0 0.14em 0 rgba(0, 60, 90, 0.5),
    0 0.26em 0.5em rgba(10, 12, 50, 0.55);
  margin: 2px 0 6px;
}
.stagefx-game.hidden { display: none; }
#stagefx.bonus-intro .stagefx-game { animation: sfxRise 0.45s 0.35s both, sfxOut 0.4s 4s ease-in forwards; }

/* 클리어 파티클 (JS가 --dx/--dy를 무작위로 지정) */
.stagefx-burst { position: absolute; inset: 0; }
.stagefx-burst i {
  position: absolute;
  left: 50%;
  top: 50%;
  font-style: normal;
  font-size: 1.5rem;
  animation: sfxParticle 1.6s ease-out forwards;
}
@keyframes sfxParticle {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15) rotate(var(--rot)); opacity: 0; }
}
@keyframes sfxSlam {
  from { transform: scale(3.6) rotate(-5deg); opacity: 0; }
  70% { transform: scale(0.94) rotate(1deg); opacity: 1; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes sfxZoomIn {
  from { transform: scale(0.25); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes sfxRise {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes sfxOut {
  to { transform: scale(0.82); opacity: 0; }
}
@keyframes sfxDim {
  0% { background: rgba(8, 10, 26, 0); }
  20% { background: rgba(8, 10, 26, 0.45); }
  75% { background: rgba(8, 10, 26, 0.45); }
  100% { background: rgba(8, 10, 26, 0); }
}

/* 방금 플레이한 내 기록 강조 (게임 종료 → 랭킹 진입 시) */
.rank-list li.mine {
  background: linear-gradient(90deg, rgba(91, 108, 255, 0.18), rgba(91, 108, 255, 0.05));
  outline: 2px solid var(--primary);
  animation: minePulse 1.1s ease-in-out 4;
}
html:lang(en) .rank-list li.mine .rank-name::after { content: 'My Score' !important; }
html:lang(zh) .rank-list li.mine .rank-name::after { content: '我的记录' !important; }
html:lang(ja) .rank-list li.mine .rank-name::after { content: '自分の記録' !important; }
.rank-list li.mine .rank-name::after {
  content: '내 기록';
  margin-left: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  border-radius: 6px;
  padding: 2px 6px;
  vertical-align: 1px;
}
@keyframes minePulse {
  0%, 100% { box-shadow: var(--shadow); transform: scale(1); }
  50% { box-shadow: 0 0 0 6px rgba(91, 108, 255, 0.22); transform: scale(1.02); }
}

.rank-num { font-weight: 800; width: 32px; flex: none; color: var(--primary-dark); }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { font-weight: 800; }
.rank-level { color: var(--muted); font-size: 0.8rem; }
.rank-level-big {
  color: #fff;
  font-size: 0.74rem;
  font-weight: 900;
  background: linear-gradient(160deg, #8a5bff, #5b6cff);
  border-radius: 999px;
  padding: 3px 9px;
}
.rank-empty { color: var(--muted); padding: 24px 0; }
/* 안내 문구 li에는 TOP3 금·은·동 스타일 미적용 */
.rank-list li.rank-empty { background: rgba(255, 255, 255, 0.92); outline: none; text-align: center; display: block; }

/* ===== 상점 — 밤하늘 배경 위 게임 아이템 카드 ===== */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 12px;
  max-width: 620px;
  margin: 0 auto 14px;
}
.shop-item {
  position: relative;
  height: 100%;
  background: rgba(255, 255, 255, 0.96);
  border: 3px solid #fffdf2;
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(20, 24, 80, 0.45), 0 12px 22px rgba(10, 12, 50, 0.35);
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: menuIn 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.shop-item:nth-child(1) { animation-delay: 0.1s; }
.shop-item:nth-child(2) { animation-delay: 0.2s; }
.shop-item:nth-child(3) { animation-delay: 0.3s; }
/* 아이콘: 색색의 배지 칩 */
.shop-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  border-radius: 16px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16), 0 4px 10px rgba(10, 12, 50, 0.2);
}
.si-mag .shop-icon { background: linear-gradient(180deg, #8db3ff, #5b8df6); }
.si-bundle .shop-icon { background: linear-gradient(180deg, #c9a4ff, #a678f0); }
.si-ad .shop-icon { background: linear-gradient(180deg, #ffb25e, #ff9432); }
.si-gold .shop-icon { background: linear-gradient(180deg, #ffd873, #f0ad24); }
.si-freeze .shop-icon { background: linear-gradient(180deg, #7fdcd0, #3fbfae); }
.si-stamp .shop-icon { background: linear-gradient(180deg, #c9a4ff, #a678f0); }
.si-noads .shop-icon { background: linear-gradient(180deg, #b6bfd8, #8c98b8); }
.shop-name { font-weight: 800; font-size: 0.95rem; }
.shop-desc { font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; word-break: keep-all; }
/* 💎 다이아 3종은 폰에서도 3열 — 카드가 좁아지므로 안쪽 여백·글자를 살짝 줄인다 */
.dia-grid3 { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dia-grid3 .shop-item { padding: 14px 8px 12px; }
.dia-grid3 .shop-icon { font-size: 1.9rem; }
.dia-grid3 .shop-name { font-size: 0.88rem; }
.dia-grid3 .shop-desc { font-size: 0.7rem; }
.dia-grid3 .btn { padding: 9px 6px; font-size: 0.85rem; }
/* 🎁 스타터 팩 단독 카드 — 가운데 정렬, 살짝 넓게 */
/* 📜 청약철회 고지 — 유료 구역 아래 (전자상거래법 표시 의무) */
.withdraw-note {
  max-width: 620px; margin: 4px auto 18px; padding: 12px 16px; text-align: center;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px; color: rgba(255, 255, 255, 0.82);
  font-size: 0.74rem; font-weight: 700; line-height: 1.65; word-break: keep-all;
}
.withdraw-note p { margin: 0 0 4px; }
/* 🔄 구매 복원 — 애플 3.1.1 필수 버튼. 다이아 충전 아래, 청약철회 고지 위 */
/* 💳 미지급 결제 안내 — 돈은 나갔는데 지급이 안 된 상태. 놓치면 안 되므로 눈에 띄게 */
.undelivered-note {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 12px; padding: 11px 13px; border-radius: 14px;
  border: 2px solid #ff9f43;
  background: linear-gradient(135deg, rgba(255, 159, 67, 0.22), rgba(255, 107, 107, 0.16));
}
.undelivered-note p { margin: 0; flex: 1; min-width: 0; font-size: 0.78rem; line-height: 1.45; color: #fff; }
.undelivered-note b { font-size: 0.9rem; color: #ffd9a8; }
.undelivered-note .btn { flex: none; white-space: nowrap; }

/* 💎 다이아로 재화 사기 — 무료 [받기] 버튼 바로 아래에 붙는 작은 버튼 (대표 지시 2026-08-31) */
.dia-buy {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 6px; padding: 6px 8px;
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 0.8rem; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, #7fc4ff, #3f8ee8);
  box-shadow: 0 2px 0 #2a5fa8;
}
.dia-buy:active { transform: translateY(1px); box-shadow: 0 1px 0 #2a5fa8; }
/* ⚠️ 예전에는 잔액이 모자라면 opacity:0.5 로 흐리게 했는데, <b>비활성 버튼으로 보였다</b>
   (대표 지시 2026-09-01: "버튼 자체가 비활성화인데 활성화는 시켜줘").
   같은 칸의 [도장 슬롯]·[광고 제거] 는 흐려지지 않아 둘이 따로 노는 것도 문제였다.
   이제 셋 다 <b>또렷하게</b> 두고, 모자랄 때는 눌렀을 때 안내(토스트)로 알린다 —
   "💎 다이아가 부족해요. (필요 400)" 처럼. 판단은 눌러 본 뒤에 알려도 늦지 않다. */
.dia-buy-cost { display: inline-flex; align-items: center; gap: 2px; }
.dia-buy-get { display: inline-flex; align-items: center; gap: 2px; }
/* 가운데 화살표 — 무엇을 주고 무엇을 받는지 한눈에 */
.dia-buy-cost::after { content: '→'; margin-left: 5px; opacity: 0.75; font-weight: 700; }

/* ═══ 상점 구역 나누기 (대표 지시 2026-09-01) ═══
   '매일 무료로 받기' 와 '다이아로 사기' 를 갈라 두었다. 예전에는 한 카드 안에
   [받기] 와 [💎10] 이 위아래로 붙어 있어, 무료를 받으러 왔다가 다이아를 쓰기 쉬웠다. */

/* 💎 '다이아로 사기' 카드의 구매 버튼 — 이제 카드의 <b>주 동작</b>이라
   다른 카드 버튼과 같은 자리(맨 아래)·같은 크기로 맞춘다 */
.shop-item .dia-buy {
  --sb-dark: #2a5fa8;
  margin-top: auto;
  width: 100%;
  gap: 8px;
  padding: 9px 8px;
  font-size: 0.82rem;
  background: linear-gradient(180deg, #7fc4ff, #3f8ee8);
  color: #fff;
}

/* 칸이 3+1 로 갈라지면 남는 카드 하나가 어색하다 — 무료 4칸·다이아 6칸을
   <b>항상 딱 떨어지게</b> 고정한다 (auto-fit 에 맡기면 3+1 이 되는 구간이 생긴다).

   ⚠️ <b>칸 수는 화면 폭이 아니라 '그리드가 실제로 얼마나 넓은가'로 정해야 한다.</b>
   .shop-grid 의 max-width 를 키우는 규칙들이 전부 (max-width: 1199px) 안에 있어서,
   <b>PC(1200px 이상)에서는 오히려 기본값 620px 로 좁아진다.</b> 그래서 폭만 보고 4칸을 주면
   1206px 화면에서 카드가 146px 이 되어 '🎁 오늘 무료 +50' 이 두 줄로 접혔다 (대표 화면에서 실측).

   무료는 이름표가 길어 <b>어느 폭에서도 2칸</b>으로 둔다 — 620px 그리드에서 카드 304px 로 넉넉하다.
   다이아는 이름표가 짧아(💎 10 → ❤️ 10) 620px 에서 3칸(199px)도 한 줄에 들어간다. */
#free-section .shop-grid,
#dia-shop-section .shop-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) {
  #dia-shop-section .shop-grid { grid-template-columns: repeat(3, 1fr); }
}
/* 버튼 폭을 카드 폭에 맞춘다 — 한 줄에 넓은 버튼과 좁은 버튼이 섞이면 엉성해 보인다
   (💎 재화 버튼은 width:100%, [💎 400] 은 글자 폭이라 나란히 두면 눈에 띄게 어긋났다) */
/* 카드 폭에 맞춰 버튼을 채우고, <b>이름표가 한 줄에 들어가게</b> 글자·여백을 줄인다.
   PC 에서 .shop-item .btn 이 1rem(=21px)까지 커지는데, 4칸으로 나눈 카드에서는
   '🎁 오늘 무료 +50' 이 두 줄로 접혀 그 카드만 키가 커 보였다.
   0.9rem·좌우 6px 로 한국어·영어·일본어 모두 한 줄(48px)인 것을 실측 확인했다. */
#free-section .shop-item .btn,
#dia-shop-section .shop-item .btn {
  width: 100%;
  padding: 12px 6px;
  font-size: 0.9rem;
}

/* 구역 제목이 카드와 너무 붙지 않게 */
#free-section .shop-sub-title { margin-top: 18px; }

.restore-row { max-width: 620px; margin: 10px auto 4px; text-align: center; }
.restore-row .shop-sub-desc { margin: 8px 0 0; }
.restore-btn {
  padding: 9px 22px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.16); border: 2px solid rgba(255, 255, 255, 0.32);
  color: #fff; font-size: 0.82rem; font-weight: 800;
}
.restore-btn:hover { background: rgba(255, 255, 255, 0.26); }
.withdraw-btn {
  margin-top: 8px; padding: 7px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14); border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff; font-size: 0.76rem; font-weight: 800;
}
.withdraw-btn:hover { background: rgba(255, 255, 255, 0.22); }
/* 규정 본문 — 법정 고지라 읽기 쉬운 왼쪽 정렬 목록으로 */
.wd-doc { text-align: left; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.wd-doc h4 { margin: 14px 0 6px; font-size: 0.95rem; color: #2a2f6b; font-weight: 900; }
.wd-doc h4:first-child { margin-top: 2px; }
.wd-doc ul { margin: 0; padding-left: 18px; }
.wd-doc li { margin-bottom: 7px; font-size: 0.82rem; line-height: 1.7; color: #4a5180;
  word-break: keep-all; }
.wd-doc li b { color: #2a2f6b; }
.wd-contact { font-size: 0.82rem; line-height: 1.7; color: #4a5180; margin: 0; }
.wd-more { margin: 12px 0 0; font-size: 0.78rem; color: #8990b8; }
.wd-doc a { color: var(--primary, #5b6cff); font-weight: 800; }

.starter-solo { display: flex; justify-content: center; }
.starter-solo .shop-item { width: min(320px, 100%); }
.starter-solo .starter-card { border-color: #ffd45c; box-shadow: 0 5px 0 rgba(210, 146, 0, 0.45), 0 10px 18px rgba(10, 12, 50, 0.22); }
/* 가격 버튼: 금화 느낌의 3D 버튼 — 카드 맨 아래 고정(설명 줄 수와 무관하게 같은 높이) */
.shop-item .btn {
  margin-top: auto;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 800;
  border: 2px solid #fffdf2;
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--sb-dark, #b8860b);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
}
.shop-item .btn-primary { --sb-dark: #b8860b; background: linear-gradient(180deg, #ffd45c, #ffb32e); color: #5a3d00; }
.shop-item .btn-secondary { --sb-dark: #cf6a10; background: linear-gradient(180deg, #ffb25e, #ff9432); color: #fff; }
.shop-item .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--sb-dark, #b8860b); }
/* 할인 리본 */
.shop-badge {
  position: absolute;
  top: -11px;
  right: -7px;
  background: linear-gradient(180deg, #ff7b6b, #ef4444);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 4px 11px;
  border-radius: 999px;
  border: 2px solid #fffdf2;
  box-shadow: 0 3px 8px rgba(150, 20, 20, 0.45);
  transform: rotate(6deg);
}
#view-shop .hint-text {
  color: #e2e6ff;
  text-shadow: 0 1px 4px rgba(10, 12, 50, 0.9);
  line-height: 1.7;
  background: rgba(18, 21, 55, 0.62);
  border-radius: 12px;
  padding: 8px 10px;
  width: 100%;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
}

/* ===== 광고 배너 (플렉스 자식: 게임 영역과 절대 겹치지 않음) ===== */
/* 📏 배너가 실제로 차지하는 세로 — 좌하단 장식이 이 위에 앉는다(.photo-scene).
   웹은 패딩까지 더해 62px, 앱은 네이티브 배너가 겹쳐 50px 로 관측됐다(2026-08-27 실측).
   배너 높이를 바꾸면 이 값도 함께 바꿔야 장식이 다시 가려지지 않는다. */
:root { --ad-slot-h: 62px; }
body.is-app { --ad-slot-h: 50px; }
/* 🚫 광고 제거 이용권 보유자 — 배너 자리가 얇은 여백만 남는다(.no-slot).
   장식이 그만큼 같이 내려오지 않으면 아래에 어색한 빈 공간이 생긴다.
   (JS 가 hideBanner/restoreBannerSlot 에서 body 클래스를 함께 토글한다) */
/* 광고를 안 보는 이용자에게는 배너 자리를 <b>완전히</b> 접는다 — 그만큼 사진이 커진다.
   예전엔 10px 을 남겼는데, iOS 는 여기에 홈 인디케이터 여백(env(safe-area-inset-bottom),
   보통 34pt)까지 더해져 44px 이 남아 "iOS 만 칸이 안 줄어든다"로 보였다.
   (안드로이드는 제스처 내비라 inset 이 0 이어서 10px 만 남았다 — 그래서 차이가 났다) */
body.no-ad-slot, body.is-app.no-ad-slot { --ad-slot-h: 0px; }

#ad-banner {
  flex: none;
  min-height: 50px;
  /* 상한 고정: AdSense가 큰 규격(사각형 등)을 반환해도 배너가 게임 영역을 밀어내지 못한다.
     상한이 없으면 광고가 화면 절반까지 차지하는 사고가 난다. */
  max-height: calc(62px + env(safe-area-inset-bottom));
  overflow: hidden;
  background: #21263c;
  color: #aab;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.82rem;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
}
/* 광고 슬롯 자체도 고정 — 스크립트가 인라인 height를 덮어써도 이 값이 이긴다 */
#ad-banner ins.adsbygoogle {
  max-height: 50px !important;
}
.ad-label {
  background: #ffd54d;
  color: #333;
  font-weight: 800;
  font-size: 0.7rem;
  border-radius: 4px;
  padding: 2px 6px;
}

/* 광고 제거 이용권 보유자: 배너 자리를 없애 사진을 더 크게 본다.
   완전히 0으로 만들면 사진이 화면 끝에 붙어 답답하므로 최소한의 숨 쉴 틈만 남긴다.
   (display:none 대신 높이만 줄인다 — 세로 플렉스라 남은 공간은 그대로 .board 가 가져간다) */
#ad-banner.no-slot {
  min-height: 0;
  /* 홈 인디케이터 여백만 남기고 접는다 (안드로이드는 0 이라 완전히 사라진다) */
  height: env(safe-area-inset-bottom);
  max-height: env(safe-area-inset-bottom);
  padding: 0;
  background: transparent;
}
.is-app #ad-banner.no-slot {
  min-height: 0;
  height: env(safe-area-inset-bottom);
  max-height: env(safe-area-inset-bottom);
}

/* 앱(Capacitor): 하단 네이티브 광고(AdMob)가 겹치는 자리 — 여백을 넉넉히 확보 */
.is-app #ad-banner {
  min-height: 74px;
  max-height: calc(74px + env(safe-area-inset-bottom));
  background: transparent;
}

.ad-modal { max-width: 380px; }
.ad-video {
  background: #111;
  border-radius: 12px;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: #ccc;
}
.ad-video-inner { text-align: center; font-size: 0.9rem; line-height: 1.8; }
.ad-play { font-size: 2.5rem; display: block; }
.ad-note { font-size: 0.75rem; color: #888; }

/* ===== 모달 ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 45, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal {
  background: var(--card);
  border-radius: 18px;
  padding: 22px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.modal h3 { font-size: 1.25rem; margin-bottom: 12px; }
#modal-body { color: var(--text); line-height: 1.7; margin-bottom: 16px; }
#modal-body .big-score { font-size: 2rem; font-weight: 800; color: var(--primary-dark); }
#modal-body input {
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 14px;
  border: 2px solid #dde1f5;
  border-radius: 10px;
  width: 100%;
  text-align: center;
  outline: none;
}
#modal-body input:focus { border-color: var(--primary); }
.modal-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ===== 🏆 도전모드 보상창 ===== */
.ch-reward-modal { max-width: 400px; }
.ch-reward-head { text-align: center; font-size: 0.9rem; color: var(--text); margin: 2px 0 10px; line-height: 1.5; }
/* 상단 '모두 받기' — 박스 목록 위에 고정, 받을 게 있을 때만 채워진다 */
.ch-claim-all { width: 100%; margin: 0 0 10px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.ch-claim-all .coin { flex: none; }
.ch-box-list { display: flex; flex-direction: column; gap: 7px; max-height: 54vh; overflow-y: auto; padding: 2px; }
.ch-box {
  display: flex; align-items: center; gap: 10px;
  background: #f4f5fb; border-radius: 12px; padding: 8px 12px;
  border: 2px solid #e7e3f5;
}
.ch-box.ready { border-color: #9b5cff; background: #f6f0ff; box-shadow: 0 2px 0 rgba(155, 92, 255, 0.25); }
.ch-box.claimed { opacity: 0.7; }
.ch-box.locked { opacity: 0.55; }
.ch-box-ico { font-size: 1.5rem; line-height: 1; width: 30px; text-align: center; }
.ch-box-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ch-box-info b { font-size: 0.9rem; }
.ch-box-info small { font-size: 0.78rem; color: #7a7f9c; display: flex; align-items: center; gap: 3px; }
.ch-claim {
  padding: 7px 16px; font-size: 0.85rem; font-weight: 800; border: none; border-radius: 10px;
  background: linear-gradient(180deg, #b98cff, #9b5cff); color: #fff; box-shadow: 0 3px 0 #6a2fc8; cursor: pointer;
}
.ch-claim:active { transform: translateY(2px); box-shadow: 0 1px 0 #6a2fc8; }
.ch-done { font-size: 0.8rem; font-weight: 800; color: #34c470; white-space: nowrap; }
.ch-lock { font-size: 1rem; }
/* 💎 10단계 상자의 다이아 — 골드와 나란히 보이고, 받으면 ✓ 로 남는다 */
.ch-dia {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-weight: 900; font-size: 0.72rem; white-space: nowrap;
  color: #2a6fd6; background: rgba(90, 160, 255, 0.16);
}
.ch-dia.got { color: #34c470; background: rgba(52, 196, 112, 0.16); }
.ch-box-tail { display: flex; align-items: center; flex: none; }

/* ===== 토스트 ===== */
#toasts {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 24px);
}
.toast {
  background: rgba(38, 43, 64, 0.92);
  color: #fff;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.85rem;
  animation: toastIn 0.25s ease, toastOut 0.3s ease 2.2s forwards;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 여러 줄 토스트 — 받은 보상을 한 줄에 하나씩 보여줄 때 (한 줄 알약 모양을 카드로 바꾼다) */
.toast.multi {
  white-space: pre-line;   /* 줄바꿈을 살린다 */
  border-radius: 14px;     /* 알약(999px) 이면 여러 줄에서 모양이 무너진다 */
  text-align: center;
  line-height: 1.6;
  padding: 12px 20px;
  overflow: visible;
  text-overflow: clip;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ===== 큰 화면 보정 ===== */
@media (min-width: 768px) {
  .logo { font-size: 1.15rem; }
  .chip { font-size: 0.85rem; padding: 5px 12px; }
  .hud-item { font-size: 0.95rem; padding: 7px 14px; }
  .game-top .btn { font-size: 0.9rem; padding: 7px 16px; }
  .menu-stack { width: 380px; }
  #app { padding: 16px 14px; }
}

/* ===== 내 계정 시트 ===== */
/* 예전엔 폰에서 화면 맨 아래에 붙는 시트였다 — 하단 광고 배너에 그대로 맞닿아
   시트 아래쪽 버튼이 광고에 눌린 것처럼 보였다. 가운데로 띄우고, 아래는 광고 자리
   (--ad-slot-h) + 안전영역만큼 비워 어떤 기기에서도 배너와 겹치지 않게 한다. */
#account-modal {
  align-items: center;
  padding: 16px 16px calc(16px + var(--ad-slot-h, 0px) + env(safe-area-inset-bottom));
}
@media (min-width: 600px) { #account-modal { align-items: center; } }

.account-sheet {
  background: var(--bg);
  width: 100%;
  max-width: 420px;
  max-height: 84dvh;
  border-radius: 22px; /* 가운데 띄우므로 아래 모서리도 둥글게 */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  animation: sheetUp 0.22s ease;
}
@media (min-width: 600px) { .account-sheet { animation: none; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0.5; } }

.account-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, #7f6bff 100%);
}
.account-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
}

.account-body {
  overflow-y: auto;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 프로필 카드 */
.profile-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.avatar {
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #9b6bff);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(91, 108, 255, 0.35);
}
.profile-info { flex: 1; min-width: 0; }
.profile-name-row { display: flex; align-items: center; gap: 6px; }
.profile-name-row b { font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-btn {
  border: none;
  background: #eef0fc;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
  cursor: pointer;
  flex: none;
}
.profile-sub {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 광고 제거 이용권 남은 기간 — 기간제라 언제 끝나는지 계정 화면에서 바로 보이게 */
.profile-pass {
  display: flex;
  align-items: center;
  gap: 5px;
  /* 프로필 카드 밖(account-body 직계)으로 옮겨 시트 전체 폭을 쓴다 —
     카드 안에서는 아바타를 뺀 좁은 칸이라 "(9/26 까..." 로 날짜가 잘렸다.
     account-body 가 gap 12px 를 주므로 여기서 margin-top 을 따로 두지 않는다. */
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #eaf6ff, #d8ecff);
  border: 1.5px solid #b9dcff;
  align-self: flex-start;
}
/* 알약 안에서 글자가 접히지 않게 — "30일 남음 (9/26까지)" 가 길어 좁은 폭에서 두 줄이 되며
   알약이 세로로 불어났다(대표 신고). 한 줄로 고정하고, 그래도 넘치면 알약이 스스로 줄어든다. */
.profile-pass { white-space: nowrap; max-width: 100%; min-width: 0; overflow: hidden; }
.profile-pass .pass-ico { font-size: 0.85rem; line-height: 1; flex: none; }
.profile-pass b { font-size: 0.68rem; font-weight: 900; color: #2b5f9e; flex: none; }
.profile-pass em {
  font-style: normal; font-size: 0.68rem; font-weight: 800; color: #1d7a4e;
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}

.profile-code {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  min-width: 0;
}
.profile-code .code-label {
  flex: none;
  font-size: 0.64rem;
  font-weight: 800;
  color: #8a90b8;
  background: #eef0fc;
  border-radius: 6px;
  padding: 2px 5px;
}
.profile-code b {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #3b4374;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-copy {
  flex: none;
  border: 1.5px solid #d8dcf5;
  background: #fff;
  color: #5661a8;
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 0 #d8dcf5;
}
.code-copy:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #d8dcf5;
}
/* 계정·정보 메뉴의 라벨 (다국어 치환용 em — 기울임 제거) */
.account-menu em, .settings-menu em { font-style: normal; }
/* 설정: 언어 선택 */
.pref-lang { flex-wrap: wrap; gap: 8px; }
.lang-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.lang-btn {
  border: 2px solid #d8dcf5;
  background: #fff;
  color: #5661a8;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.lang-btn.on {
  background: linear-gradient(160deg, #8a5bff, #5b6cff);
  border-color: #fffdf2;
  color: #fff;
  box-shadow: 0 2px 0 rgba(60, 50, 140, 0.5);
}
.profile-xp {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  min-width: 0;
}
.profile-xp .xp-lv {
  flex: none;
  font-size: 0.68rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(160deg, #8a5bff, #5b6cff);
  border-radius: 999px;
  padding: 2px 8px;
}
/* 계정 시트 계급 뱃지 (탐정 테마) */
.profile-xp .acc-rank {
  flex: none;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffd54a;
  white-space: nowrap;
}
/* 하드 도전 잠김(계정 레벨 미달) — 흐리게 */
.menu-btn.locked { opacity: 0.6; filter: grayscale(0.4); }
.profile-xp .xp-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #e7eaf8;
  overflow: hidden;
  min-width: 30px;
}
.profile-xp .xp-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8a5bff, #5b6cff);
  transition: width 0.4s;
}
.profile-xp .xp-num {
  flex: none;
  font-size: 0.66rem;
  font-weight: 800;
  color: #8a90b8;
}
.role-badge {
  flex: none;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e6e9fa;
  color: var(--muted);
}
.role-badge.linked { background: #dff5e4; color: #1d7a3d; }
.role-badge.admin { background: #ffe9a8; color: #6b5200; }

/* 보유 자산 */
.asset-row { display: flex; gap: 10px; }
.asset {
  flex: 1;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 1rem;
}
.asset b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.asset span { color: var(--muted); font-size: 0.75rem; }

/* 계정 연동 */
.link-section {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.link-title { font-weight: 800; font-size: 0.95rem; }
.link-desc { color: var(--muted); font-size: 0.78rem; line-height: 1.5; margin-bottom: 2px; }
.provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.provider-btn:active { transform: scale(0.98); }
.provider-btn.kakao { background: #FEE500; color: #191919; }
.provider-btn.google { background: #fff; color: #333; border: 1.5px solid #dde1f5; }
.provider-btn.apple { background: #000; color: #fff; }
.provider-btn.done {
  background: #f0f2f7;
  color: #1d7a3d;
  border: 1.5px solid #cde9d6;
  cursor: default;
}
.provider-btn.off { opacity: 0.45; cursor: default; }

/* 메뉴 그리드 */
.account-menu {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.account-menu button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 12px 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.1s;
}
.account-menu button:active { transform: scale(0.97); }
.account-menu button span { font-size: 1.05rem; }

.logout-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* 회원탈퇴: 로그아웃보다 눈에 덜 띄는 작은 위험 링크 */
.delete-account-btn {
  border: none;
  background: transparent;
  color: #c96a6a;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px 8px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* 위험 동작 버튼 (탈퇴·삭제 확인) */
.btn-danger { background: linear-gradient(180deg, #f0716c, #e2565b); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.95); }

/* ===== 좌측 상단 통일 뒤로가기 버튼 =====
   내용 폭(560px)에 맞춰 가운데 정렬 — PC에서 뒤로가기가 화면 끝에 동떨어지지 않게 */
.view-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin: 10px auto 16px;
}
.view-head .section-title { margin: 0; flex: 1; text-align: center; }
/* 맨바닥 글씨 대신 게임 간판 플레이트 — 상점·도전과제·가방·스탯 등 view-head 전 화면 공통 */
.view-head .section-title {
  padding: 9px 26px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(58, 63, 132, 0.92), rgba(38, 42, 99, 0.92));
  border: 2px solid rgba(255, 253, 242, 0.85);
  color: #fff; text-shadow: 0 2px 6px rgba(10, 12, 50, 0.6);
  box-shadow: 0 4px 0 rgba(20, 24, 80, 0.5), 0 8px 18px rgba(10, 12, 50, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.18);
}
/* 제목 아래 설명 줄도 유리 칩으로 — 배경 위 맨 글씨 탈피 */
.view > .shop-sub-desc {
  display: block; width: fit-content; max-width: min(560px, 92%);
  margin: -4px auto 12px; padding: 6px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.88); font-size: 0.82rem; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1); word-break: keep-all;
}
.view-head::after { content: ''; width: 46px; flex: none; } /* 제목 가운데 정렬 균형추 */
/* 게임 스타일 원형 3D 버튼 */
.back-btn {
  flex: none;
  width: 46px;
  height: 46px;
  border: 3px solid #fffdf2;
  border-radius: 50%;
  background: linear-gradient(180deg, #6d9cff, #4f8df9);
  box-shadow: 0 5px 0 #2c50c8, 0 10px 16px rgba(10, 12, 50, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
}
.back-btn:hover { filter: brightness(1.06); }
.back-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #2c50c8, 0 4px 8px rgba(10, 12, 50, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
.game-top .back-btn {
  width: 36px;
  height: 36px;
  font-size: 1.05rem;
  margin-right: auto;
  box-shadow: 0 3px 0 #2c50c8, 0 6px 10px rgba(10, 12, 50, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
.game-top .back-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #2c50c8, inset 0 2px 0 rgba(255, 255, 255, 0.35); }

/* ===== 게임 플레이 화면 게임화 ===== */
/* 어두운 인디고 배경 — 사진이 액자처럼 돋보이게 */
body.in-game { background: linear-gradient(180deg, #23264f, #343a72); }
/* HUD 칩: 남색 알약 + 금색 숫자 (상단 재화 칩과 같은 문법) */
body.in-game .game-top .hud-item {
  background: rgba(30, 40, 72, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  box-shadow: 0 3px 8px rgba(10, 12, 50, 0.35);
}
body.in-game .game-top .hud-item b { color: #ffe08a; }
body.in-game .game-top .hud-item.timer { color: #fff; }
body.in-game .game-top .hud-item.timer.low { color: #ff8a80; }

/* 남은 시간 게이지 바: 초록 → 노랑 → 빨강(깜빡임) */
.time-bar {
  flex: none;
  height: 9px;
  width: min(560px, 96%);
  margin: 3px auto 2px;
  border-radius: 999px;
  background: rgba(10, 12, 40, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.28);
  overflow: hidden;
}
.time-bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5ad98c, #3ec97e);
  transition: width 0.15s linear, background 0.3s;
}
.time-bar i.mid { background: linear-gradient(90deg, #ffd45c, #ffb32e); }
.time-bar i.low { background: linear-gradient(90deg, #ff8a6b, #ef4444); animation: timeLowPulse 0.5s infinite alternate; }
@keyframes timeLowPulse { from { opacity: 1; } to { opacity: 0.55; } }
/* 가로 소형 화면(HUD 좌측 세로 열)에서는 숫자 타이머만 사용 */
@media (orientation: landscape) and (max-height: 620px) {
  .time-bar { display: none; }
}

/* 돋보기 버튼: 골드 3D */
.game-top .btn-hint {
  border: 2px solid #fffdf2;
  font-weight: 800;
  box-shadow: 0 3px 0 #c8860a;
  transition: transform 0.1s, box-shadow 0.1s;
}
.game-top .btn-hint:active { transform: translateY(2px); box-shadow: 0 1px 0 #c8860a; }
/* 아이템이 없거나 게임당 사용 상한에 닿으면 흐리게 */
.game-top .btn-hint.depleted { opacity: 0.5; filter: saturate(0.4); }

/* ===== 협동/랭크 대기실 — 진짜 게임 로비 톤 (밤하늘 배경 위 다크 글래스) ===== */
#coop-lobby { animation: lobbyIn 0.35s ease both; }
@keyframes lobbyIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 🎟️ 초대코드 = '룸 티켓' */
#coop-lobby .invite-box {
  position: relative;
  background: linear-gradient(180deg, rgba(46, 52, 116, 0.72), rgba(24, 28, 66, 0.82));
  border: 1.5px solid rgba(150, 165, 255, 0.42);
  border-radius: 24px;
  box-shadow: 0 14px 40px rgba(6, 8, 34, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: 22px 20px 18px;
  max-width: 380px;
  overflow: hidden;
}
/* 위쪽에 은은한 빛 번짐 */
#coop-lobby .invite-box::before {
  content: ''; position: absolute; top: -60%; left: 50%; transform: translateX(-50%);
  width: 160%; height: 120%; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(120, 140, 255, 0.28), transparent 60%);
}
#coop-lobby .invite-code-label {
  position: relative;
  color: #b3bbf2; font-size: 0.72rem; font-weight: 800; letter-spacing: 3px; text-transform: uppercase;
}
#coop-lobby .invite-code {
  position: relative;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 2.3rem; font-weight: 900; letter-spacing: 10px; text-indent: 10px; /* letter-spacing 중앙보정 */
  color: #fff; margin: 8px 0 14px;
  text-shadow: 0 0 20px rgba(130, 150, 255, 0.75), 0 2px 4px rgba(0, 0, 0, 0.45);
}
#coop-lobby .invite-actions { position: relative; }
#coop-lobby .invite-actions .btn-small {
  background: rgba(255, 255, 255, 0.12); border: 1.5px solid rgba(255, 255, 255, 0.28);
  color: #eef1ff; border-radius: 999px; padding: 9px 18px; font-weight: 800; font-size: 0.82rem;
}
#coop-lobby .invite-actions .btn-small:active { transform: translateY(1px); background: rgba(255, 255, 255, 0.2); }
#coop-lobby .invite-box .qr {
  position: relative;
  border: 4px solid #fff; border-radius: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); margin-top: 4px;
}
#coop-lobby .invite-box .hint-text { position: relative; color: #aeb6ee; margin-top: 8px; }

/* 👥 플레이어 슬롯 = 아바타 카드 */
#coop-lobby .player-list { gap: 10px; max-width: 380px; }
#coop-lobby .player-list li {
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  box-shadow: 0 5px 16px rgba(6, 8, 34, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 11px 16px;
  justify-content: flex-start; gap: 13px;
  color: #f2f4ff; font-weight: 800; font-size: 1rem;
  animation: lobbySeatIn 0.3s ease both;
}
@keyframes lobbySeatIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
#coop-lobby .lobby-stamp {
  width: 46px; height: 46px; border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 14px rgba(120, 140, 255, 0.55);
  background: rgba(255, 255, 255, 0.14);
}
#coop-lobby .lobby-stamp.default {
  font-size: 1.5rem; background: linear-gradient(135deg, #6d78d8, #4450b0);
}
#coop-lobby .player-list .host-badge {
  margin-left: auto; background: linear-gradient(180deg, #ffd76a, #f7b731); color: #5a3d00;
  font-weight: 900; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* 🎮 시작 버튼 — 크고 반짝이게 (방장 눈에 확 들어오게 은은한 맥동) */
#coop-lobby .game-actions { margin-top: 16px; }
#coop-lobby .game-actions .btn-big {
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  background: linear-gradient(180deg, #7f8fff, #5464f4);
  box-shadow: 0 6px 0 #3a44b8, 0 12px 26px rgba(90, 108, 255, 0.5);
  color: #fff; font-weight: 900; letter-spacing: 0.5px;
  animation: lobbyStartPulse 1.9s ease-in-out infinite;
}
@keyframes lobbyStartPulse {
  0%, 100% { box-shadow: 0 6px 0 #3a44b8, 0 12px 26px rgba(90, 108, 255, 0.45); }
  50% { box-shadow: 0 6px 0 #3a44b8, 0 12px 34px rgba(120, 140, 255, 0.85); }
}
#coop-lobby .game-actions .btn-big:active {
  transform: translateY(4px); animation: none;
  box-shadow: 0 2px 0 #3a44b8, 0 4px 12px rgba(90, 108, 255, 0.4);
}
#coop-lobby #coop-wait-host {
  color: #c9cfff; font-weight: 700;
}
#coop-lobby #coop-wait-host::after {
  content: ''; animation: lobbyDots 1.4s steps(4) infinite;
}
@keyframes lobbyDots { 0% { content: ''; } 25% { content: '·'; } 50% { content: '··'; } 75% { content: '···'; } }

/* ===== 모달 공통: 게임 판때기 톤 ===== */
.modal {
  border: 3px solid #fffdf2;
  border-radius: 22px;
  box-shadow: 0 7px 0 rgba(20, 24, 80, 0.45), 0 18px 32px rgba(10, 12, 50, 0.45);
}

/* 설정 헤더 우측 버튼들 (효과음 토글 + 닫기) */
.settings-header-btns { display: flex; gap: 6px; }

/* ===== 상점 캐릭터 섹션 ===== */
.shop-sub-title {
  margin: 20px 0 4px;
  font-size: 1.15rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(10, 12, 50, 0.55);
}
.shop-sub-desc { font-size: 0.8rem; color: #e2e6ff; margin-bottom: 12px; text-shadow: 0 1px 6px rgba(10, 12, 50, 0.85); line-height: 1.6; }
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  max-width: 620px;
  margin: 0 auto 14px;
}
.char-card {
  height: 100%;
  background: rgba(255, 255, 255, 0.96);
  border: 3px solid #fffdf2;
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(20, 24, 80, 0.45), 0 10px 18px rgba(10, 12, 50, 0.3);
  padding: 12px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.char-card.equipped {
  border-color: #ffd45c;
  box-shadow: 0 5px 0 #c8860a, 0 10px 20px rgba(200, 140, 10, 0.4);
}
.char-face {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 3px 5px rgba(10, 12, 50, 0.25));
}
.char-card.equipped .char-face { animation: charFaceBob 1.6s ease-in-out infinite alternate; }
@keyframes charFaceBob { from { transform: translateY(0); } to { transform: translateY(-5px); } }
.char-name { font-weight: 800; font-size: 0.85rem; }
.char-perk { font-size: 0.68rem; font-weight: 700; color: #5b6cff; line-height: 1.3; }
.char-btn {
  margin-top: auto;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 800;
  border: 2px solid #fffdf2;
  border-radius: 10px;
  background: linear-gradient(180deg, #6d9cff, #4f8df9);
  color: #fff;
  box-shadow: 0 3px 0 #2c50c8;
}
.char-btn.buy { background: linear-gradient(180deg, #ffd45c, #ffb32e); color: #5a3d00; box-shadow: 0 3px 0 #b8860b; }
.char-btn.on { background: linear-gradient(180deg, #5cd694, #34c470); box-shadow: 0 3px 0 #1d8a4e; }
.char-btn.locked {
  background: linear-gradient(180deg, #b7a6e8, #9b83d9);
  box-shadow: 0 3px 0 #6c55a8;
  /* '업적 보상'이 좁은 칸에서 줄바꿈되지 않게 — 글자를 줄이고 한 줄 고정 */
  white-space: nowrap;
  font-size: 0.72rem;
  padding: 6px 8px;
  letter-spacing: -0.02em;
}
.char-btn.up { background: linear-gradient(180deg, #b98cff, #9b5cff); box-shadow: 0 3px 0 #6a2fc8; margin-top: 4px; }
.char-card.locked .char-shard { opacity: 0.95; } /* 미보유(잠금)여도 조각 진행은 또렷하게 보인다 */
/* 🧩 캐릭터 조각 게이지 */
.char-shard {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.66rem;
  font-weight: 800;
  color: #7b5bd8;
}
.char-shard.up { color: #9b5cff; }
.char-shard.maxed { color: #d98a1e; font-size: 0.72rem; }
.char-shard .cs-bar {
  width: 84%;
  height: 7px;
  border-radius: 5px;
  background: #e7e3f5;
  overflow: hidden;
}
.char-shard .cs-bar i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #b98cff, #7b5bd8);
}
.char-shard.up .cs-bar i { background: linear-gradient(90deg, #c8a0ff, #9b5cff); }
/* 강화 단계 배지 (캐릭터 이름 옆) */
.char-uplv {
  font-size: 0.62rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(180deg, #b98cff, #9b5cff);
  border-radius: 6px;
  padding: 1px 5px;
  vertical-align: middle;
}
/* ===== 게임 메뉴 팝업 스킨 — 흰 대화상자 대신 밤하늘 카드 (variant:'game') ===== */
.modal.modal-game {
  background: linear-gradient(180deg, #2e3374 0%, #262a63 60%, #21244f 100%);
  border: 3px solid #fffdf2;
  border-radius: 24px;
  box-shadow: 0 7px 0 rgba(20, 24, 80, 0.55), 0 18px 40px rgba(10, 12, 50, 0.5);
}
.modal.modal-game h3 { color: #fff; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35); }
.modal.modal-game .mcard { border-color: rgba(255, 253, 242, 0.9); }
.modal.modal-game .mcard-close { color: rgba(255, 255, 255, 0.65); }
.modal.modal-game .mcard-close:hover { color: #fff; }
/* 칩 — 밤하늘 위에서는 반투명 유리 배지로 (흰 알약은 웹스럽다) */
.modal.modal-game .mchip {
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12), 0 3px 6px rgba(10, 12, 50, 0.3);
}
.modal.modal-game .mchip b { color: #ffd45c; }

/* ===== 모달 안 모드 선택 카드 — 홈 menu-btn 과 같은 시각 언어 (앱 게임 스타일) ===== */
.mcard-stack { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 2px; }
.mcard {
  --mc-dark: #2c50c8;
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; border: 2px solid #fffdf2; border-radius: 18px;
  background: linear-gradient(180deg, #6d9cff, #4f8df9); color: #fff;
  font-family: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 4px 0 var(--mc-dark), 0 9px 16px rgba(10, 12, 50, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
}
.mcard:hover { filter: brightness(1.06); }
.mcard:active {
  transform: translateY(3px) scale(0.99);
  box-shadow: 0 1px 0 var(--mc-dark), 0 4px 8px rgba(10, 12, 50, 0.22),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
.mcard::after {
  content: ""; position: absolute; top: -40%; left: -60%; width: 34%; height: 190%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: rotate(16deg); animation: cardShine 5s ease-in-out infinite;
}
.mcard-icon {
  flex: none; width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.22); border: 2px solid rgba(255, 255, 255, 0.45);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
}
.mcard-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mcard-text b { font-size: 1.05rem; font-weight: 900; text-shadow: 0 2px 3px rgba(0, 0, 0, 0.22); }
.mcard-text small { font-size: 0.76rem; font-weight: 700; color: rgba(255, 255, 255, 0.9); line-height: 1.35;
  word-break: keep-all; overflow-wrap: break-word; } /* 어절 중간에서 안 끊기게 */
.mcard-arrow { flex: none; font-size: 0.9rem; opacity: 0.85; text-shadow: 0 2px 3px rgba(0, 0, 0, 0.2); }
.mcard-infinite { --mc-dark: #2c50c8; background: linear-gradient(180deg, #6d9cff, #4f8df9); }
.mcard-hard { --mc-dark: #a03123; background: linear-gradient(180deg, #ff7a5c, #e2564a); }
.mcard-start { --mc-dark: #6a2fc8; background: linear-gradient(180deg, #b98cff, #9b5cff); }
.mcard-reward { --mc-dark: #d29200; background: linear-gradient(180deg, #ffd45c, #ffbe2e); }
.mcard-reward .mcard-text b { color: #6b4a00; text-shadow: none; }
.mcard-reward .mcard-text small { color: #8a6510; }
.mcard-reward .mcard-arrow { color: #6b4a00; }
/* 잠긴 카드 — 흐리게 + 자물쇠 배지. 눌리는 느낌도 죽인다 */
.mcard-locked { filter: saturate(0.25) brightness(0.82); }
.mcard-locked:hover { filter: saturate(0.25) brightness(0.82); }
.mcard-locked::after { display: none; }
.mcard-badge {
  flex: none; padding: 4px 10px; border-radius: 999px;
  background: rgba(20, 24, 60, 0.45); border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 0.72rem; font-weight: 800; color: #fff; white-space: nowrap;
}
/* 모달 상단 현황 칩 (도전모드: 남은 횟수·오늘 최고) */
.mchips { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 12px; }
.mchip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: 999px;
  background: #f1f3fd; border: 2px solid #dfe4fb;
  font-size: 0.8rem; font-weight: 800; color: #4a5180;
  word-break: keep-all; white-space: nowrap;
}
.mchip b { color: #2a2f6b; font-weight: 900; }
/* 모달 닫기 텍스트 버튼 (카드가 주인공일 때 버튼 줄 대신) */
.mcard-close {
  display: block; margin: 10px auto 0; padding: 8px 22px;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.86rem; font-weight: 800; color: #8a8fb0;
}
.mcard-close:hover { color: #5a6090; }

/* 🎁 조각 상자 열기 바 (가방 상단) */
.shard-box-bar {
  display: flex; align-items: center; gap: 14px;
  max-width: 620px; margin: 0 auto 14px; padding: 14px 18px;
  background: linear-gradient(180deg, #ffffff, #f6f1ff);
  border: 3px solid #fffdf2; border-radius: 20px;
  box-shadow: 0 5px 0 rgba(107, 47, 200, 0.4), 0 10px 18px rgba(10, 12, 50, 0.22);
}
.sbx-box {
  position: relative; flex: none; width: 58px; height: 58px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; font-size: 2rem;
  background: linear-gradient(180deg, #efe6ff, #ddccff); border: 2px solid #fff;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.8), 0 3px 6px rgba(107, 47, 200, 0.2);
  animation: iconBob 2.6s ease-in-out infinite;
}
.sbx-box.empty { filter: grayscale(0.75) opacity(0.7); animation: none; }
.sbx-count {
  position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center; padding: 0 7px;
  border-radius: 999px; background: linear-gradient(180deg, #ff7a5c, #e2564a);
  border: 2px solid #fff; color: #fff; font-size: 0.76rem; font-weight: 900;
  box-shadow: 0 2px 4px rgba(160, 49, 35, 0.4);
}
.sbx-count.zero { background: linear-gradient(180deg, #b6bad4, #9a9fbf); box-shadow: 0 2px 4px rgba(90, 96, 144, 0.35); }
/* basis 0 — 긴 안내문의 본문 폭이 기준이 되면 모바일에서 아이콘과 딴 줄로 갈라진다 */
.sbx-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.sbx-title { font-weight: 900; font-size: 0.98rem; color: #4a2f8a; }
.sbx-sub { font-size: 0.76rem; font-weight: 700; color: #8a8fb0; line-height: 1.4; }
.sbx-actions { flex: none; display: flex; flex-direction: column; gap: 7px; }
.sbx-btn {
  padding: 9px 18px; font-family: inherit; font-size: 0.85rem; font-weight: 900;
  border: 2px solid #fffdf2; border-radius: 999px;
  background: linear-gradient(180deg, #b98cff, #9b5cff); color: #fff;
  box-shadow: 0 3px 0 #6a2fc8, inset 0 2px 0 rgba(255, 255, 255, 0.35); cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.sbx-btn.ghost { background: linear-gradient(180deg, #f4effd, #e6dcf8); color: #6a2fc8; box-shadow: 0 3px 0 #cdbdf0, inset 0 2px 0 #fff; }
.sbx-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #6a2fc8; }
@media (max-width: 480px) {
  .shard-box-bar { flex-wrap: wrap; }
  .sbx-main { min-width: 180px; } /* 아이콘 옆자리를 지킨다 — 버튼 줄만 아래로 내려간다 */
  .sbx-actions { flex-direction: row; width: 100%; }
  .sbx-actions .sbx-btn { flex: 1 1 0; }
}
.equip-shop-btn { margin-top: 16px; }

/* 서버 업데이트 중 안내 화면 */
#updating-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: linear-gradient(180deg, #2c3070 0%, #3d418f 55%, #6f74c9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fffdf2;
  padding: 24px;
}
.updating-box .updating-moon { font-size: 3rem; margin-bottom: 10px; }
.updating-box .spinner { margin: 0 auto 16px; }
.updating-box h2 { font-size: 1.3rem; font-weight: 900; margin-bottom: 10px; }
.updating-box p { color: #cdd2f5; font-size: 0.92rem; line-height: 1.7; }
.char-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #2c50c8; }

/* 정답 위에 등장하는 캐릭터 스탬프 (잠시 나타났다 사라진다) */
/* 사라질 때는 이동 없이 그 자리에서 페이드만 */
.mark-char.gone { animation: charFadeOut 0.4s ease forwards; }
@keyframes charFadeOut {
  to { opacity: 0; }
}
.mark-char {
  /* 기준점(transform-origin)은 JS에서 정답 좌표로 직접 지정한다 */
  animation: charPop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4));
  pointer-events: none;
}
@keyframes charPop {
  0% { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== 퀘스트 · 출석 · 업적 ===== */
/* 홈 메뉴 퀘스트 버튼 (핑크) + 받을 보상 있음 표시 점 */
.mb-quest { --mb-dark: #c2477d; background: linear-gradient(180deg, #ff8bb3, #f0699a); animation-delay: 0.4s; }
.mb-rank { animation-delay: 0.5s; }
.mb-shop { animation-delay: 0.6s; }
.mb-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff3b30;
  border: 2px solid #fffdf2;
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.8);
  animation: dotPulse 1s ease-in-out infinite alternate;
}

/* ===== 홈 우측 동그란 바로가기 메뉴 (상점/퀘스트/장비/랭킹) ===== */
.side-menu {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  /* 6개 버튼이 좁은 화면에서 양끝이 짤리지 않게 gap 을 폭에 따라 줄인다 */
  gap: clamp(4px, 2.6vw, 20px);
  margin-top: 24px;
  padding: 0 2px;
}
.side-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  min-width: 0;            /* flex 자식이 콘텐츠보다 작아질 수 있게 — 라벨이 폭을 밀지 않게 */
  flex: 0 1 auto;
}
.side-btn .sb-ico {
  /* 아이콘도 폭에 따라 축소 — 좁은 기기에서 6개가 한 줄에 들어가게 */
  width: clamp(42px, 12.5vw, 52px);
  height: clamp(42px, 12.5vw, 52px);
  border-radius: 50%;
  border: 3px solid #fffdf2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.1rem, 4.4vw, 1.45rem);
  box-shadow: 0 3px 0 rgba(20, 24, 80, 0.45), 0 6px 12px rgba(10, 12, 50, 0.35);
  transition: transform 0.1s;
}
.side-btn:active .sb-ico { transform: translateY(2px) scale(0.96); }
.sb-shop  .sb-ico { background: linear-gradient(180deg, #5cd694, #2eb567); }
.sb-quest .sb-ico { background: linear-gradient(180deg, #ff8fa8, #f75f81); }
.sb-equip .sb-ico { background: linear-gradient(180deg, #b39bf5, #8a63e8); }
.sb-stats .sb-ico { background: linear-gradient(180deg, #6fd0e6, #29a7c6); }
.sb-rank  .sb-ico { background: linear-gradient(180deg, #ffd45c, #ffb32e); }

/* ===== 스탯 강화 화면 ===== */
.stats-gold { text-align: center; font-weight: 800; color: var(--primary-dark); margin: 4px 0 12px; }
.stats-gold b { color: #d99a10; }
.stats-list { display: flex; flex-direction: column; gap: 8px; max-width: 620px; margin: 0 auto; padding: 0 6px 16px; }
/* 5장이 스크롤 없이 한 화면에 — 여백·행간을 조여 카드당 높이를 낮춘다 (대표 지시 2026-08-27) */
.stat-card { background: #fff; border: 2px solid #e7e9f7; border-radius: 14px; padding: 9px 14px 10px;
  box-shadow: 0 3px 0 rgba(20, 24, 80, 0.06); }
.stat-head { display: flex; align-items: center; gap: 7px; }
.stat-head b { font-size: 0.95rem; color: #2a2f5a; white-space: nowrap; flex: 0 1 auto;
  overflow: hidden; text-overflow: ellipsis; min-width: 0; } /* 줄바꿈 방지 + 좁으면 이름부터 줄인다 */
.stat-emoji { font-size: 1.25rem; }
.stat-lv { margin-left: auto; font-weight: 900; font-size: 0.82rem; color: var(--primary); background: #eef0fc;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap; flex: none; }
.stat-eff { font-size: 0.88rem; color: #5a5f88; margin: 6px 0 8px; }
.stat-eff b { color: #2a8f5a; }
/* 효과를 이름 옆 인라인으로 — 별도 줄을 없애 카드 높이 절약 */
.stat-eff-inline { display: flex; align-items: center; gap: 5px; font-size: 0.78rem; font-weight: 800;
  color: #2a8f5a; margin-left: 2px; min-width: 0; flex: 1 1 auto; }
/* 효과 문구만 줄어들고(말줄임), 🎁 금색 배지는 항상 온전히 보인다 */
.stat-eff-inline > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stat-eff-inline .starter-plus { flex: none; }
.stat-bar-row { display: flex; align-items: center; gap: 8px; margin: 5px 0 6px; }
.stat-bar-row .stat-bar { flex: 1 1 auto; }
.stat-bar-row .stat-bar-num { margin: 0; flex: none; min-width: 46px; text-align: right; }
.stat-bar { height: 10px; background: #e7e9f7; border-radius: 999px; overflow: hidden; }
.stat-bar i { display: block; height: 100%; background: linear-gradient(90deg, #6fd0e6, #29a7c6); border-radius: 999px;
  transition: width 0.25s ease; }
.stat-bar-num { text-align: right; font-size: 0.78rem; color: #8990b8; font-weight: 800; margin: 3px 2px 10px; }
.stat-buy .btn { padding: 7px 8px; font-size: 0.8rem; }
.stat-maxed { padding: 4px 0; }
.stat-buy { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-buy .btn { flex: 1 1 30%; }
.stat-maxed { text-align: center; font-weight: 900; color: #d99a10; padding: 6px 0; }
/* 오늘 남은 강화 칸 (스탯별 하루 10칸, 2026-09-03).
   ⚠️ 바 줄 '안'에 둔다 — 새 줄을 만들면 카드 5장에 ~85px 가 붙어 10-100 의
   "스탯 화면은 스크롤 없이 한 화면" 이 앱에서 다시 깨진다. 0 이면 붉게(무료 수령 칸과 같은 규칙) */
.stat-day { flex: none; font-size: 0.68rem; font-weight: 800; color: #7b7f96; white-space: nowrap; }
.stat-day.out { color: #d9534f; }
/* 레벨업 버튼: 게이지가 가득 차기 전엔 회색 비활성, 가득 차면 초록으로 활성화돼 눈에 띈다 */
.stat-levelup { background: #e7e9f5; color: #8990b8; }
.stat-levelup:not(:disabled) {
  background: linear-gradient(180deg, #5bd08a, #33b46a); color: #fff; font-weight: 800;
  box-shadow: 0 3px 0 #229055;
}
.stat-levelup:not(:disabled):hover { filter: brightness(0.96); }

/* 🎁 스타터 팩 능력치 안내 — 스탯 레벨과 합산되지 않는 별도 보너스라 목록 위에 따로 둔다 */
/* 🎁 스타터 보너스 배지 — 레벨 숫자는 그대로 두고 "별도 +1" 임을 보여준다 */
/* 🎁 스타터 보너스 — 각 스탯 효과 옆 금색 배지 ("라이프 +1 (+1개)") */
.starter-plus {
  display: inline-block; font-style: normal; padding: 1px 6px;
  border-radius: 999px; background: linear-gradient(180deg, #ffd45c, #ffbe2e);
  color: #6b4a00; font-size: 0.68rem; font-weight: 900; vertical-align: 1px;
  box-shadow: 0 1px 0 #d29200; white-space: nowrap;
}
.stat-starter { grid-column: 1 / -1; text-align: center; font-weight: 800; font-size: 13px;
  color: #7a5b00; background: #fff4d6; border: 1px solid #f0d79a; border-radius: 10px;
  padding: 8px 10px; margin-bottom: 8px; line-height: 1.5; }

/* 💎 다이아 — 유료 재화 색(청록). 칩과 버튼을 골드(노랑)와 확실히 구분한다. */
.btn-dia { background: linear-gradient(135deg, #22d3ee, #3b82f6); color: #fff; }
.btn-dia:hover { filter: brightness(1.05); }
.chip-dia b { color: #0891b2; }

/* ===== ✏️ 정답 펜 스킨 — 정답 원(.mark-found)의 질감 (솔로 전용) ===== */
/* 색연필: 짧은 점선 + 둥근 끝으로 손으로 슥슥 그린 스케치 느낌 */
.mark-found.pen-pencil {
  stroke: #e2711d;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 7 6;
}
/* 싸인펜: 굵고 진한 보라 단색 — 균일하고 또렷한 잉크 선 */
.mark-found.pen-marker {
  stroke: #7c3aed;
  stroke-width: 10;
  stroke-linecap: round;
}
/* 형광펜: 아주 굵고 반투명한 형광 연두 — 종이 위에 칠한 듯 밑이 비친다 */
.mark-found.pen-highlight {
  stroke: #c6f22e;
  stroke-width: 16;
  stroke-opacity: 0.62;
  stroke-linecap: round;
}
/* 🤝 <b>협동에서는 펜이 '질감'만 바꾼다 — 색은 건드리지 않는다.</b>
   협동의 원 색은 <b>'누가 찾았나'</b>(p1~p4)라서, 펜 색이 덮으면 그 정보가 통째로 사라진다.

   ⚠️ 이 규칙은 <b>반드시 펜 정의 뒤에</b> 와야 한다. 선수 색(.mark-found.p1)과 펜 색
   (.mark-found.pen-marker)은 <b>선택자 세기가 같아서(0,2,0) 나중에 오는 쪽이 이긴다.</b>
   원래 자리(968줄)에 그냥 두면 펜이 이겨서 네 명 모두 같은 색이 된다.
   → 이 블록을 위로 옮기거나, 아래에 새 펜 규칙을 추가하면 그 순간 깨진다.

   색을 뺀 나머지(굵기·점선·투명도)는 그대로 살아서, 색이 같아도 펜끼리 구분된다. */
.mark-found.p1 { stroke: var(--p1); }
.mark-found.p2 { stroke: var(--p2); }
.mark-found.p3 { stroke: var(--p3); }
.mark-found.p4 { stroke: var(--p4); }

/* ===== ✏️ 정답 원이 '그려지는' 획 (대표 지시 2026-09-03) =====
   board.js 가 정답 순간에 잠시 추가했다 지우는 별도의 원이다. 둘레만큼 준 점선을
   dashoffset 0 으로 줄여 한 바퀴 그려지게 한다 (둘레는 반지름마다 다르므로 JS 가 --dash 로 넘긴다).

   ⚠️ <b>이 획을 정답 원(.mark-found)에 직접 걸면 안 된다.</b> 색연필 펜
   (.mark-found.pen-pencil)이 stroke-dasharray 로 점선 질감을 만드는데, 획 애니메이션도
   같은 속성을 쓰기 때문에 한 원에 둘을 걸면 색연필 질감이 통째로 사라진다.

   💡 획 자체는 <b>펜 종류와 무관하게 언제나 실선</b>이다 — 위와 같은 이유로 점선을 줄 수 없다.
   색과 굵기만 펜을 따라가고, 점선 질감은 획이 끝난 뒤 앉는 정답 원에서 드러난다. */
.mark-draw {
  fill: none;
  stroke: #e53935;
  stroke-width: 7;
  stroke-linecap: round;
  transform: rotate(-90deg); /* 12시에서 시작해 시계방향 — SVG 원은 3시에서 시작한다 */
  animation: drawArc var(--draw-ms, 320ms) ease-out forwards;
}
/* 획의 굵기·색을 펜에 맞춘다 (점선은 위 주석대로 주지 않는다) */
.mark-draw.pen-pencil { stroke: #e2711d; stroke-width: 6; }
.mark-draw.pen-marker { stroke: #7c3aed; stroke-width: 10; }
.mark-draw.pen-highlight { stroke: #c6f22e; stroke-width: 16; stroke-opacity: 0.62; }
/* 🤝 협동은 '누가 찾았나' 색이 이겨야 한다 — .mark-found 와 같은 이유로 펜 규칙 <b>뒤에</b> 둔다 */
.mark-draw.p1 { stroke: var(--p1); }
.mark-draw.p2 { stroke: var(--p2); }
.mark-draw.p3 { stroke: var(--p3); }
.mark-draw.p4 { stroke: var(--p4); }
@keyframes drawArc {
  from { stroke-dashoffset: var(--dash); }
  to { stroke-dashoffset: 0; }
}
/* 획이 끝나는 순간 정답 원이 자리에 앉는다. 예전의 팝(scale 2→1)을 그대로 두면
   획과 겹쳐 원이 두 번 나타나는 것처럼 보이므로, 옅게 스며들게 바꾼다.
   선택자 세기가 .mark-found(0,1,0)보다 높아(0,2,0) animation 만 이 규칙이 이긴다 —
   stroke 계열은 건드리지 않으므로 펜 스킨·협동 색은 그대로다. */
.mark-found.after-draw {
  animation: foundSettle var(--settle-ms, 80ms) ease-out both;
  animation-delay: var(--draw-ms, 320ms);
}
@keyframes foundSettle {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* ♿ 애니메이션을 줄여 달라는 기기에서는 획을 생략하고 원을 바로 보여준다 */
@media (prefers-reduced-motion: reduce) {
  .mark-draw { display: none; }
  .mark-found.after-draw { animation: none; animation-delay: 0s; }
}

/* 상점 카드의 펜 미리보기 (24px 원에 같은 클래스 재사용 — 팝 애니메이션은 끈다) */
.pen-prev { display: flex; justify-content: center; padding: 6px 0 2px; }
/* 미리보기 바탕에 옅은 체크무늬 — 흰 바탕에서는 <b>형광펜의 반투명(62%)이 드러나지 않아</b>
   그냥 연한 초록으로만 보였다 (대표 지적 2026-09-01). 게임에서는 원이 사진 위에 그려지므로,
   밑이 비친다는 것이 보여야 세 펜의 차이가 제대로 전달된다.
   사진을 깔지 않은 이유: 카드가 6장(펜3·이펙트3)이라 그만큼 이미지 요청이 늘어난다. */
.pen-prev svg {
  width: 64px; height: 64px; border-radius: 10px;
  background-color: #e8ecf7;
  background-image:
    linear-gradient(45deg, #cfd6ea 25%, transparent 25%, transparent 75%, #cfd6ea 75%),
    linear-gradient(45deg, #cfd6ea 25%, transparent 25%, transparent 75%, #cfd6ea 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
}
.pen-prev .pen-demo { animation: none; }
.pen-prev .mark-found { stroke-width: 5; }
.pen-prev .mark-found.pen-marker { stroke-width: 8; }
.pen-prev .mark-found.pen-highlight { stroke-width: 12; }

/* ===== 🎀 테두리 랜덤 능력치 (뽑기) ===== */
.bd-abil { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 4px 0 6px; }
.bd-abil-line {
  font-size: 0.72rem; font-weight: 800; color: #3f51b5;
  background: #eef0fc; border-radius: 8px; padding: 2px 7px;
}
.bd-abil-none { font-size: 0.72rem; color: #9aa0b8; }
/* 좁은 카드라 가로로 두면 글자가 한 자씩 세로로 꺾인다 — 버튼을 위아래로 쌓고 줄바꿈 금지 */
.bd-roll { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.bd-roll .btn { width: 100%; white-space: nowrap; font-size: 0.72rem; padding: 7px 4px; }
.odds-table { width: 100%; margin: 10px 0 2px; border-collapse: collapse; }
.odds-table td { padding: 5px 8px; border-bottom: 1px solid #e7e9f7; font-size: 0.9rem; }
/* 확률 공개 상자 — 상점 테두리 구역 상단 한 곳 (카드에는 확률을 두지 않는다) */
.border-odds {
  background: #fff; border: 2px solid #e7e9f7; border-radius: 16px;
  padding: 12px 16px 10px; margin: 0 0 12px; color: #333;
  font-size: 0.86rem; line-height: 1.5;
}
.border-odds-title { margin: 0 0 6px; font-size: 0.98rem; color: #3f51b5; }
.border-odds .buy-note { margin-top: 8px; }
.roll-result { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.roll-line {
  text-align: center; font-weight: 900; font-size: 1.02rem; color: #3f51b5;
  background: #eef0fc; border-radius: 12px; padding: 9px 0;
  animation: foundPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.roll-line:nth-child(2) { animation-delay: 0.15s; }
.roll-line:nth-child(3) { animation-delay: 0.3s; }

/* ===== 💥 도장 이펙트 — 도장(mark-char)이 사라지는 연출. 정답 원(mark-found)은 그대로 ===== */
/* ✨ 스르륵: 커지면서 흐릿하게 흩어진다 */
.mark-char.fx-fade { animation: fxFade 0.9s ease both; }
@keyframes fxFade {
  from { opacity: 1; filter: blur(0); }
  to { opacity: 0; filter: blur(7px); transform: scale(1.7); }
}
/* 파편·폭죽 공통 파티클 — 방향은 인라인 CSS 변수(--dx/--dy)로 받는다 */
.fx-part {
  transform-box: fill-box;
  transform-origin: center;
  animation: fxPart 0.9s cubic-bezier(0.15, 0.8, 0.4, 1) both;
}
@keyframes fxPart {
  from { opacity: 1; transform: translate(0, 0) scale(1); }
  70% { opacity: 0.9; }
  to { opacity: 0; transform: translate(var(--dx, 40px), var(--dy, -30px)) scale(0.4); }
}

/* ===== ⚔️ 경쟁 모드 ===== */
/* 홈 메뉴 버튼 — 협동(파랑)과 구분되는 승부 색 */
/* 랭크 대전 아이콘의 적색 배경 제거 (대표 지시 2026-08-27) — 다른 카드 아이콘과
   똑같이 투명 배경 이모지로 통일해 네모 배경의 이질감을 없앤다 */
.mb-versus .mb-arrow { color: rgba(255, 255, 255, 0.9); } /* 주홍 카드 위 흰 화살표 */
/* 경쟁 게임 중에는 라이프 바를 통째로 숨긴다 (라이프 개념이 없다) */
body.versus-game #lives-bar { display: none !important; }
.coop-my-tier {
  text-align: center; font-weight: 900; color: #3f51b5;
  background: #eef0fc; border-radius: 12px; padding: 8px 10px; margin: 0 0 4px;
}
/* 결과창 */
.vs-result { text-align: center; }
.vs-sub { font-size: 0.85rem; color: #666; margin-bottom: 10px; }
.vs-row {
  display: flex; justify-content: space-between; align-items: center;
  background: #f5f6fd; border-radius: 12px; padding: 9px 14px; margin: 6px 0;
  font-weight: 800;
}
.vs-row.me { background: #eef0fc; border: 2px solid #c5cae9; }
.vs-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-finds { color: #3f51b5; }
.vs-tier { margin-top: 12px; font-weight: 800; }
.vs-delta { color: #2e7d32; font-weight: 900; }
.vs-delta.down { color: #c62828; }
.vs-promote { margin-top: 6px; font-weight: 900; color: #2e7d32; animation: foundPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.vs-demote { margin-top: 6px; font-weight: 900; color: #c62828; }
.side-btn small {
  font-size: clamp(0.58rem, 2.5vw, 0.68rem);
  font-weight: 900;
  color: #fffdf2;
  text-shadow: 0 1px 0 rgba(20, 24, 80, 0.7), 0 0 6px rgba(20, 24, 80, 0.5);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.side-btn .mb-dot {
  position: absolute;
  top: -2px;
  right: 2px;
}
@keyframes dotPulse { from { transform: scale(0.85); } to { transform: scale(1.15); } }

.quest-tabs { flex-wrap: wrap; }
.quest-tabs .tab { position: relative; padding: 7px 16px; font-size: 0.85rem; }
/* 탭별 받을 보상 알림 점 */
.tab-dot {
  position: absolute;
  top: -3px;
  right: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff3b30;
  border: 2px solid #fffdf2;
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.8);
  animation: dotPulse 1s ease-in-out infinite alternate;
}
#quest-body { max-width: 560px; margin: 0 auto 16px; display: flex; flex-direction: column; gap: 9px; }

/* 퀘스트/업적 카드 */
.quest-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid #fffdf2;
  border-radius: 16px;
  box-shadow: 0 4px 0 rgba(20, 24, 80, 0.4), 0 8px 16px rgba(10, 12, 50, 0.3);
  padding: 12px 14px;
  text-align: left;
  animation: rankIn 0.35s both;
}
.quest-card.ready { border-color: #ffd45c; box-shadow: 0 4px 0 #c8860a, 0 8px 18px rgba(200, 140, 10, 0.35); }
/* 완료 보상 일괄수령 버튼 */
.quest-claim-all {
  width: 100%;
  max-width: 620px;
  margin: 0 auto 2px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 900;
  border: 3px solid #fffdf2;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffd45c, #ffb32e);
  color: #5a3d00;
  box-shadow: 0 4px 0 #b8860b, 0 8px 16px rgba(200, 140, 10, 0.35);
  animation: rankIn 0.35s both;
}
.quest-claim-all:active { transform: translateY(2px); box-shadow: 0 2px 0 #b8860b; }
.quest-card.claimed { opacity: 0.62; }
.q-info { flex: 1 1 auto; min-width: 0; }
.q-name { font-weight: 800; font-size: 0.92rem; }
.q-name small { display: block; font-weight: 600; font-size: 0.72rem; color: var(--muted); margin-top: 1px; }
.q-bar {
  height: 8px;
  border-radius: 999px;
  background: #e5e8f7;
  overflow: hidden;
  margin: 6px 0 3px;
}
.q-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6d9cff, #4f8df9); }
.quest-card.ready .q-bar i, .quest-card.claimed .q-bar i { background: linear-gradient(90deg, #ffd45c, #ffb32e); }
.q-prog { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.q-side { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
/* 보상칸: 골드·캐릭터 보상을 한 박스에 모아 보여준다 */
.q-rewards {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: #fff7e0;
  border: 1.5px solid #f2dfa8;
  border-radius: 10px;
  padding: 4px 10px;
  min-width: 72px;
}
.q-rlabel {
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #b8912a;
}
.q-reward { font-size: 0.8rem; font-weight: 800; color: #8a6a10; }
.q-reward-ch { font-size: 0.72rem; color: #7a5cc9; white-space: nowrap; }
.q-claim {
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 800;
  border: 2px solid #fffdf2;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffd45c, #ffb32e);
  color: #5a3d00;
  box-shadow: 0 3px 0 #b8860b;
}
.q-claim:disabled { filter: grayscale(0.7); opacity: 0.55; box-shadow: 0 3px 0 #9a9a9a; cursor: default; }
.q-claim:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 #b8860b; }
.q-done { font-size: 0.82rem; font-weight: 800; color: #1d8a4e; }

/* ===== 단계형 업적 카드 (Lv.N → 무한) ===== */
.ach-card .q-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ach-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  border-radius: 9px;
  background: linear-gradient(180deg, #eef1ff, #dde3ff);
  border: 1.5px solid #cbd4ff;
  flex: none;
}
.ach-lv {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(180deg, #7b8cff, #4f63e8);
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}
.quest-card.ready .ach-lv { background: linear-gradient(180deg, #ffca4a, #eb9c12); color: #4a3200; }
.ach-card .q-name small { flex-basis: 100%; margin-top: 0; }
/* 앞으로 열릴 특별 보상 미리보기 */
.ach-next {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e2e5f5;
}
.ach-lock { font-size: 0.66rem; font-weight: 900; color: #9aa0c4; letter-spacing: 0.02em; }
.ach-next .q-reward-ch { font-size: 0.68rem; }

/* 출석 7일 그리드 */
/* ===== 출석 달력: 도장 찍기 ===== */
.att-summary {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.att-streak {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 9px 6px;
  text-align: center;
}
.att-streak b { display: block; font-size: 1.05rem; color: #ffd45c; }
.att-streak small { font-size: 0.68rem; color: #c9cdf0; }

/* 지금 무엇을 하면 되는지 한 줄로 — 도장 전/후로 색과 문구가 바뀐다 */
.att-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 2px 0 10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid #ffd45c;
  background: linear-gradient(180deg, rgba(255, 212, 92, 0.22), rgba(255, 179, 46, 0.14));
  animation: attCta 1.6s ease-in-out infinite;
}
.att-cta b { font-size: 0.95rem; color: #ffe9a8; }
.att-cta small { font-size: 0.74rem; font-weight: 800; color: #fff; display: flex; align-items: center; gap: 3px; }
.att-cta small .coin { width: 12px; height: 12px; }
/* ===== 🎰 하트 슬롯머신 ===== */
/* 상점 맨 위 진입 카드 — 가로로 길게 두어 상품 격자와 구분된다 */
.slot-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 16px;
  cursor: pointer;
  border: 2px solid #ffd45c;
  background: linear-gradient(135deg, rgba(255, 212, 92, 0.24), rgba(160, 120, 255, 0.22));
  box-shadow: 0 6px 18px rgba(10, 12, 50, 0.25);
}
/* 상품 격자(.shop-grid)와 같은 폭·가운데 정렬 — PC 에서 혼자 전폭으로 늘어나 어색했다
   (대표 지적 2026-08-31). 모바일은 원래 화면 폭이라 달라지는 게 없다. */
.slot-entry { max-width: 620px; margin-left: auto; margin-right: auto; }
.slot-entry:active { transform: translateY(1px); }
.slot-entry .se-icon { font-size: 2rem; animation: seBob 1.8s ease-in-out infinite; }
@keyframes seBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.slot-entry .se-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.slot-entry .se-text b { font-size: 1rem; color: #ffe9a8; }
.slot-entry .se-text small { font-size: 0.75rem; font-weight: 700; color: rgba(255, 255, 255, 0.86); }
.slot-entry .se-cost {
  flex: 0 0 auto; font-weight: 900; font-size: 0.9rem; color: #fff;
  padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.28);
}

/*
  슬롯머신 본체 — 릴 세 개가 세로로 흐르고 가운데 한 줄이 당첨선이다.
  ⚠️ 예전에는 룰렛 원판이었는데, 부채꼴 칸의 이름표가 아래쪽 반원에서 거꾸로 읽혔다
     (실기기 확인). 릴은 회전이 없어 그림이 항상 똑바로 선다.
*/
.sm-machine {
  --sm-cell: 3.2rem;                 /* 릴 한 칸의 높이 — JS 가 이 값으로 이동 거리를 잰다 */
  width: min(86vw, 300px);
  margin: 4px auto 10px;
  padding: 12px;
  border-radius: 18px;
  border: 2px solid rgba(255, 212, 92, 0.6);
  background: linear-gradient(180deg, #2b1f50, #150f2c);
  box-shadow: 0 8px 22px rgba(10, 12, 50, 0.45), inset 0 0 26px rgba(255, 212, 92, 0.1);
}
.sm-reels { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sm-reel {
  height: calc(var(--sm-cell) * 3);  /* 세 칸이 보이고 가운데가 당첨선 */
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  /* 위아래 끝을 흐리게 — 띠가 통 안에서 흐르는 것처럼 보인다 */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 20%, #000 80%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 20%, #000 80%, transparent 100%);
}
.sm-strip { will-change: transform; }
/* 도는 동안만 흐리게 — 멈추는 순간 또렷해져 '멈췄다'가 눈에 들어온다 */
.sm-reel.rolling .sm-strip { filter: blur(1.4px); }
.sm-cell {
  height: var(--sm-cell);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; line-height: 1;
  user-select: none;
}
/* 당첨선 — 가운데 칸을 감싸는 금색 틀 */
.sm-line {
  position: absolute; left: -3px; right: -3px;
  top: var(--sm-cell); height: var(--sm-cell);
  border-top: 2px solid rgba(255, 212, 92, 0.85);
  border-bottom: 2px solid rgba(255, 212, 92, 0.85);
  border-radius: 4px; pointer-events: none;
  transition: background 0.25s, box-shadow 0.25s;
}
.sm-machine.win .sm-line {
  background: rgba(255, 212, 92, 0.12);
  box-shadow: 0 0 16px rgba(255, 212, 92, 0.75);
}
.sm-result { text-align: center; font-weight: 900; color: #ffe9a8; min-height: 1.4em; margin-bottom: 6px; }
.sm-odds { margin-top: 6px; font-size: 0.78rem; color: rgba(255, 255, 255, 0.9); }
.sm-odds summary { cursor: pointer; font-weight: 800; }
.sm-odds ul { list-style: none; padding: 6px 0 0; margin: 0; display: grid; gap: 3px; }
.sm-odds li { display: flex; justify-content: space-between; gap: 10px; }

/* 움직임을 줄이도록 설정한 기기에서는 릴을 굴리지 않고 결과만 보여준다 */
@media (prefers-reduced-motion: reduce) {
  .sm-strip { transition: none !important; }
  .sm-reel.rolling .sm-strip { filter: none; }
}

/* 매일 받는 보상 — 항목마다 칩으로 나란히 (한 줄에 몰아 쓰면 눈에 안 들어온다) */
.att-rewards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 4px;
}
.att-rewards span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.74rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
}
.att-rewards .coin { width: 12px; height: 12px; }
.att-cta.done {
  border-color: rgba(92, 214, 148, 0.7);
  background: linear-gradient(180deg, rgba(92, 214, 148, 0.2), rgba(52, 196, 112, 0.12));
  animation: none;
}
.att-cta.done b { color: #b8f5d2; }
@keyframes attCta {
  0%, 100% { transform: translateY(0); box-shadow: 0 0 0 rgba(255, 212, 92, 0); }
  50% { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(255, 212, 92, 0.35); }
}
/* 아직 안 찍은 날 — 달력 자체가 눌러달라고 살짝 빛난다 */
.att-cal.waiting { box-shadow: 0 5px 0 rgba(20, 24, 80, 0.4), 0 0 0 3px rgba(255, 212, 92, 0.45), 0 10px 24px rgba(200, 150, 20, 0.3); }

.att-cal {
  background: rgba(255, 255, 255, 0.97);
  border: 3px solid #fffdf2;
  border-radius: 18px;
  box-shadow: 0 5px 0 rgba(20, 24, 80, 0.4), 0 10px 20px rgba(10, 12, 50, 0.3);
  padding: 10px 10px 12px;
  /* 달력이 퀘스트 패널 폭(560~780px)을 그대로 채우면 칸이 정사각(aspect-ratio)이라
     세로로 너무 길어져 스크롤 없이는 한눈에 안 들어온다. 폭을 묶어 칸을 작게 유지한다.
     폰(패널이 화면 폭)은 원래 이 크기라 달라지지 않는다. */
  width: 100%;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.att-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.att-cal-title { font-weight: 900; font-size: 0.95rem; color: #2a2f6b; }
.att-nav {
  width: 30px; height: 30px;
  border: none;
  border-radius: 10px;
  background: rgba(91, 108, 255, 0.1);
  color: #5b6cff;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
.att-nav:active { transform: scale(0.9); }
.att-nav.off { opacity: 0.25; cursor: default; }

.att-cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.att-cal-week span {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #8990b8;
  padding-bottom: 3px;
}
.att-cal-week .sun { color: #e5484d; }
.att-cal-week .sat { color: #4f8df9; }

.att-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.att-day {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: rgba(120, 128, 200, 0.07);
}
.att-day.pad { background: none; }
.att-day.future { opacity: 0.35; }
.att-num {
  font-style: normal;
  font-size: 0.74rem;
  font-weight: 700;
  color: #6b71a0;
}
/* 도장이 찍힌 날 — 장착 캐릭터가 날짜 위에 쿵 */
.att-day.stamped { background: linear-gradient(180deg, #fff3cd, #fffdf4); }
.att-day.stamped .att-num { opacity: 0.35; }
.att-stamp {
  position: absolute;
  font-style: normal;
  font-size: 1.15rem;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(120, 90, 10, 0.4));
  animation: attStampIn 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes attStampIn {
  0% { transform: scale(2.2) rotate(-18deg); opacity: 0; }
  60% { transform: scale(0.88) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
/* 오늘 — 아직 안 찍었으면 눌러서 찍는다 */
.att-day.today .att-num { color: #2a2f6b; font-weight: 900; }
/* 오늘 찍을 수 있는 칸 — 노랗게 빛나며 '여기를 누르라'고 알린다 */
.att-day.can-stamp {
  cursor: pointer;
  background: linear-gradient(180deg, #fff6d8, #ffeab0);
  animation: attToday 1.3s ease-in-out infinite;
}
.att-day.can-stamp .att-num { color: #7a5a10; }
.att-day.can-stamp:active { transform: scale(0.92); }
@keyframes attToday {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 176, 46, 0.55); }
  60% { box-shadow: 0 0 0 7px rgba(255, 176, 46, 0); }
}
/* '오늘' 꼬리표 — 어느 칸이 오늘인지 숫자만으로는 잘 안 보인다 */
.att-today-tag {
  position: absolute;
  top: -7px;
  font-style: normal;
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #fff;
  background: #4f8df9;
  border-radius: 999px;
  padding: 1px 7px;
  box-shadow: 0 2px 4px rgba(10, 12, 50, 0.3);
}
.att-day.can-stamp .att-today-tag { background: #ff9f1a; }
/* 누르라는 손가락 — 칸 아래에서 톡톡 튄다 */
.att-tap {
  position: absolute;
  bottom: -4px;
  right: -2px;
  font-style: normal;
  font-size: 0.95rem;
  animation: attTap 1.1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes attTap {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-5px) rotate(-6deg); }
}
/* 도장을 찍는 순간: 반짝이가 퍼지고 받은 보상이 떠오른다 */
.att-burst { position: absolute; inset: 0; pointer-events: none; }
.att-burst u {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #ffd45c;
  box-shadow: 0 0 6px rgba(255, 200, 60, 0.9);
  animation: attSpark 0.7s ease-out forwards;
}
.att-burst u:nth-child(1) { --ax: 0px;    --ay: -26px; }
.att-burst u:nth-child(2) { --ax: 22px;   --ay: -14px; }
.att-burst u:nth-child(3) { --ax: 22px;   --ay: 14px; }
.att-burst u:nth-child(4) { --ax: 0px;    --ay: 26px; }
.att-burst u:nth-child(5) { --ax: -22px;  --ay: 14px; }
.att-burst u:nth-child(6) { --ax: -22px;  --ay: -14px; }
@keyframes attSpark {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to { transform: translate(var(--ax), var(--ay)) scale(0.2); opacity: 0; }
}
.att-gain {
  position: absolute;
  top: -2px;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 900;
  color: #2f9e5f;
  text-shadow: 0 1px 0 #fff, 0 2px 6px rgba(10, 12, 50, 0.25);
  animation: attGain 1.3s ease-out forwards;
  pointer-events: none;
  /* 보상을 한 줄에 하나씩 쌓는다 — nowrap 이면 줄바꿈이 무시된다 */
  white-space: pre-line;
  line-height: 1.28;
  text-align: center;
}
@keyframes attGain {
  0% { transform: translateY(6px); opacity: 0; }
  25% { transform: translateY(-6px); opacity: 1; }
  75% { transform: translateY(-14px); opacity: 1; }
  100% { transform: translateY(-22px); opacity: 0; }
}
.att-ring {
  position: absolute;
  inset: 2px;
  border: 2px dashed #ffb02e;
  border-radius: 10px;
  animation: attRing 1.1s ease-in-out infinite alternate;
}
@keyframes attRing {
  from { opacity: 0.55; }
  to { opacity: 1; box-shadow: 0 0 12px rgba(79, 141, 249, 0.6); }
}
.att-day.today.stamped { box-shadow: inset 0 0 0 2px #ffb02e; }

/* 7일 사이클 보상 미리보기 */
.att-rewards {
  display: flex;
  gap: 4px;
  margin: 10px 0 2px;
  overflow-x: auto;
}
.att-chip {
  flex: 1 0 auto;
  min-width: 46px;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 5px 3px;
}
.att-chip b { display: block; font-size: 0.64rem; color: #c9cdf0; font-weight: 800; }
.att-chip em {
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
}
.att-chip em .coin { width: 9px; height: 9px; margin-right: 1px; }
.att-chip.got { background: rgba(255, 212, 92, 0.22); border-color: #ffd45c; }
.att-chip.next { outline: 2px solid #4f8df9; }

@media (max-width: 380px) {
  .att-stamp { font-size: 1rem; }
  .att-num { font-size: 0.68rem; }
}

.att-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.att-card {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #fffdf2;
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(20, 24, 80, 0.35);
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
}
.att-card b { font-size: 0.8rem; }
.att-card .att-r { font-size: 0.72rem; color: var(--muted); }
.att-card.done { background: linear-gradient(180deg, #fff3cd, #fffdf4); border-color: #ffd45c; }
.att-card.next { outline: 3px solid #4f8df9; animation: attNextGlow 0.9s ease-in-out infinite alternate; }
@keyframes attNextGlow {
  from { outline-color: #4f8df9; box-shadow: 0 3px 0 rgba(20, 24, 80, 0.35); }
  to { outline-color: #9db9ff; box-shadow: 0 3px 0 rgba(20, 24, 80, 0.35), 0 0 16px rgba(79, 141, 249, 0.75); }
}
.att-card .att-check {
  position: absolute;
  top: -8px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #5cd694, #34c470);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fffdf2;
}
.quest-att-btn { margin: 12px auto 0; display: block; border: 2px solid #fffdf2; border-radius: 16px;
  background: linear-gradient(180deg, #6d9cff, #4f8df9); box-shadow: 0 5px 0 #2c50c8, 0 10px 18px rgba(10, 12, 50, 0.35); }
.quest-att-btn:disabled { filter: grayscale(0.5); opacity: 0.7; box-shadow: 0 5px 0 #6a6a8a; }
.quest-att-btn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 #2c50c8; }
.quest-tip { font-size: 0.75rem; color: #c9cdf0; margin-top: 6px; }

/* 오늘 출석할 일차 카드는 눌러서 바로 출석 가능 */
.att-card.next { cursor: pointer; }
.att-card.next:active { transform: scale(0.95); }

/* 파란 코인 = 게임 입장권 (골드 금화와 구분) */
.coin.coin-b {
  background: radial-gradient(circle at 35% 28%, #a8ccff, #5b8df6 52%, #2c50c8);
  border-color: #1e3a9e;
  box-shadow: inset 0 0 0 2.5px rgba(210, 228, 255, 0.65), 0 1px 2px rgba(10, 20, 80, 0.4);
}
.shop-icon .coin { width: 1.15em; height: 1.15em; }

/* 좁은 화면: 재화 칩 3개가 프로필과 함께 들어가게 축소 */
/* 큰 폰에서 상단 재화 칩이 화면 밖으로 잘리지 않게 축소한다.
   430px 이던 기준을 460px 로 올린 이유: iPhone 16/17 Pro Max 가 440pt 라 430 기준을 비껴가
   축소가 안 걸렸고, 돋보기·시간추가 칩이 오른쪽으로 11pt 넘쳐 잘렸다. */
@media (max-width: 460px) {
  .chip { padding: 4px 4px 4px 9px; font-size: 0.84rem; gap: 4px; }
  .chip-plus { width: 17px; height: 17px; font-size: 0.66rem; }
  .profile-meta b { max-width: 68px; }
  .profile-meta small { font-size: 0.56rem; } /* 좁은 화면에서도 신분 표기(관리자·연동됨·게스트)는 보이게 */
  .profile-chip { padding-right: 10px; }
}

/* ===== 설정 모달: 토글 스위치 ===== */
.pref-list { display: flex; flex-direction: column; gap: 10px; }
.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 2px solid #e4e8ff;
  background: linear-gradient(180deg, #fff, #eef1ff);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 3px 0 #ccd3f2;
  cursor: pointer;
}
.pref-label { font-weight: 800; font-size: 0.95rem; color: var(--text); }
/* 체크박스를 게임 톤 스위치로 */
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #cdd2e8;
  border: 2px solid #fffdf2;
  box-shadow: inset 0 2px 4px rgba(20, 24, 80, 0.25);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex: none;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(20, 24, 80, 0.35);
  transition: left 0.15s;
}
.switch:checked { background: linear-gradient(180deg, #5cd694, #34c470); }
.switch:checked::after { left: 24px; }

/* ===== PC(넓고 높은 화면): 문구·버튼 전체 확대 =====
   글꼴은 대부분 rem이라 루트 크기만 키워도 함께 커진다.
   높이가 낮은 창(max-height 660px 축소 보정)과 충돌하지 않게 min-height 조건을 걸고,
   기본 정의를 확실히 덮도록 파일 맨 끝에 둔다. */
@media (min-width: 900px) and (min-height: 680px) {
  html { font-size: 18px; }
  .menu-stack { width: 430px; gap: 14px; }
  .menu-btn { padding: 15px 20px; border-radius: 28px; }
  .mb-icon { font-size: 2rem; }
  .side-menu { gap: 26px; margin-top: 30px; }
  .side-btn .sb-ico { width: 62px; height: 62px; font-size: 1.7rem; }
  .side-btn small { font-size: 0.75rem; }
  .modal { max-width: 460px; }
  .btn { padding: 12px 22px; }
  .back-btn { width: 50px; height: 50px; }
  .settings-header .back-btn { width: 42px; height: 42px; }
  .settings-header .account-close { width: 38px; height: 38px; }
  .settings-menu a { padding: 12px 15px; }
  .settings-menu a span { width: 38px; height: 38px; }
  .pref-row { padding: 14px 16px; }
}

/* ===== 태블릿 (가로 600~1199px) =====
   이 구간이 비어 있어 폰 레이아웃이 그대로 늘어나고 있었다.
   화면은 넓은데 메뉴·목록의 max-width가 폰 기준이라 가운데만 좁게 쓰고 아래가 크게 비었다.

   위의 PC 블록(min-width:900px)과 900~1199px 구간이 겹치므로 파일 뒤쪽에 두어
   태블릿 값이 이기게 한다. 1200px 이상은 PC 블록이 그대로 담당한다.
   가로로 눕힌 폰(높이가 낮음)이 걸려들지 않도록 min-height 조건을 함께 건다. */
@media (min-width: 600px) and (max-width: 1199px) and (min-height: 600px) {
  html { font-size: 19px; }
  #app { max-width: 900px; padding: 16px 22px 20px; }

  /* --- 홈 --- */
  .menu-stack { width: min(560px, 82%); gap: 16px; }
  .menu-btn { padding: 18px 26px; border-radius: 30px; }
  .mb-icon { font-size: 2.3rem; }
  .mb-text b { font-size: 1.35rem; }
  .mb-text small { font-size: 0.9rem; }
  .mb-arrow { font-size: 1.2rem; }
  .side-menu { gap: 30px; margin-top: 34px; }
  .side-btn .sb-ico { width: 72px; height: 72px; font-size: 2rem; }
  .side-btn small { font-size: 0.78rem; }

  /* --- 목록·그리드: 넓어진 화면만큼 폭을 늘리고 칸을 키운다 --- */
  .rank-list { max-width: 680px; }
  .rank-list li { padding: 13px 18px; }
  .shop-grid { max-width: 780px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
  .char-grid { max-width: 780px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .shop-icon { width: 72px; height: 72px; }
  .player-list { max-width: 460px; }

  /* --- 협동 대기실 --- */
  .invite-code { font-size: 2.4rem; letter-spacing: 8px; }
  .qr { width: min(220px, 28vh); }

  /* --- 모달·시트 --- */
  .modal { max-width: 560px; }
  .account-sheet { max-width: 560px; }
  .btn { padding: 12px 24px; }
  .back-btn { width: 52px; height: 52px; }
  .settings-header .back-btn { width: 44px; height: 44px; }
  .settings-header .account-close { width: 40px; height: 40px; }
  .settings-menu a { padding: 13px 16px; font-size: 1rem; }
  .settings-menu a span { width: 40px; height: 40px; font-size: 1.15rem; }
  .pref-row { padding: 15px 18px; }
  .pref-row b { font-size: 1.02rem; }
  .modal h3 { font-size: 1.4rem; }
  #modal-body { font-size: 1.02rem; }
  #modal-body input { font-size: 1.08rem; padding: 13px 16px; }
  .modal-actions { gap: 14px; }
  .toast { font-size: 0.96rem; padding: 12px 24px; }

  /* --- 공통 버튼 —— 태블릿은 폰보다 멀리 두고 보므로 손가락 목표를 키운다 --- */
  .btn { padding: 13px 26px; font-size: 1rem; border-radius: 14px; }
  .btn-big { padding: 17px 32px; font-size: 1.12rem; border-radius: 18px; }
  .btn-small { padding: 10px 18px; font-size: 0.9rem; }
  .tab { padding: 11px 30px; font-size: 1.05rem; }

  /* --- 상점 카드 --- */
  .shop-item { padding: 22px 14px 18px; gap: 10px; }
  .shop-sub-title { font-size: 1.3rem; }
  .shop-sub-desc { font-size: 0.9rem; }
  .shop-name { font-size: 1.08rem; }
  .shop-desc { font-size: 0.88rem; }
  .shop-item .btn { padding: 12px 22px; font-size: 1rem; }

  /* --- 캐릭터·테두리 카드 --- */
  .char-card { padding: 16px 10px; gap: 8px; }
  .char-face { font-size: 2.7rem; }
  .char-name { font-size: 1rem; }
  .char-perk { font-size: 0.8rem; }
  .char-btn { padding: 9px 18px; font-size: 0.92rem; }
  .char-btn.locked { padding: 9px 12px; font-size: 0.82rem; }
  .stamp-soon { padding: 8px 14px; font-size: 0.85rem; }
  .bd-prev-name { font-size: 0.86rem; }

  /* --- 퀘스트: 탭·카드·업적 (목록 폭도 다른 화면처럼 넓힌다) --- */
  #quest-body { max-width: 680px; gap: 12px; }
  .quest-tabs .tab { padding: 10px 22px; font-size: 1rem; }
  .quest-card { padding: 16px 18px; gap: 16px; border-radius: 20px; }
  .q-name { font-size: 1.05rem; }
  .q-name small { font-size: 0.84rem; }
  .q-bar { height: 10px; }
  .q-prog { font-size: 0.84rem; }
  .q-rewards { min-width: 88px; padding: 6px 12px; }
  .q-reward { font-size: 0.92rem; }
  .q-reward-ch { font-size: 0.82rem; }
  .q-claim { padding: 10px 22px; font-size: 0.95rem; }
  .q-done { font-size: 0.95rem; }
  .quest-claim-all { padding: 15px 20px; font-size: 1.08rem; }
  .quest-tip { font-size: 0.85rem; }
  .ach-ico { width: 34px; height: 34px; font-size: 1.2rem; }
  .ach-lv { padding: 3px 10px; font-size: 0.76rem; }
  .ach-lock { font-size: 0.74rem; }

  /* --- 출석 달력: 날짜 칸과 도장을 시원하게 --- */
  .att-summary { gap: 14px; }
  .att-streak b { font-size: 1.3rem; }
  .att-streak small { font-size: 0.8rem; }
  /* 날짜 칸이 정사각형이라 폭을 넓힌 만큼 달력이 세로로도 커진다.
     한 화면에 보상 칩과 출석 버튼까지 들어오도록 달력 폭만 따로 묶는다. */
  .att-cal { padding: 12px 12px 14px; border-radius: 20px; }
  .att-cal-title { font-size: 1.15rem; }
  .att-nav { width: 40px; height: 40px; font-size: 1.4rem; border-radius: 13px; }
  .att-cal-week span { font-size: 0.82rem; }
  .att-day { border-radius: 14px; }
  .att-num { font-size: 0.9rem; }
  .att-stamp { font-size: 1.6rem; }
  .att-chip { min-width: 58px; padding: 7px 5px; border-radius: 12px; }
  .att-chip b { font-size: 0.76rem; }
  .att-chip em { font-size: 0.74rem; }
  .att-chip em .coin { width: 11px; height: 11px; }

  /* --- 우편함 --- */
  .mail-tab { padding: 8px 18px; font-size: 0.9rem; }
  .mail-list { max-height: 46vh; }
  .mail-row { padding: 12px 8px; }
  .mail-ico { font-size: 1.7rem; }
  .mail-info b { font-size: 1rem; }
  .mail-info small { font-size: 0.82rem; }
  .mail-exp { font-size: 0.76rem; }
  .mail-amt { font-size: 0.95rem; }
  .mail-done { font-size: 0.85rem; }
  .mail-empty { font-size: 1rem; padding: 24px 0; }
  .mail-tip { font-size: 0.82rem; }

  /* --- 게임 화면: 사진을 화면 폭에 맞춰 크게 --- */
  body.in-game #app { max-width: none; padding: 8px 18px 14px; }
  body.in-game .game-top { justify-content: center; gap: 10px; }
  body.in-game .game-top .hud-item { font-size: 1rem; padding: 8px 16px; border-radius: 11px; }
  #lives-bar { right: 14px; gap: 8px; }
  #lives-bar span { font-size: 1.8rem; }
}

/* 상단바: 시간 추가 칩은 폰에서 자리가 없어 돋보기 칩 아래에 겹쳐 뒀다(.chip-sub).
   가로가 넉넉하면 한 줄에 나란히 세운다 — 상단바 아랫줄이 비어 보이던 문제.
   칩 4개를 한 줄에 넣으려면 프로필 칩이 줄어들 수 있어야 하므로, 폰에서 고정폭이던
   닉네임을 최대폭으로 바꾼다(좁으면 말줄임). 600~699px 는 칩만으로도 폭이 모자라
   가로 스크롤이 생기므로 폰과 같은 겹침 배치를 그대로 둔다. */
@media (min-width: 700px) and (max-width: 1199px) and (min-height: 600px) {
  .chip-col { gap: 8px; }
  .chip-sub { position: static; box-shadow: none; }
  .profile-chip { flex: 0 1 auto; }
  /* 상한을 em 으로 두면 태블릿의 큰 기준 글자(1.15rem)에 곱해져 235px 까지 늘어나고,
     10자 닉네임에서 칩이 커져 상단바가 화면을 넘는다. 화면 폭에 따라 함께 줄어드는
     상한을 둬, 긴 닉네임은 말줄임으로 잘리게 한다 (700px 대까지 한 줄 유지). */
  .profile-meta b { width: auto; max-width: min(150px, 15.5vw); }
}

/* 태블릿 세로: 화면이 길어 아래가 크게 남으므로 홈 메뉴를 조금 더 키운다 */
@media (min-width: 600px) and (max-width: 1199px) and (orientation: portrait) and (min-height: 900px) {
  .menu-stack { width: min(600px, 84%); gap: 20px; }
  .menu-btn { padding: 22px 30px; }
  .mb-icon { font-size: 2.6rem; }
  .mb-text b { font-size: 1.5rem; }
  .mb-text small { font-size: 0.95rem; }
  .side-menu { gap: 34px; margin-top: 42px; }
  .side-btn .sb-ico { width: 80px; height: 80px; font-size: 2.2rem; }
}

/* ===== 연속 정답 콤보 연출 ===== */
.combo-pop {
  position: fixed;
  left: 50%;
  top: 24%;
  z-index: 70;
  pointer-events: none;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 900;
  color: #ffd45c;
  text-shadow: 0 2px 0 rgba(120, 60, 0, 0.55), 0 4px 14px rgba(10, 12, 50, 0.6);
  animation: comboPop 0.95s cubic-bezier(0.2, 1.3, 0.4, 1) forwards;
}
.combo-pop b { font-size: 1.7rem; letter-spacing: 0.04em; }
.combo-pop small { font-size: 1.05rem; color: #aef3c1; text-shadow: 0 2px 0 rgba(10, 80, 30, 0.55), 0 4px 14px rgba(10, 12, 50, 0.6); }
@keyframes comboPop {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  45% { transform: translate(-50%, -50%) scale(1); }
  75% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(0.95); opacity: 0; }
}

/* ===== 스테이지 전환 커튼 (좌우 닫힘/열림) ===== */
#curtain { position: fixed; inset: 0; z-index: 66; pointer-events: none; }
#curtain.hidden { display: none; }
.curtain-half {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 51%;
  background: linear-gradient(180deg, #2a2e5c 0%, #383e79 55%, #2a2e5c 100%);
  transition: transform 0.42s cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
}
.curtain-l { left: 0; transform: translateX(-101%); border-right: 4px solid #ffd45c; box-shadow: 6px 0 18px rgba(10, 12, 50, 0.5); }
.curtain-r { right: 0; transform: translateX(101%); border-left: 4px solid #ffd45c; box-shadow: -6px 0 18px rgba(10, 12, 50, 0.5); }
#curtain.closing .curtain-l, #curtain.closing .curtain-r { transform: translateX(0); }
/* 커튼 위 은은한 별 무늬 */
.curtain-half::after {
  content: '✦';
  position: absolute;
  top: 50%;
  color: rgba(255, 212, 92, 0.5);
  font-size: 1.4rem;
}
.curtain-l::after { right: 18px; transform: translateY(-50%); }
.curtain-r::after { left: 18px; transform: translateY(-50%); }

/* ===== 10초 남음 HURRY UP 경고 ===== */
.hurry-pop {
  position: fixed;
  left: 50%;
  top: 30%;
  z-index: 70;
  pointer-events: none;
  white-space: nowrap; /* left:50% 배치라 가용 폭이 절반뿐 — 모바일에서 줄바꿈 방지 */
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: 0.06em;
  color: #ff6b57;
  text-shadow: 0 2px 0 rgba(120, 20, 0, 0.6), 0 4px 16px rgba(10, 12, 50, 0.6), 0 0 22px rgba(255, 107, 87, 0.45);
  animation: hurryPop 1.4s ease forwards;
}
@keyframes hurryPop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  25% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  35% { transform: translate(-50%, -50%) scale(1.05) rotate(2deg); }
  45% { transform: translate(-50%, -50%) scale(1) rotate(-1deg); }
  80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -55%) scale(0.95); opacity: 0; }
}

/* ===== 보너스 스테이지 & 아이템 ===== */
/* 거울 보너스: 오른쪽 보드 좌우반전 (클릭 좌표는 SVG 행렬로 자동 보정됨) */
.board.mirror svg { transform: scaleX(-1); }

/* 번쩍이 아이템: 남은 정답 링 반짝임 */
.reveal-ring {
  fill: none;
  stroke: #ffd45c;
  stroke-width: 8;
  filter: drop-shadow(0 0 8px rgba(255, 212, 92, 0.9));
  animation: revealBlink 0.4s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes revealBlink { from { opacity: 0.25; } to { opacity: 1; } }

/* 시간 정지: 타임 바가 얼어붙은 모습 */
#solo-time-fill.frozen, #coop-time-fill.frozen,
.frozen {
  background: linear-gradient(90deg, #9fd8ff, #5db6f5) !important;
  box-shadow: 0 0 10px rgba(120, 200, 255, 0.8);
}

/* 황금별 잡기 미니게임 */
.boards { position: relative; }
/* 사진을 받는 동안: 반쯤 그려진 사진을 감추고 로딩만 보여준다 (Solo.waitPhotos) */
.boards.photo-loading .board { visibility: hidden; }
.boards.photo-loading::after {
  content: '🖼️';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.6rem;
  filter: drop-shadow(0 4px 10px rgba(10, 12, 50, 0.5));
  animation: photoWait 1.1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes photoWait {
  0%, 100% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.94); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
}
.star-layer { position: absolute; inset: 0; z-index: 30; }
.gold-star {
  position: absolute;
  width: 52px;
  height: 52px;
  border: none;
  background: none;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  filter: drop-shadow(0 0 10px rgba(255, 212, 92, 0.9));
  transition: left 0.85s ease-in-out, top 0.85s ease-in-out, transform 0.25s, opacity 0.25s;
  animation: starWobble 1.2s ease-in-out infinite alternate;
  padding: 0;
  /* 별을 탭할 때 모바일 브라우저가 버튼 주위에 그리는 네모난 탭 하이라이트·포커스 테두리를 없앤다
     (웹사이트 버튼처럼 보이던 사각 표시 — 대표 신고 2026-08-24) */
  -webkit-tap-highlight-color: transparent;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.gold-star:focus, .gold-star:focus-visible, .gold-star:active { outline: none; }
.gold-star.caught { transform: scale(1.8); opacity: 0; }
@keyframes starWobble { from { rotate: -12deg; } to { rotate: 12deg; } }

/* 상점 아이템 보유 수 */
.shop-owned { color: var(--muted); font-weight: 700; }
/* 오늘 수령 횟수를 다 쓴 상태 — 0/10 을 붉게, 버튼은 눌리지 않는 모양으로 */
.shop-owned b.spent { color: #e5484d; }
.shop-item .btn.spent,
.shop-item .btn.spent:hover { filter: grayscale(0.85); opacity: 0.6; cursor: default; }

/* ===== 커스텀 도장 (장비 탭) — 캐릭터 카드와 같은 톤 ===== */
.stamp-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto 14px;
}
.stamp-card {
  position: relative;
  width: 150px;
  background: rgba(255, 255, 255, 0.96);
  border: 3px solid #fffdf2;
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(20, 24, 80, 0.45), 0 10px 18px rgba(10, 12, 50, 0.3);
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.stamp-card.equipped {
  border-color: #ffd45c;
  box-shadow: 0 5px 0 #c8860a, 0 10px 20px rgba(200, 140, 10, 0.4);
}
.stamp-card .char-btn { white-space: nowrap; }
.stamp-round {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover;
  border: 3px solid #eef0fc; background: #f4f5fb; display: block;
}
.stamp-round.empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: #b9bfe0; font-weight: 700;
}
.stamp-slot-name { font-size: 0.78rem; font-weight: 800; color: var(--muted); display: flex; align-items: center; gap: 3px; max-width: 100%; }
/* 능력 연결 버튼 (도장 카드): 비어 있으면 ＋ 점선 원, 연결하면 캐릭터 얼굴 */
/* 이름표가 붙은 알약 칩 — 예전에는 맨 이모지 원이라 무엇을 누르는 자리인지 알 수 없었다 */
.stamp-abil-btn {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  height: 30px; max-width: 100%; padding: 0 9px;
  border: 2px dashed #c3c9ea; border-radius: 15px; background: #f4f5fb;
  font-size: 0.66rem; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap;
  color: #8a91b8; cursor: pointer; font-family: inherit;
  margin: 2px auto 0;
}
.stamp-abil-btn .sa-face { font-size: 0.95rem; line-height: 1; }
.stamp-abil-btn.set { border-style: solid; border-color: #ffd45c; background: #fff7dd; color: #8a6510; }
/* 빈 슬롯·잠금 카드에서 이 줄을 비워 두되 높이는 지킨다 — 세 카드의 버튼이 한 줄로 맞아야 한다 */
.stamp-abil-ph { height: 30px; margin: 2px auto 0; }
/* 능력 선택 모달 목록 */
.abil-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; max-height: 45vh; overflow-y: auto; }
.abil-opt {
  border: 2px solid #e3e6f8; background: #fff; border-radius: 12px; padding: 10px 6px;
  cursor: pointer; font-family: inherit; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.abil-opt.cur { border-color: #ffd45c; background: #fff7dd; }
.abil-opt .ao-face { font-size: 1.6rem; }
.abil-opt b { font-size: 0.85rem; color: #2b3566; }
.abil-opt small { font-size: 0.68rem; color: #5b6cff; font-weight: 700; line-height: 1.25; }
.stamp-slot-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-edit { border: none; background: none; cursor: pointer; font-size: 0.78rem; padding: 0 2px; }
.stamp-price {
  display: flex; align-items: center; justify-content: center;
  height: 30px; margin: 2px auto 0;
  font-size: 0.76rem; font-weight: 800; color: #b8860b;
}
/* 판매를 멈춘 동안 [구매하기] 자리에 들어가는 표시 */
.stamp-soon {
  font-size: 0.72rem;
  font-weight: 800;
  color: #8a90b4;
  background: #eef0fa;
  border: 1.5px dashed #c9cfef;
  border-radius: 10px;
  padding: 5px 10px;
  margin-top: 2px;
}
/* 미구매 슬롯: 비활성 상태를 눈에 보이게 — 흐리고 점선 테두리 */
.stamp-card.locked {
  opacity: 0.8;
  background: rgba(240, 241, 250, 0.92);
  border-style: dashed;
  border-color: #c9cfef;
  box-shadow: none;
}
.stamp-card.locked .stamp-round { filter: grayscale(1); opacity: 0.7; }
/* 3칸이 한 줄에 들어가게 — 좁은 화면에서는 줄어든다 */
.stamp-grid { flex-wrap: nowrap; }
.stamp-card { flex: 1 1 0; max-width: 150px; min-width: 0; }
.stamp-card .char-btn { white-space: nowrap; font-size: 0.74rem; padding: 6px 10px; }
/* 🗑 카드 모서리에 얹힌 네모라 테두리와 부딪혔다 — 동그란 아이콘 버튼으로 안쪽에 앉힌다 */
.stamp-del {
  position: absolute; top: 7px; right: 7px;
  width: 26px; height: 26px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; cursor: pointer;
  background: rgba(255, 227, 227, 0.95); color: #c62828; font-size: 0.78rem; line-height: 1;
  box-shadow: 0 1px 3px rgba(10, 12, 50, 0.18);
}
.stamp-del:active { transform: translateY(1px); }
/* 카드마다 글자 길이가 달라 버튼 폭이 제각각이었다 (장착중 ✓ / 📷 사진 등록 / 구매하기) */
.stamp-card .char-btn { width: 100%; }
.stamp-guide {
  max-width: 420px;
  margin: 0 auto 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 3px dashed #c9cfef;
  border-radius: 16px;
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.55;
}
.stamp-guide-icon { font-size: 2rem; margin-bottom: 6px; }

/* 장비 탭 전체: 가운데 정렬 + 구역 간 여백.
   width:100%가 없으면 세로 flex(#app)에서 margin:auto 때문에 내용 폭(510px)으로 수축해
   모바일에서 화면 밖으로 잘린다 */
#view-equip { max-width: 780px; margin: 0 auto; width: 100%; }
#view-equip .shop-sub-title { margin-top: 28px; }
#view-equip #stamp-area { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#view-equip .stamp-grid { width: 100%; } /* align-items:center에서 내용 폭으로 수축 방지 */
#view-equip .equip-shop-btn { display: block; margin: 8px auto 0; }

/* 모바일: 내 도장 3칸·캐릭터 도장 3열이 한 화면 폭에 들어가게 축소 */
@media (max-width: 480px) {
  .stamp-grid { gap: 8px; }
  .stamp-card { width: calc((100% - 16px) / 3); min-width: 0; padding: 10px 6px 10px; }
  .stamp-round { width: 68px; height: 68px; }
  .stamp-card .char-btn { padding: 6px 10px; font-size: 0.74rem; }
  .stamp-slot-name { font-size: 0.72rem; }
  .char-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .char-card { padding: 10px 5px 10px; }
  .char-btn { padding: 6px 10px; font-size: 0.74rem; white-space: nowrap; }
}

/* ===== 도장 사진 편집 모달: 원형 프리뷰 + 드래그 이동 + 크기 슬라이더 ===== */
.stamp-editor { max-width: 340px; text-align: center; }
.se-stage {
  position: relative;
  width: 280px; height: 280px;
  margin: 10px auto 6px;
  border-radius: 14px;
  overflow: hidden;
  background: #14163a;
  touch-action: none; /* 드래그 중 화면 스크롤 방지 */
}
.se-stage canvas { display: block; cursor: grab; }
.se-stage canvas:active { cursor: grabbing; }
.se-ring {
  position: absolute; inset: 0; pointer-events: none;
  /* 원 바깥을 어둡게 눌러 최종 도장 모양을 미리 보여준다 */
  background: radial-gradient(circle at center, transparent 0 118px, rgba(10, 12, 40, 0.62) 119px);
}
.se-ring::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 236px; height: 236px;
  transform: translate(-50%, -50%);
  border: 3px dashed rgba(255, 255, 255, 0.85);
  border-radius: 50%;
}
.se-hint { font-size: 0.78rem; color: var(--muted); font-weight: 700; margin: 4px 0 8px; }
.se-zoom { display: flex; align-items: center; gap: 8px; justify-content: center; margin-bottom: 10px; }
.se-zoom input { width: 200px; }

/* ===== 보너스 스테이지 상시 배지 (중앙 상단, 클릭 통과) ===== */

/* 보너스 결과 배너: 실패는 붉은 톤, 안내는 줄바꿈 유지 */
/* 연출 요소는 id 가 stagefx 다 — 예전에 .stagefx(클래스)로 적혀 있어 두 규칙 모두 먹지 않았고,
   그래서 보너스 설명의 줄바꿈이 무시돼 한 덩어리로 붙어 나왔다 */
#stagefx .stagefx-sub { white-space: pre-line; }
#stagefx.bonus-fail .stagefx-main { color: #ff8a7a; text-shadow: 0 3px 0 rgba(120, 20, 10, 0.5); }
/* 보너스 설명은 사진 위에 얹히므로 어두운 판을 깔아 읽기 쉽게 */
#stagefx.bonus-intro .stagefx-sub {
  max-width: min(92vw, 620px);
  margin-top: 10px;
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(12, 14, 40, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.22);
  line-height: 1.65;
}

/* ===== 무작위 매칭 성사 안내 =====
   보너스 스테이지와 같은 결로 크게 띄우되, 5초 카운트다운이 끝날 때까지 사라지면 안 된다.
   bonus-intro 는 4초에 사라지도록 고정돼 있어 마지막 1초가 빈 화면이 되므로 여기서 덮어쓴다. */
#stagefx.matched-hold .stagefx-main { animation: sfxOut 0.4s 4.6s ease-in forwards; }
#stagefx.matched-hold .stagefx-sub {
  animation: sfxRise 0.45s 0.3s both, sfxOut 0.4s 4.6s ease-in forwards;
  font-size: clamp(1.05rem, 4.8vw, 1.5rem);
}

/* 별 잡기 오클릭: 누른 자리에 -2초 표시 */
.star-miss-pop {
  position: fixed;
  transform: translate(-50%, -50%);
  z-index: 60;
  color: #ff6b57;
  font-weight: 900;
  font-size: 1.3rem;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  animation: starMissUp 0.9s ease-out forwards;
}
@keyframes starMissUp {
  from { opacity: 1; margin-top: 0; }
  to { opacity: 0; margin-top: -34px; }
}

/* 협동 대기실 명단: 장착 도장 (없으면 기본 ⭐ 도장) */
.lobby-stamp {
  flex: none;
  width: 24px; height: 24px; border-radius: 50%; object-fit: cover;
  border: 2px solid #eef0fc; background: #f4f5fb; display: inline-block; vertical-align: middle;
}
.lobby-stamp.default {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8rem; background: linear-gradient(135deg, #eef0fc, #dfe4ff);
}

/* ===== 도장 AI 검증 로딩 모달 ===== */
.stamp-verify { max-width: 300px; text-align: center; padding-bottom: 18px; }
.sv-spinner { font-size: 2.2rem; margin: 6px 0 4px; animation: svBob 1s ease-in-out infinite alternate; }
@keyframes svBob { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-6px) rotate(6deg); } }
.sv-text { font-weight: 700; font-size: 0.9rem; margin: 4px 0 12px; }
.sv-bar {
  width: 84%; height: 10px; margin: 0 auto 8px;
  background: #e8eaf6; border-radius: 999px; overflow: hidden;
}
.sv-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #6d9cff, #9b6bff);
  border-radius: 999px;
  transition: width 0.15s linear;
}
#sv-pct { font-size: 0.85rem; color: var(--primary-dark); }

/* 장비: 미보유 캐릭터 도장 — 해금 전 잠금 상태 (내 도장 잠금과 같은 톤) */
.char-card.locked {
  opacity: 0.8;
  background: rgba(240, 241, 250, 0.92);
  border-style: dashed;
  border-color: #c9cfef;
  box-shadow: none;
}
.char-card.locked .char-face { filter: grayscale(1); opacity: 0.75; }

/* ===== 꾸미기(협동 테두리) 상점 카드: 실제 이름표 모양 미리보기 ===== */
.border-card { gap: 8px; }
.bd-prev {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 150px;
  margin: 6px auto 8px;
  background: var(--card);
  border-radius: 10px;
  border-left: 5px solid var(--p1, #5b6cff);
  padding: 5px 8px;
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--p1, #5b6cff);
}
.bd-prev-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.bd-prev-n { flex: none; font-weight: 800; font-size: 0.85rem; }
.bd-prev-n i { font-style: normal; font-size: 0.65rem; font-weight: 600; margin-left: 1px; }
/* 잠금(업적 미달성) 카드도 미리보기는 원래 색으로 보여준다 */
.char-card.locked .bd-prev { filter: none; }

/* 구매·사용 시작 안내 (청약철회 제한 고지 — 이용약관 제7조의2) */
/* 계정 연동 동의 — 수집 항목·목적·보유 기간을 고지하는 상자 (개인정보 보호법 제15조·제22조) */
.consent-box {
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.85;
  text-align: left;
}
.consent-box b { color: var(--secondary, #ff8a3d); }

.buy-note {
  margin-top: 12px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--secondary, #ff8a3d);
  border-radius: 0 8px 8px 0;
  font-size: 0.76rem;
  line-height: 1.6;
  text-align: left;
  opacity: 0.9;
}

/* ===== 태블릿 세로 전용 확대 (600~1199px 폭 · 900px 이상 높이) =====
   아이패드에서 상단 계정바·재화 칩·랭킹·상점이 폰 크기 그대로라 화면에 비해 너무 작았다.
   폰(최대 460px 기준 축소 블록)과 PC(1200px 이상)에는 걸리지 않게 폭 구간을 좁게 잡고,
   가로로 눕힌 폰이 들어오지 않도록 min-height 900px 을 함께 건다.
   앞선 태블릿 블록(#app max-width:900px 등)을 덮어야 하므로 파일 맨 끝에 둔다. */
@media (min-width: 600px) and (max-width: 1199px) and (min-height: 900px) {
  /* --- 화면 폭을 더 쓰게 --- */
  html { font-size: 20px; }
  #app { max-width: 980px; }

  /* --- 상단 계정바 --- */
  #topbar { padding: 10px 14px 6px; gap: 10px; } /* 700px 대에서 칩이 한 줄에 들어가도록 여유를 줄인다 */
  .profile-chip { padding: 6px 18px 6px 6px; gap: 12px; border-radius: 999px; }
  .profile-avatar { width: 54px; height: 54px; font-size: 1.5rem; }
  /* max-width 는 위 태블릿 블록의 화면 폭 연동 상한을 그대로 쓴다 (여기서 풀면 칩이 커진다) */
  .profile-meta b { font-size: 1.15rem; width: auto; }
  .profile-meta small { font-size: 0.8rem; }

  /* --- 재화 칩(하트·골드·돋보기·시간추가) --- */
  .topbar-right { gap: 10px; }
  .chip { padding: 7px 7px 7px 15px; font-size: 1.1rem; gap: 8px; border-radius: 999px; }
  .chip-plus { width: 27px; height: 27px; font-size: 0.95rem; }
  .chip-col { gap: 10px; }

  /* --- 화면 머리(뒤로가기 + 제목): 기본값 560px 라 넓힌 목록과 어긋나 뒤로가기가
         화면 가운데쯤 떠 보인다. 아래 목록들과 같은 940px 로 맞춰 왼쪽 끝에 정렬시킨다. --- */
  .view-head { max-width: 940px; }
  .back-btn { width: 56px; height: 56px; }
  .view-head::after { width: 56px; }
  .section-title { font-size: 1.8rem; }

  /* --- 홈 로고: clamp 상한(4.2rem)에 걸려 큰 화면에서도 폰 크기 그대로였다 --- */
  .game-logo { gap: 16px; margin-bottom: 30px; }
  .bl { font-size: clamp(4.5rem, 11vw, 7rem); }
  .logo-sub { font-size: 1.5rem; padding: 9px 28px; }

  /* --- 앱 인트로: 커진 글자에 맞춰 돋보기·별 도장도 같은 비율로 키운다 --- */
  #app-intro .ai-mag { font-size: clamp(3.2rem, 7.5vw, 5rem); }
  #app-intro .ai-stamp { width: clamp(140px, 18vw, 200px); right: -11%; bottom: -28%; }

  /* --- 랭킹 --- */
  .tabs { gap: 12px; margin-bottom: 20px; }
  .tab { padding: 12px 34px; font-size: 1.1rem; }
  .rank-list { max-width: 940px; gap: 12px; }
  .rank-list li { padding: 18px 24px; gap: 16px; border-radius: 16px; }

  /* --- 장비: 자체 max-width 780px 이라 위 목록들과 폭이 어긋났다 --- */
  #view-equip { max-width: 940px; }
  /* 내 도장 3칸이 아래 캐릭터 4열에 비해 작아 보이므로 함께 키운다 */
  .stamp-grid { max-width: 780px; gap: 18px; }
  .stamp-card { width: 230px; max-width: 230px; padding: 20px 14px 16px; }
  .stamp-round { width: 120px; height: 120px; }
  .stamp-slot-name { font-size: 0.95rem; }

  /* --- 협동 플레이: 입장 버튼·초대코드 칸이 380px 로 묶여 있어 태블릿에서 유독 작았다 --- */
  .coop-options { max-width: 620px; gap: 18px; }
  .coop-options .btn-big { padding: 20px 32px; font-size: 1.35rem; border-radius: 22px; }
  .join-row { gap: 12px; }
  .join-row input { font-size: 1.25rem; padding: 18px 20px; border-radius: 16px; }
  .join-row .btn { padding: 18px 32px; font-size: 1.2rem; }
  .hint-text { font-size: 1.05rem; }
  .invite-box { max-width: 620px; padding: 28px; }
  .invite-code-label { font-size: 1.05rem; }
  .player-list { max-width: 620px; gap: 12px; }
  .player-list li { padding: 16px 22px; font-size: 1.1rem; }

  /* --- 우편함 등 모달 --- */
  .modal { max-width: 640px; padding: 28px; }
  .modal h3 { font-size: 1.55rem; margin-bottom: 16px; }
  #modal-body { font-size: 1.08rem; }

  /* --- 버튼을 한 단계 더: 큰 화면일수록 멀리서 누른다 --- */
  .btn { padding: 15px 30px; font-size: 1.05rem; }
  .btn-big { padding: 19px 36px; font-size: 1.2rem; }
  .settings-menu a { padding: 15px 18px; font-size: 1.05rem; }
  .settings-menu a span { width: 44px; height: 44px; font-size: 1.25rem; }
  .toast { font-size: 1rem; padding: 13px 26px; }

  /* --- 상점·캐릭터 카드 (아래 그리드 확대와 짝) --- */
  .shop-name { font-size: 1.15rem; }
  .shop-desc { font-size: 0.92rem; }
  .shop-item .btn { padding: 13px 24px; font-size: 1.05rem; }
  .char-face { font-size: 3rem; }
  .char-name { font-size: 1.05rem; }
  .char-perk { font-size: 0.84rem; }
  .char-btn { padding: 10px 20px; font-size: 0.96rem; }

  /* --- 퀘스트·업적 --- */
  #quest-body { max-width: 780px; gap: 14px; }
  .quest-tabs .tab { padding: 11px 26px; font-size: 1.05rem; }
  .quest-card { padding: 18px 22px; }
  .q-name { font-size: 1.12rem; }
  .q-name small { font-size: 0.88rem; }
  .q-claim { padding: 12px 26px; font-size: 1rem; }
  .quest-claim-all { padding: 17px 22px; font-size: 1.15rem; }
  .ach-ico { width: 38px; height: 38px; font-size: 1.35rem; }
  .ach-lv { font-size: 0.8rem; }

  /* --- 출석 달력: 달력이 화면을 다 먹지 않게 폭을 묶는다 — 한눈에 보이는 게 우선 --- */
  .att-cal { padding: 12px 12px 14px; }
  .att-cal-title { font-size: 1.25rem; }
  .att-nav { width: 44px; height: 44px; }
  .att-cal-week span { font-size: 0.88rem; }
  .att-num { font-size: 0.98rem; }
  .att-stamp { font-size: 1.9rem; }
  .att-streak b { font-size: 1.45rem; }
  .att-chip { min-width: 64px; }

  /* --- 우편함 --- */
  .mail-list { max-height: 50vh; }
  .mail-ico { font-size: 1.9rem; }
  .mail-info b { font-size: 1.06rem; }
  .mail-info small { font-size: 0.86rem; }

  /* --- 상점 · 캐릭터 --- */
  .shop-grid { max-width: 940px; grid-template-columns: repeat(auto-fit, minmax(265px, 1fr)); gap: 22px; }
  .char-grid { max-width: 940px; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 18px; }
  .shop-icon { width: 92px; height: 92px; font-size: 2.6rem; }

  /* --- 게임 화면: 위아래 여백을 줄여 사진을 조금이라도 더 키운다 ---
     사진은 정사각형(viewBox 960x960)이고 세로 화면에 두 장을 위아래로 놓으므로
     한 변은 '남는 높이의 절반'을 넘을 수 없다. 잘라내면(cover) 틀린 곳이 화면 밖으로
     나가 문제를 풀 수 없게 되므로, 크롭 대신 군더더기 높이만 걷어낸다. */
  body.in-game #app { padding: 2px 10px 6px; }
  body.in-game .game-top { gap: 12px; }
  body.in-game .game-top .hud-item { font-size: 1.15rem; padding: 9px 18px; }
  body.in-game .game-top .back-btn { width: 46px; height: 46px; }
  #lives-bar span { font-size: 2.2rem; }
}

/* 600~699px(작은 태블릿·큰 폰 가로): 위 블록들의 글자 확대를 그대로 두면
   상단바의 프로필 칩 + 재화 칩이 화면 폭을 넘어 가로 스크롤이 생긴다.
   이 폭에서는 상단바만 폰 크기로 되돌린다 (본문 글자는 커진 채로 둔다). */
@media (min-width: 600px) and (max-width: 699px) {
  #topbar { padding: 8px 12px 5px; gap: 8px; }
  .profile-avatar { width: 44px; height: 44px; font-size: 1.2rem; }
  .profile-meta b { font-size: 0.92rem; width: 7.6em; max-width: 7.6em; }
  .profile-meta small { font-size: 0.64rem; }
  .chip { padding: 5px 5px 5px 11px; font-size: 0.9rem; gap: 6px; }
  .chip-plus { width: 23px; height: 23px; font-size: 0.85rem; }
}

/* 공지사항 팝업 본문 — 관리자가 쓴 줄바꿈 그대로, 길면 스크롤 */
.notice-body {
  text-align: left;
  max-height: 48vh;
  overflow-y: auto;
  white-space: normal;
  word-break: break-word;
}

/* ===== 앱 인트로 (앱 전용) — 네이티브 스플래시에서 이어지는 로고 애니메이션 ===== */
/* 네이티브 스플래시(단색 #262a63)가 걷히면 같은 색 밤하늘 위에서 로고가 튀어나온다.
   config.js 가 IS_APP 일 때만 hidden 을 풀고, 스플래시 hide 시점에 .go 로 재생을 시작한다. */
#app-intro {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #262a63;
}
#app-intro[hidden] { display: none; }
#app-intro .home-bg { position: absolute; display: block; }
#app-intro .game-logo { position: relative; z-index: 1; margin: 0 0 6vh; }
#app-intro .logo-bubble { position: relative; }
/* 시작 신호(.go) 전에는 로고를 숨긴 채 대기 — 스플래시가 걷히는 순간부터 애니메이션 */
#app-intro:not(.go) .bl,
#app-intro:not(.go) .logo-sub,
#app-intro:not(.go) .ai-mag,
#app-intro:not(.go) .ai-stamp { animation: none; opacity: 0; }
/* 돋보기: 글자가 다 튀어나온 뒤 위를 한 번 훑고 지나간다 */
#app-intro .ai-mag {
  position: absolute;
  left: -14%;
  top: -0.62em;
  font-size: clamp(2.1rem, 10.5vw, 3rem);
  line-height: 1;
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(10, 12, 50, 0.45));
}
#app-intro.go .ai-mag { animation: aiMagSweep 1.3s 0.75s cubic-bezier(0.45, 0.05, 0.55, 0.95) both; }
@keyframes aiMagSweep {
  0%   { opacity: 0; transform: translate(-0.4em, 0.25em) rotate(-18deg); }
  14%  { opacity: 1; }
  50%  { transform: translate(2.3em, -0.3em) rotate(9deg); }
  86%  { opacity: 1; }
  100% { opacity: 0; transform: translate(4.8em, 0.2em) rotate(-8deg); }
}
/* 별 도장: 돋보기가 지나간 자리에 쾅 찍힌다 — 크게 나타나 내리꽂히고 살짝 튄다 */
#app-intro .ai-stamp {
  position: absolute;
  right: -9%;
  bottom: -24%;
  width: clamp(86px, 24vw, 122px);
  height: auto;
  z-index: 3;
  opacity: 0;
  transform: rotate(-14deg);
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(10, 12, 50, 0.5));
}
#app-intro.go .ai-stamp { animation: aiStampSlam 0.5s 2.1s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes aiStampSlam {
  0%   { opacity: 0; transform: rotate(-2deg) scale(2.9); }
  45%  { opacity: 1; transform: rotate(-14deg) scale(0.88); }
  70%  { transform: rotate(-14deg) scale(1.08); }
  100% { opacity: 1; transform: rotate(-14deg) scale(1); }
}
/* 찍히는 충격에 로고 전체가 살짝 들썩 */
#app-intro.go .game-logo { animation: aiStampShake 0.4s 2.28s ease-out; }
@keyframes aiStampShake {
  0%   { transform: translate(0, 0); }
  30%  { transform: translate(2px, 6px) rotate(0.6deg); }
  60%  { transform: translate(-2px, -2px); }
  100% { transform: translate(0, 0); }
}

/* 퇴장: 살짝 커지며 페이드 — 홈 화면이 아래에서 드러난다 */
#app-intro.out {
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

/* ===== 회원탈퇴 모달 (잃는 것 명세 + 타이핑 확인 + 유예 안내) ===== */
.del-notice { line-height: 1.8; word-break: keep-all; text-align: center; }
.del-notice p { margin: 10px 0; }
.del-assets {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px;
  margin: 12px 0; padding: 10px 12px;
  background: rgba(120, 120, 160, 0.08); border-radius: 12px;
}
.del-row { white-space: nowrap; font-size: 0.95rem; }
.del-paid {
  color: #c0392b; font-weight: 600;
  background: rgba(220, 80, 60, 0.08); border-radius: 10px; padding: 8px 10px;
}
.del-grace { opacity: 0.85; font-size: 0.95rem; }
.del-input {
  display: block; width: 70%; margin: 12px auto 2px; padding: 10px 12px;
  border: 1.5px solid #c6c6de; border-radius: 10px;
  font-size: 1.05rem; text-align: center;
}
.del-input:focus { outline: none; border-color: #6c63ff; }
#modal-actions .btn-danger:disabled { opacity: 0.4; cursor: default; }

/* ===== 🔧 서버 점검 오버레이 (배포 재시작 감지) ===== */
#maint-overlay {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #262a63 0%, #3d448f 55%, #5b6cff 100%);
  color: #fff; text-align: center; padding: 24px;
  animation: maintIn 0.4s ease-out;
}
@keyframes maintIn { from { opacity: 0; } to { opacity: 1; } }
.maint-card { max-width: 320px; word-break: keep-all; line-height: 1.7; }
.maint-icon { font-size: 3rem; animation: iconBob 2.2s ease-in-out infinite; }
.maint-card h2 { margin: 14px 0 8px; font-size: 1.3rem; }
.maint-card p { opacity: 0.85; font-size: 0.95rem; }
.maint-dots { margin-top: 18px; }
.maint-dots span {
  display: inline-block; width: 8px; height: 8px; margin: 0 4px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.85);
  animation: maintDot 1.2s ease-in-out infinite;
}
.maint-dots span:nth-child(2) { animation-delay: 0.2s; }
.maint-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes maintDot { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.1); } }

/* ============================================================
   🎮 공용 대화상자 — 웹 모달이 아니라 게임 판때기로 (대표 지시 2026-08-27)
   구조를 [황금 레일 → 제목 밴드 → 본문 → 버튼 바] 3단으로 나눈다.
   본문 배경은 흰색 그대로 둔다 — 40군데 호출부의 본문 HTML(약관·동의문·
   결과표 등)이 어두운 글씨를 전제하고 있어 판을 뒤집으면 다 안 보인다.
   ============================================================ */
#modal .modal {
  padding: 0;                 /* 밴드를 판 끝까지 붙이려면 판 자체 여백은 0 */
  overflow: hidden;           /* 둥근 모서리 밖으로 밴드가 새지 않게 */
  /* 밴드와 버튼 바는 고정, 본문만 스크롤 — 판을 뚫고 나가는 긴 안내문(약관 등)이
     잘리지 않게 한다. 예전 .modal 은 판 전체가 스크롤이었다 */
  display: flex;
  flex-direction: column;
  border: 4px solid #fffdf2;
  border-radius: 26px;
  box-shadow: 0 8px 0 rgba(20, 24, 80, 0.5), 0 20px 44px rgba(10, 12, 50, 0.45);
}
/* 제목 밴드 — 판 위쪽을 가로지르는 간판. 위쪽 황금 레일은 밴드의 테두리로 얹는다 */
#modal #modal-title {
  margin: 0;
  padding: 15px 46px 16px;
  background: linear-gradient(180deg, #6a63e0 0%, #5a52cf 55%, #4d45bb 100%);
  border-top: 5px solid #ffc247;
  border-bottom: 3px solid rgba(20, 24, 80, 0.35);
  box-shadow: inset 0 -6px 12px rgba(20, 24, 80, 0.25);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.35;
  word-break: keep-all;
  /* 게임 간판 글씨 — 흰 획 + 아래로 떨어지는 그림자 */
  text-shadow:
    0 2px 0 rgba(20, 24, 80, 0.55),
    0 4px 10px rgba(10, 12, 50, 0.45);
}
/* 제목이 비는 대화상자(본문만 있는 안내)는 밴드를 통째로 감춘다 */
#modal #modal-title:empty { display: none; }
#modal #modal-title { flex: none; }
#modal #modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px 20px;
  margin-bottom: 0;
  min-height: 76px;           /* 한 줄짜리 안내도 판처럼 보이게 최소 높이 */
  /* safe center — 짧은 본문은 가운데, 넘치면 위부터. 그냥 center 면 넘칠 때 윗줄이 잘린다 */
  display: grid;
  align-content: safe center;
}
/* 버튼 바 — 본문과 선으로 나뉜 바닥 칸 */
#modal #modal-actions:not(:empty) {
  flex: none;
  padding: 14px 18px 18px;
  border-top: 2px solid rgba(120, 128, 200, 0.22);
  background: linear-gradient(180deg, #f7f8ff 0%, #eef0fc 100%);
}
/* 버튼 — 눌리는 두께가 있는 게임 버튼 */
#modal #modal-actions .btn {
  min-width: 118px;
  padding: 13px 22px;
  font-size: 1.02rem;
  font-weight: 900;
  border-radius: 14px;
  border: 2px solid rgba(255, 253, 242, 0.9);
  box-shadow: 0 4px 0 rgba(20, 24, 80, 0.35), 0 8px 14px rgba(10, 12, 50, 0.18);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
#modal #modal-actions .btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 0 0 rgba(20, 24, 80, 0.35);
}
#modal #modal-actions .btn-ghost {
  background: #fff;
  color: #5a6090;
  border-color: #dfe4fb;
  box-shadow: 0 4px 0 rgba(120, 128, 200, 0.3);
}
#modal #modal-actions .btn-primary {
  background: linear-gradient(180deg, #6f7dff 0%, #5b6cff 60%, #4353e8 100%);
}
#modal #modal-actions .btn-secondary {
  background: linear-gradient(180deg, #ffa055 0%, #ff8a3d 60%, #ef7522 100%);
}

/* 밤하늘 변종(variant:'game'/'mail') — 밴드만 한 톤 밝게, 바닥 칸은 어둡게 */
#modal .modal.modal-game #modal-title {
  background: linear-gradient(180deg, #3f4694 0%, #363c85 55%, #2e3374 100%);
}
#modal .modal.modal-game #modal-actions:not(:empty) {
  background: rgba(10, 12, 50, 0.28);
  border-top-color: rgba(255, 255, 255, 0.16);
}
#modal .modal.modal-game #modal-actions .btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #e6e9ff;
  border-color: rgba(255, 255, 255, 0.28);
}
/* 우편함 [?] 버튼 — 이제 밴드 안에 앉는다 */
#modal .modal.modal-mail .mail-help {
  top: 20px; right: 16px;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
#modal .modal.modal-mail .mail-help:hover { background: rgba(255, 255, 255, 0.28); }

@media (min-width: 600px) {
  #modal #modal-title { font-size: 1.55rem; padding: 17px 48px 18px; }
  #modal #modal-body { padding: 24px 24px; }
}
/* 제목이 없는 대화상자는 밴드가 빠지므로 황금 레일을 판에 직접 얹는다
   (:has 미지원 구형 웹뷰는 레일만 없고 나머지는 그대로 — 깨지지 않는다) */
#modal .modal:has(#modal-title:empty) { border-top-color: #ffc247; }

/* 같은 판때기 문법을 나머지 대화상자에도 — 이쪽은 본문 요소가 여럿이라
   판 여백은 그대로 두고 밴드·버튼 바만 음수 여백으로 판 끝까지 뽑는다 */
#challenge-reward .modal,
#stamp-editor .modal {
  padding: 0 20px;
  overflow: hidden;
  border: 4px solid #fffdf2;
  border-radius: 26px;
  box-shadow: 0 8px 0 rgba(20, 24, 80, 0.5), 0 20px 44px rgba(10, 12, 50, 0.45);
}
#challenge-reward .modal > h3,
#stamp-editor .modal > h3 {
  margin: 0 -20px 16px;
  padding: 15px 20px 16px;
  background: linear-gradient(180deg, #6a63e0 0%, #5a52cf 55%, #4d45bb 100%);
  border-top: 5px solid #ffc247;
  border-bottom: 3px solid rgba(20, 24, 80, 0.35);
  box-shadow: inset 0 -6px 12px rgba(20, 24, 80, 0.25);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1.35;
  word-break: keep-all;
  text-shadow: 0 2px 0 rgba(20, 24, 80, 0.55), 0 4px 10px rgba(10, 12, 50, 0.45);
}
#challenge-reward .modal > .modal-actions,
#stamp-editor .modal > .modal-actions {
  margin: 16px -20px 0;
  padding: 14px 18px 18px;
  border-top: 2px solid rgba(120, 128, 200, 0.22);
  background: linear-gradient(180deg, #f7f8ff 0%, #eef0fc 100%);
}
#challenge-reward .modal > .modal-actions .btn,
#stamp-editor .modal > .modal-actions .btn {
  min-width: 118px;
  padding: 13px 22px;
  font-size: 1.02rem;
  font-weight: 900;
  border-radius: 14px;
  border: 2px solid rgba(255, 253, 242, 0.9);
  box-shadow: 0 4px 0 rgba(20, 24, 80, 0.35), 0 8px 14px rgba(10, 12, 50, 0.18);
}
#challenge-reward .modal > .modal-actions .btn:active:not(:disabled),
#stamp-editor .modal > .modal-actions .btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 0 0 rgba(20, 24, 80, 0.35);
}
#challenge-reward .modal > .modal-actions .btn-ghost,
#stamp-editor .modal > .modal-actions .btn-ghost {
  background: #fff; color: #5a6090; border-color: #dfe4fb;
  box-shadow: 0 4px 0 rgba(120, 128, 200, 0.3);
}
#challenge-reward .modal > .modal-actions .btn-primary,
#stamp-editor .modal > .modal-actions .btn-primary {
  background: linear-gradient(180deg, #6f7dff 0%, #5b6cff 60%, #4353e8 100%);
}

/* ============================================================
   💪 스탯 강화 — 앱에서도 스크롤 없이 한 화면에 (대표 지시 2026-08-27, 실기기 확인)
   웹(390×844)에서는 5장이 맞았지만 **앱에는 하단 광고 배너 자리가 있어** 그만큼 모자랐다.
   실측(갤럭시 S9+ / 411×773): 필요 745px · 가능 664px → 81px 부족.
   여백·행간만 조여 채운다. 글자 크기와 버튼 크기는 손대지 않는다 — 누르는 물건이라
   작아지면 오탭이 는다.
   ============================================================ */
/* 안내 문구 — 두 줄은 그대로 두고 알약 여백만 줄인다 */
#view-stats > .shop-sub-desc {
  margin: -6px auto 6px;
  padding: 4px 14px;
  font-size: 0.78rem;
  line-height: 1.45;
}
.stats-list { gap: 6px; padding-bottom: 6px; }
.stat-card { padding: 7px 14px 8px; }
.stat-head { gap: 6px; }
.stat-bar-row { margin: 4px 0 4px; }
.stat-buy { gap: 6px; }
.stat-buy .btn { padding: 6px 8px; }
.stat-maxed { padding: 3px 0; }

/* 큰 화면에서 키우려다 되돌렸다 — 데스크톱(1280x900)도 아이콘 줄과 배너 사이가 좁아
   104px 로 키우면 메뉴를 22px 침범했다. 한 크기로 통일하는 편이 안전하다. */
