:root {
  --bg: #FEF5E6;
  --card: #FFFFFF;
  --ink: #3B2A20;
  --ink-2: #6E5A4C;
  --line: #EADBC6;
  --leaf: #6FB25A;
  --coral: #F07B5A;
  --accent: #F6D6E0;
  --radius: 22px;
  --shadow: 0 2px 0 var(--line), 0 10px 30px rgba(110, 80, 50, .08);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 10px; }

.top { display: flex; align-items: center; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 16px 4px; max-width: 520px; width: 100%; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 15px; letter-spacing: -.01em; min-height: 44px; }
.logo img { width: 28px; height: 28px; border-radius: 50%; }
.lang { min-width: 52px; min-height: 40px; border: 2px solid var(--ink); background: var(--card); border-radius: 999px; font-weight: 800; font-size: 13px; cursor: pointer; }

main { flex: 1; width: 100%; max-width: 520px; margin: 0 auto; padding: 8px 16px 24px; }
.foot { max-width: 520px; margin: 0 auto; padding: 16px 20px max(24px, env(safe-area-inset-bottom)); font-size: 12px; line-height: 1.6; color: var(--ink-2); text-align: center; }
.foot p { margin: 0 0 4px; }
.foot .made { font-weight: 700; }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 58px; padding: 14px 18px; border-radius: 18px; border: 2.5px solid var(--ink); background: var(--ink); color: #fff; font-size: 17px; font-weight: 800; letter-spacing: -.01em; cursor: pointer; text-decoration: none; box-shadow: 0 4px 0 #1f150f; transition: transform .08s, box-shadow .08s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1f150f; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.btn.ghost:active { box-shadow: 0 1px 0 var(--ink); }
.btn.coral { background: var(--coral); border-color: var(--ink); }
.btn + .btn, .stack > * + * { margin-top: 12px; }

/* start */
.hero { text-align: center; padding-top: 8px; }
.hero .eyebrow { display: inline-block; margin: 4px 0 0; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 2px solid var(--ink); font-size: 13.5px; font-weight: 800; }
.hero .mascot { width: 220px; height: 220px; margin: 0 auto -6px; animation: bob 2.4s ease-in-out infinite; }
.hero h1 { font-size: 30px; line-height: 1.25; letter-spacing: -.03em; margin: 8px 0 10px; font-weight: 900; }
.hero p.sub { font-size: 16px; line-height: 1.6; color: var(--ink-2); margin: 0 0 22px; }
.chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.chip { background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 13.5px; font-weight: 700; }
.invite { display: flex; align-items: center; gap: 12px; background: var(--bg); border: 2.5px solid var(--ink); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 18px; text-align: left; box-shadow: 0 4px 0 var(--ink); }
.invite img { width: 64px; height: 64px; border-radius: 16px; flex: none; }
.invite b { display: block; font-size: 16px; }
.invite span { font-size: 14px; color: var(--ink-2); }
.peek { margin-top: 30px; }
.peek h2 { font-size: 15px; text-align: center; color: var(--ink-2); margin: 0 0 12px; font-weight: 700; }

/* journey progress */
.journey { position: relative; height: 64px; margin: 2px 0 10px; }
.journey svg { width: 100%; height: 100%; overflow: visible; }
.journey .count { position: absolute; right: 0; top: -2px; font-size: 13px; font-weight: 800; color: var(--ink-2); }
.journey .me { position: absolute; width: 34px; height: 34px; margin: -30px 0 0 -17px; transition: left .5s cubic-bezier(.3,1.4,.5,1), top .5s cubic-bezier(.3,1.4,.5,1); filter: drop-shadow(0 2px 0 var(--line)); }
.journey .me img { width: 34px; height: 34px; border-radius: 50%; }

/* question card */
.qcard { background: var(--card); border: 2.5px solid var(--ink); border-radius: 26px; padding: 20px 18px 18px; box-shadow: 0 6px 0 var(--ink); animation: cardIn .42s cubic-bezier(.2,1.2,.4,1) both; }
.qcard.out { animation: cardOut .26s ease-in both; }
.qhead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.qicon { width: 54px; height: 54px; flex: none; border-radius: 16px; background: var(--bg); border: 2px solid var(--line); display: grid; place-items: center; font-size: 28px; }
.qplace { font-size: 13px; font-weight: 800; color: var(--coral); letter-spacing: .02em; }
.qnum { font-size: 13px; color: var(--ink-2); font-weight: 700; }
.qtext { font-size: 21px; line-height: 1.45; letter-spacing: -.02em; font-weight: 800; margin: 2px 0 18px; word-break: keep-all; }
.opts { display: grid; gap: 10px; }
.opt { text-align: left; width: 100%; min-height: 60px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg); font-size: 16.5px; line-height: 1.45; font-weight: 600; cursor: pointer; word-break: keep-all; -webkit-tap-highlight-color: transparent; transition: transform .1s, border-color .15s, background .15s; }
.opt:active { transform: scale(.98); }
.opt.picked { border-color: var(--ink); background: #FFE7A3; animation: pop .3s ease; }
.opt.dim { opacity: .45; }
.qfoot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; min-height: 44px; }
.back { background: none; border: 0; font-size: 14.5px; font-weight: 700; color: var(--ink-2); min-height: 44px; padding: 0 6px; cursor: pointer; }
.back[disabled] { visibility: hidden; }

.buddy { display: flex; align-items: flex-end; gap: 10px; margin: 18px 4px 0; min-height: 84px; }
.buddy img { width: 72px; height: 72px; flex: none; }
.buddy img.jump { animation: jump .5s cubic-bezier(.3,1.6,.5,1); }
.bubble { position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: 18px 18px 18px 6px; padding: 10px 14px; font-size: 15px; font-weight: 700; line-height: 1.4; margin-bottom: 22px; opacity: 0; transform: translateY(6px) scale(.96); transition: opacity .18s, transform .25s cubic-bezier(.3,1.6,.5,1); }
.bubble.show { opacity: 1; transform: none; }

/* loading */
.loading { text-align: center; padding: 60px 0; }
.loading img { width: 160px; height: 160px; margin: 0 auto 16px; animation: squish .7s ease-in-out infinite alternate; }
.loading p { font-size: 18px; font-weight: 800; }

/* result */
.compat + .res-label { margin-top: 28px; }
.res-label { text-align: center; font-size: 15px; font-weight: 700; color: var(--ink-2); margin: 4px 0 6px; }
.res-card { position: relative; background: var(--bg); border: 2.5px solid var(--ink); border-radius: 28px; overflow: hidden; box-shadow: 0 6px 0 var(--ink); animation: cardIn .5s cubic-bezier(.2,1.2,.4,1) both; }
.res-card .band { height: 14px; background: var(--accent); border-bottom: 2.5px solid var(--ink); }
.res-card .art { width: 78%; margin: 0 auto -10px; aspect-ratio: 1; }
.res-card .body { padding: 0 20px 22px; text-align: center; }
.type-code { font-size: 64px; line-height: 1; font-weight: 900; letter-spacing: .02em; margin: 0; }
.type-name { font-size: 25px; font-weight: 900; letter-spacing: -.03em; margin: 8px 0 8px; }
.type-line { font-size: 16.5px; line-height: 1.55; color: var(--ink-2); margin: 0; word-break: keep-all; }

.section { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 16px; }
.section h3 { font-size: 16px; margin: 0 0 12px; font-weight: 900; letter-spacing: -.01em; }
.bars { display: grid; gap: 14px; }
.bar .lbl { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.bar .lbl .win { color: var(--ink); }
.bar .lbl .lose { color: var(--ink-2); font-weight: 600; }
.bar .track { position: relative; height: 14px; border-radius: 99px; background: var(--bg); border: 2px solid var(--ink); overflow: hidden; }
.bar .fill { position: absolute; top: 0; bottom: 0; background: var(--accent); width: 0; transition: width .9s cubic-bezier(.2,1,.3,1); }
.bar .fill.left { left: 0; border-right: 2px solid var(--ink); }
.bar .fill.right { right: 0; border-left: 2px solid var(--ink); }
ul.pts { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
ul.pts li { position: relative; padding-left: 26px; font-size: 15.5px; line-height: 1.5; word-break: keep-all; }
ul.pts li::before { content: "✓"; position: absolute; left: 2px; top: 0; font-weight: 900; color: var(--leaf); }
ul.pts.warn li::before { content: "!"; color: var(--coral); left: 7px; }

.match { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.mt { text-decoration: none; text-align: center; background: var(--bg); border: 2px solid var(--line); border-radius: 18px; padding: 8px 6px 10px; min-height: 44px; }
.mt img { width: 100%; aspect-ratio: 1; }
.mt .tag { font-size: 11.5px; font-weight: 800; border-radius: 99px; display: inline-block; padding: 2px 8px; margin-bottom: 4px; }
.mt .tag.good { background: #DDF1D4; color: #2F6A1E; }
.mt .tag.bad { background: #FBE0D8; color: #9B3517; }
.mt b { display: block; font-size: 15px; }
.mt span { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.35; word-break: keep-all; }

.compat { background: var(--bg); border: 2.5px solid var(--ink); border-radius: 26px; padding: 18px; margin-top: 18px; box-shadow: 0 6px 0 var(--ink); }
.compat .pair { display: flex; align-items: center; justify-content: center; gap: 4px; }
.compat .pair figure { margin: 0; text-align: center; width: 120px; }
.compat .pair img { width: 120px; height: 120px; }
.compat .pair figcaption { font-size: 13px; font-weight: 800; line-height: 1.3; }
.compat .heart { font-size: 26px; animation: beat 1.1s ease-in-out infinite; }
.compat .score { text-align: center; font-size: 46px; font-weight: 900; margin: 6px 0 0; line-height: 1; }
.compat .tier { text-align: center; font-size: 18px; font-weight: 900; margin: 6px 0 12px; }
.compat .kicker { text-align: center; font-size: 14px; font-weight: 800; color: var(--coral); margin: 0 0 8px; }
.compat ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.compat li { background: var(--card); border-radius: 14px; padding: 10px 12px; font-size: 15px; line-height: 1.5; word-break: keep-all; }

.share { margin-top: 20px; }
.share .name { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.share label { font-size: 14px; font-weight: 700; flex: none; }
.share input { flex: 1; min-width: 0; min-height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); padding: 0 14px; font: inherit; font-size: 16px; }
.share input:focus { border-color: var(--ink); outline: none; }
.hint { font-size: 13px; color: var(--ink-2); text-align: center; margin: 8px 0 0; line-height: 1.5; }

.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gallery a { text-decoration: none; text-align: center; font-size: 12px; font-weight: 800; background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: 4px 2px 6px; }
.gallery img { width: 100%; aspect-ratio: 1; }

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

.sheet { position: fixed; inset: 0; background: rgba(40, 28, 20, .72); z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; gap: 14px; }
.sheet img { max-height: 70dvh; width: auto; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.sheet p { color: #fff; font-weight: 700; margin: 0; text-align: center; }
.sheet .btn { max-width: 320px; }

@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes cardIn { from { opacity: 0; transform: translateX(40px) rotate(2deg); } to { opacity: 1; transform: none; } }
@keyframes cardOut { to { opacity: 0; transform: translateX(-40px) rotate(-2deg); } }
@keyframes pop { 40% { transform: scale(1.03); } }
@keyframes jump { 40% { transform: translateY(-16px) scale(1.05, .95); } }
@keyframes squish { to { transform: scale(1.08, .9) translateY(8px); } }
@keyframes beat { 50% { transform: scale(1.25); } }

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

/* feather the cream square behind the standalone mascot */
.hero .mascot, .buddy img, .loading img { -webkit-mask-image: radial-gradient(closest-side, #000 78%, transparent 100%); mask-image: radial-gradient(closest-side, #000 78%, transparent 100%); }
