:root {
  --bg: #f4f1fb;
  --surface: #ffffff;
  --text: #24212e;
  --muted: #7a7590;
  --line: #e9e5f5;
  --primary: #7c5cff;
  --primary-soft: #efeaff;
  --radius: 20px;
  --shadow: 0 6px 24px rgba(60, 40, 140, 0.08);
  --accent: #7c5cff; /* 테스트별 색상으로 바뀜 */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  line-height: 1.6;
  word-break: keep-all;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

/* 모바일 화면 기준 폭. PC에서는 가운데 정렬로 보여요. */
.container { max-width: 520px; margin: 0 auto; padding: 0 16px 40px; min-height: 70vh; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(244, 241, 251, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.site-header .logo {
  display: flex; align-items: center; gap: 8px;
  max-width: 520px; margin: 0 auto; padding: 14px 16px;
  font-weight: 800; font-size: 18px; letter-spacing: -0.02em;
}
.logo-mark { font-size: 20px; }
.logo-sub { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }

.site-footer { text-align: center; font-size: 13px; color: var(--muted); padding: 24px 16px 40px; }
.site-footer p { margin: 4px 0; }
.site-footer a { text-decoration: underline; }
.muted { color: var(--muted); }

/* ---------- 홈 ---------- */
.hero { padding: 20px 4px 8px; }
.hero h1 { font-size: 26px; line-height: 1.35; margin: 0 0 6px; letter-spacing: -0.03em; }
.hero p { margin: 0; color: var(--muted); }

.test-grid { display: grid; gap: 14px; margin-top: 20px; }

.test-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.test-card:active { transform: scale(0.98); }
@media (hover: hover) { .test-card:hover { transform: translateY(-2px); } }
.test-card .thumb {
  flex: 0 0 72px; height: 72px; border-radius: 18px;
  display: grid; place-items: center; font-size: 40px;
}
.test-card h3 { margin: 0 0 2px; font-size: 17px; letter-spacing: -0.02em; }
.test-card p { margin: 0; font-size: 14px; color: var(--muted); }
.test-card .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* PC처럼 넓은 화면에서는 카드를 2열로 */
@media (min-width: 720px) {
  .container { max-width: 760px; }
  .site-header .logo { max-width: 760px; }
  .test-grid { grid-template-columns: 1fr 1fr; }
  .narrow { max-width: 520px; margin: 0 auto; }
}

/* ---------- 공통 카드 / 버튼 ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 20px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 14px 18px;
  border-radius: 16px; font-weight: 700; font-size: 17px;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-ghost { background: var(--surface); border: 1.5px solid var(--line); }
.btn-row { display: grid; gap: 10px; margin-top: 16px; }

/* ---------- 테스트 소개 ---------- */
.intro { text-align: center; padding-top: 16px; }
.intro .big-emoji {
  width: 140px; height: 140px; margin: 8px auto 16px; border-radius: 40px;
  display: grid; place-items: center; font-size: 76px;
}
.intro h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: -0.03em; line-height: 1.35; }
.intro .desc { color: var(--muted); margin: 0 0 6px; white-space: pre-line; }
.intro .meta { font-size: 13px; color: var(--muted); margin-bottom: 20px; }

/* ---------- 질문 ---------- */
.quiz-top { display: flex; align-items: center; gap: 12px; padding: 12px 0 8px; }
.back-btn { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; display: grid; place-items: center; }
.back-btn:hover { background: var(--line); }
.progress { flex: 1; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s ease; }
.progress-label { font-size: 13px; color: var(--muted); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

.question { padding: 24px 4px 20px; }
.question .qnum { color: var(--accent); font-weight: 800; font-size: 15px; }
.question h2 { font-size: 22px; line-height: 1.45; margin: 6px 0 0; letter-spacing: -0.02em; white-space: pre-line; }

.answers { display: grid; gap: 10px; }
.answer {
  width: 100%; text-align: left; padding: 18px; border-radius: 16px;
  background: var(--surface); border: 2px solid transparent; box-shadow: var(--shadow);
  font-size: 16px; line-height: 1.5; transition: border-color 0.12s, transform 0.12s;
}
.answer:active { transform: scale(0.98); }
@media (hover: hover) { .answer:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); } }
.answer.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, white); }

.fade-in { animation: fadeIn 0.3s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 로딩 ---------- */
.loading { text-align: center; padding: 80px 0; }
.loading .spinner {
  width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 50%;
  border: 6px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 결과 ---------- */
.friend-banner {
  margin-top: 12px; padding: 12px 16px; border-radius: 14px;
  background: var(--primary-soft); font-size: 14px; text-align: center;
}
.result-head { text-align: center; padding: 20px 0 8px; }
.result-head .label { font-size: 14px; color: var(--muted); }
.result-head .big-emoji { font-size: 96px; line-height: 1.1; margin: 10px 0; }
.result-head h1 { margin: 0; font-size: 28px; letter-spacing: -0.03em; color: var(--accent); }
.result-head .summary { margin: 8px 0 0; font-size: 17px; font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px 0 4px; }
.tag { padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--accent) 14%, white); color: color-mix(in srgb, var(--accent) 80%, black); }

.result-body { margin-top: 16px; }
.result-body h3 { font-size: 16px; margin: 0 0 10px; }
.result-body ul { margin: 0; padding-left: 20px; }
.result-body li { margin-bottom: 8px; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.match a { display: block; background: var(--surface); border-radius: 16px; padding: 14px 10px; text-align: center; box-shadow: var(--shadow); }
.match .m-label { font-size: 12px; color: var(--muted); }
.match .m-emoji { font-size: 34px; line-height: 1.3; }
.match .m-name { font-size: 14px; font-weight: 700; }

.share-title { text-align: center; font-weight: 700; margin: 28px 0 12px; }
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.share-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 4px 0; }
.share-btn .ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.ic-kakao { background: #fee500; color: #3c1e1e; }
.ic-link { background: #e9e5f5; }
.ic-x { background: #111; color: #fff; }
.ic-image { background: color-mix(in srgb, var(--accent) 20%, white); }

.section-title { font-size: 18px; margin: 36px 0 12px; letter-spacing: -0.02em; }

/* ---------- 대표 이미지 카드 (순정만화 등) ---------- */
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.feature-card {
  display: block; background: var(--surface); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform 0.15s ease;
}
.feature-card:active { transform: scale(0.98); }
@media (hover: hover) { .feature-card:hover { transform: translateY(-2px); } }
.feature-card .cover { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--line); }
.feature-card .body { padding: 12px 14px 14px; }
.feature-card h3 { margin: 6px 0 2px; font-size: 15px; line-height: 1.4; letter-spacing: -0.02em; }
.feature-card .meta { font-size: 12px; color: var(--muted); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; color: #fff; font-size: 12px; font-weight: 700; }
.mini-badge { font-size: 12px; font-weight: 700; }
.test-card img.thumb { object-fit: cover; }
.test-grid.one-col { grid-template-columns: 1fr; }

.intro-cover { display: block; width: 100%; max-width: 360px; aspect-ratio: 1 / 1; object-fit: cover; margin: 4px auto 16px; border-radius: 24px; box-shadow: var(--shadow); }
.intro .badge { margin-bottom: 8px; }
.btn-text { color: var(--muted); font-weight: 600; font-size: 15px; min-height: 44px; }

/* 배경 이미지가 있는 질문 */
.q-hero {
  position: relative; display: flex; align-items: flex-end;
  height: min(44vh, 400px); min-height: 240px; margin: 8px 0 16px;
  border-radius: var(--radius); overflow: hidden;
  background-color: var(--line); background-size: cover; background-position: center;
  box-shadow: var(--shadow);
}
.q-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(20, 14, 40, 0) 35%, rgba(20, 14, 40, 0.78) 100%);
}
.q-hero-text { position: relative; z-index: 1; padding: 20px; color: #fff; }
.q-hero-text .qnum { font-weight: 800; font-size: 15px; opacity: 0.9; }
.q-hero-text h2 { margin: 4px 0 0; font-size: 21px; line-height: 1.45; letter-spacing: -0.02em; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35); }

/* 캐릭터 결과 */
.rich-head { text-align: center; margin-top: 12px; padding: 20px 16px 24px; }
.rich-head .label { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.rich-head .char-img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; border-radius: 16px; background: var(--line); }
.rich-head .role { margin-top: 18px; font-weight: 700; color: var(--accent); font-size: 15px; }
.rich-head h1 { margin: 2px 0 0; font-size: 34px; letter-spacing: -0.03em; }
/* 캐릭터 대사: 테마색으로 크게 */
.rich-head .quote {
  margin: 16px 4px 4px; padding: 14px 18px;
  font-size: 19px; font-weight: 400; line-height: 1.5; letter-spacing: -0.02em; word-break: keep-all;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, white);
  border-radius: 18px;
}
.rich-head .quote .qm { font-size: 26px; line-height: 0; vertical-align: -0.2em; opacity: 0.45; margin: 0 2px; }
.rich-sec { margin-top: 14px; }
.rich-sec h3 { margin: 0 0 10px; font-size: 16px; color: var(--accent); }
.rich-sec p { margin: 0; }
.rich-sec ul { margin: 0; padding-left: 20px; }
.rich-sec li { margin-bottom: 8px; }
.rich-sec li:last-child { margin-bottom: 0; }
.love { margin: 0; }
.love dt { font-weight: 700; font-size: 14px; margin-top: 12px; }
.love dt:first-child { margin-top: 0; }
.love dd { margin: 2px 0 0; }
.heart-list { list-style: none; padding-left: 0 !important; }
.heart-list li { position: relative; padding-left: 24px; }
.heart-list li::before { content: "💗"; position: absolute; left: 0; font-size: 14px; top: 2px; }
.strength-list b { display: block; }
.catch p { font-size: 18px; font-weight: 700; text-align: center; padding: 4px 0; }

.match-list { display: grid; gap: 10px; }
.match-card { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.match-card img { flex: 0 0 76px; width: 76px; height: 76px; border-radius: 14px; object-fit: cover; }
.match-card .m-label { font-size: 12px; color: var(--muted); }
.match-card .m-name { font-weight: 800; font-size: 16px; }
.match-card .m-name .muted { font-weight: 500; font-size: 13px; }
.match-card p { margin: 4px 0 0; font-size: 14px; color: #4a4560; }
/* 잘 맞는 상대 = 초록, 안 맞는 상대 = 빨강 */
.match-card.good { background: #eefaf2; border: 2px solid #3fb96b; }
.match-card.bad { background: #fff0f0; border: 2px solid #e5534b; }
.match-card.good img { box-shadow: 0 0 0 3px #3fb96b; }
.match-card.bad img { box-shadow: 0 0 0 3px #e5534b; }
.match-card.good .m-label, .match-card.bad .m-label {
  display: inline-block; margin-bottom: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff;
}
.match-card.good .m-label { background: #2f9e57; }
.match-card.bad .m-label { background: #d9443c; }

/* ---------- 광고 자리 ---------- */
.ad-slot {
  margin: 20px 0; min-height: 100px; border-radius: 12px;
  border: 1.5px dashed #c9c3dd; color: #a49fb8; font-size: 13px;
  display: grid; place-items: center;
}

/* ---------- 토스트 / 모달 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  background: rgba(30, 27, 40, 0.92); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 100;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal {
  position: fixed; inset: 0; z-index: 90; background: rgba(20, 16, 35, 0.6);
  display: grid; place-items: center; padding: 16px;
}
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: 20px; padding: 18px; width: 100%; max-width: 420px; max-height: 92vh; overflow: auto; text-align: center; }
.modal-box img { width: 100%; border-radius: 12px; display: block; }
.modal-box p { font-size: 14px; color: var(--muted); margin: 12px 0 0; }

/* ---------- 개인정보처리방침 등 문서 페이지 ---------- */
.doc { padding-top: 16px; }
.doc h1 { font-size: 24px; }
.doc h2 { font-size: 17px; margin-top: 24px; }
.doc p, .doc li { font-size: 15px; color: #444; }
