:root {
  --bg: #f4ecdc;
  --paper: #fffdf8;
  --cream: #f6eedd;
  --cream-2: #efe3c9;
  --ink: #221d18;
  --ink-2: #5c534a;
  --line: #e6dac2;
  --olive: #5d7843;
  --olive-2: #4c6536;
  --mustard: #f5b94e;
  --orange: #e8743b;
  --radius: 28px;
  --radius-sm: 18px;
  --shadow: 0 2px 0 rgba(34, 29, 24, .06);
  --head: 'Jua', 'Noto Sans KR', sans-serif;
  --body: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
#q-intro, #q-main { display: flex; flex-direction: column; flex: 1; }
.crumb { font-size: 13px; color: var(--ink-2); margin: 4px 4px 0; }
.crumb a { text-decoration: none; font-weight: 700; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--head); font-weight: 400; line-height: 1.25; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 7vw, 40px); }
h2 { font-size: clamp(23px, 5vw, 28px); }
h3 { font-size: 20px; }
p { margin: 0 0 1em; }

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

/* ---------- header ---------- */
.site-head { padding: 14px 0; }
.site-head .wrap, .site-head .wrap-wide { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--head); font-size: 21px; }
.logo svg { width: 42px; height: 42px; background: var(--paper); border-radius: 50%; padding: 2px; }
.nav { display: flex; gap: 6px; }
.nav a { text-decoration: none; font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 999px; background: var(--paper); }
.nav a:hover { background: var(--cream-2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--head); font-size: 20px; text-decoration: none; cursor: pointer;
  border: 0; border-radius: 999px; padding: 13px 30px; min-height: 52px;
  background: var(--paper); color: var(--ink); transition: transform .12s ease;
}
.btn:active { transform: scale(.97); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark[disabled] { opacity: .35; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; }
.btn-line { background: transparent; border: 2.5px solid var(--ink); }

/* ---------- cards ---------- */
.card { background: var(--paper); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-cream { background: var(--cream); }

.hero {
  position: relative; overflow: hidden;
  background: var(--olive); color: #fff;
  border-radius: 34px; padding: 30px 24px 28px; margin: 8px 0 18px;
  min-height: 300px;
}
.hero h1 { color: #fff; max-width: 62%; }
.hero p { color: #eef3e4; max-width: 58%; font-weight: 500; }
.hero .hero-art { position: absolute; right: -24px; bottom: -14px; width: 56%; max-width: 260px; }
.hero .btn { margin-top: 6px; }
.hero .meta { font-size: 14px; opacity: .9; }

.topic {
  display: flex; align-items: center; gap: 14px; text-decoration: none;
  background: var(--paper); border-radius: var(--radius); padding: 22px 20px 22px 24px; margin-bottom: 14px;
}
.topic:hover { background: var(--cream-2); }
.topic .txt { flex: 1; min-width: 0; }
.topic h3 { margin-bottom: 4px; font-size: 22px; }
.topic p { margin: 0; color: var(--ink-2); font-size: 15px; }
.topic .art { display: flex; flex-shrink: 0; }
.topic .art svg, .topic .art img { width: 58px; height: 58px; margin-left: -14px; object-fit: contain; }

.section { margin: 34px 0; }
.section > h2 { margin-bottom: 14px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }

/* ---------- monster grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mon {
  display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none;
  background: var(--paper); border-radius: 24px; padding: 14px 8px 14px; border: 3px solid transparent;
}
.mon:hover { border-color: var(--ink); }
.mon svg, .mon img { width: 96px; height: 96px; object-fit: contain; }
.mon b { font-family: var(--head); font-weight: 400; font-size: 18px; line-height: 1.2; margin-top: 4px; }
.mon span { font-size: 13px; color: var(--ink-2); font-weight: 700; letter-spacing: .04em; }
.group-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 6px; }
.group-title i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }

/* ---------- FAQ ---------- */
details { background: var(--paper); border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 700; list-style: none; position: relative; padding-right: 28px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; position: absolute; right: 0; top: -2px; font-family: var(--head); font-size: 24px; }
details[open] summary::after { content: '−'; }
details p { margin: 10px 0 0; color: var(--ink-2); }

/* ---------- ads ---------- */
.ad { margin: 22px 0; min-height: 0; }
.ad-placeholder { display: none; }
html.adpreview .ad-placeholder {
  display: flex; align-items: center; justify-content: center; min-height: 120px;
  border: 3px dashed var(--orange); border-radius: 20px; color: var(--orange); font-weight: 700; font-size: 14px;
  background: repeating-linear-gradient(45deg, #fff5ea, #fff5ea 10px, #fdebd9 10px, #fdebd9 20px);
}
html.adpreview .ad-placeholder::before { content: '광고 위치: ' attr(data-ad); }

/* ---------- footer ---------- */
.site-foot { padding: 30px 0 46px; color: var(--ink-2); font-size: 14px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }
.site-foot a { text-decoration: none; font-weight: 700; }
.site-foot a:hover { text-decoration: underline; }

/* ======================================================
   QUIZ (test page) — mustard screen
   ====================================================== */
body.quiz-page { background: var(--mustard); min-height: 100vh; min-height: 100dvh; }
.quiz { max-width: 480px; margin: 0 auto; padding: 14px 16px 28px; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.circle-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 0; background: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-decoration: none; flex-shrink: 0;
}
.circle-btn svg { width: 24px; height: 24px; }
.quiz-title { font-family: var(--head); font-size: 22px; text-align: center; }
.pill { background: #fff; border-radius: 999px; padding: 10px 18px; font-family: var(--head); font-size: 19px; min-width: 76px; text-align: center; }
.progress { height: 8px; background: rgba(255,255,255,.45); border-radius: 99px; margin: 16px 4px 0; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 99px; transition: width .3s ease; }

.bubble-wrap { position: relative; margin: 34px 6px 26px; }
.bubble {
  position: relative; background: #fff; border-radius: 64px; padding: 40px 28px; min-height: 200px;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.bubble::before, .bubble::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.bubble::before { width: 110px; height: 110px; top: -30px; left: 22%; }
.bubble::after { width: 80px; height: 80px; top: -18px; right: 18%; }
.bubble .bump { position: absolute; background: #fff; border-radius: 50%; width: 90px; height: 90px; bottom: -24px; left: 12%; }
.bubble .bump.b2 { width: 70px; height: 70px; bottom: -16px; left: auto; right: 22%; }
.bubble p { position: relative; z-index: 1; margin: 0; font-family: var(--head); font-size: clamp(23px, 6vw, 30px); line-height: 1.35; }
.bubble .qnum { position: absolute; z-index: 1; top: 14px; left: 50%; transform: translateX(-50%); font-size: 13px; font-weight: 700; color: var(--ink-2); letter-spacing: .08em; }
.spark { position: absolute; left: -2px; bottom: -6px; width: 64px; height: 50px; }

.likert { background: #fff; border-radius: 30px; padding: 22px 16px 18px; }
.likert-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.likert button {
  border-radius: 50%; border: 3.5px solid; background: transparent; cursor: pointer; padding: 0; flex-shrink: 0;
  transition: transform .12s ease, background .15s ease;
}
.likert button:hover { transform: scale(1.08); }
.likert button:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.likert button.on { box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--ink); }
.likert .s3 { width: 50px; height: 50px; } .likert .s2 { width: 40px; height: 40px; } .likert .s1 { width: 32px; height: 32px; } .likert .s0 { width: 26px; height: 26px; }
.likert .agree { border-color: var(--olive); } .likert .agree.on { background: var(--olive); }
.likert .disagree { border-color: var(--orange); } .likert .disagree.on { background: var(--orange); }
.likert .neutral { border-color: #b9ad99; } .likert .neutral.on { background: #b9ad99; }
.likert-labels { display: flex; justify-content: space-between; margin-top: 12px; font-family: var(--head); font-size: 17px; }
.likert-labels .a { color: var(--olive); } .likert-labels .d { color: var(--orange); }
@media (max-width: 360px) {
  .likert .s3 { width: 40px; height: 40px; } .likert .s2 { width: 33px; height: 33px; } .likert .s1 { width: 27px; height: 27px; } .likert .s0 { width: 22px; height: 22px; }
}
.quiz-foot { margin-top: auto; padding-top: 22px; }
.quiz-hint { text-align: center; font-size: 13px; margin-top: 10px; color: #5a4520; }

.quiz-intro .bubble p { font-size: clamp(22px, 5.6vw, 28px); }
.intro-list { background: #fff; border-radius: 26px; padding: 18px 22px; margin: 0; list-style: none; }
.intro-list li { padding: 6px 0 6px 30px; position: relative; font-weight: 500; }
.intro-list li::before { content: ''; position: absolute; left: 4px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--mustard); }
.loading { text-align: center; padding: 50px 0; font-family: var(--head); font-size: 24px; }
.loading svg, .loading img { width: 140px; height: 140px; margin: 0 auto 10px; animation: bob 1s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-10px); } }

/* ======================================================
   TYPE / RESULT page
   ====================================================== */
.type-hero {
  position: relative; overflow: hidden; border-radius: 34px; padding: 26px 24px 24px; margin: 8px 0 16px;
  color: #fff; min-height: 320px;
}
.type-hero .you { display: none; font-weight: 700; font-size: 15px; opacity: .95; margin-bottom: 2px; }
html.is-result .type-hero .you { display: block; }
.type-hero .code { display: inline-block; background: rgba(255,255,255,.95); color: var(--ink); border-radius: 999px; padding: 4px 14px; font-weight: 700; letter-spacing: .08em; font-size: 15px; margin-bottom: 10px; }
.type-hero h1 { color: #fff; margin-bottom: 8px; max-width: 60%; }
.type-hero .catch { max-width: 56%; font-weight: 500; font-size: 16px; line-height: 1.55; margin: 0; }
.type-hero .elem { position: relative; z-index: 1; max-width: 58%; line-height: 1.5; display: inline-block; margin-top: 14px; font-size: 14px; font-weight: 700; background: rgba(0,0,0,.16); border-radius: 14px; padding: 4px 12px; }
.type-hero .art { position: absolute; right: -10px; bottom: -8px; width: 52%; max-width: 250px; background: rgba(255,255,255,.18); border-radius: 50%; }

.bars { display: none; }
html.is-result .bars { display: block; }
.bar { margin: 14px 0 18px; }
.bar-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.bar-head .on { color: var(--ink); } .bar-head .off { color: #a89c88; }
.bar-track { position: relative; height: 14px; border-radius: 99px; background: var(--cream-2); overflow: hidden; }
.bar-track i { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: var(--olive); }
.bar-pct { font-family: var(--head); font-size: 18px; margin-top: 4px; }

.share { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share .btn { font-size: 17px; padding: 12px 10px; min-height: 50px; }
.share .btn-dark { grid-column: 1 / -1; }

.list-dots { list-style: none; margin: 0; padding: 0; }
.list-dots li { position: relative; padding: 4px 0 4px 26px; }
.list-dots li::before { content: ''; position: absolute; left: 2px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--olive); }
.list-dots.warn li::before { background: var(--orange); }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match a { display: flex; flex-direction: column; align-items: center; text-decoration: none; background: var(--cream); border-radius: 24px; padding: 14px 8px; text-align: center; border: 3px solid transparent; }
.match a:hover { border-color: var(--ink); }
.match svg, .match img { width: 88px; height: 88px; object-fit: contain; }
.match small { font-weight: 700; color: var(--ink-2); font-size: 13px; }
.match b { font-family: var(--head); font-weight: 400; font-size: 18px; }

.cta-card { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 26px 24px; text-align: center; margin: 22px 0; }
.cta-card h2 { color: #fff; }
.cta-card .btn { margin-top: 6px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 700; transition: all .25s ease; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.prose h2 { margin-top: 1.2em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: 4px 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ======================================================
   MOBILE-ONLY FRAME: 데스크톱에서도 폰 너비(480px) 한 열로 표시
   ====================================================== */
html { background: #e3d5b8; }
body { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
@media (min-width: 520px) {
  body { box-shadow: 0 0 0 1px rgba(34,29,24,.05), 0 12px 48px rgba(34,29,24,.12); }
  html:has(body.quiz-page) { background: #e0a23c; }
}
.toast { max-width: 440px; }

/* ---------- images ---------- */
.hero .hero-art img, .type-hero .art img { width: 100%; height: auto; display: block; }
.type-hero .art img { padding: 6%; }
.pixel { image-rendering: pixelated; }
.logo img { width: 42px; height: 42px; background: var(--paper); border-radius: 50%; }

/* ---------- dex cards ---------- */
.mon { position: relative; }
.mon .no { position: absolute; top: 10px; left: 14px; font-size: 11px; font-weight: 700; color: #a89c88; letter-spacing: .02em; }
.mon .badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 6px; }
.badge { display: inline-block; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; padding: 5px 8px; border-radius: 999px; letter-spacing: 0; }
.topic .go { font-family: var(--head); font-size: 26px; }

.dex-tools { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0 6px; margin: 0 -2px; }
.dex-tools input {
  width: 100%; font: inherit; font-size: 16px; border: 2.5px solid var(--ink); border-radius: 999px;
  padding: 11px 18px; background: var(--paper); color: var(--ink); outline: none;
}
.dex-tools input:focus { box-shadow: 0 0 0 4px rgba(245,185,78,.5); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 700;
  border: 0; border-radius: 999px; padding: 8px 14px; background: var(--paper); color: var(--ink); cursor: pointer;
}
.chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chip.on { background: var(--ink); color: #fff; }

/* ---------- dex info ---------- */
.dex-info dl { margin: 0 0 12px; display: grid; gap: 8px; }
.dex-info dl > div { display: flex; gap: 12px; align-items: center; }
.dex-info dt { width: 72px; flex-shrink: 0; font-weight: 700; color: var(--ink-2); font-size: 14px; }
.dex-info dd { margin: 0; font-weight: 700; display: flex; gap: 6px; flex-wrap: wrap; }
.dex-info blockquote { margin: 0 0 8px; background: var(--cream); border-radius: 18px; padding: 14px 18px; font-weight: 500; }

/* ---------- similarity ranking ---------- */
.rank { display: none; }
html.is-result .rank { display: block; }
.rank-list { list-style: none; margin: 10px 0 14px; padding: 0; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.rank-list li.more { display: none; }
.rank-list.all li.more { display: flex; }
.rank-list .n { width: 26px; font-family: var(--head); font-size: 18px; text-align: center; flex-shrink: 0; }
.rank-list li:first-child .n { color: var(--orange); }
.rank-list img { width: 44px; height: 44px; flex-shrink: 0; }
.rank-list a { flex: 1; min-width: 0; text-decoration: none; }
.rank-list .nm { display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; }
.rank-list .nm small { color: var(--ink-2); font-weight: 700; }
.rank-list .track { display: block; height: 10px; border-radius: 99px; background: var(--cream-2); overflow: hidden; margin-top: 4px; }
.rank-list .track i { display: block; height: 100%; background: var(--olive); border-radius: 99px; }
.rank-list li:first-child .track i { background: var(--orange); }

/* ---------- share ---------- */
.btn-kakao { background: #fee500; color: #191600; grid-column: 1 / -1; }
.share .retry { grid-column: 1 / -1; }

/* 헤더: 긴 사이트 이름이 메뉴를 밀어내지 않도록 */
.logo { min-width: 0; font-size: 19px; }
.logo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo svg, .logo img { flex-shrink: 0; }
.nav { flex-shrink: 0; }
.nav a { white-space: nowrap; padding: 8px 12px; }

/* ---------- 허브 ---------- */
.hero-sea { background: #2f7fa6; }
.hero-sea p { color: #e3f3fb; }
.test-card {
  display: block; text-decoration: none; background: var(--paper); border-radius: var(--radius);
  padding: 20px 22px 22px; border: 3px solid transparent; margin-bottom: 10px;
}
.test-card:hover { border-color: var(--ink); }
.test-card .art { display: flex; justify-content: center; background: var(--cream); border-radius: 22px; padding: 10px 0 4px; margin-bottom: 14px; }
.test-card .art svg { width: 72px; height: 72px; margin: 0 -6px; }
.test-card h3 { font-size: 24px; margin-bottom: 6px; }
.test-card p { color: var(--ink-2); font-size: 15px; margin-bottom: 10px; }
.test-card .meta { display: inline-block; font-size: 13px; font-weight: 700; background: var(--mustard); border-radius: 999px; padding: 4px 12px; }

/* ---------- 가이드 글 ---------- */
.article h1 { font-size: clamp(26px, 6.4vw, 32px); }
.article h2 { font-size: 21px; margin-top: 1.4em; }
.article p, .article li { font-size: 16.5px; line-height: 1.85; }
.article .ad { margin: 26px -8px; }

/* ---------- 추천 취미 태그 ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tags span { background: var(--cream); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 700; }

/* ---------- 무료 MBTI 검사 (메인) ---------- */
.hero-badges { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 22px 26px 0; }
.hero-badges svg { width: 100%; height: auto; transform: rotate(-4deg); }
.hero-badges svg:nth-child(2n) { transform: rotate(5deg) translateY(10px); }
.hero-sea .hero-art { width: 44%; bottom: -6px; right: -6px; }
.hero-sea p { max-width: 54%; }
.hero-sea { min-height: 330px; }
.type-hero h1 .code { font-family: var(--body); margin-bottom: 4px; }
.mon-mbti svg { width: 84px; height: 84px; }
.mon-mbti b { font-size: 17px; margin-top: 8px; }
.type-hero .art svg { width: 100%; height: auto; padding: 10%; }

/* ---------- 연애 유형 테스트 ---------- */
.hero-love { background: #d63e57; }
.hero-love p { color: #ffe8ec; max-width: 54%; }
.hero-love .hero-art { width: 44%; bottom: -6px; right: -6px; }
.hero-love { min-height: 330px; }
body.quiz-love { background: #f4a3b2; }
html:has(body.quiz-love) { background: #e98798; }
