/* ==========================================================================
   style.css - 다중 테마, 다국어 선택기 및 광고 슬롯을 포함한 프리미엄 스타일시트
   ========================================================================== */

/* 1. 기본 디자인 시스템 토큰 및 초기화 */
:root {
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  
  /* [기본 테마] 밝고 포근한 파스텔 크림 */
  --bg-primary: #FCF9F4;      
  --bg-container: #FFFDF9;    
  --bg-card: #FFFFFF;         
  --border-color: rgba(230, 220, 210, 0.8);
  
  --color-text-main: #3C2D49; 
  --color-text-sub: #7A6987;  
  
  --color-primary: #FF7E36;    
  --color-secondary: #7C3AED;  
  
  --color-green: #10B981;
  --color-red: #EF4444;
  --color-purple: #8B5CF6;
}

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

body {
  font-family: var(--font-sans);
  background-color: #F4EFE6;
  color: var(--color-text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.4s ease;
}

/* 2. 모바일 전용 컨테이너 */
.phone-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  background: radial-gradient(circle at 50% 0%, #FFFDF9 0%, #F5EFEB 100%);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(180, 165, 150, 0.25);
  border-left: 1px solid rgba(0, 0, 0, 0.05);
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}





/* 5. 스크린 구조 및 활성화 애니메이션 */
.screen {
  display: none;
  opacity: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  flex-direction: column;
  padding: 24px;
  padding-top: 24px;
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
  animation: slideFadeIn 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes slideFadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 6. 공통 UI 컴포넌트 */

.screen-header {
  width: 100%;
  padding-bottom: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
}

.btn-back {
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-back:active {
  color: var(--color-primary);
}

.btn {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  padding: 16px 24px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  outline: none;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, #7C3AED 0%, #6366F1 100%);
  color: #FFFFFF;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.25);
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.15);
}

.btn-secondary {
  background: linear-gradient(135deg, #FF7E36 0%, #FD5E09 100%);
  color: #FFFFFF;
  box-shadow: 0 6px 20px rgba(255, 126, 54, 0.25);
}

.btn-secondary:active {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(255, 126, 54, 0.15);
}

.btn-kakao {
  background-color: #FEE500;
  color: #191919;
  box-shadow: 0 4px 12px rgba(254, 229, 0, 0.2);
}

.btn-whatsapp {
  background-color: #25D366;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

.btn-outline {
  background: transparent;
  color: var(--color-text-main);
  border: 2px solid rgba(0, 0, 0, 0.08);
}

.btn-outline:active {
  background: rgba(0, 0, 0, 0.03);
}

.ripple {
  position: relative;
}

/* 7. 홈 스크린 스타일 */
.portal-header {
  padding-top: 20px;
  margin-bottom: 24px;
  text-align: center;
}

.portal-title {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  color: var(--color-text-main);
}

.portal-title .highlight {
  color: var(--color-primary);
  background: linear-gradient(to right, #FF7E36, #FF9F43);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.portal-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-sub);
  line-height: 1.55;
  padding: 0 10px;
}

.test-list-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 30px;
}

.test-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 15px rgba(220, 210, 200, 0.12);
}

.test-card:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(220, 210, 200, 0.08);
}

.test-icon-wrapper {
  font-size: 2rem;
  background: #FFF5F0;
  width: 54px;
  height: 54px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 18px;
  border: 1px solid rgba(255, 126, 54, 0.15);
  flex-shrink: 0;
}

.test-info {
  flex-grow: 1;
}

.test-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 4px;
  word-break: keep-all;
}

.test-info p {
  font-size: 0.82rem;
  color: var(--color-text-sub);
  line-height: 1.4;
  word-break: keep-all;
}

.test-card.ready {
  opacity: 0.65;
  cursor: not-allowed;
  background: #F5EFEB;
}

.test-card.ready:active {
  transform: none;
  box-shadow: 0 4px 15px rgba(220, 210, 200, 0.12);
}

.test-card.ready .test-icon-wrapper {
  background: #E6DFD9;
  border-color: rgba(0, 0, 0, 0.05);
}

.badge-ready {
  background: #9CA3AF;
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  display: inline-block;
  margin-top: 6px;
}

.portal-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-sub);
  padding: 20px 0;
  margin-top: auto;
  border-top: 1px solid rgba(0, 0, 0, 0.03);
}


/* 8. 개별 테스트 인트로 화면 */
.intro-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 90%;
  text-align: center;
}

.main-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
  color: var(--color-text-main);
  word-break: keep-all;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--color-text-sub);
  line-height: 1.55;
  margin-bottom: 30px;
  max-width: 92%;
  word-break: keep-all;
}

.intro-banner {
  width: 200px;
  height: 200px;
  position: relative;
  margin-bottom: 35px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  border-radius: 50%;
  border: 4px solid #FFFFFF;
  background-color: #FFF;
  box-shadow: 0 8px 20px rgba(180, 165, 150, 0.15);
}

.floating {
  animation: floatEffect 3s ease-in-out infinite;
}

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

.decor-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(12px);
  z-index: 1;
}

.circle-1 {
  width: 120px;
  height: 120px;
  background: rgba(124, 58, 237, 0.08);
  top: 10px;
  left: -20px;
  animation: pulse 4s ease-in-out infinite alternate;
}

.circle-2 {
  width: 110px;
  height: 110px;
  background: rgba(255, 126, 54, 0.08);
  bottom: 10px;
  right: -20px;
  animation: pulse 4s ease-in-out infinite alternate-reverse;
}

@keyframes pulse {
  0% { transform: scale(0.9) translate(0, 0); }
  100% { transform: scale(1.1) translate(8px, 8px); }
}

.intro-footer {
  font-size: 0.8rem;
  color: var(--color-text-sub);
  margin-top: 16px;
}

/* 9. 테스트 스크린 */
.test-header {
  margin-bottom: 24px;
}

.counter {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-primary);
  display: block;
  margin-bottom: 8px;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-secondary) 0%, var(--color-primary) 100%);
  border-radius: 99px;
  transition: width 0.3s ease-out;
}

.question-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(220, 210, 200, 0.15);
}

.card-decor {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--color-primary);
}

.question-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-text-main);
  word-break: keep-all;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.option-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--color-text-main);
  padding: 16px 20px;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  word-break: keep-all;
  box-shadow: 0 4px 10px rgba(220, 210, 200, 0.12);
}

.option-btn:hover {
  background: rgba(255, 126, 54, 0.03);
  border-color: rgba(255, 126, 54, 0.3);
}

.option-btn:active {
  transform: scale(0.98);
  background: rgba(255, 126, 54, 0.08);
  border-color: var(--color-primary);
}

/* 10. 결과 대기 로딩 스크린 */
#loading-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.spinner-box {
  width: 100px;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 25px;
}

.circle-border {
  width: 64px;
  height: 64px;
  padding: 3px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background: linear-gradient(0deg, rgba(255, 126, 54, 0.1) 33%, rgba(255, 126, 54, 1) 100%);
  animation: spin .8s linear infinite;
}

.circle-core {
  width: 100%;
  height: 100%;
  background-color: var(--bg-container);
  border-radius: 50%;
}

@keyframes spin {
  from { transform: rotate(0); }
  to { transform: rotate(350deg); }
}

.loading-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 18px;
}

.loading-tips {
  height: 40px;
  position: relative;
  width: 100%;
  overflow: hidden;
}

.tip-text {
  font-size: 0.9rem;
  color: var(--color-text-sub);
  position: absolute;
  width: 100%;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
  word-break: keep-all;
}

.tip-text.active {
  opacity: 1;
  transform: translateY(0);
}

/* 11. 결과 스크린 */
.result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 40px;
}

.result-header {
  text-align: center;
  margin-bottom: 25px;
  width: 100%;
}

.result-img-box {
  width: 180px;
  height: 180px;
  margin: 0 auto 18px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #FFFFFF;
  background-color: #FFF;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 8px 24px rgba(180, 165, 150, 0.2);
}

.result-img-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 국기 이미지 전용: 사각형 프레임 (소울 컨트리 결과에 사용) */
.result-img-box.flag-rect {
  width: 240px !important;
  height: 160px !important;
  border-radius: 10px !important;
  border: 3px solid #FFFFFF !important;
  box-shadow: 0 8px 24px rgba(180, 165, 150, 0.25) !important;
  overflow: hidden !important;
}

.result-img-box.flag-rect img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 8px !important;
}

/* 전생 위인 캐릭터 전용: 사각형 프레임 (귀여운 카툰 비율 보존) */
.result-img-box.char-rect {
  width: 200px !important;
  height: 200px !important;
  border-radius: 24px !important;
  border: 4px solid #FFFFFF !important;
  background-color: #FFFFFF !important;
  box-shadow: 0 8px 24px rgba(180, 165, 150, 0.2) !important;
  overflow: hidden !important;
}

.result-img-box.char-rect img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  padding: 8px;
}

.result-animal-name {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 4px;
}



.result-type-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.4;
  margin-bottom: 14px;
  word-break: keep-all;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  background: #FFF5F0;
  border: 1px solid rgba(255, 126, 54, 0.15);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 600;
}

.result-details {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 30px;
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 6px 15px rgba(180, 165, 150, 0.1);
  position: relative;
  overflow: hidden;
}

.detail-card.border-green { border-left: 4px solid var(--color-green); }
.detail-card.border-red { border-left: 4px solid var(--color-red); }
.detail-card.border-purple { border-left: 4px solid var(--color-purple); }

.card-icon {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.detail-card h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 8px;
}

.detail-card p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text-sub);
  word-break: keep-all;
  white-space: pre-line;
}

.result-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.01);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   12. 슬라이더 (Slider) 가치관 선택형 UI 프리미엄 스타일
   ========================================================================== */
.slider-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 6px 18px rgba(220, 210, 200, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-text-main);
  padding: 0 4px;
}

.slider-label-left {
  text-align: left;
  color: var(--color-secondary);
}

.slider-label-right {
  text-align: right;
  color: var(--color-primary);
}

.custom-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: #EAE3D9;
  outline: none;
  margin: 16px 0;
  transition: background 0.3s;
}

/* Chrome/Safari Thumb */
.custom-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 3px solid #FFFFFF;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(255, 126, 54, 0.3);
  transition: transform 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.custom-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.custom-range-slider::-webkit-slider-thumb:active {
  transform: scale(1.25);
  background: var(--color-secondary);
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
}

/* Firefox Thumb */
.custom-range-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 3px solid #FFFFFF;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(255, 126, 54, 0.3);
  transition: transform 0.15s;
}

.custom-range-slider::-moz-range-thumb:active {
  background: var(--color-secondary);
}

.slider-value-indicator {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--color-text-sub);
  background: #FFF5EE;
  border: 1px solid rgba(255, 126, 54, 0.1);
  padding: 6px 16px;
  border-radius: 99px;
  margin-bottom: 24px;
  display: inline-block;
  text-align: center;
  min-width: 140px;
}

.slider-submit-btn {
  width: 100%;
}

/* 푸터 약관 링크 스타일 */
.footer-links {
  margin-top: 10px;
  font-size: 0.82rem;
  color: #B0A596;
}

.footer-links a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 700;
  margin: 0 4px;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* 정책 모달 팝업 스타일 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(92, 84, 76, 0.45); /* 반투명 은은한 갈색 */
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-card {
  width: 90%;
  max-width: 440px;
  background: #FFFDF9; /* 크림톤 */
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 12px 36px rgba(92, 84, 76, 0.15);
  transform: translateY(20px);
  transition: transform 0.25s ease;
  border: 1px solid rgba(180, 165, 150, 0.15);
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #F3EDE4;
  padding-bottom: 12px;
}

.modal-body h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--color-text-main);
  margin-top: 18px;
  margin-bottom: 6px;
}

.modal-body p {
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: #5C544C;
}

