/* theme.css: '동화마을' 테마 (파스텔 · 둥근 스티커 · 큰 캐릭터). styles.css 뒤에 불러와서 덮어씀.
   되돌리려면 index.html 에서 이 파일 링크만 지우면 됨. 항상 밝은 화면 (다크 모드 끔). */
:root,
:root:not([data-theme="light"]){
  color-scheme:light;
  --bg:#f3ecff;--card:#ffffff;--ink:#4f3f63;--muted:#85768f;--line:#e6dcf3;
  --brand:#ee5a93;--brand2:#ff9a62;--ok:#1fa971;--bad:#e5484d;--warn:#f5a623;
  --sun:#fff0b8;--mint:#cdf3e4;--pink:#ffc9dc;--lav:#e3d9ff;--peach:#ffd9c7;--sky:#d3ecff;
}
@media (prefers-color-scheme:dark){
  :root{color-scheme:light;--bg:#f3ecff;--card:#ffffff;--ink:#4f3f63;--muted:#85768f;--line:#e6dcf3}
}
body{background:linear-gradient(#cfe9ff,#f3ecff 45%,#ffeede) fixed;min-height:100vh;color:var(--ink)}
main{max-width:900px}

/* 위 막대: 가볍게, 메뉴는 가로로 밀어서 보는 알약 */
.top{background:rgba(255,255,255,.82);backdrop-filter:blur(6px);border-bottom:0;border-radius:0 0 26px 26px;box-shadow:0 4px 0 rgba(79,63,99,.06);flex-wrap:wrap;gap:6px 8px}
.brand{font-weight:900;font-size:1.15rem}
nav{flex:1 1 100%;order:5;flex-wrap:nowrap;overflow-x:auto;gap:8px;padding:2px 0 6px;-webkit-overflow-scrolling:touch;scrollbar-width:none}
nav::-webkit-scrollbar{display:none}
nav button{flex:none;background:#fff;border:0;border-radius:999px;padding:10px 18px;min-height:46px;font-weight:800;box-shadow:0 3px 0 rgba(79,63,99,.1);white-space:nowrap}
nav button.on{background:var(--brand);color:#fff;box-shadow:0 3px 0 #c43d76}
.chip{background:#fff;border:0;border-radius:999px;box-shadow:0 3px 0 rgba(79,63,99,.1);font-weight:800}
.swbtn{background:#fff;border:0;border-radius:999px;box-shadow:0 3px 0 rgba(79,63,99,.1);font-weight:800;color:var(--muted)}

/* 글자와 카드 */
h1{font-weight:900}
.card{border:0;border-radius:28px;box-shadow:0 6px 0 rgba(79,63,99,.07);padding:20px}
.tile{border:0;border-radius:28px;box-shadow:0 6px 0 rgba(79,63,99,.08);text-align:center;padding:16px 10px;min-height:118px}
.tile .em{font-size:2.6rem;line-height:1.2}.tile b{font-weight:900}.tile span{color:#7a6a8a}
.grid .tile:nth-child(6n+1){background:var(--sun)}.grid .tile:nth-child(6n+2){background:var(--mint)}.grid .tile:nth-child(6n+3){background:var(--pink)}
.grid .tile:nth-child(6n+4){background:var(--lav)}.grid .tile:nth-child(6n+5){background:var(--peach)}.grid .tile:nth-child(6n){background:var(--sky)}
.pill{background:#fff;border:0;border-radius:999px;box-shadow:0 3px 0 rgba(79,63,99,.08);font-weight:700;padding:6px 14px}
button.pill{min-height:40px}

/* 버튼: 눌리는 맛 */
.btn{background:linear-gradient(#ff8fb8,#ee5a93);border-radius:999px;box-shadow:0 6px 0 #c43d76;padding:14px 28px;font-weight:900;transition:transform .08s,box-shadow .08s}
.btn:active{transform:translateY(4px);box-shadow:0 2px 0 #c43d76}
.btn.alt{background:#fff;color:var(--ink);border:0;box-shadow:0 5px 0 rgba(79,63,99,.12)}
.btn.alt:active{box-shadow:0 1px 0 rgba(79,63,99,.12)}
.btn.ok{background:linear-gradient(#52d69c,#1fa971);box-shadow:0 6px 0 #167a52}
.btn.bad{background:linear-gradient(#ff8c8c,#e5484d);box-shadow:0 6px 0 #b3262b}

/* 진행 막대 */
.progress{height:16px;background:#fff;border-radius:99px;box-shadow:inset 0 0 0 2px #fff,0 2px 0 rgba(79,63,99,.06)}
.progress i{background:linear-gradient(90deg,#ffd45e,#ff9cc2);border-radius:99px}

/* 문제 화면 */
.q{font-weight:800}
.opt{border:0;border-radius:26px;box-shadow:0 6px 0 rgba(79,63,99,.12);font-weight:800;text-align:center;background:#fff}
.opts .opt:nth-child(4n+1){background:var(--sun)}.opts .opt:nth-child(4n+2){background:var(--mint)}
.opts .opt:nth-child(4n+3){background:var(--pink)}.opts .opt:nth-child(4n){background:var(--lav)}
.opt:active{transform:translateY(3px);box-shadow:0 3px 0 rgba(79,63,99,.12)}
.opt.right{background:#c8f5dc!important;outline:5px solid #6fd6a3;box-shadow:0 6px 0 #4cb585}
.opt.wrong{background:#ffd9d9!important;outline:4px solid #ff9a9a}
.fb{border-radius:22px;font-weight:800}
.display,input[type=text],input[type=password],textarea{border:3px solid #e6dcf3;border-radius:22px;background:#fff}
.pad button{border:0;border-radius:22px;box-shadow:0 5px 0 rgba(79,63,99,.12);background:#fff}
.passage{background:#fff8e6;border-left:0;border-radius:20px}
.model{background:#fff;border-left:0;border-radius:20px}

/* 홈: 큰 캐릭터와 말풍선 */
.stage{text-align:center;position:relative;padding:6px 0 2px}
.say{display:inline-block;background:#fff;border-radius:26px;padding:12px 22px;font-size:1.15rem;font-weight:800;position:relative;margin-bottom:14px;box-shadow:0 5px 0 rgba(79,63,99,.08)}
.say:after{content:"";position:absolute;left:50%;bottom:-12px;margin-left:-12px;border:12px solid transparent;border-top-color:#fff;border-bottom:0}
.stage .herochar{width:210px;margin:0 auto}
.stage .herochar .char{width:100%;height:auto;aspect-ratio:1/1;animation:bob 2.8s ease-in-out infinite}
@keyframes bob{50%{transform:translateY(-8px)}}
.stage h1{margin:.1em 0}
.stage .progress{max-width:420px;margin:8px auto}
.stickers{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin:8px 0}
.cta{display:block;margin:14px auto 4px;font-size:1.35rem;padding:18px 44px}
.herochar,.bgprev{border-radius:30px}

/* 정답 반응 말풍선, 토스트 */
.toast{background:#4f3f63}
.modal{border-radius:32px}

/* 탐험/말풍선 */
.exbubble{border-color:#e6dcf3;border-radius:24px}
.exhero{border-radius:28px}

@media (max-width:560px){
  .stage .herochar{width:170px}
  .top{border-radius:0 0 20px 20px}
}
@media (prefers-reduced-motion:reduce){.stage .herochar .char{animation:none}}

/* 캐릭터 응원 말풍선 + 불꽃 */
.cheer{display:flex;align-items:center;gap:10px;margin:6px 0 10px}
.cheerchar{width:72px;flex:none}.cheerchar .char{width:72px;height:72px}
.cheerbub{position:relative;background:#fff;border-radius:20px;padding:9px 16px;font-weight:800;min-height:42px;display:flex;align-items:center;box-shadow:0 4px 0 rgba(79,63,99,.08);flex:0 1 auto;max-width:calc(100% - 90px)}
.cheerbub:empty{display:none}
.cheerbub:before{content:"";position:absolute;left:-10px;top:50%;margin-top:-8px;border:8px solid transparent;border-right-color:#fff;border-left:0}
.cheerbub.pop{animation:popin .35s ease}
@keyframes popin{0%{transform:scale(.8);opacity:0}70%{transform:scale(1.05)}100%{transform:scale(1);opacity:1}}
.flame{display:inline-flex;align-items:center;gap:2px;font-weight:900;color:#e8590c}
.flame i{font-style:normal;display:inline-block;transform-origin:50% 90%;font-size:1.3rem;filter:grayscale(1);opacity:.35}
.flame.lv1 i{filter:none;opacity:1;font-size:1.4rem;animation:flick 1.2s ease-in-out infinite}
.flame.lv2 i{filter:none;opacity:1;font-size:1.9rem;animation:flick .9s ease-in-out infinite;text-shadow:0 0 10px #ffb347}
.flame.lv3 i{filter:drop-shadow(0 0 6px #ff9500) saturate(1.4);opacity:1;font-size:2.4rem;animation:flick .7s ease-in-out infinite}
.flame.lv4 i{filter:hue-rotate(190deg) drop-shadow(0 0 8px #4dabf7) saturate(1.6);opacity:1;font-size:2.8rem;animation:flick .6s ease-in-out infinite}
.flame.lv4{color:#1c7ed6}
.flame.lv5 i{filter:drop-shadow(0 0 10px #ff6bd6);opacity:1;font-size:3.1rem;animation:flick .5s ease-in-out infinite,rainbow 2.4s linear infinite}
.flame.lv5{color:#c2255c}
.flame b{font-size:1.2rem}
.flame.boom i{animation:boom .7s ease-out}
@keyframes flick{0%,100%{transform:scale(1) rotate(-2deg)}50%{transform:scale(1.12,1.18) rotate(3deg)}}
@keyframes boom{0%{transform:scale(.4)}60%{transform:scale(1.6)}100%{transform:scale(1)}}
@keyframes rainbow{to{filter:hue-rotate(360deg) drop-shadow(0 0 10px #ff6bd6)}}
#flame{min-width:64px;text-align:right}
.pill .flame i{font-size:1.1rem!important;filter:none;opacity:1}
.pill .flame.lv0 i{filter:grayscale(1);opacity:.4}
.pill .flame.lv4 i{filter:hue-rotate(190deg)!important}
@media (prefers-reduced-motion:reduce){.flame i,.cheerbub.pop{animation:none!important}}

/* 점프 러너 */
.runwrap{max-width:760px;margin:0 auto}
.runhud{display:flex;justify-content:space-between;align-items:center;font-weight:900;font-size:1.2rem;padding:6px 10px}
#rcv{width:100%;height:auto;touch-action:none;-webkit-user-select:none;user-select:none;border-radius:26px;box-shadow:0 6px 0 rgba(79,63,99,.1);touch-action:manipulation;display:block;background:#cfe9ff}

/* 불편 신고 버튼 */
.fbfab{position:fixed;right:max(12px,env(safe-area-inset-right,0px));bottom:max(12px,env(safe-area-inset-bottom,0px));z-index:40;border:0;border-radius:999px;padding:10px 16px;min-height:44px;background:#fff;color:var(--muted);font-weight:800;box-shadow:0 4px 0 rgba(79,63,99,.14),0 2px 10px rgba(79,63,99,.12);opacity:.92}
body:has(#rcv) .fbfab{display:none}
@media print{.fbfab{display:none}}

#rjump{width:100%;max-width:760px;margin:12px auto 0;font-size:1.6rem;padding:22px}
.modal{max-height:92vh;overflow:auto}

/* 영어 문장제 읽기 도움 */
.kw{border-bottom:2px dotted var(--brand);cursor:pointer;padding:0 1px;border-radius:4px}
.kw.blink{animation:kwblink 1.4s ease-in-out infinite;background:rgba(255,212,94,.35)}
.kw.off{border-bottom-color:transparent}
@keyframes kwblink{50%{background:rgba(255,154,194,.55);box-shadow:0 0 0 3px rgba(255,154,194,.3)}}
.kohelp{margin:6px 0 4px}
.kotext{margin-top:8px;padding:10px 14px;background:#fff8e6;border-radius:18px;font-weight:700;line-height:1.7}
@media (prefers-reduced-motion:reduce){.kw.blink{animation:none}}

@media (max-width:700px){.fbfab{font-size:.8rem;padding:6px 12px;min-height:36px;opacity:.8}}

/* 러너: 생명 게이지 */
.lifewrap{display:inline-flex;align-items:center;gap:8px}
.lifewrap .hearts{font-size:1.4rem;letter-spacing:1px}
.lifebar{display:inline-block;width:96px;height:14px;border-radius:99px;background:#e6eefb;overflow:hidden;box-shadow:inset 0 0 0 2px #fff}
.lifebar i{display:block;height:100%;border-radius:99px;transition:width .25s,background .25s}

/* 영어 문장제 도움: 소리 따라 읽기, 그림 */
.w.say{background:#ffe08a;border-radius:6px;box-shadow:0 0 0 3px #ffe08a}
.pics{display:flex;flex-wrap:wrap;gap:6px 10px;justify-content:center;align-items:center;font-size:2rem;line-height:1.1}
.pic{display:inline-block}.pic.gone{opacity:.25;filter:grayscale(1)}
.pbox{display:inline-flex;gap:2px;padding:6px 8px;border:3px dashed #d9c9a8;border-radius:14px;background:#fff8e6}
.kohelp .row{gap:8px}

.lifewrap b{font-size:1rem;min-width:2.6em}

/* 점프 러너: 월드 고르기, 진행 막대, 클리어 화면 */
.runstage{display:flex;align-items:center;gap:10px;padding:2px 6px 6px}
.runstage .prog{position:relative;flex:1;height:12px;border-radius:99px;background:#e6eefb;box-shadow:inset 0 0 0 2px #fff;display:block}
.runstage .prog i{display:block;height:100%;border-radius:99px;background:linear-gradient(90deg,#ffd45e,#ff9cc2)}
.runstage .prog em{position:absolute;right:-4px;top:-12px;font-style:normal;font-size:1.5rem}
.stagecards{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin-top:10px}
.stagecard{border:0;border-radius:26px;padding:18px 14px;text-align:center;box-shadow:0 6px 0 rgba(79,63,99,.12);color:#fff}
.stagecard b{display:block;font-size:1.3rem}.stagecard .sid{font-weight:900;opacity:.9}.stagecard .muted2{color:#fff;opacity:.95}
.stagecard.th-day{background:linear-gradient(#7fd3ff,#52b36b)}
.stagecard.th-night{background:linear-gradient(#3b4aa8,#1d2766)}
.stagecard.th-castle{background:linear-gradient(#ff9a62,#8a5fb0)}
.stagecard.lock{filter:grayscale(.9);opacity:.6}
.board td{padding:6px 8px;border-bottom:1px solid var(--line)}.board tr.me td{background:#fff3b8;font-weight:800}
.clearcard{text-align:center}.bigscore{font-size:2.6rem;font-weight:900;color:#ee5a93;line-height:1.1}.bigscore small{font-size:1.1rem;margin-left:4px}
.scorerows{max-width:360px;margin:8px auto}.rankline{margin-top:8px;font-size:1.1rem}
.goalscene{position:relative;height:200px;max-width:380px;margin:0 auto;overflow:hidden;border-radius:22px;background:linear-gradient(#cfe9ff,#ffeede)}
.clearcard.win .goalscene{background:linear-gradient(#ffd8a8,#ffb3d1)}
.gcastle{position:absolute;right:26px;bottom:6px;font-size:120px;line-height:1}.gcastle.dim{opacity:.4;filter:grayscale(1)}
.gpole{position:absolute;left:96px;bottom:6px;width:5px;height:150px;background:#eceef6;border-radius:3px;box-shadow:0 0 0 1px #c9cfe8}
.gflag{position:absolute;left:101px;bottom:104px;width:54px;height:30px;background:linear-gradient(#ff5f6d,#ee5a93);clip-path:polygon(0 0,100% 50%,0 100%);transform-origin:left center;animation:flagwave .55s ease-in-out infinite alternate}
@keyframes flagwave{from{transform:skewY(-6deg) scaleX(.9)}to{transform:skewY(6deg) scaleX(1.1)}}
.ghero{position:absolute;left:12px;bottom:6px;width:76px;height:76px;font-size:56px;animation:herohop .9s ease-in-out infinite}
@keyframes herohop{50%{transform:translateY(-14px)}}
.fwk{position:absolute;font-size:34px;animation:fwk 1.6s ease-out infinite}
.fwk.f1{left:20%;top:8px}.fwk.f2{left:55%;top:14px;animation-delay:.4s}.fwk.f3{left:78%;top:40px;animation-delay:.8s}.fwk.f4{left:38%;top:44px;animation-delay:1.1s}
@keyframes fwk{0%{transform:scale(.3);opacity:0}30%{opacity:1}100%{transform:scale(1.5);opacity:0}}
@media (prefers-reduced-motion:reduce){.gflag,.ghero,.fwk{animation:none}}

/* 귀여운 글꼴: 주아(Jua, SIL OFL 1.1) - 한글 2,350자만 담아 직접 호스팅해요 (구글 폰트는 중국에서 막힐 수 있어서) */
@font-face{font-family:"JuaKR";src:url("fonts/jua-ko-subset.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
:root{--font-ui:"JuaKR","Noto Sans KR","Malgun Gothic",system-ui,sans-serif}
h1,h2,.brand,nav button,.btn,.pill,.tile b,.say,.cheerbub,.bigscore,.stagecard,.stagecard b,.chip,.swbtn,.runstage b,.lifewrap b,.fbfab,.exname,.opts .opt{font-family:var(--font-ui)}
h1,h2,.bigscore{font-weight:400;letter-spacing:.01em}
.btn,nav button,.stagecard b{letter-spacing:.02em}
.btn,nav button,.pill,.tile b,.say,.cheerbub,.stagecard,.stagecard b,.chip,.swbtn,.runstage b,.lifewrap b,.fbfab,.exname,.opts .opt,.brand{font-weight:400}

/* 한자 따라쓰기 */
.hzbox{width:260px;height:260px;margin:8px auto;border-radius:22px;background:#fff;box-shadow:inset 0 0 0 3px #e6dcf3;position:relative;touch-action:none;
  background-image:linear-gradient(#f0e9fa 1px,transparent 1px),linear-gradient(90deg,#f0e9fa 1px,transparent 1px);background-size:130px 130px;background-position:center}
.hzbox svg{display:block;width:100%;height:100%;touch-action:none}

/* 한글·숫자 놀이 */
.kpwrap{max-width:480px;margin:0 auto}
#kpcv{width:100%;max-width:480px;height:auto;border-radius:26px;box-shadow:0 6px 0 rgba(79,63,99,.1);display:block;touch-action:none;margin:6px auto}
#kpcv{width:100%!important;max-width:480px;height:auto!important;aspect-ratio:480/560}
#kpcv{width:auto!important;max-width:100%;max-height:66vh;margin-left:auto;margin-right:auto}

/* 코딩 놀이터 */
.cgrid{display:grid;gap:3px;margin:6px auto;background:#e6dcf3;padding:6px;border-radius:16px}
.cc{aspect-ratio:1;background:#fff;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:1.5rem}
.cc.cw{background:#f1d9c8}
.crobot{position:relative;font-size:1.7rem;line-height:1}
.crobot small{position:absolute;right:-8px;bottom:-6px;font-size:.7rem}
.cws{height:300px;max-width:560px;margin:8px auto;border-radius:16px;overflow:hidden;border:2px solid #e6dcf3;background:#fff}
