/* base.css
   Grundlayout: Farben, Kopfleiste, Szene-Rahmen, Eingabefeld, Ziffernblock, Knöpfe, Dialog-Grundstil, Hoch-/Querformat */
:root{--bg:#1b1640;--card:#2a2362;--gold:#ffc53d;--mint:#5eead4;--red:#ff6b6b;--ink:#fbf7ec}
*{box-sizing:border-box}
@property --px{syntax:"<length>";inherits:false;initial-value:0px}   /* v415 PF6: Parallax-Versatz (input.js scrollPar) nicht vererben – sonst rechnete jeder neue Wert den ganzen SVG-Baum darunter neu (ältere Browser ignorieren die Regel = wie vorher) */
html{overscroll-behavior:none}body{margin:0;position:fixed;inset:0;overflow:hidden;touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;background:var(--bg);color:var(--ink);font-family:ui-rounded,"Nunito","Segoe UI",sans-serif;display:flex;justify-content:center}
input{-webkit-user-select:text;user-select:text}main{width:100%;height:100%;max-width:560px;padding:max(14px,env(safe-area-inset-top)) 14px max(14px,env(safe-area-inset-bottom));grid-template-rows:minmax(0,1fr) auto;align-content:stretch;display:grid;gap:12px}
.top{display:flex;justify-content:space-between;gap:6px;font-weight:700;flex-wrap:wrap}
.top span,.top button{background:var(--card);padding:6px 12px;border-radius:999px;color:var(--ink);font-size:1rem}
.xp{height:8px;background:#0f0b2a;border-radius:6px;overflow:hidden}#xp{height:100%;position:relative;background:linear-gradient(90deg,#2dd4bf,#5eead4 60%,#a7f3d0);transition:width .55s cubic-bezier(.2,.8,.2,1)}
.scene{position:relative;isolation:isolate;height:100%;border-radius:26px;overflow:hidden;background:linear-gradient(#8ad7ff 0%,#ffe6a8 72%)}
.scene>svg.hills{position:absolute;bottom:0;left:0;width:100%;height:120px}
#hero{position:absolute;left:2%;bottom:15px;width:36%;translate:var(--hx,0px) 0;transition:transform .15s,translate 1.1s ease-in-out,scale .35s ease}
#hero.lunge{transform:translateX(40px)}#hero.shake{transform:translateX(-10px) rotate(-3deg)}
#pet{position:absolute;left:31%;bottom:11px;font-size:42px}
#monw{position:absolute;right:2%;bottom:23px;width:30%;text-align:center}
#mon{font-size:100px;line-height:1;display:block;transition:transform .12s}
#monw::after{content:"";position:absolute;left:14%;right:14%;bottom:-7px;height:16px;border-radius:50%;background:radial-gradient(closest-side,#00000040,#0000);z-index:-1;pointer-events:none}   /* v415 PF10: Bodenschatten als ruhende Fläche statt drop-shadow über dem jedes Bild neu gezeichneten Monster-SVG */
#mon.hit{transform:scale(.8) rotate(14deg);filter:brightness(2)}
.hpbar{position:relative;height:16px;background:#0006;border-radius:8px;overflow:hidden;margin:0 10%}#hpt{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font:800 11px/1 system-ui,sans-serif;color:#fff;text-shadow:0 1px 2px #000,0 0 3px #000;letter-spacing:.02em;pointer-events:none;font-variant-numeric:tabular-nums}   /* v318 N7: Lebenspunkte als Zahl im Balken */#hp{height:100%;background:linear-gradient(90deg,#ef4444,#ff6b6b 70%,#fb923c);transition:width .35s cubic-bezier(.2,.8,.2,1)}
#hearts{display:flex;gap:1px;align-items:center;flex:none}#hearts svg{width:1.5em;height:1.5em;display:block}
.panel{background:var(--card);border-radius:22px;padding:10px 16px;display:flex;justify-content:center;align-items:center;gap:14px;flex-wrap:wrap}
#q{font-size:clamp(38px,11vw,56px);font-weight:800;margin:0}
input{width:min(40%,170px);font:inherit;font-size:2rem;text-align:center;padding:8px;border-radius:16px;border:3px solid var(--mint);background:#0f0b2a;color:var(--ink)}
button{font:inherit;font-weight:800;border:0;border-radius:16px;padding:12px 20px;background:var(--gold);color:#222;cursor:pointer}
button:disabled{opacity:.4;cursor:default}
button:focus-visible,input:focus-visible{outline:3px solid #fff;outline-offset:2px}
#msg{position:absolute;top:calc(var(--hud,0px) + 6px);left:10px;right:10px;margin-inline:auto;width:fit-content;max-width:calc(100% - 20px);box-sizing:border-box;z-index:75;background:#000a;padding:4px 14px;border-radius:16px;white-space:normal;text-align:center;line-height:1.25;overflow-wrap:break-word;font-weight:700;font-size:clamp(.8rem,2.6cqw,1.1rem)}   /* v357 UI2/UI3: Hinweis-Band über allen Szene-Objekten (Tor 33, Effekte 60, Szenen 66), bricht in die nächste Zeile um statt über den Rand zu laufen */#msg:empty{display:none}#netw{position:absolute;right:10px;top:calc(var(--hud,0px) + 8px);z-index:76;width:34px;height:34px;display:none;place-items:center;border-radius:50%;background:#0007;font-size:18px;pointer-events:none;animation:netp 1.6s ease-in-out infinite}#netw.on{display:grid}@keyframes netp{50%{opacity:.35}}@media (prefers-reduced-motion:reduce){#netw{animation:none}}   /* v365 NET4: kleines pulsierendes 📶 oben rechts in der Szene (unter der Kopfzeile, nichts Bedienbares darunter) statt Text-Leiste */input.bad{border-color:var(--red);color:var(--red)}.ok{color:var(--mint)}.no{color:var(--red)}
.shop{background:var(--card);border-radius:22px;padding:14px}.shop h2{margin:0 0 8px;font-size:1.05rem}
.lgrp{background:#ffffff0d;border-radius:14px;margin:6px 0;padding:0 10px}.lgrp summary{cursor:pointer;font-weight:800;padding:11px 2px;list-style:none;display:flex;justify-content:space-between;align-items:center}
.lgrp summary::-webkit-details-marker{display:none}.lgrp summary::after{content:"▾";transition:transform .2s;opacity:.7}.lgrp[open] summary::after{transform:rotate(180deg)}.lgrp[open]{padding-bottom:6px}
.cnm{overflow-wrap:anywhere;hyphens:auto;line-height:1.1}
.row{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:6px 0}.row b{width:74px;font-size:.9rem}
.row button{background:#0f0b2a;color:var(--ink);padding:8px 10px;font-size:.95rem}.row button.on{background:var(--mint);color:#222}
dialog{max-height:88dvh;overflow:auto;border:0;border-radius:22px;background:var(--card);color:var(--ink);padding:18px;width:min(92vw,420px)}
dialog::backdrop{background:#000a}dialog h2{margin:0 0 8px}
dialog label{display:flex;gap:10px;align-items:center;margin:9px 0;font-weight:700}
dialog input[type=number],dialog select{font:inherit;font-size:1rem;padding:6px;border-radius:10px;border:2px solid var(--mint);background:#0f0b2a;color:var(--ink);width:auto}
dialog input[type=checkbox]{width:22px;height:22px;padding:0;border:0;accent-color:var(--mint)}
.btns{display:flex;gap:8px;justify-content:flex-end;margin-top:14px}
.scene{container-type:inline-size}#mon svg{width:143.333%;margin:-40% 0 -11.667% -21.667%;display:block}   /* viewBox 172x182 = 120er Figur + Rand 26/48/26/14: Layout bleibt wie bei 120x120 */#pet{height:calc((100% - var(--hud,0px))*.22);aspect-ratio:1}#pet svg,#hero svg{width:100%;height:100%}#hero{max-width:38%;width:auto;height:calc((100% - var(--hud,0px))*.74);aspect-ratio:170/230}#monw{max-width:34%;width:auto;height:calc((100% - var(--hud,0px))*.56);aspect-ratio:1/1.1}.ic{width:28px;height:28px;vertical-align:middle}.top span,.top button,.row button{display:inline-flex;align-items:center;gap:5px}.top .ic,.top svg{width:1.3em;height:1.3em}.pad{width:100%}
.pad{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;max-width:340px;margin:12px auto 0}
.pad button{font-size:1.7rem;padding:0;height:clamp(52px,8vh,76px);background:#0f0b2a;color:var(--ink);border:2px solid var(--mint);touch-action:manipulation;user-select:none;-webkit-user-select:none}
.pad button:active{background:var(--mint);color:#222}.pad .del{border-color:var(--red)}.pad:not(.negon) .sgn{display:none}.pad .sgn{border-color:var(--gold)}

@media(orientation:portrait) and (min-width:700px){main{max-width:760px}#q{font-size:72px}.pad{max-width:460px}.pad button{height:84px;font-size:2.2rem}}
@media(orientation:landscape){main{max-width:1180px;height:100dvh}#pet{left:20%}.pad{display:flex;max-width:none;margin:0}.pad button{flex:1;height:clamp(42px,12vh,68px);font-size:1.5rem}.pad .del{order:1}}
@media(orientation:landscape) and (max-height:480px){main{gap:5px;padding:6px 14px}.top span,.top button{padding:2px 10px}.panel{padding:2px 10px}#q{font-size:30px}input{font-size:1.3rem;padding:2px}.pad{gap:4px}.pad button{height:38px;font-size:1.2rem}}
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

#ver,#onl{position:fixed;right:8px;bottom:3px;font-size:10px;opacity:.4;pointer-events:none;z-index:1;color:#fff}#onl{right:auto;left:8px}   /* v410 ON1: Spieler online unten links, wie die Versionszeile */
/* Hamburger-Menü (Kopfleiste): Kennzahlen links, Menü-Knopf rechts, Liste mit großen beschrifteten Icons */
.top{position:relative;z-index:30;align-items:center}#hb{margin-left:auto;padding:6px 12px;cursor:pointer}#hb .ic{width:1.6em;height:1.6em}
#menu{position:absolute;right:0;top:calc(100% + 6px);display:grid;gap:4px;min-width:220px;padding:8px;background:var(--bg);border:2px solid #fff3;border-radius:18px;box-shadow:0 12px 30px #000a}
#menu[hidden],#menu button[hidden]{display:none}
#menu button{display:flex;align-items:center;gap:12px;width:100%;padding:8px 14px;border-radius:14px;font-size:1.15rem;font-weight:800;text-align:left;cursor:pointer;border:0}
#menu button .ic{width:40px;height:40px;flex:none}#menu button i{font-style:normal}
#menu{max-height:calc(100dvh - 80px);overflow:auto}   /* v345: Menü wurde mit „Zahlenwerkstatt“ höher als flache Bildschirme – nie aus dem Bild ragen */
@media(orientation:landscape) and (max-height:720px){#menu{grid-template-columns:1fr 1fr;min-width:min(380px,70vw);max-height:calc(100dvh - 64px);overflow:auto;padding:5px;gap:3px}#menu #rg{grid-column:1/-1;padding:2px 8px 5px}#menu button{padding:2px 10px;min-height:36px;font-size:1rem;gap:8px}#menu button .ic{width:28px;height:28px}}
/* ---- UI-Politur (v46): Ziffernblock mit Tiefe und Druck-Animation, Münzen zählen, Balken blitzen ---- */
.pad button{background:linear-gradient(#1f1a5a,#0f0b2a);box-shadow:0 5px 0 #000b,inset 0 2px 0 #ffffff26;transition:transform .07s ease-out,box-shadow .07s ease-out,background .12s}
.pad button:active{background:var(--mint);transform:translateY(4px);box-shadow:0 1px 0 #000b,inset 0 2px 0 #ffffff40}
.pad{padding-bottom:5px}
@media(orientation:landscape) and (max-height:480px){.pad button{box-shadow:0 3px 0 #000b,inset 0 2px 0 #ffffff26}.pad button:active{transform:translateY(2px);box-shadow:0 1px 0 #000b}.pad{padding-bottom:3px}}
#co b{font-weight:inherit;font-variant-numeric:tabular-nums}
#co.bump{animation:bump .5s ease-out}@keyframes bump{30%{transform:scale(1.18);color:#fde047}}
#xp.shine::after{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,#fffb 50%,transparent 70%);transform:translateX(-100%);animation:shine .7s ease-out}
@keyframes shine{to{transform:translateX(100%)}}
@media (prefers-reduced-motion:reduce){.pad button,#xp,#hp{transition:none}#co.bump,#xp.shine::after{animation:none}}

/* ---- HUD-Ebene (v112): Kopfleiste, XP-Balken und Rechenaufgabe liegen halbtransparent ÜBER der Szene (Szene füllt die ganze Bühne) ---- */

.hud{position:absolute;left:0;right:0;top:0;z-index:30;display:grid;gap:6px;padding:10px 10px 0;pointer-events:none}
.hud>*{pointer-events:auto}
.hud .top span,.hud .top button{background:#1b1640b8;box-shadow:0 2px 8px #0004}
.hud .xp{background:#0f0b2a99;height:7px}
.hud .panel{background:#140f3cc2;box-shadow:0 3px 12px #0005;padding:6px 16px}
.hud #q{text-shadow:0 2px 0 #0009;white-space:nowrap;flex:none}   /* v138: einzeilig; fitQ() (game.js) passt die Schrift an */
@media(orientation:landscape) and (max-height:480px){.hud{gap:3px;padding:6px 8px 0}.hud .panel{padding:1px 10px}}
/* v113: Aufgaben-Feld nur so breit wie nötig (nicht über die volle Breite); Rang/Level als Kopfzeile im Hamburger-Menü */
.hud .panel{justify-self:center;width:fit-content;max-width:100%}.hud .panel input{width:clamp(96px,30vw,150px)}
#menu #rg{padding:4px 12px 8px;font-size:.95rem;font-weight:800;text-align:center;border-bottom:1px solid #fff3;margin-bottom:2px;color:var(--gold);overflow-wrap:anywhere}
#menu #rg:empty{display:none}
/* v113: kleine Handys im Hochformat (z. B. iPhone 13 mini, 375x812): alles kompakter */
@media(orientation:portrait) and (max-width:430px){
 main{padding:max(8px,env(safe-area-inset-top)) 8px max(8px,env(safe-area-inset-bottom));gap:6px}
 .hud{padding:6px 6px 0;gap:4px}
 .top{gap:4px}.top span,.top button{padding:3px 9px;font-size:.9rem}#hb{padding:3px 9px}#hb .ic{width:1.45em;height:1.45em}
 .hud .panel{padding:3px 12px;gap:8px;border-radius:16px}
 #q{font-size:clamp(24px,8.6vw,34px)}
 input{font-size:1.4rem;padding:3px;border-width:2px;border-radius:12px}.hud .panel input{width:clamp(84px,26vw,120px)}
 .pad{gap:5px;margin-top:4px;max-width:290px}.pad button{height:clamp(42px,6.2vh,52px);font-size:1.35rem;border-radius:13px;box-shadow:0 3px 0 #000b,inset 0 2px 0 #ffffff26}.pad button:active{transform:translateY(2px)}.pad{padding-bottom:3px}
 #menu{min-width:200px;padding:6px}#menu button{padding:5px 12px;font-size:1.02rem;gap:10px}#menu button .ic{width:30px;height:30px}
 .hud .top span,.hud .top button{min-height:32px}.hud #hb{min-width:38px}.pad button{min-height:0;min-width:0}#menu button{min-height:40px}
 dialog{padding:14px}
}
/* v115: XP-Balken ganz oben, Herzen links in der Kopfleiste (vor der Serie) */
.hud{padding-top:4px}.hud .xp{margin:0 2px 2px}
.hud .top{margin-top:2px}.stage{position:relative;min-height:0}
/* v341 R3: Pause der Spielwelt (core.js pauseOn, z. B. Rechenschieber offen): alle CSS-Animationen der Szene halten an und laufen danach an derselben Stelle weiter */
#sc.paused,#sc.paused *,#sc.paused *::before,#sc.paused *::after{animation-play-state:paused!important}
/* v420 FZ1: eingefroren (Duell) – Szene, Hexe, Monster, Käfig, Truhe halten an (Tiere fliegen weiter) (Spieluhr core.js einfrieren) */
body.eingefroren :is(.sscene,.wit,#monw,#cagew,#loot),body.eingefroren :is(.sscene,.wit,#monw,#cagew,#loot) *,body.eingefroren :is(.sscene,.wit,#monw,#cagew,#loot) *::before,body.eingefroren :is(.sscene,.wit,#monw,#cagew,#loot) *::after{animation-play-state:paused!important}
