/* Nelo – der kleine Elefant · Grundlagen
   Eine Schrift (Google Sans Flex, ganz rund, OFL), Farben aus den Kulissen der Serie.
   Bewegung: Aufkleber landen mit Nachfedern (token-federnd-verspielt),
   Menüs und Dialoge öffnen weich und schließen schneller (token-toggle-asymmetrisch). */

@font-face {
  font-family: "Nelo Rund";
  src: url("../fonts/nelo-rund.woff2") format("woff2");
  font-weight: 400 900;
  font-stretch: 100% 125%;
  font-display: swap;
}

:root {
  /* Farben: jede Wandfarbe einer Kulisse ist eine ganze Fläche */
  --minze: #9fd8c1;
  --himmel: #a6cceb;
  --rose: #f5b9c0;
  --sonne: #f8d474;
  --flieder: #cbb9eb;
  --holz: #d8a36f;
  --holz-dunkel: #b9844f;
  --nacht: #24264a;          /* Schrift, 8:1 bis 10:1 auf allen Pastellen */
  --nacht-weich: #3b3e6b;
  --papier: #fffdf8;         /* weißer Stanzrand */
  --koralle: #f07e62;        /* nur der Haupt-Knopf, Schrift darauf Nachtblau (5,4:1) */
  --koralle-tief: #c9583f;
  --wand: var(--himmel);

  /* Schrift */
  --schrift: "Nelo Rund", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --text: 1.125rem;
  --text-klein: 1rem;
  --zeile: 1.55;
  --mass: 62ch;
  --h1: clamp(2.6rem, 1.3rem + 5.2vw, 6.25rem);
  --h2: clamp(2rem, 1.25rem + 2.8vw, 3.75rem);
  --h3: 1.375rem;

  /* Raum */
  --r1: 4px; --r2: 8px; --r3: 14px; --r4: 22px; --r5: 34px; --r6: 52px; --r7: 80px; --r8: 120px;
  --rand: clamp(18px, 4.5vw, 64px);
  --breite: 1320px;

  /* Aufkleber */
  --stanz: clamp(5px, 0.55vw, 8px);
  --schatten: 0 0.45rem 0.9rem rgba(36, 38, 74, 0.2), 0 1px 2px rgba(36, 38, 74, 0.12);
  --schatten-hoch: 0 1.1rem 1.6rem rgba(36, 38, 74, 0.24), 0 2px 3px rgba(36, 38, 74, 0.12);
  --radius: 22px;
  --radius-klein: 14px;

  /* Bewegung */
  --feder: linear(0.000, 0.016, 0.059, 0.120, 0.194, 0.275, 0.359, 0.443, 0.524, 0.601, 0.672, 0.736, 0.793, 0.843, 0.886, 0.922, 0.952, 0.977, 0.996, 1.011, 1.022, 1.030, 1.035, 1.037, 1.038, 1.038, 1.036, 1.034, 1.031, 1.028, 1.025, 1.022, 1.019, 1.016, 1.013, 1.010, 1.008, 1.006, 1.005, 1.003, 1.000);  /* sanfte Feder, ca. 4 % Überschwingen, kein Nachzittern */
  --hops: cubic-bezier(0.3, 1.15, 0.5, 1);
  --aus: cubic-bezier(0.16, 1, 0.3, 1);
  --ein: cubic-bezier(0.7, 0, 0.84, 0);
  --d-kurz: 180ms;
  --d-mittel: 440ms;
  --d-lang: 900ms;

  --fokus: 3px solid var(--nacht);
  color-scheme: light;
}

@supports not (transition-timing-function: linear(0, 1)) {
  :root { --feder: var(--hops); }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  font-family: var(--schrift);
  font-size: var(--text);
  line-height: var(--zeile);
  font-weight: 450;
  color: var(--nacht);
  background: var(--wand);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
h1, h2 { font-weight: 800; font-stretch: 100%; line-height: 1.02; letter-spacing: -0.012em; text-wrap: balance; }
h1 { font-size: var(--h1); }
h2 { font-size: var(--h2); }
h3 { font-size: var(--h3); font-weight: 750; line-height: 1.2; text-wrap: balance; }
p, li { text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 0.09em; text-underline-offset: 0.18em; }
::selection { background: var(--sonne); color: var(--nacht); }
:focus-visible { outline: var(--fokus); outline-offset: 4px; border-radius: 6px; }
.dunkel :focus-visible { outline-color: var(--sonne); }
button { font: inherit; color: inherit; }
.versteckt { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.zahl { font-variant-numeric: tabular-nums; }
.name { hyphens: manual; white-space: nowrap; }

.sprung {
  position: absolute; left: var(--r3); top: -100px; z-index: 100;
  background: var(--papier); padding: var(--r3) var(--r4); border-radius: 999px;
  font-weight: 750; box-shadow: var(--schatten);
  transition: top var(--d-kurz) var(--aus);
}
.sprung:focus { top: var(--r3); }

/* ---------- Aufkleber-Schrift ---------- */
.stanz {
  -webkit-text-stroke: calc(var(--stanz) * 2.4) var(--papier);
  paint-order: stroke fill;
  filter: drop-shadow(0 0.35rem 0.5rem rgba(36, 38, 74, 0.2));
}
.stanz-zeile { display: block; }

/* ---------- Wortmarke ---------- */
.wortmarke {
  display: inline-flex; align-items: baseline;
  font-weight: 850; font-stretch: 122%; letter-spacing: -0.01em;
  font-size: clamp(2.1rem, 1.6rem + 1.6vw, 3.4rem); line-height: 1;
  text-decoration: none; white-space: nowrap;
  -webkit-text-stroke: calc(var(--stanz) * 1.9) var(--papier); paint-order: stroke fill;
  filter: drop-shadow(0 0 0.6px rgba(36, 38, 74, 0.55)) drop-shadow(0 0.3rem 0.45rem rgba(36, 38, 74, 0.22));
  view-transition-name: wortmarke;
}
.wortmarke span { display: inline-block; transition: transform var(--d-lang) var(--feder); }
.wortmarke span:nth-child(1) { color: var(--koralle); }
.wortmarke span:nth-child(2) { color: #f2c14e; }
.wortmarke span:nth-child(3) { color: #59b892; }
.wortmarke span:nth-child(4) { color: #5e96d0; }
@media (hover: hover) {
  .wortmarke:hover span:nth-child(odd) { transform: translateY(-0.06em) rotate(-3deg); }
  .wortmarke:hover span:nth-child(even) { transform: translateY(-0.03em) rotate(2deg); }
}

/* ---------- Kopf ---------- */
.kopf {
  position: relative; z-index: 20;
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--r4);
  padding: clamp(14px, 2vw, 28px) var(--rand) 0;
  max-width: calc(var(--breite) + 2 * var(--rand)); margin-inline: auto;
}
.kopf-rechts { display: flex; align-items: flex-start; gap: clamp(10px, 1.6vw, 22px); }
.rahmen-nav { display: flex; gap: clamp(10px, 2vw, 30px); list-style: none; padding: 0; }
.rahmen {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-decoration: none; font-weight: 800; font-size: clamp(0.875rem, 0.8rem + 0.35vw, 1.1rem);
  transform-origin: 50% 0;
  transition: transform var(--d-lang) var(--feder);
}
.rahmen-bild {
  width: clamp(58px, 4.5vw + 32px, 98px); aspect-ratio: 1;
  border: var(--stanz) solid var(--papier); border-radius: var(--radius-klein);
  box-shadow: var(--schatten); background: var(--papier) center / 84% no-repeat;
  display: grid; place-items: center; overflow: hidden;
}
.rahmen:nth-child(1) .rahmen-bild { rotate: -3deg; }
.rahmen:nth-child(2) .rahmen-bild { rotate: 2deg; }
.rahmen:nth-child(3) .rahmen-bild { rotate: -1.5deg; }
.rahmen[aria-current="page"] .rahmen-bild { outline: 4px solid var(--koralle); outline-offset: 3px; }
@media (hover: hover) { .rahmen:hover { transform: rotate(-2deg) translateY(-3px); } }
.rahmen:active { transform: scale(0.94); transition-duration: var(--d-kurz); }

.schalter { display: flex; gap: 8px; }
.rund-knopf {
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--papier); box-shadow: var(--schatten);
  display: grid; place-items: center;
  transition: transform var(--d-mittel) var(--feder), background-color var(--d-kurz);
}
.rund-knopf svg { width: 24px; height: 24px; }
.rund-knopf[aria-pressed="true"] { background: var(--sonne); }
@media (hover: hover) { .rund-knopf:hover { transform: scale(1.05); } }
.rund-knopf:active { transform: scale(0.9); }

@media (max-width: 600px) {
  .kopf { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 10px; align-items: start; }
  .kopf-rechts { display: contents; }
  .kopf nav { grid-column: 2; grid-row: 1 / span 2; justify-self: end; }
  .schalter { grid-column: 1; grid-row: 2; }
  .rund-knopf { width: 44px; height: 44px; }
  .wortmarke { font-size: 2rem; }
  .rahmen-nav { gap: 8px; }
  .rahmen-bild { width: 58px; }
}

/* ---------- Knöpfe ---------- */
.knopf, .knopf-zweit {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 56px; padding: 0 1.4em; border-radius: 999px; cursor: pointer;
  font-weight: 800; font-size: 1.125rem; text-decoration: none; line-height: 1.1; text-align: center;
  border: var(--stanz) solid var(--papier);
  transition: transform var(--d-mittel) var(--feder), box-shadow var(--d-mittel) var(--aus);
}
.knopf { background: var(--koralle); color: var(--nacht); box-shadow: 0 7px 0 -2px var(--koralle-tief), var(--schatten-hoch); }
.knopf-zweit { background: var(--papier); color: var(--nacht); box-shadow: var(--schatten); border-color: transparent; }
.knopf svg, .knopf-zweit svg { width: 1.2em; height: 1.2em; flex: none; }
@media (hover: hover) {
  .knopf:hover, .knopf-zweit:hover { transform: translateY(-2px); }
}
.knopf:active { transform: translateY(4px) scale(0.98); box-shadow: 0 2px 0 -1px var(--koralle-tief), var(--schatten); transition-duration: 90ms; }
.knopf-zweit:active { transform: scale(0.96); transition-duration: 90ms; }
.knopf[aria-disabled="true"], .knopf:disabled { background: #e7dfd3; box-shadow: var(--schatten); cursor: default; }

/* ---------- Bild-Aufkleber ---------- */
.aufkleber {
  border: var(--stanz) solid var(--papier); border-radius: var(--radius);
  box-shadow: var(--schatten); background: var(--papier);
  overflow: hidden;
}
.aufkleber > img, .aufkleber > video { width: 100%; height: 100%; object-fit: cover; }
.frei { filter: drop-shadow(0 0.5rem 0.7rem rgba(36, 38, 74, 0.22)); }

/* ---------- Flächen ---------- */
.flaeche { position: relative; padding: clamp(64px, 9vw, 140px) var(--rand); }
.innen { max-width: var(--breite); margin-inline: auto; }
.f-minze { background: var(--minze); }
.f-himmel { background: var(--himmel); }
.f-rose { background: var(--rose); }
.f-sonne { background: var(--sonne); }
.f-flieder { background: var(--flieder); }
.f-papier { background: var(--papier); }
.f-nacht { background: var(--nacht); color: var(--papier); }
.f-nacht a { color: var(--papier); }
.f-nacht h1, .f-nacht h2 { color: var(--nacht); }
.f-nacht .knopf, .f-nacht .knopf-zweit, .f-nacht .rund-knopf, .f-nacht .spiel-hinweis { color: var(--nacht); }

/* Boden: Holzdielen, Fußleiste darüber */
.boden {
  background: var(--holz) repeating-linear-gradient(180deg, rgba(120, 70, 30, 0.12) 0 2px, transparent 2px 64px);
}
.fussleiste { height: 14px; background: var(--papier); }

/* ---------- Leseteile ---------- */
.lesen { max-width: var(--mass); }
.lesen p + p { margin-top: 0.9em; }
.lesen h2 { margin-bottom: 0.5em; }
.lesen h3 { margin: 1.6em 0 0.4em; }
.lesen ul { padding-left: 1.2em; }
.lesen li + li { margin-top: 0.35em; }
.leise { color: var(--nacht-weich); }

/* ---------- Fuß ---------- */
.fuss { position: relative; color: var(--nacht); --fuss-luft: clamp(48px, 5.5vw, 80px); }
.fuss .fussleiste { display: none; }   /* klare Kante wie bei den anderen Abschnitten */
.fuss-boden { padding: var(--fuss-luft) var(--rand) clamp(32px, 4.5vw, 56px); }
.fuss-innen {
  max-width: var(--breite); margin-inline: auto;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--r5); align-items: end;
}
.fuss-nelo { width: clamp(180px, 22vw, 300px); align-self: start; margin-top: calc(-1 * var(--fuss-luft) - clamp(180px, 22vw, 300px) * 0.42); }
.fuss-links { display: flex; flex-wrap: wrap; gap: 6px 22px; list-style: none; padding: 0; font-weight: 700; }
.fuss-links a { text-decoration: none; display: inline-block; padding: 8px 0; }
@media (hover: hover) { .fuss-links a:hover { text-decoration: underline; } }
.fuss-klein { font-size: var(--text-klein); margin-top: var(--r3); }
.fuss-gute-nacht { font-weight: 800; font-size: clamp(1.4rem, 1rem + 1.4vw, 2.2rem); line-height: 1.1; margin-bottom: var(--r3); }
@media (max-width: 640px) {
  .fuss-innen { grid-template-columns: 1fr; }
  .fuss-nelo { order: -1; margin-top: calc(-58px - var(--fuss-luft)); margin-bottom: calc(-1 * var(--r3)); justify-self: end; width: 190px; }
}

/* ---------- Eltern-Tor ---------- */
.tor {
  border: 0; padding: 0; background: transparent; max-width: min(520px, calc(100vw - 32px));
  overflow: visible;
}
.tor::backdrop { background: rgba(36, 38, 74, 0.55); }
.tor-karte {
  background: var(--papier); border-radius: 28px; padding: clamp(24px, 4vw, 40px);
  box-shadow: var(--schatten-hoch);
}
.tor[open] .tor-karte { animation: tor-auf var(--d-lang) var(--feder) both; }
@keyframes tor-auf { from { transform: translateY(24px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.tor h2 { font-size: 1.75rem; margin-bottom: 0.4em; }
.tor-zahlen { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: var(--r4) 0; }
.tor-zahlen button {
  min-height: 56px; border-radius: 16px; border: 3px solid #e4dccf; background: #fff;
  font-weight: 800; font-size: 1.35rem; cursor: pointer; font-variant-numeric: tabular-nums;
  transition: transform var(--d-kurz) var(--aus), border-color var(--d-kurz);
}
.tor-zahlen button:hover { border-color: var(--nacht); }
.tor-zahlen button:active { transform: scale(0.94); }
.tor-falsch { animation: wackeln 380ms var(--aus); }
@keyframes wackeln { 25% { transform: translateX(-6px); } 60% { transform: translateX(4px); } }
.tor-unten { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.tor-meldung { min-height: 1.6em; font-weight: 700; }

/* ---------- Seitenwechsel ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 160ms var(--ein) both seite-weg; }
::view-transition-new(root) { animation: 520ms var(--aus) 90ms both seite-rein; }
::view-transition-group(wortmarke) { animation-duration: 600ms; animation-timing-function: var(--aus); }
@keyframes seite-weg { to { opacity: 0; transform: scale(0.985); } }
@keyframes seite-rein { from { clip-path: inset(100% 0 0 0 round 40px); transform: translateY(60px); } to { clip-path: inset(0 0 0 0 round 0); transform: none; } }

/* ---------- Bewegung ruhig ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
html.ruhig *, html.ruhig *::before, html.ruhig *::after { animation-play-state: paused !important; }

@media (forced-colors: active) {
  .stanz, .wortmarke { -webkit-text-stroke: 0; filter: none; }
  .knopf, .knopf-zweit, .rund-knopf, .aufkleber, .rahmen-bild { border: 2px solid CanvasText; }
  .rund-knopf[aria-pressed="true"] { outline: 3px solid Highlight; }
}

@media print {
  .kopf-rechts, .schalter, .zimmer-buehne, video, .tor { display: none !important; }
  body { background: #fff; }
  .flaeche { padding: 24px 0; background: #fff !important; }
}

/* Sprachwahl im Kopf: gleiche Form wie Ton und Bewegung */
.rund-knopf.sprache, .f-nacht .rund-knopf.sprache { text-decoration: none; font-weight: 800; font-size: 0.95rem; letter-spacing: 0.04em; color: var(--nacht); }
