/* ==========================================================================
   Rechentablett 2.0 – virtuelles Arbeitsmittel zum Teile-Ganzes-Konzept
   Designsprache der App-Familie (Schüttelbox, Zerlegen): Hintergrund #E7EDEF,
   weiße Pillen-Knöpfe. Schrift: Avela Buch (Christian Urff, SIL OFL 1.1) für alle Texte,
   Grundschrift nur für Zahlen und Gleichungen (--zahlen-schrift), system-ui für reine
   Textlabels in Einstellungen. Ganzes blau, Teile rot (abschaltbar).
   ========================================================================== */

@font-face {
  font-family: 'Grundschrift';
  src: url('fonts/Grundschrift-Regular.otf') format('opentype');
  font-weight: normal;
}
@font-face {
  font-family: 'Grundschrift';
  src: url('fonts/Grundschrift-Bold.otf') format('opentype');
  font-weight: bold;
}
@font-face {
  font-family: 'Avela Buch';
  src: url('fonts/AvelaBuch-Regular.woff2') format('woff2');
  font-weight: normal;
}
@font-face {
  font-family: 'Avela Buch';
  src: url('fonts/AvelaBuch-SemiBold.woff2') format('woff2');
  font-weight: 600 700;
}

/* Bis 20 (höchstens zwei Ziffern) sind Gesamtzahl und Teilzahlen größer (Teilzahlen: messen()) */
body.zr-klein { --kopf-h: 96px; }
:root {
  --bg: #E7EDEF;
  --panel: #A7C4DA;          /* Rahmen des Tabletts */
  --panel-dunkel: #86A8C2;
  --ink: #1C2B45;
  --ink-leise: #5C6B80;
  --accent: #3E8E8E;
  --whole-blue: #2B5C8A;     /* das GANZE */
  --part-red: #9A3B3B;       /* die TEILE */
  --ok: #3E8E5A;
  --ok-bg: #E4F2E8;
  --cover: #33445E;          /* Klappen und Rolladen */
  --cover-hell: #3F5373;
  --btn-bg: #FFFFFF;
  --flaeche: #FBFCFD;        /* Legefläche */
  --trenner: #1C2B45;
  --chip: #2980B9;           /* Plättchen: flacher blauer Kreis mit schwarzem Rand wie im Original */
  --chip-rand: #111111;
  --streifen: #E6EFF7;       /* Füllung von Zehnerstreifen und Hunderterfeldern */
  --streifen-rand: #4F7499;
  --heft-linie: #C3CCD7;     /* Kästchenraster beim Zahl schreiben */
  --farbe-0: #D9483B;        /* „Seiten farbig“: Plättchen links / rechts (UI setzt die gewählten Farben) */
  --farbe-1: #2980B9;
  --farbe-0-text: #B83D32;
  --farbe-1-text: #2471A3;
  --shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  --zahlen-schrift: 'Grundschrift', system-ui, sans-serif;   /* Zahlen und Gleichungen */
  --text-schrift: 'Avela Buch', system-ui, -apple-system, sans-serif;
  --leiste-h: 56px;
  --kopf-h: 84px;
  --griff-h: 28px;
  --trenner-b: 14px;
  --gutter: 14px;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }   /* Safari: Querformat vergrößert keine Texte */
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text-schrift);
}
/* Knöpfe und Eingaben erben die Schrift nicht automatisch */
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#app {
  height: 100vh;
  height: -webkit-fill-available;   /* Safari vor iOS 15.4 */
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---- Knöpfe ------------------------------------------------------------ */
.round {
  width: var(--leiste-h);
  height: var(--leiste-h);
  border-radius: 50%;
  border: none;
  background: var(--btn-bg);
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: none;
}
.round.klein { width: 44px; height: 44px; }
/* Erwachsenen-Sperre: Einstellungen erst nach 3 Sekunden Halten; der Ring füllt sich dabei */
.round.halten { position: relative; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: none; }
.halte-ring { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); pointer-events: none; transform: rotate(-90deg); }
.halte-ring circle { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 170; stroke-dashoffset: 170; opacity: 0; }
.round.halten.haelt .halte-ring circle { opacity: 1; stroke-dashoffset: 0; transition: stroke-dashoffset var(--halte-ms, 3000ms) linear; }
.round.mini { width: 30px; height: 30px; }
.pill {
  height: var(--leiste-h);
  padding: 0 22px;
  border-radius: 999px;
  border: none;
  background: var(--btn-bg);
  box-shadow: var(--shadow);
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  flex: none;
}
.pill.klein { height: 44px; padding: 0 16px; font-size: 18px; font-family: system-ui, -apple-system, sans-serif; }
.pill.akzent, .round.akzent, .pill[aria-pressed="true"] { background: var(--accent); color: #fff; }
.round[disabled], .pill[disabled] { opacity: 0.38; cursor: default; box-shadow: none; }
/* Getippt, die Aktion beginnt gleich – sobald die Hand den Blick freigibt (HAND_WEG_MS). Bis dahin
   zieht ein Ring nach außen auf, der unter der Fingerkuppe hervorschaut. Gleich bei jedem Knopf. */
.kommt { animation: knopf-kommt var(--hand-weg-ms, 400ms) ease-out both; }
@keyframes knopf-kommt {
  from { box-shadow: 0 0 0 0 rgba(62, 142, 142, 0.75); }
  60% { box-shadow: 0 0 0 11px rgba(62, 142, 142, 0.45); }
  to { box-shadow: 0 0 0 15px rgba(62, 142, 142, 0.2); }
}
.bare { background: transparent; box-shadow: none; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button svg { display: block; flex: none; }
/* Grundschrift nur für Zahlen und Gleichungen; Zahlen im Fließtext umschließt die UI mit .ziffern */
.ziffern, .zahlkarte, .gleichungen, .stellen-info, .chip, .stepper .st-wert, .vm-taste, .vm-anzeige,
.vm-versuche, .vm-marke, .rad-ziffer, .sf-ziffer, .segment button b { font-family: var(--zahlen-schrift); }
/* Das „?“ der Grundschrift steht schief: Klappen und Rolladen nehmen die Textschrift */
.zahlkarte .klappe, .roll-frage { font-family: var(--text-schrift); }
/* Blitzblick: Auge rechts neben dem „?“ öffnet den Rolladen kurz (Einstellung blitzAuge, Dauer
   blitzMs). Das „?“ bleibt genau in der Mitte, damit ein Tipp dorthin weiter zum Zahlenfeld führt. */
.rolladen { --frage: min(92px, var(--frage-platz, 92px)); }   /* schmale Hälfte (iPhone): kleiner, Auge bleibt im Bild */
.roll-auge {
  display: none;
  position: absolute;
  left: calc(50% + var(--frage) * 0.78);
  top: calc(50% - var(--frage) / 2);
  width: var(--frage);
  height: var(--frage);
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: manipulation;
}
.roll-auge svg { width: 52%; height: 52%; }
body.mit-auge .roll-auge { display: inline-flex; }
.segment.einzug { margin: -4px 0 10px 52px; flex-wrap: wrap; }
#fk-blitz { display: inline-flex; align-items: center; gap: 6px; }
#fk-blitz[hidden] { display: none; }

/* ---- Werkzeugleiste ------------------------------------------------------ */
#leiste {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px var(--gutter) 6px;
  flex: none;
}
.leiste-links { justify-self: start; display: flex; gap: 10px; }
.leiste-mitte { display: flex; gap: 10px; align-items: center; }
.leiste-rechts { justify-self: end; display: flex; gap: 10px; }
body.urff-shell #leiste { padding-right: 290px; }
body.native-app #btn-vollbild, body.kein-vollbild #btn-vollbild { display: none; }
body:not(.mit-vorlesen) #btn-vorlesen { display: none; }
/* Wenige Knöpfe (reizarm): ohne Rechnungen, Ordnen nur ohne Automatik */
body:not(.mit-rechnungen-knopf) #btn-rechnungen { display: none; }
body:not(.mit-ordnen-knopf) #btn-ordnen { display: none; }
body:not(.mit-wuerfeln) #btn-wuerfeln { display: none; }
body:not(.mit-ueberraschung) #btn-ueberraschung { display: none; }
body:not(.mit-einfuehrung) #btn-einfuehrung { display: none; }
/* Papierkorb: leicht rot und mit Abstand zu den Nachbarn, damit er nicht versehentlich erwischt wird */
#btn-leeren { color: #B23A33; margin: 0 8px; }
body.klassisch .kopf-knoepfe > #btn-leeren:not(.zurueckholen) { background: rgba(217, 72, 59, 0.1); color: #B23A33; }
body.klassisch .kopf-knoepfe > #btn-leeren { margin: 0 10px 0 4px; }
#mehr-liste #btn-leeren { margin: 6px 0 0; }
body:not(.mit-rueckgaengig) #btn-rueckgaengig { display: none; }
#btn-leeren .ico-zurueck { display: none; }
#btn-leeren.zurueckholen .ico-leeren { display: none; }
#btn-leeren.zurueckholen .ico-zurueck { display: block; }
#btn-leeren.zurueckholen { background: var(--accent); color: #fff; }
#btn-rechnungen { padding: 0 18px; font-size: 24px; }
/* Die Ziffern der Grundschrift stehen in ihrer Zeile zu hoch (vgl. .zahlkarte .ziffer); im iPad-Simulator
   gemessen 2,25 px bei 24 px (Chrome rundet auf ganze Pixel und zeigt 1,5 px) */
#btn-rechnungen .ziffern { position: relative; top: 0.09em; }
/* Ordnen: lange drücken schaltet „automatisch anordnen“; dann eingefärbt mit Kreislauf-Marke */
#btn-ordnen { position: relative; }
#btn-ordnen[aria-pressed="true"] { background: var(--accent); color: #fff; }
#btn-ordnen .auto-marke {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  display: none;
  align-items: center;
  justify-content: center;
}
#btn-ordnen[aria-pressed="true"] .auto-marke { display: flex; }
#btn-ordnen .auto-marke svg { transform: none; }

/* ---- Hauptbereich -------------------------------------------------------- */
#haupt {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: var(--gutter);
  padding: 0 var(--gutter) var(--gutter);
}
#arbeitsflaeche {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---- Kopf: Gesamtzahl und Rechnungen ------------------------------------ */
#kopf {
  height: var(--kopf-h);
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
}
.gleichungen {
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: clamp(18px, 2.9vw, 38px);
  line-height: 1.1;
  color: var(--ink-leise);
  white-space: nowrap;
  overflow: hidden;
  padding-top: 6px;
}
body.familie .gleichungen { font-size: clamp(15px, 2.2vw, 28px); }
#gl-plus { text-align: right; padding-right: 18px; align-items: flex-end; }
#gl-minus { text-align: left; padding-left: 18px; align-items: flex-start; }
.gleichung { display: inline-flex; gap: 0.28em; align-items: baseline; }
.gleichung .kaestchen {
  display: inline-block;
  width: 0.9em;
  height: 0.95em;
  border: 2px solid currentColor;
  border-radius: 0.12em;
  transform: translateY(0.12em);
}
body.farben .gleichung .ganzes { color: var(--whole-blue); }
body.farben .gleichung .teil { color: var(--part-red); }
.gleichungen.aus { visibility: hidden; }
/* Rechnungen per Knopf: sanft ein- und ausblenden */
.gleichungen.erscheint { animation: auftauchen 600ms ease-out both; }
.gleichungen.vergeht { opacity: 0; transition: opacity 450ms ease; }

/* ---- Zahlkarten ---------------------------------------------------------- */
.zahlkarte {
  position: relative;
  border: none;
  background: #fff;
  color: var(--ink);
  overflow: hidden;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.zahlkarte .ziffer { position: relative; top: 0.05em; }
body.farben .zahlkarte.ganzes { color: var(--whole-blue); }
body.farben .zahlkarte.teil { color: var(--part-red); }
.zahlkarte .klappe {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, var(--cover-hell) 0 9px, var(--cover) 9px 11px);
  color: #fff;
  font-size: 0.7em;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-102%);
  transition: transform 260ms ease;
}
.zahlkarte.zu .klappe { transform: translateY(0); }
#zahl-ganzes {
  min-width: 132px;
  height: calc(var(--kopf-h) - 6px);
  font-size: calc(var(--kopf-h) * 0.76);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -2px 0 2px var(--panel) inset, 0 -3px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: -1px;
  z-index: 1;
}
#zahl-ganzes .klappe { border-radius: 20px 20px 0 0; }
#zahl-ganzes .schloss {
  position: absolute;
  top: 7px;
  right: 9px;
  color: var(--ink-leise);
  display: none;
}
body.fest #zahl-ganzes .schloss { display: block; }
body.fest #zahl-ganzes { padding: 0 30px; }
.zahlkarte.wackeln, .vorrat-quelle.wackeln { animation: wackeln 420ms ease; }
@keyframes wackeln {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.zahlkarte.leuchten { animation: leuchten 1100ms ease; }
@keyframes leuchten {
  0%, 100% { box-shadow: 0 0 0 0 rgba(43, 92, 138, 0); }
  30% { box-shadow: 0 0 0 6px rgba(43, 92, 138, 0.35); }   /* Blau des Ganzen, kein Grün */
}
/* Würfeln: Die neue Gesamtzahl kommt zuerst – die Karte färbt sich kurz im hellen Blau des Ganzen,
   die Zahl blendet auf; erst danach kommen die Teile unter ihr hervor (GANZES_ZUERST_MS). Anders als
   .leuchten (Auftrag fertig): Fläche statt Ring. */
#zahl-ganzes.hervor { animation: ganzes-hervor 1100ms ease; }
#zahl-ganzes.hervor .ziffer { animation: auftauchen 350ms ease-out; }
@keyframes ganzes-hervor {
  0%, 100% { background-color: #fff; }
  20%, 55% { background-color: #DCE6EF; }
}

/* ---- Tablett ------------------------------------------------------------- */
#tablett {
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 0;                 /* eigener Stapelkontext: Steine, Klappen, Rolladen */
  display: grid;
  grid-template-columns: 1fr var(--trenner-b) 1fr;
  background: var(--panel);
  border-radius: 24px;
  padding: 10px;
  box-shadow: 0 6px 18px rgba(28, 43, 69, 0.12);
  touch-action: none;
}
.haelfte {
  position: relative;          /* KEIN z-index: Kinder teilen den Stapelkontext des Tabletts */
  background: var(--flaeche);
  box-shadow: inset 0 2px 6px rgba(28, 43, 69, 0.08);
  overflow: hidden;
}
#haelfte-0 { border-radius: 16px 0 0 16px; }
#haelfte-1 { border-radius: 0 16px 16px 0; }
#trenner {
  position: relative;
  background: var(--trenner);
}
#btn-tauschen {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 2400;
  color: var(--ink);
}
body:not(.mit-tauschen) #btn-tauschen { display: none; }

.griff {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--griff-h);
  border: none;
  padding: 0;
  z-index: 2300;
  background: repeating-linear-gradient(180deg, #C9D5DF 0 6px, #B6C5D2 6px 7px);
  border-bottom: 2px solid #9DB0C0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.griff-knauf {
  width: 64px;
  height: 10px;
  border-radius: 6px;
  background: var(--cover);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.haelfte.zu .griff { background: var(--cover); border-bottom-color: var(--cover); }
.haelfte.zu .griff-knauf { background: #E7EDEF; }

.zahlkarte.teil {
  position: absolute;
  top: calc(var(--griff-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2100;
  min-width: 96px;
  height: var(--zahl-h, 66px);
  font-size: calc(var(--zahl-h, 66px) * 0.84);
  border-radius: 16px;
  box-shadow: 0 2px 6px rgba(28, 43, 69, 0.14);
}
.zahlkarte.teil.wackeln { animation: wackeln-mitte 420ms ease; }
@keyframes wackeln-mitte {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translateX(calc(-50% - 6px)); }
  60% { transform: translateX(calc(-50% + 5px)); }
}
.stellen-info {
  position: absolute;
  top: calc(var(--griff-h) + 8px + var(--zahl-h, 66px) + 4px);
  left: 0;
  right: 0;
  text-align: center;
  z-index: 2100;
  font-size: 19px;
  color: var(--ink-leise);
  pointer-events: none;
  display: flex;
  justify-content: center;
  gap: 1em;                        /* deutliche Lücke zwischen den Stellen */
}
.sw-stelle { white-space: nowrap; }
.sw-name { margin-left: 0.24em; }
body:not(.sw) .stellen-info, body:not(.stellen-zeigen) .stellen-info { display: none; }

.rolladen {
  position: absolute;
  inset: 0;
  z-index: 2200;
  background: repeating-linear-gradient(180deg, var(--cover-hell) 0 22px, var(--cover) 22px 25px);
  clip-path: inset(0 0 100% 0);
  transition: clip-path 420ms cubic-bezier(.4, .1, .2, 1);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.haelfte.zu .rolladen { clip-path: inset(0 0 0 0); pointer-events: auto; }
.roll-frage {
  width: var(--frage);
  height: var(--frage);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: calc(var(--frage) * 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Bühne und Steine ---------------------------------------------------- */
#buehne {
  position: absolute;
  inset: 0;
  pointer-events: none;        /* Treffer werden geometrisch bestimmt */
  /* kein z-index, kein transform: Steine teilen den Stapelkontext des Tabletts */
}
.stein {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  will-change: transform;
  transition: transform 380ms cubic-bezier(.3, .7, .3, 1), width 300ms ease, height 300ms ease, opacity 300ms ease;
}
/* Würfeln: Die Teile kommen unter der Gesamtzahl hervor und wandern an ihren Platz – sanft
   anfahren, damit man sieht, woher sie kommen. Steht vor .zieht: Ein gegriffener Stein folgt
   sofort dem Finger. */
.stein.ausschuetten { transition: transform 640ms cubic-bezier(.45, 0, .25, 1), width 300ms ease, height 300ms ease, opacity 120ms ease; }
/* Gesamtzahl aufgedeckt: Beide Teile rücken an der Trennwand zusammen, die Wand tritt zurück.
   Steht ebenfalls vor .zieht. */
.stein.zusammen { transition: transform 520ms cubic-bezier(.4, 0, .2, 1), width 300ms ease, height 300ms ease; }
/* Nach einem Knopf (Überraschung, Ordnen, Rückgängig): langsamer, damit man der Veränderung folgen
   kann, sobald die Hand den Blick freigibt (LANGSAM_MS). Steht ebenfalls vor .zieht. */
.stein.langsam { transition: transform 850ms cubic-bezier(.4, 0, .2, 1), width 300ms ease, height 300ms ease, opacity 300ms ease; }
.stein.zieht, .stein.ohne-animation { transition: width 300ms ease, height 300ms ease; }
#trenner { transition: opacity 420ms ease; }
#tablett.zusammen #trenner { opacity: 0.22; }
/* Ein Plättchen ist ein flacher Kreis mit Rand – ohne Verlauf, ohne Schatten (wie im Original).
   Nur in der Hand hebt ein Schatten es sichtbar ab. */
.stein.e {
  --ring: calc(var(--d, 60px) * 0.06);
  width: var(--d, 60px);
  height: var(--d, 60px);
  border-radius: 50%;
  background: var(--chip);
  box-shadow: inset 0 0 0 var(--ring) var(--chip-rand);
}
/* Einer in Stellenwert-Größe: genau so groß wie die Punkte im Zehnerstreifen (rt-punkt) */
body.sw .stein.e { --ring: calc(var(--u, 40px) * 0.055); width: calc(var(--u, 40px) * 0.74); height: calc(var(--u, 40px) * 0.74); }
.stein.z { width: calc(var(--u, 40px) * 10.3); height: var(--u, 40px); }
.stein.h { width: calc(var(--u, 40px) * 10.3); height: calc(var(--u, 40px) * 10.3); }
.stein svg { width: 100%; height: 100%; display: block; overflow: visible; }
.stein.zieht { filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25)); }
/* In der Hand über Zahlkarten und geschlossenem Rolladen (2200): Ein Stein lässt sich sichtbar auf
   den Rolladen legen und verschwindet erst beim Loslassen darunter. Griff und Tausch-Knopf bleiben oben. */
#buehne .stein.zieht { z-index: 2250 !important; }
.stein.e.zieht { filter: none; box-shadow: inset 0 0 0 var(--ring) var(--chip-rand), 0 8px 12px rgba(0, 0, 0, 0.28); }
.stein.weg { opacity: 0; }
.stein.neu { animation: auftauchen 260ms ease; }
/* Gezeichnet: Plättchen wachsen entlang des Strichs auf. Größe statt scale animieren: scale
   wirkt vor der Verschiebung und ließe sie aus der Ecke hereinfliegen; translate(-50%,-50%)
   hält sie beim Wachsen in der Mitte. */
.stein.gezeichnet { animation: aufploppen 300ms ease-out both; }
@keyframes aufploppen {
  from { opacity: 0; width: 0; height: 0; }
}
@keyframes auftauchen {
  from { opacity: 0; }
  to { opacity: 1; }
}
.stein.markiert { filter: drop-shadow(0 0 5px rgba(229, 185, 63, 0.95)); }
.stein.e.markiert { filter: none; box-shadow: inset 0 0 0 var(--ring) var(--chip-rand), 0 0 0 4px rgba(229, 185, 63, 0.85); }
body.sw .stein.e.markiert { box-shadow: inset 0 0 0 var(--ring) var(--chip-rand), 0 0 0 3px rgba(229, 185, 63, 0.85); }
/* Spur: Wo ein Teil weggeht, bleibt sein Umriss so lange stehen, wie die Bewegung dauert – dann ist
   er weg (keine Markierung, die stehen bleibt). Unter allen Steinen und unter dem Rolladen. */
.stein.spur { transition: none; animation: spur-vergeht 850ms ease-in both; }
.stein.e.spur { background: transparent; }
.stein.spur .rahmen { fill: none; }
.stein.spur .punkte { display: none; }
@keyframes spur-vergeht {
  from { opacity: 0.6; }
  to { opacity: 0; }
}
/* Weggehen nach einem Knopf: Das Plättchen verblasst zum Umriss, dann verschwindet es */
.stein.vergeht { animation: vergehen 900ms ease-in both; }
.stein.e.vergeht { animation-name: vergehen-e; }
@keyframes vergehen {
  to { opacity: 0; }
}
@keyframes vergehen-e {
  50% { opacity: 1; background-color: transparent; }
  to { opacity: 0; background-color: transparent; }
}
/* Rückgängig: Was zurückkommt, taucht langsam auf; „Überraschung: kommt dazu“ wächst langsamer */
.stein.taucht-auf { animation: auftauchen 850ms ease-out both; }
.stein.gezeichnet.langsam { animation-duration: 650ms; }

/* Zehnerstreifen und Hunderterfelder: Rahmen um Plättchen-Punkte */
.rahmen { fill: var(--streifen); stroke: var(--streifen-rand); }
.punkte { fill: url(#rt-punkt); }
/* Bündeln: der Rahmen legt sich sichtbar um die zusammengerückten Plättchen */
.stein.z.entsteht .rahmen { animation: rahmen-z 560ms ease-out both; }
.stein.h.entsteht .rahmen { animation: rahmen-h 680ms ease-out both; }
@keyframes rahmen-z {
  from { stroke-dasharray: 23; stroke-dashoffset: 23; fill-opacity: 0; }
  65% { fill-opacity: 0; }
  to { stroke-dasharray: 23; stroke-dashoffset: 0; fill-opacity: 1; }
}
@keyframes rahmen-h {
  from { stroke-dasharray: 42; stroke-dashoffset: 42; fill-opacity: 0; }
  65% { fill-opacity: 0; }
  to { stroke-dasharray: 42; stroke-dashoffset: 0; fill-opacity: 1; }
}
/* Entbündeln: nur der Rahmen bleibt kurz stehen und löst sich auf */
.stein.geist { transition: none; z-index: 1; }
.stein.z.geist .rahmen { animation: rahmen-z 360ms ease-in reverse both; }
.stein.h.geist .rahmen { animation: rahmen-h 420ms ease-in reverse both; }

/* Seiten farbig: Farbe der Seite, auf der ein Plättchen liegt (beim Ziehen: wo es landen würde) */
body.seitenfarben .stein.e.s0 { background: var(--farbe-0); }
body.seitenfarben .stein.e.s1 { background: var(--farbe-1); }
body.seitenfarben .stein.s0 .punkte { fill: url(#rt-punkt-0); }
body.seitenfarben .stein.s1 .punkte { fill: url(#rt-punkt-1); }
body.seitenfarben #zahl-0, body.seitenfarben .gleichung .teil.s0, body.seitenfarben .haus-zeilen span:nth-child(odd) { color: var(--farbe-0-text); }
body.seitenfarben #zahl-1, body.seitenfarben .gleichung .teil.s1, body.seitenfarben .haus-zeilen span:nth-child(even) { color: var(--farbe-1-text); }

/* Zeichnen: Spur des Fingers (Strich = 10, Viereck = 100) */
#spuren {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2050;               /* über den Steinen, unter Zahlkarten und Rolladen */
  overflow: visible;
}
/* Leer ausblenden: Über den Steinen bekäme die Fläche sonst eine eigene Grafikebene in Tablettgröße */
#spuren:empty { display: none; }
#spuren polyline {
  fill: none;
  stroke: var(--chip);
  stroke-opacity: 0.22;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke-opacity 160ms ease, opacity 320ms ease;
}
#spuren polyline.erkannt { stroke-opacity: 0.5; }
#spuren polyline.weg { opacity: 0; }

/* ---- Vorrat (Stellenwertmaterial) ---------------------------------------- */
#vorrat {
  flex: none;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  padding-top: 10px;
}
.vorrat-quelle {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 6px 14px 4px;
  min-width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  touch-action: none;
  cursor: grab;
}
.vorrat-quelle.aus { opacity: 0.38; }
.vq-bild { display: flex; align-items: center; justify-content: center; height: 40px; }
.vq-bild svg { display: block; }
.vq-name { font: 14px system-ui, -apple-system, sans-serif; color: var(--ink-leise); }
body:not(.zr1000) .vorrat-quelle[data-typ="h"] { display: none; }
#btn-buendeln { height: auto; min-height: 56px; font-size: 18px; font-family: system-ui, -apple-system, sans-serif; }

/* ---- Forscherkarte ------------------------------------------------------- */
#forscher {
  width: 330px;
  flex: none;
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 12px 14px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.fk-kopf { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.fk-kopf .fk-gruppe { flex: 1; min-width: 0; }
#fk-einklappen svg { transition: transform 200ms ease; }
/* Eingeklappt (breite Bildschirme): schmale Leiste, das Tablett bekommt den Platz */
@media (min-width: 901px) {
  #forscher.eingeklappt { width: 64px; padding: 12px 8px; align-items: center; }
  #forscher.eingeklappt > :not(.fk-kopf) { display: none; }
  #forscher.eingeklappt .fk-kopf { flex-direction: column; }
  #forscher.eingeklappt .fk-gruppe, #forscher.eingeklappt #fk-schliessen { display: none; }
  #forscher.eingeklappt #fk-einklappen svg { transform: rotate(180deg); }
}
.fk-gruppe {
  border: none;
  background: none;
  padding: 4px 0;
  font: 600 12px system-ui, -apple-system, sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: left;
}
#fk-titel { margin: 0; font-size: 28px; line-height: 1.1; }
#fk-text { margin: 0; font-size: 21px; line-height: 1.38; }
/* Begründungsfrage: ruhig abgesetzt, gleiche Schrift wie der Auftrag */
#fk-warum { margin: 0; padding: 8px 10px; border-radius: 12px; background: #EAF3F3; font-size: 19px; line-height: 1.35; }
.fk-warum-marke { display: block; font: 600 12px system-ui, -apple-system, sans-serif; letter-spacing: 0.02em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
/* Film zum Auftrag (960 × 540): Vorschaubild ist das letzte Bild, Antippen spielt mit Ton */
#fk-film { margin: 0; display: flex; flex-direction: column; gap: 4px; max-width: 420px; }
.film-buehne { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #E7EDEF; box-shadow: inset 0 0 0 1px rgba(28, 43, 69, 0.08); cursor: pointer; touch-action: manipulation; }
.film-buehne video { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.film-start {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  border-radius: 50%;
  background: rgba(28, 43, 69, 0.78);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 160ms ease;
  pointer-events: none;
}
.film-nochmal, #fk-film.fertig .film-play { display: none; }
#fk-film.fertig .film-nochmal { display: block; }
#fk-film.laeuft .film-start { opacity: 0; }
#fk-film-text { min-height: 2.7em; font-size: 17px; line-height: 1.3; color: var(--ink-leise); }
#fk-film-text:empty { min-height: 0; }
.fk-werkzeuge { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stepper {
  display: inline-flex;
  align-items: center;
  height: 44px;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}
.stepper button {
  width: 42px;
  height: 44px;
  border: none;
  background: none;
  font-size: 26px;
  line-height: 1;
}
.stepper .st-wert { min-width: 38px; text-align: center; font-size: 26px; color: var(--whole-blue); }
/* Einstellungen: eigener Zahlenraum (Gesamtzahl höchstens) */
.grenzwahl { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.grenzwahl .stepper { box-shadow: none; background: #EEF3F6; }
.grenzwahl .stepper .st-wert { min-width: 64px; }
.grenzwahl .stepper button[disabled] { opacity: 0.3; }
.grenzwahl .hinweis { margin: 0; }
#fk-tipps { margin: 0; padding-left: 1.3em; font-size: 18px; line-height: 1.35; color: var(--ink); }
#fk-tipps:empty { display: none; }
#fk-tipps li { margin: 4px 0; }
#fk-meldung {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #EAF1F6;              /* beschreibend, nicht wertend: gleiche Farbe für alle Rückmeldungen */
  border-radius: 14px;
  padding: 10px 10px 10px 12px;
  font-size: 19px;
  line-height: 1.35;
}
#fk-meldung .fk-haken { color: var(--accent); margin-top: 2px; }
#fk-meldung-text { flex: 1; }
#fk-meldung.neu { animation: auftauchen 300ms ease; }
.fk-fuss {
  margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: 6px;
  position: sticky; bottom: -12px; background: #fff; padding-bottom: 12px; margin-bottom: -12px; z-index: 1;
}

/* Sammlung: Zerlegungshaus und Listen */
#fk-sammlung { display: flex; flex-direction: column; gap: 8px; }
.sammel-titel { font: 600 14px system-ui, -apple-system, sans-serif; color: var(--ink-leise); }
.haus { display: inline-flex; flex-direction: column; align-items: stretch; align-self: flex-start; min-width: 150px; }
.haus-dach {
  height: 46px;
  background: var(--panel);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 26px;
  padding-bottom: 2px;
}
body.farben .haus-dach { color: var(--whole-blue); }
.haus-zeilen { border: 3px solid var(--panel); border-top: none; display: grid; grid-template-columns: 1fr 1fr; }
.haus-zeilen span { text-align: center; font-size: 24px; padding: 2px 10px; border-top: 2px solid #E3EBF1; }
.haus-zeilen span:nth-child(odd) { border-right: 3px solid var(--panel); }
body.farben .haus-zeilen span { color: var(--part-red); }
.haus-zeilen span.neu { background: #FFF6D8; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #EEF3F6; border-radius: 10px; padding: 3px 9px; font-size: 21px; }
.chip.neu { background: #FFF6D8; }
.erledigt { font: 14px system-ui, -apple-system, sans-serif; color: var(--ink-leise); }

/* ---- Dialoge ------------------------------------------------------------- */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(28, 43, 69, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  touch-action: none;
}
.dialog-karte {
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  width: min(560px, 100%);
  max-height: min(88vh, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: system-ui, -apple-system, sans-serif;
}
.dialog-karte.breit { width: min(860px, 100%); }
/* Link und QR-Code */
.dialog-inhalt.teilen { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.teilen-was { margin: 0; font-size: 16px; color: var(--ink); }
.qr-feld { border: none; padding: 10px; background: #fff; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(28, 43, 69, 0.12); cursor: zoom-in; line-height: 0; }
.qr-feld svg, .qr-gross-code svg { display: block; width: 100%; height: 100%; shape-rendering: crispEdges; }
.qr-feld svg { width: 240px; height: 240px; }
.teilen-link { width: 100%; }
#teilen-url { width: 100%; box-sizing: border-box; font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 9px 12px; border: 1px solid #C9D5DF; border-radius: 10px; background: #F6F9FA; color: var(--ink); -webkit-user-select: text; user-select: text; }
.teilen-knoepfe { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#film-gross:focus, #qr-gross:focus { outline: none; }
#qr-gross { position: fixed; inset: 0; z-index: 5000; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; cursor: zoom-out; padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
#qr-gross[hidden] { display: none; }
.qr-gross-code { width: min(82vh, 92vw); height: min(82vh, 92vw); }
.qr-gross-was { margin: 0; font: 20px var(--text-schrift); color: var(--ink); text-align: center; }

/* Große Filmansicht: so groß, wie der Bildschirm erlaubt (16:9), Kopfzeile und Satz bleiben sichtbar */
#film-gross {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(17, 27, 41, 0.94);
  --fg-rest: 180px;
}
#film-gross[hidden] { display: none; }
.fg-figur {
  margin: 0; display: flex; flex-direction: column; gap: 12px;
  width: min(100%, calc((100vh - var(--fg-rest)) * 16 / 9));
}
/* dvh erst ab iOS 15.4: Mit var() fiele sonst auch die vh-Zeile davor weg (Breite auto, Film zu groß) */
@supports (height: 100dvh) {
  .fg-figur { width: min(100%, calc((100dvh - var(--fg-rest)) * 16 / 9)); }
}
.fg-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.fg-kopf h2 { margin: 0; font: 600 22px/1.2 var(--text-schrift); color: #fff; }
#fg-zu { flex: none; width: 52px; height: 52px; background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: none; }
#fg-zu:hover { background: rgba(255, 255, 255, 0.24); }
.fg-figur .film-buehne { border-radius: 16px; background: #E7EDEF; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); }
.fg-figur .film-start { width: 76px; height: 76px; margin: -38px 0 0 -38px; }
#film-gross.fertig .film-play { display: none; }
#film-gross.fertig .film-nochmal { display: block; }
#film-gross.laeuft .film-start { opacity: 0; }
.fg-satz { min-height: 2.6em; margin: 0; text-align: center; color: #fff; font: 24px/1.3 var(--text-schrift); }
@media (max-height: 520px) {
  #film-gross { --fg-rest: 120px; }
  .fg-figur { gap: 6px; }
  .fg-kopf { min-height: 44px; }
  .fg-kopf h2 { font-size: 18px; }
  #fg-zu { width: 44px; height: 44px; }
  .fg-satz { font-size: 17px; min-height: 2.6em; }
}
.dialog-kopf { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px 22px; }
.dialog-kopf h2 { margin: 0; font: 600 22px system-ui, -apple-system, sans-serif; }
.dialog-inhalt { overflow-y: auto; padding: 4px 22px 22px; touch-action: pan-y; overscroll-behavior: contain; }
.dialog-inhalt section { padding: 8px 0 10px; border-bottom: 1px solid #E5EBEF; }
.dialog-inhalt section:last-child { border-bottom: none; }
.dialog-inhalt h3 { font: 600 13px system-ui, -apple-system, sans-serif; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-leise); margin: 10px 0 8px; }
.segment { display: flex; background: #EEF3F6; border-radius: 14px; padding: 4px; gap: 4px; }
.segment button {
  flex: 1;
  border: none;
  background: none;
  border-radius: 10px;
  padding: 10px 6px;
  font: 16px system-ui, -apple-system, sans-serif;
  white-space: nowrap;
}
.segment button b { font-weight: normal; font-size: 20px; }
.segment button.an { background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); color: var(--accent); font-weight: 600; }
.segment button[disabled] { opacity: 0.35; cursor: default; }
.hinweis { font-size: 14px; color: var(--ink-leise); margin: 8px 2px 0; }
.schalter { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 17px; cursor: pointer; }
.schalter small { display: block; font-size: 13px; color: var(--ink-leise); }
.schalter input {
  -webkit-appearance: none;
  appearance: none;
  width: 50px;
  height: 30px;
  border-radius: 15px;
  background: #CBD5DD;
  position: relative;
  flex: none;
  margin: 0;
  transition: background 160ms;
}
.schalter input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 160ms;
}
.schalter input:checked { background: var(--accent); }
.schalter input:checked::after { transform: translateX(20px); }
body:not(.sw) .schalter.nur-sw { display: none; }
body:not(.zeichnen-moeglich) .schalter.nur-zeichnen { display: none; }
body:not(.mit-vermuten) .schalter.nur-vermuten { display: none; }
.schalter.einzug { margin-left: 52px; }
/* Farbwahl für „Seiten farbig“: Felder sehen aus wie Plättchen */
.farbwahl { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 10px 62px; }
.farbzeile { display: flex; align-items: center; gap: 10px; }
.fz-name { width: 52px; flex: none; font-size: 15px; color: var(--ink-leise); }
.fz-felder { display: flex; flex-wrap: wrap; gap: 9px; }
.farbfeld {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  padding: 0;
  box-shadow: inset 0 0 0 2px var(--chip-rand);
  overflow: hidden;
  flex: none;
}
.farbfeld.an { box-shadow: inset 0 0 0 2px var(--chip-rand), 0 0 0 3px #fff, 0 0 0 5px var(--accent); }
.farbfeld.eigen { background: conic-gradient(#D9483B, #F2C318, #3FA34D, #1F9E9A, #2980B9, #8B4FB3, #D9483B); }
.farbfeld.eigen input { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); opacity: 0; cursor: pointer; border: none; padding: 0; }
.einst-fuss { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 14px !important; }
.einst-fuss .pill { font: 16px system-ui, -apple-system, sans-serif; height: 44px; }

/* Übersicht der Forscheraufträge */
#karten-liste h3 { margin-top: 16px; }
.karten-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.karten-kachel {
  border: none;
  background: #F2F6F8;
  border-radius: 16px;
  padding: 12px 12px 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 86px;
}
.karten-kachel:hover { background: #E8F0F3; }
.karten-kachel .kk-titel { font: 20px var(--text-schrift); line-height: 1.15; }
.karten-kachel .kk-zr { align-self: flex-start; font: 600 12px system-ui, -apple-system, sans-serif; color: #fff; background: var(--accent); border-radius: 8px; padding: 2px 7px; }
.karten-kachel.aktiv { outline: 3px solid var(--accent); }
.karten-kachel .kk-marken { display: flex; align-items: center; gap: 6px; }
.karten-kachel .kk-film { display: inline-flex; color: var(--accent); }
.karten-kachel .kk-klasse { font: 600 12px system-ui, -apple-system, sans-serif; color: var(--ink-leise); }
/* Übersicht: passend zum Zahlenraum hervorgehoben, die übrigen blass, aber wählbar */
.karten-kachel.blass { opacity: 0.42; }
.karten-kachel.blass:hover, .karten-kachel.blass:focus-visible { opacity: 0.85; }
#karten-liste h3.blass { color: var(--ink-leise); }
.kl-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.kl-label { font: 600 14px system-ui, -apple-system, sans-serif; color: var(--ink-leise); }
.segment.klein button { min-height: 36px; padding: 0 12px; font-size: 15px; white-space: nowrap; }
.segment.klein button b { font-size: 17px; }

/* Anleitung */
.dialog-inhalt.text { font-size: 16px; line-height: 1.5; }
.dialog-inhalt.text .einleitung { font-size: 18px; }
.gesten { padding-left: 1.2em; }
/* Einführungsfilme (groß) und „Neu hier?“ in der Übersicht */
.hilfe-filme.gross { grid-template-columns: minmax(0, 560px); margin: 0 0 6px; }
.hilfe-film .leise { font-weight: normal; color: var(--ink-leise); }
.karten-inhalt { display: flex; flex-direction: column; gap: 10px; }
.neu-hier .hilfe-film.quer { flex-direction: row; align-items: center; gap: 14px; }
.neu-hier .hilfe-film.quer .film-buehne { width: 200px; flex: none; }
.neu-hier .hilfe-film.quer .film-start { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
.neu-hier .hilfe-film.quer figcaption { min-height: 0; font-size: 16px; }
.neu-hier .hilfe-film.quer figcaption b { font-size: 18px; }
/* Einstellungen: der Film für Lehrkräfte ganz oben, als Kachel vom Rest abgesetzt */
.einst-film { margin: 10px 0 2px; padding: 8px; border-radius: 16px; background: #EEF3F6; }
.einst-film .hilfe-film.quer .film-buehne { width: 160px; background: #fff; }
/* Erster Start: großes Vorschaubild des Kinderfilms, darunter „Film ansehen“ und „Gleich loslegen“ */
.dialog-inhalt.willkommen { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.willkommen-film { margin: 0; width: min(420px, 100%); display: flex; flex-direction: column; gap: 6px; }
.willkommen-film img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.willkommen-film .film-start { top: 74%; }     /* unter dem Titel des Vorschaubilds */
.willkommen-film figcaption { display: flex; flex-direction: column; gap: 2px; font-size: 16px; color: var(--ink-leise); }
.willkommen-film figcaption b { font-size: 20px; color: var(--ink); font-weight: 600; }
.willkommen-knoepfe { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.dialog-inhalt.willkommen .hinweis { margin: 0; }
.einst-knoepfe { margin: 6px 0 4px; }
/* Bedien-Clips in der Anleitung */
.hilfe-filme { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 4px 0 8px; }
.hilfe-film { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.hilfe-film figcaption { display: flex; flex-direction: column; gap: 2px; font-size: 15px; line-height: 1.3; color: var(--ink-leise); min-height: 3.6em; }
.hilfe-film figcaption b { color: var(--ink); font-weight: 600; }
.gesten li { margin: 6px 0; }
.quelle { font-size: 14px; color: var(--ink-leise); }

/* Kurzmeldung */
#toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 8px);     /* über der Leiste, nicht über der Gesamtzahl */
  transform: translateX(-50%);
  pointer-events: none;           /* nie Berührungen abfangen */
  max-width: calc(100% - 32px);
  text-align: center;
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  padding: 10px 18px;
  font: 16px system-ui, -apple-system, sans-serif;
  z-index: 6000;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

/* ---- Vermuten am Abdecker (wie Schüttelbox) ------------------------------ */
/* Zahlenfeld als Sprechblase an der Zahl bzw. mittig auf dem Rolladen. Fünfer-Struktur:
   0 für sich, darunter 1–5 / 6–10 … (Lücke nach jedem Zehner); bis 100 Reihen zu 10 wie die
   Hundertertafel; bis 1000 ein Ziffernblock. Tastengröße --taste rechnet die UI passend. */
#vermutung { position: fixed; inset: 0; z-index: 4000; touch-action: none; }
.vm-hintergrund { position: absolute; inset: 0; background: rgba(20, 32, 52, 0.10); }
.vm-karte {
  position: absolute;
  --taste: 56px;
  background: #F4F2EC;
  border-radius: 20px;
  padding: 10px 14px 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}
.vm-pfeil { position: absolute; width: 18px; height: 18px; margin-left: -9px; background: #F4F2EC; transform: rotate(45deg); display: none; }
.vm-karte[data-pfeil="oben"] .vm-pfeil { display: block; top: -8px; }
.vm-karte[data-pfeil="unten"] .vm-pfeil { display: block; bottom: -8px; }
.vm-karte[data-pfeil="links"] .vm-pfeil { display: block; left: -8px; margin: -9px 0 0; }
.vm-karte[data-pfeil="rechts"] .vm-pfeil { display: block; right: -8px; margin: -9px 0 0; }
.vm-kopf { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
#vm-titel { flex: 1 1 auto; font: 600 18px system-ui, -apple-system, sans-serif; }
.vm-zu { background: rgba(28, 43, 69, 0.08); box-shadow: none; }
.vm-karte .vm-zu { width: 36px; height: 36px; position: relative; }
/* Schreiben ⇄ Tasten; nach Mühe beim Erkennen hebt er sich hervor (kein Urteil, nur ein Angebot) */
.vm-karte .vm-modus { width: 36px; height: 36px; position: relative; flex: none; background: rgba(28, 43, 69, 0.08); box-shadow: none; color: var(--ink); }
.vm-modus[hidden] { display: none !important; }
.vm-karte .vm-modus.hinweis { background: var(--accent); color: #fff; animation: vm-hinweis 1.4s ease-out 2; }
@keyframes vm-hinweis { from { box-shadow: 0 0 0 0 rgba(62, 142, 142, 0.55); } to { box-shadow: 0 0 0 12px rgba(62, 142, 142, 0); } }
/* Trefferfläche für Kinderfinger größer als das Sichtbare */
.vm-karte .vm-zu::after, .vm-karte .vm-modus::after, #fk-meldung-vorlesen::after { content: ''; position: absolute; inset: -6px; }
#fk-meldung-vorlesen { position: relative; }
.vm-tasten { display: flex; flex-direction: column; gap: 8px; }
.vm-reihe { display: flex; gap: 8px; }
.vm-reihe.erste { margin-bottom: 6px; }            /* die 0 steht für sich */
.vm-reihe.block-ende { margin-bottom: 8px; }       /* Lücke nach jedem Zehner bzw. Fünfziger */
.vm-taste {
  flex: none;
  width: var(--taste);
  height: var(--taste);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-family: 'Grundschrift', system-ui, sans-serif;
  font-weight: bold;
  font-size: calc(var(--taste) * 0.5);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
}
.vm-taste > span { position: relative; top: 0.08em; }
.vm-taste.fuenf { margin-right: 10px; }             /* Fünfer-Lücke in Zehnerreihen */
.vm-taste:active:not(:disabled) { transform: scale(0.94); }
.vm-taste:disabled { opacity: 0.22; cursor: default; box-shadow: none; }
.vm-taste.versucht { position: relative; }
.vm-taste.versucht:disabled { opacity: 0.4; }
.vm-taste.versucht::after, .vm-versuche span::after, .vm-marke.falsch::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 2px;
  background: var(--part-red);
  transform: rotate(-35deg);
}
body.farben .vm-karte[data-rolle="ganzes"] .vm-taste.zahl { color: var(--whole-blue); }
body.farben .vm-karte[data-rolle="teil"] .vm-taste.zahl { color: var(--part-red); }
.vm-taste.ok { background: var(--accent); color: #fff; }
.vm-taste.ok:disabled { opacity: 0.3; }
.vm-taste svg { width: 46%; height: 46%; }
/* Ziffernblock: Anzeige über drei Tastenspalten */
.vm-anzeige {
  height: calc(var(--taste) * 1.1);
  margin-bottom: 8px;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--taste) * 0.78);
  letter-spacing: 0.04em;
}
.vm-anzeige .leer { color: #C3CBD3; font-family: var(--text-schrift); }
body.farben .vm-karte[data-rolle="ganzes"] .vm-anzeige { color: var(--whole-blue); }
body.farben .vm-karte[data-rolle="teil"] .vm-anzeige { color: var(--part-red); }
.vm-versuche { display: flex; justify-content: center; gap: 8px; margin: -2px 0 8px; font-size: 22px; color: #6B7685; }
.vm-versuche span { position: relative; padding: 0 4px; }
.vm-zeigen { display: flex; margin: 12px auto 0; background: rgba(28, 43, 69, 0.08); box-shadow: none; }
.vm-zeigen[hidden] { display: none !important; }
.vm-karte.wackeln { animation: wackeln 380ms ease; }
body.seitenfarben .vm-karte[data-seite="0"] .vm-taste.zahl, body.seitenfarben .vm-karte[data-seite="0"] .rad-ziffer { color: var(--farbe-0-text); }
body.seitenfarben .vm-karte[data-seite="1"] .vm-taste.zahl, body.seitenfarben .vm-karte[data-seite="1"] .rad-ziffer { color: var(--farbe-1-text); }

/* Ab 100: Ziffern-Räder, eins je Stelle wie in der Stellenwerttafel (ziehen, wischen oder antippen).
   Das Fenster ist 2,3 Ziffern hoch (RAD_REIHEN in rechentablett-ui.js): die Nachbarn sind nur
   angeschnitten und blass, die Mitte ist klar. Gedreht wird per JS (translateY), nicht nativ. */
.vm-rad { display: flex; gap: 10px; justify-content: center; }
.rad-spalte { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rad-name { font: 600 16px system-ui, -apple-system, sans-serif; color: var(--ink-leise); }
.rad-fenster {
  position: relative;
  width: calc(var(--taste) * 1.2);
  height: calc(var(--taste) * 2.3);
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}
.rad-band {
  position: absolute;
  left: 5px;
  right: 5px;
  top: calc(var(--taste) * 0.65);
  height: var(--taste);
  border-radius: 12px;
  background: rgba(62, 142, 142, 0.10);
  box-shadow: inset 0 0 0 2px rgba(62, 142, 142, 0.5);
  pointer-events: none;
}
.rad {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: ns-resize;
  border-radius: inherit;
  -webkit-mask-image: linear-gradient(transparent, rgba(0, 0, 0, 0.1) 9%, rgba(0, 0, 0, 0.4) 23%, #000 31%, #000 69%, rgba(0, 0, 0, 0.4) 77%, rgba(0, 0, 0, 0.1) 91%, transparent);
  mask-image: linear-gradient(transparent, rgba(0, 0, 0, 0.1) 9%, rgba(0, 0, 0, 0.4) 23%, #000 31%, #000 69%, rgba(0, 0, 0, 0.4) 77%, rgba(0, 0, 0, 0.1) 91%, transparent);
}
.rad:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.rad-liste { position: absolute; left: 0; right: 0; top: calc(var(--taste) * 0.65); will-change: transform; }
.rad-ziffer {
  height: var(--taste);
  display: flex;
  align-items: center;
  justify-content: center;
  font: bold calc(var(--taste) * 0.66) 'Grundschrift', system-ui, sans-serif;
  color: var(--ink);
}
.rad-ziffer > span { position: relative; top: 0.08em; }
body.farben .vm-karte[data-rolle="ganzes"] .rad-ziffer { color: var(--whole-blue); }
body.farben .vm-karte[data-rolle="teil"] .rad-ziffer { color: var(--part-red); }
.vm-rad-fuss { display: flex; justify-content: center; margin-top: 12px; }
/* Schmale Hälfte (iPhone hoch): Räder dicht an dicht, damit das Feld auf dem Rolladen bleibt */
.vm-karte.kompakt { padding: 8px 8px 10px; width: -webkit-min-content; width: min-content; }   /* so breit wie die Räder; der Titel bricht um */
.vm-karte.kompakt #vm-titel { font-size: 15px; }
.vm-karte.kompakt .vm-rad { gap: 4px; }
.vm-karte.kompakt .rad-fenster { width: var(--taste); border-radius: 12px; }
.vm-karte.kompakt .rad-band { left: 2px; right: 2px; }
.vm-taste.ok.breit { width: auto; min-width: calc(var(--taste) * 2.2); border-radius: 999px; padding: 0 24px; }
.vm-taste.ok.breit svg { width: calc(var(--taste) * 0.46); height: calc(var(--taste) * 0.46); }

/* Zahl schreiben: ein Kästchen je Stelle, so groß wie Platz ist (--kaestchen rechnet
   kaestchenGroesse). Die Kästchen liegen ohne Abstand im Kästchenraster wie im Heft: Die Reihe
   zeichnet das Raster, ringsum läuft das Papier aus (angeschnittene Kästchen; dort angesetzte
   Striche gehören zum nächsten Kästchen). Beim Schreiben ist die Tinte zu sehen; erkannt, steht die
   Ziffer gesetzt in der Grundschrift da (unsicher: blass). Zwei Ziffern in einem Kästchen werden kleiner. */
.vm-schreiben { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.sf-reihe {
  --linie: 2px;
  --rand-x: var(--sf-rand-x, 12px);                      /* setzeFeld: was neben den Kästchen übrig ist */
  --rand-y: var(--sf-rand-y, 6px);
  display: flex;
  justify-content: center;
  padding: var(--rand-y) var(--rand-x);
  background-color: #fff;
  background-image:
    linear-gradient(to right, var(--heft-linie) var(--linie), transparent 0),
    linear-gradient(to bottom, var(--heft-linie) var(--linie), transparent 0);
  background-size: var(--kaestchen, 120px) calc(var(--kaestchen, 120px) * 1.2);
  background-position: calc(var(--rand-x) - var(--linie) / 2) calc(var(--rand-y) - var(--linie) / 2);
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 var(--rand-x), #000 calc(100% - var(--rand-x)), transparent),
    linear-gradient(to bottom, transparent, #000 var(--rand-y), #000 calc(100% - var(--rand-y)), transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 var(--rand-x), #000 calc(100% - var(--rand-x)), transparent),
    linear-gradient(to bottom, transparent, #000 var(--rand-y), #000 calc(100% - var(--rand-y)), transparent);
  mask-composite: intersect;
}
.sf-kaestchen {
  position: relative;
  flex: none;
  width: var(--kaestchen, 120px);
  height: calc(var(--kaestchen, 120px) * 1.2);            /* HOCH */
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.sf-kaestchen canvas { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 0.3s; }
.sf-ziffer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0.08em;
  font-weight: bold;
  font-size: calc(var(--kaestchen, 120px) * 0.86);
  line-height: 1;
  color: var(--ink);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.sf-kaestchen[data-ziffern="2"] .sf-ziffer { font-size: calc(var(--kaestchen, 120px) * 0.56); letter-spacing: -0.02em; }
.sf-kaestchen[data-ziffern="3"] .sf-ziffer { font-size: calc(var(--kaestchen, 120px) * 0.38); }
.sf-kaestchen.voll .sf-ziffer { opacity: 1; }
.sf-kaestchen.voll canvas { opacity: 0; }
.sf-kaestchen.unsicher .sf-ziffer { opacity: 0.45; }
.sf-kaestchen.schreibt canvas { opacity: 1; transition: none; }
.sf-kaestchen.schreibt .sf-ziffer { opacity: 0; transition: none; }
body.farben .vm-karte[data-rolle="ganzes"] .sf-ziffer { color: var(--whole-blue); }
body.farben .vm-karte[data-rolle="teil"] .sf-ziffer { color: var(--part-red); }
body.seitenfarben .vm-karte[data-seite="0"] .sf-ziffer { color: var(--farbe-0-text); }
body.seitenfarben .vm-karte[data-seite="1"] .sf-ziffer { color: var(--farbe-1-text); }
.sf-fuss { display: flex; gap: 16px; justify-content: center; align-items: center; }
.sf-fuss .vm-taste.weg { background: rgba(28, 43, 69, 0.08); box-shadow: none; color: var(--ink-leise); }

/* Nach dem Aufdecken: Haken bzw. durchgestrichene Vermutung an der Zahl, bis sich etwas ändert */
.vm-marke {
  position: fixed;
  z-index: 60;
  min-width: 34px;
  height: 34px;
  padding: 0.12em 8px 0;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;            /* nie Berührungen abfangen */
  font: bold 22px 'Grundschrift', system-ui, sans-serif;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  animation: vm-auf 260ms ease-out;
}
.vm-marke.ok { background: var(--ok); color: #fff; padding: 0 6px; }
.vm-marke.ok svg { width: 22px; height: 22px; }
.vm-marke.falsch { background: #fff; color: #6B7685; }
@keyframes vm-auf { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }

/* ---- Eingebettet / native ------------------------------------------------ */
body.embedded #btn-vollbild { display: none; }

/* ---- Kleine Bildschirme -------------------------------------------------- */
/* Hochformat: Karte unter dem Tablett (eigener Platz, verdeckt nichts) */
@media (max-width: 900px) and (orientation: portrait) {
  #haupt { flex-direction: column; }
  #forscher { order: 2; width: auto; max-height: 40vh; flex: none; }
  #fk-film { max-width: min(300px, 58%); }
  #forscher.eingeklappt > :not(.fk-kopf):not(#fk-titel) { display: none; }
  #fk-einklappen svg { transform: rotate(-90deg); }
  #forscher.eingeklappt #fk-einklappen svg { transform: rotate(90deg); }
  /* urff.app-Hülle: „Festhalten“ und „Beenden“ sitzen unten rechts, über dem Weiter-Pfeil */
  body.urff-shell .fk-fuss { padding-right: 96px; }
}
/* Schmales Querformat (iPhone): schmale Seitenleiste */
@media (max-width: 900px) and (orientation: landscape) {
  #forscher { width: 250px; padding: 8px 10px; gap: 6px; }
  #fk-titel { font-size: 21px; }
  #fk-text { font-size: 16px; }
  #fk-tipps, #fk-meldung { font-size: 15px; }
  #fk-warum { font-size: 15px; padding: 6px 8px; }
  #fk-film-text { font-size: 14px; }
  .haus-zeilen span, .chip { font-size: 18px; }
  #forscher.eingeklappt { width: 56px; padding: 8px 6px; align-items: center; }
  #forscher.eingeklappt > :not(.fk-kopf) { display: none; }
  #forscher.eingeklappt .fk-kopf { flex-direction: column; }
  #forscher.eingeklappt .fk-gruppe, #forscher.eingeklappt #fk-schliessen { display: none; }
  #forscher.eingeklappt #fk-einklappen svg { transform: rotate(180deg); }
}
@media (max-height: 620px), (max-width: 700px) {
  :root { --leiste-h: 44px; --kopf-h: 60px; --griff-h: 22px; --gutter: 10px; }
  body.zr-klein { --kopf-h: 68px; }
  .pill { font-size: 18px; padding: 0 14px; }
  #btn-rechnungen { font-size: 19px; padding: 0 12px; }
  .leiste-mitte { gap: 6px; }
  #leiste { padding-top: 6px; }
  .round svg { transform: scale(0.85); }
  .vq-bild { height: 30px; }
  .vorrat-quelle { min-width: 70px; padding: 4px 8px 2px; }
  #btn-buendeln { min-height: 44px; }
  .rolladen { --frage: min(64px, var(--frage-platz, 64px)); }
}
/* Niedrige Bildschirme (iPhone quer): Vorrat ohne Beschriftung – die Bilder zeigen das Material,
   der Name bleibt im aria-label; das Tablett bekommt die Höhe */
@media (max-height: 430px) {
  .vq-name { display: none; }
  #vorrat { padding-top: 6px; }
  .vorrat-quelle { justify-content: center; padding: 4px 8px; }
}
@media (max-width: 560px) {
  .leiste-rechts .pill span { display: none; }
  .leiste-rechts .pill { padding: 0 12px; }
  #btn-vollbild { display: none; }
}
/* iPhone hoch: Werkzeuge in eine eigene Reihe, damit alle Knöpfe (auch „Forschen“) erreichbar bleiben */
@media (max-width: 480px) {
  #gl-plus { padding-right: 8px; }
  #gl-minus { padding-left: 8px; }
  #zahl-ganzes { min-width: 100px; }
  #vorrat { gap: 8px; }
  #btn-buendeln { padding: 0 12px; }
  #btn-buendeln span { display: none; }
  .segment button { padding: 10px 3px; }
  #leiste { grid-template-columns: 1fr 1fr; grid-template-areas: "links rechts" "mitte mitte"; row-gap: 6px; }
  .leiste-links { grid-area: links; }
  .leiste-rechts { grid-area: rechts; }
  .leiste-mitte { grid-area: mitte; justify-self: center; flex-wrap: wrap; justify-content: center; }
}

/* ---- Ansicht wie die alte App (Standard; body.klassisch, aus mit Einstellung leiste) -------
   Wie 2012 reicht das Tablett links, rechts und unten bis an den Rand. Die Leiste entfällt: Die UI
   verteilt die Knöpfe dezent links und rechts neben die Gesamtzahl (ordneKnoepfe). Wird es eng,
   wandern Ordnen, Leeren und Vollbild hinter „⋯“ (kopf-kompakt), noch enger stehen die Knöpfe in
   einer eigenen Zeile über der Gesamtzahl (kopf-zeile). */
#btn-werkzeuge, .kopf-knoepfe { display: none; }
body.klassisch { --rail-knopf: 44px; --rail-luecke: 8px; }
body.klassisch #leiste { display: none; }
body.klassisch #app { padding-bottom: 0; }
body.klassisch #haupt { padding: 0; }
body.klassisch #kopf { position: relative; }
body.klassisch .kopf-knoepfe {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2600;                  /* über dem Tablett (eigener Stapelkontext) */
  display: flex;
  align-items: center;
  gap: var(--rail-luecke);
}
#kopf-links { left: var(--gutter); }
#kopf-rechts { right: var(--gutter); }
body.klassisch .kopf-knoepfe > .round, body.klassisch .kopf-knoepfe > .pill {
  width: var(--rail-knopf);
  height: var(--rail-knopf);
  padding: 0;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: none;
  color: var(--ink-leise);
}
body.klassisch .kopf-knoepfe > .round svg, body.klassisch .kopf-knoepfe > .pill svg { transform: scale(0.82); }
body.klassisch .kopf-knoepfe > #btn-rechnungen { width: auto; padding: 0 12px; font-size: 18px; }
body.klassisch .kopf-knoepfe > #btn-forschen span { display: none; }
/* genug Breite: „Forschen“ als Wort neben der Lupe */
body.klassisch.forschen-text .kopf-knoepfe > #btn-forschen { width: auto; padding: 0 16px 0 12px; gap: 6px; font-size: 18px; }
body.klassisch.forschen-text .kopf-knoepfe > #btn-forschen span { display: inline; }
body.klassisch .kopf-knoepfe > [aria-pressed="true"], body.klassisch #btn-werkzeuge[aria-expanded="true"],
body.klassisch .kopf-knoepfe > #btn-leeren.zurueckholen { background: var(--accent); color: #fff; }
body.klassisch.kopf-kompakt #btn-werkzeuge { display: inline-flex; }
/* „⋯“: Ordnen und Leeren als Spalte darunter, in gewohnter Größe */
#mehr-liste {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: calc(-6px - (var(--leiste-h) - var(--rail-knopf)) / 2);
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(28, 43, 69, 0.22);
}
body.klassisch.werkzeuge-offen #mehr-liste { display: flex; }
body.klassisch.kopf-zeile #kopf { height: auto; padding-top: calc(var(--rail-knopf) + 8px); }
body.klassisch.kopf-zeile .kopf-knoepfe { bottom: auto; height: calc(var(--rail-knopf) + 8px); }
body.klassisch #tablett { border-radius: 0; padding: 10px 0 0; box-shadow: none; }
body.klassisch #haelfte-0, body.klassisch #haelfte-1 { border-radius: 0; }
/* Unten reicht das Tablett unter den Home-Balken; die Legefläche endet darüber (messen() liest
   padding-bottom der Hälften). Mit Vorrat liegt der Vorrat unten. */
body.klassisch:not(.sw) .haelfte { padding-bottom: env(safe-area-inset-bottom, 0px); }
body.klassisch:not(.sw) #btn-tauschen { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
body.klassisch #vorrat { padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
body.klassisch #forscher { margin: 8px 0 max(var(--gutter), env(safe-area-inset-bottom, 0px)) var(--gutter); }
/* Hinweise unten statt oben: oben steht die Gesamtzahl */
body.klassisch #toast { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); }
body.klassisch.sw #toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 150px); }
@media (max-width: 900px) and (orientation: portrait) {
  body.klassisch #forscher { margin: var(--gutter) var(--gutter) max(var(--gutter), env(safe-area-inset-bottom, 0px)); }
}
@media (max-height: 620px), (max-width: 700px) {
  body.klassisch { --rail-knopf: 40px; --rail-luecke: 6px; }
}
@media (max-width: 480px) {
  body.klassisch { --rail-knopf: 36px; --rail-luecke: 4px; }
}

/* ---- Alte Ansicht (Einstellung alteAnsicht, body.alte-ansicht; nur im freien Tablett) ---------
   Wie die App von 2012 (Maße aus den Bildschirmfotos vom iPad): dunkle Leiste mit der Gesamtzahl in
   einem hellgrauen Feld (16,6 % der Breite), darunter ein schwarzer Strich, die Trennwand schwarz und
   breit (3 %), über jeder Hälfte der graue Griff des Rolladens, Teilzahlen in hellgrauen Feldern,
   alle Ziffern schwarz. Keine Knöpfe außer dem kleinen Zahnrad oben links (weiter mit 3 Sekunden
   Halten), keine Rechnungen und Farben. Optisch ähnlich, nicht gleich: Geschlossen sind Rolladen und
   Klappen die neuen (mit „?“, auf Wunsch Auge), Vermuten und Schreiben gelten wie eingestellt. */
body.alte-ansicht {
  --alt-leiste: #2C3E50;
  --alt-feld: #ECF0F1;
  --alt-griff: #7F8C8D;
  --trenner: #000;
  --trenner-b: clamp(14px, 3vw, 44px);
  --griff-h: calc(var(--kopf-h) * 0.38);
}
body.alte-ansicht .kopf-knoepfe > :not(#btn-menu) { display: none !important; }
body.alte-ansicht #kopf { background: var(--alt-leiste); }
body.alte-ansicht .kopf-knoepfe > #btn-menu { background: transparent; color: rgba(236, 240, 241, 0.6); }
body.alte-ansicht #zahl-ganzes {
  height: var(--kopf-h);
  min-width: clamp(110px, 16.6vw, 260px);
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--alt-feld);
  font-size: calc(var(--kopf-h) * 0.95);
}
body.alte-ansicht .zahlkarte { color: #000; }
/* 2012 standen die Ziffern etwas unter der Mitte ihres Feldes */
body.alte-ansicht .zahlkarte .ziffer { top: 0.13em; }
body.alte-ansicht #zahl-ganzes .klappe { border-radius: 0; }
body.alte-ansicht #tablett { background: #000; }
body.alte-ansicht .haelfte { background: #fff; box-shadow: none; }
body.alte-ansicht .griff {
  background: var(--alt-griff);
  border-bottom: 2px solid #000;
  box-shadow: 0 4px 0 #CCC;
}
body.alte-ansicht #btn-tauschen { display: none !important; }
/* offen der graue Balken von 2012, geschlossen der neue Rolladen mit Knauf */
body.alte-ansicht .haelfte:not(.zu) .griff-knauf { display: none; }
body.alte-ansicht .haelfte.zu .griff { background: var(--cover); border-bottom-color: var(--cover); box-shadow: none; }
body.alte-ansicht .zahlkarte.teil {
  top: calc(var(--griff-h) + 12px);
  min-width: clamp(110px, 16.6vw, 260px);     /* so breit wie das Feld der Gesamtzahl */
  border-radius: 0;
  box-shadow: none;
  background: var(--alt-feld);
  font-size: calc(var(--zahl-h, 66px) * 0.95);
}
body.alte-ansicht .stellen-info { top: calc(var(--griff-h) + 12px + var(--zahl-h, 66px) + 4px); }
/* Einstellungen: was in der alten Ansicht nichts bewirkt, steht nicht da */
body.alte-ansicht .nicht-alt { display: none !important; }

#tablett.sofort .stein, #tablett.sofort .rolladen, #tablett.sofort .zahlkarte .klappe { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .stein, .rolladen, .zahlkarte .klappe { transition-duration: 1ms !important; }
  .film-start, .schalter input, .schalter input::after, #fk-einklappen svg { transition-duration: 1ms !important; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; }
  .wackeln { outline: 3px solid var(--ink); outline-offset: 2px; }
}
