:root {
  --bg: #FFF4DC;
  --ink: #2B2140;
  --soft: #6A6280;
  --card: #FFFFFF;
  --primary: #FF5A3C;
  --mint: #26B88F;
  --yellow: #FFC93C;
  --red: #E0364F;
  --line: #2B2140;
  --radius: 20px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg) radial-gradient(circle at 12px 12px, rgba(43, 33, 64, .07) 2px, transparent 2.5px) 0 0 / 28px 28px;
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: inherit; }
.top { padding: 14px 16px 0; text-align: center; }
.logo { display: inline-block; font-weight: 900; font-size: 18px; text-decoration: none; background: var(--yellow); border: 2.5px solid var(--line); border-radius: 999px; padding: 2px 14px; transform: rotate(-2deg); }
main { max-width: 480px; margin: 0 auto; padding: 20px 18px 32px; text-align: center; display: flex; flex-direction: column; gap: 14px; min-height: 70vh; }
footer { text-align: center; font-size: 13px; color: var(--soft); padding: 8px 16px 96px; }
h1 { font-size: 30px; line-height: 1.25; margin: 4px 0; font-weight: 900; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0 0 10px; font-weight: 800; }
p { margin: 0; }
.sub { color: var(--soft); font-size: 16px; }
.step { font-weight: 800; color: var(--primary); font-size: 14px; }
.note { color: var(--soft); font-size: 14px; min-height: 1em; }
.label, label { font-weight: 700; font-size: 14px; text-align: left; display: block; }
.error { color: var(--red); font-weight: 700; font-size: 15px; min-height: 1.4em; }
.loading { padding: 80px 0; color: var(--soft); font-weight: 700; }
.big-emoji { font-size: 72px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* 버튼: 스티커 느낌의 굵은 테두리와 딱딱한 그림자 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 54px; padding: 12px 18px; width: 100%;
  font: inherit; font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none;
  background: var(--card); border: 2.5px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--line); cursor: pointer;
  transition: transform .08s, box-shadow .08s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.small { min-height: 44px; font-size: 15px; padding: 8px 12px; box-shadow: 0 3px 0 var(--line); }
.btn:disabled { cursor: default; opacity: 1; }
:focus-visible { outline: 3px solid #3B6BFF; outline-offset: 3px; }

input[type="text"] {
  width: 100%; min-height: 52px; padding: 10px 14px; font: inherit; font-size: 17px; color: var(--ink);
  background: #fff; border: 2.5px solid var(--line); border-radius: 16px;
}
input[type="radio"] { width: 26px; height: 26px; accent-color: var(--mint); flex: none; margin: 0; }
.choice-edit { display: flex; align-items: center; gap: 10px; }
.link { text-align: center; font-size: 14px !important; }

.mute { position: fixed; top: 10px; right: 10px; width: 44px; height: 44px; font-size: 20px; background: #fff; border: 2.5px solid var(--line); border-radius: 50%; cursor: pointer; z-index: 5; }

.bar { height: 14px; background: #fff; border: 2.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--mint); transition: width .3s; }

.card { background: var(--card); border: 2.5px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: left; }

/* 캐릭터 */
.char { display: inline-flex; align-items: center; justify-content: center; width: 132px; height: 132px; margin: 0 auto; position: relative; }
.char img { width: 100%; height: 100%; object-fit: contain; }
.char-emoji { font-size: 96px; line-height: 1; }
.mood-happy { animation: hop .5s ease-out; }
.mood-sad { animation: droop .5s ease-out forwards; }
@keyframes hop { 0% { transform: translateY(0) } 40% { transform: translateY(-16px) rotate(-6deg) } 100% { transform: none } }
@keyframes droop { 0% { transform: none } 30% { transform: translateX(-6px) } 60% { transform: translateX(6px) } 100% { transform: rotate(8deg) translateY(4px); filter: saturate(.5) } }

/* 잠금 캐릭터: 이미지에는 금빛 후광, 이모지로 대신할 때는 무지개 테두리 */
.char.fancy img { filter: drop-shadow(0 0 8px rgba(255, 196, 60, .95)) drop-shadow(0 0 2px #fff); }
.char.fancy.emoji { border-radius: 50%; background: conic-gradient(from 0deg, #FFD86B, #FF8FC7, #8FD3FF, #9BE7C4, #FFD86B); box-shadow: 0 0 22px rgba(255, 190, 60, .75); }
.char.fancy.emoji::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #FFFDF4; }
.char.fancy > * { position: relative; }
.char.fancy::after { content: "✨"; position: absolute; top: -6px; right: -4px; font-size: 26px; animation: twinkle 1.4s infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(.7); opacity: .5 } 50% { transform: scale(1.2); opacity: 1 } }

.hero-chars { display: flex; justify-content: center; margin: 8px 0; }
.hero-chars .char { width: 64px; height: 64px; margin: 0 -2px; }
.hero-chars .char-emoji { font-size: 44px; }
.hero-chars .char.fancy::after { font-size: 16px; }
.how { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.how li { background: #fff; border: 2.5px solid var(--line); border-radius: 16px; padding: 10px 14px; font-weight: 600; }
.how b { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 6px; background: var(--yellow); border: 2px solid var(--line); border-radius: 50%; font-size: 14px; }

.char-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.char-pick { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; min-height: 96px; font: inherit; color: var(--ink); background: #fff; border: 2.5px solid var(--line); border-radius: 16px; cursor: pointer; }
.char-pick .char { width: 52px; height: 52px; }
.char-pick .char-emoji { font-size: 36px; }
.char-pick .char.fancy::after { font-size: 14px; top: -6px; right: -6px; }
.char-pick .char.fancy.emoji::before { inset: 4px; }
.char-name { font-size: 12px; font-weight: 700; }
.char-pick.on { background: var(--yellow); box-shadow: 0 4px 0 var(--line); transform: translateY(-2px); }
/* 잠긴 캐릭터도 흐리게 하지 않는다. 갖고 싶어 보여야 공유할 이유가 생긴다. */
.char-pick.locked { background: #FFFBEF; border-style: dashed; }
.lock { font-size: 11px; font-weight: 800; color: var(--primary); }

/* 풀기 */
.face .char { width: 110px; height: 110px; }
.face .char-emoji { font-size: 80px; }
.question { font-size: 24px; min-height: 2.5em; display: grid; place-items: center; }
.choice { justify-content: flex-start; text-align: left; }
.choice.right { background: var(--mint); color: #fff; }
.choice.wrong { background: var(--red); color: #fff; }
.feedback { font-weight: 800; min-height: 1.5em; }

/* 결과: 등급별 배경색, 장면 이미지, 도장, 말풍선, 게이지 */
.result { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 8px; background: linear-gradient(160deg, var(--g1, #fff), var(--g2, #fff)); border: 2.5px solid var(--line); border-radius: 28px; padding: 18px 16px 20px; box-shadow: 0 6px 0 var(--line); }
.result.gold { border-color: #E6A800; box-shadow: 0 6px 0 #E6A800, 0 0 28px rgba(255, 201, 60, .9); }
.result > * { position: relative; }
.owner { font-weight: 800; background: rgba(255, 255, 255, .85); border-radius: 999px; padding: 2px 14px; }
.scene { width: 100%; max-width: 280px; aspect-ratio: 1; display: grid; place-items: center; background: rgba(255, 255, 255, .9); border: 2.5px solid var(--line); border-radius: 24px; overflow: hidden; }
.scene img { width: 100%; height: 100%; object-fit: cover; }
.scene-emoji { font-size: 84px; line-height: 1.1; }
.score { font-size: 60px; font-weight: 900; color: #fff; line-height: 1.1; text-shadow: 0 3px 0 var(--line), 2px 0 0 var(--line), -2px 0 0 var(--line), 0 -2px 0 var(--line); font-variant-numeric: tabular-nums; }
.stats .score { color: var(--primary); text-shadow: none; }
.grade { font-size: 30px; }
.stamp { display: inline-block; background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 4px 18px; transform: rotate(-4deg); box-shadow: 0 4px 0 var(--line); animation: stamp .45s .75s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes stamp { 0% { transform: scale(3) rotate(12deg); opacity: 0 } 100% { transform: scale(1) rotate(-4deg); opacity: 1 } }
.says { display: flex; align-items: flex-end; gap: 6px; margin-top: 6px; }
.says .char { width: 64px; height: 64px; margin: 0; flex: none; }
.says .char-emoji { font-size: 46px; }
.says .char.fancy::after { display: none; }
.says .char.fancy.emoji::before { inset: 4px; }
.bubble { position: relative; background: #fff; border: 2.5px solid var(--line); border-radius: 18px; padding: 10px 14px; font-size: 18px; font-weight: 800; text-align: left; margin-bottom: 14px; }
.bubble::before { content: ""; position: absolute; left: -9px; bottom: 10px; width: 14px; height: 14px; background: #fff; border-left: 2.5px solid var(--line); border-bottom: 2.5px solid var(--line); transform: rotate(45deg); }
.gauge-wrap { width: 100%; }
.gauge { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 4px; }
.gauge i { height: 12px; background: rgba(255, 255, 255, .6); border: 2px solid var(--line); border-radius: 999px; }
.gauge i.on { background: var(--yellow); }
.result .note { color: var(--ink); font-weight: 700; }
.sprinkle { position: absolute !important; inset: 0; pointer-events: none; }
.sprinkle span { position: absolute; top: -30px; font-size: 22px; animation: fall 2.6s linear both; }
@keyframes fall { to { transform: translateY(620px) rotate(300deg); opacity: 0 } }
.badge { display: inline-block; font-size: 13px; font-weight: 800; background: var(--yellow); border: 2px solid var(--line); border-radius: 999px; padding: 1px 10px; vertical-align: middle; white-space: nowrap; }
.hook { min-height: 64px; font-size: 18px; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.03) } }
.hook-bar { position: sticky; bottom: 0; margin: 0 -18px; padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); }

.board, .review, .replies, .my-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.board li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: #F6F2FA; font-weight: 700; }
.board li.perfect { background: #FFF1BF; outline: 2px solid #E6A800; }
.board li.me { outline: 2.5px solid var(--primary); }
.rank { width: 28px; text-align: center; }
.board .name { flex: 1; min-width: 0; }
.pts { color: var(--primary); }
.review li { border-top: 1.5px dashed #D8D2E3; padding-top: 8px; }
.review li:first-child { border-top: 0; padding-top: 0; }
.rq { font-weight: 800; }
.wrong-text { color: var(--red); }
.right-text { color: #128262; font-weight: 700; }
.replies a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; background: #F6F2FA; text-decoration: none; font-weight: 700; }
.replies .char { width: 40px; height: 40px; margin: 0; flex: none; }
.replies .char-emoji { font-size: 28px; }
.replies .char.fancy::after { display: none; }
.replies .char.fancy.emoji::before { inset: 3px; }
.replies a span:nth-child(2) { flex: 1; min-width: 0; }
.go { color: var(--primary); font-size: 14px; white-space: nowrap; }

.stats { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.my-list { gap: 12px; }
.my-list .card { display: flex; flex-direction: column; gap: 10px; }
.my-head { display: flex; align-items: center; gap: 10px; }
.my-head .char { width: 48px; height: 48px; margin: 0; flex: none; }
.my-head .char-emoji { font-size: 34px; }
.my-head .char.fancy::after { display: none; }
.my-head .char.fancy.emoji::before { inset: 4px; }
.my-head h2 { margin: 0; }
.ad { margin-top: 8px; min-height: 100px; }

.doc { text-align: left; }
.doc h2 { margin-top: 12px; }
.doc ul { margin: 0; padding-left: 20px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.hook-bar[hidden] { display: none; }
