/* ---------- Schriften ----------
   Inter und Outfit (SIL Open Font License, siehe fonts/LICENSE.md) liegen lokal in
   fonts/, damit beim Öffnen keine Verbindung zu Google Fonts entsteht. Nur die
   Zeichensätze latin und latin-ext, als variable Schrift über den Gewichtsbereich. */

/* Inter latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Inter latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Outfit latin-ext */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("fonts/outfit-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Outfit latin */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("fonts/outfit-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Dunkles Theme mit Neon-Weihnachtsfarben */
  --text: #eef3fb;
  --muted: #9fb0c8;
  --link: #ffd23f;
  --focus: #39ff88;
  --line: rgba(255, 255, 255, .14);
  --field: rgba(255, 255, 255, .04);

  --neon-red: #ff2d55;
  --neon-green: #39ff88;
  --neon-gold: #ffd23f;
  --neon-white: #fff6e0;

  --radius: 16px;
  /* lokale Schriften (oben), mit Systemschrift als Rückfall */
  --display: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--text);
  font: 16px/1.5 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 96px; /* Platz für Schneehügel und Wichtel */
  background: #05070f linear-gradient(180deg, #03050c 0%, #0a1426 50%, #15294a 100%) fixed;
}

/* ---------- Winterszene ---------- */

#snow {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
#ground {
  position: fixed; left: 0; bottom: 0; width: 100%; height: 76px;
  pointer-events: none; z-index: 1;
}
/* Haufen, Wichtel und fliegende Geschenke liegen hinter den Karten
   (gleiche Ebene, aber früher im DOM als header/main). */
#gift-pile {
  position: fixed; left: 50%; bottom: 22px; width: 0; height: 0;
  pointer-events: none; z-index: 1;
}
#gift-fly {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden;
}
#gift-sparks { position: absolute; inset: 0; width: 100%; height: 100%; }
.pgift {
  position: absolute; border-radius: 2px; transform-origin: 50% 100%;
  background:
    linear-gradient(90deg, transparent calc(50% - 1.5px), var(--r) 0 calc(50% + 1.5px), transparent 0),
    linear-gradient(0deg, transparent calc(50% - 1.5px), var(--r) 0 calc(50% + 1.5px), transparent 0),
    var(--c);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .16), inset 0 2px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(8, 20, 40, .35);
}
.pgift::before {
  content: ""; position: absolute; left: 50%; top: -5px; width: 12px; height: 7px; margin-left: -6px;
  background:
    radial-gradient(circle 3px at 3px 4px, var(--r) 90%, transparent 100%),
    radial-gradient(circle 3px at 9px 4px, var(--r) 90%, transparent 100%);
}
.pgift.land { animation: gift-land .28s ease-out; }
.pgift.sink { animation: gift-sink 1s ease-in .4s forwards; }
@keyframes gift-land { from { transform: scale(1.15, .8); } to { transform: none; } }
@keyframes gift-sink { to { opacity: 0; transform: translateY(6px); } }
#wichtel-lane {
  position: fixed; left: 0; right: 0; bottom: 0; height: 130px;
  pointer-events: none; z-index: 1; overflow: hidden;
}
.wichtel {
  position: absolute; left: 0; bottom: var(--b, 8px); width: var(--s, 60px);
  animation: wichtel-walk var(--dur, 30s) linear forwards;
  will-change: transform;
}
.wichtel.flip .inner { transform: scaleX(-1); }
.wichtel svg {
  display: block; width: 100%; height: auto;
  transform-origin: 50% 100%;
  animation: wichtel-bob var(--step, .45s) ease-in-out infinite alternate;
  filter: drop-shadow(0 2px 2px rgba(8, 20, 40, .35));
}
.wichtel .leg {
  transform-box: fill-box; transform-origin: 50% 0;
  animation: wichtel-leg var(--step, .45s) ease-in-out infinite alternate;
}
.wichtel .leg.b { animation-direction: alternate-reverse; }
@keyframes wichtel-walk { from { transform: translateX(var(--from)); } to { transform: translateX(var(--to)); } }
@keyframes wichtel-bob { from { transform: translateY(0) rotate(-2.5deg); } to { transform: translateY(-3px) rotate(2.5deg); } }
@keyframes wichtel-leg { from { transform: rotate(-30deg); } to { transform: rotate(30deg); } }

/* ---------- Layout ---------- */

.site-header, main { position: relative; z-index: 1; }
.site-header { padding: 16px; text-align: center; }
.brand {
  font-family: var(--display); font-weight: 700; font-size: 1.35rem;
  color: var(--text); text-decoration: none; letter-spacing: .02em;
  text-shadow: 0 0 6px rgba(255, 45, 85, .7), 0 0 18px rgba(255, 45, 85, .45);
}

main { width: 100%; max-width: 640px; margin: 0 auto; padding: 12px 16px 32px; flex: 1; }

h1 {
  font-family: var(--display); font-size: 2rem; line-height: 1.15; margin: 0 0 8px;
  text-wrap: balance;
  text-shadow: 0 0 8px rgba(57, 255, 136, .35), 0 0 22px rgba(57, 255, 136, .2);
}
h2 { font-family: var(--display); font-size: 1.15rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.lead { color: var(--muted); margin: 0 0 22px; }
.hint { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
.center { text-align: center; }
.opt { color: var(--muted); font-weight: 400; font-size: .85em; font-family: var(--sans); }
a { color: var(--link); }

/* ---------- LED-Streifen ----------
   Ein durchgehender Lichtstreifen (wie ein COB-LED-Strip) in Weihnachtsfarben, dessen
   Farbsegmente mit gleichmässigem Tempo im Kreis um den Rand laufen. Gezeichnet wird
   er von festive.js als SVG-Rechteck mit gestrichelten Linien je Farbe; eine zweite,
   unscharfe Kopie darunter ist der Lichtschein. ::before trägt den Kartenhintergrund
   zwischen Schein und Streifen. */

.led {
  --led-bg: rgba(8, 11, 20, .6); /* durchscheinend: Szene dahinter bleibt sichtbar */
  position: relative;
  isolation: isolate;
}
.led::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; pointer-events: none;
  background: var(--led-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); /* falls das Skript fehlt */
}
.led-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: visible; pointer-events: none; z-index: -1;
}
.led-svg.glow { z-index: -2; filter: blur(9px); opacity: .75; }
.led-svg rect { fill: none; }

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

.card {
  margin: 0 0 18px;
  padding: 22px 18px 18px;
  color: var(--text);
  border-radius: var(--radius);
}
.card.links-card { padding: 0; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 12px; }
label:last-child { margin-bottom: 0; }
input[type=text], textarea, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #6f7d93; }
select option { background: #0d1320; color: var(--text); }
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--neon-green);
  box-shadow: 0 0 0 1px var(--neon-green), 0 0 14px rgba(57, 255, 136, .45);
}
.btn:focus-visible, a:focus-visible, .x:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
textarea { resize: vertical; }
input[type=checkbox] { accent-color: var(--neon-green); width: 18px; height: 18px; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 11, 20, .6);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
  transition: border-color .15s, box-shadow .15s, color .15s;
}
.btn:hover {
  border-color: var(--neon-gold);
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 210, 63, .4);
}
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 45, 85, .6), rgba(255, 45, 85, .4));
  border: 2px solid var(--neon-red);
  text-shadow: 0 0 8px rgba(255, 45, 85, .9);
  box-shadow: 0 0 12px rgba(255, 45, 85, .55), inset 0 0 14px rgba(255, 45, 85, .35);
}
.btn.primary:hover {
  border-color: #ff5c7c;
  box-shadow: 0 0 22px rgba(255, 45, 85, .8), inset 0 0 18px rgba(255, 45, 85, .5);
}
.btn.big { width: 100%; padding: 14px; font-size: 1.15rem; font-family: var(--display); }
.btn.small { padding: 6px 10px; font-size: .85rem; }

.badge {
  background: var(--neon-green);
  color: #04140b;
  border-radius: 999px;
  padding: 0 9px;
  font: 700 .85rem var(--sans);
  box-shadow: 0 0 10px rgba(57, 255, 136, .6);
}

.add-row { display: flex; gap: 8px; }
.add-row input { margin-top: 0; flex: 1; min-width: 0; }

.chips, .links { list-style: none; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.chips:empty { margin: 0; }
.chips li {
  display: flex; align-items: center; gap: 4px;
  background: rgba(57, 255, 136, .08);
  border: 1px solid rgba(57, 255, 136, .55);
  color: #c9ffe0;
  border-radius: 999px;
  padding: 4px 4px 4px 12px;
  max-width: 100%;
  box-shadow: 0 0 8px rgba(57, 255, 136, .18);
}
.chips li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 1.1rem; line-height: 1; width: 28px; height: 28px; border-radius: 50%;
  flex: none;
}
.x:hover { background: rgba(255, 45, 85, .18); color: var(--neon-red); }

.error {
  background: rgba(255, 45, 85, .12); color: #ffc2cf;
  border-left: 4px solid var(--neon-red);
  border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; font-weight: 600;
  box-shadow: -4px 0 14px -4px rgba(255, 45, 85, .8);
}

.links { padding: 14px 18px 4px; }
.links li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.links li:first-child { border-top: 0; }
.links .who { font-weight: 600; overflow-wrap: anywhere; }
.links .btns { display: flex; gap: 6px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.reveal-card { text-align: center; padding: 40px 20px 32px; }
.event {
  color: var(--neon-red); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  font-size: .85rem; margin: 0 0 8px; overflow-wrap: anywhere;
  text-shadow: 0 0 10px rgba(255, 45, 85, .7);
}
.receiver {
  font-family: var(--display);
  font-size: 2.6rem; font-weight: 700; color: var(--neon-green); line-height: 1.15;
  margin: 4px 0 20px; overflow-wrap: anywhere;
  text-shadow: 0 0 10px rgba(57, 255, 136, .8), 0 0 30px rgba(57, 255, 136, .45);
  animation: pop .5s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
dl { margin: 0 0 20px; text-align: left; }
dl div { padding: 8px 0; border-top: 1px solid var(--line); }
dt { color: var(--muted); font-size: .85rem; }
dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

dialog {
  width: min(420px, calc(100vw - 32px));
  background: transparent; color: var(--text);
  border: 0; border-radius: var(--radius);
  padding: 22px 20px 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .7);
  overflow: visible;
}
dialog::backdrop { background: rgba(2, 4, 10, .72); }
dialog p { margin: 0 0 18px; font-size: 1.05rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.header-tools {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 6px; align-items: center;
}
.fx-toggle {
  font: inherit; font-size: .8rem; color: var(--muted); cursor: pointer;
  background: rgba(8, 11, 20, .6); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px;
}
.fx-toggle:hover { color: var(--text); border-color: var(--neon-gold); box-shadow: 0 0 10px rgba(255, 210, 63, .35); }
.fx-toggle[aria-pressed="true"] { color: var(--text); border-color: rgba(57, 255, 136, .55); }
.fx-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 480px) {
  .site-header { text-align: left; }
  .header-tools { flex-direction: column; align-items: flex-end; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .receiver { animation: none; }
}
