/* === Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === 전역 오버플로우 차단 === */
html {
  overflow-x: hidden;      /* 가로 스크롤 원천 차단 */
  width: 100%;
}

body {
  overflow-x: hidden;      /* 이중 보험 */
  width: 100%;
}

/* === CSS Variables === */
:root {
  /* Colors - Primary */
  --color-primary: #1A1A1A;
  --color-primary-60: rgba(26, 26, 26, 0.6);
  --color-primary-40: rgba(26, 26, 26, 0.4);
  --color-primary-20: rgba(26, 26, 26, 0.2);
  
  /* Colors - Accent (Orange) */
  --color-accent: #FF6B35;
  --color-accent-light: #FF8C5A;
  --color-accent-glow: rgba(255, 107, 53, 0.15);
  
  /* Colors - Background */
  --color-bg: #F9FBF9;
  --color-bg-warm: #FFF8F0;
  --color-white: #FFFFFF;
  --color-card: #FFFFFF;
  
  /* Colors - Semantic */
  --color-emerald: #10B981;
  --color-emerald-hover: #059669;
  --color-border: rgba(0, 0, 0, 0.08);
  
  /* Colors - Orange shades */
  --color-orange-100: #FFE4CC;
  --color-orange-200: rgba(255, 107, 53, 0.2);
  --color-amber-200: rgba(255, 193, 7, 0.2);
  
  /* Colors - Axis bars */
  --color-axis-e: #FF6B35;
  --color-axis-s: #4ECDC4;
  --color-axis-f: #FF6B6B;
  --color-axis-j: #45B7D1;
  
  /* Typography */
  --font-main: 'Nunito', 'Noto Sans KR', 'Noto Sans JP', 'Noto Sans SC', -apple-system, sans-serif;
  --font-display: 'Nunito', 'Noto Sans KR', 'Noto Sans JP', 'Noto Sans SC', -apple-system, sans-serif;
  
  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  
  /* Max width */
  --max-width: 480px;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* === Animations === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes bounceArrow {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px);
  }
}

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

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes barFill {
  from {
    width: 0%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

/* === Utility === */
.hidden {
  display: none !important;
}

/* =========================================
   Global Header (Know Your Pet)
========================================= */
.site-header {
  position: sticky; /* sticky는 relative positioning context를 제공하므로 프로그레스 바를 absolute로 배치 가능 */
  top: 0;
  width: 100%;
  background-color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  z-index: 1000;
}

.header-inner {
  max-width: 100%;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  box-sizing: border-box;
  overflow: hidden;
}

/* 브랜드 로고 텍스트 */
.brand-logo {
  font-family: 'Nunito', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #333333;
  text-decoration: none;
  letter-spacing: -0.5px;
  transition: color var(--transition-fast);
  flex-shrink: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 200px);
}

.brand-logo:hover {
  color: #FF6B35;
}

/* =========================================
   Language Selector (Global)
========================================= */
.lang-selector {
  display: flex;
  gap: 4px; /* 버튼 사이 간격 */
  background: var(--color-white);
  padding: 4px;
  border-radius: 50px; /* 둥근 테두리 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* 살짝 그림자 */
  border: 1px solid var(--color-border);
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.lang-btn {
  padding: 6px 12px;
  min-height: 32px; /* 터치 영역 확보 */
  border: none;
  background: transparent;
  color: var(--color-primary-60); /* 기본 글자색 */
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-main);
  -webkit-tap-highlight-color: transparent; /* 모바일 파란색 하이라이트 제거 */
  user-select: none;
}

.lang-btn:hover {
  color: var(--color-primary);
  background: var(--color-bg); /* 마우스 올렸을 때 배경색 */
}

/* 현재 선택된 언어 버튼 스타일 */
.lang-btn.active {
  background: var(--color-accent); /* 포인트 컬러 (오렌지색 계열) */
  color: var(--color-white);
}

/* 헤더 내 언어 선택기 여백 조정 */
.site-header .lang-selector {
  margin: 0;
}

/* 모바일 화면에서 버튼 크기 약간 조정 */
@media (max-width: 480px) {
  .lang-btn {
    padding: 6px 8px;
    font-size: 12px;
  }
}

/* 페이지별 뒤로가기 버튼 (test.html, result.html용) */
.page-top-bar {
  max-width: 600px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-top-bar .back-link {
  display: flex;
  align-items: center;
  color: var(--color-primary-60);
  text-decoration: none;
  font-size: 14px;
  transition: color var(--transition-fast);
}

.page-top-bar .back-link:hover {
  color: var(--color-primary);
}

.page-top-bar .back-link .material-symbols-outlined {
  font-size: 20px;
}

/* =========================================
   Progress Bar (헤더 하단에 부착)
========================================= */
.progress-bar-container {
  position: absolute; /* fixed 대신 absolute를 써서 헤더 바닥에 붙임 */
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.08);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #FF6B35, #FFB347);
  border-radius: 0 4px 4px 0;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   모바일 최적화 (언어 버튼 줄바꿈 방지)
========================================= */
@media (max-width: 480px) {
  .lang-selector {
    gap: 2px;
    padding: 2px;
    flex-shrink: 1;
    min-width: 0;
  }
  .lang-btn {
    padding: 4px 6px;
    font-size: 11px;
  }
  .header-inner {
    padding: 10px 16px;
  }
  .brand-logo {
    font-size: 1.1rem;
  }
}

/* 매우 작은 화면 (360px 이하) */
@media (max-width: 360px) {
  .header-inner {
    padding: 10px 12px;
  }
  .brand-logo {
    font-size: 1rem;
  }
  .lang-btn {
    padding: 4px 5px;
    font-size: 10px;
  }
}

/* =========================================
   Global Footer (Know Your Pet)
========================================= */
.site-footer {
  padding: 24px 16px 32px;
  text-align: center;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: auto; /* 콘텐츠가 짧아도 푸터가 밑으로 가게 함 */
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-text {
  font-size: 12px;
  color: rgba(45, 52, 54, 0.4);
}

.footer-dot {
  font-size: 12px;
  color: rgba(45, 52, 54, 0.2);
}

.footer-link {
  font-size: 12px;
  color: rgba(45, 52, 54, 0.4);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: #FF6B35; /* 오렌지색 포인트 */
}
