/* Anmeldeseite: Welten (Inseln) über den Wolken, Flug ins Dorf.
   Die Bilder liegen auf einer «Bühne» im Seitenverhältnis des Originals (1672 × 941 bzw. 1672 × 810).
   Lagen in Prozent der Bühne, Längen in cqw (1cqw = 1/100 der Bühnenbreite). */

.einstieg {
  --vh: 100vh;
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  background: #9dbbd8;
  color: #fff;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}
@supports (height: 100dvh) { .einstieg { --vh: 100dvh; } }
.einstieg * { box-sizing: border-box; }
.einstieg[data-zustand="aus"] { visibility: hidden; }

.nur-vorlesen {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------ Szenen */
.szene-teil { position: absolute; inset: 0; overflow: hidden; }
.szene-teil.himmel { background: linear-gradient(180deg, #4f7fb8 0%, #9cbad6 45%, #e9eef2 100%); }
.szene-teil.dorf { visibility: hidden; background: #3d5a2a; }
.einstieg[data-zustand="dorf"] .szene-teil.himmel { visibility: hidden; }
.einstieg[data-zustand="dorf"] .szene-teil.dorf { visibility: visible; }

/* Unscharfer Grund, falls die Bühne den Bildschirm nicht ganz füllt */
.unscharf {
  position: absolute;
  inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(24px) saturate(1.1);
}
.himmel .unscharf { background-image: url("einstieg-himmel.webp?v=3"); }
.dorf .unscharf { background-image: url("einstieg-dorf.webp?v=7"); }

.kamera { position: absolute; inset: 0; }

/* Bühne: füllt den Bildschirm, aber Krone (oben) bis Knopf (unten) bleiben immer sichtbar.
   Ist das Fenster sehr breit, bleiben seitlich Ränder (unscharfer Grund). */
.buehne {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  container-type: inline-size;
  overflow: hidden;
}
.himmel .buehne {
  --b: min(max(100vw, var(--vh) * 1672 / 941), var(--vh) * 1672 / 880);
  width: var(--b);
  aspect-ratio: 1672 / 941;
  top: clamp(calc(var(--vh) - var(--b) * 941 / 1672), calc(var(--vh) / 2 - var(--b) * 440 / 1672), 0px);
}
.dorf .buehne {
  --b: min(max(100vw, var(--vh) * 1672 / 810), var(--vh) * 1672 / 660);
  width: var(--b);
  aspect-ratio: 1672 / 810;
  top: clamp(calc(var(--vh) - var(--b) * 810 / 1672), calc(var(--vh) / 2 - var(--b) * 330 / 1672), 0px);
}
@media (min-aspect-ratio: 1672/880) {
  .himmel .buehne {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
  }
}
@media (min-aspect-ratio: 1672/660) {
  .dorf .buehne {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
  }
}
/* Hochkant: Himmel ganz zeigen (Titel lesbar), oben und unten weich in den unscharfen Grund */
@media (max-aspect-ratio: 1/1) {
  .himmel .buehne {
    --b: 190vw;
    top: calc(var(--vh) / 2 - var(--b) * 470 / 1672);
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 7%, #000 93%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 7%, #000 93%, transparent 100%);
  }
}

.ebene { position: absolute; inset: 0; }
.ebene > img,
.ebene > .lage {
  position: absolute;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.hintergrund { inset: 0; width: 100%; height: 100%; }

/* ------------------------------------------------------------ Welten (schweben) */
/* Jede Welt ist dieselbe Insel. Platz und Grösse setzt einstieg.js; hier steht, wie sie je nach
   Entfernung aussieht. Beim Wechsel reist die Insel per transform an ihren neuen Platz (das Schweben
   läuft über «translate» und stört das nicht). */
.welt {
  position: absolute;
  left: 22.907%; top: 26.674%; width: 53.409%;
  pointer-events: none;
  transform-origin: 0 0;
  animation: schweben 9s ease-in-out infinite alternate;
  --hub: -0.42cqw;
}
.welt > img {
  display: block; width: 100%; height: auto;
  user-select: none; -webkit-user-drag: none;
  filter: saturate(1) contrast(1) brightness(1);
  transition: filter 0.3s ease, opacity 0.3s ease;
}
/* weiter entfernte Welten: kleiner, etwas blasser und bläulicher */
.welt.fern > img { filter: saturate(0.82) contrast(0.88) brightness(1.06); }
.welt.sehr-fern > img { filter: saturate(0.7) contrast(0.78) brightness(1.1) blur(0.3px); opacity: 0.85; }
/* Unterwegs lichtet oder verdichtet sich der Dunst so langsam, wie die Insel reist. */
.welt.unterwegs { will-change: transform; }
.welt.unterwegs > img { transition-duration: 2.8s; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }

/* Anklickbare Fläche einer Welt hinten. Steht vor Bild und Name, damit Zeigen und Fokus beide erreichen. */
.welt-knopf {
  position: absolute;
  z-index: 1;
  inset: 2% -4% -22% -4%; /* reicht bis unter den Namen: genügend gross zum Antippen */
  margin: 0; padding: 0; border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.welt-knopf:focus-visible { outline: 3px solid #ffd77a; outline-offset: 2px; }
.welt-knopf:hover ~ img,
.welt-knopf:focus-visible ~ img { filter: saturate(1) contrast(0.98) brightness(1.05); }
.welt-knopf:active ~ img { filter: saturate(1.05) contrast(1) brightness(1.12); transition-duration: 0.1s; }

/* Name unter der Insel */
.welt-name {
  position: absolute;
  left: 50%; top: 93%;
  translate: -50% 0;
  white-space: nowrap;
  font-size: max(12px, 1.16cqw);
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #fbf6ea;
  text-shadow: 0 0.08cqw 0.3cqw rgba(10, 25, 50, 0.95), 0 0 0.8cqw rgba(10, 25, 50, 0.75), 0 0 1.6cqw rgba(10, 25, 50, 0.45);
  transition: opacity 0.3s ease, color 0.2s ease;
}
.welt-name small { font-size: 0.86em; font-style: italic; opacity: 0.85; }
.welt-knopf:hover ~ .welt-name,
.welt-knopf:focus-visible ~ .welt-name { color: #ffd77a; }
/* Die Welt vorne trägt ihren Namen unter dem Knopf; unterwegs sind die Namen kurz weg. */
.welt.haupt .welt-name,
.welt.unterwegs .welt-name,
.welt.sehr-fern .welt-name { opacity: 0; }
.welt.haupt .welt-knopf { display: none; }
@keyframes schweben {
  from { translate: 0 0; }
  to   { translate: 0 var(--hub); }
}

/* Wasserfälle: fliessende Streifen über dem gemalten Wasser */
.fall {
  position: absolute;
  overflow: hidden;
  mix-blend-mode: screen;
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 55%, transparent 100%);
}
.fall::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -100%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='240'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.3 0.012' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 2.6 -1.25'/%3E%3C/filter%3E%3Crect width='60' height='240' filter='url(%23f)'/%3E%3C/svg%3E");
  background-size: 100% 50%;
  animation: fallen 1.1s linear infinite;
}
.fall-1 { left: 9.7%; top: 48.8%; width: 7.3%; height: 48%; }
.fall-2 { left: 68.5%; top: 64.2%; width: 8.2%; height: 34%; }
.fall-2::before { animation-duration: 1.3s; }
@keyframes fallen { to { transform: translateY(50%); } }

/* ------------------------------------------------------------ Wolken in Bewegung */
.wolkenzug {
  left: 0;
  width: 200%;
  background: url("einstieg-wolken.webp") repeat-x left bottom / 50% 100%;
  animation: ziehen 120s linear infinite;
  will-change: transform;
}
.wolkenzug.horizont { bottom: 47%; height: 14%; opacity: 0.4; animation-duration: 260s; }
.wolkenzug.hinten { bottom: 14%; height: 30%; opacity: 0.55; animation-duration: 140s; }
.wolkenzug.mitte  { bottom: -2%; height: 34%; opacity: 0.7; animation-duration: 110s; animation-direction: reverse; }
.wolkenzug.vorne  { bottom: -9%; height: 30%; opacity: 0.9; animation-duration: 75s; }
@keyframes ziehen { to { transform: translateX(-50%); } }

/* einzelne Wolken, die quer über den Himmel treiben */
.wolke-bild {
  left: 0;
  height: auto;
  animation: treiben 300s linear infinite;
  will-change: transform;
}
@keyframes treiben {
  from { transform: translateX(-30cqw); }
  to   { transform: translateX(110cqw); }
}
.wb-1 { top: 9%;  width: 16%; opacity: 0.9;  animation-duration: 340s; animation-delay: -40s; }
.wb-2 { top: 24%; width: 11%; opacity: 0.85; animation-duration: 260s; animation-delay: -170s; }
.wb-3 { top: 36%; width: 19%; opacity: 0.7;  animation-duration: 300s; animation-delay: -95s; }
.wb-4 { top: 50%; width: 24%; opacity: 0.6;  animation-duration: 240s; animation-delay: -205s; }
.wb-5 { top: 66%; width: 22%; opacity: 0.85; animation-duration: 170s; animation-delay: -60s; }
.wb-6 { top: 76%; width: 28%; opacity: 0.9;  animation-duration: 140s; animation-delay: -110s; }

/* feine Nebelschleier quer über die Inselsockel */
.nebelzug {
  left: -900px; right: -900px;
  top: 56%; height: 30%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='600'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.004 0.011' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.97 0 0 0 0 0.98 0 0 0 0 0.98 1.5 0 0 0 -0.72'/%3E%3C/filter%3E%3Crect width='900' height='600' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 900px 600px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 35%, #000 65%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 35%, #000 65%, transparent);
  opacity: 0.75;
  animation: nebel 70s linear infinite;
}
.nebelzug.zwei { top: 66%; height: 26%; opacity: 0.6; animation-duration: 100s; animation-direction: reverse; }
@keyframes nebel { from { transform: translateX(0); } to { transform: translateX(900px); } }

/* ------------------------------------------------------------ Leinwände (Vögel, Dorfleben) */
.leben { inset: 0; width: 100%; height: 100%; }

/* Nebel im Dorf, langsam ziehend */
.nebel-dorf {
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.02' numOctaves='3' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1.6 0 0 0 -0.55'/%3E%3C/filter%3E%3Crect width='600' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 600px 300px;
  -webkit-mask-image: url("einstieg-dorf-nebel.webp");
  -webkit-mask-size: 100% 100%;
  mask-image: url("einstieg-dorf-nebel.webp");
  mask-size: 100% 100%;
  opacity: 0.7;
  animation: nebel-dorf 60s linear infinite;
}
@keyframes nebel-dorf { to { background-position: 600px 0; } }

/* ------------------------------------------------------------ Texte und Knöpfe auf dem Himmel */
.untertitel {
  position: absolute;
  left: 0; right: 0;
  top: 16.7%;
  margin: 0;
  text-align: center;
  font-size: 1.36cqw;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #fbf6ea;
  text-shadow: 0 0.08cqw 0.3cqw rgba(10, 25, 50, 0.9), 0 0 0.9cqw rgba(10, 25, 50, 0.6);
  pointer-events: none;
}

/* Unsichtbare Knöpfe genau über den gemalten Knöpfen */
.bild-knopf {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  font-size: 1px;
  cursor: pointer;
  border-radius: 999px;
  touch-action: manipulation;
  transition: box-shadow 0.2s ease, background-color 0.2s ease, transform 0.12s ease;
}
.bild-knopf:hover { background-color: rgba(255, 245, 210, 0.1); box-shadow: 0 0 1.6cqw rgba(255, 214, 120, 0.55); }
.bild-knopf:active { transform: scale(0.97); }
.bild-knopf:focus-visible { outline: 3px solid #ffd77a; outline-offset: 3px; }
.bild-knopf:disabled { cursor: progress; }

/* Welche Welt vorne steht: Zeile unter dem Knopf, blendet beim Wechsel über. */
.welt-gewaehlt {
  position: absolute;
  left: 0; right: 0;
  top: 92.4%;
  margin: 0;
  text-align: center;
  font-size: max(13px, 1.3cqw);
  line-height: 1.2;
  letter-spacing: 0.03em;
  color: #fbf6ea;
  text-shadow: 0 0.08cqw 0.3cqw rgba(10, 25, 50, 0.95), 0 0 0.8cqw rgba(10, 25, 50, 0.8), 0 0 1.8cqw rgba(10, 25, 50, 0.5);
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.welt-gewaehlt.wechselt { opacity: 0; }

#welt-betreten { left: 39.95%; top: 82.68%; width: 20.04%; height: 8.5%; min-height: 44px; animation: pulsieren 2.8s ease-in-out infinite; }
@keyframes pulsieren {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 214, 120, 0); }
  50% { box-shadow: 0 0 2cqw rgba(255, 214, 120, 0.5); }
}
.insel-flaeche {
  position: absolute;
  left: 23.62%; top: 26.57%; width: 52.03%; height: 32.94%;
  border: 0; padding: 0; margin: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

/* ------------------------------------------------------------ Dorf mit Anmeldung */
.wasser {
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='w' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.045 0.11' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 3 -1.7'/%3E%3C/filter%3E%3Crect width='320' height='320' filter='url(%23w)'/%3E%3C/svg%3E");
  background-size: 320px 320px;
  -webkit-mask-image: url("einstieg-dorf-wasser.webp");
  -webkit-mask-size: 100% 100%;
  mask-image: url("einstieg-dorf-wasser.webp");
  mask-size: 100% 100%;
  mix-blend-mode: screen;
  opacity: 0.6;
  animation: stroemen 16s linear infinite;
}
@keyframes stroemen { to { background-position: 320px 320px; } }

#anmeldeformular .feld {
  position: absolute;
  display: block;
  margin: 0;
  left: 42.344%; width: 15.371%;
  border-radius: 0.4cqw;
  transition: box-shadow 0.2s ease;
}
.feld-name { top: 50.864%; height: 4.815%; }
.feld-passwort { top: 56.914%; height: 4.691%; }
.feld:focus-within { box-shadow: 0 0 0 2px #c9a54e, 0 0 1.2cqw rgba(201, 165, 78, 0.55); }
#anmeldeformular .feld input {
  position: absolute;
  display: block;
  min-width: 0;
  left: 16%;
  top: 0;
  width: 80%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0.3cqw;
  outline: 0;
  background: transparent;
  color: #33281c;
  font: inherit;
  font-size: max(16px, 0.98cqw);
  line-height: normal;
}
.feld input::placeholder { color: #8b7b66; opacity: 1; }
.feld input[aria-invalid="true"] { color: #8c1d14; }
/* Vom Browser ausgefüllte Felder: Farbe des Pergaments statt hellblau */
.feld input:-webkit-autofill,
.feld input:-webkit-autofill:hover,
.feld input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px #f1ebe0 inset;
  -webkit-text-fill-color: #33281c;
  caret-color: #33281c;
  transition: background-color 600000s 0s;
}
.feld input:autofill { box-shadow: 0 0 0 100px #f1ebe0 inset; }

.knopf-anmelden { left: 42.045%; top: 63.58%; width: 15.969%; height: 5.802%; border-radius: 0.5cqw; }
.knopf-zurueck { left: 46.531%; top: 70.37%; width: 6.938%; height: 3.457%; min-height: 32px; border-radius: 0.3cqw; }
.knopf-zurueck:hover { background-color: rgba(120, 90, 40, 0.12); box-shadow: none; }

.fehler {
  position: absolute;
  left: 50%;
  top: 76.5%;
  translate: -50% 0;
  max-width: 24cqw;
  margin: 0;
  padding: 0.5cqw 1cqw;
  border-radius: 0.5cqw;
  background: rgba(120, 22, 16, 0.92);
  color: #fff;
  font-size: max(14px, 0.9cqw);
  text-align: center;
  box-shadow: 0 0.4cqw 1.2cqw rgba(0, 0, 0, 0.35);
}
.fehler[hidden] { display: none; }

/* Heller Schleier beim Übergang */
.blitz {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 45%, #fffaf0 0%, #fff4dc 45%, #f2e6c8 100%);
}
.einstieg[data-zustand="flug"] .himmel { pointer-events: none; }

/* ------------------------------------------------------------ Bewegung reduzieren */
@media (prefers-reduced-motion: reduce) {
  .welt, .fall::before, .wolkenzug, .wolke-bild, .nebelzug, .wasser, .nebel-dorf, #welt-betreten { animation: none !important; }
  .wolke-bild { display: none; }
  .bild-knopf, .feld { transition: none; }
  /* Welten wechseln ohne Fahrt (einstieg.js blendet kurz über); Namen und Dunst wechseln sofort. */
  .welt > img, .welt.unterwegs > img { transition: none; }
}
