/* =========================================================
   구구단 랩 · 디자인
   - 색·글꼴·둥글기는 :root 토큰만 바꾸면 전체에 반영됩니다.
   - 화면 상태: .app[data-screen="home|quiz|result|map"]
   - 문제 상태: .app[data-state="ask|ok|bad"], 입력 방식: .app[data-input="key|mic"]
   - 60초 도전: .app[data-mode="speed"]
   ========================================================= */
@font-face{font-family:"Pretendard";src:url("/fonts/Pretendard-subset.woff2") format("woff2");font-weight:100 900;font-display:swap}
@font-face{font-family:"Baloo 2";src:url("fonts/baloo2-800.woff2") format("woff2");font-weight:800;font-display:swap}

:root{
  --ink:#10284F; --muted:#5E7396; --line:#DFE9F6; --bg:#F5FAFF; --card:#FFFFFF; --soft:#F1F6FD;
  --blue:#2377F3; --blue-l:#E3EEFF; --green:#1FB574; --green-l:#E5FAF0;
  --yellow:#FFD66E; --yellow-l:#FFF4D2; --yellow-ink:#8A5A00;
  --coral:#F2556A; --coral-l:#FFECEF; --purple:#6A4BD8; --purple-l:#EFE9FF; --pink:#D63D55; --pink-l:#FFE8EC;
  --st-ok:#1FB574; --st-think:#FFD66E; --st-bad:#F2556A; --st-none:#E7EEF7;
  --radius-l:26px; --radius-m:18px; --radius-s:12px;
  --shadow:0 10px 28px rgba(39,87,151,.08);
  --font:"Pretendard","Apple SD Gothic Neo","Malgun Gothic","Noto Sans KR",sans-serif;
  --num:"Baloo 2","Pretendard",sans-serif;
  color-scheme:light;
}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:#EAF1F8;color:var(--ink);font-family:var(--font);letter-spacing:-.025em;word-break:keep-all;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent}
a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer;padding:0;touch-action:manipulation}
svg{fill:none;stroke:currentColor;stroke-width:2.1;stroke-linecap:round;stroke-linejoin:round}
:focus-visible{outline:3px solid var(--yellow);outline-offset:2px;border-radius:10px}
[hidden]{display:none!important}

.app{position:relative;max-width:440px;min-height:100dvh;margin:0 auto;background:var(--bg);padding-bottom:calc(20px + env(safe-area-inset-bottom,0px));overflow-x:hidden}
@media (min-width:460px){ .app{box-shadow:0 18px 60px rgba(24,52,94,.14)} }

/* ---------- 헤더 ---------- */
.top{position:sticky;top:0;z-index:20;height:64px;padding:calc(env(safe-area-inset-top,0px)) 12px 0;display:flex;align-items:center;gap:8px;background:rgba(255,255,255,.96);border-bottom:1px solid var(--line);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
.app[data-screen="quiz"] .top{display:none}
.top-back{width:36px;height:44px;display:grid;place-items:center}
.top-back svg{width:22px;height:22px;stroke-width:2.4}
.top-brand{display:flex;align-items:center;gap:8px;flex:1}
.top-brand img{width:30px;height:30px}
.top-brand small{display:block;font-size:11px;font-weight:800;color:var(--muted)}
.top-brand b{display:block;font-size:20px;font-weight:900;line-height:1.05}
.icon-btn{width:44px;height:44px;border-radius:14px;background:var(--soft);color:var(--blue);display:grid;place-items:center}
.icon-btn svg{width:22px;height:22px}
.icon-btn--plain{background:var(--card);color:var(--muted)}
#btnSound .ic-off{display:none}
#btnSound[aria-pressed="false"]{color:var(--muted)}
#btnSound[aria-pressed="false"] .ic-on{display:none}
#btnSound[aria-pressed="false"] .ic-off{display:block}

/* ---------- 화면 전환 ---------- */
.screen{display:none;padding:14px}
.app[data-screen="home"] .screen[data-screen="home"],
.app[data-screen="quiz"] .screen[data-screen="quiz"],
.app[data-screen="result"] .screen[data-screen="result"],
.app[data-screen="map"] .screen[data-screen="map"]{display:block}

/* ---------- 공통 부품 ---------- */
.card{background:var(--card);border-radius:var(--radius-l);box-shadow:var(--shadow)}
.block{margin-top:16px}
.block-head{display:flex;justify-content:space-between;align-items:baseline;gap:8px;margin:0 2px 8px}
.block-head h2{margin:0;font-size:18px;font-weight:900}
.block-head span{font-size:12.5px;font-weight:700;color:var(--muted)}
.link-btn{height:32px;padding:0 12px;border-radius:10px;background:var(--blue-l);color:var(--blue);font-size:13px;font-weight:800}
.btn{width:100%;min-height:58px;border-radius:20px;font-size:19px;font-weight:900;display:flex;align-items:center;justify-content:center;gap:8px;margin-top:12px}
.btn svg{width:20px;height:20px;stroke-width:2.6}
.btn--primary{background:var(--blue);color:#fff;box-shadow:0 10px 22px rgba(35,119,243,.28)}
.btn--accent{background:var(--coral);color:#fff;box-shadow:0 10px 22px rgba(242,85,106,.25)}
.btn--plain{background:var(--card);color:var(--ink);box-shadow:var(--shadow);font-size:16px;min-height:52px}
.btn--ghost{background:transparent;color:var(--muted);font-size:15px;min-height:46px}
.btn:disabled{opacity:.45;cursor:default}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.row2 .btn{margin-top:10px}
.bubble{position:relative;background:#fff;border-radius:20px;padding:11px 15px;font-size:16px;font-weight:800;line-height:1.4;box-shadow:var(--shadow);max-width:230px}
.bubble::after{content:"";position:absolute;left:-7px;bottom:18px;width:16px;height:16px;background:#fff;transform:rotate(45deg);border-radius:3px}
.bubble--right::after{left:auto;right:-7px}
.bubble b{color:var(--blue)}
.toast{position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom,0px));transform:translate(-50%,20px);background:var(--ink);color:#fff;font-size:14px;font-weight:700;padding:10px 16px;border-radius:999px;opacity:0;pointer-events:none;transition:.2s;z-index:60;max-width:90vw;text-align:center}
.toast.on{opacity:1;transform:translate(-50%,0)}

/* ---------- 캐릭터 구구 ---------- */
.mascot svg{display:block;width:100%;height:100%}
.mascot--hero{position:absolute;right:16px;bottom:4px;width:150px;height:150px}
.mascot--coach{width:88px;height:88px;flex:none}
.mascot--result{width:116px;height:116px;flex:none}
.mascot.is-hop{animation:hop .8s ease-in-out 2}
.mascot.is-tilt{animation:tilt 1s ease-in-out 1;transform-origin:50% 85%}
@keyframes hop{0%,100%{transform:translateY(0)}45%{transform:translateY(-12px) rotate(-3deg)}}
@keyframes tilt{0%,100%{transform:rotate(0)}30%{transform:rotate(-8deg)}70%{transform:rotate(6deg)}}

/* ---------- 1. 홈 ---------- */
.hero{position:relative;height:230px;border-radius:var(--radius-l);overflow:hidden;background:#DDF2FF;box-shadow:var(--shadow)}
.hero .bubble{position:absolute;left:18px;top:62px;font-size:17px}
.hero-nums i{position:absolute;font-style:normal;font-family:var(--num);font-size:30px;font-weight:800;animation:float 3s ease-in-out infinite}
.hero-nums i:nth-child(1){left:24px;top:18px;color:#2DB6E8}.hero-nums i:nth-child(2){left:70px;top:8px;color:#1FB574;animation-delay:.3s}
.hero-nums i:nth-child(3){left:118px;top:20px;color:#8B6CF0;animation-delay:.6s}.hero-nums i:nth-child(4){left:320px;top:26px;color:#2DB6E8;animation-delay:.9s}
.hero-nums i:nth-child(5){left:26px;top:150px;color:#F2A100;animation-delay:1.2s}.hero-nums i:nth-child(6){left:84px;top:178px;color:#1FB574;animation-delay:1.5s}
.hero-nums i:nth-child(7){left:178px;top:12px;color:#F2556A;animation-delay:1.8s}.hero-nums i:nth-child(8){left:150px;top:180px;color:#8B6CF0;animation-delay:2.1s}
@keyframes float{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
.stages{display:flex;gap:8px}
.stage{flex:1 1 0;min-height:56px;border-radius:16px;background:var(--card);box-shadow:var(--shadow);display:flex;flex-direction:column;align-items:center;justify-content:center;padding:6px 4px}
.stage b{font-size:17px;font-weight:900}.stage span{font-size:12.5px;font-weight:700;color:var(--muted)}
.stage[aria-pressed="true"]{background:var(--blue);color:#fff}.stage[aria-pressed="true"] span{color:rgba(255,255,255,.85)}
.stages--small .stage{min-height:44px}
.dans{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.dans.dans--many{grid-template-columns:repeat(5,minmax(0,1fr))}
.dan{position:relative;height:56px;border-radius:16px;border:3px solid transparent;display:flex;align-items:baseline;justify-content:center;gap:1px}
.dan b{font-family:var(--num);font-size:28px;font-weight:800;line-height:50px}
.dan span{font-size:13px;font-weight:800}
.dans--many .dan{height:50px}.dans--many .dan b{font-size:24px;line-height:44px}
.dan:nth-child(4n+1){background:#E1F0FF;color:#1C6BD8}.dan:nth-child(4n+2){background:#FFF2CF;color:#9A6A00}
.dan:nth-child(4n+3){background:#E1F8EE;color:#13955D}.dan:nth-child(4n+4){background:#EFE9FF;color:#6A4BD8}
.dan[aria-pressed="true"]{border-color:var(--blue)}
.dan[aria-pressed="true"]::after{content:"";position:absolute;top:-8px;right:-6px;width:22px;height:22px;border-radius:50%;background:var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10.5l4 4 8-9'/%3E%3C/svg%3E") center/12px no-repeat}
.btn--start{min-height:64px;font-size:20px;margin-top:16px}
.modes{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
.mode{border-radius:20px;background:var(--card);box-shadow:var(--shadow);padding:14px 12px;display:flex;align-items:center;gap:10px;text-align:left;min-height:72px}
.mode b{display:block;font-size:15.5px;font-weight:900}.mode small{display:block;font-size:12.5px;font-weight:700;color:var(--muted)}
.mode-ic{width:44px;height:44px;border-radius:14px;display:grid;place-items:center;flex:none}
.mode-ic svg{width:24px;height:24px}
.mode-ic--blue{background:var(--blue-l);color:#1C6BD8}.mode-ic--pink{background:var(--pink-l);color:var(--pink)}
.mode-ic--green{background:var(--green-l);color:#13955D}.mode-ic--purple{background:var(--purple-l);color:var(--purple)}
.home-foot{margin-top:16px;display:flex;flex-direction:column;align-items:center;gap:8px}
.switch{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:700;color:var(--muted)}
.switch input{width:20px;height:20px;accent-color:var(--blue)}
.today{margin:0;font-size:14px;font-weight:800;color:var(--muted)}
.today b{color:var(--ink)}

/* ---------- 2. 문제 ---------- */
.q-head{display:flex;align-items:center;gap:8px;padding-top:env(safe-area-inset-top,0px)}
.q-title{flex:1;font-size:16px;font-weight:900;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.q-count{font-family:var(--num);font-size:20px;font-weight:800}
.combo{display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 10px;border-radius:999px;background:var(--yellow-l);color:var(--yellow-ink);font-size:13px;font-weight:900}
.combo svg{width:14px;height:14px;fill:#FF8A3D;stroke:none}
.q-bar{height:10px;border-radius:5px;background:#E2ECF8;margin-top:10px;overflow:hidden}
.q-bar i{display:block;height:100%;width:0;background:var(--blue);border-radius:5px;transition:width .3s}
.q-timer{position:relative;height:28px;border-radius:14px;background:#E2ECF8;margin-top:8px;overflow:hidden}
.q-timer i{position:absolute;left:0;top:0;bottom:0;background:var(--coral);border-radius:14px;transition:width 1s linear}
.q-timer b{position:relative;display:block;text-align:center;line-height:28px;font-family:var(--num);font-size:18px;font-weight:800}
.coach{display:flex;align-items:flex-end;gap:6px;padding:6px 2px 4px}
.coach .bubble{margin-bottom:24px}
.problem{background:var(--card);border:3px solid transparent;border-radius:28px;box-shadow:var(--shadow);padding:16px 10px 18px;display:flex;flex-direction:column;align-items:center;gap:10px;transition:border-color .2s,background .2s}
.app[data-state="ok"] .problem{border-color:var(--green)}
.app[data-state="bad"] .problem{border-color:var(--coral);background:#FFFAFB}
.eq{position:relative;display:flex;align-items:center;gap:10px}
.op{font-family:var(--num);font-size:40px;font-weight:800;color:#9AABC6}
.tile{min-width:88px;height:88px;padding:0 10px;border-radius:24px;display:grid;place-items:center;font-family:var(--num);font-size:58px;font-weight:800;line-height:1}
.tile--a{background:var(--blue-l);color:#1C6BD8}.tile--b{background:var(--yellow-l);color:#9A6A00}.tile--prod{background:var(--purple-l);color:var(--purple)}
.tile.is-blank{background:#F3F8FF;border:3px dashed #9CC2FF;color:var(--blue)}
.read-btn{position:absolute;right:-48px;top:50%;transform:translateY(-50%);width:40px;height:40px;border-radius:12px;background:var(--soft);color:var(--blue);display:grid;place-items:center}
.read-btn svg{width:20px;height:20px}
.answer{min-width:140px;height:88px;padding:0 12px;border-radius:24px;background:#F3F8FF;border:3px dashed #9CC2FF;display:inline-flex;align-items:center;justify-content:center;font-family:var(--num);font-size:58px;font-weight:800;color:var(--ink)}
.answer .caret{display:inline-block;width:4px;height:48px;border-radius:2px;background:var(--blue);margin-left:4px;animation:blink 1s step-end infinite}
.app[data-state="ok"] .answer,.app[data-state="bad"] .answer{border-style:solid}
.app[data-state="ok"] .answer{background:var(--green);border-color:var(--green);color:#fff}
.app[data-state="ok"] .caret,.app[data-state="bad"] .caret{display:none}
.answer.is-voice{font-family:var(--font);font-size:26px;color:var(--blue)}
.answer .wrong-num{font-size:38px;color:#A9B6CC;text-decoration:line-through;text-decoration-color:var(--coral);text-decoration-thickness:4px;margin-right:10px}
.answer .right-num{color:var(--yellow-ink)}
.app[data-state="bad"] .answer{background:var(--yellow-l);border-color:var(--yellow)}
@keyframes blink{50%{opacity:0}}
.problem.is-pop{animation:pop .45s ease-out}
.problem.is-shake{animation:shake .4s ease-in-out}
@keyframes pop{0%{transform:scale(1)}40%{transform:scale(1.04)}100%{transform:scale(1)}}
@keyframes shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-8px)}75%{transform:translateX(8px)}}

.feedback{margin-top:12px}
.fb-ok,.fb-bad{display:none}
.app[data-state="ok"] .fb-ok{display:flex}
.app[data-state="bad"] .fb-bad{display:block}
.fb-ok{flex-wrap:wrap;justify-content:center;gap:8px}
.fb-chip{display:inline-flex;align-items:center;gap:6px;height:40px;padding:0 14px;border-radius:999px;background:var(--card);box-shadow:var(--shadow);font-size:15px;font-weight:900}
.fb-chip .star{width:20px;height:20px;fill:var(--yellow);stroke:#E3A800;stroke-width:1.4}
.fb-chip--speed{color:var(--green)}
.fb-chip--slow{color:var(--yellow-ink)}
.autobar{width:100%;height:8px;border-radius:4px;background:#E2ECF8;overflow:hidden;margin-top:6px}
.autobar i{display:block;height:100%;width:0;background:var(--green);border-radius:4px}
.app[data-state="ok"] .autobar i{animation:fillbar var(--auto,900ms) linear forwards}
@keyframes fillbar{to{width:100%}}
.explain{display:flex;gap:14px;align-items:center;background:var(--card);border-radius:22px;box-shadow:var(--shadow);padding:14px 16px}
.dots{display:grid;gap:4px;flex:none}
.dots i{width:11px;height:11px;border-radius:50%;background:var(--blue);display:block}
.dots i.last{background:var(--yellow)}
.explain-text{font-size:15px;font-weight:800;line-height:1.6}
.explain-text .muted{color:var(--muted)}
.explain-text .big{font-family:var(--num);font-size:28px;font-weight:800}
.explain-text .c1{color:var(--blue)}.explain-text .c2{color:var(--yellow-ink)}
.fb-bad .btn{margin-top:12px}
.app[data-state="ok"] .input-switch,.app[data-state="ok"] .keypad,.app[data-state="ok"] .voice,
.app[data-state="bad"] .input-switch,.app[data-state="bad"] .keypad,.app[data-state="bad"] .voice{display:none!important}

.input-switch{display:flex;gap:4px;margin:14px 0 12px;padding:4px;border-radius:16px;background:#E6EEF8}
.input-switch button{flex:1 1 0;height:44px;border-radius:13px;font-size:15px;font-weight:800;color:var(--muted);display:flex;align-items:center;justify-content:center;gap:6px}
.input-switch button svg{width:20px;height:20px}
.input-switch button[aria-pressed="true"]{background:var(--card);color:var(--ink);box-shadow:0 2px 6px rgba(39,87,151,.12)}
.app[data-mode="speed"] .input-switch{display:none}
.keypad{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:14px}
.input-switch:not([hidden]) + .keypad{margin-top:0}
.keypad button{height:62px;border-radius:18px;background:var(--card);box-shadow:0 3px 10px rgba(39,87,151,.08);font-family:var(--num);font-size:32px;font-weight:800;color:var(--ink);transition:transform .06s}
.keypad button:active{transform:scale(.95)}
.keypad .key-del{background:#E9F0FA;color:var(--muted);display:grid;place-items:center}
.keypad .key-del svg{width:28px;height:28px}
.keypad .key-ok{background:var(--blue);color:#fff;font-family:var(--font);font-size:21px;font-weight:900}
.app[data-input="mic"] .keypad{display:none}
.app[data-input="key"] .voice{display:none!important}

.voice{margin-top:0;height:232px;border-radius:26px;background:var(--card);box-shadow:var(--shadow);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;text-align:center;padding:0 16px}
.voice small{font-size:13px;font-weight:700;color:var(--muted)}
.voice-state{font-size:18px;font-weight:900}
.mic-wrap{position:relative;width:100px;height:100px}
.mic{position:absolute;inset:0;border-radius:50%;background:var(--blue);color:#fff;display:grid;place-items:center;box-shadow:0 10px 22px rgba(35,119,243,.35)}
.mic svg{width:34px;height:34px}
.mic-ring{position:absolute;inset:0;border-radius:50%;background:var(--blue);opacity:0}
.voice.is-listening .mic-ring{animation:ring 1.4s ease-out infinite}
.voice.is-listening .mic-ring--2{animation-delay:.7s}
@keyframes ring{0%{transform:scale(1);opacity:.45}100%{transform:scale(1.65);opacity:0}}
.waves{display:flex;align-items:center;gap:5px;height:26px}
.waves i{width:6px;height:26px;border-radius:3px;background:#C9DBF7;transform:scaleY(.3)}
.voice.is-listening .waves i{background:var(--blue);animation:wave .9s ease-in-out infinite}
.voice.is-listening .waves i:nth-child(2n){animation-delay:.15s}.voice.is-listening .waves i:nth-child(3n){animation-delay:.3s}
@keyframes wave{0%,100%{transform:scaleY(.3)}50%{transform:scaleY(1)}}

/* 별 터짐 */
.burst{position:fixed;inset:0;pointer-events:none;z-index:50}
.burst i{position:absolute;width:26px;height:26px;margin:-13px 0 0 -13px;animation:burst 1s cubic-bezier(.15,.8,.3,1) forwards}
.burst i svg{width:100%;height:100%;stroke:#fff;stroke-width:1.4}
@keyframes burst{0%{opacity:1;transform:translate(0,0) scale(.3)}70%{opacity:1}100%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(1) rotate(var(--r))}}
@media (prefers-reduced-motion:reduce){ .burst{display:none} .mascot.is-hop,.mascot.is-tilt,.problem.is-pop,.problem.is-shake,.hero-nums i{animation:none} }

/* ---------- 3. 결과 ---------- */
.result-top{display:flex;align-items:center;gap:8px;padding:16px}
.result-score{flex:1}
.result-score small{font-size:14px;font-weight:800;color:var(--muted)}
.score b{font-family:var(--num);font-size:56px;font-weight:800;line-height:1.05}
.score span{font-family:var(--num);font-size:26px;font-weight:800;color:#9AABC6}
.stars{display:flex;flex-wrap:wrap;gap:1px}
.stars svg{width:18px;height:18px;stroke-width:1.4}
.stars .on{fill:var(--yellow);stroke:#E3A800}.stars .off{fill:#fff;stroke:#C9D6EA}
.result-msg{margin:6px 0 0;font-size:14px;font-weight:800;color:var(--ink)}
.result-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin-top:12px}
.result-stats div{padding:12px;text-align:center}
.result-stats div+div{border-left:1px solid var(--line)}
.result-stats b{display:block;font-family:var(--num);font-size:24px;font-weight:800}
.result-stats span{font-size:12.5px;font-weight:700;color:var(--muted)}
.c-ok{color:var(--green)}.c-bad{color:var(--coral)}
.result-wrong{margin-top:12px;padding:14px 16px}
.result-wrong h3{margin:0 0 8px;font-size:16px;font-weight:900}
.wrong-list{display:flex;flex-wrap:wrap;gap:6px}
.wrong-list span{height:34px;padding:0 12px;border-radius:999px;background:var(--coral-l);color:var(--coral);font-family:var(--num);font-size:17px;font-weight:800;display:inline-flex;align-items:center}
.result-actions{margin-top:4px}

/* ---------- 4. 지도 ---------- */
.map-card{margin-top:12px;padding:14px 10px}
.map-grid{display:grid;gap:3px}
.map-grid .h{font-family:var(--num);font-size:12px;font-weight:800;color:var(--muted);text-align:center;display:grid;place-items:center}
.map-grid .cell{height:30px;border-radius:8px;font-family:var(--num);font-size:13px;font-weight:800;display:grid;place-items:center;background:var(--st-none);color:#A3B1C7}
.map-grid.is-big .cell{height:16px;border-radius:3px;font-size:0}
.map-grid.is-big .h{font-size:8px}
.cell.st-ok{background:var(--st-ok);color:#fff}.cell.st-think{background:var(--st-think);color:var(--yellow-ink)}.cell.st-bad{background:var(--st-bad);color:#fff}
.cell.is-picked{outline:3px solid var(--ink);outline-offset:1px}
.legend{display:flex;flex-wrap:wrap;gap:6px 12px;margin-top:10px;padding:0 4px;font-size:12.5px;font-weight:700}
.legend span{display:inline-flex;align-items:center;gap:5px}
.legend i{width:13px;height:13px;border-radius:4px;display:block}
.legend .st-ok{background:var(--st-ok)}.legend .st-think{background:var(--st-think)}.legend .st-bad{background:var(--st-bad)}.legend .st-none{background:var(--st-none)}
.map-tip{margin:10px 4px 0;font-size:13.5px;font-weight:800;color:var(--muted);min-height:20px}
.map-counts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:12px}
.map-counts div{background:var(--card);border-radius:18px;box-shadow:var(--shadow);padding:10px;text-align:center}
.map-counts span{display:block;font-size:12px;font-weight:700;color:var(--muted)}
.map-counts b{font-family:var(--num);font-size:24px;font-weight:800}


/* ============================================================
   BAEUM LAB · GUGUDAN LAB v2 — PIGEON EDITION
   ============================================================ */
:root{
  --ink:#152B52;--muted:#7184A3;--line:#E5ECF6;--bg:#F7FBFF;--card:#FFFFFF;--soft:#F0F6FD;
  --blue:#216EF2;--blue-l:#E7F0FF;--green:#20B97A;--green-l:#E7FAF1;
  --yellow:#FFD060;--yellow-l:#FFF4CD;--yellow-ink:#8B6100;
  --coral:#F15B6E;--coral-l:#FFECEF;--purple:#7458D8;--purple-l:#F0EBFF;--pink:#DE5A7A;--pink-l:#FFEAF0;
  --st-ok:#35BE86;--st-think:#FFC54B;--st-bad:#FF776C;--st-none:#E9EFF7;
  --radius-l:24px;--radius-m:18px;--radius-s:12px;--shadow:0 8px 24px rgba(40,77,125,.07)
}
body{background:#EAF0F7;line-height:1.38}.app{max-width:430px;background:linear-gradient(180deg,#F9FCFF 0,#F5FAFF 100%)}
@media(min-width:431px){.app{box-shadow:0 20px 65px rgba(27,51,91,.16)}}
.top{height:68px;padding-left:14px;padding-right:14px;background:rgba(255,255,255,.97);border-bottom:1px solid rgba(225,234,245,.9)}
.top-back{width:34px}.top-brand{gap:9px}.top-brand img{width:28px;height:28px}.top-brand small{font-size:10px;letter-spacing:.02em}.top-brand b{font-size:19px;letter-spacing:-.045em}.icon-btn{width:40px;height:40px;border-radius:13px;background:#F1F6FC;box-shadow:none}.screen{padding:14px 14px 25px}
.card{border:1px solid var(--line);box-shadow:none}.block{margin-top:19px}.block-head{margin:0 2px 10px}.block-head h2{font-size:17px;letter-spacing:-.04em}.block-head span{font-size:11.5px;font-weight:650}.link-btn{height:31px;border-radius:10px;background:#EEF4FF;font-size:12px}.btn{border-radius:17px;font-size:17px;min-height:54px;box-shadow:none}.btn--primary{background:linear-gradient(135deg,#1E67E7,#2B83FA);box-shadow:0 8px 18px rgba(35,119,243,.18)}.btn--accent{background:linear-gradient(135deg,#F35B6F,#FF7582);box-shadow:0 8px 18px rgba(242,85,106,.16)}.btn--plain{border:1px solid var(--line);box-shadow:none}.bubble{border:1px solid #EAF0F8;box-shadow:0 6px 18px rgba(48,79,118,.06);font-size:14px;line-height:1.42;padding:10px 13px}
.mascot--hero{right:22px;bottom:4px;width:154px;height:154px;filter:drop-shadow(0 8px 12px rgba(48,70,112,.10))}.mascot--coach{width:84px;height:84px}.mascot--result{width:112px;height:112px}
.hero{height:235px;border-radius:25px;background:linear-gradient(160deg,#E8F8FF 0%,#F2F8FF 55%,#F8F4FF 100%);border:1px solid #E2EEF8;box-shadow:none}.hero:before,.hero:after{content:"";position:absolute;border-radius:50%;background:rgba(255,255,255,.78)}.hero:before{width:72px;height:25px;left:20px;top:34px;box-shadow:22px -7px 0 -3px rgba(255,255,255,.8)}.hero:after{width:54px;height:18px;right:18px;top:38px;box-shadow:17px -6px 0 -4px rgba(255,255,255,.8)}.hero .bubble{left:20px;top:78px;font-size:14px;z-index:2}.hero-nums i{font-size:27px;opacity:.9;filter:drop-shadow(0 2px 0 rgba(255,255,255,.7))}.hero-nums i:nth-child(1){left:24px;top:14px}.hero-nums i:nth-child(2){left:76px;top:17px}.hero-nums i:nth-child(3){left:126px;top:22px}.hero-nums i:nth-child(4){left:auto;right:28px;top:23px}.hero-nums i:nth-child(5){left:23px;top:166px}.hero-nums i:nth-child(6){left:77px;top:191px}.hero-nums i:nth-child(7){left:161px;top:17px}.hero-nums i:nth-child(8){left:150px;top:189px}
.stages{gap:7px}.stage{min-height:54px;border-radius:15px;border:1px solid var(--line);box-shadow:none;background:#fff}.stage b{font-size:15px}.stage span{font-size:11.5px}.stage[aria-pressed="true"]{background:#EAF2FF;color:#1E67E7;border-color:#A9C7FF;box-shadow:inset 0 0 0 1px #A9C7FF}.stage[aria-pressed="true"] span{color:#537DB9}.dans{gap:8px}.dan{height:52px;border-radius:15px;border-width:2px}.dan b{font-size:26px;line-height:48px}.dan:nth-child(4n+1){background:#E8F3FF}.dan:nth-child(4n+2){background:#FFF4D8}.dan:nth-child(4n+3){background:#E8F9F1}.dan:nth-child(4n+4){background:#F1EDFF}.dan[aria-pressed="true"]{border-color:#2B76F2;box-shadow:0 0 0 2px rgba(43,118,242,.08)}.dan[aria-pressed="true"]::after{width:19px;height:19px;top:-6px;right:-4px;box-shadow:0 2px 7px rgba(37,101,214,.20)}.btn--start{min-height:58px;font-size:17px;margin-top:14px}.modes{gap:9px;margin-top:12px}.mode{border-radius:18px;border:1px solid var(--line);box-shadow:none;min-height:72px;padding:12px 11px}.mode b{font-size:14px}.mode small{font-size:11.5px}.mode-ic{width:40px;height:40px;border-radius:13px}.home-foot{margin-top:15px}
.q-head{padding:3px 0 8px}.q-title{font-size:15px}.q-count{font-size:13px}.q-bar{height:6px;background:#E5EDF7}.q-bar i{background:linear-gradient(90deg,#2477F2,#65BAFF)}.coach{min-height:91px;padding:8px 9px;margin-top:9px;background:linear-gradient(180deg,#EDF8FF,#F8FCFF);border:1px solid #E5EFF8;border-radius:21px;box-shadow:none}.coach .bubble{font-size:12.5px}.problem{margin-top:11px;border-radius:23px;border:1px solid #E4EBF5;box-shadow:none;padding:22px 18px}.op{font-size:34px;color:#95A6C0}.tile{min-width:78px;height:78px;border-radius:19px;font-size:50px}.tile--a{background:#E5EFFF}.tile--b{background:#FFF1C9}.tile--prod{background:#EEE9FF}.tile.is-blank{border-width:2px;background:#F8FBFF}.answer{min-width:126px;height:78px;border-radius:19px;border-width:2px;font-size:50px;background:#FAFCFF}.answer .caret{height:42px;width:3px}.read-btn{right:-42px;width:36px;height:36px;border-radius:11px}.input-switch{border-radius:14px;padding:3px;margin:12px 0 10px}.input-switch button{height:40px;border-radius:11px;font-size:13.5px}.keypad{gap:8px;margin-top:11px}.keypad button{height:56px;border-radius:15px;border:1px solid var(--line);box-shadow:none;font-size:28px;background:#fff}.keypad .key-ok{border:0;background:linear-gradient(135deg,#216EF2,#2D86FA);font-size:18px}.keypad .key-del{background:#EEF3FA}.voice{height:220px;border-radius:22px;border:1px solid var(--line);box-shadow:none}.mic-wrap{width:90px;height:90px}.mic{background:linear-gradient(145deg,#4A9BFF,#2167E7);box-shadow:0 9px 22px rgba(35,119,243,.20)}.voice-state{font-size:16px}
.fb-chip{height:37px;border:1px solid var(--line);box-shadow:none;font-size:13px}.explain{border:1px solid var(--line);border-radius:20px;box-shadow:none}.explain-text{font-size:13.5px}.explain-text .big{font-size:25px}.dots i{width:9px;height:9px}.app[data-state="ok"] .problem{background:linear-gradient(180deg,#F7FFFB,#EEFBF5);border-color:#BFEBD7}.app[data-state="bad"] .problem{background:linear-gradient(180deg,#FFFDFC,#FFF4F1);border-color:#FFD3CC}.app[data-state="ok"] .answer{background:#20B97A;border-color:#20B97A}.app[data-state="bad"] .answer{background:#FFF3D6;border-color:#FFD060}
.result-top{padding:14px 15px;border-radius:23px;background:linear-gradient(160deg,#EEF8FF,#F8FBFF);border:1px solid var(--line)}.result-score small{font-size:12.5px}.score b{font-size:50px}.score span{font-size:23px}.result-msg{font-size:13px}.result-stats{border:1px solid var(--line);border-radius:18px;background:#fff;overflow:hidden}.result-stats div{padding:11px}.result-stats b{font-size:22px}.result-wrong{border:1px solid var(--line);box-shadow:none}.wrong-list span{font-size:15px;height:31px}.map-card{border:1px solid var(--line);box-shadow:none;border-radius:22px;background:#fff}.map-grid{gap:4px}.map-grid .cell{height:28px;border-radius:7px}.map-grid.is-big .cell{height:15px}.legend{font-size:11px;color:#6E809D}.map-counts{gap:7px}.map-counts div{border:1px solid var(--line);box-shadow:none;border-radius:16px}.map-counts b{font-size:21px}
@media(max-width:370px){.screen{padding-left:11px;padding-right:11px}.hero{height:225px}.mascot--hero{right:10px;width:145px;height:145px}.hero .bubble{left:13px;max-width:185px}.dans{gap:6px}.dan{height:50px}.mode{padding:10px 8px}.tile{min-width:72px;height:72px;font-size:46px}.answer{min-width:114px;height:72px;font-size:46px}.keypad button{height:53px}}

/* =========================================================
   작은 화면 보정 (기능 담당 추가)
   - 키가 작은 휴대폰(높이 720px 이하)에서 '확인' 버튼이 화면 밖으로 밀리지 않게 압축
   - 가로 화면에서는 문제(왼쪽) + 키패드(오른쪽) 두 칸 배치
   ========================================================= */
@media (max-height:740px) and (orientation:portrait){
  .app[data-screen="quiz"] .screen[data-screen="quiz"]{padding-top:10px}
  .coach{padding:2px 2px 0}
  .mascot--coach{width:60px;height:60px}
  .coach .bubble{margin-bottom:14px;font-size:14px;padding:8px 12px}
  .problem{padding:12px 8px 14px;gap:8px}
  .tile{min-width:68px;height:68px;font-size:44px;border-radius:20px}
  .op{font-size:32px}
  .answer{min-width:116px;height:68px;font-size:44px;border-radius:20px}
  .answer .caret{height:38px}
  .input-switch{margin:10px 0 8px}
  .input-switch button{height:40px}
  .keypad{gap:8px}
  .keypad button{height:50px;font-size:28px}
  .voice{height:200px}
}
@media (orientation:landscape) and (max-height:520px){
  .app{max-width:none}
  .app[data-screen="quiz"] .screen[data-screen="quiz"]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:16px;align-items:start;padding:10px 16px}
  .q-head,.q-bar,.q-timer{grid-column:1 / -1}
  .coach{display:none}
  .problem{grid-column:1;grid-row:4 / span 3;margin-top:10px}
  .feedback{grid-column:2;grid-row:4;margin-top:10px}
  .input-switch{grid-column:2;grid-row:4;margin:10px 0 8px}
  .keypad,.voice{grid-column:2;grid-row:5}
  .keypad button{height:52px;font-size:26px}
  .voice{height:220px}
  .tile{min-width:72px;height:72px;font-size:46px}
  .answer{min-width:120px;height:72px;font-size:46px}
  .screen[data-screen="home"],.screen[data-screen="result"],.screen[data-screen="map"]{max-width:560px;margin:0 auto}
}
@media (max-height:660px) and (orientation:portrait){
  .q-bar{margin-top:6px}
  .mascot--coach{width:50px;height:50px}
  .coach .bubble{margin-bottom:10px}
  .problem{padding:10px 8px 12px}
  .tile{min-width:62px;height:62px;font-size:40px}
  .answer{height:62px;font-size:40px}
  .keypad{gap:6px}
  .keypad button{height:46px;font-size:26px}
  .input-switch{margin:8px 0 6px}
}

/* =========================================================
   상단 이미지(히어로) — 목업 '홈' 화면과 똑같은 배치
   (목업 기준 폭 362px의 좌표를 % 로 바꿔 폭이 달라도 같은 구도)
   ========================================================= */
.hero{height:236px;border:0;border-radius:26px;background:#DDF2FF;box-shadow:0 10px 28px rgba(39,87,151,.08)}
.hero:before,.hero:after{display:none!important}
.hero .cloud{position:absolute;display:block;background:#fff;border-radius:999px;opacity:.9;pointer-events:none}
.hero .cloud::after{content:"";position:absolute;border-radius:50%;background:#fff}
.hero .cloud--1{left:7.18%;top:40px;width:70px;height:22px}
.hero .cloud--1::after{left:13px;top:-14px;width:29px;height:29px}
.hero .cloud--2{left:74.03%;top:30px;width:62px;height:20px}
.hero .cloud--2::after{left:11px;top:-12px;width:26px;height:26px}
.hero-nums{display:block!important}
.hero-nums i{position:absolute;font-style:normal;font-family:var(--num);font-size:30px;font-weight:800;opacity:1;filter:none;right:auto;animation:float 3s ease-in-out infinite}
.hero-nums i:nth-child(1){left:6.63%;top:58px;color:#2DB6E8}
.hero-nums i:nth-child(2){left:17.13%;top:28px;color:#1FB574;animation-delay:.3s}
.hero-nums i:nth-child(3){left:25.97%;top:52px;color:#8B6CF0;animation-delay:.6s}
.hero-nums i:nth-child(4){left:88.4%;top:40px;color:#2DB6E8;animation-delay:.9s}
.hero-nums i:nth-child(5){left:8.29%;top:128px;color:#F2A100;animation-delay:1.2s}
.hero-nums i:nth-child(6){left:19.34%;top:160px;color:#1FB574;animation-delay:1.5s}
.hero-nums i:nth-child(7){left:82.87%;top:182px;color:#F2556A;animation-delay:2.1s}
.hero-nums i:nth-child(8){left:91.16%;top:120px;color:#8B6CF0;animation-delay:1.8s}
.hero .bubble{left:20px;top:66px;bottom:auto;max-width:190px;font-size:17px;line-height:1.4;padding:11px 15px;z-index:2}
.hero .bubble::after{left:auto;right:-7px;bottom:18px}
.mascot--hero{right:22px;bottom:6px;width:150px;height:150px;z-index:1;filter:none}
@media (max-width:370px){.hero .bubble{max-width:180px;font-size:16px}.mascot--hero{right:16px;width:142px;height:142px}}

/* 구구 그림은 아이콘용 공통 선 규칙(svg{stroke…})을 받지 않게 — 목업과 같은 모양 유지 */
.mascot svg{fill:#000;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter}

/* 캐릭터 이미지 (배움랩 비둘기 라인업) */
.mascot img{display:block;width:100%;height:100%;object-fit:contain;object-position:center bottom}
