/* ===== 기본 ===== */
:root {
  --bg: #fdf8f1;
  --card: #ffffff;
  --text: #2b2420;
  --sub: #7a6e66;
  --line: #eee4d8;
  --point: #ff7a59;
  --point-dark: #e9603f;
  --soft: #fff1e6;
  --radius: 18px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  word-break: keep-all;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.wrap { max-width: 480px; margin: 0 auto; padding: 0 16px; }

/* ===== 헤더 / 푸터 ===== */
.site-header { padding: 14px 0; border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: -0.5px; }
.logo span { color: var(--point); }
.site-footer { margin-top: 48px; padding: 24px 0 40px; border-top: 1px solid var(--line); font-size: 13px; color: var(--sub); text-align: center; }
.site-footer nav { display: flex; justify-content: center; gap: 16px; margin-bottom: 8px; }
.site-footer nav a:hover { color: var(--text); }

/* ===== 메인 ===== */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: 24px; line-height: 1.35; letter-spacing: -0.5px; }
.hero p { color: var(--sub); margin-top: 6px; font-size: 15px; }
.test-list { display: grid; gap: 14px; margin-top: 20px; }
.test-card { display: block; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 10px rgba(80, 50, 20, .06); transition: transform .15s; }
.test-card:active { transform: scale(.98); }
.test-card .thumb { aspect-ratio: 16 / 9; background: var(--soft); object-fit: cover; width: 100%; }
.test-card .body { padding: 14px 16px 16px; }
.test-card .badge { display: inline-block; font-size: 12px; font-weight: 700; color: var(--point); background: var(--soft); padding: 2px 8px; border-radius: 99px; margin-bottom: 6px; }
.test-card h2 { font-size: 18px; line-height: 1.35; }
.test-card p { font-size: 14px; color: var(--sub); margin-top: 4px; }

/* ===== 버튼 ===== */
.btn { display: block; width: 100%; padding: 16px; border-radius: 14px; font-weight: 700; font-size: 17px; text-align: center; }
.btn-primary { background: var(--point); color: #fff; }
.btn-primary:active { background: var(--point-dark); }
.btn-line { background: var(--card); border: 1.5px solid var(--line); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== 테스트 인트로 ===== */
.intro { padding: 28px 0; text-align: center; }
.intro img { width: 100%; border-radius: var(--radius); background: var(--soft); }
.intro h1 { font-size: 24px; margin-top: 20px; line-height: 1.35; }
.intro p { color: var(--sub); margin: 8px 0 24px; }
.intro .meta { font-size: 13px; color: var(--sub); margin-top: 12px; }

/* ===== 문항 ===== */
.quiz { padding: 20px 0; }
.quiz-top { display: flex; align-items: center; gap: 12px; }
.back-btn { font-size: 22px; width: 36px; height: 36px; border-radius: 50%; background: var(--card); flex-shrink: 0; }
.back-btn:disabled { opacity: .3; }
.progress { flex: 1; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--point); border-radius: 99px; transition: width .25s; }
.progress-num { font-size: 13px; color: var(--sub); min-width: 40px; text-align: right; }
.q-num { margin-top: 36px; font-weight: 800; color: var(--point); }
.q-text { font-size: 22px; line-height: 1.4; margin: 6px 0 28px; min-height: 62px; letter-spacing: -0.3px; }
.options { display: grid; gap: 10px; }
.option { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 16px; text-align: left; font-size: 16px; transition: border-color .1s, background .1s; }
.option:active, .option.selected { border-color: var(--point); background: var(--soft); }
.loading { padding: 120px 0; text-align: center; color: var(--sub); }
.loading .spinner { width: 44px; height: 44px; border: 4px solid var(--line); border-top-color: var(--point); border-radius: 50%; margin: 0 auto 16px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 결과 ===== */
.result { padding: 24px 0; }
.result-card { background: var(--card); border-radius: var(--radius); padding: 24px 20px; text-align: center; box-shadow: 0 2px 10px rgba(80, 50, 20, .06); }
.result-card .label { font-size: 14px; color: var(--sub); }
.result-card h1 { font-size: 28px; margin: 4px 0 12px; letter-spacing: -0.5px; }
.result-card img { width: 72%; margin: 0 auto; }
.result-card .summary { font-size: 17px; font-weight: 700; margin-top: 14px; line-height: 1.45; }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.tags span { font-size: 13px; background: var(--soft); color: var(--point-dark); padding: 3px 10px; border-radius: 99px; }
.section { margin-top: 20px; background: var(--card); border-radius: var(--radius); padding: 20px; }
.section h2 { font-size: 17px; margin-bottom: 10px; }
.section p + p { margin-top: 10px; }
.section ul { padding-left: 18px; }
.section li + li { margin-top: 4px; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match a { background: var(--bg); border-radius: 14px; padding: 12px; text-align: center; }
.match small { display: block; font-size: 12px; color: var(--sub); }
.match img { width: 64px; margin: 6px auto; }
.match strong { font-size: 15px; }
.rel + .rel { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.rel h3 { font-size: 15px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.rel p { font-size: 15px; color: #4a403a; }
.match-row { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; }
.match-row + .match-row { margin-top: 10px; }
.match-row.good { background: #fff1e6; }
.match-row.bad { background: #f2f0ee; }
.match-row img { width: 72px; flex-shrink: 0; }
.match-row small { display: block; font-size: 12px; font-weight: 700; color: var(--point-dark); }
.match-row.bad small { color: #7a6e66; }
.match-row strong { font-size: 16px; }
.match-row p { font-size: 13px; color: #5a504a; margin-top: 2px; line-height: 1.5; }
.match.grid4 { grid-template-columns: repeat(3, 1fr); }
.match.grid4 a { padding: 8px 4px; }
.match.grid4 strong { font-size: 13px; }
.actions { margin-top: 20px; display: grid; gap: 10px; }
.disclaimer { margin-top: 16px; font-size: 12px; color: var(--sub); text-align: center; }
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px); background: rgba(43, 36, 32, .92); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 10; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 광고 슬롯 (광고 코드 넣기 전엔 안 보임) ===== */
.ad-slot { margin: 20px 0; text-align: center; }
.ad-slot:empty { display: none; }

/* ===== 일반 문서 페이지 (소개/개인정보/문의) ===== */
.doc { padding: 28px 0; }
.doc h1 { font-size: 24px; margin-bottom: 16px; }
.doc h2 { font-size: 17px; margin: 24px 0 8px; }
.doc p, .doc li { font-size: 15px; color: #4a403a; }
.doc ul { padding-left: 18px; }

/* ===== 배경 장식 캐릭터 ===== */
.has-deco { position: relative; }
.has-deco > *:not(.deco) { position: relative; z-index: 1; }
.deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: visible; }
.deco img { position: absolute; opacity: .28; transform: rotate(var(--rot)); animation: float 3.2s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: rotate(var(--rot)) translateY(0); } 50% { transform: rotate(var(--rot)) translateY(-6px); } }

/* ===== 결과 대기: 캐릭터 폴짝 ===== */
.loading .hop { display: flex; justify-content: center; gap: 10px; height: 110px; align-items: flex-end; margin-bottom: 18px; }
.loading .hop img { width: 72px; animation: hop .9s ease-in-out infinite; }
.loading .hop img:nth-child(2) { animation-delay: .15s; }
.loading .hop img:nth-child(3) { animation-delay: .3s; }
@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1.06, .94); }
  40% { transform: translateY(-30px) scale(.96, 1.04); }
  60% { transform: translateY(-30px) scale(.96, 1.04); }
}
.loading .steam { font-size: 15px; font-weight: 700; color: var(--text); }
.loading .dots::after { content: ''; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@media (prefers-reduced-motion: reduce) { .deco img, .loading .hop img { animation: none; } }

/* ===== 카카오 버튼 (카카오 가이드 색상) ===== */
.btn-kakao { background: #fee500; color: #191919; }
.btn-kakao:active { background: #f5dc00; }
.btn-soft { background: var(--soft); color: var(--point-dark); }

/* ===== 공유 아이콘 (앱 아이콘 스타일) ===== */
.share-box h2 { margin-bottom: 16px; }
.share-icons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.share-icons button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; }
.app-ic {
  width: 60px; height: 60px; border-radius: 16px;  /* 앱 아이콘처럼 둥근 사각형 */
  display: grid; place-items: center; position: relative; overflow: hidden;
  box-shadow: 0 4px 10px rgba(60, 40, 20, .14), inset 0 -2px 0 rgba(0, 0, 0, .08);
  transition: transform .12s;
}
.app-ic::after { /* 위쪽 은은한 광택 */
  content: ''; position: absolute; inset: 0 0 50% 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0));
}
.app-ic svg { width: 40px; height: 40px; position: relative; z-index: 1; }
.share-icons button:active .app-ic { transform: scale(.92); }
.app-label { font-size: 13px; font-weight: 600; color: var(--text); }
.ic-kakao { background: linear-gradient(160deg, #ffeb3b, #fdd800); }
.ic-insta { background: linear-gradient(45deg, #ffb340 0%, #ff5a5f 45%, #d9358f 75%, #8f4dff 100%); }
.ic-link { background: linear-gradient(160deg, #9aa4b2, #6b7686); }

/* ===== 전체 중 N% ===== */
.ratio { margin-top: 16px; padding: 12px; border-radius: 14px; background: var(--bg); }
.ratio div { font-size: 16px; }
.ratio b { color: var(--point-dark); font-size: 20px; }
.ratio small { display: block; font-size: 14px; font-weight: 700; margin-top: 2px; }
.ratio em { display: block; font-style: normal; font-size: 11px; color: var(--sub); margin-top: 4px; }
