/* ============================================================
   RESET & 기본
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #f1d849;
  --text-dark: #333;
  /* 변수 대신 아래 background-image에서 직접 경로를 지정합니다 */
}

/* styles.css: html, body 영역 수정 */

html, body {
  height: 100%;
  overflow: hidden; 
  margin: 0;
  padding: 0;

 /* [폰트] Noto Sans KR 최우선 적용 및 렌더링 최적화 */
  font-family: 'Noto Sans KR', 'Noto Sans JP', 'Noto Sans SC', 'Noto Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif !important;
  font-weight: 500; /* 기본 굵기 설정 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* 배경 및 기타 설정 */
  background-color: #a5a29f !important; 
  background-image: url('/skin_mbti/test2/bg_img.jpg') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;

  color: #ffffff !important;
  line-height: 1.5 !important;
}

/* 터치 디바이스에서 클릭 시 생기는 파란 하이라이트 제거 (선택) */
* {
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   공통 페이지 래퍼
   JS가 display를 직접 'flex' / 'none' 으로 제어
   ============================================================ */
/* 3. 중앙 페이지 영역 로직 보강 */
.page {
  display: none;
  flex-direction: column;
  align-items: center;
  
  /* [모바일 기본값] 상단부터 차례로 정렬 (요청사항 반영) */
  justify-content: flex-start; 
  
  width: 100%;
  max-width: 480px; /* PC에서도 모바일 크기로 중앙 고정 */
  min-height: 100svh;
  margin: 0 auto;
  position: relative;
  
 /* 배경 이미지가 중복되지 않도록 여기서 삭제하고 투명도만 줍니다 */

  background: rgba(0, 0, 0, 0.15); 
 

  /* 노치 및 하단 바 여백 */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* [PC/고해상도 환경] 중앙 정렬 적용 */
/* 화면 높이가 700px 이상이고 가로폭이 모바일 이상일 때만 중앙으로 */
@media (min-height: 700px) and (min-width: 481px) {
  .page {
    /* PC에서는 내용을 정중앙으로 배치 */
    justify-content: center !important; 
    padding-top: 0; /* 중앙 정렬 시 상단 패딩 초기화 */
    box-shadow: 0 0 50px rgba(0,0,0,0.2);
  }

  /* [핵심] 결과 페이지만 상단 정렬로 덮어쓰기 */
  /* 결과지는 내용이 길어서 중앙 정렬 시 상단이 잘릴 수 있습니다. */
  .page-result {
    justify-content: flex-start !important; 
    /* 상단이 너무 붙지 않도록 적절한 여백 부여 */
    padding-top: 5vh !important; 
    padding-bottom: 5vh !important;
  }
}

/* 개별 페이지의 상단 고정 강제성 제거 */
.page-welcome, .page-intro, .page-quiz, .page-result {
  /* 위 .page에서 선언한 justify-content를 따르도록 개별 설정은 삭제하거나 초기화 */
  height: 100svh; 
}

/* 초기에는 모두 숨김 — JS가 첫 화면을 flex로 바꿈 */
.page { display: none; }

/* ============================================================
   WELCOME - 클라이언트 요청 반영 수정 버전
   ============================================================ */

.page-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* 중앙 집중형 레이아웃으로 변경 */
  height: 100svh;
  padding: 2rem 1rem;
  overflow-y: auto; /* 내용이 많아질 경우를 대비 */
}

/* .page-welcome 내부 요소 수정 */
.welcome-logo-v {
  background: #004262;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  padding: 0.6rem 1.5rem;
  /* margin-bottom을 고정값 대신 비율로 변경 */
  margin-bottom: 5vh; 
  text-align: center;
  letter-spacing: 0.02em;
}

/* 2. 메인 타이틀 (VOS SKIN MBTI) */
.welcome-title {
  /* 3.5rem이 너무 크다면 10vw 정도로 유동적으로 설정 */
  font-size: clamp(2.5rem, 12vw, 3.5rem); 
  font-weight: 900;
  color: #fff;
  text-align: center;
  line-height: 1.1;
  /* 버튼 리스트와의 간격을 줄여서 화면 안으로 밀어 넣음 */
  margin-bottom: 6vh; 
  padding: 0;
  text-transform: uppercase;
}

/* 3. 안내 문구 (Select your language) */
.welcome-hint {
  font-size: 1.1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  margin-bottom: 1.5vh; /* 간격을 더 좁게 */
  letter-spacing: 0.02em;
}

/* 4. 버튼 컨테이너 */
.lang-btn-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
}

/* 언어 선택 버튼 (검정 네모 스타일 최종 통합본) */
.btn-lang {
  /* 아이폰 11 Pro 등 모바일 대응을 위해 너비 86vw로 소폭 조정 */
  width: min(340px, 86vw); 
  padding: 0.8rem 1.2rem;
  font-size: 1.45rem; /* 가독성을 고려한 크기 */
  font-weight: 500;
  font-family: inherit;
  color: #fff;
  background: rgba(17, 17, 17, 0.55) !important; 
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  
  /* 내부 정렬 핵심 로직 */
  display: flex;
  align-items: center;
  /*justify-content: center;
    gap: 0; */
  
  /* [핵심] justify-content를 center에서 flex-start로 변경하고 패딩으로 조절 */
  justify-content: flex-start !important;
  /* [수정] 이 수치를 조절하여 오른쪽으로 얼마나 밀지 결정하세요 (예: 15% ~ 25%) */
  padding-left: 27% !important; 
  
  transition: all 0.2s ease;


  /* 클릭 시 입체감을 위한 그림자 유지 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

/* 국기 이미지가 들어가는 컨테이너 (정렬의 핵심) */
.btn-lang img {
 width: 42px;        /* 국기 가로 크기 고정 */
  height: 28px;         /* 국기 세로 크기 고정 (미국 국기 비율 고려) */
  object-fit: contain;   /* 비율을 유지하며 고정된 영역 안에 안착 */
  margin-right: 20px;    /* 국기와 텍스트 사이의 일정한 간격 */
  flex-shrink: 0;        /* 크기 변형 방지 */
}

/* 텍스트 영역 (시안처럼 세로 줄을 맞추기 위함) */
.btn-lang span, 
.btn-lang-text {
  width: 120px;          /* 텍스트 시작 지점을 맞추기 위한 고정 너비 */
  text-align: left;      /* 글자 시작 위치 통일 */
  display: inline-block;
}

/* ============================================================
   인트로 화면 전용
   ============================================================ */

.page-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100svh;
  padding: 2rem 1.5rem;
}

.intro-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2rem;
}

.intro-desc {
  font-size: 1.2rem; /* 시안처럼 크게 */
  font-weight: 400;
  line-height: 1.6;
  color: #fff;
  text-align: center;
  margin-bottom: 4rem;
  white-space: pre-line;
}

/* 검정 네모 버튼 (시작하기) */
.btn-black-rect {
  width: min(340px, 90vw);
  padding: 1.2rem;
  background: rgba(17, 17, 17, 0.55) !important; 
  color: #fff;
  font-size: 1.6rem;
  font-weight: 500;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  margin-bottom: 1.5rem;
}

/* 언어 다시 선택 (언더라인 링크) */
.btn-link-text {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 1.1rem;
  text-decoration: underline;
  cursor: pointer;
}


/* ============================================================
   QUIZ
   ============================================================ */
.page-quiz {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* center보다 flex-start가 작은 폰에서 유리함 */
  height: 100svh;
  padding-top: calc(2vh + env(safe-area-inset-top));
  padding-bottom: 2vh;
  overflow-y: auto;
}
/* 뒤로가기 */
.back-btn {
  display: none; /* JS가 조작 */
  position: absolute;
  top: .9rem;
  left: .9rem;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.85);
  font-size: 1.6rem;
  cursor: pointer;
  padding: .2rem .55rem;
  border-radius: .5rem;
  transition: background .18s;
  z-index: 20;
  line-height: 1;
}
.back-btn:hover { background: rgba(255,255,255,.2); }

/* 진행 바 */
.progress-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: .6rem;
}
.progress-track {
  width: 78%;
  max-width: 300px;
  height: .6rem;
  background: rgba(255,255,255,.3);
  border-radius: 9999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 9999px;
  width: 0%;
  transition: width .4s ease;
}

/* Q번호 / 안내 */
.q-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: rgba(255,255,255,.7);
  text-align: center;
  margin: .4rem 0 .2rem;
}
.q-inst {
  font-size: .82rem;
  color: rgba(255,255,255,.62);
  text-align: center;
  max-width: 82%;
  line-height: 1.45;
  margin-bottom: 1rem;
  white-space: pre-line; /* 이 속성이 있어야 \n이 작동합니다 */
}

/* 카드 래퍼 (슬라이드 애니메이션 대상) */
#q-content-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  will-change: transform, opacity;
}

/* 질문 카드 */
.q-card {
  width: 92%;
  max-width: 360px;
  background: var(--bg-fallback);
  background-image: var(--bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: .85rem;
  box-shadow: 0 6px 12px rgba(0,0,0,.15);
  padding: 1.2rem;
}
.q-title {
  font-size: 1.10rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
  white-space: pre-line;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
/* 글자가 많을 때 적용될 클래스 */
.q-title.font-small {
  font-size: 1rem;      /* 크기를 살짝 줄임 */
  letter-spacing: -0.03em; /* 자간을 살짝 좁혀서 한눈에 들어오게 함 */
  line-height: 1.4;     /* 행간 조절 */
}

/* 선택지 버튼 */
.q-opts { display: flex; flex-direction: column; gap: 0.6rem; }

/* 선택지 버튼 - 안정화 버전 */
/* 1. 기본 버튼 스타일 (평소 상태) */
.opt-btn {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.8rem 1rem;
  font-size: 0.9rem; /* 기본 크기 */
  font-family: inherit;
  font-weight: 400;
  color: #fff;

  /* [수정] 배경색 0.55로 고정 */
  background: rgba(17, 17, 17, 0.55) !important; 
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.75rem;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: pre-line; /* 이 속성이 있어야 \n이 작동합니다 */
  word-break: keep-all;  /* 단어 단위로 끊어지게 하여 문맥 유지 */
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.2s;
  
  /* [수정] 애니메이션 최소화 (잔상 방지) */
  transition: none !important; 
  transform: none !important;
 /* [수정] 그림자를 조금씩만 빼서 은은하게 설정 */
  /* 세로 이동: 4px -> 2px | 퍼짐 정도: 10px -> 8px | 투명도: 0.2 -> 0.15 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  
  /* 포커스 시 생기는 외곽선 제거 */
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}
/* 2. 마우스 호버 시 - 올라가는 효과 제거 */
.opt-btn:hover {
  transform: none !important; 
  background: rgba(17, 17, 17, 0.57) !important; /* 살짝만 변하게 */
}

/* 3. [핵심] 선택된 상태 (.chosen) - 평소와 똑같이 만들기 */
.opt-btn.chosen {
  /* [수정] 평소 상태인 0.55와 완벽히 동일하게 설정 */
  background: rgba(17, 17, 17, 0.55) !important; 
  
  /* 위치 이동과 그림자 효과를 완전히 죽임 */
  transform: none !important; 
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15) !important;
  
  /* 테두리만 아주 미세하게 밝게 하여 최소한의 클릭 느낌만 유지 */
  border-color: rgba(255, 255, 255, 0.4) !important; 
}

/* 텍스트가 길 경우 */
.opt-btn.text-small {
  font-size: 0.85rem !important;
  line-height: 1.35;
  letter-spacing: -0.04em;
}

/* ============================================================
   RESULT
   ============================================================ */
.page-result {
  align-items: stretch;
  padding: 2.5rem 1.2rem 2rem;
  overflow-y: auto;
  height: 100svh;
  gap: 1rem;
}

.res-logo {
  font-size: 2.3rem;
  font-weight: 900;
  line-height: .9;
  color: rgba(255,255,255,.95);
  letter-spacing: .02em;
  text-align: center;
}

.res-mbti-block,
.res-card {
  background: rgba(55,55,55,.88);
  border-radius: 1rem;
  padding: 1.2rem 1.25rem;
  box-shadow: 0 10px 24px rgba(0,0,0,.2);
  /* [핵심] 중앙 정렬 설정 */
  display: flex;
  flex-direction: column;
  align-items: center;      /* 가로축 중앙 정렬 */
  text-align: center;       /* 텍스트 자체 중앙 정렬 */
}

/* MBTI 코드 (예: DRNT) */
.res-code {
  font-size: 3.5rem;        /* 크기를 소폭 키워 강조 */
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.05em;
  line-height: 1;
  margin-bottom: 1rem;      /* 하단 설명과의 간격 확보 */
}

/* 피부 타입/고민 설명 행 */
.res-type-row { 
  display: flex; 
  align-items: center;      /* 레이블과 가치 텍스트 높이 맞춤 */
  justify-content: center;  /* [핵심] 가로축 중앙 정렬 */
  gap: 0.5rem;              /* 레이블과 텍스트 사이 간격 */
  margin-top: 0.3rem; 
}

.res-label { 
  display:none;
  font-size: .85rem;        /* 가독성을 위해 소폭 상향 */
  color: rgba(255,255,255,.6); 
  white-space: nowrap; 
}

.res-type-val { 
  font-size: 1rem;          /* 가독성을 위해 소폭 상향 */
  color: rgba(255,255,255,.95); 
  font-weight: 700; 
}

.res-card-title {
  width: 93%;             /* 부모 안에서 가로폭을 꽉 채워야 왼쪽 정렬이 보입니다 */
  text-align: left;        /* [핵심] 왼쪽 정렬로 강제 설정 */
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: rgba(255,255,255,.85);
  text-transform: uppercase;
  margin-bottom: .8rem;
  /* 만약 패딩이 필요하다면 살짝 추가 */
  padding-left: 0.2rem;
}

.res-pill-list { 
  display: flex; 
  flex-direction: column; 
  gap: .65rem;
  width: 100%;
  align-items: center;      /* 내부 항목들을 중앙으로 */
  }

.res-pill,
.res-cos-item {
  width: 92%;
  margin: 0 auto;
  background: rgba(255,255,255,.94);
  color: #2a2a2a;
  border-radius: .85rem;
  padding: .9rem 1.2rem;
  text-align: center;
  font-weight: 800;
  font-size: .95rem;
  line-height: 1.45;
  white-space: pre-line !important; /* 줄바꿈 기호 인식 */
  line-height: 1.4;                /* 두 줄이 되었을 때 줄 간격 확보 */
  text-decoration: none;
  word-break: keep-all;            /* 단어 단위로 자연스럽게 끊기 */
}

/* 추천 시술 버튼 (링크 스타일) */
.res-pill.link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none; /* 링크 밑줄 제거 */
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    border: none;
    outline: none;
}

/* 클릭 시 반응 (피드백) */
.res-pill.link-btn:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.85);
}

/* 화장품 토글 */
.res-cos-header {
  width: 93%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: .8rem;
}
.res-cos-header .res-card-title { margin-bottom: 0; }
.res-arrow { font-size: .95rem; color: rgba(255,255,255,.75); transition: transform .28s; }
.res-arrow.closed { transform: rotate(-90deg); }

.res-cos-hint {
  width: 90%;
  margin: 0.1rem auto 0.1rem; /* 위로 1.5rem, 아래로 1rem 여백 */
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8); /* 흰색 배경 위라면 어둡게, 어두운 배경이면 밝게 조절 */
  text-align: center;
  line-height: 1.5;
  word-break: keep-all;
  font-weight: 400; /* 너무 굵지 않게 */
}

/* 재시작 버튼 */
.res-restart-btn {
  width: 100%;
  padding: .95rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 700;
  color: rgba(255,255,255,.93);
  background: rgba(255,255,255,.14);
  border: none;
  border-radius: .85rem;
  cursor: pointer;
  transition: background .2s;
  margin-top: .25rem;
}
.res-restart-btn:hover { background: rgba(255,255,255,.26); }

/* ============================================================
   애니메이션 (전체 화면용)
   ============================================================ */
@keyframes fadeUp    { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:none; } }
@keyframes slideR    { from { opacity:0; transform:translateX(30px); } to { opacity:1; transform:none; } }
@keyframes slideL    { from { opacity:0; transform:translateX(-30px);} to { opacity:1; transform:none; } }
.anim-fade  { animation: fadeUp .3s ease both; }
.anim-right { animation: slideR .3s ease both; }
.anim-left  { animation: slideL .3s ease both; }

/* ============================================================
   카드 전용 슬라이드 애니메이션 (퀴즈 내 질문 전환용)
   ============================================================ */
@keyframes cardOutL { from { opacity:1; transform:translateX(0);   } to { opacity:0; transform:translateX(-40px); } }
@keyframes cardOutR { from { opacity:1; transform:translateX(0);   } to { opacity:0; transform:translateX(40px);  } }
@keyframes cardInR  { from { opacity:0; transform:translateX(50px);} to { opacity:1; transform:translateX(0);    } }
@keyframes cardInL  { from { opacity:0; transform:translateX(-50px);} to { opacity:1; transform:translateX(0);  } }
.card-exit-left  { animation: cardOutL .18s ease forwards; pointer-events:none; }
.card-exit-right { animation: cardOutR .18s ease forwards; pointer-events:none; }
.card-enter-right { animation: cardInR .25s ease both; }
.card-enter-left  { animation: cardInL .25s ease both; }

/* ============================================================
   반응형
   ============================================================ */
@media (max-width: 390px) {
  .btn-lang    { width: 88vw; }
  .q-card      { max-width: 97vw; }
  .res-code    { font-size: 2.5rem; }
  .page-result { padding: 1.5rem .9rem; }
}