/* Basis- und Layoutstile. Aussehen nach der Präsentation „präsii für onno“ (Gestaltungselemente, Glückslos, Header/Footer,
   Spendesumme, Grobe Anordnung). Die Farben dieser Gestaltung stehen unten als --gl-* und wurden aus der Präsentation gemessen;
   sie sind nicht Teil des Design Systems in tokens.css, das hier unverändert bleibt. */

:root {
  --gl-page: #faf6ef;        /* Seitenhintergrund */
  --gl-cream: #f4ede4;       /* Los, Header-Band */
  --gl-cream-soft: #f7f0e7;  /* Spendesumme-Karte, Footer */
  --gl-sand: #ede3da;        /* ferne Hügel im Footer */
  --gl-green: #18503c;       /* Dunkelgrün: Fortschrittsbalken, Spendesumme, Banner */
  --gl-ink: #104838;         /* Schrift der Erklärungstexte */
  --gl-magenta: #b40050;     /* Titel, Button, „Noch … Tage“ (aus dem Entwurf Design/Neu gemessen) */
  --gl-track: #c0d0cc;       /* Schiene des Fortschrittsbalkens */
  --gl-green-deep: #1c4f3d;
  --gl-green-mid: #2a775b;
  --gl-red: #e53128;         /* Titel, Schleifen */
  --gl-pink: #fda3b2;
  --gl-orange: #fdae4a;
  --gl-orange-deep: #ff6a27;
  --gl-yellow: #f9cf72;      /* Plaketten hinter den Figuren */
  --gl-brown: #6e4630;
  /* Schmale Schrift für Titel, Überschriften und Zahlen. DINCond-Bold liegt noch nicht als Datei vor: Auf Mac und iOS greift die
     Systemschrift „DIN Condensed“, sonst Arial Narrow, zuletzt DIN Bold. Mit der Datei: @font-face in css/tokens.css (siehe README). */
  --font-cond: "DINCond-Bold", "DIN Condensed", "DIN Cond", "Arial Narrow", "DIN", system-ui, sans-serif;
  --font-number: var(--font-cond);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--gl-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
}

img, svg, canvas { max-width: 100%; }
img, svg { display: block; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--text-heading);
  text-wrap: balance;
}

p { margin: 0; max-width: 65ch; }

a { color: inherit; }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Seitenränder liegen am Container (nicht am Body), damit Bänder wie Header und Footer die volle Breite nutzen können. */
.container {
  width: 100%;
  max-width: calc(1280px + 2 * var(--space-4));
  margin-inline: auto;
  padding-left: max(var(--space-4), env(safe-area-inset-left, 0px));
  padding-right: max(var(--space-4), env(safe-area-inset-right, 0px));
}

/* ---------- Header: fertiges Band (Design/Header), das Logo ist Teil des Bildes ---------- */
/* Das Band ist 16:1. Auf schmalen Bildschirmen bliebe es zu flach, dann wird es höher und rechts angeschnitten (das Logo steht links). */
.site-header { background: var(--gl-cream); }
.site-header__art {
  display: block;
  width: 100%;
  height: clamp(56px, 6.25vw, 140px);
  object-fit: cover;
  object-position: left center;
}


/* ---------- Seitenaufbau (nach dem Entwurf Design/Neu): Titel und Countdown oben, darunter Texte | Los | Spendesumme ---------- */
/* Der Inhalt liegt über dem Footer (z-index), denn der Footer rückt nach oben in den Inhalt hinein. */
.page { position: relative; z-index: 1; padding-block: var(--space-6) var(--space-5); }
.page__grid {
  position: relative; /* für die goldenen Sterne (.star-layer) */
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px minmax(0, 1.25fr); /* rechts breiter: Platz für die große Spendesumme */
  grid-template-rows: auto 1fr;
  column-gap: var(--space-8);
  row-gap: var(--space-8); /* Platz zwischen Titel und Los, in den das grüne Band hineinragt */
  align-items: stretch;
}
.hero { grid-column: 2; grid-row: 1; }
.info { grid-column: 1; grid-row: 2; }
.play { grid-column: 2; grid-row: 2; }
.donation-col { grid-column: 3; grid-row: 2; }

/* Goldene Sterne in den Lücken unter den Texten (js/app.js, placeStars): nur Dekoration, ohne Klickfang */
.star-layer { position: absolute; inset: 0; pointer-events: none; }
.star-layer img, .star-layer svg { position: absolute; height: auto; transform: translate(-50%, -50%); }

/* ---------- Titel: mittig und gerade über dem Los, darf links und rechts über die Spalte hinausragen ---------- */
.hero { display: flex; justify-content: center; align-items: flex-end; min-width: 0; }
.hero__inner { position: relative; flex: none; }
.hero__star { position: absolute; left: calc(-1 * clamp(34px, 3.8vw, 62px) - 1cm); top: calc(50% - 0.15em); transform: translateY(-50%); width: clamp(44px, 4.6vw, 76px); height: auto; } /* mittig zur Überschrift (em = Schriftgröße des Titels, setzt js/app.js auch hier), 1 cm weiter links */
.hero__title {
  font-family: var(--font-cond);
  font-size: 100px; /* js/app.js passt die Größe an die Breite an */
  font-weight: var(--fw-bold);
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  text-wrap: nowrap;
  white-space: nowrap;
  color: var(--gl-magenta);
}
.hero__spark { position: absolute; right: calc(-1 * clamp(26px, 3vw, 46px)); bottom: 8%; width: clamp(24px, 2.6vw, 40px); height: auto; fill: #d42a2c; }

/* ---------- Countdown: unter dem Button „Neues Los ziehen“ ---------- */
.countdown {
  align-self: center;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  max-width: 100%;
  padding: var(--space-4) var(--space-6);
  background: #fff;
  border: 1px solid #efe7de;
  color: var(--gl-ink);
  font-size: clamp(16px, 1.55vw, 20px);
  line-height: 1.35;
}
.countdown svg { flex: none; width: 32px; height: 35px; fill: none; stroke: var(--gl-magenta); stroke-width: 3.8; stroke-linejoin: round; stroke-linecap: round; } /* Sanduhr aus dem Entwurf */
.countdown strong { color: var(--gl-magenta); font-weight: var(--fw-bold); }

/* ---------- Erklärungstexte links ---------- */
.info { display: flex; flex-direction: column; justify-content: center; gap: var(--space-6); padding-top: 56px; /* Platz für das grüne Band über dem Los */ color: var(--gl-ink); }
.info h2 {
  font-family: var(--font-cond);
  font-size: clamp(34px, 3.7vw, 54px);
  font-weight: var(--fw-bold);
  line-height: 1.02;
  text-transform: uppercase;
  color: var(--gl-ink);
}
.info p { margin-top: var(--space-3); font-size: clamp(17px, 1.6vw, 21px); max-width: 30ch; color: var(--gl-ink); }
.info__block--right { text-align: right; }
.info__block--right p { margin-left: auto; }

.play { display: flex; flex-direction: column; gap: var(--space-3); }
.caption { text-align: center; color: var(--gl-ink); font-weight: var(--fw-regular); letter-spacing: 0.02em; }
/* Zu schmal für eine Zeile (Handy): js/app.js setzt die Klasse, dann umbricht der Text in normaler Größe */
.caption.is-wrapped { white-space: normal; font-size: 16px; line-height: 1.35; margin-inline: auto; }

.donation-col { display: flex; flex-direction: column; gap: var(--space-5); }
.donation-col__top { display: flex; flex-direction: column; gap: var(--space-5); }
.result-box { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); text-align: center; }

/* ---------- Los: fertiges Bild (Design/Neu) mit Rubbelfeldern ---------- */
/* Lage und Größe der Felder setzt js/app.js nach den Maßen in data/content.js. --u = CSS-Pixel pro Bildpixel (js/app.js, fitCard);
   Figuren und Beträge wachsen damit proportional zum Los. */
.ticket-card {
  --u: 0.4574px;
  position: relative;
  width: 440px;
  max-width: 100%;
  aspect-ratio: 962 / 1214;
}
.ticket-card__art { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: calc(var(--u) * 28); }
.ticket-card__grid { position: absolute; inset: 0; }
.ticket-card.is-closed .ticket-card__art { filter: grayscale(1); opacity: .45; } /* Spendenziel erreicht: kein Los mehr */
.new-ticket[hidden] { display: none; }

/* Grünes Band über der linken oberen Ecke des Loses, schräg und an den Enden eingekerbt */
.ticket-card__ribbon {
  position: absolute;
  left: -42%;
  top: -9%;
  width: 82%;
  height: 14%;
  z-index: 3;
  display: grid;
  place-items: center;
  background: var(--gl-green);
  color: var(--gl-page);
  clip-path: polygon(0 0, 100% 0, 96.5% 50%, 100% 100%, 0 100%, 3.5% 50%);
  transform: rotate(-4deg);
  font-family: var(--font-cond);
  font-size: calc(var(--u) * 58); /* js/app.js passt die Größe an die Breite des Bands an */
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
  pointer-events: none;
}

/* Hinter der Rubbelschicht: Strahlen des Hintergrunds, dann links Figur auf Zackenplakette, rechts der Betrag */
.ticket__bg { position: absolute; pointer-events: none; }
.ticket__cell { position: absolute; display: grid; place-items: center; }
.ticket__cell--amount {
  font-family: var(--font-cond);
  font-size: calc(var(--u) * 84);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: #fff;
}
.ticket__badge { position: relative; width: calc(var(--u) * 158); height: calc(var(--u) * 158); display: grid; place-items: center; } /* Feldhöhe ist 182 Bildpixel */
.ticket__badge svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: #f6c445; }
.ticket__badge img { position: relative; width: 84%; height: auto; }

/* Rubbelschicht: nur die Felder darin sind deckend (Kopie aus dem Losbild), alles dazwischen ist durchsichtig */
.ticket__cover {
  position: absolute;
  cursor: url("../assets/cursors/coin-5cent.png") 20 20, crosshair; /* 5-Cent-Münze, Mittelpunkt als Hotspot */
  cursor: -webkit-image-set(url("../assets/cursors/coin-5cent.png") 1x, url("../assets/cursors/coin-5cent@2x.png") 2x) 20 20, crosshair; /* scharf auf Retina */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Spendesumme ---------- */
.donation { text-align: center; color: var(--gl-ink); }
.donation__label {
  font-weight: var(--fw-light);
  font-size: var(--fs-lead);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #111;
}
.donation__value {
  margin-top: var(--space-2);
  font-family: var(--font-number);
  font-weight: var(--fw-bold);
  font-size: 96px; /* js/app.js passt die Größe an die Breite an */
  line-height: 1;
  white-space: nowrap;
  color: var(--gl-green);
}
.donation__value.is-unavailable { font-family: var(--font-body); font-size: var(--fs-h4); font-weight: var(--fw-regular); }
.donation__bar { height: 14px; margin-top: var(--space-4); border-radius: 7px; background: var(--gl-track); overflow: hidden; text-align: left; }
.donation__bar span { display: block; width: 0; height: 100%; border-radius: 7px; background: var(--gl-green); }
.donation__scale { display: flex; justify-content: space-between; margin-top: var(--space-2); font-size: 18px; font-weight: var(--fw-regular); }

/* Ergebnis des Loses (Gewonnen/Niete) unter der Spendesumme */
.ticket-result { align-self: stretch; font-size: clamp(30px, 3.2vw, 40px); line-height: 1.2; font-weight: var(--fw-bold); color: var(--gl-magenta); }
.ticket-result:empty { display: none; }
.ticket-result.is-long { font-size: clamp(22px, 2.2vw, 28px); }

/* Button: lädt die Seite neu und damit ein neues Los */
.new-ticket {
  padding: 14px 40px;
  border: 0;
  border-radius: 999px;
  background: var(--gl-magenta);
  color: var(--gl-page);
  font: inherit;
  font-size: var(--fs-lead);
  font-weight: var(--fw-bold);
  cursor: pointer;
}
.new-ticket:hover { background: #8e003f; }
.new-ticket:focus-visible { outline: 3px solid var(--gl-orange); outline-offset: 3px; }

/* Weihnachtsbaum unten in der rechten Spalte (so groß wie im Entwurf, etwa 43 % der Breite des Loses); --tree-sink (js/app.js) zieht ihn so weit nach unten,
   dass der Stamm auf dem Schnee des Footers steht. Bäume und Geschenke im Footer meiden seinen Platz (drawFooter). */
.tree {
  position: relative;
  z-index: 2;
  align-self: center;
  width: min(100%, 190px);
  margin-top: auto;
  margin-bottom: calc(-1 * var(--tree-sink, 0px));
}
.tree img { width: 100%; height: auto; }
.tree__star { width: 17%; height: auto; margin: 0 auto -1%; }

/* ---------- Footer: Schneelandschaft mit durchsichtigem Himmel. Höhe und Hochrücken (--footer-lift) setzt js/app.js ---------- */
.site-footer { position: relative; z-index: 0; margin-top: calc(-1 * var(--footer-lift, 0px)); }
.site-footer__scene { display: block; width: 100%; height: 300px; }
/* Links zu Impressum und Datenschutz, unten mittig auf dem Schnee */
.site-footer__links { position: absolute; left: 0; right: 0; bottom: 12px; z-index: 3; display: flex; justify-content: center; gap: var(--space-5); padding-inline: 16px; font-size: 15px; }
.site-footer__links a { color: var(--gl-ink); text-decoration: underline; text-underline-offset: 3px; }
.site-footer__links a:hover { color: var(--gl-magenta); }
.site-footer__links a:focus-visible { outline: 3px solid var(--gl-orange); outline-offset: 3px; border-radius: 4px; }

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

/* Layout nach Breite (die Zahl der Spalten liest js/app.js aus dem Raster, ändere die Breakpoints also nur hier):
   über 1100 px   drei Spalten: Texte | Los | Spendesumme, Button, Countdown und Baum; oben der Titel mittig über dem Los
   821–1100 px    zwei Spalten: links Titel und Los, rechts Spendesumme, Button, Countdown und die Texte
   bis 820 px     eine Spalte: Titel, Los, Button, Countdown, Spendesumme, Texte; Baum und Sterne entfallen */
@media (max-width: 1100px) {
  .page__grid { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; gap: var(--space-7); align-items: start; }
  .hero { grid-area: 1 / 1 / 2 / 2; margin-bottom: var(--space-4); }
  .hero__star { left: -14px; top: -42px; width: 40px; transform: none; }
  .hero__spark { right: -10px; bottom: -28px; }
  .play { grid-area: 2 / 1 / 5 / 2; }
  .donation-col { grid-area: 1 / 2 / 3 / 3; }
  .info { grid-area: 3 / 2 / 5 / 3; gap: var(--space-6); padding-top: 0; }
  .info__block--right { text-align: left; }
  .info__block--right p { margin-left: 0; }
  .ticket-card__ribbon { left: 9%; top: -11%; }
  .tree { display: none; }
  .site-footer { margin-top: calc(var(--space-6) - var(--footer-lift, 0px)); }
}

@media (max-width: 820px) {
  .page { padding-block: var(--space-5) var(--space-7); }
  .page__grid { grid-template-columns: minmax(0, 440px); grid-template-rows: none; justify-content: center; gap: var(--space-6); }
  .hero, .play, .donation-col, .info { grid-area: auto; }
  .site-footer { margin-top: 0; }
  .donation-col, .donation-col__top { display: contents; } /* Spendesumme und Ergebnis werden einzeln einsortiert */
  .hero { order: 1; }
  .hero__title span { display: block; } /* Titel in zwei Zeilen */
  .hero__star { left: -14px; top: -30px; transform: none; }
  .hero__spark { right: -14px; bottom: -6px; }
  .play { order: 2; }
  .result-box { order: 3; margin-top: calc(-1 * var(--space-3)); }
  .countdown { order: 4; justify-self: stretch; }
  .donation { order: 5; }
  .info { order: 6; display: block; padding-top: 0; }
  .info__block { margin-bottom: var(--space-7); }
  .info__block:last-child { margin-bottom: 0; }
}

/* Kleine Handys (bis 400 px) */
@media (max-width: 400px) {
  .new-ticket { padding: 12px 28px; }
  .countdown { padding: var(--space-3) var(--space-4); gap: var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Overlay: Newsletter und Nachricht (js/signup.js) ---------- */
.signup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  background: rgba(16, 72, 56, .62);
}
.signup[hidden] { display: none; }
html.has-signup { overflow: hidden; }
.signup__card {
  width: 100%;
  max-width: 560px;
  margin: auto;
  padding: clamp(24px, 4vw, 40px);
  border-radius: 28px;
  background: var(--gl-page);
  color: var(--gl-ink);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
.signup__title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4.4vw, 36px);
  font-weight: var(--fw-bold);
  line-height: 1.1;
  color: var(--gl-magenta);
}
.signup__text { margin-top: var(--space-3); font-size: clamp(16px, 2vw, 19px); }
.signup__form { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); }
.signup__text--label { display: block; margin-top: var(--space-4); }
.signup__input {
  min-width: 0;
  width: 100%;
  padding: 12px 18px;
  border: 2px solid var(--gl-track);
  border-radius: 16px;
  background: #fff;
  color: var(--gl-ink);
  font: inherit;
  font-size: 17px;
}
.signup__input:focus-visible { outline: 3px solid var(--gl-orange); outline-offset: 2px; border-color: var(--gl-green); }
.signup__input:disabled { background: var(--gl-cream); color: #7d8f88; }
.signup__textarea { resize: vertical; min-height: 96px; }
.signup__button { align-self: flex-end; padding: 12px 36px; font-size: 17px; }
.signup__button:disabled { background: #cfa6bb; cursor: default; }
.signup__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.signup__note { margin-top: calc(-1 * var(--space-1)); font-size: 13px; line-height: 1.35; color: #4d6f63; }
.signup__note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.signup__note a:hover { color: var(--gl-magenta); }
.signup__status { min-height: 1.2em; margin-top: var(--space-2); font-size: 15px; font-weight: var(--fw-bold); color: var(--gl-green); }
.signup__status.is-error { color: var(--gl-red); }
.signup__skip {
  display: block;
  margin: var(--space-5) auto 0;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: #5d7a6f;
  font: inherit;
  font-size: 15px;
  text-decoration: underline;
  cursor: pointer;
}
.signup__skip:hover { color: var(--gl-ink); }
.signup__skip:focus-visible { outline: 3px solid var(--gl-orange); outline-offset: 2px; }
@media (max-width: 520px) {
  .signup__button { align-self: stretch; }
}
