@font-face { font-family: Fredoka; font-weight: 500; src: url(fonts/fredoka-latin-500-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Fredoka; font-weight: 600; src: url(fonts/fredoka-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Fredoka; font-weight: 700; src: url(fonts/fredoka-latin-700-normal.woff2) format('woff2'); font-display: swap; }
:root { --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --green: #3fd17a; --green2: #1e9d55; --blue: #2a9df4; --blue2: #1767b8; --orange: #ff9a1f; --orange2: #c96300; --pink: #ff4f9a; --ink: #1d2b4f; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd3ff; font-family: Fredoka, system-ui, 'Noto Sans CJK JP', 'Noto Sans CJK KR', 'Hiragino Sans', 'Apple SD Gothic Neo', sans-serif; color: #fff; touch-action: none; overscroll-behavior: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.scr { position: absolute; inset: 0; display: none; flex-direction: column; padding: calc(var(--st) + 10px) 14px calc(var(--sb) + 14px); pointer-events: none; }
body[data-scr=home] #home, body[data-scr=levels] #levels, body[data-scr=shop] #shop, body[data-scr=hud] #hud { display: flex; }
.scr > * { pointer-events: auto; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 20px; font-weight: 700; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.2); transition: transform .08s; position: relative; }
.btn:active { transform: translateY(3px) scale(.98); }
.btn.big { font-size: 34px; height: 76px; width: min(330px, 86vw); background: linear-gradient(#5be38f, var(--green)); box-shadow: 0 6px 0 var(--green2), 0 10px 20px rgba(0,0,0,.25); letter-spacing: 1px; }
.btn.big small { display: block; font-size: 15px; font-weight: 600; opacity: .95; letter-spacing: 0; }
.btn.mid { font-size: 20px; height: 58px; padding: 0 18px; background: linear-gradient(#4fb6ff, var(--blue)); box-shadow: 0 5px 0 var(--blue2), 0 8px 14px rgba(0,0,0,.2); }
.btn.orange { background: linear-gradient(#ffb64f, var(--orange)); box-shadow: 0 5px 0 var(--orange2), 0 8px 14px rgba(0,0,0,.2); }
.btn.pink { background: linear-gradient(#ff7ab5, var(--pink)); box-shadow: 0 5px 0 #b8246a, 0 8px 14px rgba(0,0,0,.2); }
.btn.round { width: 50px; height: 50px; border-radius: 50%; font-size: 24px; background: rgba(255,255,255,.92); color: var(--ink); text-shadow: none; box-shadow: 0 4px 0 rgba(0,0,0,.15); }
.btn.round svg { width: 26px; height: 26px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(20,40,90,.45); backdrop-filter: blur(4px); border-radius: 999px; padding: 6px 14px 6px 6px; font-weight: 700; font-size: 20px; }
.coin { width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6b0, #ffd23f 40%, #e09a00); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); display: inline-block; position: relative; flex: none; }
.coin::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; border: 2px solid rgba(180,110,0,.45); }
.star-i { color: #ffd23f; font-size: 22px; text-shadow: 0 2px 0 #b57a00; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.top .right { display: flex; gap: 8px; align-items: center; }
/* logo */
.logo { text-align: center; margin-top: 8px; transform: rotate(-3deg); animation: logoIn .7s cubic-bezier(.2,1.6,.4,1) both; }
.logo .l1 { font-size: clamp(26px, 8.5vw, 38px); font-weight: 700; color: #fff; letter-spacing: 1px; text-shadow: 0 3px 0 #1d4fb0, 2px 0 0 #1d4fb0, -2px 0 0 #1d4fb0, 0 -2px 0 #1d4fb0, 2px 2px 0 #1d4fb0, -2px 2px 0 #1d4fb0, 0 6px 10px rgba(0,0,0,.25); }
.logo .l1 b { color: #ffd23f; }
.logo .l2 { font-size: clamp(46px, 16vw, 72px); font-weight: 700; line-height: .95; background: linear-gradient(#fff36b, #ffb21f 55%, #ff7a1a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #8a3500) drop-shadow(2px 0 0 #8a3500) drop-shadow(-2px 0 0 #8a3500) drop-shadow(0 -2px 0 #8a3500) drop-shadow(0 8px 10px rgba(0,0,0,.25)); }
@keyframes logoIn { from { transform: scale(.4) rotate(-12deg); opacity: 0; } }
#home .spacer { flex: 1; pointer-events: none; }
.chars { display: flex; justify-content: center; gap: 18px; margin-bottom: 14px; }
.char { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 12px 6px; border-radius: 22px; background: rgba(255,255,255,.25); border: 3px solid transparent; font-weight: 700; font-size: 18px; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.char canvas { width: 70px; height: 70px; animation: bob 1.6s ease-in-out infinite; }
.char:nth-child(2) canvas { animation-delay: -.8s; }
.char.sel { background: rgba(255,255,255,.55); border-color: #ffd23f; color: #1d2b4f; text-shadow: none; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.chooseLbl { text-align: center; font-weight: 600; font-size: 15px; opacity: .95; margin-bottom: 6px; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.homeBtns { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.homeBtns .row { display: flex; gap: 14px; width: min(330px, 86vw); }
.homeBtns .row .btn { flex: 1; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
/* panels */
.panel { background: rgba(255,255,255,.96); color: var(--ink); border-radius: 24px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.hdr { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hdr h2 { flex: 1; margin: 0; font-size: 28px; text-shadow: 0 3px 0 rgba(0,0,0,.2); }
.scroll { flex: 1; overflow-y: auto; touch-action: pan-y; padding-bottom: 20px; -webkit-overflow-scrolling: touch; }
#levels, #shop { background: linear-gradient(180deg, rgba(42,157,244,.92), rgba(120,200,255,.92)); }
.world { border-radius: 24px; padding: 12px 14px 16px; margin-bottom: 14px; box-shadow: 0 6px 0 rgba(0,0,0,.12); }
.world h3 { margin: 0 0 10px; font-size: 21px; display: flex; justify-content: space-between; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.world .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.lv { aspect-ratio: 1; border-radius: 50%; background: #fff; color: var(--ink); font-size: 28px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 5px 0 rgba(0,0,0,.2); position: relative; max-width: 92px; justify-self: center; width: 100%; }
.lv .st { font-size: 13px; color: #f0b400; letter-spacing: 1px; height: 14px; }
.lv .st i { color: #cfd6e4; font-style: normal; }
.lv.lock { background: rgba(255,255,255,.45); color: rgba(29,43,79,.45); }
.lv.cur { background: #ffd23f; animation: pulse 1.3s infinite; }
.shopGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.skin { background: rgba(255,255,255,.95); color: var(--ink); border-radius: 20px; padding: 10px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 5px 0 rgba(0,0,0,.15); border: 3px solid transparent; }
.skin canvas { width: 70px; height: 70px; }
.skin .nm { font-weight: 700; font-size: 14px; text-align: center; min-height: 18px; }
.skin .pr { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 4px; border-radius: 12px; padding: 4px 10px; background: #ffe48a; }
.skin .pr .coin { width: 18px; height: 18px; } .skin .pr .coin::after { inset: 4px; border-width: 1.5px; }
.skin.own .pr { background: #d6f5e2; } .skin.sel { border-color: #3fd17a; } .skin.sel .pr { background: var(--green); color: #fff; }
.skin.lockw .pr { background: #e6e9f0; font-size: 11px; text-align: center; }
.skin.cant { opacity: .8; }
/* HUD */
#hud .top { align-items: flex-start; }
.prog { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px; }
.prog .lbl { font-weight: 700; font-size: 18px; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.bar { width: 100%; max-width: 220px; height: 14px; border-radius: 99px; background: rgba(0,0,0,.25); position: relative; border: 2px solid rgba(255,255,255,.8); }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, #7dff6a, #3fd17a); width: 0; }
.bar .tick { position: absolute; top: -3px; width: 4px; height: 16px; background: #fff; border-radius: 2px; opacity: .7; }
.bar .tick.ok { background: #ffd23f; opacity: 1; }
.bar .flag { position: absolute; right: -10px; top: -9px; font-size: 18px; }
.hint { position: absolute; left: 0; right: 0; bottom: calc(var(--sb) + 70px); text-align: center; pointer-events: none !important; transition: opacity .4s; }
.hint .box { display: inline-block; background: rgba(20,40,90,.6); border-radius: 18px; padding: 12px 18px; font-size: 20px; font-weight: 700; max-width: 86vw; }
.hand { font-size: 54px; display: block; animation: press 1.2s ease-in-out infinite; }
.hand.drag { animation: drag 1.6s ease-in-out infinite; }
@keyframes press { 50% { transform: translateY(8px) scale(.92); } }
@keyframes drag { 0%,100% { transform: translateX(-50px); } 50% { transform: translateX(50px); } }
#fade { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .3s; }
#fade.on { opacity: .75; }
#toast { position: fixed; left: 50%; top: calc(var(--st) + 96px); transform: translateX(-50%) scale(.6); opacity: 0; pointer-events: none; background: linear-gradient(#ffe36b, #ffb21f); color: #5a2a00; font-weight: 700; font-size: 19px; padding: 10px 18px; border-radius: 18px; box-shadow: 0 5px 0 #c97800, 0 10px 20px rgba(0,0,0,.2); transition: transform .25s cubic-bezier(.2,1.6,.4,1), opacity .2s; text-align: center; max-width: 88vw; }
#toast.on { opacity: 1; transform: translateX(-50%) scale(1); }
#toast.blue { background: linear-gradient(#7fd0ff, #3fa9ff); color: #08325e; box-shadow: 0 5px 0 #1767b8, 0 10px 20px rgba(0,0,0,.2); }
/* modal */
#modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(10,30,70,.45); z-index: 50; padding: 20px; }
#modal.on { display: flex; }
#modal .panel { width: min(360px, 92vw); padding: 22px 18px 20px; text-align: center; animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
#modal h2 { margin: 0 0 6px; font-size: 32px; color: #ff7a1a; text-shadow: 0 3px 0 #ffd9a8; }
.stars { display: flex; justify-content: center; gap: 6px; margin: 6px 0 4px; }
.stars .s { display: flex; flex-direction: column; align-items: center; width: 92px; font-size: 12px; font-weight: 600; color: #6a7590; }
.stars .s span { font-size: 56px; line-height: 1.1; color: #dfe4ee; transform: scale(.6); transition: transform .35s cubic-bezier(.2,1.8,.4,1), color .2s; }
.stars .s:nth-child(2) span { font-size: 68px; margin-top: -10px; }
.stars .s.on span { color: #ffd23f; text-shadow: 0 3px 0 #c98f00; transform: scale(1); }
.reward { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 30px; font-weight: 700; margin: 8px 0 4px; }
.sub { color: #6a7590; font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.unlock { background: #fff4c7; border-radius: 16px; padding: 8px; margin: 8px 0 12px; display: flex; align-items: center; gap: 10px; justify-content: center; font-weight: 700; animation: pop .4s .6s both; }
.unlock canvas { width: 52px; height: 52px; }
.mbtns { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 8px; }
.mbtns .row { display: flex; gap: 10px; width: 100%; } .mbtns .row .btn { flex: 1; font-size: 18px; height: 52px; }
.mbtns .btn.big { width: 100%; font-size: 26px; height: 64px; }
.set { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px; border-bottom: 1px solid #eef1f6; font-size: 19px; font-weight: 600; }
.tog { min-width: 84px; height: 40px; border-radius: 20px; background: #dfe4ee; color: #6a7590; font-weight: 700; font-size: 16px; }
.tog.on { background: var(--green); color: #fff; }
#splash { position: fixed; inset: 0; z-index: 80; background: #2a9df4; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff; }
#splash.on { display: flex; } #splash img { width: 120px; height: 120px; border-radius: 26px; } .studio-name { letter-spacing: 4px; font-weight: 700; }
.ver { text-align: center; font-size: 12px; color: #9aa3b8; margin-top: 10px; }
@media (max-height: 700px) { .char canvas { width: 52px; height: 52px; } .char { padding: 5px 10px 4px; font-size: 16px; } .chars { margin-bottom: 8px; } .logo .l2 { font-size: clamp(40px, 14vw, 60px); } }
/* v0.2: difficulty chips, music menu, popups, flash */
.diffs { display: flex; justify-content: center; gap: 6px; margin: 0 auto 12px; background: rgba(20,40,90,.35); padding: 5px; border-radius: 999px; backdrop-filter: blur(4px); width: max-content; max-width: 100%; }
.dchip { font-weight: 700; font-size: 15px; padding: 7px 12px; border-radius: 999px; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.3); white-space: nowrap; }
.dchip.sel { background: #fff; color: var(--ink); text-shadow: none; box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.dchip.sel.d-easy { background: #c9ffd9; } .dchip.sel.d-hard { background: #ffd0d8; } .dchip.sel.d-normal { background: #fff3b8; }
#levels .diffs { margin-bottom: 10px; }
.trks { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; touch-action: pan-y; margin: 6px 0; }
.trk { display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 12px; border-radius: 14px; background: #f0f3fa; font-weight: 600; font-size: 17px; color: var(--ink); }
.trk .ti { font-size: 20px; width: 26px; text-align: center; }
.trk .tn { flex: 1; } .trk small { display: block; font-size: 12px; font-weight: 500; opacity: .7; }
.trk.sel { background: linear-gradient(90deg, #efe0ff, #e0f2ff); box-shadow: inset 0 0 0 2px #b45bff; }
.trk .ck { color: #b45bff; font-weight: 700; font-size: 20px; }
.packs { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
#pops { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pop { position: absolute; top: 34%; transform: translateX(-50%); font-weight: 700; font-size: 30px; white-space: nowrap; animation: popUp 1.1s cubic-bezier(.2,1.4,.4,1) forwards; pointer-events: none; }
.pop.near { color: #fff; text-shadow: 0 3px 0 #b45bff, 0 0 14px rgba(180,91,255,.8); }
.pop.combo { color: #ffd23f; text-shadow: 0 3px 0 #a35a00, 0 0 14px rgba(255,210,63,.8); top: 26%; }
@keyframes popUp { 0% { opacity: 0; transform: translateX(-50%) scale(.3) rotate(-8deg); } 20% { opacity: 1; transform: translateX(-50%) scale(1.15) rotate(3deg); } 35% { transform: translateX(-50%) scale(1) rotate(0); } 100% { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(1); } }
#flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; }
#flash.on { animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@media (max-height: 700px) { .diffs { margin-bottom: 6px; } .dchip { font-size: 13px; padding: 5px 10px; } .trk { padding: 6px 10px; font-size: 15px; } }
/* ---------- monetization (shop IAP, double coins, test sheets) ---------- */
#modal .panel { max-height: calc(100vh - 40px); overflow-y: auto; }
.iap { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.iapRow { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; }
.iapCard { background: rgba(255,255,255,.95); color: var(--ink); border-radius: 18px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 5px 0 rgba(0,0,0,.15); font-weight: 700; font-size: 14px; text-align: center; min-height: 92px; }
.iapCard b { font-size: 15px; line-height: 1.15; } .iapCard small { font-size: 11px; font-weight: 600; color: #6a7590; line-height: 1.2; }
.iapCard .pb { background: linear-gradient(#5be38f, var(--green)); color: #fff; border-radius: 12px; padding: 4px 10px; font-size: 14px; white-space: nowrap; }
.iapCard.prem { flex-direction: row; gap: 10px; background: linear-gradient(135deg, #fff7d6, #e3f6ff); border: 3px solid #ffd23f; min-height: 0; text-align: left; }
.iapCard.prem canvas { width: 56px; height: 56px; flex: none; } .iapCard.prem .tx { flex: 1; display: flex; flex-direction: column; gap: 2px; } .iapCard.prem b { font-size: 18px; color: #c27a00; }
.iapCard.prem.own { justify-content: center; font-size: 16px; color: #2a8a4f; padding: 12px; }
.iapCard.free { background: linear-gradient(#fff, #ffe9f4); border: 2px dashed #ff7ab5; } .iapCard.free[disabled] { opacity: .6; }
.skin.premSkin .pr { background: linear-gradient(#ffe48a, #ffc93a); font-size: 13px; }
.restoreRow { text-align: center; margin-top: 14px; }
.linkBtn { background: none; color: inherit; text-decoration: underline; font-size: 14px; font-weight: 600; opacity: .9; padding: 6px 8px; }
#modal .linkBtn { color: #2a6fd6; }
.langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px 0 10px; border-bottom: 1px solid #eef1f6; }
.langs .tog { min-width: 0; height: 36px; font-size: 14px; padding: 0 4px; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; margin-top: 8px; }
.btn.dbl { width: 100%; margin-top: 10px; font-size: 18px; min-height: 52px; height: auto; padding: 8px 12px; }
.sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; background: rgba(10,30,70,.5); padding: 20px; }
.sheet .panel { width: min(340px, 92vw); padding: 20px 16px; text-align: center; } .sheet h3 { margin: 0 0 6px; font-size: 19px; } .sheet .row { display: flex; gap: 10px; margin-top: 12px; } .sheet .row .btn { flex: 1; }
.adfake { position: fixed; inset: 0; z-index: 90; background: #111; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; }
.skin .nm { overflow-wrap: anywhere; hyphens: auto; } .iapRow > * { min-width: 0; } .iapCard b, .iapCard small { overflow-wrap: anywhere; }
