/* Stellas Lernspiele - Aussehen.
   Leitidee: alles sieht aus wie genaeht - Filzstuecke mit Steppnaht, Stoffetiketten, Holzknoepfe.
   Farben kommen von der Puppe: Sternchenstoff (pfirsich), Muetze (salbei), Haende (koralle), Rucksack (hellblau).
   Wortarten: Nomen blau, Verb rot, Adjektiv gruen. */
:root {
  --n: #1e78e6; --n-bg: #dcebff; --v: #e53935; --v-bg: #ffe1df; --a: #2e9e44; --a-bg: #dcf5e0;
  --ink: #2b2a4a; --muted: #6c6788; --felt: #fbf4e6; --felt-d: #e9dcc3; --stitch: #b79a6c;
  --peach: #f0c2a2; --peach-d: #d79e7b; --sage: #7fae9d; --sage-d: #5c8a79; --coral: #e3868a; --coral-d: #bf5f66; --sky: #a9bfd6;
  --night1: #1c2259; --night2: #37307c; --gold: #ffd54a; --gold-d: #e09d00; --wood: #c98f5a; --wood-d: #9a6535;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Segoe UI", system-ui, sans-serif;
  --weave: repeating-linear-gradient(45deg, rgba(120, 90, 50, .05) 0 2px, transparent 2px 5px), repeating-linear-gradient(-45deg, rgba(120, 90, 50, .04) 0 2px, transparent 2px 5px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); font-size: 18px; line-height: 1.35;
  background: radial-gradient(120% 80% at 80% 110%, #5b3d92 0, transparent 60%), linear-gradient(165deg, var(--night1), var(--night2)); background-attachment: fixed;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
h1, h2, p { margin: 0; }
#sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#sky i { position: absolute; width: var(--s); height: var(--s); background: #fff; opacity: .55; clip-path: polygon(50% 0, 62% 38%, 100% 38%, 69% 60%, 80% 100%, 50% 76%, 20% 100%, 31% 60%, 0 38%, 38% 38%); transform: scale(2.2); animation: twinkle 4s var(--d) infinite ease-in-out; }
@keyframes twinkle { 50% { opacity: .12; transform: scale(1.3) rotate(20deg); } }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
#app { position: relative; min-height: 100%; }

.screen { max-width: 980px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px 170px; min-height: 100dvh; display: flex; flex-direction: column; gap: 18px; }
.screen.center { align-items: center; justify-content: center; text-align: center; padding-bottom: 190px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; }
.top h1, .screen.center > h1 { color: #fff; font-size: clamp(26px, 5vw, 40px); font-weight: 800; letter-spacing: .3px; }
.top h1::after, .screen.center > h1::after { content: ""; display: block; height: 5px; margin-top: 4px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--gold) 0 14px, transparent 14px 22px); opacity: .8; }
.sec { color: #fff; font-size: 22px; font-weight: 800; margin-top: 4px; }
.hint { color: #d9dcff; font-size: 16px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.hint .star-ico { width: 20px; }
.err { color: #ffb3ae; font-weight: 700; min-height: 1.3em; }
.row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

/* Filzstueck mit Steppnaht: Grundform fuer Karten und Flaechen */
.card, .usercard, .gamecard, .levelcard, .minicard, .st-bubble, .stage, .facts > div, .badge.got, .newitem {
  position: relative; background: var(--weave), var(--felt); border-radius: 30px 24px 32px 22px / 24px 30px 22px 32px;
  box-shadow: 0 10px 22px rgba(10, 10, 50, .35), inset 0 0 0 1px rgba(255, 255, 255, .7);
}
.card::before, .usercard::before, .gamecard::before, .levelcard::before, .minicard::before, .st-bubble::before, .stage::before, .facts > div::before {
  content: ""; position: absolute; inset: 8px; border: 2.5px dashed var(--stitch); border-radius: inherit; opacity: .55; pointer-events: none;
}
.card { padding: 24px; }
.card.narrow { max-width: 420px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.card.narrow h1 { color: var(--ink); font-size: 28px; }
.fig-s { width: 190px; margin: -10px 0 -20px; }

/* Knoepfe: aufgenaehte Stoffetiketten statt Pillen */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 12px 26px; font-weight: 800; color: #fff;
  background: var(--weave), var(--coral); border-radius: 16px 20px 15px 21px / 20px 15px 21px 16px; box-shadow: 0 6px 0 var(--coral-d), 0 12px 18px rgba(10, 10, 50, .3); transform: rotate(-1deg); transition: transform .08s, box-shadow .08s; }
.btn::before { content: ""; position: absolute; inset: 5px; border: 2px dashed rgba(255, 255, 255, .75); border-radius: inherit; pointer-events: none; }
.btn:active { transform: rotate(-1deg) translateY(5px); box-shadow: 0 1px 0 var(--coral-d); }
.btn.big { min-height: 68px; font-size: 25px; padding: 14px 38px; }
.btn svg { width: 26px; height: 26px; }
.btn.ghost { background: var(--weave), var(--sage); box-shadow: 0 6px 0 var(--sage-d), 0 12px 18px rgba(10, 10, 50, .3); transform: rotate(1deg); }
.btn.ghost:nth-child(2) { background: var(--weave), var(--peach); color: #5a3418; box-shadow: 0 6px 0 var(--peach-d), 0 12px 18px rgba(10, 10, 50, .3); transform: rotate(-1.5deg); }
.btn.ghost:nth-child(2)::before { border-color: rgba(120, 70, 30, .5); }
.btn.ghost:nth-child(3) { background: var(--weave), var(--sky); color: #24405e; box-shadow: 0 6px 0 #7f98b3, 0 12px 18px rgba(10, 10, 50, .3); }
.btn.ghost:nth-child(3)::before { border-color: rgba(40, 70, 110, .45); }
.btn.small { min-height: 42px; padding: 6px 16px; font-size: 15px; }
.btn.danger { background: #ffd9d6; color: #9c1c14; box-shadow: 0 4px 0 #e8a6a1; }
.btn.danger::before { border-color: rgba(150, 30, 20, .4); }
.linkbtn { color: #cfd3ff; text-decoration: underline dashed; text-underline-offset: 5px; padding: 12px; align-self: center; font-size: 16px; }
/* Runde Knoepfe sehen aus wie Holzknoepfe mit Naht */
.iconbtn { position: relative; width: 54px; height: 54px; flex: none; border-radius: 50%; color: #5a3418; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #f6d7ad, #dba36a 70%); box-shadow: 0 5px 0 var(--wood-d), 0 9px 14px rgba(10, 10, 50, .35); }
.iconbtn::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; border: 2px dashed rgba(90, 52, 24, .45); }
.iconbtn svg { width: 26px; height: 26px; position: relative; }
.iconbtn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--wood-d); }

.pop { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1) backwards; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-9px) rotate(-2deg); } 40%, 80% { transform: translateX(9px) rotate(2deg); } }
.star-ico { width: 24px; height: 24px; fill: var(--gold); stroke: var(--gold-d); stroke-width: 1.6; vertical-align: -4px; }
.shape { width: 26px; height: 26px; flex: none; }
.shape-n { fill: var(--n); } .shape-v { fill: var(--v); } .shape-a { fill: var(--a); }
.shape.open { fill: none; stroke-width: 2.5; stroke-dasharray: 3 3; }
.shape-n.open { stroke: var(--n); } .shape-v.open { stroke: var(--v); } .shape-a.open { stroke: var(--a); }
.c-n { color: var(--n); } .c-v { color: var(--v); } .c-a { color: var(--a); }
.bg-n { background: var(--n); } .bg-v { background: var(--v); } .bg-a { background: var(--a); }

/* Benutzerwahl */
.usergrid, .gamegrid, .levelgrid, .minigrid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); }
.usercard, .gamecard, .levelcard, .minicard { padding: 20px 14px 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; transition: transform .12s; }
.usercard:nth-child(odd), .gamecard:nth-child(odd), .levelcard:nth-child(odd) { transform: rotate(-1.2deg); }
.usercard:nth-child(even), .gamecard:nth-child(even), .levelcard:nth-child(even) { transform: rotate(1deg); }
.usercard:active, .gamecard:active, .levelcard:active, .minicard:active { transform: scale(.95); }
.usercard .avatar { width: 96px; height: 96px; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--stitch); }
.usercard b, .gamecard b, .minicard b { font-size: 22px; margin-top: 4px; }
.stars { color: var(--muted); font-size: 16px; font-weight: 700; }
.usercard.new { background: none; box-shadow: none; color: #fff; border: 3px dashed rgba(255, 255, 255, .55); }
.usercard.new::before { display: none; }
.usercard.new .stars { color: #d9dcff; }
.plus { width: 96px; height: 96px; display: grid; place-items: center; font-size: 60px; font-weight: 800; color: #6a4500; background: var(--gold); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); padding-top: 8px; }
.avatar { display: block; border-radius: 50%; }
.newuser { display: flex; flex-direction: column; gap: 12px; }
.newuser label { font-weight: 800; font-size: 20px; }
input { font: inherit; font-size: 26px; font-weight: 700; padding: 12px 16px; border-radius: 14px; border: 3px dashed var(--stitch); background: #fff; color: var(--ink); width: 100%; outline: none; }
input:focus { border-color: var(--n); border-style: solid; }
.newuser .hint, .card .hint { color: var(--muted); justify-content: flex-start; }
.newuser .err, .card .err { color: var(--v); }
.newuser .btn { align-self: center; }
.avgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.avpick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 18px; border: 3px dashed transparent; }
.screen > .avgrid .avpick { color: #fff; }
.avpick .avatar { width: 64px; height: 64px; }
.avpick small { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 3px; }
.avpick small svg { width: 13px; height: 13px; }
.avpick.on { border-color: var(--gold-d); background: #fff3c9; color: var(--ink) !important; transform: scale(1.06) rotate(-2deg); }
.avpick.locked .avatar { filter: grayscale(1); opacity: .4; }
.gate { display: flex; flex-direction: column; gap: 12px; width: 100%; align-items: center; }
.gate input { text-align: center; letter-spacing: 4px; }
.plist { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.prow { display: flex; align-items: center; gap: 10px; }
.prow .avatar { width: 44px; height: 44px; } .prow span { color: var(--muted); margin-left: auto; }
.calc { max-width: 140px; margin-top: 10px; }

/* Startseite */
.me { display: flex; align-items: center; gap: 12px; color: #fff; text-align: left; }
.me .avatar { width: 62px; height: 62px; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--gold); }
.me b { font-size: 24px; display: block; } .me small { color: #cfd3ff; }
/* Sternekonto als Stoffetikett mit Oese */
.starcount { margin-left: auto; position: relative; display: flex; align-items: center; gap: 6px; background: var(--weave), var(--felt); color: var(--ink); padding: 8px 18px 8px 30px; border-radius: 6px 16px 16px 6px; font-size: 24px; cursor: pointer; box-shadow: 0 5px 12px rgba(10, 10, 50, .35); transform: rotate(2deg); }
.starcount::before { content: ""; position: absolute; left: 9px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--night1); box-shadow: 0 0 0 2px var(--stitch); }
.starcount .star-ico { width: 30px; height: 30px; }
.gamegrid { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
.gamecard { padding: 26px 14px 22px; }
.gamecard small, .levelcard small, .minicard small { color: var(--muted); font-size: 15px; }
.gamecard.soon { background: none; box-shadow: none; color: #cfd3ff; border: 3px dashed rgba(255, 255, 255, .3); }
.gamecard.soon::before { display: none; }
.gamecard.soon small { color: #a9aee0; } .gamecard.soon svg { width: 30px; height: 30px; opacity: .6; }
.gicon { display: flex; gap: 8px; } .gicon .shape { width: 46px; height: 46px; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .18)); }
.gicon .shape:nth-child(1) { animation: bob 2.4s infinite; } .gicon .shape:nth-child(2) { animation: bob 2.4s .3s infinite; } .gicon .shape:nth-child(3) { animation: bob 2.4s .6s infinite; }
@keyframes bob { 50% { transform: translateY(-7px); } }

/* Legende der Wortarten: eingenaehte Etiketten */
.legend { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.chip { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 12px; background: var(--weave), var(--felt); font-size: 16px; border-radius: 5px; border-left: 9px solid; box-shadow: 0 4px 10px rgba(10, 10, 50, .3); }
.chip:nth-child(1) { transform: rotate(-1.5deg); } .chip:nth-child(3) { transform: rotate(1.5deg); }
.chip b { display: block; line-height: 1.1; } .chip small { font-size: 12px; color: var(--muted); display: block; }
.chip-n { border-color: var(--n); } .chip-n b { color: var(--n); }
.chip-v { border-color: var(--v); } .chip-v b { color: var(--v); }
.chip-a { border-color: var(--a); } .chip-a b { color: var(--a); }

/* Level */
.levelgrid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.levelcard { padding: 24px 14px 20px; gap: 8px; }
.levelcard b { font-size: 22px; }
.lvnum { width: 62px; height: 62px; color: #5a3418; font-size: 30px; font-weight: 800; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f6d7ad, #dba36a 70%); box-shadow: 0 4px 0 var(--wood-d), inset 0 0 0 5px rgba(246, 215, 173, 1), inset 0 0 0 7px rgba(90, 52, 24, .35); }
.lvnum svg { width: 26px; height: 26px; }
.lvstars .star-ico { width: 30px; height: 30px; fill: #ece4d3; stroke: #d4c7ab; }
.lvstars .star-ico.on { fill: var(--gold); stroke: var(--gold-d); }
.levelcard.locked { background: none; box-shadow: none; color: #d9dcff; border: 3px dashed rgba(255, 255, 255, .35); }
.levelcard.locked::before { display: none; }
.levelcard.locked small { color: #b9bdea; } .levelcard.locked .lvnum { filter: grayscale(1); opacity: .6; }
.levelcard.locked .lvstars { opacity: .3; }

/* Spielen */
.play { gap: 14px; padding-bottom: 20px; }
.playbar { display: flex; align-items: center; gap: 10px; color: #fff; }
/* Fortschritt: Sterne auf einem Stoffband */
.slots { flex: 1; display: flex; justify-content: center; gap: clamp(2px, 1vw, 8px); padding: 7px 12px; background: var(--weave), #4a4a94; border-radius: 6px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12); outline: 2px dashed rgba(255, 255, 255, .35); outline-offset: -6px; }
.slots { min-width: 0; }
.slot { flex: 1 1 0; min-width: 0; max-width: 40px; aspect-ratio: 1; display: grid; place-items: center; }
.slot .star-ico { width: 100%; height: 100%; fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .22); stroke-dasharray: 2 2; transition: fill .3s, transform .3s; }
.slot.ready .star-ico { fill: rgba(255, 255, 255, .16); stroke: rgba(255, 255, 255, .55); }
.slot.now .star-ico { stroke: #fff; stroke-dasharray: none; animation: pulse 1s infinite; }
.slot.gold .star-ico { fill: var(--gold); stroke: var(--gold-d); stroke-dasharray: none; animation: starin .5s; }
.slot.silver .star-ico { fill: #cfd6ea; stroke: #8f9ab8; stroke-dasharray: none; animation: starin .5s; }
@keyframes pulse { 50% { transform: scale(1.18); } }
@keyframes starin { 0% { transform: scale(.3) rotate(-90deg); } 60% { transform: scale(1.5); } }
.play .legend .chip { padding: 4px 12px 4px 10px; }
.stage { flex: 1; padding: clamp(18px, 3vw, 32px); padding-bottom: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(14px, 3vh, 30px); min-height: 52vh; }
.ask { font-size: clamp(22px, 3.6vw, 32px); font-weight: 800; text-align: center; }
.tip { color: var(--muted); font-size: 17px; text-align: center; max-width: 30em; }
.bigword { font-size: clamp(44px, 10vw, 92px); font-weight: 800; padding: 6px 30px; border-radius: 10px; border: 5px dashed transparent; transition: background .3s, color .3s; }
.choices, .palette, .cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; width: 100%; }
/* Die drei Wortarten als Filzflicken in ihrer Form: Quadrat, Kreis, Dreieck */
.typebtn { position: relative; flex: 1 1 150px; max-width: 240px; min-height: 124px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff; font-size: 24px; transition: transform .1s, opacity .2s; border-radius: 22px 18px 24px 16px / 18px 24px 16px 22px; }
.typebtn::before { content: ""; position: absolute; inset: 7px; border: 2.5px dashed rgba(255, 255, 255, .8); border-radius: inherit; pointer-events: none; }
.typebtn small { font-size: 15px; opacity: .95; } .typebtn .shape { width: 40px; height: 40px; fill: #fff; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .2)); }
.typebtn.t-n { background: var(--weave), var(--n); box-shadow: 0 8px 0 #1458ad, 0 14px 18px rgba(10, 10, 50, .3); transform: rotate(-1.5deg); }
.typebtn.t-v { background: var(--weave), var(--v); box-shadow: 0 8px 0 #a8221f, 0 14px 18px rgba(10, 10, 50, .3); border-radius: 60px; }
.typebtn.t-a { background: var(--weave), var(--a); box-shadow: 0 8px 0 #1f7030, 0 14px 18px rgba(10, 10, 50, .3); transform: rotate(1.5deg); border-radius: 50% 50% 18px 18px / 34% 34% 18px 18px; }
.typebtn:active { translate: 0 6px; }
.typebtn:disabled { opacity: .28; box-shadow: none; }
.typebtn.correct { animation: pulse .5s 2; }
/* Wortkarten und Woerter: Papierstreifen mit Naht */
.wordcard { position: relative; flex: 1 1 160px; max-width: 280px; min-height: 110px; font-size: clamp(28px, 5vw, 42px); font-weight: 800; background: #fff; border: 3px dashed var(--stitch); border-radius: 8px; box-shadow: 0 7px 14px rgba(60, 40, 10, .22); padding: 10px 16px; }
.wordcard:nth-child(odd) { transform: rotate(-1.5deg); } .wordcard:nth-child(even) { transform: rotate(1.2deg); }
.wordcard:active { translate: 0 5px; }
.sentence { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 22px 8px; font-size: clamp(26px, 5.2vw, 46px); font-weight: 700; padding-top: 14px; }
.word { padding: 6px 12px 8px; border-radius: 8px; border: 3px solid transparent; border-bottom: 3px dashed var(--stitch); background: #fff; transition: background .15s, transform .1s; position: relative; }
.word:active { transform: scale(.94); }
.dot { font-size: 1.2em; font-weight: 800; margin-left: -6px; }
.m-n { background: var(--n-bg) !important; border: 3px dashed var(--n) !important; color: #0e4a94; }
.m-v { background: var(--v-bg) !important; border: 3px dashed var(--v) !important; color: #99201c; }
.m-a { background: var(--a-bg) !important; border: 3px dashed var(--a) !important; color: #1b6a2c; }
.word.m-n::before, .word.m-v::before, .word.m-a::before { content: ""; position: absolute; left: 50%; top: -20px; width: 17px; height: 17px; margin-left: -8.5px; }
.word.m-n::before { background: var(--n); border-radius: 3px; }
.word.m-v::before { background: var(--v); border-radius: 50%; }
.word.m-a::before { background: var(--a); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.faded { opacity: .35; }
.glow { animation: glow 1s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 7px rgba(255, 213, 74, .75); } }
.todo { display: flex; gap: 8px; } .todo .shape { width: 30px; height: 30px; transition: fill .2s; }
/* Farbtoepfe: Garnrollen */
.pot { position: relative; min-width: 104px; min-height: 80px; padding: 10px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 18px; color: #fff; border-radius: 12px; transition: transform .12s; border-top: 8px solid var(--wood); border-bottom: 8px solid var(--wood); background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, .16) 0 2px, transparent 2px 6px); }
.pot svg { width: 30px; height: 30px; fill: #fff; }
.pot.t-n { background-color: var(--n); } .pot.t-v { background-color: var(--v); } .pot.t-a { background-color: var(--a); } .pot.t-x { background-color: #9a97b5; }
.pot.t-x svg { fill: none; }
.pot { opacity: .6; } .pot.on { opacity: 1; transform: translateY(-10px) scale(1.1) rotate(-2deg); box-shadow: 0 12px 16px rgba(10, 10, 50, .3); }
.yay { color: var(--a); font-weight: 800; } .oops { color: #c2571a; font-weight: 800; }

/* Auswertung */
.result { gap: 18px; }
.medals { display: flex; gap: 8px; align-items: flex-end; }
.medalstar .star-ico { width: clamp(64px, 16vw, 110px); height: auto; fill: rgba(255, 255, 255, .1); stroke: rgba(255, 255, 255, .35); stroke-dasharray: 2 1.5; }
.medalstar:nth-child(2) .star-ico { width: clamp(84px, 21vw, 140px); }
.medalstar.on .star-ico { fill: var(--gold); stroke: var(--gold-d); stroke-dasharray: none; }
.medalstar.on { animation: starin .7s backwards; }
.earn { width: min(460px, 100%); display: flex; flex-direction: column; gap: 8px; font-size: 19px; }
.earnrow { display: flex; justify-content: space-between; gap: 10px; align-items: center; position: relative; }
.earnrow.total { border-top: 3px dashed var(--stitch); padding-top: 10px; font-size: 24px; font-weight: 800; }
.total-n i { font-style: normal; } .total-n .star-ico { width: 30px; height: 30px; }
.news { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.newitem { display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; text-align: left; animation: pop .5s 1.2s backwards; background: var(--weave), #fff3c9; }
.newitem small { display: block; color: #8a6a00; font-size: 13px; } .newitem .avatar { width: 48px; height: 48px; }
.gift, .medal { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--c, var(--gold)); color: var(--ink); flex: none; }
.gift svg, .medal svg { width: 30px; height: 30px; } .medal .star-ico { fill: #fff; stroke: rgba(0, 0, 0, .15); } .medal { color: #fff; }
.btn.bonus { animation: wiggle 1.4s infinite; background: var(--weave), var(--gold); color: #5a3d00; box-shadow: 0 6px 0 var(--gold-d), 0 12px 18px rgba(10, 10, 50, .3); }
.btn.bonus::before { border-color: rgba(110, 70, 0, .5); }
@keyframes wiggle { 0%, 100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.06); } }
.bigscore { font-size: 84px; font-weight: 800; color: #fff; } .bigscore .star-ico { width: 80px; height: 80px; }

/* Profil */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.facts > div { padding: 16px 10px; text-align: center; }
.facts b { font-size: 32px; display: block; } .facts small { color: var(--muted); } .facts .star-ico { width: 28px; height: 28px; }
.badgegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.badge { color: #c9cdf5; border-radius: 18px; padding: 12px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2.5px dashed rgba(255, 255, 255, .28); }
.badge small { font-size: 13px; } .badge .medal { background: rgba(0, 0, 0, .25); color: #8e93c4; }
.badge.got { color: var(--ink); border: 0; }
.badge.got .medal { background: var(--c); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c); } .badge.got small { color: var(--muted); }
.stat { display: grid; grid-template-columns: 110px 1fr 60px; align-items: center; gap: 10px; padding: 6px 0; font-weight: 800; position: relative; }
.meter { height: 18px; background: #ece4d3; border-radius: 4px; overflow: hidden; } .meter i { display: block; height: 100%; background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .25) 0 3px, transparent 3px 8px); }
.stat b { text-align: right; }

/* Kleiderschrank: Holzschrank mit Kleiderstangen, die Teile haengen an Klammern */
.wardrobe { padding-left: calc(min(42vw, 52vh) + 24px); padding-bottom: 30px; }
.wlines { display: flex; flex-direction: column; gap: 16px; padding: 18px; border-radius: 22px; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 46px), linear-gradient(180deg, #d9a56e, var(--wood)); box-shadow: inset 0 0 0 6px var(--wood-d), inset 0 0 0 9px #e6b784, 0 12px 24px rgba(10, 10, 50, .4); }
.wline h2 { display: flex; align-items: center; gap: 8px; font-size: 20px; color: #4a2c12; }
.wline h2 .garment { width: 30px; height: 30px; color: #4a2c12; }
.rope { position: relative; display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 12px 6px 4px; }
.rope::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 7px; border-radius: 4px; background: linear-gradient(180deg, #f3f3f6, #9d9db0); box-shadow: 0 2px 3px rgba(0, 0, 0, .3); }
.peg { position: relative; width: 86px; padding: 20px 4px 8px; display: flex; flex-direction: column; align-items: center; color: #4a2c12; transform-origin: 50% 6px; transition: transform .2s; border-radius: 14px; }
.peg:nth-child(odd) { transform: rotate(-3deg); } .peg:nth-child(even) { transform: rotate(2.5deg); }
.peg .clip { position: absolute; top: -4px; left: 50%; width: 13px; height: 30px; margin-left: -6.5px; border-radius: 3px; background: linear-gradient(90deg, #f2d29f, #d9a25f); box-shadow: 0 2px 3px rgba(0, 0, 0, .3); z-index: 1; }
.peg .garment { width: 70px; height: 70px; filter: drop-shadow(0 4px 3px rgba(60, 30, 0, .35)); }
.garment.none { opacity: .75; }
.peg.on { transform: rotate(0) scale(1.14); background: radial-gradient(closest-side, rgba(255, 233, 138, .95), rgba(255, 233, 138, 0)); animation: swing 2.4s ease-in-out infinite; }
@keyframes swing { 0%, 100% { rotate: -3deg; } 50% { rotate: 3deg; } }
.peg.locked .garment { opacity: .32; filter: grayscale(.6); }
.peg .tag { position: absolute; bottom: 2px; right: -2px; display: flex; align-items: center; gap: 2px; padding: 2px 7px 2px 4px; font-size: 14px; font-weight: 800; color: var(--ink); background: var(--felt); border-radius: 3px 9px 9px 3px; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); transform: rotate(-8deg); }
.peg .tag .star-ico { width: 15px; height: 15px; }
@media (max-width: 700px) and (orientation: portrait) {
  .wardrobe { padding-left: 12px; height: 100dvh; padding-bottom: 12px; }
  .wardrobe .wlines { margin-top: 38vh; overflow-y: auto; flex: 1; min-height: 0; }
}

/* Bonusspiele */
.minigrid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); width: 100%; }
.mini-ico { width: 84px; height: 84px; border-radius: 22px 18px 24px 16px; background: var(--night2); padding: 10px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); }
.screen.mini { padding-bottom: 12px; height: 100dvh; }
.mini-title { font-size: 22px; flex: 1; text-align: center; }
.mini-score { font-size: 26px; font-weight: 800; background: var(--weave), var(--felt); color: var(--ink); padding: 6px 16px; border-radius: 6px 14px 14px 6px; } .mini-score i { font-style: normal; }
.mini-stage { flex: 1; position: relative; border-radius: 26px; overflow: hidden; background: rgba(0, 0, 0, .2); min-height: 300px; outline: 2.5px dashed rgba(255, 255, 255, .3); outline-offset: -8px; }
.mini-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.memo { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #fff; padding: 14px; }
.memo-msg { font-size: 28px; font-weight: 800; } .memo-lives { color: #cfd3ff; }
.memo-ring { position: relative; width: min(74vw, 52vh, 420px); aspect-ratio: 1; }
.memo-star { position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; margin: -15%; transform: rotate(var(--a)) translateY(-118%) rotate(calc(-1 * var(--a))); transition: filter .1s; }
.memo-star .star-ico { width: 100%; height: 100%; fill: var(--c); stroke: rgba(255, 255, 255, .5); opacity: .55; transition: opacity .1s, transform .1s; }
.memo-star.lit .star-ico { opacity: 1; transform: scale(1.3); filter: drop-shadow(0 0 16px var(--c)); stroke: #fff; }

/* ---------- Stella ---------- */
#stella-dock { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.st-dim { position: absolute; inset: 0; background: rgba(15, 18, 60, .6); opacity: 0; transition: opacity .3s; }
.st-wrap { position: absolute; left: 4px; bottom: max(2px, env(safe-area-inset-bottom)); width: clamp(120px, 19vw, 190px); transition: left .5s cubic-bezier(.4, 1.3, .5, 1), bottom .5s cubic-bezier(.4, 1.3, .5, 1), width .5s cubic-bezier(.4, 1.3, .5, 1), transform .4s; display: flex; flex-direction: column; align-items: center; }
.st-fig { width: 100%; pointer-events: auto; cursor: pointer; }
.stella3d { display: block; width: 100%; aspect-ratio: 1; }
.mode-hidden .st-wrap { transform: translateY(140%); }
.mode-big .st-dim { opacity: 1; pointer-events: auto; }
.mode-big .st-wrap { --w: min(62vw, 44vh, 360px); width: var(--w); left: calc(50% - var(--w) / 2); bottom: 3vh; }
.mode-stage .st-wrap { --w: min(42vw, 52vh); width: var(--w); left: 6px; bottom: 6vh; }
.st-bubble { position: absolute; bottom: 92%; left: 50%; width: min(90vw, 540px); transform: translateX(-50%); padding: 22px 26px; font-size: clamp(20px, 3vw, 26px); font-weight: 700; text-align: center; pointer-events: auto; display: flex; flex-direction: column; gap: 14px; align-items: center; animation: pop .4s cubic-bezier(.3, 1.5, .5, 1); }
.st-bubble[hidden] { display: none; }
.st-bubble::after { content: ""; position: absolute; top: calc(100% - 2px); left: 50%; margin-left: -16px; border: 16px solid transparent; border-top-color: var(--felt); border-bottom: 0; }
@media (max-width: 700px) and (orientation: portrait) { .mode-stage .st-wrap { --w: min(70vw, 36vh); left: calc(50% - var(--w) / 2); bottom: auto; top: 70px; } }
/* gezeichnete Ersatzfigur (falls das Geraet kein 3D kann) */
.stella { display: block; width: 100%; height: auto; overflow: visible; --px: 0px; --py: 0px; --mo: 0; }
.stella [class^="s-"] { transform-box: fill-box; }
.s-all { animation: s-bob 3.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes s-bob { 50% { transform: translateY(-5px) rotate(-1.2deg); } }
.s-cap { transform-origin: 40% 90%; animation: s-cap 3.4s ease-in-out infinite; }
@keyframes s-cap { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(2.5deg); } }
.s-leg { transform-origin: 50% 0; animation: s-leg 2.6s ease-in-out infinite; } .s-leg-r { animation-delay: -1.3s; }
@keyframes s-leg { 50% { transform: rotate(5deg); } }
.s-pupil { transform: translate(var(--px), var(--py)); transition: transform .25s ease-out; }
.s-brow { transition: transform .3s; transform-origin: 50% 50%; }
.s-mouth { transform-origin: 50% 0; transform: scaleY(.72); transition: transform .07s linear; }
.talking .s-mouth { transform: scaleY(calc(.3 + var(--mo) * .95)); }
.s-mouth-sad { opacity: 0; }
.mood-sad .s-all { animation: none; transform: translateY(6px) rotate(3deg); }
.mood-sad .s-mouth { opacity: 0; } .mood-sad .s-mouth-sad { opacity: 1; }
.mood-sad .s-brow-l { transform: rotate(-22deg) translateY(5px); } .mood-sad .s-brow-r { transform: rotate(22deg) translateY(5px); }
.mood-sleep .s-eye { transform: scaleY(.08); transform-origin: 50% 50%; }
.act-cheer .s-jump, .act-hop .s-jump { animation: s-hop .6s cubic-bezier(.3, .7, .4, 1) 2; transform-origin: 50% 100%; }
.act-hop .s-jump { animation-iteration-count: 1; }
@keyframes s-hop { 0% { transform: scale(1.08, .86); } 40% { transform: translateY(-40px) scale(.95, 1.08); } 75% { transform: translateY(0) scale(1.07, .9); } 100% { transform: none; } }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .screen { padding-left: 10px; padding-right: 10px; gap: 14px; }
  .chip small { display: none; } .chip { font-size: 15px; padding: 4px 10px 4px 8px; } .chip .shape { width: 20px; height: 20px; }
  .iconbtn { width: 46px; height: 46px; } .iconbtn svg { width: 22px; height: 22px; }
  .typebtn { flex-basis: 28%; min-height: 104px; font-size: 18px; } .typebtn small { font-size: 12px; } .typebtn .shape { width: 30px; height: 30px; }
  .pot { min-width: 72px; font-size: 14px; padding: 6px 6px; }
  .usergrid { grid-template-columns: repeat(2, 1fr); }
  .peg { width: 74px; } .peg .garment { width: 58px; height: 58px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .play .legend { display: none; } .stage { min-height: 0; padding-bottom: 16px; padding-left: 170px; }
  .mode-big .st-wrap { --w: min(30vw, 70vh); left: 2vw; bottom: 0; }
  .mode-big .st-bubble { left: 100%; bottom: 22%; transform: none; width: min(60vw, 480px); margin-left: 6px; }
  .mode-big .st-bubble::after { display: none; }
}
@media (prefers-reduced-motion: reduce) { .s-all, .s-cap, .s-leg, #sky i, .gicon .shape, .peg.on, .btn.bonus { animation: none !important; } }

/* Fehler melden */
.reportbtn { position: fixed; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 70; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(20, 22, 70, .55); border: 2px dashed rgba(255, 255, 255, .45); opacity: .7; }
.reportbtn svg { width: 20px; height: 20px; }
.reportbtn:active { opacity: 1; transform: scale(.92); }
.report-dlg { position: fixed; inset: 0; z-index: 80; background: rgba(15, 18, 60, .7); display: grid; place-items: center; padding: 16px; }
.report-card { width: min(460px, 100%); display: flex; flex-direction: column; gap: 12px; }
.report-card h2 { font-size: 24px; }
textarea { font: inherit; font-size: 18px; padding: 10px 12px; border-radius: 12px; border: 3px dashed var(--stitch); background: #fff; color: var(--ink); width: 100%; resize: vertical; -webkit-user-select: text; user-select: text; outline: none; }
.replist { display: flex; flex-direction: column; gap: 14px; }
.rep { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; -webkit-user-select: text; user-select: text; }
.rep.done { opacity: .55; }
.rep header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .rep header span { color: var(--muted); } .rep header .btn { margin-left: auto; }
.repnote { font-size: 20px; font-weight: 700; } .repnote.leer { color: var(--muted); font-weight: 400; font-size: 16px; }
.repctx { display: grid; gap: 4px; font-size: 14px; } .repctx div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; } .repctx small { color: var(--muted); } .repctx span { overflow-wrap: anywhere; }

/* Klasse, PIN, Abmelden */
.klasse { color: #ffe9a8; font-weight: 800; font-size: 18px; margin-top: -8px; }
.usercard { position: relative; }
.pinmark { position: absolute; top: 10px; right: 12px; width: 22px; height: 22px; color: var(--stitch); }
.pinmark svg { width: 100%; height: 100%; }
.pinform { width: 100%; }
.pinform .avatar { width: 96px; height: 96px; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--stitch); }
.pinform label { font-weight: 800; font-size: 20px; }
.pinform input:not([type=checkbox]) { text-align: center; letter-spacing: 3px; }
.pinform .hint { font-size: 14px; justify-content: center; text-align: center; }
.showpin { display: flex; align-items: center; gap: 8px; font-size: 16px !important; font-weight: 700 !important; color: var(--muted); }
input[type=checkbox] { width: 24px; height: 24px; padding: 0; flex: none; accent-color: var(--sage-d); }
.linkbtn.dark { color: var(--muted); padding: 6px; }

/* Musik-Knopf neben dem Ton-Knopf */
.soundbtns { display: flex; gap: 8px; flex: none; }
.iconbtn.music.off { filter: grayscale(.7); opacity: .8; }

/* Rechnen bis 100 */
.gicon.rechen span { width: 50px; height: 50px; display: grid; place-items: center; font-size: 40px; font-weight: 800; line-height: 1; color: #fff; border-radius: 12px; background: var(--weave), var(--a); box-shadow: 0 4px 0 #1f7030; animation: bob 2.4s infinite; }
.gicon.rechen span + span { background: var(--weave), var(--v); box-shadow: 0 4px 0 #a8221f; border-radius: 50%; animation-delay: .3s; }
.stage.rechnen { gap: clamp(10px, 2vh, 22px); justify-content: flex-start; padding-bottom: 24px; }
.eq { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: clamp(6px, 1.6vw, 14px); font-size: clamp(38px, 9vw, 72px); font-weight: 800; line-height: 1; }
.eq .op { color: var(--muted); }
.gap { min-width: 1.9em; height: 1.45em; padding: 0 .2em; font: inherit; font-weight: 800; color: var(--ink); background: #fff; border: 4px dashed var(--stitch); border-radius: 14px; display: inline-grid; place-items: center; position: relative; }
.gap.active { border-color: var(--n); border-style: solid; box-shadow: 0 0 0 5px var(--n-bg); }
.gap.ok { border-color: var(--a); border-style: solid; background: var(--a-bg); box-shadow: none; }
.gap.frage { color: var(--stitch); }
.gap[data-hint]:empty::after { content: attr(data-hint); color: #c9c2d6; }
.gap.fix { border-style: solid; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(100%, 320px); }
.key { min-height: clamp(52px, 8.5vh, 70px); font-size: 30px; font-weight: 800; color: var(--ink); background: var(--weave), #fff; border: 3px solid var(--felt-d); border-radius: 16px; box-shadow: 0 5px 0 var(--stitch); display: grid; place-items: center; touch-action: manipulation; }
.key:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--stitch); }
.key svg { width: 30px; height: 30px; }
.key.del { background: var(--weave), var(--peach); border-color: var(--peach-d); box-shadow: 0 5px 0 var(--peach-d); color: #5a3418; }
.key.ok { background: var(--weave), var(--sage); border-color: var(--sage-d); box-shadow: 0 5px 0 var(--sage-d); color: #fff; }
.numcard, .signcard, .tile { flex: 1 1 110px; max-width: 170px; min-height: 92px; font-size: clamp(34px, 7vw, 50px); }
.signcard { max-width: 130px; font-size: 54px; }
.wordcard.ok { border-color: var(--a); border-style: solid; background: var(--a-bg); }
.tile.weg { opacity: .18; transform: scale(.85); box-shadow: none; }
.gap.ablage.voll { background: #fff9e6; border-style: solid; border-color: var(--gold-d); }
.hilfe { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hilfe:empty { display: none; }
.feld { --d: clamp(9px, 2.2vw, 14px); display: grid; grid-template-columns: repeat(10, var(--d)); gap: 3px; padding: 8px; background: #fff; border-radius: 10px; border: 2px dashed var(--felt-d); }
.feld i { width: var(--d); height: var(--d); border-radius: 50%; background: var(--n); }
.feld i.f5 { margin-right: 5px; }
.feld i.db { background: var(--v); }
.feld i.hohl { background: none; border: 2px dashed var(--muted); }
.feld i.weg { background: none; border: 2px solid var(--v); position: relative; opacity: .8; }
.feld i.weg::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; border-top: 2px solid var(--v); transform: rotate(-45deg); }
.rweg { display: flex; flex-direction: column; gap: 2px; font-size: 22px; font-weight: 800; color: var(--muted); text-align: center; }
.rweg span:last-child { color: var(--ink); }
.mauer { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: clamp(26px, 6vw, 40px); font-weight: 800; }
.mauer > div { display: flex; gap: 6px; }
.stein { width: 2.6em; height: 1.7em; display: grid; place-items: center; background: var(--weave), var(--peach); border: 3px solid var(--peach-d); border-radius: 8px; color: #5a3418; font: inherit; font-weight: 800; }
.stein.gap { background: #fff; border: 4px dashed var(--stitch); color: var(--ink); min-width: 0; padding: 0; }
.stein.gap.active { border-color: var(--n); border-style: solid; }
.stein.gap.ok { border-color: var(--a); border-style: solid; background: var(--a-bg); }
@media (max-width: 560px) { .numpad { gap: 8px; width: min(100%, 290px); } .stage.rechnen .tip { font-size: 14px; } .numcard, .tile { flex-basis: 40%; min-height: 74px; } }
@media (orientation: landscape) and (max-height: 520px) { .stage.rechnen { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; } .stage.rechnen .ask { width: 100%; } .key { min-height: 44px; font-size: 24px; } }

/* Nichts darf breiter sein als der Bildschirm (kein seitliches Scrollen). */
html, body { overflow-x: hidden; max-width: 100%; }
#app { overflow-x: clip; }
.top > *, .playbar > * { min-width: 0; }
.top h1 { flex: 1 1 auto; overflow-wrap: anywhere; }
.me { flex: 1 1 auto; min-width: 0; }
.me span { min-width: 0; } .me b, .me small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .avatar, .starcount, .soundbtns, .iconbtn { flex: none; }
.mini-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  .top { gap: 8px; }
  .top h1 { font-size: clamp(21px, 6.2vw, 28px); }
  .me { gap: 8px; } .me .avatar { width: 46px; height: 46px; } .me b { font-size: 19px; } .me small { font-size: 13px; }
  .starcount { padding: 6px 10px 6px 24px; font-size: 19px; gap: 4px; } .starcount .star-ico { width: 22px; height: 22px; } .starcount::before { left: 7px; width: 8px; height: 8px; margin-top: -4px; }
  .soundbtns { gap: 6px; } .iconbtn { width: 42px; height: 42px; }
  .mini-title { font-size: 17px; } .mini-score { font-size: 20px; padding: 5px 10px; }
  .eq { font-size: clamp(30px, 10vw, 52px); gap: 5px; }
}
@media (max-width: 380px) { .me small { display: none; } }
@media (max-width: 560px) and (orientation: portrait) { .stage.rechnen { padding-bottom: 64px; } }

/* Zoom gesperrt: kein Aufziehen mit zwei Fingern, kein Doppeltipp-Zoom (Scrollen bleibt). */
html, body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Zahlenfeld bis 100 (Hundertertafel) */
.gicon.feldicon { display: grid; grid-template-columns: repeat(4, 12px); gap: 3px; padding: 6px; background: #fff; border-radius: 10px; box-shadow: 0 4px 0 var(--stitch); animation: bob 2.4s infinite; }
.gicon.feldicon i { width: 12px; height: 12px; border-radius: 3px; background: var(--felt-d); }
.gicon.feldicon i.an { background: var(--n); } .gicon.feldicon i.an + i.an { background: var(--v); } .gicon.feldicon i.an:nth-child(10) { background: var(--a); }
.stage.zahlenfeld { padding-left: clamp(6px, 2vw, 32px); padding-right: clamp(6px, 2vw, 32px); }
.zf { --c: clamp(26px, min(8.6vw, 5.6vh), 46px); display: grid; grid-template-columns: repeat(10, var(--c)); gap: 2px; padding: 5px; background: var(--stitch); border-radius: 10px; }
.zf-c { width: var(--c, 44px); height: var(--c, 44px); display: grid; place-items: center; padding: 0; font: inherit; font-size: calc(var(--c, 44px) * .46); font-weight: 800; color: var(--ink); background: #fff; border-radius: 4px; touch-action: manipulation; }
.zf-c.leer { background: #fdf8ec; }
.zf-c.hilf { color: var(--muted); background: #f2ead8; }
.zf-c.reihe { background: #fff3c9; }
.zf-c.start { background: var(--n); color: #fff; }
.zf-c.mark { background: var(--gold); box-shadow: inset 0 0 0 3px var(--gold-d); animation: pulse 1s infinite; color: #6a4500; z-index: 1; }
.zf-c.ok { background: var(--a); color: #fff; animation: none; }
.zf-c.falsch { background: var(--v-bg); }
.zf-c.glow { box-shadow: inset 0 0 0 3px var(--a); }
.zf-zahl { display: inline-grid; place-items: center; min-width: 1.9em; padding: 0 .25em; background: var(--n); color: #fff; border-radius: 10px; }
.zf-zahl.frage { background: var(--gold); color: #6a4500; }
.zf-weg { display: flex; align-items: center; gap: 8px; font-size: clamp(26px, 6vw, 40px); font-weight: 800; flex-wrap: wrap; justify-content: center; }
.zf-weg span { display: grid; place-items: center; width: 1.5em; height: 1.5em; background: #fff; border: 3px solid var(--felt-d); border-radius: 10px; }
.zf-stueck { --c: clamp(56px, 16vw, 76px); display: grid; grid-template-columns: repeat(var(--w), var(--c)); gap: 4px; }
.zf-stueck .zf-c { border: 3px solid var(--stitch); border-radius: 8px; min-width: 0; }
.zf-stueck .zf-c.nix { visibility: hidden; }
.zf-stueck .zf-c.fix { background: var(--weave), var(--peach); border-color: var(--peach-d); color: #5a3418; }
.zf-stueck .zf-c.blass { background: #fdf8ec; border-style: dashed; }
.zf-stueck .zf-c.gap { border: 4px dashed var(--stitch); height: var(--c); }
.zf-stueck .zf-c.gap.active { border-color: var(--n); border-style: solid; box-shadow: 0 0 0 4px var(--n-bg); }
.zf-stueck .zf-c.ok, .zf-stueck .zf-c.gap.ok { background: var(--a-bg); border-color: var(--a); border-style: solid; color: var(--ink); box-shadow: none; }
.zf-stueck .zf-c.mark { border-color: var(--gold-d); }
.stage.zahlenfeld .numcard { min-height: 64px; flex-basis: 20%; max-width: 110px; font-size: clamp(24px, 6vw, 36px); }
@media (max-width: 560px) and (orientation: portrait) { .stage.zahlenfeld .cards { gap: 8px; } }

/* Die Seite selbst steht fest (kein Zoomen, kein seitliches Verschieben). Gescrollt wird nur im Inhalt, und nur hoch und runter. */
html, body { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; touch-action: none; }
#app { position: absolute; inset: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
#app * { touch-action: pan-y; }
#stella-dock, #stella-dock *, .reportbtn, .report-dlg, .report-dlg * { touch-action: manipulation; }
.report-dlg textarea { touch-action: auto; }
.mini-canvas { touch-action: none !important; }

/* Gesperrte Bonusspiele */
.minicard.locked { background: none; box-shadow: none; color: #cfd3ff; border: 3px dashed rgba(255, 255, 255, .4); }
.minicard.locked::before { display: none; }
.minicard.locked .mini-ico { opacity: .6; } .minicard.locked .mini-ico svg { width: 44px; height: 44px; }
.minicard.locked small { color: #b9bdea; }
.gift.mini-gift svg { width: 100%; height: 100%; }

/* Hoehe immer am sichtbaren Bereich ausrichten (iPhone: die Browser-Leisten zaehlen nicht mit).
   Alle Bildschirme richten sich nach dem Inhaltsbereich, nicht mehr direkt nach dem Fenster. */
html, body { inset: auto; top: 0; left: 0; width: 100%; height: 100vh; height: 100dvh; }
.screen { min-height: 100%; }
/* Bonusspiele: genau ein Bildschirm hoch, nichts scrollt, die Leiste oben bleibt sichtbar. */
#app:has(.screen.mini) { overflow: hidden; touch-action: none; }
.screen.mini { height: 100%; min-height: 0; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); gap: 10px; overflow: hidden; }
.screen.mini .playbar { flex: none; }
.screen.mini .mini-stage { flex: 1 1 0; min-height: 0; }
@media (max-width: 700px) and (orientation: portrait) { .wardrobe { height: 100%; min-height: 0; } }

/* Zurueck zur normal scrollenden Seite. Die fest verankerte Seite (siehe weiter oben) hat am iPhone in Safari den oberen Rand
   unter die Browser-Leiste geschoben. Jetzt scrollt wieder das Dokument selbst, Safari rueckt den Inhalt dann von allein richtig ein.
   Seitliches Scrollen und Zoomen bleiben gesperrt (overflow-x: clip, touch-action, Gesten-Sperre in app.js). */
html { position: static; inset: auto; width: auto; height: auto; min-height: 100%; overflow-x: clip; overflow-y: auto; touch-action: pan-y; }
body { position: static; inset: auto; width: auto; height: auto; min-height: 100vh; min-height: 100dvh; overflow-x: clip; overflow-y: visible; touch-action: pan-y; }
#app { position: relative; inset: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; overflow-x: clip; }
.screen { min-height: 100vh; min-height: 100dvh; }
/* Bonusspiele: genau der sichtbare Bereich, nichts scrollt. */
html:has(.screen.mini), body:has(.screen.mini) { overflow: hidden; height: 100dvh; min-height: 0; touch-action: none; }
#app:has(.screen.mini) { height: 100dvh; min-height: 0; overflow: hidden; }
.screen.mini { height: 100dvh; min-height: 0; }
@media (max-width: 700px) and (orientation: portrait) { .wardrobe { height: 100dvh; min-height: 0; } }

/* Hinweis: App auf den Startbildschirm holen */
.inst { position: fixed; inset: 0; z-index: 90; background: rgba(15, 18, 60, .88); display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); overflow-y: auto; touch-action: pan-y; }
.inst * { touch-action: manipulation; }
.inst-card { width: min(100%, 440px); padding: 18px 18px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.inst-fig { width: 104px; height: auto; margin-top: -4px; animation: bob 2.4s infinite; }
.inst-card h2 { font-size: 24px; font-weight: 800; line-height: 1.15; }
.inst-warum { color: var(--muted); font-size: 16px; }
.inst-steps { list-style: none; counter-reset: s; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; }
.inst-steps li { counter-increment: s; display: grid; grid-template-columns: 30px 44px 1fr; align-items: center; gap: 8px; background: #fff; border: 2px dashed var(--felt-d); border-radius: 12px; padding: 8px 10px 8px 6px; font-size: 16px; line-height: 1.25; }
.inst-steps li::before { content: counter(s); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: #6a4500; font-weight: 800; }
.inst-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--n-bg); color: var(--n); }
.inst-ico svg { width: 28px; height: 28px; }
.inst-ok { font-size: 15px; }
.inst-klein { font-size: 14px; color: var(--muted); }
.inst .btn { min-height: 50px; font-size: 18px; padding: 10px 22px; }
.inst .btn.big { font-size: 21px; }
.inst .linkbtn { font-size: 15px; }

/* Safari am iPhone: Ohne viewport-fit=cover bleibt die Seite unter Safaris Leisten (vorher rutschte der obere Rand darunter).
   Einblendungen: Ist die Karte hoeher als der sichtbare Bereich, darf sie oben nicht abgeschnitten werden -
   deshalb nicht mittig ausrichten, sondern mit automatischem Rand (mittig, solange Platz ist) und scrollbar. */
.inst, .report-dlg { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.inst-card, .report-dlg > .card { margin: auto 0; flex: none; }
@media (max-height: 780px) {
  .inst-card { gap: 7px; padding: 14px 14px 10px; }
  .inst-fig { width: 70px; }
  .inst-card h2 { font-size: 21px; }
  .inst-warum { font-size: 14px; }
  .inst-steps li { font-size: 15px; padding: 6px 8px 6px 4px; grid-template-columns: 28px 38px 1fr; }
  .inst-ico { width: 38px; height: 38px; } .inst-ico svg { width: 24px; height: 24px; }
  .inst .btn { min-height: 44px; font-size: 17px; padding: 8px 18px; }
}

/* Vom Startbildschirm aus (Klasse als-app, siehe js/als-app.js): Abstand zur Statusleiste und fester Streifen darueber. */
.als-app body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); background: #1c2259; z-index: 95; pointer-events: none; }
.als-app .screen { padding-top: calc(env(safe-area-inset-top, 0px) + 12px); }
.als-app .screen.mini { padding-top: calc(env(safe-area-inset-top, 0px) + 8px); padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); }
.als-app .report-dlg { padding-top: calc(env(safe-area-inset-top, 0px) + 12px); }
.als-app .reportbtn { bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); }
/* Startbildschirm-App: Hintergrund der Seite selbst in App-Farbe, damit unter der durchsichtigen Statusleiste nichts Helles erscheint. */
.als-app, .als-app body { background-color: #1c2259; }

/* Hintergrund als feste Ebene hinter allem, die auch die Bereiche unter Statusleiste und Home-Balken abdeckt.
   Vorher hing der Verlauf am body und endete in der Startbildschirm-App unten zu frueh. */
html { background: #1c2259; }
body, .als-app body { background: transparent; }
html::before { content: ""; position: fixed; left: 0; right: 0; top: -15vh; bottom: -15vh; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 80% at 80% 100%, #5b3d92 0, transparent 60%), linear-gradient(165deg, var(--night1), var(--night2)); }

/* Startbildschirm-App: echter, fester Streifen unter der Statusleiste (statt des Pseudo-Elements).
   iOS erkennt feste Elemente am oberen Rand und uebernimmt ihre Farbe - ohne sie legt es einen weichen, unscharfen Uebergang ueber den Inhalt. */
#statusbar { display: none; }
.als-app #statusbar { display: block; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); background: #1c2259; z-index: 96; pointer-events: none; }
.als-app body::before { display: none; }

/* Startbildschirm-App, zweiter Versuch gegen den unscharfen Uebergang: iOS laesst den weichen Uebergang etwas unter die
   Statusleiste hineinreichen. Der feste Streifen ist deshalb hoeher als die Statusleiste, und der Inhalt beginnt erst darunter.
   So liegt im ganzen unscharfen Bereich nur einfarbiger Hintergrund - und Unschaerfe auf einer einzigen Farbe sieht man nicht. */
.als-app #statusbar { height: calc(env(safe-area-inset-top, 0px) + 22px); }
.als-app .screen { padding-top: calc(env(safe-area-inset-top, 0px) + 30px); }
.als-app .screen.mini { padding-top: calc(env(safe-area-inset-top, 0px) + 28px); }
.als-app .report-dlg { padding-top: calc(env(safe-area-inset-top, 0px) + 30px); }
