/* === MalHelden – Styles === */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { color-scheme: light; forced-color-adjust: none; }

:root {
  /* Engine-Bausteine (Level-Kacheln, Farb-Auswahlring) auf Markenfarbe ziehen –
     ohne diese Zeilen bleibt das Grün aus engine.css. */
  --he-akzent: #ec4899;
  --he-akzent-dunkel: #be185d;
  --c-bg: #fdf2f8;
  --c-primary: #ec4899;
  --c-primary-dark: #be185d;
  --c-accent: #f472b6;
  --c-text: #2d3436;
  --c-muted: #636e72;
  --c-card: #ffffff;
  --c-shadow: 0 4px 12px rgba(0,0,0,0.08);
  --c-shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --c-danger: #e74c3c;

  --w-anlaut:  #ec4899;
  --w-lesen:   #2196f3;
  --w-schreiben: #e91e63;
  --w-grammatik: #f472b6;
  --w-recht:   #009688;
  --w-text:    #795548;
  --w-spiel:   #00897b;
  --w-bonus:   #ffc107;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Comic Sans MS", "Comic Neue", sans-serif;
  font-size: 18px;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
/* Safe-Area-Insets für Android 15 Edge-to-Edge + Notch */
.view {
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  box-sizing: border-box;
}
.version-tag {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: var(--c-muted);
  opacity: 0.6;
  pointer-events: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }

/* === View System === */
.view {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.view.active { display: flex; }

/* === Home / Hauptmenü === */
#view-home {
  background: linear-gradient(180deg, #fdf2f8 0%, #ded5ff 100%);
}
.home-header {
  text-align: center;
  padding: 24px 16px 12px;
  position: relative;
}
.mascot {
  font-size: 84px;
  line-height: 1;
  margin-bottom: 4px;
  animation: bounce 2s ease-in-out infinite;
  /* Rein dekorativ: die Bounce-Animation (transform) erzeugt einen eigenen
     Stacking-Context und würde sonst über den Profil-/Eltern-Buttons liegen
     und deren Klicks abfangen. */
  pointer-events: none;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.home-header h1 {
  margin: 0;
  font-size: 32px;
  color: var(--c-primary-dark);
  letter-spacing: 0.5px;
}
.tagline {
  margin: 4px 0 0;
  color: var(--c-muted);
  font-size: 16px;
}
.parent-btn {
  position: absolute;
  z-index: 3;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.7);
  border-radius: 24px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  box-shadow: var(--c-shadow);
}
.profile-chip {
  position: absolute;
  z-index: 3;
  top: 16px;
  left: 16px;
  background: rgba(255,255,255,0.85);
  border-radius: 24px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  box-shadow: var(--c-shadow);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-chip:active { transform: scale(0.96); }

/* Profil-Auswahl */
.profile-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}
.profile-card {
  background: var(--c-card);
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--c-shadow);
  border: 3px solid transparent;
  position: relative;
  cursor: pointer;
}
.profile-card.active { border-color: var(--c-primary); background: #e8f5e9; }
.profile-card:active { transform: scale(0.96); }
.profile-card .pc-avatar { font-size: 56px; line-height: 1; }
.profile-card .pc-name { margin-top: 6px; font-size: 16px; font-weight: 700; }
.profile-card .pc-stats { margin-top: 4px; font-size: 11px; color: var(--c-muted); }
.profile-card .pc-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  background: transparent;
  font-size: 18px;
  opacity: 0.5;
}

/* Avatar-Wahl-Dialog */
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.avatar-picker button {
  background: #f0f0f0;
  border-radius: 12px;
  padding: 10px 4px;
  font-size: 28px;
  cursor: pointer;
}
.avatar-picker button.selected { background: #ffe082; border: 2px solid var(--c-primary); }

/* Sticker-Album */
.stickers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}
.sticker-tile {
  background: linear-gradient(135deg, #fdf2f8, #fbcfe8);
  border-radius: 16px;
  padding: 14px 6px;
  text-align: center;
  box-shadow: var(--c-shadow);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.sticker-tile.locked { opacity: 0.25; background: #eee; }
.sticker-tile .stk-icon { font-size: 44px; line-height: 1; }
.sticker-tile .stk-name { font-size: 11px; font-weight: 600; margin-top: 6px; }

/* Adaptive Hint Glow */
.hint-btn.glow { animation: hint-pulse 1s ease-in-out infinite; box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.4); }
@keyframes hint-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* === Wochen-Challenge Banner === */
.banner-card.weekly { border-left: 4px solid #9c27b0; }
.wc-bar { margin-top: 4px; height: 4px; background: rgba(0,0,0,0.08); border-radius: 2px; overflow: hidden; }
.wc-bar > div { height: 100%; background: #9c27b0; transition: width 0.3s; }

/* === Onboarding === */
#view-onboarding {
  background: linear-gradient(180deg, #fdf2f8 0%, #fbcfe8 100%);
  align-items: center;
  justify-content: center;
}
.onboarding-wrap {
  text-align: center;
  padding: 40px 24px;
  max-width: 360px;
  width: 100%;
}
.onb-mascot {
  font-size: 140px;
  line-height: 1;
  animation: bounce 2s ease-in-out infinite;
  margin-bottom: 16px;
  /* Deko: transform-Animation erzeugt einen Stacking-Context und würde sonst
     die Onboarding-Buttons überdecken (vgl. Fuchs/Profil-Chip auf der Startseite). */
  pointer-events: none;
}
.onboarding-wrap h1 { font-size: 28px; color: var(--c-primary-dark); margin-bottom: 12px; }
.onboarding-wrap p { font-size: 18px; color: var(--c-text); margin-bottom: 32px; }
.onb-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; }
.onb-dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(0,0,0,0.15); }
.onb-dot.active { background: var(--c-primary); }
.onb-skip { background: transparent; color: var(--c-muted); font-size: 14px; margin-top: 12px; text-decoration: underline; padding: 8px; }

/* === Shop === */
.shop-coins {
  background: rgba(255,235,59,0.9);
  border-radius: 16px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 14px;
}
.shop-content {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}
.shop-section { margin-bottom: 24px; }
.shop-section h3 { font-size: 18px; margin: 0 0 12px; color: var(--c-primary-dark); }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.shop-item {
  background: var(--c-card);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
  box-shadow: var(--c-shadow);
  border: 3px solid transparent;
  position: relative;
}
.shop-item.owned { border-color: #4caf50; }
.shop-item.active { border-color: #ff9800; background: #fff3cd; }
.shop-item.cant { opacity: 0.55; }
.shop-item .si-icon { font-size: 36px; line-height: 1; }
.shop-item .si-name { font-size: 11px; font-weight: 600; margin-top: 4px; }
.shop-item .si-price { margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--c-accent); }
.shop-item .si-status { font-size: 11px; color: var(--c-muted); margin-top: 2px; }

/* === Stats Chart === */
#statsChart { display: flex; align-items: flex-end; gap: 4px; height: 100px; margin-top: 8px; padding: 0 4px; }
.stat-bar { flex: 1; background: var(--c-primary); border-radius: 4px 4px 0 0; min-height: 4px; position: relative; transition: height 0.3s; }
.stat-bar .stat-label { position: absolute; bottom: -18px; left: 0; right: 0; font-size: 11px; text-align: center; color: var(--c-muted); }
.stat-bar .stat-value { position: absolute; top: -16px; left: 0; right: 0; font-size: 11px; text-align: center; font-weight: 700; color: var(--c-text); }
.stat-bar.today { background: var(--c-accent); }

/* === Audio-Recorder === */
.audio-recorder-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
.audio-recorder-modal {
  background: var(--c-card);
  border-radius: 20px;
  padding: 24px;
  max-width: 360px;
  width: calc(100% - 32px);
  text-align: center;
}
.audio-recorder-modal h3 { margin: 0 0 12px; }
.rec-text { background: #f0f0f0; padding: 12px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; }
.rec-button {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--c-danger);
  color: white;
  font-size: 36px;
  box-shadow: var(--c-shadow-lg);
  margin: 8px;
}
.rec-button.recording { animation: rec-pulse 1s ease-in-out infinite; background: #c62828; }
@keyframes rec-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(198,40,40,0.6); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 16px rgba(198,40,40,0); }
}
.rec-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }

/* === Result Mascot stronger animation === */
.result-mascot { transform-origin: center; }
@keyframes result-celebrate {
  0% { transform: scale(0) rotate(-200deg); }
  35% { transform: scale(1.3) rotate(20deg); }
  55% { transform: scale(0.9) rotate(-10deg); }
  75% { transform: scale(1.1) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}
.result-mascot.celebrate { animation: result-celebrate 0.8s ease-out; }

/* === Mascot react on play === */
.mascot.happy { animation: mascot-happy 0.5s ease-out; }
@keyframes mascot-happy {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-14px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
}

.worlds-grid, .classes-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 16px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  align-content: start;
}
.class-card {
  background: var(--c-card);
  border-radius: 20px;
  padding: 22px 12px;
  text-align: center;
  box-shadow: var(--c-shadow);
  border: 3px solid transparent;
  position: relative;
  min-height: 150px;
  transition: transform 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.class-card:active { transform: scale(0.96); }
.class-card.locked { opacity: 0.65; }
.class-card .class-icon { font-size: 44px; line-height: 1; }
.class-card .class-name { margin-top: 8px; font-size: 18px; font-weight: 700; color: var(--c-text); }
.class-card .class-age { margin-top: 4px; font-size: 14px; color: var(--c-muted); }
.class-card .class-stars { margin-top: 6px; font-size: 14px; color: var(--c-accent); font-weight: 600; }
.class-card .class-progress { display: flex; align-items: center; gap: 6px; width: 100%; max-width: 150px; }
.class-card .mini-bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.08); overflow: hidden; }
.class-card .mini-fill { display: block; height: 100%; background: var(--c-accent); border-radius: 4px; transition: width 0.3s; }
.class-card .lock-badge { position: absolute; top: 8px; right: 8px; font-size: 20px; }
.class-card.full-width { grid-column: span 2; min-height: auto; padding: 14px 12px; }
.class-card.full-width .class-icon { font-size: 36px; }
.world-card {
  background: var(--c-card);
  border-radius: 20px;
  padding: 20px 12px;
  text-align: center;
  box-shadow: var(--c-shadow);
  border: 3px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.world-card:active { transform: scale(0.96); }
.world-card.locked { opacity: 0.55; }
.world-card .world-icon { font-size: 44px; line-height: 1; }
.world-card .world-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.world-card .world-name {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.3;
}
.world-card .world-meta {
  margin-top: 4px;
  font-size: 13px;
  color: var(--c-muted);
  line-height: 1.35;
}
.world-card .world-stars {
  margin-top: 6px;
  font-size: 14px;
  color: var(--c-accent);
  font-weight: 600;
}
.world-card .lock-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 20px;
}
.world-card .preview-badge,
.class-card .preview-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #ffd54f, #ff9800);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  letter-spacing: 0.5px;
}
.world-card.preview { border-color: #ff9800 !important; box-shadow: 0 0 0 2px rgba(255,152,0,0.2), var(--c-shadow); }
.level-tile.preview-locked { background: linear-gradient(135deg, #fff3e0, #ffe0b2); border-color: #ff9800; opacity: 0.85; }
.level-tile.preview-locked .level-num { font-size: 24px; }

.home-footer {
  padding: 14px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--c-accent);
}

/* === Welt-Header === */
.world-header, .play-header {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  padding: 12px 16px;
  background: var(--c-card);
  box-shadow: var(--c-shadow);
  position: sticky;
  top: 0;
  z-index: 5;
}
.world-header h2 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  color: var(--c-primary-dark);
}
.back-btn, .speak-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--c-bg);
  font-size: 28px;
  font-weight: 700;
  color: var(--c-text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-btn:active, .speak-btn:active { background: #e0d4ad; }

/* === Welt: Level-Grid (jetzt in Phasen à 10) === */
.levels-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}
.phase-header {
  background: var(--c-card);
  padding: 10px 14px;
  border-radius: 14px;
  border-left: 4px solid var(--c-primary);
  box-shadow: var(--c-shadow);
}
.phase-header.complete {
  background: linear-gradient(90deg, #c8e6c9, #fff);
  border-left-color: var(--c-primary-dark);
}
.phase-header.locked {
  opacity: 0.55;
  border-left-color: #999;
}
.phase-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  font-size: 16px;
}
.phase-name { color: var(--c-primary-dark); }
.phase-progress { color: var(--c-muted); font-size: 11px; font-weight: 600; }
.phase-bar {
  margin-top: 6px;
  height: 5px;
  background: rgba(0,0,0,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.phase-bar > div { height: 100%; background: var(--c-primary); transition: width 0.3s; }
.phase-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.phase-section.locked .level-tile {
  background: #f0f0f0;
  color: var(--c-muted);
}
.level-tile {
  aspect-ratio: 1;
  background: var(--c-card);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--c-shadow);
  font-size: 20px;
  font-weight: 700;
  border: 3px solid transparent;
  position: relative;
}
.level-tile.completed { border-color: var(--c-primary); }
.level-tile.locked { opacity: 0.5; }
.level-tile.premium { opacity: 0.6; }
.level-tile .level-num { font-size: 24px; }
.level-tile .level-stars {
  font-size: 11px;
  margin-top: 4px;
  color: var(--c-accent);
}
.level-tile .premium-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 14px;
}

/* === Spielfeld === */
#view-play { background: linear-gradient(180deg, #fdf2f8 0%, #fbcfe8 100%); }
.progress-bar {
  height: 12px;
  background: rgba(0,0,0,0.08);
  border-radius: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--c-primary);
  transition: width 0.3s;
  border-radius: 6px;
}
.progress-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-accent);
  white-space: nowrap;
  min-width: 44px;
  text-align: center;
}
/* 🏆 Phase mit 100% Sternen */
.phase-header.perfect {
  background: linear-gradient(135deg, #fff8e1, #ffecb3);
  border: 2px solid #ffc107;
  border-radius: 12px;
}
.phase-header.perfect .phase-name { color: #b8860b; }
.play-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  gap: 24px;
}
.question-card {
  background: var(--c-card);
  border-radius: 24px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--c-shadow-lg);
  max-width: 420px;
  width: 100%;
}
.question-text {
  font-size: 20px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 8px;
}
.question-target {
  font-size: 84px;
  font-weight: 800;
  color: var(--c-primary-dark);
  line-height: 1;
  margin: 8px 0;
}
.question-anchor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 12px 0 4px;
  width: 100%;
  border-radius: 16px;
  padding: 8px;
  transition: background 0.15s, transform 0.1s;
}
.question-anchor.tappable {
  cursor: pointer;
  background: rgba(76, 175, 80, 0.08);
  border: 2px dashed rgba(76, 175, 80, 0.3);
}
.question-anchor.tappable:active { transform: scale(0.96); background: rgba(108, 75, 214, 0.16); }
.anchor-hint { font-size: 16px; opacity: 0.7; margin-left: 4px; }
.anchor-img {
  font-size: 72px;
  line-height: 1.1;
  max-width: 100%;
  text-align: center;
  letter-spacing: 2px;
  word-break: break-word;
}
.anchor-clock { display: flex; justify-content: center; }
.anchor-clock svg { max-width: 100%; height: auto; }
.anchor-word { font-size: 22px; font-weight: 700; color: var(--c-primary-dark); letter-spacing: 0.5px; }
.option-btn.text { font-size: 22px; padding: 14px 6px; }
.options-row {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 420px;
}
.options-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.options-row.cols-4 { grid-template-columns: repeat(2, 1fr); }
.options-row.cols-1 { grid-template-columns: 1fr; max-width: 480px; }
.option-btn {
  background: var(--c-card);
  border-radius: 20px;
  padding: 18px 8px;
  font-size: 44px;
  font-weight: 700;
  box-shadow: var(--c-shadow);
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
  overflow: hidden;
}
/* Kurze Text-Optionen (Zahlen, Wörter): kleiner, umbrechbar */
.option-btn.text {
  font-size: 24px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  line-height: 1.2;
  padding: 14px 8px;
}
/* Lange Text-Optionen (ganze Sätze): einspaltig, links, kleiner, niedriger */
.option-btn.long {
  font-size: 18px;
  min-height: 56px;
  padding: 12px 16px;
  justify-content: flex-start;
  text-align: left;
  line-height: 1.25;
}
.option-btn:active { transform: scale(0.94); }
.option-btn.correct { background: #c8e6c9; border: 3px solid var(--c-primary); }
.option-btn.wrong { background: #ffe0e0; }
/* Twemoji-Grafiken: skalieren mit der Schriftgröße des Kontexts */
img.twe {
  height: 1em;
  width: 1em;
  vertical-align: -0.125em;
  margin: 0 0.03em;
  display: inline-block;
  object-fit: contain;
}

/* === Feedback Overlay === */
.feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadein 0.2s;
}
.feedback-overlay[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.feedback-content {
  background: var(--c-card);
  border-radius: 24px;
  padding: 40px 32px;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  box-shadow: var(--c-shadow-lg);
  animation: pop 0.3s ease-out;
}
@keyframes pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.feedback-content .feedback-icon { font-size: 72px; display: block; margin-bottom: 8px; }

/* === Result === */
#view-result {
  background: linear-gradient(180deg, #fdf2f8 0%, #fbcfe8 100%);
  align-items: center;
  justify-content: center;
}
.result-card {
  background: var(--c-card);
  border-radius: 28px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--c-shadow-lg);
  max-width: 380px;
  width: calc(100% - 32px);
  margin: auto;
}
.result-mascot { font-size: 96px; line-height: 1; pointer-events: none; }
.result-card h2 { margin: 12px 0 8px; font-size: 28px; color: var(--c-primary-dark); }
.result-stars {
  font-size: 56px;
  letter-spacing: 8px;
  margin: 16px 0;
}
.result-card p { color: var(--c-muted); margin-bottom: 20px; }
.result-buttons {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
}

/* === Big Buttons === */
.big-btn {
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  box-shadow: var(--c-shadow);
  min-height: 56px;
}
.big-btn.primary { background: var(--c-primary); color: white; }
.big-btn.primary:active { background: var(--c-primary-dark); }
.big-btn.secondary { background: var(--c-bg); color: var(--c-text); }
.big-btn.danger { background: var(--c-danger); color: white; width: 100%; }

/* === Eltern-Bereich === */
.parent-lock {
  margin: 40px auto;
  max-width: 360px;
  padding: 24px;
  background: var(--c-card);
  border-radius: 20px;
  box-shadow: var(--c-shadow);
  text-align: center;
}
.parent-question { color: var(--c-muted); margin: 0 0 12px; }
.parent-math { font-size: 32px; font-weight: 700; margin: 16px 0; }
#parentAnswer {
  width: 100%;
  padding: 14px;
  font-size: 24px;
  text-align: center;
  border: 2px solid #ddd;
  border-radius: 12px;
  margin-bottom: 16px;
}
.parent-error { color: var(--c-danger); font-weight: 600; margin-top: 8px; }

.parent-content { padding: 16px; max-width: 480px; width: 100%; margin: 0 auto; }
.parent-section {
  background: var(--c-card);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--c-shadow);
}
.parent-section h3 { margin: 0 0 12px; font-size: 18px; }
.parent-section.danger { border: 2px dashed var(--c-danger); }
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}
.settings-row:last-child { border-bottom: none; }
.settings-row input[type="checkbox"] { width: 24px; height: 24px; }
.settings-row select { padding: 8px; border-radius: 8px; border: 1px solid #ddd; font-size: 16px; max-width: 60%; }
.voice-row select { max-width: 70%; }
.voice-test { width: 100%; margin-top: 8px; }

.progress-world-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.progress-world-row:last-child { border-bottom: none; }
.progress-world-icon { font-size: 24px; width: 32px; }
.progress-world-name { flex: 1; font-weight: 600; }
.progress-world-bar {
  flex: 2;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}
.progress-world-bar > div { height: 100%; background: var(--c-primary); }
.progress-world-count { font-size: 14px; color: var(--c-muted); width: 48px; text-align: right; }

.purchase-status { margin-top: 10px; font-size: 14px; color: var(--c-primary-dark); font-weight: 600; }
.unlock-btn { padding: 8px 14px; border-radius: 12px; background: var(--c-primary); color: white; font-weight: 700; font-size: 14px; box-shadow: var(--c-shadow); }
.unlock-btn.unlocked { background: #e0e0e0; color: var(--c-muted); }

/* === Konfetti === */
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(120vh) rotate(720deg); opacity: 0; }
}
.confetti-piece {
  position: fixed;
  top: -10vh;
  z-index: 200;
  pointer-events: none;
  border-radius: 3px;
  animation: confetti-fall linear forwards;
}

/* === Banner-Row (Streak + Tägliche Aufgabe) === */
.banner-row {
  display: flex;
  gap: 10px;
  padding: 8px 16px 0;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}
.banner-card {
  flex: 1;
  /* min-width:0 ist Pflicht: Flex-Items schrumpfen sonst nicht unter ihre
     Textbreite (min-width:auto) – auf 360-px-Handys lief die 3. Karte sonst
     aus dem Bild. */
  min-width: 0;
  background: var(--c-card);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--c-shadow);
  font-weight: 700;
  cursor: pointer;
}
.banner-card:active { transform: scale(0.97); }
.banner-card.streak { border-left: 4px solid #ff5722; }
.banner-card.daily  { border-left: 4px solid #2196f3; }
.banner-card .banner-icon { font-size: 24px; }
/* kein overflow-wrap:anywhere – das zerhackte Wörter mitten drin („Tagesau|fgabe").
   Die Labels sind stattdessen kurz gehalten, damit sie in ein Drittel von 360 px passen. */
.banner-card .banner-text { font-size: 14px; line-height: 1.2; min-width: 0; }
.banner-card .banner-text small { display: block; font-weight: 500; color: var(--c-muted); font-size: 11px; }

/* === Hint-Button === */
.hint-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff3cd;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--c-shadow);
}
.hint-btn:disabled { opacity: 0.4; background: #eee; cursor: not-allowed; }
/* 5 Kinder im Header: Zurück · Fortschrittsbalken · Label · Hilfe · Lautsprecher.
   Mit nur 4 Spalten rutschte der Lautsprecher in eine 2. Zeile und das Label
   wurde vom Hilfe-Button abgeschnitten („P1 · 1/10" → „P1 · 1/1"). */
.play-header { grid-template-columns: 56px 1fr auto 48px 48px; gap: 8px; }

/* Hint hides option */
.option-btn.hint-hidden { opacity: 0.15; pointer-events: none; transform: scale(0.92); }

/* === Result-Buttons (nur Welt + Replay, Auto-Weiter übernimmt) === */
.result-buttons { grid-template-columns: 1fr 1fr; gap: 10px; }
.result-buttons .big-btn { padding: 14px 6px; font-size: 18px; }

/* === Abzeichen-Grid === */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.badge-tile {
  background: linear-gradient(135deg, #fdf2f8, #fbcfe8);
  border-radius: 12px;
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  box-shadow: var(--c-shadow);
}
.badge-tile .badge-icon { font-size: 28px; display: block; line-height: 1; }
.badge-empty {
  color: var(--c-muted);
  font-style: italic;
  text-align: center;
  padding: 12px 0;
  grid-column: span 4;
}

/* === Button-Tap Effect === */
.option-btn { transition: transform 0.12s, box-shadow 0.12s; }
.option-btn:active { transform: scale(0.92); box-shadow: var(--c-shadow); }
.option-btn.correct { animation: pop-correct 0.4s ease-out; }
@keyframes pop-correct {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.option-btn.wrong { animation: shake 0.4s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* === View-Transitions === */
.view { transition: opacity 0.2s; }
.view:not(.active) { opacity: 0; }
.view.active { opacity: 1; }

/* === Result-Mascot animiert === */
.result-mascot { animation: result-bounce 0.6s ease-out; }
@keyframes result-bounce {
  0% { transform: scale(0) rotate(-180deg); }
  60% { transform: scale(1.2) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}

/* === Result-Stars staggered === */
.result-stars { display: inline-block; }

/* === Footer mit Abzeichen-Summary === */
.home-footer { display: flex; justify-content: center; gap: 16px; align-items: center; }

/* === Maler-Höhle Canvas === */
.dots-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.dots-hint {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-primary-dark);
  text-align: center;
}
.dots-canvas {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--c-shadow);
  touch-action: none;
}

/* === Schreib-Aufgaben (Typ „tippen" / „satz-sortieren") ============== */
/* Lückensatz: die Lücke ist ein eigenes Element, damit sie auch auf kleinen
   Displays sichtbar bleibt (nackte Unterstriche verschwinden optisch). */
.anchor-sentence {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--c-text);
  text-align: center;
  padding: 4px 2px;
  overflow-wrap: break-word;
  min-width: 0;
}
.anchor-sentence .gap {
  display: inline-block;
  min-width: 68px;
  border-bottom: 3px solid var(--c-primary);
  vertical-align: baseline;
  margin: 0 3px;
}
.anchor-sentence .gap.filled {
  border-bottom-color: var(--c-primary-dark);
  color: var(--c-primary-dark);
  font-weight: 800;
}

/* --- Tastatur-Eingabe --- */
.type-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 16px 16px;
  width: 100%;
  min-width: 0;
}
.type-input {
  width: 100%;
  max-width: 340px;
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 1px;
  padding: 12px 10px;
  border: 3px solid var(--c-primary);
  border-radius: 14px;
  background: var(--c-card);
  color: var(--c-text);
  /* body hat user-select:none – für das Eingabefeld zurücknehmen,
     sonst lässt sich auf iOS/Android nicht markieren/korrigieren. */
  user-select: text;
  -webkit-user-select: text;
}
.type-input:focus { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.type-input.correct { border-color: #4caf50; background: #e8f5e9; }
.type-input.wrong { animation: shake 0.4s ease-in-out; border-color: var(--c-danger); }
.type-check { width: 100%; max-width: 340px; }
.type-feedback { font-size: 16px; min-height: 26px; text-align: center; }
.type-feedback.hint { color: var(--c-primary-dark); }
.type-feedback.ok { color: #2e7d32; font-weight: 700; font-size: 22px; }
.type-feedback.bad { color: var(--c-danger); }
.type-compare {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
  word-break: break-all;
}
.type-compare .ok { color: #2e7d32; }
.type-compare .bad { color: var(--c-danger); text-decoration: underline wavy; }
.type-solution { font-size: 17px; color: var(--c-text); margin-top: 6px; }

/* --- Satz/Wort sortieren --- */
.sort-slot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 62px;
  margin: 0 16px 10px;
  padding: 8px;
  border: 3px dashed var(--c-primary);
  border-radius: 14px;
  background: rgba(255,255,255,0.6);
}
.sort-slot.letters { letter-spacing: 1px; }
.sort-slot.correct { border-style: solid; border-color: #4caf50; background: #e8f5e9; }
.sort-slot.wrong { animation: shake 0.4s ease-in-out; border-color: var(--c-danger); }
.sort-pool {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0 16px 16px;
}
.sort-chip {
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  padding: 10px 14px;
  min-height: 48px;
  border-radius: 12px;
  background: var(--c-card);
  color: var(--c-text);
  border: 2px solid var(--c-primary);
  box-shadow: var(--c-shadow);
  transition: transform 0.12s;
}
.sort-chip:active { transform: scale(0.94); }
.sort-chip.placed { background: #ede7ff; border-style: solid; box-shadow: none; }
.sort-pool.letters .sort-chip { min-width: 48px; text-align: center; }
/* Anlaut-Aufgaben zeigen kein geschriebenes Wort – Hinweis, dass der Anker hörbar ist */
.anchor-hint-only { font-size: 14px; color: var(--c-primary-dark); opacity: 0.85; }


.stats-chart { display: flex; align-items: flex-end; gap: 4px; height: 96px; padding: 20px 0 22px; }
.stats-bar { flex: 1; background: var(--line); border-radius: 4px 4px 0 0; min-height: 3px; position: relative; }
.stats-bar.has { background: var(--primary); }
/* Wert über dem Balken, Wochentag darunter – beide absolut, sonst schiebt der
   Text den Balken auseinander und klebt mitten in der Säule. */
.stats-bar .stat-value { position: absolute; bottom: 100%; left: -2px; right: -2px; text-align: center;
  font-size: 11px; font-weight: 700; color: var(--ink-soft); margin-bottom: 3px; }
.stats-bar .stat-label { position: absolute; top: 100%; left: -2px; right: -2px; text-align: center;
  font-size: 10px; color: var(--ink-soft); margin-top: 4px; }
.stats-bar.today { outline: 2px solid var(--gold); outline-offset: 1px; }
.stats-note { font-size: 13px; color: var(--ink-soft); margin: 14px 0 0; }

/* Kennzahlen sitzen oben bei den Kacheln statt als Fußzeile unter allem. */
.home-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px;
  margin: 2px 0 14px; padding: 10px 12px; background: #fff; border-radius: 14px;
  font-size: 15px; font-weight: 600; color: var(--ink-soft); }

.topic-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; }
.topic-row .name { flex: 1; }
.topic-row .quote { font-weight: 700; }
.topic-row .quote.low { color: var(--bad); }
.topic-row .quote.mid { color: var(--gold); }
