/* Rechenblitz – modern, freundlich, große Touch-Ziele. Für iPad optimiert. */
:root {
  --bg: #F6F4FF;
  --surface: #FFFFFF;
  --surface-2: #F1EEFF;
  --ink: #26233A;
  --ink-2: #5B5773;
  --muted: #8E8AA8;
  --line: #E6E1FA;
  --primary: #6C5CE7;
  --primary-2: #8E7CFF;
  --primary-dark: #5241CC;
  --red: #FF6B6B;
  --blue: #2E9BF0;
  --green: #22B573;
  --green-dark: #168A56;
  --yellow: #FFC928;
  --orange: #FF9F1C;
  --pink: #FF6FA8;
  --danger: #E03E52;
  --radius: 28px;
  --shadow: 0 2px 4px rgba(76, 60, 170, .05), 0 12px 32px rgba(76, 60, 170, .10);
  --shadow-lift: 0 4px 8px rgba(76, 60, 170, .08), 0 20px 44px rgba(76, 60, 170, .16);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --box0: #EEEBF8; --box1: #E3F6EA; --box2: #B9E6C9; --box3: #7DD3A0; --box4: #37B36F; --box5: #1B7A48;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(circle at 8% -5%, #E4DEFF 0, transparent 38%),
    radial-gradient(circle at 95% 5%, #FFE1EE 0, transparent 34%),
    radial-gradient(circle at 60% 110%, #DDF1FF 0, transparent 45%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
input, textarea { -webkit-user-select: text; user-select: text; font: inherit; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
h1, h2 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: 32px; font-weight: 850; }
h2 { font-size: 22px; font-weight: 800; }
.loading { text-align: center; margin-top: 40vh; color: var(--muted); }
.muted { color: var(--ink-2); font-size: 16px; }

#app {
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- Grundbausteine ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 24px 48px; display: flex; flex-direction: column; gap: 20px; animation: fade-up .35s ease-out; }
.page-center { align-items: center; text-align: center; justify-content: center; min-height: 100dvh; }
.page-head { display: flex; align-items: center; gap: 14px; width: 100%; flex-wrap: wrap; }
.page-head h1 { flex: 1; text-align: left; }
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(108, 92, 231, .07); padding: 22px 24px; width: 100%;
  display: flex; flex-direction: column; gap: 12px;
}
.card h2 { margin-bottom: 2px; }
.lead { font-size: 24px; color: var(--ink-2); margin: 0; font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 26px; border: 0; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow); font-weight: 800; font-size: 19px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:active { transform: translateY(2px) scale(.98); }
.btn-big { min-height: 72px; font-size: 23px; padding: 0 34px; }
.btn-small { min-height: 44px; font-size: 16px; padding: 0 14px; }
.btn-go {
  background: linear-gradient(135deg, #2BD189, #17A864); color: #fff;
  box-shadow: 0 6px 0 #11824D, 0 12px 26px rgba(23, 168, 100, .3);
}
.btn-go:active { box-shadow: 0 3px 0 #11824D; }
.btn-ghost { background: transparent; box-shadow: none; color: var(--ink-2); text-decoration: underline; text-underline-offset: 4px; }
.btn-danger { background: #FFE3E7; color: var(--danger); box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn-row.start { justify-content: flex-start; }
.icon-btn {
  min-width: 56px; height: 56px; border: 0; border-radius: 18px; background: var(--surface);
  box-shadow: var(--shadow); font-size: 22px; font-weight: 800; padding: 0 14px;
}
.icon-btn:active { transform: scale(.95); }
select { font: inherit; font-size: 18px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; }

/* ---------- Avatar ---------- */
.avatar-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.avatar { font-size: 72px; line-height: 1; }
.avatar.small { font-size: 44px; }

/* ---------- Profilwahl ---------- */
.hero-page { gap: 26px; }
.logo { font-size: 64px; letter-spacing: -2px; }
.logo span { background: linear-gradient(135deg, var(--primary), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo i { font-style: normal; display: inline-block; animation: wobble 2.4s ease-in-out infinite; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: 22px; justify-content: center; max-width: 960px; }
.avatar-btn {
  width: 180px; padding: 18px 12px 16px; border: 0; border-radius: 32px; background: var(--surface);
  box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.avatar-btn:hover { box-shadow: var(--shadow-lift); }
.avatar-btn:active { transform: scale(.96); }
.avatar-pic { width: 130px; height: 150px; display: block; }
.avatar-name { font-size: 22px; font-weight: 850; }
.empty-card { max-width: 520px; }
.adult-btn { margin-top: 6px; }

/* ---------- Menü ---------- */
.hero {
  display: flex; align-items: center; gap: 24px; padding: 20px 26px; border-radius: 34px;
  background: linear-gradient(135deg, #7B6CF6, #A184FF 55%, #FF8CC6); color: #fff;
  box-shadow: 0 16px 40px rgba(108, 92, 231, .3); position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.hero-avatar {
  position: relative; flex: none; width: 150px; height: 170px; border: 0; padding: 0; background: none;
  filter: drop-shadow(0 8px 16px rgba(40, 20, 120, .3)); transition: transform .15s;
}
.hero-avatar:active { transform: scale(.96); }
.hero-edit { position: absolute; right: 0; bottom: 8px; width: 42px; height: 42px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 20px; box-shadow: var(--shadow); }
.hero-info { flex: 1; display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 1; min-width: 0; }
.hero-top { display: flex; align-items: center; gap: 10px; }
.hero-top h1 { flex: 1; font-size: 34px; }
.hero .btn-ghost { color: #fff; }
.hero .level-chip { background: rgba(255, 255, 255, .95); color: var(--primary-dark); }
.hero .level-title { color: #fff; }
.hero .xp-bar { background: rgba(255, 255, 255, .3); }
.hero .chip { background: rgba(255, 255, 255, .22); color: #fff; }
.chip-btn { border: 0; }

.start-card {
  display: flex; align-items: center; gap: 24px; width: 100%; padding: 26px 32px; position: relative; overflow: hidden;
  border: 0; border-radius: 34px; text-align: left; color: #fff;
  background: linear-gradient(135deg, #2BD189, #12B5A6); box-shadow: 0 8px 0 #0E8F7C, 0 18px 36px rgba(18, 181, 166, .3);
  transition: transform .12s;
}
.start-card:active { transform: translateY(4px); box-shadow: 0 4px 0 #0E8F7C; }
.start-play { width: 88px; height: 88px; border-radius: 50%; background: rgba(255, 255, 255, .25); display: grid; place-items: center; font-size: 40px; flex: none; animation: pulse 2s ease-in-out infinite; }
.start-text { flex: 1; }
.start-title { display: block; font-size: 38px; font-weight: 900; letter-spacing: -0.02em; }
.start-sub { display: block; font-size: 20px; opacity: .95; margin-top: 4px; }
.start-deco { font-size: 90px; opacity: .25; position: absolute; right: 20px; transform: rotate(12deg); }
.last-line { margin: -6px 0 0; color: var(--ink-2); padding-left: 8px; }
.section-title { margin-top: 6px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.tile {
  --accent: var(--primary);
  border: 0; border-radius: 26px; background: var(--surface); box-shadow: var(--shadow);
  padding: 18px 12px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 150px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover:not(:disabled) { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.tile:active:not(:disabled) { transform: scale(.97); }
.tile.locked { opacity: .5; cursor: default; box-shadow: none; background: rgba(255, 255, 255, .6); }
.tile-badge {
  width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center; font-size: 38px;
  background: color-mix(in srgb, var(--accent) 16%, white);
  box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--accent) 22%, transparent);
}
.tile-icon { font-size: 44px; line-height: 1; }
.tile-title { font-weight: 850; font-size: 18px; text-align: center; }
.mini-bar { display: block; width: 80%; height: 8px; border-radius: 4px; background: var(--box0); overflow: hidden; }
.mini-bar > span { display: block; height: 100%; background: var(--accent, var(--green)); border-radius: 4px; }
.mini-bar.wide { width: 160px; flex: none; }
.module-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.module { background: var(--surface); border-radius: 26px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: var(--shadow); }
.module.soon { opacity: .6; box-shadow: none; border: 2px dashed var(--line); background: transparent; }
.module-note { font-size: 14px; color: var(--muted); font-weight: 700; }

/* ---------- Übungseinheit ---------- */
.session {
  position: relative; height: 100vh; height: 100dvh;
  display: grid; gap: 16px; padding: 16px 20px 20px;
  grid-template-areas: "top top" "task pad";
  grid-template-columns: 1fr minmax(300px, 36%);
  grid-template-rows: auto 1fr;
}
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 14px; padding: 8px 10px; border-radius: 26px;
  background: rgba(255, 255, 255, .7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow);
}
.topbar .icon-btn { box-shadow: none; background: var(--surface-2); height: 48px; min-width: 48px; }
.phase-label { font-weight: 850; font-size: 21px; white-space: nowrap; }
.bar { flex: 1; height: 14px; border-radius: 7px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary-2), var(--primary)); border-radius: 7px; transition: width .25s linear; }
.bar.bar-count { background: none; text-align: center; font-weight: 800; color: var(--ink-2); height: auto; }
.stars { font-weight: 850; font-size: 22px; background: #FFF6D6; color: #8A5A00; padding: 8px 16px; border-radius: 18px; min-width: 90px; text-align: center; white-space: nowrap; }
.combo {
  font-weight: 850; font-size: 22px; padding: 8px 14px; border-radius: 18px; white-space: nowrap;
  background: linear-gradient(135deg, #FFB020, #FF6B6B); color: #fff; box-shadow: 0 6px 16px rgba(255, 107, 107, .35);
}
.combo.bump { animation: bump .45s ease-out; }
.toast {
  position: absolute; left: 50%; top: 96px; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 20px; padding: 12px 24px; border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .25); pointer-events: none; white-space: nowrap;
}
.toast.show { animation: toast-in .3s ease-out; }

.task-area {
  grid-area: task; background: var(--surface); border-radius: 34px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px;
  min-height: 0; position: relative; overflow: hidden;
}
.task-area::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 8px;
  background: linear-gradient(90deg, var(--primary), var(--pink), var(--orange));
}
.visual-slot { min-height: 150px; display: flex; align-items: center; justify-content: center; width: 100%; }
.visual { transition: opacity .35s ease; display: flex; justify-content: center; width: 100%; animation: pop-in .3s ease-out; }
.visual.gone { opacity: 0; }
.visual-pair { display: flex; gap: 24px; align-items: center; justify-content: center; flex-wrap: wrap; }
.zehnerfeld { width: min(100%, 440px); max-height: 28vh; height: auto; }
.zahlenhaus { width: 190px; height: auto; }
.hint-btn { border: 2px dashed var(--line); background: transparent; border-radius: 999px; padding: 10px 22px; font-size: 18px; font-weight: 800; color: var(--muted); }

.equation { display: flex; align-items: center; gap: 16px; font-size: clamp(60px, 9.5vw, 112px); font-weight: 900; position: relative; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.equation .op { color: var(--primary-2); }
.equation .label { font-size: .45em; color: var(--ink-2); }
.ans {
  min-width: 1.4em; padding: 0 .14em; text-align: center; border-radius: 24px; color: var(--primary);
  background: var(--surface-2); box-shadow: inset 0 0 0 4px var(--line);
  transition: background .15s, box-shadow .15s;
}
.ans.ok, .ans.fix { background: #E0F8EC; box-shadow: inset 0 0 0 5px var(--green); color: var(--green-dark); animation: pop-in .25s ease-out; }
.ans.bad { background: #FFE6E9; box-shadow: inset 0 0 0 5px var(--red); color: var(--danger); animation: shake .35s; }
.star-burst { position: absolute; right: -10px; top: -10px; font-size: 60px; animation: burst .7s ease-out forwards; pointer-events: none; }

.feedback { min-height: 0; width: 100%; display: flex; justify-content: center; }
.help { text-align: center; max-width: 640px; animation: fade-up .3s ease-out; }
.help-head { font-size: 24px; margin: 0 0 8px; font-weight: 700; }
.help-tip { font-size: 21px; background: #FFF6D6; border-radius: 20px; padding: 12px 20px; margin: 0 0 14px; line-height: 1.35; }

.pad-slot { grid-area: pad; display: flex; align-items: stretch; min-height: 0; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 12px; width: 100%; }
.key {
  border: 0; border-radius: 26px; background: var(--surface);
  box-shadow: 0 6px 0 #DCD6F5, 0 10px 20px rgba(76, 60, 170, .08);
  font-size: 46px; font-weight: 850; min-height: 72px; color: var(--ink);
  transition: transform .06s, box-shadow .06s;
}
.key.pressed, .key:active { transform: translateY(4px); box-shadow: 0 2px 0 #DCD6F5; }
.key-del { font-size: 34px; color: var(--ink-2); background: var(--surface-2); }
.key-ok { background: linear-gradient(135deg, #2BD189, #17A864); color: #fff; box-shadow: 0 6px 0 #11824D, 0 10px 20px rgba(23, 168, 100, .25); }
.key-ok.pressed, .key-ok:active { box-shadow: 0 2px 0 #11824D; }

.overlay {
  position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: rgba(246, 244, 255, .88); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 20px;
}
.overlay.overlay-full { padding: 0; background: var(--bg); }
.intro-card, .pause-card { max-width: 640px; text-align: center; align-items: center; gap: 12px; padding: 34px; animation: pop-in .35s ease-out; }
.intro-step { color: var(--primary); font-weight: 800; background: var(--surface-2); padding: 4px 14px; border-radius: 999px; }
.intro-icon { font-size: 84px; line-height: 1; animation: wobble 2.4s ease-in-out infinite; }
.intro-card p { font-size: 21px; margin: 0 0 8px; line-height: 1.45; color: var(--ink-2); }

/* ---------- Pausen & Entspannung ---------- */
.exercise { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.ex-head { font-size: 28px; font-weight: 850; }
.ex-body { min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ex-text { font-size: 20px; color: var(--ink-2); max-width: 460px; }
.ex-foot { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.ex-bar { width: 80%; flex: none; }
.ex-card { align-items: center; }
.breath { position: relative; width: 260px; height: 260px; display: grid; place-items: center; }
.breath-circle {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #D9CCFF, #8E7CFF 60%, #6C5CE7);
  box-shadow: 0 20px 50px rgba(108, 92, 231, .35);
  animation: breathe 10s ease-in-out infinite;
}
.breath-text { position: relative; font-size: 28px; font-weight: 850; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.move { display: flex; flex-direction: column; align-items: center; gap: 16px; animation: pop-in .4s ease-out; }
.move-icon { font-size: 120px; line-height: 1; }
.move-text { font-size: 28px; font-weight: 750; max-width: 520px; margin: 0; line-height: 1.3; }
.move.tense .move-icon { animation: tense 1.2s ease-in-out infinite; }
.step-bar { width: 220px; height: 8px; border-radius: 4px; background: var(--box0); overflow: hidden; }
.step-bar > span { display: block; height: 100%; width: 0; background: var(--primary-2); border-radius: 4px; animation: step-fill linear forwards; }

/* ---------- Abschluss ---------- */
.big-emoji { font-size: 110px; line-height: 1; animation: pop-in .5s ease-out; }
.stat-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.stat { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); padding: 16px 22px; min-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-val { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-lbl { color: var(--ink-2); font-size: 15px; font-weight: 700; }
.stat-cmp { font-size: 15px; color: var(--green-dark); font-weight: 800; }
.stat-row.small .stat { min-width: 140px; box-shadow: none; background: var(--surface-2); }
.stat-row.small .stat-val { font-size: 26px; }
.unlock { font-size: 22px; background: #FFF6D6; padding: 10px 20px; border-radius: 16px; margin: 0; }

/* ---------- Gamification ---------- */
.game-card { gap: 10px; }
.xp-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; }
.level-chip { background: var(--ink); color: #fff; font-weight: 850; padding: 6px 14px; border-radius: 999px; font-size: 17px; }
.level-title { font-weight: 850; font-size: 20px; flex: 1; }
.xp-gain { font-weight: 850; color: var(--green-dark); font-size: 20px; }
.xp-bar { display: block; height: 14px; width: 100%; border-radius: 7px; background: var(--box0); overflow: hidden; }
.xp-bar > span { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, #FFD43B, #FF9F1C); transition: width .8s ease; }
.menu-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 16px; }
.levelup { font-size: 24px; margin: 0; background: #FFF6D6; border-radius: 16px; padding: 10px 16px; animation: pop-in .5s ease-out; }
.gain { font-size: 20px; margin: 0; }
.summary .game-card { max-width: 760px; text-align: left; }
.sticker-gain { display: flex; align-items: center; gap: 12px; }
.sticker-big { font-size: 56px; line-height: 1; }
.count { color: var(--muted); font-size: 16px; font-weight: 800; margin-left: 6px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge-new { display: flex; flex-wrap: wrap; gap: 12px; }
.badge {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 10px;
  border-radius: 22px; background: var(--surface-2); opacity: .55; min-width: 150px;
}
.badge.on { opacity: 1; background: linear-gradient(160deg, #FFF8DC, #FFE9A8); box-shadow: inset 0 0 0 3px #FFD43B; }
.badge-icon { font-size: 40px; line-height: 1; }
.badge-title { font-weight: 850; }
.badge-desc { font-size: 14px; color: var(--ink-2); }
.pop { animation: pop-in .5s ease-out both; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.sticker { aspect-ratio: 1; display: grid; place-items: center; border-radius: 18px; background: var(--surface-2); color: var(--muted); font-weight: 850; font-size: 22px; }
.sticker.on { font-size: 40px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); }
.mini-avatar { width: 64px; height: 72px; border: 0; padding: 0; background: none; }

/* ---------- Avatar-Editor ---------- */
.editor-main { display: grid; grid-template-columns: minmax(260px, 38%) 1fr; gap: 20px; align-items: start; }
.editor-preview { align-items: center; text-align: center; position: sticky; top: 16px; }
.preview-big { width: 100%; max-width: 320px; aspect-ratio: 200 / 246; animation: pop-in .3s ease-out; }
.editor-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.part-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.part-tab {
  border: 0; border-radius: 999px; padding: 10px 16px; background: var(--surface); box-shadow: var(--shadow);
  font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 6px;
}
.part-tab.on { background: var(--primary); color: #fff; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.option {
  border: 0; border-radius: 22px; background: var(--surface-2); padding: 8px 6px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .12s;
}
.option:active:not(:disabled) { transform: scale(.95); }
.option.on { background: #fff; box-shadow: inset 0 0 0 4px var(--primary); }
.option.locked { opacity: .5; cursor: default; }
.option-img { width: 86px; height: 100px; display: block; }
.option-name { font-size: 14px; font-weight: 800; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px; }
.color-opt {
  aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--c);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .08); display: grid; place-items: center; font-size: 18px; color: #fff;
}
.color-opt small { display: block; font-size: 11px; font-weight: 800; }
.color-opt.on { box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--primary); }
.color-opt.locked { opacity: .45; cursor: default; }

/* ---------- Spiele ---------- */
.game { position: relative; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 16px 20px; gap: 12px; }
.game-grid .tile { min-height: 160px; }
.sky { position: relative; flex: 1; border-radius: 30px; overflow: hidden; background: linear-gradient(#9FD4FF, #E2F3FF 70%, #F6F4FF); }
.balloon {
  --c: var(--red);
  position: absolute; bottom: -140px; width: 86px; height: 104px;
  border-radius: 50% 50% 48% 48% / 56% 56% 44% 44%;
  background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .7) 0 10%, transparent 11%), var(--c);
  box-shadow: inset -8px -10px 0 rgba(0, 0, 0, .12);
  animation: rise linear forwards; display: grid; place-items: center; font-size: 36px; cursor: pointer;
}
.balloon::after { content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 46px; background: rgba(0, 0, 0, .25); }
.balloon.gold { box-shadow: 0 0 0 4px #fff7, 0 0 24px #F6C343; }
.balloon.popped { animation: popped .25s ease-out forwards; pointer-events: none; }

.memory-board { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 8px; max-width: 900px; width: 100%; margin: 0 auto; align-content: center; }
.mem-card { border: 0; padding: 0; background: none; aspect-ratio: 1; perspective: 800px; max-height: 26vh; }
.mem-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .35s; transform-style: preserve-3d; }
.mem-card.flip .mem-inner, .mem-card.done .mem-inner { transform: rotateY(180deg); }
.mem-back, .mem-front {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 22px; backface-visibility: hidden;
  -webkit-backface-visibility: hidden; box-shadow: var(--shadow); font-size: clamp(40px, 7vw, 72px);
}
.mem-back { background: linear-gradient(135deg, var(--primary-2), var(--pink)); font-size: 36px; }
.mem-front { background: #fff; transform: rotateY(180deg); }
.mem-card.done .mem-front { box-shadow: inset 0 0 0 4px var(--green); }

.mole-field {
  flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 16px;
  max-width: 760px; width: 100%; margin: 0 auto; align-content: center;
  background: linear-gradient(#BDEBA8, #7DD3A0); border-radius: 30px;
}
.hole { position: relative; aspect-ratio: 1.3; max-height: 22vh; border: 0; padding: 0; overflow: hidden; border-radius: 50% / 40%; background: radial-gradient(ellipse at 50% 70%, #4A2F1A 0 55%, #6E4A2B 56% 100%); }
.mole { position: absolute; left: 0; right: 0; bottom: -70%; font-size: clamp(48px, 9vw, 84px); line-height: 1; transition: bottom .12s ease-out; pointer-events: none; }
.hole.up .mole { bottom: 12%; }
.hole.hit .mole { transform: scale(1.2); }

.catch-field { position: relative; flex: 1; overflow: hidden; border-radius: 30px; touch-action: none; background: linear-gradient(#1B2150, #3C3F8F 70%, #7B6CF6); }
.fall { position: absolute; left: 0; top: 0; font-size: 44px; line-height: 1; pointer-events: none; will-change: transform; }
.basket { position: absolute; bottom: 4%; left: 50%; transform: translateX(-50%); font-size: 80px; line-height: 1; transition: left .05s linear; pointer-events: none; }
.basket.wet { animation: shake .35s; filter: grayscale(.6); }

.simon-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.simon-msg { font-size: 28px; font-weight: 850; margin: 0; min-height: 36px; }
.simon { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; width: min(90vw, 60vh, 520px); }
.pad { --c: var(--green); aspect-ratio: 1; border: 0; border-radius: 36px; font-size: clamp(56px, 10vw, 96px); background: var(--c); opacity: .45; box-shadow: 0 6px 0 rgba(0, 0, 0, .15); transition: opacity .1s, transform .1s; }
.pad.lit { opacity: 1; transform: scale(1.05); box-shadow: 0 0 0 6px #fff, 0 0 40px var(--c); }

.paint { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.paint-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--c); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .6); }
.swatch.on, .size.on, .stamp.on { outline: 4px solid var(--primary); outline-offset: 2px; }
.size { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--surface); display: grid; place-items: center; }
.size i { display: block; border-radius: 50%; background: var(--ink); }
.stamp { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--surface); font-size: 24px; padding: 0; }
.tool-sep { width: 2px; height: 32px; background: var(--line); margin: 0 4px; }
.paint-canvas { flex: 1; width: 100%; min-height: 0; border-radius: 24px; background: #fff; box-shadow: var(--shadow); touch-action: none; }

/* Jump & Run */
.jr { position: relative; width: 100%; height: 100%; overflow: hidden; touch-action: none; border-radius: 0; }
.jr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.jr-hud { position: absolute; left: 16px; right: 16px; top: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; pointer-events: none; }
.jr-pill { background: rgba(255, 255, 255, .88); border-radius: 999px; padding: 10px 18px; font-weight: 850; font-size: 22px; box-shadow: var(--shadow); white-space: nowrap; }
.jr-task {
  background: #fff; border-radius: 24px; padding: 8px 28px; font-size: clamp(36px, 6vw, 60px); font-weight: 900;
  box-shadow: 0 10px 30px rgba(40, 30, 120, .2); border: 4px solid var(--primary-2); animation: pop-in .3s ease-out;
  white-space: nowrap;
}
.jr-task .q { color: var(--primary); }
.jr-task.good { border-color: var(--green); }
.jr-task.bad { border-color: var(--red); }
.jr-float { position: absolute; left: 0; right: 0; top: 30%; display: flex; justify-content: center; pointer-events: none; }
.jr-pop { position: absolute; font-size: 44px; font-weight: 900; color: #fff; padding: 6px 22px; border-radius: 999px; animation: float-up 1.3s ease-out forwards; }
.jr-pop.good { background: var(--green); }
.jr-pop.bad { background: var(--red); }
.jr-pop.miss { background: var(--ink-2); font-size: 32px; }
.jr-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(38, 35, 58, .35); padding: 20px; }
.jr-screen { position: relative; height: 100vh; height: 100dvh; }
.jr-host { position: absolute; inset: 0; }
.jr-exit { position: absolute; left: 16px; bottom: 16px; z-index: 5; }

/* ---------- Erwachsene ---------- */
.pin-page { gap: 16px; }
.pin-dots { display: flex; gap: 18px; }
.pin-dots span { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 3px var(--ink-2); }
.pin-dots span.on { background: var(--primary); box-shadow: none; }
.pin-dots.shake { animation: shake .35s; }
.pin-msg { min-height: 24px; color: var(--danger); margin: 0; }
.pin-pad { width: 330px; height: 360px; display: flex; }
.gate-form { max-width: 460px; font-size: 24px; }
.gate-form input { width: 100px; font-size: 24px; padding: 8px; border-radius: 10px; border: 2px solid var(--line); }

.parent .card h2 { font-size: 21px; }
.child-tabs { display: flex; flex-wrap: wrap; gap: 10px; }
.child-tab { border: 0; border-radius: 999px; padding: 12px 20px; background: var(--surface); box-shadow: var(--shadow); font-weight: 800; min-height: 52px; }
.child-tab.active { background: var(--primary); color: #fff; }
.child-tab.add { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.add-form label, .name-row { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.add-form input, .name-row input { flex: 1; max-width: 320px; font-size: 20px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-pick button { width: 56px; height: 56px; font-size: 32px; border: 0; border-radius: 14px; background: var(--surface-2); }
.avatar-pick button.on { box-shadow: inset 0 0 0 3px var(--primary); background: #fff; }
.note { background: #FFF1D6; border-radius: 12px; padding: 10px 14px; margin: 0; }
.switch-row { display: flex; align-items: center; gap: 12px; font-weight: 800; min-height: 44px; flex-wrap: wrap; }
.switch-row input, .path-item input { width: 26px; height: 26px; accent-color: var(--primary); }
.path-list { display: flex; flex-direction: column; gap: 6px; }
.path-item { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.path-icon { font-size: 26px; }
.path-title { font-weight: 800; flex: 1; }
.path-pct { width: 52px; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.chart { margin: 0; }
.chart figcaption, .heat figcaption { font-weight: 800; color: var(--ink-2); font-size: 15px; margin-bottom: 6px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .mark { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .pt:hover .mark { r: 6; }
.data-table { border-collapse: collapse; width: 100%; font-size: 16px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); }
details summary { cursor: pointer; color: var(--ink-2); margin-top: 8px; }

.heat-row { display: flex; flex-wrap: wrap; gap: 26px; }
.heat { margin: 0; }
.heat-table { border-collapse: separate; border-spacing: 3px; }
.heat-table th { font-size: 13px; color: var(--muted); font-weight: 700; width: 22px; }
.heat-cell { display: block; width: 30px; height: 30px; border: 0; border-radius: 7px; padding: 0; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; color: var(--ink-2); }
.heat-legend span { display: flex; align-items: center; gap: 6px; }
.heat-legend .heat-cell { width: 18px; height: 18px; border-radius: 4px; }
.box0 { background: var(--box0); }
.box1 { background: var(--box1); box-shadow: inset 0 0 0 1px #C9EBD6; }
.box2 { background: var(--box2); }
.box3 { background: var(--box3); }
.box4 { background: var(--box4); }
.box5 { background: var(--box5); }
.heat-info { min-height: 22px; margin: 0; }

/* ---------- Grafiken (SVG) ---------- */
.feld-frame { fill: #F1EEFF; stroke: #B9AEF5; stroke-width: 3; }
.feld-cell { fill: #FFFFFF; stroke: #DCD6F5; stroke-width: 2; }
.feld-cell.off { fill: #ECE9F6; stroke: #E0DCEF; }
.feld-mid { stroke: #B9AEF5; stroke-width: 3; }
.dot-c1 { fill: var(--red); }
.dot-c2 { fill: var(--blue); }
.dot-gone { fill: var(--red); opacity: .25; }
.dot-open { fill: none; stroke: var(--blue); stroke-width: 3; stroke-dasharray: 6 5; }
.cross { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.haus-roof { fill: #FFC9B5; stroke: #E0785A; stroke-width: 4; stroke-linejoin: round; }
.haus-body { fill: #FFFFFF; stroke: #E0785A; stroke-width: 4; }
.haus-wall { stroke: #E0785A; stroke-width: 4; }
.haus-num { font: 800 54px var(--font); text-anchor: middle; fill: var(--ink); }
.haus-roofnum { font-size: 46px; }
.haus-q { fill: var(--muted); }
.dot-c1-text { fill: var(--red); }
.dot-c2-text { fill: var(--blue); }

/* ---------- Animationen ---------- */
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes burst { from { transform: scale(.4); opacity: 1; } to { transform: translateY(-60px) scale(1.3); opacity: 0; } }
@keyframes breathe { 0%, 100% { transform: scale(.55); } 50% { transform: scale(1); } }
@keyframes pop-in { from { transform: scale(.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade-up { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(0); } to { transform: translateY(calc(-100dvh - 160px)); } }
@keyframes popped { to { transform: scale(1.6); opacity: 0; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes step-fill { to { width: 100%; } }
@keyframes tense { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes float-up { 0% { transform: translateY(20px) scale(.8); opacity: 0; } 15% { transform: none; opacity: 1; } 100% { transform: translateY(-80px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .breath-circle { animation: breathe 12s ease-in-out infinite !important; }
}

/* ---------- Hochformat & kleine Bildschirme ---------- */
@media (max-aspect-ratio: 1/1) {
  .session {
    grid-template-areas: "top" "task" "pad";
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr minmax(300px, 38%);
  }
  .module-row { grid-template-columns: 1fr; }
  .memory-board { grid-template-columns: repeat(3, 1fr); }
  .editor-main { grid-template-columns: 1fr; }
  .editor-preview { position: static; }
  .preview-big { max-width: 220px; }
}
@media (max-width: 700px) {
  .topbar { gap: 8px; }
  .bar.bar-count { display: none; }
  .stars, .combo { font-size: 18px; padding: 6px 10px; min-width: 0; }
  .phase-label { font-size: 18px; }
  .start-title { font-size: 28px; }
  .logo { font-size: 44px; }
  .hero { flex-direction: column; text-align: center; }
  .hero-top h1 { font-size: 28px; }
  .jr-pill { font-size: 16px; padding: 8px 12px; }
  .jr-hud { flex-wrap: wrap; }
  .jr-task { order: 3; margin: 0 auto; font-size: 34px; padding: 6px 20px; }
}
