*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow:hidden;background:#8fd0f5;font-family:Vazirmatn,sans-serif;color:#3b2f4a;user-select:none;-webkit-user-select:none;touch-action:none}
html body #game-root{position:fixed;inset:0;width:100%;max-width:100%;height:100%;margin:0;overflow:hidden}
html body #game{position:absolute;inset:0}
html body #game canvas{width:100%;height:100%;display:block}
html body #startBtn,html body #retryBtn,html body #hud,html body #dpad,html body #dpad-action{display:none!important}
#ui{position:absolute;inset:0;pointer-events:none}
#ui>*{pointer-events:auto}
#ui>#hudBar{pointer-events:none}
#hudBar .pause-btn{pointer-events:auto}
#readyHint,#toast,#flash{pointer-events:none!important}
.hidden{display:none!important}
.scr{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;padding:max(14px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom))}
.bg-title{background:url(./assets/title_bg.webp) center/cover}
.bg-soft{background:linear-gradient(180deg,#a9dcf7 0%,#d9f0fb 55%,#cfe9b4 100%)}
#scr-loading{justify-content:center;background:linear-gradient(#8fd0f5,#dff3fc)}
.load-box{text-align:center;width:min(280px,80%)}
.load-title{font-family:Lalezar,Vazirmatn;font-size:56px;color:#fff;text-shadow:0 3px 0 #e2668a,0 6px 14px rgba(80,40,90,.3)}
.load-bar{height:14px;border-radius:9px;background:rgba(255,255,255,.6);overflow:hidden;margin:16px 0 8px;border:2px solid #fff}
.load-bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#ffb347,#f2668b);transition:width .2s}
.load-txt{font-size:14px;color:#3e6b85}
.top-row{width:100%;display:flex;justify-content:space-between;align-items:center}
.coin-chip{display:flex;align-items:center;gap:6px;background:rgba(255,255,255,.88);border-radius:999px;padding:4px 12px 4px 6px;font-weight:800;font-size:16px;box-shadow:0 3px 0 rgba(90,60,110,.18)}
.coin-chip img{width:28px;height:28px}
.round-btn{width:46px;height:46px;border-radius:50%;border:none;background:rgba(255,255,255,.88);color:#5a4a78;display:grid;place-items:center;cursor:pointer;box-shadow:0 3px 0 rgba(90,60,110,.18)}
.logo-wrap{margin-top:auto;text-align:center;display:flex;flex-direction:column;align-items:center}
.logo{width:min(220px,52vw);animation:bob 3s ease-in-out infinite;filter:drop-shadow(0 10px 12px rgba(60,80,120,.25))}
.title{font-family:Lalezar,Vazirmatn;font-weight:400;font-size:clamp(54px,16vw,78px);line-height:1.3;margin:-10px 0 0;color:#fff;text-shadow:0 4px 0 #e2668a,0 8px 18px rgba(80,40,90,.35)}
.tagline{margin:0;font-weight:600;color:#2e5d78;background:rgba(255,255,255,.7);padding:2px 14px;border-radius:999px;line-height:1.9}
.menu-btns{margin-top:auto;display:flex;flex-direction:column;gap:12px;align-items:center;width:100%}
.btn{border:none;cursor:pointer;font-family:Lalezar,Vazirmatn;font-size:28px;color:#fff;width:min(260px,72vw);height:84px;background:center/100% 100% no-repeat;text-shadow:0 2px 0 rgba(0,0,0,.25);transition:transform .12s;padding-bottom:6px;line-height:1.6}
.btn.primary{background-image:url(./assets/btn_primary.webp)}
.btn.secondary{background-image:url(./assets/btn_secondary.webp);font-size:24px;height:74px}
.btn.small{width:130px;height:60px;font-size:20px}
.btn:active{transform:scale(.94)}
.btn:disabled{filter:grayscale(1);opacity:.6}
#playBtn{animation:pulse 1.6s ease-in-out infinite}
.best-line{margin-top:10px;font-size:14px;background:rgba(255,255,255,.75);padding:2px 14px;border-radius:999px;line-height:1.9}
@keyframes bob{50%{transform:translateY(-10px) rotate(-3deg)}}
@keyframes pulse{50%{transform:scale(1.05)}}
.head{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px}
.head h2{font-family:Lalezar,Vazirmatn;font-weight:400;font-size:26px;margin:0;color:#fff;text-shadow:0 2px 0 #e2668a}
.back-btn{display:flex;align-items:center;gap:2px;border:none;background:rgba(255,255,255,.9);border-radius:999px;font-family:Vazirmatn;font-weight:700;font-size:14px;padding:8px 12px 8px 14px;color:#5a4a78;cursor:pointer;min-height:44px}
.map-scroll{flex:1;width:100%;overflow-y:auto;margin-top:8px;touch-action:pan-y;scrollbar-width:none}
.map-inner{position:relative;width:100%;max-width:420px;margin:0 auto}
.map-inner svg{position:absolute;inset:0;width:100%;height:100%}
.node{position:absolute;width:88px;height:108px;transform:translate(-50%,-50%);border:none;background:none;cursor:pointer;padding:0;font-family:Lalezar,Vazirmatn}
.node .nimg{width:88px;height:88px;display:block}
.node .nnum{position:absolute;top:22px;inset-inline:0;text-align:center;font-size:30px;color:#fff;text-shadow:0 2px 0 rgba(0,0,0,.35)}
.node .lock{position:absolute;top:20px;left:22px;width:44px;height:44px}
.node .nstars{position:absolute;bottom:4px;inset-inline:0;display:flex;justify-content:center}
.node .nstars img{width:22px;height:22px;margin:0 -1px}
.node .nname{position:absolute;top:96px;left:50%;transform:translateX(-50%);white-space:nowrap;font-family:Vazirmatn;font-weight:700;font-size:12px;background:rgba(255,255,255,.85);border-radius:999px;padding:0 8px;line-height:1.8}
.node.cur .nimg{animation:bob 1.8s ease-in-out infinite}
.map-foot{display:flex;align-items:center;gap:6px;background:rgba(255,255,255,.88);border-radius:999px;padding:2px 14px;margin-top:6px}
.map-foot img{width:24px}
.shop-scroll{flex:1;width:100%;max-width:440px;overflow-y:auto;touch-action:pan-y;padding-bottom:16px}
.shop-h{font-family:Lalezar,Vazirmatn;font-weight:400;font-size:22px;margin:14px 0 6px;color:#3a6a86}
.shop-note{margin:-4px 0 8px;font-size:13px;color:#4f6d7d}
.shop-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.item{background:rgba(255,255,255,.9);border-radius:18px;padding:10px;display:flex;flex-direction:column;align-items:center;gap:4px;box-shadow:0 4px 0 rgba(90,60,110,.12);min-width:0}
.item canvas{width:84px;height:84px}
.item .iname{font-weight:800;font-size:15px;text-align:center}
.buy{border:none;border-radius:999px;min-height:40px;padding:0 14px;font-family:Vazirmatn;font-weight:800;font-size:14px;cursor:pointer;display:flex;align-items:center;gap:4px;background:#ffb347;color:#5a3300;box-shadow:0 3px 0 #d7862a}
.buy img{width:20px}
.buy.owned{background:#e5eef3;color:#5a6b77;box-shadow:0 3px 0 #bccbd5}
.buy.equip{background:#7ccf7c;color:#0f3e12;box-shadow:0 3px 0 #4f9d4f}
.buy:disabled{opacity:.5}
.shop-list{display:flex;flex-direction:column;gap:10px}
.pitem{flex-direction:row;justify-content:space-between;text-align:start}
.pitem .pinfo{flex:1;min-width:0}
.pitem .pdesc{font-size:12px;color:#5d6f7c;line-height:1.7}
.pitem .picon{width:48px;height:48px;flex:none}
#hudBar{position:absolute;top:0;inset-inline:0;padding:max(10px,env(safe-area-inset-top)) 10px 0}
.hud-row{display:flex;align-items:center;gap:8px}
.hearts{display:flex;gap:2px;background:rgba(255,255,255,.8);border-radius:999px;padding:4px 8px}
.hearts img{width:24px;height:24px;transition:transform .2s,opacity .2s}
.hearts img.lost{opacity:.25;filter:grayscale(1);transform:scale(.8)}
.prog{flex:1;min-width:0}
.prog-name{font-size:12px;font-weight:800;color:#2e5d78;text-align:center;line-height:1.6;text-shadow:0 1px 0 #fff}
.prog-track{height:10px;background:rgba(255,255,255,.7);border-radius:9px;overflow:hidden;border:2px solid #fff}
.prog-track i{display:block;height:100%;width:0;background:linear-gradient(90deg,#7ccf7c,#ffcf4a)}
.pause-btn{width:46px;height:46px;border:none;background:none;padding:0;cursor:pointer}
.pause-btn img{width:100%;height:100%}
.hud-row2{display:flex;gap:6px;margin-top:6px;flex-wrap:wrap}
.chip{display:flex;align-items:center;gap:4px;background:rgba(255,255,255,.8);border-radius:999px;padding:0 10px;font-size:13px;font-weight:600;line-height:2}
.chip img{width:20px;height:20px}
.chip b{font-size:15px}
.chip.pop{animation:pop .3s}
@keyframes pop{40%{transform:scale(1.25)}}
#powerChips{display:flex;gap:6px}
.pchip{background:#fff3c4;color:#7a5200}
#readyHint{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px}
.hint-card{background:rgba(255,255,255,.92);border-radius:18px;padding:10px 18px;text-align:center;font-weight:700;max-width:86%;line-height:1.9;box-shadow:0 6px 18px rgba(60,80,120,.2)}
.hint-lvl{font-family:Lalezar,Vazirmatn;font-weight:400;font-size:24px;color:#e2668a}
.tap-ring{position:relative;width:90px;height:90px;margin-top:120px}
.tap-ring i{position:absolute;inset:0;border:4px solid #fff;border-radius:50%;animation:ring 1.2s ease-out infinite}
.tap-ring i+i{animation-delay:.6s}
.finger{position:absolute;left:30px;top:30px;width:34px;height:34px;border-radius:50%;background:#fff;box-shadow:0 0 0 6px rgba(255,255,255,.4);animation:tap 1.2s ease-in-out infinite}
@keyframes ring{0%{transform:scale(.3);opacity:1}100%{transform:scale(1.4);opacity:0}}
@keyframes tap{50%{transform:scale(.75)}}
#toast{position:absolute;top:26%;left:50%;transform:translateX(-50%);font-family:Lalezar,Vazirmatn;font-size:30px;color:#fff;text-shadow:0 3px 0 #e2668a,0 6px 14px rgba(0,0,0,.2);white-space:nowrap;animation:toast 1.4s ease-out forwards}
@keyframes toast{0%{opacity:0;transform:translate(-50%,20px) scale(.6)}15%{opacity:1;transform:translate(-50%,0) scale(1.1)}25%{transform:translate(-50%,0) scale(1)}80%{opacity:1}100%{opacity:0;transform:translate(-50%,-30px)}}
#flash{position:absolute;inset:0;background:#ff6b6b;opacity:0;transition:opacity .25s}
.modal{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(40,60,90,.45);backdrop-filter:blur(3px);padding:16px}
.card{width:min(340px,100%);background:url(./assets/panel_frame.webp) center/100% 100% no-repeat;padding:38px 26px 30px;display:flex;flex-direction:column;align-items:center;gap:8px;animation:cardIn .35s cubic-bezier(.2,1.5,.5,1)}
@keyframes cardIn{from{transform:scale(.6);opacity:0}}
.card h2{font-family:Lalezar,Vazirmatn;font-weight:400;font-size:38px;margin:0;color:#e2668a;line-height:1.5}
.card-sub{margin:-6px 0 4px;font-weight:600;color:#5a6b77}
.card .btn{width:min(230px,70vw)}
.res-stars{display:flex;align-items:flex-end;gap:4px}
.res-stars img{width:62px;height:62px;opacity:0;transform:scale(0)}
.res-stars img:nth-child(2){width:78px;height:78px;margin-bottom:10px}
.res-stars img.show{animation:starIn .45s cubic-bezier(.2,1.8,.5,1) forwards}
@keyframes starIn{to{opacity:1;transform:scale(1)}}
.res-stats{display:flex;gap:10px;width:100%}
.res-stats div{flex:1;background:rgba(255,255,255,.7);border-radius:14px;text-align:center;padding:4px;display:flex;flex-direction:column;font-size:12px;line-height:1.7}
.res-stats b{font-size:20px}
.reward{display:flex;align-items:center;gap:6px;background:#fff3c4;border-radius:999px;padding:2px 16px;font-weight:700}
.reward img{width:28px}
.reward b{font-size:20px;color:#a86a00}
.btn-row{display:flex;gap:8px}
