/* Rechnen mit Köpfchen Web — Grundlayout nach iOS-Vorbild (erzwungener Light Mode).
   Übernommen aus Rechenfeld-Web; Nav-/Stack-/Toolbar-/Sheet-Regeln unten stammen noch aus
   der Kopie und greifen erst wieder, wenn spätere Tasks die entsprechenden Screens bauen
   (aktuell ohne Wirkung, da index.html nur den Screen-Router + Portrait-Overlay enthält). */

@font-face {
  font-family: 'Grundschrift';
  src: url('Grundschrift-Regular.otf') format('opentype');
  font-display: swap;
}

@font-face {
  font-family: 'Grundschrift';
  font-weight: bold;
  src: url('Grundschrift-Bold.otf') format('opentype');
  font-display: swap;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fff;
  color: #000;
  color-scheme: light; /* erzwungener Light Mode wie iOS */
}

body {
  display: flex;
  flex-direction: column;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Navigationsleiste ---------- */
#navbar {
  flex: 0 0 auto;
  min-height: 48px;
  background: #000;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  padding-top: env(safe-area-inset-top, 0);
  z-index: 40;
}
#navbar.hidden { display: none; }
#navTitle { font-size: 17px; font-weight: 600; }
.nav-group { display: flex; gap: 4px; }

/* Reveal-Button für die Navigationsleiste (Web-Ersatz für iOS-Systemeinstellungen).
   Runde Matheforscher-Reveal-Optik, aber oben rechts: dort ist bei ausgeblendeter Navbar
   frei, während unten rechts die Aktions-Buttons + Fuß-Werkzeugleiste sitzen. */
#navReveal {
  position: fixed; right: 10px; z-index: 45;
  top: calc(8px + env(safe-area-inset-top, 0));
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid rgba(0,0,0,0.2);
  background: rgba(255,255,255,0.85); color: #333;
  font-size: 18px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: background 0.2s;
}
#navReveal:hover { background: #fff; }
#navReveal.hidden { display: none; }
.nav-btn {
  width: 42px; height: 42px;
  background: none; border: none; color: #fff;
  display: grid; place-items: center;
  cursor: pointer; border-radius: 8px;
}
.nav-btn:active { background: rgba(255,255,255,0.2); }
.nav-btn svg { width: 24px; height: 24px; fill: currentColor; }
.nav-btn.recording { color: rgb(255,135,135); }

/* ---------- Darstellungs-Stack ---------- */
#stack {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 20px 8px;
  min-height: 0;
  overflow: hidden;
}
.collapsible {
  flex: 0 0 auto;
  overflow: hidden;
  position: relative;
  transition: height 0.5s, flex-basis 0.5s, opacity 0.5s;
}
.collapsible.versteckt { display: none; }
.feld-flex { flex: 1 1 0; min-height: 0; }

/* Storyboard-Höhen des vertikalen Stacks (schrumpfen bei knapper Höhe mit) */
#sachrechnenView { flex: 0 1 100px; min-height: 56px; }
#rechenlinieView { flex: 0 1 180px; min-height: 120px; }
#actionCollectionView { flex: 0 1 200px; min-height: 110px; }
#aufgabenfamilieView { flex: 0 1 120px; min-height: 64px; }
#aufgabenView { flex: 0 1 200px; min-height: 110px; }
#actionViewContainer { flex: 0 1 150px; min-height: 84px; }

/* Sachaufgabe */
.sach-zeile { display: flex; align-items: stretch; gap: 8px; height: 100%; }
#sachaufgabenLabel {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-size: clamp(16px, 2.6vmin, 28px);
  background: #F2F2F2;
  border-radius: 8px;
  padding: 6px 14px;
  transition: opacity 0.5s;
  cursor: pointer;
}
#nextSachaufgabenButton {
  flex: 0 0 45px;
  border: none; border-radius: 8px;
  background: #0a7bff; color: #fff;
  opacity: 0.6;
  cursor: pointer;
  display: grid; place-items: center;
}
#nextSachaufgabenButton svg { width: 26px; height: 26px; fill: currentColor; }

/* Aufgabenfamilie */
#aufgabenfamilieLabel {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  white-space: pre;
  font-size: clamp(20px, 4.4vmin, 45px);
  background: #F2F2F2;
  border-radius: 8px;
}
.familie-inner { white-space: pre; text-align: center; line-height: 1.45; }

/* Rechenaufgabe (Rechenterm + Soundknopf) */
.aufgaben-zeile { display: flex; align-items: center; height: 100%; gap: 4px; }
#rechentermContainer { flex: 1; height: 100%; min-width: 0; }
#btnSound {
  flex: 0 0 38px; height: 38px;
  align-self: center;
  border: none; background: none; cursor: pointer; opacity: 0.5;
}
#btnSound img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Toolbar ---------- */
#toolbar {
  flex: 0 0 auto;
  background: #000;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 40;
}
.toolbar-inner {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 3px 20px;
}
.tb-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; color: #fff;
  font-size: 15px;
  height: 40px;
  min-width: 44px;
  cursor: pointer;
  border-radius: 8px;
  justify-content: center;
}
.tb-btn:active { background: rgba(255,255,255,0.2); }
.tb-btn img { height: 28px; max-width: 52px; object-fit: contain; filter: invert(1); }
.tb-icon img { height: 30px; }
#btnBlitzblick.selected { background: rgba(255,255,255,0.32); }

.segmented {
  display: flex;
  background: rgba(255,255,255,0.52);
  border-radius: 7px;
  padding: 2px;
  height: 34px;
}
.segmented button {
  border: none; background: transparent;
  border-radius: 5px;
  width: 36px;
  display: grid; place-items: center;
  cursor: pointer;
}
.segmented button img { height: 22px; }
.segmented button.selected { background: #fff; }

.tb-farben { display: flex; gap: 10px; }
.color-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: pointer;
}

/* ---------- Menüs & Popover ---------- */
.menu, .popover {
  position: fixed;
  z-index: 60;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  padding: 6px;
}
.hidden { display: none !important; }
.menu .menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 14px;
  border: none; background: none;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.menu .menu-item:hover { background: #eee; }
.menu .menu-item img { height: 22px; width: 44px; object-fit: contain; }
.menu .menu-item .check { width: 18px; }
.menu .menu-item:disabled { opacity: 0.35; cursor: default; }

/* Teilen-Popover */
#sharePopover.share { width: min(94vw, 340px); padding: 12px; color: #333; }
.share-toggle { display: flex; gap: 4px; margin-bottom: 10px; }
.share-toggle button {
  flex: 1; padding: 6px 4px;
  font: inherit; font-size: 13px;
  border: 1px solid #ccc; border-radius: 7px;
  background: #f4f4f4; color: #333; cursor: pointer;
}
.share-toggle button.selected { background: #1A4766; border-color: #1A4766; color: #fff; }
.share-row { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.share-url {
  flex: 1; min-width: 0;
  font: inherit; font-size: 12px;
  padding: 7px 8px;
  border: 1px solid #ccc; border-radius: 7px;
  background: #fff; color: #333;
}
.share-copy {
  flex: 0 0 auto; padding: 7px 12px;
  font: inherit; font-size: 13px;
  border: none; border-radius: 7px;
  background: #1A4766; color: #fff; cursor: pointer;
  white-space: nowrap;
}
.share-qr { width: min(82vw, 280px); height: min(82vw, 280px); margin: 6px auto 0; }
.share-qr svg { width: 100%; height: 100%; display: block; }
.share-hint { font-size: 11px; color: #888; text-align: center; margin-top: 8px; }

.popover.dark {
  background: #1c1c1e; color: #fff;
  padding: 20px;
  max-height: 70vh; overflow-y: auto;
  min-width: 300px;
}
.popover.dark h3 { font-size: 22px; margin-bottom: 14px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 8px 0;
  font-size: 16px;
}

/* iOS-artiger Switch */
.uiswitch {
  position: relative;
  width: 51px; height: 31px;
  flex: 0 0 51px;
  border-radius: 16px;
  border: none;
  background: rgba(120,120,128,0.32);
  cursor: pointer;
  transition: background 0.25s;
}
.uiswitch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  transition: transform 0.25s;
}
.uiswitch.on { background: #34c759; }
.uiswitch.on::after { transform: translateX(20px); }

/* ---------- Sheets & Alerts ---------- */
.sheet {
  position: fixed; inset: 0;
  z-index: 70;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
}
.sheet-card {
  background: #f2f2f7;
  border-radius: 14px;
  width: min(680px, 94vw);
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 8px;
}
.sheet-head h2 { font-size: 34px; font-weight: 700; }
.close-btn {
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: rgba(120,120,128,0.16);
  font-size: 16px;
  cursor: pointer;
}
#settingsBody { overflow-y: auto; padding: 0 20px 20px; }
.settings-section { margin-top: 18px; }
.settings-section > .section-title {
  font-size: 13px; color: #6d6d72;
  text-transform: uppercase;
  padding: 0 16px 6px;
}
.settings-group { background: #fff; border-radius: 10px; overflow: hidden; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  font-size: 16px;
  border-top: 0.5px solid rgba(60,60,67,0.29);
}
.settings-row:first-child { border-top: none; }
.settings-row .row-label { flex: 1; }
.settings-row input[type="range"] { flex: 1; }
.settings-info { font-size: 14px; line-height: 1.45; padding: 12px 16px; color: #333; }
.settings-info a { color: #0a7bff; }
.seg-textual { display: flex; background: rgba(120,120,128,0.16); border-radius: 8px; padding: 2px; flex-wrap: wrap; }
.seg-textual button {
  border: none; background: transparent;
  padding: 5px 10px; border-radius: 6px;
  font-size: 14px; cursor: pointer;
}
.seg-textual button.selected { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }

.alert-card {
  background: #f2f2f7;
  border-radius: 14px;
  width: min(320px, 88vw);
  padding: 20px;
  text-align: center;
}
.alert-card h3 { font-size: 17px; margin-bottom: 6px; }
.alert-card p { font-size: 14px; margin-bottom: 12px; }
.alert-card input {
  width: 100%;
  font-size: 20px;
  text-align: center;
  padding: 8px;
  border: 1px solid #ccc; border-radius: 8px;
  margin-bottom: 14px;
  background: #fff;
}
.alert-buttons { display: flex; gap: 10px; }
.alert-buttons button {
  flex: 1;
  padding: 10px;
  border: none; border-radius: 10px;
  background: #e5e5ea;
  font-size: 16px;
  cursor: pointer;
}
.alert-buttons .primary { background: #0a7bff; color: #fff; font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  #stack { padding: 4px 8px 6px; }
  .toolbar-inner { justify-content: center; padding: 3px 8px; }
  #navTitle { display: none; }
}
@media (max-height: 480px) {
  #navbar { min-height: 40px; }
  .nav-btn { width: 36px; height: 36px; }
}

/* Stellenwertmaterial (Dienes) */
#dienesView { position: relative; }
#dienesUmschalter {
  position: absolute; top: 8px; right: 10px; z-index: 2;
  height: 32px;
}
#dienesUmschalter button { width: 38px; }

/* ---------- App-Hülle (Screen-Router, js/app.js) ---------- */
#app {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.screen {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  font-family: 'Grundschrift', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.screen[hidden] { display: none; }
.screen h1 { font-size: clamp(22px, 4vmin, 40px); }
.screen .platzhalter { font-size: clamp(14px, 2.6vmin, 20px); color: #444; }

/* ---------- Wettrenn-Modus-Gerüst (js/modes/mode-framework.js, SPEC-CORE §5) ----------
   Die Route 'mode' baut hier das gemeinsame Gerüst: Spielfeld (Subklasse füllt), unten der
   RaceProgress-Streifen, dazu Overlays (checkButton §5.4, Köpfchen-Figur mit Sprechblasen-
   Anker für Task 22, Zurück-Button, Konfetti-Schicht §5.2). #screen-mode ist ein .screen —
   die Mode-Root füllt ihn voll (kein Zentrieren). */
#screen-mode { padding: 0; justify-content: stretch; align-items: stretch; }
.mode-root {
  position: relative;
  flex: 1 1 auto;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.mode-spielfeld {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
}
/* RaceProgress-Streifen unten (Rechenmaschine nutzt ihn oben — Subklasse ordnet um). */
.mode-race {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  height: clamp(84px, 14vmin, 120px);
  overflow: visible;
}
/* §8.1 / SPEC-CORE §5.1: Rechenmaschine (RechenmaschineMode._baueView setzt diese Klasse)
   zeigt den RaceProgress OBEN. .mode-root ist flex-column → order:-1 zieht den Streifen vor
   das Spielfeld, ohne die DOM-Reihenfolge (und damit den RaceProgress-Aufbau) zu ändern. */
.mode-root--race-oben .mode-race { order: -1; }
/* grüner checkButton (75×75, §5.4): weich ein-/ausblenden, transform/opacity only. */
.mode-check {
  position: absolute;
  top: 12px; right: 16px;
  width: 75px; height: 75px;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  z-index: 20;
}
.mode-check[hidden] { display: none; }
/* Köpfchen-Figur mit Sprechblasen-Anker (nur Gerüst; Task 22 = KI-Sprechblase). */
.koepfchen-figur {
  position: absolute;
  left: 12px; top: 12px;
  width: clamp(56px, 10vmin, 96px);
  pointer-events: none;
  z-index: 20;
}
.koepfchen-figur img { display: block; width: 100%; height: auto; }
.sprechblase {
  position: absolute;
  left: 100%; top: 0;
  margin-left: 10px;
  min-width: 140px; max-width: 40vw;
  padding: 10px 14px;
  background: #fff;
  border: 2px solid #68D7A1;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  font-size: clamp(14px, 2.2vmin, 20px);
  color: #222;
  pointer-events: auto;
}
.sprechblase[hidden] { display: none; }
/* Zurück-Button unten links (§1.3), 38×38-Asset. */
.mode-back {
  position: absolute;
  left: 12px; bottom: 12px;
  width: 44px; height: 44px;
  border: none; border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  display: grid; place-items: center;
  cursor: pointer;
  z-index: 25;
}
.mode-back img { width: 24px; height: 24px; }
.mode-back:active { filter: brightness(0.95); }
/* Konfetti-Schicht: volle Fläche, über allem, transparent fürs Antippen (§5.2). */
.mode-konfetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

/* ---------- Portrait-Overlay ("Bitte dreh dein Gerät quer!") ----------
   Landscape-only wie iOS (spec-koepfchen-core.md); im Hochformat verdeckt dieser
   Vollbild-Hinweis die gesamte App. */
#portraitOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  color: #fff;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-family: 'Grundschrift', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: clamp(18px, 5vmin, 32px);
}
@media (orientation: portrait) {
  #portraitOverlay { display: flex; }
}
#dienesUmschalter button svg { width: 26px; height: 26px; display: block; }

/* ================= Hauptmenü (js/menu.js: renderMenu) =================
   Optik nach spec-term-picker-actions §12 (MenuCell) + Gruppierung nach Design §6.1. */

/* Menü-Screen füllt den Bildschirm statt (wie die Platzhalter) mittig zu zentrieren. */
#screen-menu { padding: 0; gap: 0; align-items: stretch; justify-content: flex-start; }

.koepfchen-menu {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  text-align: left;
  font-family: 'Grundschrift', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- Kopfzeile: Maskottchen · Titel-Button · Fortschritt (SPEC-CORE §3.1) ---------- */
.menu-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px 0;
}
.menu-figur { width: 84px; height: 84px; object-fit: contain; flex: 0 0 auto; }
.menu-feld-btn {
  margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  background: #CCCCCC;               /* grau 0.8 wie iOS btnFeld */
  border: none; border-radius: 12px;
  padding: 10px 26px;
  font: inherit; font-size: clamp(22px, 3.6vmin, 40px); font-weight: 500;
  color: #222; cursor: pointer;
}
.menu-feld-btn:active { filter: brightness(0.95); }
.menu-feld-icon { width: 40px; height: 40px; object-fit: contain; }
.menu-fortschritt {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  background-repeat: no-repeat; background-position: center; background-size: contain;
  display: flex; align-items: center; justify-content: center;
  color: #1A3A5C; font-weight: bold; font-size: 22px;
}
.menu-fortschritt.versteckt { visibility: hidden; }

/* ---------- Spielemenü: horizontal scrollend, nach Gruppen (Design §6.1) ---------- */
.menu-scroller {
  flex: 1 1 auto;
  min-height: 0;
  display: flex; flex-direction: row; align-items: flex-start;
  gap: 40px;
  overflow-x: auto; overflow-y: hidden;
  padding: 6px 24px 16px;
  -webkit-overflow-scrolling: touch;
}
.menu-gruppe { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.menu-gruppe-titel {
  font-size: 18px; font-weight: bold; color: #555;
  padding-left: 4px; white-space: nowrap;
}
.menu-gruppe-kacheln { display: flex; flex-direction: row; gap: 30px; padding-top: 24px; }

/* ---------- Kachel (MenuCell §12) ---------- */
.menu-kachel {
  position: relative;
  flex: 0 0 auto;
  width: 200px; height: 290px;
  padding: 0; border: none;
  border-radius: 16px;
  background: rgb(205, 205, 205);   /* Basis-BG (§12) */
  overflow: visible;                /* Badge darf über die Ecke ragen */
  cursor: pointer;
}
.kachel-content {
  position: absolute; inset: 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--kachel-farbe, #CDCDCD);
  display: flex; flex-direction: column;
  padding: 10px;                    /* 10 px Rand ums Bild (§12) */
  gap: 6px;
  transition: opacity 0.3s;
}
.menu-kachel.gesperrt .kachel-content { opacity: 0.3; }   /* locked (§12) */
.menu-kachel.geloest .kachel-content { opacity: 0.7; }    /* solved (§12) */
.kachel-bild { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; }
.kachel-label {
  flex: 1 1 auto;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 18px; line-height: 1.15;
  overflow: hidden;
}
.kachel-sterne { flex: 0 0 auto; width: 100%; height: 25px; object-fit: contain; }
.kachel-badge {
  position: absolute;
  top: -20px; right: -20px;         /* zentriert auf (rechts−30, oben+30), 100×100 (§12) */
  width: 100px; height: 100px;
  object-fit: contain;
  pointer-events: none;
}

/* ---------- Fußzeile: Benutzerzeile + Einstellungen (SPEC-CORE §3.1/§3.4) ---------- */
.menu-footer {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 8px 20px 12px;
}
.menu-userbar { display: flex; align-items: center; gap: 10px; }
.menu-user-plus {
  display: flex; align-items: center; gap: 6px;
  background: #E0E0E0; border: none; border-radius: 10px;
  padding: 8px 14px; font: inherit; font-size: 16px; color: #222; cursor: pointer;
}
.menu-user-plus img { height: 22px; }
.menu-user-select {
  font: inherit; font-size: 16px;
  padding: 8px 12px; border-radius: 10px; border: 1px solid #ccc;
  background: #fff; color: #222; min-width: 120px; cursor: pointer;
}
.menu-user-trash {
  width: 40px; height: 40px;
  border: none; border-radius: 10px; background: #E0E0E0;
  cursor: pointer; display: grid; place-items: center;
}
.menu-user-trash img { height: 22px; }
.menu-settings-btn {
  background: rgba(204, 204, 204, 0.8);   /* grau 0.8, alpha 0.8 wie iOS */
  border: none; border-radius: 10px;
  padding: 12px 22px; font: inherit; font-size: 16px; color: #333; cursor: pointer;
}
.menu-settings-btn:active { filter: brightness(0.95); }
/* Forscherstreifen-Galerie-Knopf im Menü (Design §6.2.2) — passt sich der Fußzeile an. */
.menu-galerie-btn {
  background: rgba(204, 204, 204, 0.8);
  border: none; border-radius: 10px;
  padding: 12px 20px; font: inherit; font-size: 16px; color: #333; cursor: pointer;
}
.menu-galerie-btn:active { filter: brightness(0.95); }

/* ---------- Schloss-Shake (§0.6 / §3.3: 0,4 s Feder) ---------- */
@keyframes menu-shake {
  0%   { transform: translateX(20px); }
  15%  { transform: translateX(-15px); }
  30%  { transform: translateX(11px); }
  45%  { transform: translateX(-7px); }
  60%  { transform: translateX(4px); }
  75%  { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}
.menu-shake { animation: menu-shake 0.4s ease-in-out; }

/* ================= Einstellungs-Screen (js/settings-screen.js: renderSettings) =========
   Optik nach SPEC-CORE §7.1 (SettingsViewController) + Erwachsenen-Bereich (Design §4/§7.5).
   Reihen-/Gruppen-/Switch-Optik nutzt die generischen .settings-*-Klassen (oben, aus der
   Rechenfeld-Kopie). Der Screen füllt den Bildschirm und scrollt vertikal (Landscape). */
#screen-settings { padding: 0; gap: 0; align-items: stretch; justify-content: flex-start; }

.koepfchen-settings {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f2f2f7;
  text-align: left;
  font-family: 'Grundschrift', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.settings-header {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  padding-top: calc(10px + env(safe-area-inset-top, 0));
}
.settings-back {
  width: 40px; height: 40px; flex: 0 0 40px;
  border: none; border-radius: 50%;
  background: rgba(120,120,128,0.16);
  cursor: pointer; display: grid; place-items: center;
}
.settings-back svg { width: 24px; height: 24px; display: block; }
.settings-back:active { filter: brightness(0.94); }
.settings-title { font-size: clamp(22px, 3.2vmin, 34px); font-weight: 700; }

.settings-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 max(20px, env(safe-area-inset-left)) 32px;
}
/* Lesbare Spaltenbreite auf breiten Displays. */
.settings-body > .settings-section { max-width: 720px; margin-left: auto; margin-right: auto; }

.section-subtitle {
  font-size: 13px; color: #6d6d72; text-transform: uppercase;
  padding: 18px 16px 6px;
}

/* Zahlenraum-Stepper (− Wert +) */
.zr-stepper { display: flex; align-items: center; gap: 0; }
.zr-btn {
  width: 40px; height: 34px;
  border: none; background: rgba(120,120,128,0.16);
  font-size: 22px; line-height: 1; cursor: pointer; color: #111;
}
.zr-btn:first-child { border-radius: 8px 0 0 8px; }
.zr-btn:last-child { border-radius: 0 8px 8px 0; }
.zr-btn:disabled { opacity: 0.3; cursor: default; }
.zr-btn:not(:disabled):active { background: rgba(120,120,128,0.3); }
.zr-wert {
  min-width: 48px; text-align: center;
  font-size: 18px; font-weight: 600;
  padding: 0 6px;
}

/* Farb-Picker (spec-term-picker-actions §13.1) */
.settings-farben { display: flex; gap: 14px; }
.wscolor-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.35);
  cursor: pointer; padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.wscolor-btn:active { filter: brightness(0.95); }
.wscolor-backdrop { position: fixed; inset: 0; z-index: 80; }
.wscolor-popover {
  position: fixed;
  display: flex; gap: 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  padding: 8px;
}
.wscolor-swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.25);
  cursor: pointer; padding: 0;
  display: grid; place-items: center;
}
.wscolor-swatch.selected { border-width: 2px; }
.wscolor-swatch svg { width: 26px; height: 26px; display: block; }

/* Benutzerzeile */
.settings-userbar { display: flex; align-items: center; gap: 8px; }
.settings-user-select {
  font: inherit; font-size: 15px;
  padding: 6px 10px; border-radius: 8px; border: 1px solid #ccc;
  background: #fff; color: #222; min-width: 110px; cursor: pointer;
}
.settings-user-plus, .settings-user-trash {
  width: 36px; height: 36px;
  border: none; border-radius: 8px; background: rgba(120,120,128,0.16);
  cursor: pointer; display: grid; place-items: center;
}
.settings-user-plus img, .settings-user-trash img { height: 20px; }
.settings-user-plus:active, .settings-user-trash:active { filter: brightness(0.94); }

/* Erwachsenen-Bereich + Reflexions-Platzhalter */
.settings-adult .section-title { color: #8a3a3a; }
.settings-row.gedimmt { opacity: 0.4; }
.settings-reflexionen {
  background: #fff; border-radius: 10px;
  padding: 14px 16px; margin-top: 4px;
}
.settings-empty { font-size: 14px; line-height: 1.5; color: #6d6d72; }
.settings-reflexion-zeile {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-top: 0.5px solid rgba(60,60,67,0.2); font-size: 15px;
}
.settings-reflexion-zeile:first-child { border-top: none; padding-top: 0; }
.settings-reflexion-format { color: #333; font-weight: 600; }
.settings-reflexion-antwort { color: #444; font-variant-numeric: tabular-nums; }

/* Erststart-Führung (SPEC-CORE §3.6): läuft seit Task 9 über die echte
   OverlayView-Spotlight-Mechanik (js/overlay.js, Styles dort) — die frühere
   Modal-Karten-Optik (.menu-guide-*) ist entfallen. */

/* ---------- Freies Rechenfeld (js/modes/freifeld.js, SPEC-CORE §4) ----------
   Screen füllt den Bildschirm; das Innenlayout (Feld/Term/Buttons/Toolbar) stylt
   das Modul selbst (freifeld-style). */
#screen-freifeld { padding: 0; gap: 0; align-items: stretch; justify-content: flex-start; min-height: 0; }
