:root {
  --theme: #ffe3ec;
  --accent: #f08aa8;
  --ink: #2b2b2b;
  --muted: #6b6b6b;
  --card: #fff;
  --radius: 22px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--ink);
  background: linear-gradient(180deg, var(--theme) 0%, #fffdf7 60%, #fff 100%);
  min-height: 100vh;
  transition: background .4s;
  -webkit-font-smoothing: antialiased;
}
body { position: relative; }
body::before {
  content: "";
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,.7) 2px, transparent 2.5px);
  background-size: 28px 28px;
  opacity: .6;
}
#app { max-width: 520px; margin: 0 auto; padding: 24px 18px 56px; }
.screen { animation: pop .35s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

h1 { font-size: 28px; margin: 10px 0 6px; text-align: center; letter-spacing: -0.5px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; margin: 18px 0 10px; }
.lead { text-align: center; color: var(--muted); margin: 0 0 16px; line-height: 1.5; }
.hint { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* intro */
.hero-chars { display: flex; justify-content: center; gap: 6px; margin-top: 24px; }
.hero-char { filter: drop-shadow(0 6px 0 rgba(0,0,0,.08)); }
.float { animation: float 3s ease-in-out infinite; }
.hero-char:nth-child(2) { animation-delay: .5s; }
.hero-char:nth-child(3) { animation-delay: 1s; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
.stat-pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.pill { background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.invite { display: flex; gap: 12px; align-items: center; background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 12px 14px; margin: 14px 0; font-size: 14px; line-height: 1.4; }
.invite small { color: var(--muted); }
.invite-char svg { display: block; }

/* buttons */
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.btn {
  appearance: none; border: 2px solid var(--ink); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 12px 18px; font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s;
  font-family: inherit;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.big { padding: 16px 22px; font-size: 17px; }
.btn.ghost { box-shadow: none; border-color: rgba(43,43,43,.25); font-weight: 600; }
.btn:disabled { opacity: .6; cursor: wait; }

/* quiz */
.progress { height: 10px; background: rgba(0,0,0,.08); border-radius: 999px; overflow: hidden; margin: 8px 0 18px; }
.progress .bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.qnum { font-weight: 800; color: var(--accent); font-size: 14px; }
.qnum span { color: var(--muted); font-weight: 600; }
.question { margin: 6px 0 18px; line-height: 1.4; min-height: 62px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  text-align: left; background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 15px 16px;
  font-size: 15px; font-weight: 600; cursor: pointer; line-height: 1.4; box-shadow: 0 3px 0 var(--ink);
  font-family: inherit; color: var(--ink); transition: transform .08s, background .12s;
}
.opt:hover { background: var(--theme); }
.opt.sel { background: var(--accent); color: #fff; transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.quiz-nav { display: flex; justify-content: flex-start; margin-top: 18px; }

/* result */
.card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 20px 18px; margin-bottom: 16px; box-shadow: 0 6px 0 rgba(43,43,43,.9); }
.main-card { text-align: center; }
.result-label { font-size: 14px; color: var(--muted); font-weight: 600; }
.big-chara { margin: 4px auto; filter: drop-shadow(0 8px 0 rgba(0,0,0,.06)); }
.big-chara svg { display: block; margin: 0 auto; }
.name { font-size: 36px; margin: 0; color: var(--accent); }
.title { font-weight: 700; font-size: 17px; margin-top: 4px; }
.tags { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.tags span { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--theme); border-radius: 999px; padding: 4px 10px; }
.desc { text-align: left; line-height: 1.65; font-size: 15px; color: #3a3a3a; margin: 10px 0 14px; }
.radar-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; }
.radar { width: 100%; max-width: 240px; overflow: visible; }
.stat-list { display: flex; flex-direction: column; gap: 7px; }
.stat-row { display: grid; grid-template-columns: 58px 1fr 28px; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; text-align: left; }
.stat-bar { height: 10px; background: rgba(0,0,0,.08); border-radius: 999px; overflow: hidden; }
.stat-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .6s; }
.stat-val { text-align: right; color: var(--muted); }
.stat-summary { font-size: 14px; color: var(--muted); margin: 12px 0 0; }
.stat-summary b { color: var(--ink); }
@media (max-width: 400px) { .radar-wrap { grid-template-columns: 1fr; } .radar { margin: 0 auto; } }

.compare-card { text-align: center; background: linear-gradient(180deg, #fff, var(--theme)); }
.compare-heads { display: flex; justify-content: center; align-items: center; gap: 14px; }
.compare-heads .chara { display: flex; flex-direction: column; align-items: center; font-weight: 700; font-size: 14px; gap: 2px; }
.compare-heads .heart { font-size: 34px; }
.compare-level { font-size: 20px; font-weight: 800; margin-top: 10px; }
.compare-level b { color: var(--accent); font-size: 26px; }
.compare-note { color: #3a3a3a; line-height: 1.5; margin: 6px 0 0; }

.partner-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.partner-tile {
  background: #fffdf7; border: 2px solid rgba(43,43,43,.2); border-radius: 16px; padding: 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-family: inherit; color: var(--ink);
}
.partner-tile:hover { border-color: var(--ink); }
.partner-tile b { font-size: 15px; }
.partner-tile small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.compare-pick { margin-top: 16px; }
.compare-pick label { font-size: 13px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 8px; }
.pick-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pick { background: none; border: 2px solid transparent; border-radius: 999px; padding: 2px; cursor: pointer; line-height: 0; }
.pick.sel { border-color: var(--ink); }

.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.share { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 10px; font-size: 14px; box-shadow: 0 3px 0 var(--ink); }
.btn.share .ico { font-size: 18px; }
.btn.kakao { background: #FEE500; }
.btn.insta { background: linear-gradient(45deg, #ffd27a, #f77eb9 60%, #a37cf0); color: #fff; }
.share-hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 10px 0 0; }
.card-preview:empty { display: none; }
.card-preview { margin-top: 12px; }
.card-preview img { width: 100%; max-width: 270px; display: block; margin: 0 auto; border-radius: 14px; border: 2px solid var(--ink); }
.footer-note { font-size: 11px; color: var(--muted); text-align: center; margin-top: 20px; line-height: 1.5; }

/* chars */
.char-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.char-tile {
  background: var(--bg); border: 2px solid var(--ink); border-radius: 18px; padding: 12px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: inherit; color: var(--ink);
  box-shadow: 0 4px 0 var(--ink); transition: transform .08s;
}
.char-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.char-tile b { font-size: 16px; }
.char-tile small { font-size: 11.5px; color: #444; text-align: center; }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  transition: .25s; pointer-events: none; max-width: 90vw; text-align: center; z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 캐릭터 이미지 */
.chara-img { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; box-sizing: border-box; vertical-align: middle; }
.chara-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hero-char .chara-img { background: #fff; border: 2px solid var(--ink); }
.big-chara .chara-img { border: 3px solid var(--ink); }

/* 강제선택 퀴즈 */
/* 선택 단계가 바뀌어도 화면과 버튼의 클릭 위치는 유지한다. */
.screen.quiz { animation: none; }
.ask { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.ask-face { flex: none; line-height: 0; }
.ask .question { margin: 0; min-height: 0; font-size: 21px; }
.hl-most { color: var(--accent); }
.hl-least { color: #6b7a99; }
.opt { position: relative; min-height: 76px; }
.opt:disabled { cursor: default; }
.opt:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.opt.picked-most { background: var(--accent); color: #fff; opacity: .9; cursor: default; }
.opt.picked-least { background: #e8ecf3; }
.tag-most { position: absolute; top: 8px; left: 14px; font-size: 11px; font-weight: 800; background: #fff; color: var(--accent); border-radius: 999px; padding: 2px 8px; }
.stat-name small { display: block; font-size: 10px; font-weight: 600; color: var(--muted); }
.stat-row { grid-template-columns: 64px 1fr 28px; }

.quiz-guide { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 0 0 16px; }

/* 답을 살짝 안아 주듯 눌렀다가 다음 질문으로 이어진다. */
.quiz-content { animation: quiz-arrive 380ms cubic-bezier(.22, 1, .36, 1) both; }
.quiz .options { min-height: 0; gap: 9px; justify-content: flex-start; }
.quiz .opt { flex: 0 0 auto; min-height: 54px; padding: 13px 16px; text-align: left; line-height: 1.65; word-break: keep-all; overflow-wrap: anywhere; }
.quiz:not(.is-leaving) .ask-face { animation: quiz-hello 480ms ease-out both; }
.quiz.is-leaving .quiz-content { animation: quiz-depart 220ms 140ms ease-in both; }
.quiz.is-leaving .opt.picked-most,
.quiz.is-leaving .opt.picked-least { animation: quiz-squish 300ms ease-out both; }
.quiz.is-leaving .opt:not(.picked-most):not(.picked-least) { opacity: .55; transition: opacity 180ms ease; }
@keyframes quiz-arrive {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes quiz-depart {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-6px); }
}
@keyframes quiz-squish {
  0% { transform: scale(1); }
  40% { transform: scale(.975); }
  75% { transform: scale(1.008); }
  100% { transform: scale(1); }
}
@keyframes quiz-hello {
  0% { transform: rotate(-5deg) scale(.94); }
  60% { transform: rotate(3deg) scale(1.025); }
  100% { transform: rotate(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .screen, .quiz-content, .quiz .ask-face, .quiz.is-leaving .quiz-content,
  .quiz.is-leaving .opt.picked-most, .quiz.is-leaving .opt.picked-least { animation: none; }
  .quiz *, .quiz.is-leaving .opt:not(.picked-most):not(.picked-least) { transition: none; }
}

/* 질문과 선택지 세 개를 한 화면에 모은다. 내용은 자르지 않고 줄바꿈한다. */
.quiz .ask { align-items: flex-start; gap: 10px; margin: 12px 0 22px; }
.quiz .ask .question { font-size: 19px; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere; }
.quiz .ask-face { margin-top: 2px; }
@media (max-width: 420px) {
  .quiz .ask .question { font-size: 18px; }
  .quiz .opt { padding: 13px 12px; }
}

/* 결과가 왜 나왔는지와 2순위 친구를 짧게 보여 준다. */
.why { text-align: left; background: var(--theme); border-radius: 14px; padding: 12px 14px; margin: 14px 0 6px; font-size: 13.5px; line-height: 1.55; }
.why b { display: block; margin-bottom: 6px; font-size: 14px; }
.why p { margin: 4px 0 0; color: #3a3a3a; word-break: keep-all; }
.why p span { display: block; color: var(--muted); font-size: 12.5px; }
.runner-up { display: flex; align-items: center; gap: 10px; width: 100%; margin: 10px 0 0; padding: 8px 12px; border: 2px dashed rgba(43,43,43,.25); border-radius: 14px; background: #fff; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; text-align: left; }
.runner-up b { color: var(--accent); }

/* 우리 궁합 자랑하기 */
.pair-share { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.btn.pair-card { background: #fff; }
