:root{--cream:#faf0d4;--ink:#1f3131;--coral:#f5573b;--gold:#f9bc4c;--safe-top:0px;--safe-bottom:0px;font-family:ui-rounded,'Arial Rounded MT Bold',system-ui,-apple-system,sans-serif;color:var(--ink);background:#ded4b7;font-synthesis:none}*{box-sizing:border-box}body{margin:0;overscroll-behavior:none}button,a,input{ -webkit-tap-highlight-color:transparent}button{font-size:12px;font-family:inherit;font-weight:850;cursor:pointer;border:2px solid var(--ink);background:#fff9e9;color:var(--ink);border-radius:12px;padding:12px;touch-action:manipulation;transition:transform .12s,background .12s}button:active{transform:translateY(2px)}button:disabled{opacity:.5;cursor:default}button:focus-visible,a:focus-visible{outline:3px solid #628f90;outline-offset:3px}[hidden]{display:none!important}a{color:inherit}#app{max-width:480px;min-height:100dvh;margin:auto;background:var(--cream);padding:calc(12px + var(--safe-top)) 16px calc(14px + var(--safe-bottom));box-shadow:0 0 80px #1f31311a}header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;gap:8px}.brand{display:flex;gap:9px;align-items:center;text-decoration:none;font-size:13px;font-weight:950;line-height:1.02;letter-spacing:-.6px}.brand img{width:38px;height:38px;border-radius:10px}.top-actions{display:flex;gap:7px;align-items:center}.icon{font-size:21px;width:38px;height:38px;padding:0;border:0;border-radius:50%;background:#fff9e9}.icon.muted{color:#aa8e74;background:#e7dcc0;text-decoration:line-through}.pause{background:var(--coral);color:white;border-color:var(--coral);font-size:11px;min-height:38px;letter-spacing:.5px;padding:8px 11px}.hero{text-align:center}.eyebrow{font-size:10px;font-weight:900;letter-spacing:1.3px;color:#987452}h1{font-size:clamp(36px,10.5vw,48px);line-height:.95;letter-spacing:-2px;margin:12px 0 4px;font-weight:1000}h1 span{color:var(--coral)}.hero-art{height:156px;position:relative;max-width:390px;margin:auto;overflow:hidden}.hero-art canvas{width:100%;height:220px;position:absolute;left:0;top:-23px}.hero-bubble{position:absolute;left:9px;top:30px;border:2px solid var(--ink);padding:13px 14px;border-radius:14px;background:#fffcf2;font-size:14px;line-height:1.25;transform:rotate(-5deg);font-weight:900}.hero-bubble:after{content:'';position:absolute;right:-8px;bottom:13px;width:13px;height:13px;transform:rotate(45deg);background:#fffcf2;border-top:2px solid var(--ink);border-right:2px solid var(--ink)}.stamp{position:absolute;right:15px;top:105px;color:var(--coral);font-size:27px;transform:rotate(10deg);font-weight:950}.hero p{font-size:13px;line-height:1.5;max-width:360px;margin:2px auto 17px;color:#667063}.primary{width:100%;border-color:var(--coral);background:var(--coral);color:white;padding:17px 10px;font-size:16px;border-radius:13px;box-shadow:0 5px 0 #c23f2b;letter-spacing:.4px}.modes{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin:20px 0 18px}.mode{font-size:10px;padding:11px 3px;background:transparent;border-color:#d9ceb0}.mode small{font-size:8px;display:block;font-weight:550;line-height:1.35;margin-top:5px}.mode.active{border-color:var(--ink);background:var(--ink);color:var(--cream)}.section-label{display:flex;justify-content:space-between;gap:8px;font-size:10px;letter-spacing:.5px;margin-bottom:9px}.chapter-tabs{display:flex;gap:5px;margin-bottom:9px}.chapter-tabs button{flex:1;padding:5px;font-size:10px;border-color:#d9ceb0;border-radius:6px}.chapter-tabs button.active{background:var(--gold);border-color:var(--gold)}.levels{display:grid;grid-template-columns:repeat(5,1fr);gap:7px}.levels button{padding:10px 3px;border:1px solid #d6c9a7;font-size:13px;background:#fff9e9;position:relative}.levels button.selected{border:2px solid var(--ink);background:var(--gold);padding:9px 2px}.levels button:disabled{background:#e6ddc5;color:#948872}.home-actions{display:grid;grid-template-columns:1.2fr 1fr;gap:8px;margin:17px 0 13px}.home-actions button{font-size:10px;min-height:41px}.best{text-align:center;font-size:9px;line-height:1.5;color:#798170}.best b{color:var(--ink)}footer{display:flex;justify-content:center;gap:18px;margin:15px 0 0;font-size:9px;color:#8a8270}footer a{text-decoration:none}.hud{display:flex;justify-content:space-between;align-items:center;gap:10px;font-variant-numeric:tabular-nums}.hud>div:first-child,.hud>div:last-child{min-width:45px}.hud>div:last-child{text-align:right}.hud small{display:block;font-size:9px;letter-spacing:.7px;color:#84816a;font-weight:850}.hud strong{display:block;font-size:23px;font-weight:950}.level-hud{text-align:center;flex:1}.level-hud strong{font-size:11px;margin-top:5px;max-width:220px}.debt-head{display:flex;justify-content:space-between;font-size:9px;margin-top:10px}.debt-head b{letter-spacing:1px}.debt-track{height:7px;border-radius:5px;overflow:hidden;background:#ded5b7;margin:4px 0 10px}#debtBar{height:100%;background:var(--coral);width:0;transition:width .15s}.arena-wrap{position:relative;overflow:hidden;border-radius:13px;border:2px solid var(--ink);background:#b0c49e;margin:auto;width:100%;max-width:min(100%,calc((100dvh - 228px - var(--safe-top) - var(--safe-bottom))*390/620))}#arena{display:block;width:100%;height:auto;touch-action:none;user-select:none;cursor:crosshair}.weapon-name{text-align:center;font-size:9px;min-height:24px;padding:8px 0 5px;letter-spacing:.7px;font-weight:900}.weapons{display:grid;grid-template-columns:repeat(7,1fr);gap:5px}.weapon{padding:4px 0;border:1px solid #d9ceb0;border-radius:9px;background:#fff7e1;min-height:41px;position:relative}.weapon canvas{display:block;width:35px;height:33px;margin:auto}.weapon.active{border:2px solid var(--ink);background:var(--gold);padding:3px 0}.weapon.locked:after{content:'🔒';position:absolute;bottom:1px;right:1px;font-size:9px}.powers{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:8px}.powers button{font-size:9px;padding:8px 3px;border-color:#d9ceb0;border-width:1px;min-height:33px}.powers b{display:inline-block;border-radius:50%;background:var(--ink);color:cream;margin-left:5px;min-width:17px;padding:2px;font-size:9px;color:var(--cream)}.overlay{position:fixed;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;background:#1f3131aa;padding:16px;backdrop-filter:blur(3px)}.sheet{background:var(--cream);border:2px solid var(--ink);border-radius:24px;width:100%;max-width:430px;max-height:calc(100dvh - 40px);overflow:auto;padding:32px 23px 23px;position:relative;text-align:center;box-shadow:0 20px 80px #0003}.close{position:absolute;top:12px;right:12px;border:0;background:#fff9e9;border-radius:50%;width:34px;height:34px;padding:0;font-size:23px}.sheet h2{font-size:25px;line-height:1.05;letter-spacing:-1px;margin:15px 0}.sheet p{font-size:13px;line-height:1.55}.sheet .primary{margin:14px 0 11px;font-size:13px;padding:15px 8px}.sheet .secondary{display:block;width:100%;margin:8px 0;padding:13px;font-size:12px}.sheet .fine{font-size:10px;color:#727866;line-height:1.5}.shop-art{height:140px;width:100%;display:block}.terms-check{display:flex;align-items:center;justify-content:center;gap:9px;font-size:11px;margin-top:14px;text-align:left;line-height:1.4}.terms-check input{width:19px;height:19px;accent-color:var(--coral);flex-shrink:0}.setting-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:12px 0;border-bottom:1px solid #ddd1b3;padding-bottom:12px;font-size:12px;font-weight:800}.setting-row button{min-width:66px;font-size:11px}.language-buttons{display:flex;gap:4px}.language-buttons button{min-width:38px;padding:8px 6px}.language-buttons button.active{background:var(--gold);border-color:var(--gold)}.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;margin:20px 0}.stats strong{display:block;font-size:24px}.stats small{font-size:9px}.toast{position:fixed;bottom:30px;left:50%;transform:translateX(-50%);z-index:30;max-width:90vw;width:max-content;background:var(--ink);color:var(--cream);padding:14px 17px;border-radius:12px;font-size:12px;text-align:center;box-shadow:0 4px 20px #0003}.legal{padding:24px 22px;max-width:640px;margin:auto;line-height:1.6;background:var(--cream);min-height:100vh}.legal h1{font-size:32px;line-height:1.1}.legal h2{font-size:20px;margin-top:25px}.legal p,.legal li{font-size:14px}.credit-links{font-size:10px;line-height:1.6;text-align:left}.credit-links a{display:inline-block;margin-right:6px}@media(max-height:720px){#app{padding-top:calc(7px + var(--safe-top))}header{margin-bottom:10px}.hero-art{height:128px}.hero-art canvas{top:-40px}.hero h1{font-size:36px}.hero p{font-size:11px;margin-bottom:13px}.modes{margin:15px 0 12px}.home-actions{margin:13px 0 8px}.arena-wrap{max-width:min(100%,calc((100dvh - 270px - var(--safe-top) - var(--safe-bottom))*390/620))}}@media(prefers-reduced-motion:reduce){button,#debtBar{transition:none}}

/* Use Telegram's visible viewport and reserve the bottom safe area. */
:root{--app-height:100dvh;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px)}
#app{min-height:var(--app-height);padding-top:calc(8px + var(--safe-top));padding-bottom:calc(24px + var(--safe-bottom))}
header{margin-bottom:9px}.brand{font-size:11px;gap:7px}.brand img{width:32px;height:32px}.icon{width:32px;height:32px;font-size:19px}.pause{min-height:32px;padding:6px 10px}.top-actions{gap:6px}
.hero-art{height:124px}.hero-art canvas{top:-40px}.hero h1{font-size:42px;margin-top:9px}.hero p{margin-bottom:12px}.modes{margin:16px 0 13px}.home-actions{margin:12px 0 10px}
#app.playing{height:var(--app-height);min-height:0;display:flex;flex-direction:column;overflow:hidden;padding-bottom:calc(32px + var(--safe-bottom))}
#app.playing header{flex:none;margin-bottom:7px}
#play{flex:1;min-height:0;display:flex;flex-direction:column}
.hud,.debt-head,.debt-track,.weapon-name,.weapons,.powers{flex:none}
.hud strong{font-size:20px}.level-hud strong{font-size:10px;margin-top:3px}.hud small{font-size:8px}.debt-head{margin-top:7px}.debt-track{margin-bottom:7px}
.arena-space{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:hidden}
.arena-space .arena-wrap{flex:none;max-width:100%;margin:0;aspect-ratio:390/620}
.weapon-name{min-height:21px;padding:6px 0 4px}.powers{margin-top:6px}.powers button{padding:8px 2px}.overlay{bottom:auto;height:var(--app-height);padding-top:calc(16px + var(--safe-top));padding-bottom:calc(16px + var(--safe-bottom))}.sheet{max-height:calc(var(--app-height) - 32px - var(--safe-top) - var(--safe-bottom))}
.compact-viewport .hero-art{height:80px}.compact-viewport .hero-art canvas{top:-67px}.compact-viewport .hero-bubble{top:12px;font-size:12px;padding:10px}.compact-viewport .stamp{top:62px;font-size:23px}
.compact-viewport .hero h1{font-size:32px;margin:7px 0 3px}.compact-viewport .hero p{font-size:11px;margin:2px auto 6px}.compact-viewport #start{padding:13px 8px;font-size:14px}.compact-viewport .modes{margin:10px 0 8px}.compact-viewport .mode{padding:7px 3px}.compact-viewport .levels button{padding:6px 3px}.compact-viewport .levels button.selected{padding:5px 2px}.compact-viewport .home-actions{margin:7px 0 8px}.compact-viewport footer{margin-top:10px}
@media(max-height:720px){.hero-art{height:80px}.hero-art canvas{top:-67px}.hero-bubble{top:12px;font-size:12px;padding:10px}.stamp{top:62px;font-size:23px}.hero h1{font-size:32px;margin:7px 0 3px}.hero p{font-size:11px;margin:2px auto 6px}#start{padding:13px 8px;font-size:14px}.modes{margin:10px 0 8px}.mode{padding:7px 3px}.levels button{padding:6px 3px}.levels button.selected{padding:5px 2px}.home-actions{margin:7px 0 8px}footer{margin-top:10px}}

.toast{bottom:auto;top:calc(var(--app-height) - var(--safe-bottom) - 24px);transform:translate(-50%,-100%)}
