/* 🧠 청춘 두뇌 건강 테스트 - 스타일 디자인 */

/* 디자인 시스템 변수 정의 (웜 라이트 테마 전용) */
:root {
  --bg-color: #FAF6F0;       /* 부드럽고 따뜻한 크림/베이지 바탕 */
  --card-bg: #FFFFFF;        /* 카드 및 레이어 화이트 */
  --text-dark: #3E352F;      /* 시니어 눈의 피로를 최소화하는 진한 밤색 */
  --text-muted: #7A6F68;     /* 옅은 브라운 회색 */
  
  --primary-color: #FF6F3D;  /* 오렌지/다홍 포인트 (활력, 클릭 유도) */
  --primary-hover: #E85B2A;
  --secondary-color: #00A896;/* 청록 포인트 (안정감, 성공 피드백) */
  --secondary-hover: #008F80;
  
  --accent-color: #FFD166;   /* 옐로우 포인트 (칭찬, 장식) */
  --error-color: #E74C3C;    /* 오답 적색 경고 */
  --kakao-color: #FEE500;    /* 카카오 브랜드 노랑 */
  --kakao-text: #191919;
  
  --border-radius-lg: 20px;
  --border-radius-md: 12px;
  --box-shadow: 0 10px 25px rgba(62, 53, 47, 0.06);
  --box-shadow-hover: 0 15px 35px rgba(62, 53, 47, 0.12);
  
  --font-family: 'Noto Sans KR', sans-serif;
  --font-display: 'Outfit', 'Noto Sans KR', sans-serif;
}

/* 기본 리셋 및 전역 스타일 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* 모바일 터치 시 푸른 반짝임 제거 */
}

/* 화면 읽기 전용 클래스 (SEO 및 웹 접근성 개선) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: var(--font-family);
  background-color: #ECE7E1; /* 외부 배경색 */
  color: var(--text-dark);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* 앱 최상위 컨테이너 (모바일 기기 비율 고정 및 반응형 제한) */
#game-app-container {
  width: 100%;
  max-width: 480px; /* 전형적인 스마트폰 가로 크기 제한 */
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-color);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 스크린 레이아웃 공통 */
.app-screen {
  display: none;
  width: 100%;
  height: 100%;
  padding: 24px;
  flex-direction: column;
  overflow-y: auto;
}

.app-screen.active {
  display: flex;
}

/* 1. 시작 화면 디자인 및 오버레이 */
#start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(250, 246, 240, 0.6); /* 투명도를 조율하여 뒷배경 게임 이미지가 비치게 함 */
  backdrop-filter: blur(6px); /* 뒷배경 흐림 효과 */
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#start-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.logo-area {
  margin-top: 20px;
}

.emoji-logo {
  font-size: 80px;
  display: block;
  margin-bottom: 16px;
  animation: floatEmoji 3s ease-in-out infinite;
}

#main-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  color: var(--text-dark);
  line-height: 1.25;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 18px;
  color: var(--primary-color);
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* 안내 카드 */
.instructions-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  width: 100%;
  box-shadow: var(--box-shadow);
  border: 3px solid #E6DFD5;
  margin: 24px 0;
  text-align: left;
}

.instructions-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-dark);
  border-bottom: 2px solid #F3EDE4;
  padding-bottom: 8px;
}

.instructions-list {
  list-style: none;
}

.instructions-list li {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 12px;
  position: relative;
  padding-left: 24px;
  color: var(--text-dark);
}

.instructions-list li::before {
  content: "💡";
  position: absolute;
  left: 0;
  top: 1px;
}

.instructions-list li strong {
  color: var(--primary-color);
}

/* 2. 게임 화면 디자인 */
#game-screen {
  /* 패딩을 조정해 이미지가 화면 가장자리와 겹치지 않도록 함 */
  padding: 12px 16px;
  justify-content: flex-start;
  overflow: hidden; /* 플레이 중에는 스크롤 절대 방지 */
  position: relative; /* 시작 오버레이 absolute 배치를 위한 relative 컨텍스트 제공 */
}

.game-header {
  width: 100%;
  margin-bottom: 8px;
}

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

.stage-badge {
  background-color: var(--text-dark);
  color: var(--bg-color);
  padding: 6px 14px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 30px;
  font-family: var(--font-display);
  white-space: nowrap;
}

.score-display {
  display: flex;
  gap: 12px;
}

.score-item {
  background: var(--card-bg);
  padding: 6px 12px;
  border-radius: 12px;
  border: 2px solid #E6DFD5;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.score-item.age-warning .value {
  color: var(--primary-color);
  font-size: 18px;
  font-weight: 900;
}

.score-item.iq-danger .value {
  color: var(--secondary-color);
  font-size: 18px;
  font-weight: 900;
}

/* 실시간 연령 변화 게이지 바 */
.timer-bar-container {
  width: 100%;
  height: 10px;
  background-color: #E6DFD5;
  border-radius: 5px;
  overflow: hidden;
}

.timer-progress-bar {
  height: 100%;
  width: 0%; /* 시간이 갈수록 가득 채워져서 뇌가 노화됨을 표시 */
  background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
  transition: width 0.1s linear, background-color 0.5s ease;
  border-radius: 5px;
}

/* 메인 플레이 영역 (상하 이미지 프레임) */
.game-play-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 8px 0;
}

.game-image-frame {
  /* 모바일에서 이미지가 너무 작아 보이는 현상 개선 */
  width: min(90vw, 45vh * 1.5); /* 뷰포트 너비 90% 또는 높이 기반 최대 크기로 확대 */
  max-width: 480px;          /* 과도한 확대 방지 */
  aspect-ratio: 1.5;         /* 3:2 비율 고정 */
  margin: 0 auto;
  position: relative;

  background-color: #EFECE7;
  border: 4px solid var(--primary-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
  touch-action: none; /* 드래그 및 기본 모바일 액션 방지 */
}

/* 오답일 때 깜빡이며 요동치는 프레임 효과 */
.game-image-frame.penalty {
  border-color: var(--error-color);
  animation: shake 0.3s ease-in-out;
}

.game-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: fill; /* 이미지 잘림 방지 (3:2 비율에 맞춰 채움) */
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* 이미지 사이 구분 디자인 */
.divider-line {
  height: 4px;
  width: 80%;
  background: dashed #D6CEB8;
  margin: 0 auto;
}

/* 오버레이 틀린 그림 컨테이너 */
.diff-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* 클릭은 이미지 프레임 자체가 받음 */
}

/* 3. 결과 화면 디자인 */
#end-screen {
  justify-content: space-between;
  align-items: center;
}

.result-header {
  text-align: center;
  margin-top: 15px;
}

.result-header h2 {
  font-size: 26px;
  font-weight: 900;
  margin-top: 8px;
}

.result-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  width: 100%;
  box-shadow: var(--box-shadow);
  border: 4px solid #E6DFD5;
  text-align: center;
  margin: 20px 0;
}

.result-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 24px;
  gap: 16px;
}

.stat-box {
  background-color: var(--bg-color);
  border-radius: var(--border-radius-md);
  padding: 16px 12px;
  flex: 1;
  border: 2px solid #E6DFD5;
}

.stat-label {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 700;
}

.stat-value {
  font-size: 32px;
  font-weight: 900;
  font-family: var(--font-display);
}

.text-primary {
  color: var(--primary-color);
}

.text-secondary {
  color: var(--secondary-color);
}

.result-diagnosis {
  background: #FDFBF7;
  border-radius: var(--border-radius-md);
  padding: 16px;
  border-left: 5px solid var(--primary-color);
  text-align: left;
}

.result-diagnosis h3 {
  font-size: 18px;
  font-weight: 900;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.result-diagnosis p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-dark);
}

/* 하단 푸터 영역 */
.game-footer {
  width: 100%;
  text-align: center;
  padding: 8px 0;
}

.footer-status {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 3px solid #E6DFD5;
  padding: 8px 20px;
  border-radius: 12px;
  display: inline-flex;
  margin-bottom: 6px;
}

.status-icon {
  font-size: 20px;
}

.status-text {
  font-size: 18px;
  font-weight: 700;
}

.status-text strong {
  color: var(--secondary-color);
  font-size: 22px;
}

.guide-tip {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 700;
}

/* 4. 공통 컴포넌트: 버튼 디자인 */
.btn {
  font-family: var(--font-family);
  font-size: 18px;
  font-weight: 900;
  padding: 16px 24px;
  border-radius: 40px;
  border: none;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.btn:active {
  transform: scale(0.96);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:disabled {
  background-color: #C2B8A3;
  color: #FAF6F0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-large {
  font-size: 22px;
  padding: 20px 32px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: #FFFFFF;
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
}

.btn-kakao {
  background-color: var(--kakao-color);
  color: var(--kakao-text);
  border: 1px solid #E5CE00;
}

.btn-kakao:hover {
  background-color: #F7D400;
}

.btn-outline {
  background-color: transparent;
  color: var(--text-dark);
  border: 3px solid #D6CEB8;
}

.btn-outline:hover {
  background-color: rgba(62, 53, 47, 0.04);
}

.action-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
}

.btn-icon {
  font-size: 22px;
}

/* 5. 동적 렌더링 요소 (정답 동그라미 및 랜덤 아이콘) */

/* 틀린 그림으로 띄울 아이콘 컨테이너 */
.diff-item {
  position: absolute;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  filter: drop-shadow(1px 2px 2px rgba(0,0,0,0.35));
}

.diff-item svg {
  width: 100%;
  height: 100%;
}

/* 맞춘 정답에 치는 초록색 동그라미 */
.correct-marker {
  position: absolute;
  width: 50px;
  height: 50px;
  border: 6px solid #2ECC71;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  z-index: 10;
  animation: popMarker 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  box-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

/* 6. 토스트 알림창 */
.toast-message {
  position: absolute;
  top: 15px; /* 이미지 영역을 가리지 않도록 상단 배치 */
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background-color: rgba(62, 53, 47, 0.98);
  color: #FAF6F0;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 700;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  border: 2px solid var(--accent-color); /* 시인성 확보를 위한 테두리 추가 */
}

.toast-message.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 7. 애니메이션 모음 */
@keyframes floatEmoji {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes popMarker {
  to {
    transform: translate(-50%, -50%) scale(1);
  }
}

/* 8. 수동 애드센스 광고 영역 데코레이션 */
.adsense-container {
  width: 100%;
  display: block; /* Flexbox item collapse (AvailableWidth=0) 방지를 위해 block으로 설정 */
  background-color: #F3ECE3;
  border: 2px dashed #C2B8A3;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  margin: 16px 0 8px 0;
  min-height: 100px;
  max-height: 120px;
  position: relative;
}

.ads-game-screen,
.ads-end-screen {
  position: relative;
  margin: 0 0 8px 0;
  min-height: 60px;
  max-height: 90px;
}

.ads-game-screen {
  z-index: 101; /* 오버레이(z-index 100)보다 상위에 오게 하여 blur 필터를 피하고 활성 상태 유지 */
  margin-top: 8px; /* 광고와 게임 이미지 사이에 충분한 여백을 두어 겹치지 않게 함 */
}

.adsense-container.ads-game-screen:has(iframe),
.adsense-container.ads-game-screen:has(ins[data-ad-status="filled"]),
.adsense-container.ads-end-screen:has(iframe),
.adsense-container.ads-end-screen:has(ins[data-ad-status="filled"]) {
  min-height: auto;
  max-height: 90px !important; /* 상단 광고는 최대 90px로 강제 제한하여 영역 침범 방지 */
  overflow: hidden !important;
}

/* 애드센스 태그 자체의 가로폭이 0px로 붕괴되는 현상 방지 */
.adsense-container ins.adsbygoogle {
  display: block !important;
  width: 100% !important;
  min-width: 250px;
}

.adsense-container:has(iframe),
.adsense-container:has(ins[data-ad-status="filled"]) {
  background-color: transparent;
  border: none;
  min-height: auto;
  max-height: none;
}

/* 9. 데스크톱/PC 환경 반응형 레이아웃 (가로 화면에서 좌/우 배치 & 이미지 지원) */
@media (min-width: 1024px) {
  body {
    justify-content: center;
    align-items: stretch;
  }

  #game-app-container {
    max-width: 1500px; /* 데스크톱에서 게임 화면 크기를 키워 시인성을 제고하고 애드센스 공간 유지 */
    height: 95vh;
    border-radius: var(--border-radius-lg);
    border: 4px solid #D6CEB8;
  }

  /* 시작 화면 및 결과 화면 카드 가로폭 중앙 정렬 */
  .instructions-card,
  .result-card {
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
  }

  #btn-start-game,
  .action-buttons {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }

  .adsense-container {
    max-width: 728px; /* 리더보드 광고 표준 크기 */
    margin-left: auto;
    margin-right: auto;
  }

  /* 게임 플레이 영역을 좌/우 배치(flex-direction: row)로 전환 */
  .game-play-area {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0 32px;
  }

  .game-image-frame {
    /* 각 이미지의 크기를 컨테이너(1500px)에 맞춰 최대 700px로 확장 및 여백 제거하여 간격 최소화 */
    width: min(45vw, 55vh * 1.5, 700px);
    max-width: none; /* 모바일의 max-width: 480px 제약 해제 */
    aspect-ratio: 1.5; /* 3:2 비율 고정 (700px일 때 세로 466.6px) */
    height: auto;
    border-width: 5px;
    margin: 0;
  }

  /* 좌우 이미지를 밀착시키되 가운데 5px 경계선을 유지하기 위해 경계와 라운딩 조정 */
  #frame-top {
    border-right: 5px solid var(--primary-color);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
  #frame-bottom {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  /* 구분선을 가려서 완전히 붙어 있게 만듦 */
  .divider-line {
    display: none;
  }
}

/* 결과 화면(#end-screen) 컴팩트 최적화 - 스크롤 방지 및 애드센스 상단 마진 조율 */
#end-screen {
  padding: 12px 24px;
}

#end-screen .result-header {
  text-align: center;
  margin-top: 4px;
}

#end-screen .result-header .emoji-logo {
  font-size: 50px;
  margin-bottom: 4px;
  animation: floatEmoji 3s ease-in-out infinite;
}

#end-screen .result-header h2 {
  font-size: 20px;
  margin-top: 4px;
}

#end-screen .result-card {
  padding: 12px 16px;
  margin: 10px 0;
}

#end-screen .result-stats {
  margin-bottom: 12px;
  gap: 12px;
}

#end-screen .stat-box {
  padding: 8px 6px;
}

#end-screen .stat-label {
  font-size: 13px;
  margin-bottom: 4px;
}

#end-screen .stat-value {
  font-size: 24px;
}

#end-screen .result-diagnosis {
  padding: 10px 12px;
}

#end-screen .result-diagnosis h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

#end-screen .result-diagnosis p {
  font-size: 13.5px;
  line-height: 1.45;
}

#end-screen .adsense-container {
  margin: 0 0 10px 0; /* 최상단에 배치되므로 상단 여백 제거, 하단 여백만 살짝 추가 */
}

#end-screen .action-buttons {
  margin-top: 6px;
  gap: 8px;
}

#end-screen .action-buttons .btn {
  padding: 11px 20px;
  font-size: 15.5px;
}

/* 모바일 전용 상단 애드센스 배너 크기 압축 및 공간 절약 조율 */
@media (max-width: 767px) {
  .adsense-container.ads-game-screen,
  .adsense-container.ads-end-screen {
    min-height: 50px;
    max-height: 60px;
    margin: 0 0 6px 0;
  }
  .adsense-container.ads-game-screen:has(iframe),
  .adsense-container.ads-game-screen:has(ins[data-ad-status="filled"]),
  .adsense-container.ads-end-screen:has(iframe),
  .adsense-container.ads-end-screen:has(ins[data-ad-status="filled"]) {
    min-height: auto;
    max-height: 60px !important;
    overflow: hidden !important;
  }

  /* 모바일 화면에서 하단 잘림을 원천적으로 막기 위한 여백 극소화 */
  #game-screen {
    padding: 6px 12px;
  }
  .game-header {
    margin-bottom: 4px;
  }
  .header-top {
    margin-bottom: 4px;
  }
  .game-play-area {
    margin: 4px 0;
    gap: 6px;
  }
  .game-image-frame {
    width: min(100%, 30vh * 1.5) !important; /* 기존 32.5vh에서 30vh로 조율하여 하단 안전 마진 확보 */
  }
  .game-footer {
    padding: 4px 0;
  }
  .footer-status {
    padding: 6px 16px;
    margin-bottom: 2px;
  }
  .guide-tip {
    font-size: 12px;
    margin: 0;
  }

  /* 모바일 상단 헤더 요소 크기 압축 조율 */
  .stage-badge {
    padding: 4px 10px !important;
    font-size: 13.5px !important;
  }
  .btn-sound-toggle {
    width: 30px !important;
    height: 30px !important;
    font-size: 12px !important;
  }
  .score-display {
    gap: 6px !important;
  }
  .score-item {
    padding: 4px 8px !important;
    font-size: 12.5px !important;
    gap: 2px !important;
  }
  .score-item.age-warning .value,
  .score-item.iq-danger .value {
    font-size: 15px !important;
  }
}

/* 하단 맞춰야 할 개수 시각적 점 표시기 */
.diff-dots-container {
  display: flex;
  gap: 8px;
  margin-left: 14px;
  align-items: center;
}

.diff-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #E6DFD5;
  border: 2px solid #C4B9A6;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.diff-dot.found {
  background-color: var(--secondary-color); /* 녹색 */
  border-color: #2F9D27;
  transform: scale(1.25);
  box-shadow: 0 0 10px rgba(47, 157, 39, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

/* 하단 틀린 그림 목표 개수 영역 펄스 강조 효과 */
@keyframes footer-pulse {
  0% {
    transform: scale(1);
    border-color: #E6DFD5;
  }
  50% {
    transform: scale(1.08);
    border-color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(47, 157, 39, 0.4);
  }
  100% {
    transform: scale(1);
    border-color: #E6DFD5;
  }
}

.footer-status.pulse {
  animation: footer-pulse 0.8s ease-in-out 2;
}

/* 상단 효과음 토글 버튼 */
.btn-sound-toggle {
  background-color: var(--card-bg);
  border: 2px solid #E6DFD5;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  padding: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-sound-toggle:hover {
  background-color: #E6DFD5;
  transform: scale(1.05);
}

.btn-sound-toggle:active {
  transform: scale(0.9);
}

/* 타이머 바 래퍼 및 남은 초 스타일 */
.timer-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.timer-bar-wrapper .timer-bar-container {
  flex: 1;
}

.timer-seconds-text {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-color);
  min-width: 45px;
  text-align: right;
  white-space: nowrap;
}

/* 정답 플로팅 텍스트 이펙트 */
.floating-score-effect {
  position: absolute;
  pointer-events: none;
  font-family: var(--font-family);
  font-weight: 900;
  font-size: 20px;
  z-index: 50;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  animation: floatUpFade 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.floating-score-effect.age {
  color: #FFD166; /* 금빛 노랑 */
}

.floating-score-effect.iq {
  color: #2ECC71; /* 연두/초록 */
}

@keyframes floatUpFade {
  0% {
    transform: translate(-50%, -50%) translateY(0) scale(0.8);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -50%) translateY(-20px) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) translateY(-70px) scale(1.0);
    opacity: 0;
  }
}

/* 충전 안내 모달 스타일 (고급 다크 글래스모피즘) */
.game-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 26, 23, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: none; /* JS로 flex 처리 */
  justify-content: center;
  align-items: center;
  padding: 24px;
  animation: fadeIn 0.3s ease forwards;
}

.game-modal-overlay.active {
  display: flex;
}

.game-modal-content {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  border: 4px solid var(--primary-color);
  text-align: center;
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-emoji {
  font-size: 54px;
  display: block;
  margin-bottom: 12px;
}

.game-modal-content h2 {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 12px;
  color: var(--text-dark);
}

.game-modal-content p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 가상 광고 오버레이 스타일 (전체화면) */
.ad-simulation-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #110F0E;
  z-index: 300;
  display: none; /* JS로 flex 처리 */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  color: #FFFFFF;
}

.ad-simulation-overlay.active {
  display: flex;
}

.ad-simulation-content {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.ad-badge {
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: 1px;
}

.ad-video-mock {
  width: 100%;
  aspect-ratio: 16/9;
  background: radial-gradient(circle, #2C2621 0%, #1E1A16 100%);
  border-radius: var(--border-radius-md);
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

/* 프리미엄 로딩 스피너 */
.ad-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.ad-main-message {
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
}

.ad-sub-message {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.ad-countdown-text {
  font-family: var(--font-family);
  font-size: 18px;
  font-weight: 800;
  background-color: var(--primary-color);
  color: #FFFFFF;
  padding: 10px 24px;
  border-radius: 30px;
  box-shadow: 0 4px 15px rgba(255, 111, 61, 0.4);
  animation: pulseCountdown 1s infinite alternate;
}

/* 기회 하트 색상 강조 */
.attempts-display .value {
  color: #E74C3C !important;
  letter-spacing: -1px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulseCountdown {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

@media (max-width: 767px) {
  .attempts-display .value {
    font-size: 11px !important;
    letter-spacing: -2px;
  }
}

@media (min-width: 1024px) {
  body {
    justify-content: center;
    align-items: stretch;
  }

  #game-app-container {
    width: min(100vw, 1500px);
    max-width: none;
  }
}
