/* fun-lab 공통 스타일 — 흰 바탕·검정 글자·회색 1개·강조색 1개(고기 빨강: 진행 막대·주 버튼만)
   꾸밈(상자·그림자·그라데이션·이모지) 없이 글자 크기·굵기·여백으로만 구분합니다. */
@font-face { font-family: "Pretendard"; font-weight: 400; font-display: swap; src: url(fonts/Pretendard-Regular.subset.woff2) format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 600; font-display: swap; src: url(fonts/Pretendard-SemiBold.subset.woff2) format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 700; font-display: swap; src: url(fonts/Pretendard-Bold.subset.woff2) format("woff2"); }

:root {
  --bg: #ffffff;
  --text: #191919;
  --body: #333333;
  --sub: #8b8b8b;     /* 회색 (보조 글자) */
  --line: #ececec;    /* 얇은 구분선 */
  --soft: #f4f4f4;    /* 보기 버튼 바탕 */
  --accent: #8f2f2a;  /* 고기 빨강 — 진행 막대·주 버튼에만 */
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --text: #f2f2f2;
    --body: #d6d6d6;
    --sub: #9a9a9a;
    --line: #333336;
    --soft: #2a2a2d;
    --accent: #a63a33;
  }
}
* { 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", "Noto Sans KR", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -.2px;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, p { margin: 0; }
.wrap { max-width: 520px; margin: 0 auto; padding: 0 24px 40px; }

/* 상단 글자 링크 */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.topbar a { text-decoration: none; color: var(--sub); font-size: 14px; min-height: 48px; display: inline-flex; align-items: center; }

/* 버튼 */
.btn {
  display: block; width: 100%;
  border: 0; border-radius: 14px;
  padding: 16px 18px; min-height: 56px;
  font: inherit; font-size: 17px; font-weight: 600;
  text-align: center; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: .85; }
.btn-main { background: var(--accent); color: #fff; }
.links { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 28px; margin-top: 4px; }
.links [hidden] { display: none !important; }
.links a, .links button {
  background: none; border: 0; padding: 0 2px; min-height: 44px; display: inline-flex; align-items: center;
  font: inherit; font-size: 14px; color: var(--sub); text-decoration: none; cursor: pointer; letter-spacing: -.2px;
  -webkit-tap-highlight-color: transparent;
}

/* 화면 아래 고정 버튼 자리 (아이폰 아래 막대 피함) */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--bg);
  padding: 12px 24px calc(6px + env(safe-area-inset-bottom));
}
.dock > * { max-width: 472px; margin-left: auto; margin-right: auto; }
.has-dock { padding-bottom: calc(150px + env(safe-area-inset-bottom)); } /* result.js가 실제 높이로 다시 맞춤 */

/* 섹션 제목 */
.sec { margin-top: 44px; }
.sec h2 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.sec p { color: var(--body); line-height: 1.75; }
.sec p + p { margin-top: 6px; }

/* 하단 고지 */
.foot { margin-top: 56px; color: var(--sub); font-size: 12.5px; line-height: 1.6; }
.foot p { margin: 2px 0; }

.ico { display: block; }

/* ===== 사이트 첫 화면 ===== */
.home-head { padding-top: 56px; }
.home-head h1 { font-size: 32px; font-weight: 700; letter-spacing: -1px; line-height: 1.25; }
.home-head p { color: var(--sub); margin-top: 6px; }
.game-list { margin-top: 40px; border-top: 1px solid var(--line); }
.game { display: flex; align-items: center; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.game .ico { width: 56px; height: 56px; flex: none; }
.game b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -.4px; }
.game span { display: block; font-size: 14px; color: var(--sub); }
.game i { margin-left: auto; font-style: normal; color: var(--sub); }
.game.soon { color: var(--sub); }
.game.soon b { color: var(--sub); }

/* ===== 테스트 시작 ===== */
.start[hidden], .quiz[hidden], .loading[hidden] { display: none; }
.start { padding-top: 28px; }
.icon-row { display: flex; gap: 12px; }
.icon-row img { width: 52px; height: 52px; }
.start h1 { font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 1.3; margin-top: 28px; }
.start .sub { font-size: 18px; margin-top: 6px; }
.start .intro { color: var(--body); line-height: 1.75; margin-top: 24px; }
.start .meta { color: var(--sub); font-size: 14px; margin-top: 12px; }

/* ===== 질문 ===== */
.bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: var(--line); z-index: 6; }
.bar i { display: block; height: 3px; width: 0; background: var(--accent); transition: width .25s ease; }
.quiz { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; margin-bottom: -40px; padding-top: 36px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.q-top { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.count { font-size: 15px; color: var(--sub); font-weight: 600; }
.back { background: none; border: 0; color: var(--sub); font: inherit; font-size: 14px; min-height: 44px; padding: 0 2px; cursor: pointer; }
.back:disabled { visibility: hidden; }
.qtext { font-size: 27px; font-weight: 700; line-height: 1.42; letter-spacing: -.8px; margin-top: 12px; text-wrap: balance; }
.opts { margin-top: auto; padding-top: 40px; }
.opt {
  display: block; width: 100%; text-align: left;
  background: var(--soft); color: var(--text);
  border: 0; border-radius: 14px;
  padding: 20px; min-height: 64px; margin-top: 10px;
  font: inherit; font-size: 17px; line-height: 1.45; letter-spacing: -.3px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.opt.picked { box-shadow: inset 0 0 0 2px var(--text); }
.loading { padding-top: 120px; color: var(--sub); }

/* ===== 결과 ===== */
.friend { display: block; color: var(--text); font-size: 14.5px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.friend b { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.friend[hidden] { display: none; }
.res-head { padding-top: 28px; }
.res-head .ico { width: 104px; height: 104px; }
.res-pre { color: var(--sub); font-size: 15px; margin-top: 24px; }
.res-head h1 { font-size: 40px; font-weight: 700; letter-spacing: -1.6px; line-height: 1.2; margin-top: 6px; }
.res-nick { font-size: 18px; margin-top: 10px; letter-spacing: -.3px; }
.res-traits { font-size: 14px; color: var(--sub); margin-top: 12px; }
.res-body { margin-top: 40px; }
.res-body p { color: var(--body); line-height: 1.75; }
.res-body p + p { margin-top: 16px; }
.pair { border-top: 1px solid var(--line); }
.pair a { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.pair .ico { width: 44px; height: 44px; flex: none; }
.pair small { display: block; color: var(--sub); font-size: 12.5px; }
.pair b { display: block; font-size: 16px; font-weight: 600; }
.pair span { display: block; font-size: 14px; color: var(--sub); line-height: 1.5; }
.sec .hint { font-size: 13px; color: var(--sub); margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%); opacity: 0; background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14.5px; transition: opacity .2s ease; pointer-events: none; z-index: 10; width: max-content; max-width: 90vw; }
.toast.on { opacity: 1; }
/* 결과 카드 크게 보기 (길게 눌러 저장) */
.img-view { position: fixed; inset: 0; z-index: 20; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 24px calc(24px + env(safe-area-inset-bottom)); }
.img-view img { display: block; width: auto; max-width: 100%; max-height: 68vh; height: auto; border: 1px solid var(--line); border-radius: 12px; -webkit-touch-callout: default; }
.img-view p { color: var(--text); font-size: 15px; text-align: center; }
.img-view .btn { max-width: 472px; }
.img-view .img-note { color: var(--sub); font-size: 13px; max-width: 472px; }
.btn-sub { background: var(--soft); color: var(--text); }
@media (prefers-color-scheme: dark) { .img-view { background: #1c1c1e; } }

/* ===== 16유형 보기 ===== */
.types-head { padding-top: 28px; }
.types-head h1 { font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 1.3; }
.types-head p { color: var(--sub); margin-top: 6px; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; row-gap: 28px; margin-top: 36px; }
.type-item { display: block; text-decoration: none; color: var(--text); min-width: 0; }
.type-item .ico { width: 64px; height: 64px; }
.type-item b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -.4px; margin-top: 8px; }
.type-item span { display: block; color: var(--sub); font-size: 13.5px; }
.axis-note { font-size: 14.5px; }
.axis-list { margin-top: 14px; border-top: 1px solid var(--line); }
.axis-list div { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; color: var(--sub); line-height: 1.6; }
.axis-list b { display: block; color: var(--text); font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.types-cta { margin-top: 40px; }

/* 시작 버튼 (본문 안) */
.start-go { margin-top: 28px; }
/* 결과 본문 끝 글자 링크 */
.more { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-top: 48px; }
.more a { font-size: 15px; font-weight: 600; color: var(--text); text-underline-offset: 4px; min-height: 44px; display: inline-flex; align-items: center; }
/* 다크모드: 아이콘 외곽선이 바탕에 묻히지 않게 모든 아이콘 뒤에 밝은 둥근 바탕 */
@media (prefers-color-scheme: dark) {
  img.ico { background: #ece7df; border-radius: 28%; box-sizing: border-box; padding: 5px; }
  .res-head img.ico { padding: 10px; }
  .pair img.ico { padding: 4px; }
  .type-item img.ico { padding: 6px; }
}

/* 첫 화면 제목 옆 마스코트(잔디 머리) — 글자 높이에 맞춰 한 줄 */
.home-head h1 { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.home-head .mascot { display: block; width: auto; height: 44px; flex: none; margin-top: -4px; }

/* 카톡 안 브라우저 안내 (assets/inapp.js가 카톡일 때만 넣음) */
.inapp-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 20px; background: var(--soft); font-size: 13.5px; line-height: 1.4; }
.inapp-bar p { flex: 1; min-width: 0; color: var(--text); }
.inapp-open { flex: none; padding: 8px 12px; min-height: 40px; display: inline-flex; align-items: center; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; font-size: 13.5px; }
.inapp-x { flex: none; width: 40px; height: 40px; border: 0; background: none; color: var(--sub); font-size: 22px; line-height: 1; cursor: pointer; }
.inapp-ask { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0, 0, 0, .5); }
.inapp-card { width: 100%; max-width: 360px; background: var(--bg); color: var(--text); border-radius: 20px; padding: 24px 22px 12px; text-align: center; }
.inapp-card img { display: block; margin: 0 auto; width: 104px; height: auto; }
.inapp-t { font-size: 19px; font-weight: 700; letter-spacing: -.5px; margin-top: 12px; }
.inapp-d { color: var(--body); font-size: 15px; line-height: 1.6; margin-top: 8px; word-break: keep-all; }
.inapp-card .btn { margin-top: 20px; }
.inapp-stay { display: block; width: 100%; min-height: 48px; margin-top: 4px; border: 0; background: none; font: inherit; font-size: 15px; color: var(--sub); cursor: pointer; }
@media (prefers-color-scheme: dark) { .inapp-card img { background: #ece7df; border-radius: 24px; padding: 6px; } }
.inapp-card:focus { outline: none; }
