/* ============================================================
   Drachenschule – Stylesheet
   Look aus einem Guss mit dem Drachenbrief: Pergament, Marine-Tinte,
   Tartan-Rahmen, Patrick Hand. Alles Gestaltbare hängt an den Tokens
   in :root (Farben je Fach, Tiefe, Radien, Bewegung).
   ============================================================ */

:root {
  /* Tinte und Papier */
  --ink: #1f3560;          /* Marine-Tinte, wie im Drachenbrief */
  --ink-weich: #4a5d85;
  --ink-leise: #6f7c99;
  --papier: #fffdf7;
  --pergament: #f4e8cb;
  --pergament-rand: rgba(150, 105, 45, 0.22);

  /* Fachfarben: Grundton, heller Tint, Sockel (unterer Kachelrand), Leuchten */
  --rot: #d4503e;
  --gruen: #5f8f3c;
  --hellgruen: #9ec468;
  --blau: #2a78d6;
  --sand: #f3e2b8;
  --gelb-tint: #fff3d3;
  --gelb-sockel: #f1d58a;
  --gelb-glow: rgba(242, 182, 50, .34);
  --blau-tint: #e6effb;
  --blau-sockel: #b3cbee;
  --blau-glow: rgba(74, 143, 224, .26);
  --rot-tint: #fde9e3;
  --rot-sockel: #f1b8a9;
  --rot-glow: rgba(226, 96, 79, .24);
  --gruen-tint: #eaf3df;
  --gruen-sockel: #bed99f;
  --gruen-glow: rgba(106, 168, 79, .28);

  /* Tiefe: weiche, nach unten versetzte Schatten in Tinte statt harter Blockschatten */
  --sh-1: 0 1px 1px rgba(31, 53, 96, .08), 0 3px 8px -2px rgba(31, 53, 96, .20);
  --sh-2: 0 2px 3px rgba(31, 53, 96, .07), 0 10px 22px -8px rgba(31, 53, 96, .32);
  --sh-3: 0 4px 6px rgba(31, 53, 96, .08), 0 22px 40px -14px rgba(31, 53, 96, .40);
  /* Drückbare Knöpfe: innerer Sockel unten, der beim Drücken flacher wird */
  --sockel: inset 0 -4px 0 rgba(31, 53, 96, .10);
  --sockel-gedrueckt: inset 0 -1px 0 rgba(31, 53, 96, .10);

  --r-s: 10px;
  --r-m: 16px;
  --r-l: 22px;
  --r-xl: 28px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --fokus: 0 0 0 3px var(--papier), 0 0 0 6px var(--blau);
}

html, body { height: 100%; }

/* Gemeinsamer Hintergrund aller Seiten: Pergament mit feiner Papierstruktur und
   dunkleren Rändern (wie der Drachenbrief). Die Startseite legt ihre Szene darüber. */
html {
  background-color: var(--pergament);
  background-image:
    radial-gradient(ellipse at 50% 38%, rgba(255, 250, 235, 0) 48%, var(--pergament-rand) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .52  0 0 0 0 .38  0 0 0 0 .18  0 0 0 .55 -.14'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  background-attachment: fixed, scroll;
  scrollbar-color: rgba(31, 53, 96, .35) transparent;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Patrick Hand", cursive;
  color: var(--ink);
  caret-color: var(--blau);
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(242, 182, 50, .45); color: var(--ink); }

/* Tartan-Rahmen um den Bildschirm (Gruß an den Brief), klickt nicht mit */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  padding: 9px;
  background:
    repeating-linear-gradient(90deg, rgba(40, 120, 78, .78) 0 12px, transparent 12px 34px, rgba(204, 58, 48, .72) 34px 40px, transparent 40px 56px, rgba(250, 214, 90, .85) 56px 58px, transparent 58px 72px),
    repeating-linear-gradient(0deg, rgba(40, 120, 78, .78) 0 12px, transparent 12px 34px, rgba(204, 58, 48, .72) 34px 40px, transparent 40px 56px, rgba(250, 214, 90, .85) 56px 58px, transparent 58px 72px),
    #1f3b72;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
/* Feine Innenkante, damit der Rahmen wie gefasst wirkt statt aufgeklebt */
body::before {
  content: "";
  position: fixed;
  inset: 9px;
  z-index: 50;
  pointer-events: none;
  box-shadow: inset 0 0 0 1.5px rgba(31, 53, 96, .55), inset 0 6px 14px -8px rgba(31, 53, 96, .45);
}
@media (max-width: 600px) { body::after { padding: 6px; } body::before { inset: 6px; } }

a { color: #2d5aa3; text-underline-offset: .18em; }
a:hover { color: var(--ink); }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--fokus); }

/* ---------- Fixe Hintergrund-Szene ---------- */
/* Eine zusammenhängende SVG-Illustration (siehe index.html) statt einzelner
   CSS-Formen — Wiese und Schlossfuß teilen sich dieselbe Pfad-Basislinie,
   damit das Schloss auf jeder Bildschirmgröße wirklich auf dem Boden steht. */

.scene {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  display: block;
}
/* Optionales gemaltes Szenenbild (data-bild, siehe ladeMedien in app.js) liegt
   über der SVG-Szene; fehlt die Datei, bleibt die SVG sichtbar. */
.scene-bild { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.scene-bild .medien { width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }

/* ---------- Symbole ---------- */
/* Eigene Strich-Icons (24er Raster, 2,6 Strichstärke, runde Enden) als Maske,
   damit sie die Textfarbe übernehmen. Data-URIs laufen auch per file://. */
.ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}
.ico-home { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 11.2 12 4l8.5 7.2'/%3E%3Cpath d='M6 9.6V19a1 1 0 0 0 1 1h3.4v-5.2h3.2V20H17a1 1 0 0 0 1-1V9.6'/%3E%3C/svg%3E"); }
.ico-zurueck { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5.5M11 5.5 4.5 12l6.5 6.5'/%3E%3C/svg%3E"); }
.ico-weiter { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h13.5M13 5.5l6.5 6.5-6.5 6.5'/%3E%3C/svg%3E"); }
.ico-ton { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.3h3.3L12 5.2v13.6l-4.7-4.1H4z' fill='%23000'/%3E%3Cpath d='M15.6 9.2a4 4 0 0 1 0 5.6M18.4 6.4a8 8 0 0 1 0 11.2'/%3E%3C/svg%3E"); }
.ico-neu { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19.5 13A7.5 7.5 0 1 1 17 6.9'/%3E%3Cpath d='M18.6 3.6v4.3h-4.3'/%3E%3C/svg%3E"); }
.ico-pruefen { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.8 12.6 9.6 17.4 19.4 6.8'/%3E%3C/svg%3E"); }
.ico-loeschen { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5.5h10a1.5 1.5 0 0 1 1.5 1.5v10a1.5 1.5 0 0 1-1.5 1.5H9L3.5 12z'/%3E%3Cpath d='m12.5 9.5 5 5m0-5-5 5'/%3E%3C/svg%3E"); }
.ico-plus { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.ico-minus { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E"); }
.ico-abmelden { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21V10.5a5.5 5.5 0 0 1 11 0V21'/%3E%3Cpath d='M15 10.6l-3.6-1.2v10.4L15 21'/%3E%3Cpath d='M2.5 21h11.5'/%3E%3Cpath d='M20.6 3.2a3.1 3.1 0 1 0 1.6 5a2.6 2.6 0 0 1-1.6-5z' fill='%23000' stroke-width='1.2'/%3E%3Cpath d='M18.4 12.6v.01M21.4 14.6v.01'/%3E%3C/svg%3E"); }
.ico-amt { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5' r='2.6'/%3E%3Cpath d='M10.6 7.4 10 12.5h4l-.6-5.1'/%3E%3Cpath d='M5.5 15.5a2.5 2.5 0 0 1 2.5-3h8a2.5 2.5 0 0 1 2.5 3v1h-13z'/%3E%3Cpath d='M4 20.5h16'/%3E%3Cpath d='M8 20.5l1-1.4h6l1 1.4' stroke-width='1.4'/%3E%3C/svg%3E"); }

/* ---------- Grundbausteine ---------- */

.titel {
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  text-wrap: balance;
  text-shadow: 0 2px 0 rgba(255, 253, 247, .7);
}
/* Zierlinie unter Überschriften, wie im Brief */
.titel::after {
  content: "";
  display: block;
  width: 150px;
  height: 14px;
  margin: 6px auto 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 10'%3E%3Cg fill='none' stroke='%231f3560' stroke-width='1.3' stroke-linecap='round'%3E%3Cpath d='M2 5H34M56 5H88'/%3E%3Cpath d='M34 5c3-4 7-4 8 0c1 4 5 4 6 0c1-4 5-4 8 0'/%3E%3Ccircle cx='45' cy='5' r='1.6' fill='%231f3560'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}

.sk {
  border: 3px solid var(--ink);
  border-radius: var(--r-l);
  background: var(--papier);
  box-shadow: var(--sh-2);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 0;
  flex-wrap: wrap;
}
.topbar .spacer { flex: 1; }
@media (max-width: 600px) { .topbar { padding: 14px 16px 0; gap: 10px; } }

.hartmut { width: 86px; height: auto; flex: none; filter: drop-shadow(0 4px 5px rgba(31, 53, 96, .22)); }
.hartmut.klein { width: 64px; }

.jubel { animation: jubel 0.9s var(--ease); }
@keyframes jubel {
  0%, 100% { transform: none; }
  25% { transform: translateY(-16px) rotate(-6deg) scale(1.04); }
  55% { transform: translateY(-6px) rotate(5deg); }
}
.wackel { animation: wackel 0.45s ease; }
@keyframes wackel {
  0%, 100% { transform: none; }
  25% { transform: translateX(-9px) rotate(-2deg); }
  75% { transform: translateX(9px) rotate(2deg); }
}

.ic { width: 26px; height: 26px; }

/* Drückbare Knöpfe: Papierfläche, Tintenrand, Sockel innen, weicher Schatten.
   Beim Drücken sinkt der Knopf ein. */
.iconbtn, .pillbtn, .letter-tile, .zahlen-strip button, .strip-nav button, .tafel-zelle, .egg {
  transition: transform .14s var(--ease), box-shadow .14s var(--ease), background-color .14s ease, color .14s ease;
}
.iconbtn {
  width: 56px;
  height: 56px;
  border: 3px solid var(--ink);
  border-radius: var(--r-m);
  background: linear-gradient(180deg, #fff 0%, var(--papier) 100%);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sockel), var(--sh-1);
  font-size: 1.6rem;
  font-family: inherit;
  text-decoration: none;
  flex: none;
  cursor: pointer;
}
.iconbtn .ico { font-size: 28px; }
.iconbtn:hover { background: var(--gelb-tint); color: var(--ink); transform: translateY(-1px); }
.iconbtn:active { transform: translateY(2px); box-shadow: var(--sockel-gedrueckt), 0 1px 2px rgba(31, 53, 96, .2); }
.iconbtn:focus-visible { box-shadow: var(--sockel), var(--fokus); }
.iconbtn.sm { width: 46px; height: 46px; border-width: 2.5px; border-radius: 13px; font-size: 1.3rem; }
.iconbtn.sm .ico { font-size: 23px; }
.iconbtn.gruen { background: linear-gradient(180deg, #f4f9ee 0%, var(--gruen-tint) 100%); color: #2f5a1c; }
.iconbtn.gruen:hover { background: var(--gruen-tint); }
.iconbtn:disabled { opacity: .35; cursor: default; pointer-events: none; box-shadow: none; }

/* Dezente Knöpfe für Erwachsene oben rechts auf der Startseite (Verwaltung,
   Abmelden); app.js blendet sie ein, wenn die App vom Server kommt */
.eckknopf { color: var(--ink-leise); opacity: .55; padding: 6px; display: inline-flex; flex: none; transition: opacity .2s; }
.eckknopf[hidden] { display: none; }
.eckknopf .ico { font-size: 26px; }
.eckknopf:hover, .eckknopf:focus-visible { opacity: 1; }

/* Rückfrage vor dem Abmelden (für Erwachsene, deshalb mit Text). „Hierbleiben“
   ist groß und vorausgewählt, „Abmelden“ klein und abseits; ein Tipp neben den
   Dialog bricht ab. */
.rueckfrage {
  border: 3px solid var(--ink);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, #fff 0%, var(--papier) 100%);
  color: var(--ink);
  box-shadow: var(--sh-3);
  padding: 28px 28px 22px;
  width: min(440px, calc(100vw - 32px));
  box-sizing: border-box;
  font-family: inherit;
  text-align: center;
}
.rueckfrage[open] { animation: rueckfrage-auf .22s var(--ease); }
.rueckfrage::backdrop { background: rgba(31, 53, 96, .45); }
@keyframes rueckfrage-auf { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.rueckfrage .rf-icon { font-size: 44px; color: var(--ink-weich); }
.rueckfrage h2 { margin: 6px 0 8px; font-size: 1.8rem; font-weight: normal; }
.rueckfrage p { margin: 0 0 22px; font-size: 1.25rem; color: var(--ink-weich); line-height: 1.35; }
.rueckfrage .rf-knoepfe { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.rueckfrage .rf-bleiben { font-size: 1.6rem; padding: 14px 36px; min-height: 72px; width: 100%; justify-content: center; }
.rueckfrage .rf-bleiben .ico { font-size: 30px; }
.rueckfrage .rf-abmelden { font-size: 1.1rem; padding: 6px 18px; min-height: 48px; color: var(--ink-weich); border-width: 2px; box-shadow: var(--sh-1); }
.rueckfrage .rf-abmelden:hover { background: var(--rot-tint); color: var(--ink); }
.rueckfrage .pillbtn:focus-visible { outline: none; box-shadow: var(--sockel), var(--fokus); }

.pillbtn {
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff 0%, var(--papier) 100%);
  font-family: inherit;
  font-size: 1.3rem;
  padding: 6px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--sockel), var(--sh-1);
  color: var(--ink);
  cursor: pointer;
}
.pillbtn:hover { background: var(--gelb-tint); transform: translateY(-1px); }
.pillbtn:active { transform: translateY(2px); box-shadow: var(--sockel-gedrueckt); }
.pillbtn.gruen { background: var(--gruen-tint); }
.pillbtn.aktiv { background: var(--gruen-tint); border-color: var(--gruen); color: #2f5a1c; box-shadow: inset 0 0 0 2px var(--gruen), var(--sh-1); }
.zahlenraum-wahl { display: flex; gap: 14px; justify-content: center; margin-top: 32px; }
.zahlenraum-wahl .pillbtn { min-width: 100px; min-height: 64px; justify-content: center; font-size: 2rem; }
/* Kompakt in der Kopfleiste der Aufgaben */
.zahlenraum-wahl.klein { gap: 6px; margin: 0; }
.zahlenraum-wahl.klein .pillbtn { min-width: 0; min-height: 40px; padding: 4px 12px; font-size: 1.2rem; }
@media (max-width: 600px) { .zahlenraum-wahl.klein .pillbtn { min-height: 36px; padding: 2px 8px; font-size: 1.05rem; } }

.badge-tile {
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--gelb-tint);
  box-shadow: var(--sh-1);
  font-size: 1.5rem;
  line-height: 1;
  padding: 8px 18px;
  flex: none;
}
.badge-tile.blau { background: var(--blau-tint); }
.badge-tile.rot { background: var(--rot-tint); }
.badge-uhr { width: 1.5rem; height: 1.5rem; display: block; }
/* Auf Inhaltsseiten führt das Abzeichen zurück zur Übersicht des Bausteins */
a.badge-tile { color: var(--ink); text-decoration: none; cursor: pointer; transition: transform .14s var(--ease), box-shadow .14s var(--ease); }
a.badge-tile:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
a.badge-tile:active { transform: translateY(1px); box-shadow: none; }

/* ---------- Kacheln ---------- */
/* Jede Kachel trägt ihre Fachfarbe als Verlauf, Sockel und weiches Leuchten
   hinter dem Motiv. Die Farben kommen aus .tile-gelb/-blau/-rot/-gruen. */

.tile {
  --tint: var(--gelb-tint);
  --tile-sockel: var(--gelb-sockel);
  --glow: var(--gelb-glow);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, #fffefa 0%, var(--tint) 78%);
  box-shadow: inset 0 -7px 0 var(--tile-sockel), inset 0 2px 0 rgba(255, 255, 255, .9), var(--sh-2);
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-bottom: 7px;
  text-decoration: none;
  color: var(--ink);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.tile::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 46%;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 68%);
  transform: translate(-50%, -50%);
  transition: transform .4s var(--ease);
}
.tile:hover { transform: translateY(-5px); color: var(--ink); box-shadow: inset 0 -7px 0 var(--tile-sockel), inset 0 2px 0 rgba(255, 255, 255, .9), var(--sh-3); }
.tile:hover::before { transform: translate(-50%, -50%) scale(1.15); }
.tile:active { transform: translateY(1px); box-shadow: inset 0 -3px 0 var(--tile-sockel), var(--sh-1); }
.tile:focus-visible { box-shadow: inset 0 -7px 0 var(--tile-sockel), var(--fokus), var(--sh-2); }
.tile .glyph { font-size: 4rem; line-height: 1; }
.tile .tile-ic { width: 96px; height: 96px; }
.tile .untertitel { font-size: 1.2rem; color: var(--ink-leise); }
.tile-gelb { --tint: var(--gelb-tint); --tile-sockel: var(--gelb-sockel); --glow: var(--gelb-glow); }
.tile-blau { --tint: var(--blau-tint); --tile-sockel: var(--blau-sockel); --glow: var(--blau-glow); }
.tile-rot { --tint: var(--rot-tint); --tile-sockel: var(--rot-sockel); --glow: var(--rot-glow); }
.tile-gruen { --tint: var(--gruen-tint); --tile-sockel: var(--gruen-sockel); --glow: var(--gruen-glow); }

/* Motiv einer Kachel; mit generiertem Bild (data-bild) ersetzt das Bild den
   gezeichneten Inhalt. */
.tile-motiv { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.tile-motiv.mit-medien { width: 100%; height: 100%; position: absolute; inset: 0 0 7px; }
.tile-motiv .medien { width: 100%; height: 100%; object-fit: cover; }

.platzhalter {
  border: 3px dashed rgba(120, 110, 90, 0.5);
  border-radius: var(--r-m);
  color: #94957e;
  font-size: 1.3rem;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Buchstaben: Erkunden ---------- */

#buchstaben-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 14px;
}
.letter-tile {
  font-family: inherit;
  font-size: 2rem;
  border: 3px solid var(--ink);
  border-radius: var(--r-m);
  background: linear-gradient(180deg, #fff 0%, var(--papier) 100%);
  box-shadow: var(--sockel), var(--sh-1);
  min-height: 88px;
  color: var(--ink);
  cursor: pointer;
}
.letter-tile:hover { background: var(--gelb-tint); transform: translateY(-2px); }
.letter-tile:active { transform: translateY(2px); box-shadow: var(--sockel-gedrueckt), 0 1px 2px rgba(31, 53, 96, .2); }
.letter-tile:focus-visible { box-shadow: var(--sockel), var(--fokus); }
.letter-tile .ico { font-size: 32px; vertical-align: middle; }
.letter-tile.big { font-size: 4rem; min-height: 160px; border-radius: var(--r-xl); }
.letter-tile.richtig { background: var(--gruen-tint); border-color: var(--gruen); color: #2f5a1c; box-shadow: inset 0 0 0 2px var(--gruen), var(--sh-2); }

/* Groß- und Kleinbuchstabe in der Lineatur (drei Etagen) */
.modal-lineatur { position: relative; width: min(300px, 70vw); aspect-ratio: 2 / 1; border-radius: var(--r-s); overflow: hidden; border: 2px solid var(--ink); }

/* ---------- Buchstaben: Schreiben ---------- */

.trace-wrap { max-width: 760px; display: flex; gap: 18px; align-items: stretch; }
.trace-stage {
  position: relative;
  flex: 1;
  height: min(62vh, 520px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.trace-guide-box {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.trace-letter-el { user-select: none; pointer-events: none; }
.trace-canvas-el { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
/* Geschriebenes blendet nach einer Pause aus (initTrace mit fadeAfter) */
.trace-canvas-el { transition: opacity .8s ease; }
.trace-canvas-el.ausblenden { opacity: 0; }
.trace-tools { display: flex; flex-direction: column; gap: 14px; justify-content: center; }
/* Schreibfläche mit Pfeilen rechts daneben, die Auswahlleiste darunter nur
   unter der Fläche zentriert (Grid; .trace-spalte gruppiert nur im HTML) */
.trace-wrap.mit-spalte {
  display: grid; width: 100%;
  grid-template-columns: minmax(0, 1fr) auto; column-gap: 18px;
}
.trace-spalte { display: contents; }
.mit-spalte .trace-stage { grid-column: 1; grid-row: 1; }
.mit-spalte .trace-tools { grid-column: 2; grid-row: 1; }
.mit-spalte .strip-nav { grid-column: 1; grid-row: 2; }
@media (max-width: 576px) {
  .trace-wrap { flex-direction: column; }
  .trace-stage { flex: none; } /* sonst kollabiert die Höhe im Spalten-Layout auf 0 */
  .trace-tools { flex-direction: row; justify-content: center; }
  /* Am Handy: Fläche, dann Pfeile, dann Auswahl */
  .trace-wrap.mit-spalte { grid-template-columns: minmax(0, 1fr); row-gap: 18px; }
  .mit-spalte .trace-tools { grid-column: 1; grid-row: 2; }
  .mit-spalte .strip-nav { grid-row: 3; margin-top: 0; }
}

/* Buchstaben in der Lineatur (js/schrift.js): drei Ebenen übereinander —
   Linien mit den drei Etagen, hohler Buchstabe wie im Lernheft (Rand, helle
   Füllung, Punktlinie in der Mitte) und die Führung (Startpunkte, Pfeile,
   Nummern) neben dem Buchstaben. */
.lineatur-ebene { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.etage { stroke: none; }
.etage-dach { fill: #e3ecf8; }
.etage-wohnung { fill: #fffefa; }
.etage-keller { fill: #e6f0d8; }
.lineatur-linie { stroke: var(--ink); stroke-width: .8; opacity: .7; }
.lineatur-linie.grundlinie { stroke-width: 1.2; opacity: .85; }
.schrift-spur path, .schrift-tinte path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.schrift-spur .spur-rand { stroke: var(--ink); stroke-width: 9; }
.schrift-spur .spur-innen { stroke: #fff; stroke-width: 7.4; }
.schrift-spur .spur-mitte { stroke: #b3ab9b; stroke-width: 1.1; stroke-dasharray: 0 2.6; }
.schrift-spur .punkt-rand { fill: var(--ink); transform-box: fill-box; transform-origin: center; transform: scale(1.25); }
.schrift-spur .punkt-innen { fill: #fff; }
.schrift-tinte .spur-innen { stroke: var(--ink); stroke-width: 3.2; }
.schrift-tinte .punkt-innen { fill: var(--ink); transform-box: fill-box; transform-origin: center; transform: scale(.55); }
.fuehrungs-pfeil { fill: none; stroke: var(--blau); stroke-width: 1; stroke-dasharray: 3 2; stroke-linecap: round; }
.pfeilspitze { fill: var(--blau); }
.startpunkt { fill: var(--ink); }
.mess-pfad { fill: none; stroke: none; }

/* ---------- Rätsel ---------- */

#quiz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  max-width: 640px;
  margin: 0 auto;
}

/* ---------- Zahlen ---------- */

.zahl-karte {
  width: min(38vw, 220px);
  height: min(42vw, 240px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: min(24vw, 9rem);
  background: linear-gradient(180deg, #fff 0%, var(--blau-tint) 85%);
}
.eier-feld { display: flex; flex-wrap: wrap; gap: 12px; max-width: 300px; align-content: center; justify-content: center; }
.egg {
  width: 44px;
  height: 56px;
  border: 3px solid var(--ink);
  background: radial-gradient(ellipse at 35% 28%, #fff 0 18%, var(--papier) 60%);
  border-radius: 50% 50% 50% 50% / 60% 60% 42% 42%;
  box-shadow: var(--sh-1);
  padding: 0;
  cursor: pointer;
}
.egg:hover { background: var(--gelb-tint); }
.egg.voll { background: radial-gradient(ellipse at 35% 28%, #d6ecb6 0 16%, var(--hellgruen) 62%); }

/* Zahlen schreiben: Hartmuts Feuerdrachen-Eier (SVG im Knopf) unter der Fläche.
   Noch nicht gezählte Eier schlummern blass, gezählte leuchten feurig. */
.mit-eiern .eier-feld { grid-column: 1; grid-row: 2; max-width: none; min-height: 64px; }
.mit-eiern .strip-nav { grid-row: 3; }
/* Zeilenumbruch nach dem 4. Ei; der negative Rand hebt die zusätzliche Lücke der leeren Zeile auf */
.eier-umbruch { flex-basis: 100%; height: 0; margin-top: -12px; }
.eier-feld .egg {
  width: 48px; height: 61px; border: none; border-radius: 0; background: none; box-shadow: none;
  filter: saturate(.35) opacity(.7) drop-shadow(0 3px 2px rgba(31, 53, 96, .18));
  transition: filter .25s ease, transform .14s var(--ease);
}
.eier-feld .egg svg { display: block; width: 100%; height: 100%; overflow: visible; }
.eier-feld .egg .ei-schale { fill: #7fb24f; }
.eier-feld .egg .ei-rand { fill: none; stroke: var(--ink); stroke-width: 2.6; }
.eier-feld .egg:hover { background: none; transform: translateY(-2px); }
.eier-feld .egg.voll {
  background: none;
  filter: drop-shadow(0 0 6px rgba(242, 140, 40, .75)) drop-shadow(0 3px 2px rgba(31, 53, 96, .18));
  animation: ei-wackel .45s var(--ease);
}
@keyframes ei-wackel { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-9deg) scale(1.08); } 65% { transform: rotate(7deg); } }
@media (max-width: 576px) {
  .mit-eiern .eier-feld { grid-row: 3; gap: 8px; }
  .mit-eiern .strip-nav { grid-row: 4; }
  .eier-feld .egg { width: 40px; height: 51px; }
}
.egg.mini { width: 15px; height: 19px; border-width: 2px; pointer-events: none; box-shadow: none; }

.zahlen-strip { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.zahlen-strip button {
  width: 46px;
  height: 48px;
  border: 2.5px solid var(--ink);
  border-radius: var(--r-s);
  background: var(--papier);
  box-shadow: inset 0 -3px 0 rgba(31, 53, 96, .09);
  font-family: inherit;
  font-size: 1.3rem;
  color: var(--ink);
  cursor: pointer;
}
.zahlen-strip button:hover { background: var(--gelb-tint); }
.zahlen-strip button.aktiv { background: var(--blau-tint); border-color: var(--blau); box-shadow: inset 0 0 0 1.5px var(--blau); }

/* Bildkacheln (SVG) für wortlose Übersichtsseiten, Raster siehe .hub-grid.bilder */
.tile .tile-bild { width: 112px; height: 112px; filter: drop-shadow(0 3px 2px rgba(31, 53, 96, .12)); }
.tile-bild text { font-family: "Patrick Hand", cursive; fill: var(--ink); }

/* Stellenwerte: alles in Blau, deutlich abgestufte Helligkeit (Rot wirkte
   wie ein Fehler): Einer dunkle Tinte, Zehner mittleres Blau, Hunderter hell */
.stelle { display: inline-block; width: .62em; text-align: center; }
.stelle.tausender { color: #8cc0f2; }
.stelle.hunderter { color: #5aa5f0; }
.stelle.zehner { color: #2a6fc9; }

.tafel { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; max-width: 760px; margin: 0 auto; }
.tafel-zelle {
  font-family: inherit;
  font-size: clamp(.95rem, 3.3vw, 1.8rem);   /* Platz für drei Stellen */
  color: var(--ink);
  background: var(--papier);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-s);
  box-shadow: inset 0 -3px 0 rgba(31, 53, 96, .09);
  padding: 6px 0;
  display: flex;
  justify-content: center;
  cursor: pointer;
}
.tafel-zelle:hover, .tafel-zelle.gehoert { background: var(--gelb-tint); }
.tafel-zelle.neu { animation: tafel-neu .4s var(--ease); }
@keyframes tafel-neu { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 600px) { .tafel { gap: 3px; } .tafel-zelle { border-width: 2px; border-radius: 7px; } }
.tafel.vier .tafel-zelle { font-size: clamp(.75rem, 2.6vw, 1.45rem); }   /* bis 1000: vier Stellen */

/* Vergleichen: Balken-Symbol oben zeigt, ob die größte oder kleinste Zahl gesucht ist */
.cue-svg { width: 54px; height: 54px; flex: none; }

/* Vergleichen: Zahlenstrahl mit den vier Vorschlägen */
.vergleich-strahl { display: block; width: min(100%, 760px); height: auto; margin: 0 auto 18px; overflow: visible; }
.vergleich-strahl .vs-linie { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.vergleich-strahl .vs-strich { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; opacity: .55; }
.vergleich-strahl .vs-strich.zehner { stroke-width: 5; opacity: 1; }
.vergleich-strahl text { font-family: "Patrick Hand", cursive; text-anchor: middle; fill: var(--ink); }
.vergleich-strahl .vs-zehner { font-size: 34px; opacity: .7; }
.vergleich-strahl .vs-faden { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 4 5; opacity: .45; }
.vergleich-strahl .vs-marke circle { fill: #f2c14e; stroke: var(--ink); stroke-width: 3; }
.vergleich-strahl .vs-marke text { font-size: 40px; }
.vergleich-strahl .vs-marke.richtig circle { fill: var(--gruen); }
.vergleich-liste { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.letter-tile.vergleich { width: 200px; min-height: 0; font-size: 3rem; padding: 2px 0; display: flex; justify-content: center; }

/* Mengen */
.mengen-feld { width: min(100%, 320px); height: auto; display: block; margin: 0 auto 22px; background: var(--papier); border: 3px solid var(--ink); border-radius: var(--r-l); box-shadow: var(--sh-2); }
.zahlen-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; max-width: 520px; margin: 0 auto; }
.zahlen-pad .letter-tile { font-size: 2.2rem; min-height: 64px; }

/* Rechnen */
.rechen-aufgabe { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: clamp(2.4rem, 9vw, 3.6rem); margin: 14px 0 26px; font-variant-numeric: tabular-nums; }
.rechen-eingabe {
  min-width: 2.2em;
  min-height: 1.3em;
  border: 3px dashed var(--ink-weich);
  border-radius: var(--r-m);
  background: rgba(255, 253, 247, .7);
  display: inline-flex;
  justify-content: center;
  transition: background-color .2s ease, border-color .2s ease;
}
.rechen-eingabe.voll { border-style: solid; border-color: var(--ink); background: var(--blau-tint); box-shadow: var(--sh-1); }
.ziffern-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 312px; margin: 0 auto; }
.ziffern-pad .letter-tile { font-size: 2.2rem; min-height: 68px; }
.ziffern-pad .letter-tile.gruen { background: linear-gradient(180deg, #f4f9ee 0%, var(--gruen-tint) 100%); color: #2f5a1c; }

/* ---------- Uhr ---------- */

.clock-wrap { max-width: 340px; width: 100%; }
.clock-svg { width: 100%; height: auto; touch-action: none; cursor: grab; filter: drop-shadow(0 10px 14px rgba(31, 53, 96, .22)); }
.clock-svg { user-select: none; -webkit-user-select: none; }
.clock-num { font-family: "Patrick Hand", cursive; font-size: 22px; fill: var(--ink); pointer-events: none; }
.digital {
  border: 3px solid var(--ink);
  border-radius: var(--r-l);
  background: linear-gradient(180deg, #fff 0%, var(--blau-tint) 90%);
  box-shadow: var(--sh-2);
  font-size: 3rem;
  font-variant-numeric: tabular-nums;
  padding: 4px 28px;
  letter-spacing: 3px;
  cursor: pointer;
}
.digital.ziel { border-style: dashed; background: var(--papier); color: var(--ink); cursor: pointer; box-shadow: none; }
/* Erkunden und Stellen gleich aufgebaut: analoge Uhr links, digitale rechts
   daneben (auch am Handy); beim Stellen Ton oben, Prüfen unten mittig */
.uhr-buehne { display: flex; gap: 32px; align-items: center; justify-content: center; margin-top: 16px; }
.uhr-buehne .clock-wrap { flex: 0 1 340px; min-width: 0; }
.uhr-buehne .digital { flex: none; }
.uhr-fuss { display: flex; justify-content: center; margin-top: 24px; }
@media (max-width: 600px) {
  .uhr-buehne { gap: 14px; }
  .uhr-buehne .digital { font-size: 2rem; padding: 4px 12px; letter-spacing: 1px; }
}
.check-btn { width: 88px; height: 88px; font-size: 2.6rem; border-radius: 50%; }
.check-btn .ico { font-size: 42px; }

/* ============================================================
   App-Ergänzungen (Prototyp): Layout, Modal, Konfetti
   ============================================================ */

* { box-sizing: border-box; }
body { margin: 0; padding-bottom: 40px; }
main { max-width: 960px; margin: 0 auto; padding: 8px 24px 48px; position: relative; }
@media (max-width: 600px) { main { padding: 6px 16px 40px; } }

.zurueck { text-decoration: none; }

.tiles-grid, .hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  margin-top: 28px;
}
.tiles-grid .tile, .hub-grid .tile { min-height: 220px; }
.tile .tile-svg { width: 92px; height: 92px; filter: drop-shadow(0 3px 2px rgba(31, 53, 96, .12)); }

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(31, 40, 60, 0.38);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: einblenden .2s ease;
}
.sk-modal {
  border: 3px solid var(--ink);
  border-radius: var(--r-xl);
  font-family: "Patrick Hand", cursive;
  background: linear-gradient(180deg, #fffdf6 0%, var(--gelb-tint) 100%);
  padding: 32px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: var(--sh-3);
  cursor: pointer;
  animation: modal-auf .35s var(--ease);
}
@keyframes einblenden { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-auf { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }

.confetti-piece {
  position: fixed;
  width: var(--sz, 16px);
  height: var(--sz, 16px);
  border-radius: 4px;
  pointer-events: none;
  animation-name: confetti-fall;
  animation-timing-function: cubic-bezier(.15, .6, .4, 1);
  animation-fill-mode: forwards;
  z-index: 9999;
}
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translate(var(--dx), 100vh) rotate(var(--rot, 360deg)); opacity: 0; }
}

.raetsel-frage { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 12px 0 28px; flex-wrap: wrap; }
/* Über der Schreibfläche: weniger Abstand, damit die Fläche groß bleibt */
.raetsel-frage.eng { margin: 4px 0 10px; }

.trace-stage { background: #f6f2e8; border: 3px solid var(--ink); border-radius: var(--r-l); box-shadow: var(--sh-2); position: relative; }
.trace-nav { display: flex; justify-content: space-between; max-width: 760px; margin: 18px auto 0; }

.stroke-num-bg { fill: #fff; stroke: var(--blau); stroke-width: 1.2; }
.stroke-num-text { font: 700 6px ui-monospace, Menlo, monospace; fill: var(--blau); text-anchor: middle; dominant-baseline: central; }

.strip-nav { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; margin-top: 22px; }
.strip-nav button {
  width: 33px; height: 36px; border: 2px solid var(--ink); border-radius: 8px;
  background: var(--papier); box-shadow: inset 0 -2px 0 rgba(31, 53, 96, .09);
  font-family: inherit; font-size: .95rem; color: var(--ink); cursor: pointer;
}
.strip-nav button:hover { background: var(--gelb-tint); }
.strip-nav button.aktiv { background: var(--ink); color: var(--papier); box-shadow: var(--sh-1); }
/* Feste Spaltenzahl, damit die Reihen gleich lang sind statt eines kurzen Rests */
.strip-nav.raster { display: grid; grid-template-columns: repeat(var(--spalten), 33px); justify-content: center; }
@media (max-width: 576px) {
  .strip-nav.raster { grid-template-columns: repeat(var(--spalten-schmal), minmax(0, 33px)); }
  .strip-nav.raster button { width: auto; }
}

.hub-desc { color: var(--ink-weich); font-size: 1rem; text-align: center; margin-top: -14px; }

/* ============================================================
   Startseite: Hartmut im Medaillon, Begrüßung, Fächer
   ============================================================ */

.held {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin: 4px auto 0;
  flex-wrap: wrap;
}
.held-figur {
  position: relative;
  width: 148px;
  aspect-ratio: 1;
  flex: none;
  border: 3px solid var(--ink);
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 38%, #fffdf3 0%, #f3e6c4 72%);
  box-shadow: inset 0 0 0 5px rgba(255, 253, 247, .9), inset 0 0 0 7px rgba(31, 53, 96, .2), var(--sh-2);
  cursor: pointer;
}
.held-figur .hartmut { position: absolute; left: 50%; bottom: 6%; width: 72%; transform: translateX(-50%); }
.held-figur .hartmut.jubel { animation-name: jubel-mitte; }
@keyframes jubel-mitte {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translateX(-50%) translateY(-12px) rotate(-6deg); }
  55% { transform: translateX(-50%) translateY(-4px) rotate(5deg); }
}
/* Reaktionen beim Antippen (app.js, hartmutReagiert). --ht-basis hält die
   Grundposition: im Porträt der Startseite ist Hartmut mit translateX(-50%) zentriert. */
.hartmut { --ht-basis: translateX(0); transform-origin: 50% 100%; }
.held-figur .hartmut { --ht-basis: translateX(-50%); }
.antippbar { cursor: pointer; }
.hartmut.ht-winken { animation: ht-winken 1.3s var(--ease); }
.hartmut.ht-huepfen { animation: ht-huepfen .9s var(--ease); }
.hartmut.ht-lachen { animation: ht-lachen 1s ease-in-out; }
.hartmut.ht-drehen { animation: ht-drehen 1s var(--ease); }
@keyframes ht-winken {
  0%, 100% { transform: var(--ht-basis) rotate(0); }
  15% { transform: var(--ht-basis) rotate(-10deg); }
  32% { transform: var(--ht-basis) rotate(9deg); }
  50% { transform: var(--ht-basis) rotate(-8deg); }
  68% { transform: var(--ht-basis) rotate(6deg); }
  84% { transform: var(--ht-basis) rotate(-3deg); }
}
@keyframes ht-huepfen {
  0%, 100% { transform: var(--ht-basis); }
  25% { transform: var(--ht-basis) translateY(-12px) rotate(-6deg); }
  55% { transform: var(--ht-basis) translateY(-4px) rotate(5deg); }
}
@keyframes ht-lachen {
  0%, 100% { transform: var(--ht-basis) scale(1, 1); }
  12%, 37%, 62% { transform: var(--ht-basis) translateY(-4px) scale(.96, 1.05); }
  25%, 50%, 75% { transform: var(--ht-basis) scale(1.06, .93); }
}
@keyframes ht-drehen {
  0% { transform: var(--ht-basis) rotateY(0); }
  100% { transform: var(--ht-basis) rotateY(360deg); }
}
.held-figur .medien { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Titel neben Hartmut, vertikal mittig, ohne Zierlinie */
.held-text { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.held-text .titel { margin: 0; text-align: left; }
.held-text .titel::after { display: none; }
@media (max-width: 600px) {
  .held { gap: 14px; flex-wrap: nowrap; }
  .held-figur { width: 104px; }
  .held-text .titel { font-size: 1.75rem; }
}
.tiles-grid .tile .glyph { font-size: 4.6rem; }
.tiles-grid .tile .tile-svg { width: 104px; height: 104px; }
/* Am Handy alle drei Fächer nebeneinander, ohne Scrollen sichtbar */
@media (max-width: 600px) {
  .tiles-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
  .tiles-grid .tile { min-height: 132px; border-radius: var(--r-l); }
  .tiles-grid .tile .glyph { font-size: 2.7rem; }
  .tiles-grid .tile .tile-svg { width: 66px; height: 66px; }
}

/* ============================================================
   Buchstaben: Bildwörter, Anfangsbuchstabe, Lesen
   ============================================================ */

/* Kacheln ohne Worte: das Bild erklärt die Aktivität */
/* Baustein-Übersichten: Flex statt Grid, damit eine unvollständige letzte
   Reihe mittig steht. Höchstens vier Kacheln je Reihe (weniger, wenn es
   weniger gibt), am Handy zwei. */
.hub-grid.bilder { --spalten: 4; display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
.hub-grid.bilder:has(> .tile:nth-child(3):last-child) { --spalten: 3; }
.hub-grid.bilder:has(> .tile:nth-child(2):last-child) { --spalten: 2; }
.hub-grid.bilder > .tile { flex: 0 0 calc((100% - (var(--spalten) - 1) * 20px) / var(--spalten)); min-width: 0; }
@media (max-width: 576px) { .hub-grid.bilder { --spalten: 2; } .hub-grid.bilder:has(> .tile:nth-child(3):last-child) { --spalten: 2; } }
.hub-grid.bilder .tile { min-height: 184px; }
.tile .tile-emoji { font-size: 3.6rem; line-height: 1; }
.tile .tile-reihe { display: flex; align-items: center; gap: 8px; }
.hub-grid.bilder .tile-reihe .glyph { font-size: 3.4rem; }
.hub-grid.bilder .tile-reihe .tile-emoji { font-size: 3rem; }
.hub-grid.bilder .tile-reihe .tile-pfeil { font-size: 2.2rem; }
.tile .tile-pfeil { font-size: 2.6rem; color: var(--ink-leise); }
.tile .ico { font-size: 52px; color: var(--ink-weich); }
.tile .tile-stift { width: 48px; height: 80px; }

.bild-emoji { font-size: 5rem; line-height: 1.1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.bild-svg { width: 5.5rem; height: 5.5rem; }
.bild-emoji.gross { font-size: clamp(5rem, 22vw, 8rem); }
.bild-svg.gross { width: clamp(6rem, 26vw, 9rem); height: clamp(6rem, 26vw, 9rem); }

.karte {
  border: 3px solid var(--ink);
  border-radius: var(--r-xl);
  background: var(--papier);
  box-shadow: var(--sh-2);
  min-width: min(70vw, 260px);
  min-height: 200px;
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
}
.karte.gelb { background: linear-gradient(180deg, #fffdf6 0%, var(--gelb-tint) 90%); }
.karte .karte-buchstabe { font-size: clamp(6rem, 26vw, 9rem); line-height: 1; }
.buehne { display: flex; flex-direction: column; align-items: center; gap: 24px; margin-top: 20px; }

.antworten { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; max-width: 600px; }
.antworten .letter-tile.big { min-height: 130px; }
.bild-tile {
  border: 3px solid var(--ink);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, #fff 0%, var(--papier) 100%);
  box-shadow: var(--sockel), var(--sh-1);
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  cursor: pointer;
  transition: transform .14s var(--ease), box-shadow .14s var(--ease);
}
.bild-tile:hover { background: var(--gelb-tint); transform: translateY(-2px); }
.bild-tile:active { transform: translateY(2px); box-shadow: var(--sockel-gedrueckt); }
.bild-tile.richtig { background: var(--gruen-tint); border-color: var(--gruen); box-shadow: inset 0 0 0 2px var(--gruen), var(--sh-2); }
.bild-tile .bild-emoji { font-size: clamp(3.4rem, 13vw, 5rem); }

.icon-zeile { display: flex; gap: 16px; justify-content: center; align-items: center; flex-wrap: wrap; }
.iconbtn.gross { width: 80px; height: 80px; font-size: 2.3rem; border-radius: var(--r-l); }
.iconbtn.gross .ico { font-size: 38px; }


/* Lesen: Silben abwechselnd blau und rot (Silbenmethode) */
.lesewort { font-size: clamp(3.2rem, 13vw, 6.5rem); line-height: 1.1; text-align: center; letter-spacing: 1px; white-space: nowrap; }
.lesewort .silbe:nth-child(4n+1) { color: #2a5fb0; }
.lesewort .silbe:nth-child(4n+3) { color: #c2412f; }
.lesewort .trenn { color: #b8b2a2; padding: 0 2px; }
.bild-verdeckt { font-size: 4.5rem; color: #b8b2a2; }

.stufen { display: flex; gap: 10px; justify-content: center; }
.stufen .pillbtn { min-width: 76px; min-height: 50px; justify-content: center; gap: 6px; }
.stufen .punkt { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); display: inline-block; }
.stufen .pillbtn.aktiv .punkt { background: var(--gruen); }
.stufen .pillbtn .ico { font-size: 24px; }
.stufen .pillbtn .ico + .ico { margin-left: -4px; }
.buehne #quiz-grid { width: 100%; }

/* ---------- Serviceportal des Amts (Landingpage aus dem Drachenbrief und Login) ----------
   Nimmt Kennungen und Ton des Briefs auf (weihnachten/brief.html), damit sich beide Seiten als
   Fortsetzung anfühlen. Die Login-Seite rendert der Server (adapter-in-web, templates/login.html). */
.portal { max-width: 620px; padding-top: 22px; }

.amt { text-align: center; margin-bottom: 6px; }
.amt .amt-name { font-size: clamp(1.15rem, 3.6vw, 1.45rem); line-height: 1.2; }
.amt .amt-sub { font-size: 1rem; opacity: .75; letter-spacing: .04em; }

.portal .titel { text-align: center; margin: 14px 0 6px; line-height: 1.1; }

.akte {
  background: var(--gelb-tint);
  padding: 14px 20px;
  margin: 18px 0;
  font-size: 1.15rem;
}
.akte dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; margin: 0; }
.akte dt { opacity: .75; white-space: nowrap; }
.akte dd { margin: 0; }
.stempel {
  display: inline-block;
  margin-top: 10px;
  padding: 0 10px;
  border: 2.5px solid var(--gruen);
  border-radius: 8px;
  color: var(--gruen);
  transform: rotate(-3deg);
  font-size: 1.1rem;
}

.figuren { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 6px 0 4px; }
/* Beide SVGs haben dieselbe Zeichenfläche (200×200), gleiche Breite = gleich groß */
.figuren .hartmut, .figuren .cleo { width: 110px; height: auto; }

.portal .text { font-size: 1.25rem; line-height: 1.4; }

.code-box { background: #fff; padding: 18px 20px 20px; margin-top: 18px; }
.code-box label { display: block; font-size: 1.4rem; }
.code-box label + .code-row, .code-box .code-row + label { margin-top: 10px; }
.code-box .hinweis { font-size: 1.05rem; opacity: .8; margin: 2px 0 12px; line-height: 1.3; }
.code-row { display: flex; gap: 10px; flex-wrap: wrap; }
.code-row input {
  flex: 1 1 200px;
  min-width: 0;
  font-family: inherit;
  font-size: 1.4rem;
  color: var(--ink);
  padding: 8px 14px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--gelb-tint);
}
.code-row input:focus { outline: 3px solid var(--hellgruen); outline-offset: 1px; }
.code-row .pillbtn { flex: 1 0 auto; justify-content: center; font-size: 1.4rem; min-height: 54px; }
.code-box .fehler {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--rot-tint);
  border: 2px solid var(--rot);
  font-size: 1.15rem;
}
.code-box .erfolg { margin: 12px 0 0; font-size: 1.25rem; color: var(--gruen); }

.fusszeile { text-align: center; font-size: .95rem; opacity: .65; margin-top: 22px; }

/* Weniger Bewegung, wenn das Gerät darum bittet */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .confetti-piece { display: none; }
}
