:root {
  --bg: #f7f7f5;
  --ink: #1b1b1b;
  --muted: #8a8a8a;
  --line: #ececea;
  --card: #fff;
  --sheet: #ebebe8;
  --yellow: #f3f520;
  --pink: #ff3ea5;
  --mint: #2ee6a6;
  --warn: #fff1e6;
  --warn-ink: #b8541a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: "Pretendard Variable", Pretendard, system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.5; word-break: keep-all; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

#app { max-width: 440px; margin: 0 auto; min-height: 100dvh; }
.view { min-height: 100dvh; padding: 24px 20px 0; display: flex; flex-direction: column; position: relative; }
.view.center { justify-content: center; align-items: center; text-align: center; padding-bottom: 80px; }

.brand { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.title { font-size: 34px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.2; margin-top: 8px; }
.sub { font-size: 15px; color: var(--muted); margin: 12px 0 0; }

/* 큰 숫자 원 (시작 화면) */
.blob { width: 214px; height: 214px; border-radius: 50%; background: var(--yellow); display: flex; flex-direction: column; justify-content: center; align-items: center; }
.blob b { font-size: 96px; line-height: .9; font-weight: 800; letter-spacing: -0.05em; }
.blob span { font-size: 15px; font-weight: 700; margin-top: 6px; }
.blob2 { position: absolute; left: 168px; top: 116px; width: 108px; height: 108px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; font-weight: 800; }
.blob2 b { font-size: 34px; line-height: 1; }
.blob2 span { font-size: 11.5px; }
.intro-hero { position: relative; height: 236px; margin-top: 28px; }

/* ───────── 질문 ───────── */
.topbar { display: flex; align-items: center; gap: 12px; height: 32px; position: relative; z-index: 2; }
.icon { font-size: 20px; width: 28px; height: 28px; display: grid; place-items: center; }
.bars { flex: 1; display: flex; gap: 4px; }
.bars i { flex: 1; height: 4px; border-radius: 4px; background: #e2e2df; transition: background .2s; }
.bars i.on { background: var(--ink); }
.count { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.q-wrap { position: relative; z-index: 1; }

/* 문장 채우기 — 지나간 조각은 흐리게, 지금 조각은 크게 */
.sentence { margin-top: 26px; font-size: 19px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.45; color: #b9b9b5; }
.sentence mark { background: var(--yellow); color: var(--ink); padding: 0 5px; border-radius: 4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.sentence .frag.now { color: var(--ink); font-size: 1.37em; }
.sentence u { display: inline-block; width: 110px; height: 1em; border-bottom: 4px solid var(--ink); text-decoration: none; vertical-align: -0.12em; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { border-color: #cfcfcb; } }
/* 휴대폰: 바로 앞 조각과 지금 조각만 */
.sentence .frag:not(:nth-last-child(-n+3)), .sentence .sep:not(:nth-last-child(-n+3)) { display: none; }
.q-ask { font-size: 15px; font-weight: 600; margin-top: 16px; }
.q-sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; min-height: 20px; }
#q-body { margin-top: 18px; animation: fadein .2s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { background: var(--card); border-radius: 20px; padding: 16px; text-align: left; box-shadow: 0 0 0 1px var(--line); transition: transform .08s, background .15s; min-height: 64px; display: flex; flex-direction: column; justify-content: center; }
.opt:active { transform: scale(.97); }
.opt b { font-size: 16px; font-weight: 600; }
.opt small { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.opt.on { background: var(--ink); color: #fff; box-shadow: none; }
.opt.on small { color: #aaa; }
.grid2 .opt { min-height: 88px; justify-content: flex-end; }
.grid2 .opt.wide { grid-column: span 2; min-height: 56px; justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack .opt { font-size: 17px; font-weight: 600; padding: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--card); border-radius: 99px; padding: 11px 16px; font-size: 15px; box-shadow: 0 0 0 1px var(--line); transition: transform .08s; }
.chip:active { transform: scale(.96); }
.chip.on { background: var(--ink); color: #fff; box-shadow: none; }
.chip.solo { background: transparent; box-shadow: 0 0 0 1px #d4d4d0; color: #555; }
.chip.solo.on { background: var(--ink); color: #fff; }
.sec { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }

/* 직접 쓰기 */
.write { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 16px; padding: 5px 5px 5px 16px; box-shadow: 0 0 0 1.5px var(--ink); margin-top: 16px; }
.write input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; padding: 10px 0; }
.write input::placeholder { color: #b3b3ae; }
.write button { background: var(--ink); color: #fff; border-radius: 11px; padding: 10px 16px; font-size: 14px; font-weight: 600; flex-shrink: 0; }
#q-body > .write:first-child { margin-top: 0; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.match { display: inline-block; margin-top: 10px; background: #fff; border-radius: 12px; padding: 9px 13px; font-size: 14px; box-shadow: 0 0 0 1px var(--line); }
.match b { background: var(--yellow); padding: 1px 7px; border-radius: 6px; font-weight: 600; }
.match button { margin-left: 6px; color: var(--muted); text-decoration: underline; font-size: 13px; }
.ac { background: #fff; border-radius: 14px; margin-top: 6px; box-shadow: 0 0 0 1px var(--line), 0 10px 24px rgba(0,0,0,.07); overflow: hidden; }
.ac button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 11px 14px; font-size: 15px; text-align: left; border-top: 1px solid #f1f1ef; }
.ac button:first-child { border-top: 0; }
.ac button:hover, .ac button:focus-visible { background: #fafaf3; }
.ac small { color: var(--muted); font-size: 12.5px; }
.ac-none { padding: 12px 14px; font-size: 13.5px; color: #666; }

/* 답할수록 떠오르는 성분 — 휴대폰은 위쪽 작은 줄 */
.floats { display: flex; gap: 6px; min-height: 30px; margin: 12px 0 -6px; position: relative; z-index: 1; }
.fl { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; flex-shrink: 0; }
.fl b { display: none; }
.fl.pop { animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(0); } }
.floats:empty::before { content: ""; }
/* topbar 위로 floats가 먼저 나오지 않게 순서 조정 */
.quizv { display: flex; }
.quizv .floats { order: 1; }
.quizv .topbar { order: 0; }
.quizv .q-wrap { order: 2; }
.quizv .bottom { order: 3; }

.bottom { margin-top: auto; position: sticky; bottom: 0; padding: 18px 0 max(18px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 78%, transparent); z-index: 3; }
.btn { display: block; width: 100%; background: var(--ink); color: #fff; border-radius: 16px; padding: 17px; font-weight: 600; font-size: 16px; }
.btn:disabled { background: #d6d6d3; cursor: default; }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-light { background: #fff; color: var(--ink); margin-top: 10px; box-shadow: 0 0 0 1px var(--line); }
.disc { font-size: 11.5px; color: var(--muted); margin-top: 12px; line-height: 1.55; }

/* 맞추는 중 */
.pulse { width: 120px; height: 120px; border-radius: 50%; background: var(--yellow); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.15); background: var(--mint); } }
.q-title { font-size: 30px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.25; margin-top: 28px; }

/* ───────── 결과 ───────── */
.type { font-size: 32px; font-weight: 700; letter-spacing: -0.045em; line-height: 1.15; margin-top: 6px; }
.say { font-size: 21px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.5; margin-top: 16px; }
.say mark { background: var(--yellow); padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.say .pk { background: var(--pink); color: #fff; padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.res-stage { margin-top: 18px; }
.stage { --k: .62; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; padding: 10px 0; }
.ball { width: max(84px, calc(var(--s) * var(--k) * 1px)); height: max(84px, calc(var(--s) * var(--k) * 1px)); border-radius: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; margin: -6px; box-shadow: 0 10px 28px rgba(0,0,0,.07); transition: transform .15s; animation: pop .55s cubic-bezier(.2,1.5,.4,1) backwards; padding: 6px; line-height: 1.2; }
.ball:nth-child(2) { animation-delay: .08s; transform: translateY(14px); }
.ball:nth-child(3) { animation-delay: .16s; transform: translateY(-10px); }
.ball:nth-child(4) { animation-delay: .24s; transform: translateY(18px); }
.ball:nth-child(5) { animation-delay: .32s; }
.ball:hover { filter: brightness(.97); }
.ball b { font-size: calc(max(84px, calc(var(--s) * var(--k) * 1px)) / 6.2); font-weight: 700; }
.ball small { font-size: 11px; font-weight: 600; opacity: .7; margin-top: 2px; }
.ball.have { color: #fff; }
.ball.zero { background: var(--mint); }
.ball.zero b { font-size: 56px; }
.stage-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }

.r-sec { margin-top: 24px; }
.r-sec h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.r-sec h3 i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.list { list-style: none; counter-reset: n; }
.list li { counter-increment: n; border-top: 1px solid #e3e3df; }
.list li:last-child { border-bottom: 1px solid #e3e3df; }
.list button { width: 100%; text-align: left; display: grid; grid-template-columns: 48px 1fr; column-gap: 10px; padding: 14px 0; }
.list button::before { content: counter(n, decimal-leading-zero); font-size: 30px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; grid-row: span 2; }
.list b { font-size: 17px; font-weight: 600; }
.list span { font-size: 13px; color: #666; line-height: 1.5; margin-top: 2px; }
.list em { font-style: normal; font-size: 11px; font-weight: 700; background: #eee; padding: 2px 8px; border-radius: 99px; margin-left: 8px; vertical-align: 2px; }
.list em.now { background: var(--yellow); }
.list em.have { background: var(--pink); color: #fff; }
.list li { position: relative; }
.buy { display: inline-flex; align-items: center; margin: -4px 0 14px 58px; background: var(--ink); color: #fff; text-decoration: none; border-radius: 99px; padding: 8px 14px; font-size: 13px; font-weight: 600; }
.buy:hover { background: #333; }
.aff-inline { display: block; margin: -8px 0 14px 58px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.buy-kv .aff-inline { margin: 6px 0 0; }
.aff { font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.buy-kv .buy { margin: 0; }
.buy-kv .src { margin-top: 8px; }
.note { background: var(--card); border-radius: 16px; padding: 14px 16px; margin-bottom: 8px; font-size: 14.5px; line-height: 1.6; }
.note.warn { background: var(--warn); color: var(--warn-ink); }
.res-bottom .btns { display: flex; flex-direction: column; }

/* 시트 */
.sheet-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.28); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { width: 100%; max-width: 440px; max-height: 86dvh; overflow-y: auto; background: var(--sheet); border-radius: 26px 26px 0 0; padding: 12px 20px max(22px, env(safe-area-inset-bottom)); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.grab { width: 38px; height: 4px; border-radius: 4px; background: #cfcfcb; margin: 0 auto 16px; }
.badge { display: inline-block; background: #fff; border-radius: 99px; padding: 5px 12px; font-size: 13px; }
.sheet-title { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 8px 0 14px; }
.kv { background: #fff; border-radius: 14px; padding: 13px 15px; margin-bottom: 8px; font-size: 14px; line-height: 1.6; }
.kv b { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.kv p { white-space: pre-line; }
.src { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* ───────── 넓은 화면: 웹사이트 배치 ───────── */
@media (min-width: 900px) {
  #app { max-width: 1180px; }
  .view { padding: 40px 56px 0; }

  /* 시작 — 왼쪽 글, 오른쪽 원 */
  .introv { display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: 1fr auto; align-items: center; column-gap: 40px; }
  .introv .title { font-size: 64px; letter-spacing: -0.05em; }
  .introv .sub { font-size: 18px; margin-top: 18px; }
  .introv .intro-hero { height: 420px; margin: 0; }
  .introv .blob { width: 360px; height: 360px; margin-left: 40px; }
  .introv .blob b { font-size: 170px; }
  .introv .blob span { font-size: 20px; }
  .introv .blob2 { width: 170px; height: 170px; left: 330px; top: 220px; }
  .introv .blob2 b { font-size: 54px; }
  .introv .blob2 span { font-size: 15px; }
  .introv .bottom { grid-column: 1; position: static; background: none; max-width: 420px; }

  /* 질문 — 가운데 좁은 기둥, 가장자리에 떠오르는 원 */
  .quizv .topbar { max-width: 760px; width: 100%; margin: 0 auto; }
  .quizv .q-wrap { max-width: 760px; width: 100%; margin: 0 auto; }
  .quizv .bottom { max-width: 760px; width: 100%; margin: auto auto 0; display: flex; justify-content: flex-end; background: none; position: static; }
  .quizv .bottom .btn { width: auto; padding: 17px 36px; }
  .sentence { font-size: 30px; letter-spacing: -0.04em; line-height: 1.42; margin-top: 56px; }
  .sentence .frag.now { font-size: 1.47em; }
  .sentence .frag:not(:nth-last-child(-n+3)), .sentence .sep:not(:nth-last-child(-n+3)) { display: inline; }
  .sentence u { width: 180px; border-bottom-width: 5px; }
  .q-ask { font-size: 17px; margin-top: 22px; }
  .q-sub { font-size: 14.5px; }
  #q-body { margin-top: 24px; }
  .grid2 { grid-template-columns: repeat(3, 1fr); }
  .grid2 .opt.wide { grid-column: span 3; }
  .stack { flex-direction: row; flex-wrap: wrap; }
  .stack .opt { flex: 1 1 160px; justify-content: center; text-align: center; padding: 26px 20px; font-size: 19px; }
  .chip { padding: 12px 18px; font-size: 15.5px; }
  .write { max-width: 520px; }

  .floats { position: absolute; inset: 0; margin: 0; pointer-events: none; z-index: 0; display: block; }
  .fl { position: absolute; width: var(--d); height: var(--d); font-size: 14px; transition: all .5s cubic-bezier(.2,1.3,.4,1); box-shadow: 0 12px 30px rgba(0,0,0,.06); }
  .fl b { display: block; padding: 0 8px; text-align: center; line-height: 1.2; }
  .fl i { display: none; }
  .fl.s0 { --d: 150px; left: -20px; top: 150px; }
  .fl.s1 { --d: 118px; right: 10px; top: 110px; }
  .fl.s2 { --d: 100px; left: 70px; bottom: 140px; }
  .fl.s3 { --d: 84px; right: 90px; bottom: 210px; }
  .fl.s4 { --d: 70px; right: -6px; top: 330px; font-size: 12px; }

  /* 결과 — 위: 문장 | 원 모음, 아래: 번호 목록 | 정리 */
  .res-top { display: grid; grid-template-columns: 1fr 1.05fr; gap: 48px; align-items: center; min-height: 520px; }
  .type { font-size: 52px; }
  .say { font-size: 30px; line-height: 1.45; margin-top: 22px; }
  .res-stage { margin: 0; }
  .stage { --k: 1; min-height: 440px; }
  .ball { margin: -10px; }
  .ball small { font-size: 12.5px; }
  .res-more { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; margin-top: 12px; }
  .res-bottom { position: static; background: none; max-width: 560px; }
  .res-bottom .btns { flex-direction: row; gap: 10px; }
  .res-bottom .btns .btn { width: auto; padding: 17px 30px; margin: 0; }

  /* 시트 — 오른쪽 옆판 */
  .sheet-wrap { justify-content: flex-end; align-items: stretch; }
  .sheet { max-width: 420px; max-height: none; height: 100%; border-radius: 26px 0 0 26px; padding: 26px 26px 30px; animation: side .22s ease-out; }
  .sheet .grab { display: none; }
  @keyframes side { from { transform: translateX(40px); opacity: 0; } }
}
