/* Wichteli – mobile first, Winternacht-Look. Ein Stylesheet, keine Abhängigkeiten. */

:root {
  color-scheme: dark;

  /* Nachthimmel als Grund, Tannengrün für die Karten, Rot und Gold als Schmuck. */
  --nacht: #0a1726;
  --nacht-2: #102338;
  --tanne: #142c25;
  --tanne-tief: #102219;
  --rand: #2c4b3c;
  --rand-still: #23384a;

  --text: #f1f6f2;
  --text-still: #a3bdb0;

  --rot: #d94f4a;
  --rot-dunkel: #b23b37;
  --gold: #f0c05a;
  --gold-tief: #c39a3c;
  --gruen: #49c48a;

  --radius: 16px;
  --luft: 1rem;

  /* Für Überschriften: eine ruhige Serife, die überall lokal vorhanden ist. */
  --schrift-titel: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

/* Muss vor allen display-Regeln gewinnen, sonst zeigt sich [hidden]-Markup. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* Nachthimmel mit einem warmen Schimmer oben – wie Lichter hinterm Fenster. */
  background:
    radial-gradient(90% 45% at 50% -5%, rgba(240, 192, 90, 0.14) 0%, transparent 70%),
    radial-gradient(120% 70% at 50% 0%, var(--nacht-2) 0%, var(--nacht) 65%),
    var(--nacht);
  background-attachment: fixed;
}

/* ------------------------------------------------------------- Schneefall */

/* Drei Ebenen aus getunten Punkten. Jede verschiebt sich pro Durchlauf um
   genau eine Kachelhöhe, dadurch läuft es nahtlos. Bewegt wird per transform,
   das ist auch auf älteren Handys billig. */
.schnee {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.schnee::before,
.schnee::after,
.schnee > span {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -260px;
  bottom: 0;
  display: block;
}

/* nah: große, hellere Flocken */
.schnee > span {
  background-image:
    radial-gradient(circle at 15% 12%, #fff 0 2.2px, transparent 3px),
    radial-gradient(circle at 68% 34%, #fff 0 1.8px, transparent 2.6px),
    radial-gradient(circle at 41% 71%, #fff 0 2px, transparent 2.8px);
  background-size: 260px 260px;
  opacity: 0.5;
  animation: schneien 14s linear infinite;
}

/* mittel */
.schnee::before {
  background-image:
    radial-gradient(circle at 82% 18%, #fff 0 1.5px, transparent 2.2px),
    radial-gradient(circle at 27% 46%, #fff 0 1.3px, transparent 2px),
    radial-gradient(circle at 58% 88%, #fff 0 1.6px, transparent 2.2px);
  background-size: 200px 200px;
  opacity: 0.32;
  animation: schneien-mittel 22s linear infinite;
}

/* fern: feiner Staub */
.schnee::after {
  background-image:
    radial-gradient(circle at 9% 62%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 74% 8%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 47% 39%, #fff 0 0.9px, transparent 1.5px);
  background-size: 150px 150px;
  opacity: 0.2;
  animation: schneien-fern 34s linear infinite;
}

@keyframes schneien       { to { transform: translate3d(6px, 260px, 0); } }
@keyframes schneien-mittel { to { transform: translate3d(-8px, 200px, 0); } }
@keyframes schneien-fern  { to { transform: translate3d(4px, 150px, 0); } }

/* --------------------------------------------------------------- Gerüst */

.kopf, .huelle, .fuss, .lichterkette { position: relative; z-index: 1; }

.kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--luft);
  padding: max(0.75rem, env(safe-area-inset-top)) var(--luft) 0.75rem;
}

.marke {
  font-family: var(--schrift-titel);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.marke-icon {
  width: 1.9rem;
  height: 1.9rem;
  margin-right: 0.35rem;
  vertical-align: -0.45em;
}

/* Lichterkette unter dem Kopf: zwei Reihen Lämpchen, leicht versetzt blinkend. */
.lichterkette {
  height: 14px;
  margin-bottom: 0.75rem;
  border-top: 1px solid var(--rand-still);
}
.lichterkette::before,
.lichterkette::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: repeat-x;
}
/* Jedes Lämpchen ist ein kleiner Kern mit weichem Schein drumherum. */
.lichterkette::before {
  background-image:
    radial-gradient(circle at 18px 6px, var(--gold) 0 2.4px, rgba(240, 192, 90, 0.28) 3px, transparent 7px),
    radial-gradient(circle at 78px 6px, var(--rot) 0 2.4px, rgba(217, 79, 74, 0.28) 3px, transparent 7px);
  background-size: 120px 14px;
  animation: funkeln 3.6s ease-in-out infinite;
}
.lichterkette::after {
  background-image:
    radial-gradient(circle at 48px 6px, var(--gruen) 0 2.4px, rgba(73, 196, 138, 0.26) 3px, transparent 7px),
    radial-gradient(circle at 108px 6px, #7fb8ff 0 2.4px, rgba(127, 184, 255, 0.26) 3px, transparent 7px);
  background-size: 120px 14px;
  animation: funkeln 3.6s ease-in-out infinite 1.8s;
}
@keyframes funkeln {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

.huelle {
  flex: 1;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 var(--luft) 2rem;
}

.fuss {
  max-width: 40rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem var(--luft) max(1.5rem, env(safe-area-inset-bottom));
  color: var(--text-still);
  border-top: 1px solid var(--rand-still);
}

.fuss nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.fuss a { color: var(--text-still); }

/* -------------------------------------------------------------- Karten */

.karte {
  position: relative;
  background: linear-gradient(180deg, var(--tanne) 0%, var(--tanne-tief) 100%);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: var(--luft);
  margin: 0 0 var(--luft);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.karte-still {
  background: rgba(16, 34, 25, 0.6);
  box-shadow: none;
}

/* Betonte Karten bekommen oben eine goldene Schmuckkante. */
.karte-akzent { border-color: var(--gold-tief); }
.karte-akzent::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--rot), var(--gold), var(--gruen), var(--gold), var(--rot));
}

/* Die Spendenbox soll da sein, aber nicht drängeln. */
.spendenbox { margin-top: 2rem; }
.spendenbox .knopf { background: var(--gold); color: #2f2200; }
.spendenbox .knopf:active { background: var(--gold-tief); }

/* Die Installations-Karte steht ganz oben und darf ruhig auffallen. */
.installbox h2::before {
  content: "📲 ";
}

.karte-kopfkarte {
  background: none;
  border: none;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
}

.karte-link { display: block; color: inherit; text-decoration: none; }
.karte-link:active { transform: scale(0.995); }

.karte h2 {
  font-family: var(--schrift-titel);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}
.karte h3.unter { font-size: 0.95rem; margin: 1rem 0 0.5rem; color: var(--text-still); }
.karte > p:last-child { margin-bottom: 0; }

.karte-kopf { display: flex; flex-direction: column; gap: 0.35rem; }

.titel {
  font-family: var(--schrift-titel);
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 0 0 0.35rem;
}

.held { padding: 0.5rem 0 1rem; }
.held .titel::after {
  content: " ❄";
  color: var(--gold);
  font-size: 0.8em;
}

.klein { font-size: 0.875rem; color: var(--text-still); margin: 0.25rem 0; }
.mittig { text-align: center; }
.fliess { white-space: pre-wrap; overflow-wrap: anywhere; }
.zitat { border-left: 3px solid var(--gold-tief); padding-left: 0.75rem; color: var(--text-still); }

.grossname {
  font-family: var(--schrift-titel);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0.25rem 0 0.75rem;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(240, 192, 90, 0.25);
}

.zurueck { display: inline-block; margin-bottom: 0.5rem; color: var(--text-still); text-decoration: none; }

/* -------------------------------------------------------------- Listen */

.liste { list-style: none; margin: 0 0 var(--luft); padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.liste-punkte { list-style: none; padding-left: 0; gap: 0.4rem; }
.liste-punkte li { padding-left: 1.5rem; position: relative; }
.liste-punkte li::before {
  content: "❄";
  position: absolute;
  left: 0;
  color: var(--gold-tief);
  font-size: 0.85em;
}

.person { display: flex; align-items: center; gap: 0.6rem; }
.person-name { flex: 1; overflow-wrap: anywhere; }
.person-aktionen { display: flex; gap: 0.4rem; }

.avatar {
  flex: 0 0 auto;
  width: 2.25rem; height: 2.25rem;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700;
  background: hsl(var(--h, 150) 42% 34%);
  border: 1px solid hsl(var(--h, 150) 42% 46%);
  color: #fff;
}

.wunschliste .wunsch {
  display: flex; align-items: flex-start; gap: 0.6rem;
  background: rgba(10, 23, 38, 0.45);
  border: 1px solid var(--rand);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
}
.wunsch-text { flex: 1; min-width: 0; }
.wunsch-titel { margin: 0; overflow-wrap: anywhere; }
.wunsch-titel a { color: var(--text); }

/* --------------------------------------------------------------- Chips */

.marken { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.marke-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--rand);
  color: var(--text);
}
.marke-chip-gold { background: var(--gold); color: #2f2200; }
.marke-chip-rot { background: var(--rot); color: #fff; }
.marke-chip-still { background: transparent; border: 1px solid var(--rand); color: var(--text-still); }

.zaehler {
  display: inline-block; min-width: 1.4rem;
  margin-left: 0.4rem; padding: 0 0.35rem;
  border-radius: 999px;
  background: #ffffff33; font-size: 0.8rem;
}

/* -------------------------------------------------------------- Knöpfe */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.6rem 1rem;
  border: none; border-radius: 12px;
  background: linear-gradient(180deg, var(--rot) 0%, var(--rot-dunkel) 100%);
  color: #fff;
  font: inherit; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.knopf:active { background: var(--rot-dunkel); transform: translateY(1px); box-shadow: none; }
.knopf-gross { width: 100%; font-size: 1.05rem; min-height: 3rem; }
.knopf-klein { min-height: 2.25rem; padding: 0.35rem 0.7rem; font-size: 0.875rem; }
.knopf-still {
  background: transparent; border: 1px solid var(--rand); color: var(--text); box-shadow: none;
}
.knopf-still:active { background: var(--rand); }
.knopf-warnung { background: linear-gradient(180deg, #8a2a28 0%, #6d201e 100%); }

/* ------------------------------------------------- Anmeldung bei Anbietern */

.anbieter { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.knopf-anbieter { width: 100%; }

/* Die Anbieter erwarten ihre eigenen Farben, nicht unsere. */
.knopf-google {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
}
.knopf-google:active { background: #e8eaed; }

.knopf-apple {
  background: #000;
  color: #fff;
  border: 1px solid #000;
}
.knopf-apple:active { background: #1a1a1a; }

/* ------------------------------------------------------------ Formulare */

.formular { display: flex; flex-direction: column; gap: 0.75rem; }
.formular-eng { gap: 0.5rem; margin-top: var(--luft); }
.formular label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.875rem; color: var(--text-still); }
.formular label em { color: var(--gold); font-style: normal; }

input, textarea, select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rand);
  border-radius: 12px;
  background: rgba(10, 23, 38, 0.55);
  color: var(--text);
  font: inherit;      /* 16px verhindert das Zoomen auf iOS */
}
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible,
.knopf:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Auswahl der Auslosungsart: zwei anklickbare Kacheln statt nackter Radios. */
.wahl {
  border: 0;
  padding: 0;
  margin: 0 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.wahl legend { padding: 0; margin-bottom: 0.35rem; }

.wahl-option {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rand);
  border-radius: 12px;
  background: rgba(10, 23, 38, 0.35);
  cursor: pointer;
}
/* Radios dürfen nicht die Formatierung der Textfelder erben. */
.wahl-option input[type="radio"] {
  width: auto;
  min-height: 0;
  margin: 0.2rem 0 0;
  flex: 0 0 auto;
  accent-color: var(--gold);
}
.wahl-option > span { display: flex; flex-direction: column; gap: 0.15rem; }
.wahl-option .klein { margin: 0; }
.wahl-option:has(input:checked) {
  border-color: var(--gold-tief);
  background: rgba(240, 192, 90, 0.08);
}

.feld-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
/* Die Rückmeldung des Selbstspeicherns soll nichts verschieben, wenn sie
   erscheint und wieder verschwindet. */
.notiz-status {
  min-height: 1.3em;
  margin: 0.15rem 0 0;
  color: var(--gruen);
}

.zeile-rechts { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }

.link-zeile { display: flex; gap: 0.5rem; margin-bottom: 0.6rem; }
.link-feld { font-size: 0.85rem; }

details { margin-top: 0.5rem; }
summary { cursor: pointer; padding: 0.5rem 0; font-weight: 600; }

/* ------------------------------------------------------- Betriebszahlen */

.zahlen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.6rem;
  margin: 0 0 0.5rem;
}
.zahlen > div {
  background: rgba(10, 23, 38, 0.45);
  border: 1px solid var(--rand);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
}
.zahlen dt { font-size: 0.78rem; color: var(--text-still); }
.zahlen dd {
  margin: 0.1rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------- Hinweise */

.hinweis {
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0 0 var(--luft);
  border: 1px solid var(--rand);
  background: rgba(16, 34, 25, 0.75);
}
.hinweis-ok { border-color: var(--gruen); }
.hinweis-fehler { border-color: var(--rot); }
.hinweis-warten { border-color: var(--gold-tief); }

/* ----------------------------------------------------------------- Chat */

.verlauf {
  display: flex; flex-direction: column; gap: 0.5rem;
  margin-bottom: var(--luft);
  max-height: 60dvh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.blase {
  max-width: 85%;
  padding: 0.55rem 0.8rem;
  border-radius: 16px;
  border: 1px solid var(--rand);
}
.blase p { margin: 0; overflow-wrap: anywhere; }
.blase time { display: block; text-align: right; font-size: 0.7rem; margin-top: 0.2rem; }
.blase-eigen {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--rot) 0%, var(--rot-dunkel) 100%);
  border-color: var(--rot-dunkel);
}
.blase-eigen time { color: #ffffffcc; }
.blase-fremd { align-self: flex-start; background: var(--tanne); }

.chat-eingabe { display: flex; gap: 0.5rem; align-items: flex-end; }
.chat-eingabe textarea { flex: 1; }

.nur-lesegeraet {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Wer Bewegung nicht mag, bekommt einen ruhigen Sternenhimmel statt Schnee. */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
