@font-face {
  font-family: "Segment";
  src: url("/fonts/Segment-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Segment";
  src: url("/fonts/Segment-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ball-blue: #1140fe;
  --ball-blue-dunkel: #0a2fa0;
  --ball-blue-rgb: 17, 64, 254;
  --tinte: #1a1a1a;
  --leise: #5b5e66; /* 6,4:1 auf Weiß */
  --linie: #d5dae5;
  --flaeche: #f3f5fa;
  --weiss: #ffffff;
  --fehler: #c4161c; /* 5,9:1 auf Weiß */
  --fehler-flaeche: #fdecec;
  --radius: 14px;
}

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

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

body {
  margin: 0;
  background: var(--flaeche);
  color: var(--tinte);
  font-family: "Segment", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
}
h1 {
  font-size: 1.625rem;
}
h2 {
  font-size: 1.25rem;
}
h3 {
  font-size: 1.125rem;
}
p {
  margin: 0 0 0.75rem;
}
a {
  color: var(--ball-blue);
}

/* ---------- Kopf ---------- */

.kopf {
  background: var(--ball-blue);
  color: var(--weiss);
  padding: 1.25rem 1rem 3.5rem;
}
.kopf-innen {
  max-width: 34rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo {
  width: 72px;
  height: auto;
  flex: none;
}
.kopf-titel {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.kopf-zusatz {
  display: block;
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.85;
}

.inhalt {
  max-width: 34rem;
  margin: -2.5rem auto 0;
  padding: 0 1rem 3rem;
}
.admin .inhalt,
.admin .kopf-innen {
  max-width: 52rem;
}

/* ---------- Bausteine ---------- */

.karte {
  background: var(--weiss);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  margin-bottom: 1rem;
}
.karte > h2 {
  margin-top: 0;
}

.illustration {
  display: block;
  width: 100%;
  max-width: 26rem;
  height: auto;
  margin: 0 auto 1rem;
}

.einleitung {
  margin-bottom: 1.25rem;
}
.einleitung h1 {
  color: var(--ball-blue);
}

.hinweis,
.leise {
  color: var(--leise);
  font-size: 0.9375rem;
}

/* Ablauf: echte Reihenfolge, daher nummeriert */
.schritte {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: schritt;
}
.schritte li {
  position: relative;
  padding: 0 0 1rem 2.75rem;
  counter-increment: schritt;
}
.schritte li::before {
  content: counter(schritt);
  position: absolute;
  left: 0;
  top: -0.125rem;
  display: grid;
  place-items: center;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 50%;
  background: var(--ball-blue);
  color: var(--weiss);
  font-weight: 700;
  font-size: 0.9375rem;
}
.schritte li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(0.9375rem - 1px);
  top: 1.875rem;
  bottom: 0.125rem;
  width: 2px;
  background: var(--linie);
}
.schritte li:last-child {
  padding-bottom: 0;
}

/* ---------- Formular ---------- */

.formular {
  display: grid;
  gap: 1.25rem;
}
.schmal {
  max-width: 24rem;
  margin-inline: auto;
}

.feld-reihe {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 30rem) {
  .feld-reihe {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
}

.feld > label:first-child,
.suche > label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

input[type="text"],
input:not([type]),
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="password"],
textarea {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 0.875rem;
  border: 2px solid var(--linie);
  border-radius: 10px;
  background: var(--weiss);
  color: var(--tinte);
  font: inherit;
  font-size: 1.0625rem; /* ≥ 16px: iOS zoomt sonst */
  appearance: none;
}
textarea {
  resize: vertical;
  line-height: 1.4;
}
input:not([type="checkbox"]):focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--ball-blue);
  box-shadow: 0 0 0 3px rgba(var(--ball-blue-rgb), 0.25);
}

.wunsch .haekchen {
  margin-top: 0.5rem;
}
/* Wer sich überraschen lässt, braucht das Wunschfeld nicht. Ohne :has()
   bleibt es sichtbar; der Server ignoriert es dann. */
.wunsch:has(input[name="ueberraschen"]:checked) textarea {
  display: none;
}

.feld-fehler input,
.feld-fehler textarea {
  border-color: var(--fehler);
}
.fehlertext {
  color: var(--fehler);
  font-size: 0.9375rem;
  margin: 0.375rem 0 0;
}
.fehlerkasten {
  background: var(--fehler-flaeche);
  border-left: 4px solid var(--fehler);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--tinte);
}
.fehlerkasten p,
.fehlerkasten ul {
  margin: 0;
}
.fehlerkasten ul {
  padding-left: 1.25rem;
  margin-top: 0.25rem;
}

.haekchen {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: 2.75rem;
  cursor: pointer;
}
.haekchen input {
  width: 1.375rem;
  height: 1.375rem;
  accent-color: var(--ball-blue);
  flex: none;
}

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--ball-blue);
  border-radius: 12px;
  background: var(--ball-blue);
  color: var(--weiss);
  font: inherit;
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
  cursor: pointer;
}
.formular > .knopf {
  width: 100%;
  min-height: 3.5rem;
}
.knopf:hover {
  background: var(--ball-blue-dunkel);
  border-color: var(--ball-blue-dunkel);
}
.knopf:focus-visible,
.link-knopf:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(var(--ball-blue-rgb), 0.45);
  outline-offset: 2px;
}
.knopf-zweit {
  background: var(--weiss);
  color: var(--ball-blue);
}
.knopf-zweit:hover {
  background: rgba(var(--ball-blue-rgb), 0.06);
  color: var(--ball-blue-dunkel);
}
.knopf-gefahr {
  background: var(--fehler);
  border-color: var(--fehler);
}
.knopf-gefahr:hover {
  background: #9e1015;
  border-color: #9e1015;
}
.knopf-klein {
  min-height: 2.75rem;
  font-size: 1rem;
  padding: 0.5rem 1rem;
}
.knopf-gross {
  width: 100%;
  min-height: 3.75rem;
  font-size: 1.25rem;
}
.knopf-reihe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.link-knopf {
  display: inline-flex;
  align-items: center;
  background: none;
  border: 0;
  padding: 0.5rem 0;
  min-height: 2.75rem;
  color: var(--ball-blue);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Eigene Seite ---------- */

.danke {
  text-align: center;
  padding-block: 2rem;
}
.haken {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--ball-blue);
  color: var(--weiss);
  font-size: 2rem;
  font-weight: 700;
}
.zusammenfassung {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  background: rgba(var(--ball-blue-rgb), 0.08);
  color: var(--ball-blue);
  font-weight: 700;
}

.ziehen {
  text-align: center;
}
.ziehen form {
  margin-top: 1.25rem;
}

.link-feld {
  padding: 0.75rem 0.875rem;
  border-radius: 10px;
  background: var(--flaeche);
  overflow-wrap: anywhere;
  user-select: all;
}
.leise-kasten h2 {
  font-size: 1.0625rem;
}
.leise-kasten p:not(.link-feld) {
  color: var(--leise);
  font-size: 0.9375rem;
}

/* Die Wichtelkarte als Geschenkanhänger: dicke Kontur wie die Illustration,
   Loch und Schnur oben. Beim ersten Ziehen schwingt sie ein. */
.wichtelkarte {
  position: relative;
  margin: 0 0 1rem;
  padding: 3rem 1.25rem 1.25rem;
  background: var(--weiss);
  border: 3px solid var(--tinte);
  border-radius: 22px;
  transform-origin: 50% 0;
}
.wichtelkarte::before {
  content: "";
  position: absolute;
  top: 0.875rem;
  left: 50%;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: -0.625rem;
  border: 3px solid var(--tinte);
  border-radius: 50%;
  background: var(--ball-blue); /* liegt auf dem blauen Kopf */
}
.wichtelkarte::after {
  content: "";
  position: absolute;
  top: -0.75rem;
  left: 50%;
  width: 3px;
  height: 2.25rem;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--weiss);
}
.funken {
  position: absolute;
  top: 0.75rem;
  right: 0.875rem;
  width: 2.75rem;
  height: 2.75rem;
  fill: none;
  stroke: var(--tinte);
  stroke-width: 3.5;
  stroke-linecap: round;
}
.karte-titel {
  margin: 0;
  color: var(--leise);
}
.kind-name {
  margin: 0.125rem 0 0.375rem;
  font-size: 2.125rem;
  color: var(--ball-blue);
  overflow-wrap: anywhere;
}
.kind-nummer {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.125rem 0.75rem;
  border: 2px solid var(--tinte);
  border-radius: 999px;
  font-weight: 700;
}
.angaben {
  margin: 0;
}
.angaben div {
  padding: 0.625rem 0;
  border-top: 2px dashed var(--linie);
}
.angaben dt {
  color: var(--leise);
  font-size: 0.9375rem;
}
.angaben dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.wichtelkarte.neu {
  animation: einschwingen 1.1s cubic-bezier(0.3, 0.7, 0.4, 1) both;
}
.wichtelkarte.neu .funken {
  animation: funkeln 0.5s 0.8s ease-out both;
}
@keyframes einschwingen {
  0% {
    opacity: 0;
    transform: translateY(-1.5rem) rotate(-10deg);
  }
  35% {
    opacity: 1;
    transform: translateY(0) rotate(6deg);
  }
  60% {
    transform: rotate(-3deg);
  }
  80% {
    transform: rotate(1.5deg);
  }
  100% {
    transform: none;
  }
}
@keyframes funkeln {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.nach-karte {
  margin: -0.25rem 0.25rem 1rem;
}

.kleingedruckt {
  padding: 0.5rem 0.25rem;
  color: var(--leise);
  font-size: 0.9375rem;
}
.kleingedruckt h2 {
  font-size: 1rem;
  color: var(--tinte);
  margin-top: 1rem;
}

/* ---------- Organisation und Empfang ---------- */

.admin-kopf {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  background: var(--weiss);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.admin-kopf h1 {
  margin: 0;
}
.admin-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}
.gross {
  font-size: 1.25rem;
  font-weight: 700;
}
.meldung {
  background: rgba(var(--ball-blue-rgb), 0.08);
  border-left: 4px solid var(--ball-blue);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}
section > h2 {
  margin-top: 1.5rem;
}

.zahlen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.zahl-kachel {
  background: var(--weiss);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
}
.zahl-wert {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--ball-blue);
  font-variant-numeric: tabular-nums;
}
.zahl-text {
  margin: 0;
  color: var(--leise);
  font-size: 0.9375rem;
}

.auslosen {
  display: grid;
  gap: 1rem;
  margin: 1rem 0 0.5rem;
}

details > summary {
  cursor: pointer;
  padding: 0.625rem 0;
}
details.karte > summary {
  font-weight: 700;
}
details[open].karte > summary {
  margin-bottom: 0.5rem;
}
.adressen-label {
  display: block;
  font-weight: 700;
  margin: 1rem 0 0.375rem;
}
.adressen {
  font-size: 0.9375rem;
}

.eintraege {
  list-style: none;
  padding: 0.25rem 1.25rem;
}
.eintrag,
.geschenk {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--linie);
}
.eintrag:last-child,
.geschenk:last-child {
  border-bottom: 0;
}
.eintrag p,
.geschenk p {
  margin: 0;
}
.eintrag-name,
.geschenk-fuer {
  font-weight: 700;
}
.geschenk-fuer {
  font-size: 1.125rem;
}
.eintrag-info {
  color: var(--leise);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}
.geschenk {
  flex-wrap: wrap;
}
.geschenk .marke {
  margin-top: 0.375rem;
}
.link-details summary {
  color: var(--ball-blue);
  font-size: 0.9375rem;
}
.link-details .link-feld {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.9375rem;
}
.loeschen {
  flex: none;
  text-align: right;
}
.loeschen summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 2.75rem;
  padding: 0;
  color: var(--fehler);
  list-style: none;
}
.loeschen summary::-webkit-details-marker {
  display: none;
}
.loeschen form {
  margin-top: 0.25rem;
}

.marke {
  display: inline-block;
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  background: var(--flaeche);
  color: var(--leise);
  font-size: 0.8125rem;
  font-weight: 400;
  vertical-align: 0.1em;
}
.marke.warnung {
  background: var(--fehler-flaeche);
  color: var(--fehler);
}
.marke.da {
  background: rgba(var(--ball-blue-rgb), 0.1);
  color: var(--ball-blue-dunkel);
}
.marke.fertig {
  background: var(--tinte);
  color: var(--weiss);
}

.namen {
  margin: 0;
  padding-left: 1.25rem;
}
.namen li {
  padding: 0.25rem 0;
  overflow-wrap: anywhere;
}

.suche-zeile {
  display: flex;
  gap: 0.5rem;
}
.suche-zeile input {
  flex: 1;
  min-width: 0;
}
.suche .hinweis {
  margin: 0.5rem 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .wichtelkarte.neu,
  .wichtelkarte.neu .funken {
    animation: none;
  }
}
