:root{--bg:#faf7f0;--card:#fff;--ink:#222;--muted:#777;--line:#ddd6c6;--acc:#e8590c;--good:#2f9e44;--warn:#f08c00;--bad:#e03131;--egg:#fff3d6}
@media (prefers-color-scheme:dark){:root{--bg:#16161a;--card:#222228;--ink:#eee;--muted:#9a9aa5;--line:#38383f;--egg:#3a3526}}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.45 "Comic Sans MS","Chalkboard SE",system-ui,sans-serif}
header{display:flex;justify-content:space-between;align-items:center;gap:12px;max-width:520px;margin:0 auto;padding:12px 16px}
h1{margin:0;font-size:1.4rem}h2{font-size:1.2rem}
main{max-width:520px;margin:0 auto;padding:0 16px 40px}
.card{background:var(--card);border:2px solid var(--line);border-radius:14px;padding:12px;margin:10px 0}
.muted{color:var(--muted)}.small{font-size:.85rem}
button,input{font:inherit;color:inherit}
button{background:var(--card);border:2px solid var(--ink);border-radius:10px;padding:8px 12px;cursor:pointer}
button:hover:not(:disabled){transform:translateY(-1px)}
button:disabled{opacity:.45;cursor:not-allowed}
button.primary{background:var(--acc);border-color:var(--acc);color:#fff}
button.link{border:0;background:none;text-decoration:underline;padding:0;color:var(--muted)}
input{background:var(--card);border:2px solid var(--line);border-radius:10px;padding:8px 10px;width:100%}
#startForm{display:flex;gap:8px}#startForm input{flex:1}
.xp,.bar{height:10px;background:var(--line);border-radius:6px;overflow:hidden;margin:6px 0}
.xp i,.bar i{display:block;height:100%;width:0;background:var(--acc);transition:width .3s}
.arena{display:flex;justify-content:center;gap:0;background:var(--egg);border:2px solid var(--line);border-radius:14px;min-height:240px;overflow:hidden}
.arena .pet-svg{width:100%;max-width:260px;height:240px}
.arena.fight .pet-svg{max-width:50%}
.bars{display:grid;grid-template-columns:1fr 1fr;gap:6px 14px;margin:10px 0}
.bars label{font-size:.85rem;display:block}
.bars .bar i{background:var(--good)}.bars .mid i{background:var(--warn)}.bars .low i{background:var(--bad)}
.actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px;margin:10px 0}
.hp{display:grid;grid-template-columns:112px 1fr 64px;align-items:center;gap:8px;font-size:.9rem}
.hp span{line-height:1.2}.hp .bar i{background:var(--good)}.hp .bar.enemy i{background:#4c6ef5}
.log{list-style:none;padding:0;margin:10px 0;max-height:180px;overflow:auto;font-size:.9rem}
.log li{padding:3px 0;border-bottom:1px dashed var(--line)}
/* stickman */
.ln{stroke:var(--ink);stroke-width:5;stroke-linecap:round;stroke-linejoin:round;fill:none}
.ln.thin{stroke-width:2.5}.ln.head{fill:var(--card)}.ln.nofill{fill:none}
.ln.pole{stroke:#868e96;stroke-width:4}.flag{fill:var(--acc);stroke:var(--ink);stroke-width:2;stroke-linejoin:round}.ln.band{stroke:var(--bad);stroke-width:4}
.ln.ink{stroke:#fff}.dot{fill:var(--ink)}.dot.ink{fill:#fff}
.tear{stroke:#4dabf7}
.shadow{fill:rgba(0,0,0,.12)}.egg{fill:var(--card);stroke:var(--ink);stroke-width:5}
.cap{fill:#364fc7;stroke:var(--ink);stroke-width:2}.book{fill:#f59f00;stroke:var(--ink);stroke-width:2}
.elem{font-size:20px}.elem.mid{text-anchor:middle}.shades{fill:var(--ink)}.note{font-size:22px;fill:var(--acc)}.zz{font-size:16px;fill:var(--muted)}
.aura{fill:none;stroke:var(--acc);stroke-width:2;stroke-dasharray:4 8;opacity:.7;transform-origin:100px 112px;animation:spin 14s linear infinite}
.body path,.body ellipse{stroke:var(--ink);stroke-width:4;stroke-linejoin:round;stroke-linecap:round}.body .inner{fill:rgba(255,255,255,.55);stroke-width:2.5}.body .leaf{fill:#2f9e44;fill-opacity:1}.body .facet{fill:none;stroke-width:2;opacity:.45}
.cheek{fill:#ffa8a8;opacity:.8}.crown{fill:#fcc419;stroke:var(--ink);stroke-width:2.5;stroke-linejoin:round}
.bob{animation:bob 1.6s ease-in-out infinite}.bob.slow{animation-duration:3.2s}
.wobble{transform-origin:100px 196px;animation:wob 2.4s ease-in-out infinite}
.shake{animation:shake .3s}
@keyframes bob{50%{transform:translateY(-5px)}}
@keyframes wob{25%{transform:rotate(3deg)}75%{transform:rotate(-3deg)}}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes shake{25%{transform:translateX(-8px)}75%{transform:translateX(8px)}}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
dialog{border:2px solid var(--ink);border-radius:14px;background:var(--card);color:var(--ink);max-width:340px;width:90%}
dialog label{display:block;margin:8px 0}
.elems{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0}.elems button.on{background:var(--acc);border-color:var(--acc);color:#fff}
.coin{font-weight:bold}.head-top{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
.tabs{display:flex;gap:6px;margin:8px 0}.tabs button.on{background:var(--acc);border-color:var(--acc);color:#fff}
.items{list-style:none;margin:0;padding:0;max-height:52vh;overflow:auto}
.items li{display:grid;grid-template-columns:34px 1fr auto;gap:8px;align-items:center;padding:7px 0;border-bottom:1px dashed var(--line)}
.items .e{font-size:1.5rem;text-align:center}.items .d{font-size:.8rem;color:var(--muted)}.items h4{margin:8px 0 2px;font-size:.9rem;color:var(--muted)}
.hint{margin:4px 0;font-size:.85rem}.star{color:var(--warn)}
dialog#shop{max-width:440px}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
