/* ==========================================================================
   fruitrabbit stress pop - Premium CSS Styling File (Final Precision 3D Alignment)
   ========================================================================== */

/* 기본 리셋 및 글로벌 변수 정의 */
:root {
  --primary-glow: #00f0ff;
  --secondary-glow: #ff007c;
  --accent-gold: #ffd700;
  --bg-dark: #0f0a1c;
  --glass-bg: rgba(18, 10, 36, 0.68);
  --glass-border: rgba(255, 255, 255, 0.15);
  --text-light: #f5f3ff;
  --text-dim: #a78bfa;
  --font-game: 'Outfit', 'Noto Sans KR', -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  height: 100%;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  font-family: var(--font-game);
  background-color: var(--bg-dark);
  color: var(--text-light);
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
}

/* PC 환경용 뒷배경 흐림/그라데이션 데코레이션 */
.pc-background-decor {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 30%, #581c87 0%, transparent 50%),
              radial-gradient(circle at 80% 70%, #0369a1 0%, transparent 50%),
              radial-gradient(circle at 50% 50%, #1e1b4b 0%, #090514 100%);
  filter: blur(5px);
  z-index: 1;
}

/* 모바일 기기 최적화 뷰포트 프레임 (PC 및 모바일 모두 고정 해상도를 유지하며 동적 scale 스냅 적용) */
.device-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 450px;
  height: 880px;
  background-color: #000;
  overflow: hidden;
  z-index: 2;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.8),
              0 0 0 8px rgba(255, 255, 255, 0.08);
  border-radius: 40px;
  display: flex;
  flex-direction: column;
  /* [디바이스 프레임 기본 커서 복구]: 프레임 자체는 포인터 기본 형태 유지 */
  cursor: default;
}

/* 게임 보드 플레이 영역 내에서만 마우스 화살표를 완벽 은폐 (커스텀 뿅망치 커서 적용 활성화) */
.game-board,
.game-board * {
  cursor: none !important;
}

/* 모바일 꽉 채우기용 미디어 쿼리 - 고정 450x880 논리 해상도를 JS 배율 트랜스폼으로 대응하므로 외형 크래시 방지 */
@media (max-width: 480px), (max-height: 500px) {
  body {
    background-color: #000;
  }
}

/* 게임 플레이 화면 영역 */
.game-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: #0f0a1c;
  overflow: hidden;
}

/* 1. 상단 헤더: Glassmorphism 스탯 보드 */
.game-header {
  position: absolute;
  top: calc(15px + env(safe-area-inset-top, 0px));
  left: 15px;
  right: 15px;
  height: 65px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  z-index: 10;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* 상단 헤더 액션 버튼 스타일 (투명 원본 이미지 출력) */
.header-action-btn {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
  margin: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.header-action-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-action-btn:active {
  transform: scale(0.9);
  opacity: 0.8;
}

.header-left, .header-right {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

#score-display {
  color: var(--primary-glow);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* 로고 텍스트 디자인 */
.game-title {
  text-align: center;
  font-family: var(--font-game);
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.title-stress {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
}

.title-pop {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(45deg, var(--primary-glow), var(--secondary-glow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(255, 0, 124, 0.3);
}

/* 최고 점수 배지 및 스테이지 진행도 게이지 */
.game-info-overlay {
  position: absolute;
  top: 90px;
  left: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

.best-score-badge {
  align-self: flex-end;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: var(--accent-gold);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.stage-progress-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stage-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-glow), #a855f7);
  border-radius: 10px;
  box-shadow: 0 0 8px var(--primary-glow);
  transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 2. 메인 게임 보드 */
.game-board {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
  background-color: #0f0a1c;
}

/* 1. 맨 뒷배경 레이어 */
.board-background-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('assets/layer_bg.png?v=12.0.0');
  background-size: 108% 100%;
  background-position: center center; 
  background-repeat: no-repeat;
  z-index: 1;
  pointer-events: none;
}

/* 윗줄 바위 전경 레이어 */
.board-foreground-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('assets/layer_top.png?v=12.0.0');
  background-size: 108% 100%;
  background-position: center center; 
  background-repeat: no-repeat;
  z-index: 3;
  pointer-events: none;
}

/* 중간줄 바위 전경 레이어 */
.board-foreground-mid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('assets/layer_mid.png?v=12.0.0');
  background-size: 108% 100%;
  background-position: center center; 
  background-repeat: no-repeat;
  z-index: 5;
  pointer-events: none;
}

/* 아랫줄 바위 전경 레이어 */
.board-foreground-bot {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('assets/layer_bot.png?v=12.0.0');
  background-size: 108% 100%;
  background-position: center center; 
  background-repeat: no-repeat;
  z-index: 7;
  pointer-events: none;
}

/* 타격 파티클 렌더링 캔버스 (항상 최상단) */
.particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8; 
}

/* 3. 6개 포털 구멍 래퍼 (3D 원근 정밀 좌표 및 크기 매칭) */
.portal-hole {
  position: absolute;
  z-index: 3;
  cursor: none; 
}

/* [피드백 적용]: 대충 때려도 100% 타격이 잘 감지되도록 히트박스 영역을 보이지 않게 사방으로 35px씩 넉넉하게 확장 */
.portal-hole::after {
  content: '';
  position: absolute;
  top: -35px;
  left: -35px;
  right: -35px;
  bottom: -35px;
  cursor: none;
  z-index: 10;
}

/* 윗줄 2개 (Row 1) */
#hole-0 {
  top: 24.30%;
  left: 29.10%;
  width: 84px;
  height: 56px;
  transform: translate(-50%, -50%);
  z-index: 2;
}
#hole-1 {
  top: 24.30%;
  left: 70.30%;
  width: 84px;
  height: 56px;
  transform: translate(-50%, -50%);
  z-index: 2;
}

/* 중간줄 2개 (Row 2) */
#hole-2 {
  top: 39.60%;
  left: 27.71%;
  width: 94px;
  height: 62px;
  transform: translate(-50%, -50%);
  z-index: 4;
}
#hole-3 {
  top: 39.60%;
  left: 72.49%;
  width: 94px;
  height: 62px;
  transform: translate(-50%, -50%);
  z-index: 4;
}

/* 아랫줄 2개 (Row 3) */
#hole-4 {
  top: 56.50%;
  left: 25.62%;
  width: 100px;
  height: 66px;
  transform: translate(-50%, -50%);
  z-index: 6;
}
#hole-5 {
  top: 56.50%;
  left: 74.48%;
  width: 100px;
  height: 66px;
  transform: translate(-50%, -50%);
  z-index: 6;
}

/* [피드백 반영]: 구멍별 3D 원근에 맞게 캐릭터 바닥면을 하단 림(빨간 아치)에 100% 피팅 */
#hole-0 .character-container,
#hole-1 .character-container {
  bottom: -11px;
}
#hole-2 .character-container,
#hole-3 .character-container {
  bottom: -11px;
}
#hole-4 .character-container,
#hole-5 .character-container {
  bottom: -13px;
}

/* 포털 안쪽 은하 소용돌이 빛무라 연출 */
.portal-portal-visual {
  position: absolute;
  top: 25%;
  left: 10%;
  width: 80%;
  height: 55%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.4) 0%, rgba(2, 132, 199, 0.1) 60%, transparent 100%);
  filter: blur(3px);
  z-index: 1;
  pointer-events: none;
  opacity: 0.7;
}

/* 7. [UPGRADE]: 개별 포털 전용 초정밀 3D 타원 클리핑 마스크 돔 */
/* [피드백 적용]: 구멍의 입체 각도에 맞춰 3차원 클리핑 반경을 더욱 좁고 타이트하게 깎아서 정의! */
/* 캐릭터 머리가 절대로 구멍 바깥의 보랏빛 돌 링 테두리를 침범하거나 덮치지 않고 안쪽에서만 움직이도록 봉쇄! */
.character-container {
  position: absolute;
  bottom: 0px; 
  left: -10%; /* [UPGRADE]: 120% 너비 확장으로 양옆 10% 오프셋 배치 */
  width: 120%; /* [UPGRADE]: 동물 캐릭터 크기 최대 확장을 위해 너비 120%로 확대 */
  /* [귀 차단 해소]: 높이를 200%로 설정하여 복잡한 세로 축척을 완전히 정리하고 귀가 잘리는 현상도 제거 */
  height: 200%; 
  overflow: visible; /* [피드백 반영]: 귀 윗부분 및 턱 아래가 가로선으로 싹둑 잘리는 overflow 범인을 완전히 제거(visible)하여 100% 풍성하고 온전한 얼굴 확보! */
  z-index: 2;
  pointer-events: none;
}

/* 개별 포털 전용 3D 개방형 폴리곤 클리핑 마스크 */
/* [피드백 반영]: 실제 3D 전경 레이어가 동물의 몸통 아랫부분을 완벽히 자연스럽게 가려주므로 가상 클리핑 마스크 제거! */
.portal-hole .character-container {
  clip-path: none;
}

/* 구멍 위에 덮여서 캐릭터의 아랫부분을 자연스럽게 덮어 가려주는 구멍 앞쪽 테두리 레이어 */
.portal-rim-overlay {
  display: none;
}

/* 8. 캐릭터 이미지 클래스 */
.game-character {
  position: absolute;
  /* [피드백 반영]: 구멍의 라운드선(하단 테두리)과 정밀 매칭을 위해 bottom 0px 배치 및 크기를 100%로 키워 구멍에 꽉 차게 조율 */
  bottom: 0px; 
  left: 50%;
  transform: translate(-50%, 100%); 
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom center;
  transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.22); 
  pointer-events: auto; 
}

/* 캐릭터가 솟아올랐을 때 적용될 클래스 */
.game-character.popup {
  /* [피드백 반영]: 얼굴의 90%만 올라오도록 제한하여 자연스럽게 하단 10%는 돌과 림 뒤에 가려지게 설정! */
  transform: translate(-50%, 10%); 
}

/* 9. 하단 도구 전환(뿅망치/손) 바 (Glassmorphism) */
.tool-switch-bar {
  position: absolute;
  bottom: 75px;
  left: 20px;
  right: 20px;
  height: 68px;
  background: rgba(18, 10, 36, 0.75);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  display: flex;
  gap: 12px;
  padding: 7px 12px;
  z-index: 10;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.tool-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-family: var(--font-game);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-btn.active {
  background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4),
              inset 0 2px 2px rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.tool-btn:active {
  transform: translateY(1px);
}

.tool-btn-icon-wrapper {
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.tool-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* 10. 최하단 푸터 버튼군 */
.game-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: rgba(10, 5, 20, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
  z-index: 10;
}

.footer-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-game);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 12px;
  transition: all 0.2s;
  border-radius: 12px;
  touch-action: manipulation;
}

.footer-btn:hover, .footer-btn:active {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* 신비로운 영롱한 크리스탈 3D 보석 아이콘 스타일링 */
.crystal-icon {
  width: 25px;
  height: 25px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.footer-btn:hover .crystal-icon {
  transform: scale(1.18) rotate(5deg);
  filter: drop-shadow(0 4px 10px rgba(168, 85, 247, 0.4));
}

.footer-btn:active .crystal-icon {
  transform: scale(0.9) rotate(-3deg);
}

/* 카메라 3D 하이라이트 버튼 보석네온 펄스 효과 */
.btn-primary-highlight {
  color: var(--primary-glow) !important;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 16px;
  padding: 6px 16px;
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.15);
  animation: crystalPulse 2.5s infinite ease-in-out;
}

@keyframes crystalPulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(0, 240, 255, 0.15); border-color: rgba(0, 240, 255, 0.25); }
  50% { box-shadow: 0 8px 25px rgba(0, 240, 255, 0.4), 0 0 10px rgba(244, 63, 94, 0.2); border-color: rgba(0, 240, 255, 0.5); }
}

.btn-primary-highlight:active {
  transform: translateY(-2px);
  animation: none;
}

/* 11. 커스텀 마우스 커서 스타일 */
.custom-cursor {
  position: absolute;
  pointer-events: none !important; 
  z-index: 9999;
  /* [피드백 반영]: 타격 임팩트 시 시각적 만족도를 위해 뿅망치 크기를 초거대화 (110px -> 145px 대왕 장난감화!) */
  width: 145px;
  height: 145px;
  display: none;
  transition: transform 0.05s ease-out;
}
.custom-cursor * {
  pointer-events: none !important; 
}

.custom-cursor img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.08s ease-out;
  pointer-events: none !important;
}

/* 뿅망치 타격 격렬한 모션 (순간이동 제거, 컨테이너 translate 고정 유지) */
.custom-cursor.tool-hammer.whack {
  /* 망치의 origin 자체를 변경하지 않음. 타격 모션은 이미지 프레임 변경으로만 수행됨 */
}
.custom-cursor.tool-hammer.whack img {
  /* CSS keyframes는 삭제됨, JS가 이미지를 제어함 */
}


/* 뿅망치 타격 격렬한 모션: 임팩트 순간 찰진 스케일 바운스 3D 텐션 추가 */
.custom-cursor.tool-hammer.whack img {
  animation: hammerSquishAnimation 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes hammerSquishAnimation {
  0% {
    transform: scale(1) translateY(0);
  }
  15% {
    /* 치켜올릴 때 약간 얇고 길게 치솟음 */
    transform: scale(0.92, 1.08) translateY(-6px);
  }
  30% {
    /* 내리쳐 닿는 순간 납작하고 넓게 찌그러지며 왼쪽으로 슬쩍 휠 */
    transform: scale(1.15, 0.85) translateY(12px) rotate(-6deg);
  }
  75% {
    /* 튕겨오르는 텐션 복귀 */
    transform: scale(0.97, 1.03) translateY(4px);
  }
  100% {
    transform: scale(1) translateY(0) rotate(0deg);
  }
}


/* 11.5 타격 말풍선 효과 */
.speech-bubble {
  position: absolute;
  pointer-events: none;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border: none;
  border-radius: 18px;
  padding: 8px 18px;
  color: #1e1b4b;
  font-family: 'Black Han Sans', 'Jua', 'Do Hyeon', sans-serif;
  font-size: 26px;
  font-weight: bold;
  transform: translate(-50%, -50%) scale(0);
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25), 
              inset 0 -3px 0 rgba(0, 0, 0, 0.08), 
              inset 0 2px 0 rgba(255, 255, 255, 0.9);
  animation: speechBubbleAnim 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px 8px 0;
  border-style: solid;
  border-color: #f1f5f9 transparent transparent transparent;
}

.speech-bubble::before {
  display: none;
}

@keyframes speechBubbleAnim {
  0% {
    transform: translate(-50%, -50%) scale(0) translateY(0);
    opacity: 1;
  }
  20% {
    transform: translate(-50%, -50%) scale(1.2) translateY(-10px);
    opacity: 1;
  }
  40% {
    transform: translate(-50%, -50%) scale(1) translateY(-15px);
    opacity: 1;
  }
  80% {
    transform: translate(-50%, -50%) scale(1) translateY(-30px);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.8) translateY(-40px);
    opacity: 0;
  }
}


/* 12. 모달 팝업 및 공통 오버레이 스타일 */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 4, 15, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.glass-modal {
  background: rgba(22, 14, 43, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 30px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6),
              0 0 30px rgba(124, 58, 237, 0.1);
  transform: scale(0.85);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.modal-overlay.open .glass-modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}

.modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 15px 24px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* 카메라 모달의 2버튼 그리드 레이아웃 리팩토링 (가로폭 좁은 기기 최적화) */
.camera-modal .modal-footer {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
}

/* 모달 무광 버튼 공통 */
.modal-btn {
  flex: 1;
  padding: 14px 20px;
  border-radius: 16px;
  font-family: var(--font-game);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, #00f0ff 0%, #0284c7 100%);
  color: #0c0824;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3),
              inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.btn-primary:active {
  transform: translateY(1.5px);
  box-shadow: 0 2px 5px rgba(0, 240, 255, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light);
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(1.5px);
}

/* 13. 카메라 화면 & 3D 네온 가이드라인 */
.camera-stream-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: #000;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.08);
}

#camera-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.face-guide-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.face-guide-svg {
  width: 90%;
  height: 90%;
}

.guide-ellipse {
  fill: none;
  stroke: var(--primary-glow);
  stroke-width: 2.5;
  stroke-dasharray: 8 6;
  filter: drop-shadow(0 0 5px var(--primary-glow));
  animation: guidePulse 1.8s infinite ease-in-out;
}

.guide-axis {
  fill: none;
  stroke: rgba(0, 240, 255, 0.25);
  stroke-width: 1;
}

.guide-label {
  position: absolute;
  bottom: 12px;
  background: rgba(15, 10, 28, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  color: var(--primary-glow);
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}

@keyframes guidePulse {
  0%, 100% { stroke: var(--primary-glow); filter: drop-shadow(0 0 4px var(--primary-glow)); opacity: 0.85; }
  50% { stroke: #c084fc; filter: drop-shadow(0 0 10px #c084fc); opacity: 1; }
}

/* 14. 설정 아이템 리스트 */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.setting-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
}

.setting-desc {
  font-size: 10.5px;
  color: var(--text-dim);
}

.text-link-item {
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-dim) !important;
}

.text-link-item:active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.02);
}

.chevron-right {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* 토글 스위치 디자인 */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

input:checked + .slider {
  background: linear-gradient(135deg, #00f0ff 0%, #0284c7 100%);
  border-color: rgba(0, 240, 255, 0.2);
}

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: #0c0824;
}

/* 개인정보 방침 텍스트 창 */
.text-scroll {
  max-height: 260px;
  overflow-y: auto;
  padding-right: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: #cbd5e1;
}

.text-scroll h3 {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  margin-top: 15px;
  margin-bottom: 5px;
}

.text-scroll p {
  margin-bottom: 10px;
}

.text-scroll::-webkit-scrollbar {
  width: 4px;
}
.text-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
.text-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

/* 15. 게임 시작 및 Ready/Go 오버레이 */
.game-start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #1b0e35 0%, #080312 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px;
  z-index: 90;
  transition: opacity 0.4s ease-out;
}

.splash-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 320px;
}

.splash-logo-img-wrapper {
  width: 100%;
  max-width: 290px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
  animation: logoFloat 3s infinite ease-in-out;
}

.splash-logo-img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

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

.splash-desc {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
  margin-bottom: 30px;
}

/* 시작 버튼 */
.start-game-btn {
  padding: 16px 40px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: #fff;
  font-family: var(--font-game);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.45),
              inset 0 2px 2px rgba(255, 255, 255, 0.25);
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.start-game-btn:active {
  transform: translateY(2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

/* Ready / Go 카운트 오버레이 */
.ready-go-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 4, 18, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 85;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.ready-go-text {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 0, 124, 0.8);
  transform: scale(0.6);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ready-go-overlay.show {
  opacity: 1;
}

.ready-go-overlay.show .ready-go-text {
  transform: scale(1);
  opacity: 1;
}

/* ==========================================================================
   15. 3D 얼굴 피규어 대화식 크롭퍼 모달 스타일
   ========================================================================== */
.cropper-viewport-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #0c081e;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
  cursor: grab;
  /* 모바일 터치 스크롤 방지하여 매끄러운 드래그 가능하게 설정 */
  touch-action: none; 
}

.cropper-viewport-wrapper:active {
  cursor: grabbing;
}

#cropper-source-img {
  position: absolute;
  top: 0;
  left: 0;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none; /* 드래그 마우스 이벤트는 뷰포트에서 직접 수집하여 갱신 */
  transform-origin: center center;
}

.cropper-ellipse-guide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.cropper-ellipse-guide-svg {
  width: 100%;
  height: 100%;
}

.cropper-slider-container {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  width: 100%;
  padding: 0 4px;
}

.cropper-slider-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-dim);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.cropper-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.cropper-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-glow);
  cursor: pointer;
  box-shadow: 0 0 8px var(--primary-glow);
  transition: transform 0.1s;
}

.cropper-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* 캐리커처/아트토이 선택 세그먼트 스타일 */
.cropper-style-selector {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.cropper-style-label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.style-options {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: 85%;
  box-sizing: border-box;
}

.style-opt-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: bold;
  text-align: center;
}

.style-opt-btn.active {
  background: var(--primary-glow);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
}

.style-opt-btn:hover:not(.active) {
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.04);
}

/* 타격 성공 시 전체 화면 진동 효과 (iOS 햅틱 미지원 기기 대응) */
@keyframes viewportShake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-6px, 4px) rotate(-0.5deg); }
  30% { transform: translate(6px, -4px) rotate(0.5deg); }
  50% { transform: translate(-4px, -3px) rotate(-0.3deg); }
  70% { transform: translate(4px, 3px) rotate(0.3deg); }
  90% { transform: translate(-2px, 1px) rotate(-0.1deg); }
}

.game-viewport.shake {
  animation: viewportShake 0.14s ease-in-out;
}

/* 16. 말풍선 텍스트 관리 모달 스타일 */
.speech-list-container {
  max-height: 350px;
  overflow-y: auto;
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 5px;
}

.speech-list-container::-webkit-scrollbar {
  width: 4px;
}
.speech-list-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}
.speech-list-container::-webkit-scrollbar-thumb {
  background: var(--text-dim);
  border-radius: 4px;
}

.speech-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.speech-text {
  font-size: 14px;
  color: #fff;
  font-weight: 600;
}

.btn-delete-speech {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #f43f5e;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete-speech:hover {
  background: rgba(244, 63, 94, 0.25);
  color: #fff;
}

.speech-add-container {
  display: flex;
  gap: 8px;
}

.speech-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-game);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.speech-input:focus {
  border-color: var(--primary-glow);
}

.btn-add-speech {
  background: var(--primary-glow);
  color: #0c0824;
  border: none;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-speech:active {
  transform: translateY(2px);
}

/* 초고속 캐릭터 번개 네온 오라 이펙트 - [크리티컬 수정]: 천천히 올라오는 느낌을 완전히 배제하고 Snappy하게 연출되도록 트랜지션 단축(0.08s) */
.game-character.fast-character {
  filter: drop-shadow(0 0 8px #f59e0b) saturate(1.5);
  transition: transform 0.08s cubic-bezier(0.25, 1, 0.5, 1);
}
.game-character.fast-character.popup {
  animation: fastVibrate 0.15s infinite linear;
}

/* 페이크 캐릭터 (조금 솟아오르다 들어가는 캐릭터) 전용 애니메이션 정의 */
.game-character.peek-character {
  transition: transform 0.12s cubic-bezier(0.25, 1, 0.5, 1);
}
.game-character.peek-character.popup {
  transform: translate(-50%, 65%); /* 머리 부분만 35% 가량 빼꼼 솟아오르고 신속 회수 */
}

@keyframes fastVibrate {
  0% { transform: translate(-50%, 10%) translate(0, 0); }
  25% { transform: translate(-50%, 10%) translate(-1.5px, 1px); }
  50% { transform: translate(-50%, 10%) translate(1.5px, -1px); }
  75% { transform: translate(-50%, 10%) translate(-1px, -1.5px); }
  100% { transform: translate(-50%, 10%) translate(1px, 1.5px); }
}

/* 키보드가 올라왔을 때 모달을 위로 슬라이드 */
.modal-overlay.keyboard-active .glass-modal {
  transform: translateY(-110px) scale(1) !important;
}

/* iPhone Safari용 초강력 페이크 풀스크린 (100% 뷰포트 강제 스냅) */
html.fake-fullscreen, 
html.fake-fullscreen body {
  height: 100dvh !important;
  height: 100% !important;
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  top: 0 !important;
  left: 0 !important;
}

html.fake-fullscreen .device-frame {
  height: 100dvh !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* ==========================================================================
   ⏱️ 60초 타임어택 & 스티커북 콜렉션 신규 레이아웃 스타일
   ========================================================================== */

/* 상단 타임어택 정보 바 */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.target-score-badge {
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: var(--primary-glow);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.8px;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
  text-shadow: 0 0 5px rgba(0, 240, 255, 0.5);
  animation: glowTargetPulse 3s infinite ease-in-out;
}

@keyframes glowTargetPulse {
  0%, 100% { border-color: rgba(0, 240, 255, 0.4); box-shadow: 0 0 10px rgba(0, 240, 255, 0.2); }
  50% { border-color: rgba(0, 240, 255, 0.8); box-shadow: 0 0 15px rgba(0, 240, 255, 0.5); }
}

.time-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.time-label {
  font-size: 11.5px;
  font-weight: 900;
  color: var(--secondary-glow);
  text-shadow: 0 0 8px rgba(255, 0, 124, 0.6);
  min-width: 72px;
  letter-spacing: 0.8px;
}

.time-row .stage-progress-container {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
  margin-bottom: 0px;
}

.time-row .stage-progress-bar {
  background: linear-gradient(90deg, #ff007c, #a855f7, #00f0ff);
  box-shadow: 0 0 12px rgba(255, 0, 124, 0.6);
  transition: width 0.1s linear; /* Smooth linear transition for countdown */
}

/* 스티커북 모달 전용 스타일링 */
.stickerbook-modal {
  max-width: 410px;
  width: 92%;
}

.sticker-stats-desc {
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  color: var(--accent-gold);
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
  margin-bottom: 18px;
  background: rgba(255, 215, 0, 0.08);
  border: 1px dashed rgba(255, 215, 0, 0.3);
  padding: 6px 12px;
  border-radius: 12px;
  display: inline-block;
  left: 50%;
  position: relative;
  transform: translateX(-50%);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  max-height: 440px;
  overflow-y: auto;
  padding: 4px;
}

/* 스티커북 스크롤바 커스텀 */
.sticker-grid::-webkit-scrollbar {
  width: 6px;
}
.sticker-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}
.sticker-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.sticker-card {
  position: relative;
  background: rgba(18, 10, 36, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.sticker-card.locked {
  opacity: 0.32;
  filter: grayscale(85%) contrast(0.9);
  pointer-events: none; /* 잠김 상태에서는 클릭 불가 */
}

.sticker-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.sticker-image-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sticker-lock-icon {
  position: absolute;
  font-size: 24px;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  opacity: 0.85;
}

.sticker-canvas {
  width: 80px;
  height: 80px;
  object-fit: contain;
  transition: all 0.3s;
}

.sticker-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 16px;
  transition: all 0.3s;
}

.sticker-card-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  text-align: center;
}

.sticker-card-desc {
  font-size: 9.5px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.3;
}

/* 스티커 카드 해제 완료 시 적용되는 스타일 */
.sticker-card.unlocked {
  background: rgba(26, 15, 60, 0.7);
  border-color: rgba(255, 215, 0, 0.4);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.12), 0 0 10px rgba(168, 85, 247, 0.15);
  transform: translateY(-2px);
  opacity: 1 !important;
  filter: none !important;
  cursor: pointer;
}

.sticker-card.unlocked:hover {
  transform: translateY(-5px) scale(1.03);
  border-color: rgba(255, 215, 0, 0.7);
  box-shadow: 0 12px 30px rgba(255, 215, 0, 0.22), 0 0 15px rgba(0, 240, 255, 0.2);
}

.sticker-card.unlocked .sticker-image-wrapper {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, rgba(168, 85, 247, 0) 70%);
  border-color: rgba(168, 85, 247, 0.25);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.15);
}

.sticker-card.unlocked .sticker-lock-icon {
  display: none;
}

.sticker-card.unlocked .sticker-canvas,
.sticker-card.unlocked .sticker-img {
  filter: drop-shadow(0 4px 10px rgba(0, 240, 255, 0.4));
  animation: floatSticker 3s infinite ease-in-out;
}

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

.sticker-card.unlocked .sticker-card-title {
  color: var(--accent-gold);
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

.sticker-card.unlocked .sticker-card-desc {
  color: #fff;
  font-weight: bold;
}

/* 스티커 획득 모달 꾸미기 */
.reward-sticker-showcase {
  background: radial-gradient(circle, rgba(234, 179, 8, 0.15) 0%, rgba(234, 179, 8, 0) 75%);
  padding: 20px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.reward-sticker-name {
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  letter-spacing: 0.5px;
}

/* 미션 실패 뱃지 연동 바이브레이션 */
.fail-badge-wrapper {
  animation: failPulse 2s infinite ease-in-out;
}

@keyframes failPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(244, 63, 94, 0.3)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 16px rgba(244, 63, 94, 0.6)); }
}
