/* Geschenkpapier „Schneeweiß“: dicke Konturen, harte Schatten, Rot-Grün-Gold */

@font-face {
  font-family: 'Grandstander';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('/fonts/grandstander-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;
}

@font-face {
  font-family: 'Grandstander';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('/fonts/grandstander-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;
}

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/nunito-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;
}

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/nunito-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;
}

:root {
  --bg: #f6f8fa;
  --paper: #ffffff;
  --ink: #1e2a22;
  --muted: #4a5a4f;
  --line: #dce3e8;
  --red: #c8352e;
  --red-light: #e2574c;
  --mint: #cfe6cf;
  --green: #6fb58a;
  --gold: #f2b33d;
  --gold-light: #fdf1d6;
  --border: 2.5px solid var(--ink);
  --display: 'Grandstander', 'Nunito', system-ui, sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: 400 16px/1.5 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  /* Konfetti am Seitenrand */
  background: var(--bg)
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 520'><rect x='552' y='30' width='12' height='12' rx='2' fill='%23F2B33D' transform='rotate(20 558 36)'/><circle cx='514' cy='70' r='5' fill='%23C8352E'/><circle cx='40' cy='120' r='5' fill='%23F2B33D'/><circle cx='24' cy='270' r='7' fill='%236FB58A'/><rect x='572' y='300' width='10' height='10' rx='2' fill='%23C8352E' transform='rotate(-25 577 305)'/><path d='M30 420l6 10h-12z' fill='%23F2B33D'/><circle cx='580' cy='470' r='6' fill='%236FB58A'/></svg>")
    no-repeat center top / min(100%, 640px) auto;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 18px 64px;
}

main.busy {
  cursor: progress;
}

main.busy button {
  pointer-events: none;
  opacity: 0.6;
}

/* ---------------------------------------------------------------------------
   Typografie
   --------------------------------------------------------------------------- */

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 24px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.15;
}

h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(2rem, 8vw, 2.4rem);
}

h2 {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 1.4rem;
}

h3 {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 1.2rem;
}

p {
  margin: 0 0 12px;
}

.center {
  text-align: center;
}

.muted {
  color: var(--muted);
}

/* Kleines Etikett mit Kontur, z. B. Name oben rechts oder „Admin“ */
.pill,
h2.section {
  display: inline-block;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1.5;
}

h2.section {
  display: block;
  width: fit-content;
  margin: 44px 0 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.who {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------------------------------------------------------------------------
   Karten und Flächen
   --------------------------------------------------------------------------- */

.card {
  background: var(--paper);
  border: var(--border);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 4px 4px 0 var(--ink);
}

.card > :last-child {
  margin-bottom: 0;
}

.card.warn {
  background: var(--gold-light);
}

.card.highlight {
  box-shadow: 4px 4px 0 var(--red);
}

.card.compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.card.compact h2 {
  margin: 0;
  font-size: 1.2rem;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.stage > * {
  margin: 0;
}

.lead {
  font-size: 1.05rem;
  color: var(--muted);
}

/* Geschenk mit schrägem Aufkleber */
.hero {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0 0 8px;
}

.hero svg {
  width: min(100%, 270px);
  height: auto;
}

.stage > .hero {
  margin: 0;
}

.sticker {
  position: absolute;
  top: 4px;
  right: max(0px, calc(50% - 165px));
  margin: 0;
  background: var(--gold);
  border: var(--border);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 6px 12px;
  transform: rotate(8deg);
  font-size: 1.05rem;
  font-weight: 700;
}

.deadline {
  width: fit-content;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 600;
}

.deadline strong {
  font-weight: 800;
}

/* Countdown-Kacheln */
.countdown-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 10px;
}

.countdown-label strong {
  font-weight: 800;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.countdown div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  background: var(--paper);
  border: var(--border);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-2deg);
}

.countdown div:nth-child(2) {
  transform: rotate(1.5deg);
}

.countdown div:nth-child(3) {
  transform: rotate(-1deg);
}

.countdown strong {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}

.countdown span {
  font-size: 0.8rem;
  font-weight: 800;
}

/* Hinweis mit Kalender-Symbol */
.note {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: var(--border);
  border-radius: 18px;
  padding: 14px 16px;
}

.note svg {
  flex-shrink: 0;
}

.note p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Teilnehmer */
.people {
  margin: 0 0 28px;
}

.people-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.people-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.people-head .count {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--red);
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips li {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px 4px 8px;
  font-size: 0.9rem;
  font-weight: 800;
}

.chips li::before {
  content: '';
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
}

.chips li:nth-child(3n + 2)::before {
  background: var(--green);
}

.chips li:nth-child(3n)::before {
  background: var(--gold);
}

/* ---------------------------------------------------------------------------
   Auslosung: Umschlag und Brief
   --------------------------------------------------------------------------- */

/* Sobald ausgelost ist, wird die ganze Seite grün, mit eigenem Konfetti. */
body:has(.present) {
  background: var(--mint)
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 500'><rect x='22' y='30' width='12' height='12' rx='2' fill='%23F2B33D' transform='rotate(20 28 36)'/><rect x='360' y='40' width='12' height='12' rx='2' fill='%23C8352E' transform='rotate(-30 366 46)'/><circle cx='64' cy='100' r='6' fill='%23C8352E'/><circle cx='340' cy='112' r='5' fill='%23FFFFFF'/><path d='M12 200l7 12h-14z' fill='%23FFFFFF'/><rect x='380' y='230' width='10' height='10' rx='2' fill='%23F2B33D' transform='rotate(35 385 235)'/><circle cx='14' cy='330' r='6' fill='%23F2B33D'/><path d='M372 380q4-6 8 0q4 6 8 0' stroke='%23C8352E' stroke-width='3' fill='none' stroke-linecap='round'/><circle cx='16' cy='460' r='5' fill='%23C8352E'/><circle cx='386' cy='480' r='6' fill='%23FFFFFF'/></svg>")
    no-repeat center top / min(100%, 640px) auto;
}

.present {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  text-align: center;
}

.present > * {
  margin: 0;
}

.present h2 {
  font-size: 1.6rem;
  font-weight: 800;
}

.present .closed {
  width: min(100%, 300px);
  height: auto;
}

.envelope {
  position: relative;
  width: min(100%, 346px);
  aspect-ratio: 346 / 450;
}

.envelope .back {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42.2%;
  background: var(--red-light);
  border: var(--border);
  border-radius: 16px;
}

.envelope .letter {
  position: absolute;
  left: 6.4%;
  right: 6.4%;
  top: 0;
  height: 82.2%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 36px 16px 0;
  background: var(--paper);
  border: var(--border);
  border-radius: 18px;
  box-shadow: 5px 5px 0 var(--ink);
  transform: rotate(-3deg);
}

.envelope .letter.slide {
  animation: slide-out 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes slide-out {
  from {
    transform: translateY(55%) rotate(0deg);
  }
}

.envelope .front {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 42.2%;
}

.eyebrow {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--muted);
}

.giftee {
  margin: 0;
  max-width: 100%;
  font-family: var(--display);
  font-weight: 800;
  font-size: min(4.75rem, 19vw);
  line-height: 1.1;
  color: var(--red);
  overflow-wrap: anywhere;
}

.giftee.len-m {
  font-size: min(3.5rem, 13vw);
}

.giftee.len-l {
  font-size: min(2.4rem, 8.5vw);
}

.giftee.len-xl {
  font-size: min(1.9rem, 7vw);
}

.letter svg {
  margin-top: 6px;
}

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

/* ---------------------------------------------------------------------------
   Formulare und Buttons
   --------------------------------------------------------------------------- */

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 6px;
}

input {
  width: 100%;
  min-height: 56px;
  margin-bottom: 18px;
  padding: 0 16px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--paper);
  border: var(--border);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--ink);
}

input::placeholder {
  color: #6b7a70;
}

input:focus,
button:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

form.stack button.primary {
  width: 100%;
}

button {
  --offset: 3px;
  --shadow: var(--ink);
  min-height: 48px;
  padding: 10px 18px;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  background: var(--paper);
  border: var(--border);
  border-radius: 14px;
  box-shadow: var(--offset) var(--offset) 0 var(--shadow);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

button:hover {
  transform: translate(-1px, -1px);
  box-shadow: calc(var(--offset) + 1px) calc(var(--offset) + 1px) 0 var(--shadow);
}

button:active {
  transform: translate(2px, 2px);
  box-shadow: calc(var(--offset) - 2px) calc(var(--offset) - 2px) 0 var(--shadow);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--offset) var(--offset) 0 var(--shadow);
}

button.primary {
  --offset: 4px;
  --shadow: var(--red);
  min-height: 56px;
  font-size: 1.2rem;
  color: #fff;
  background: var(--ink);
  border-radius: 16px;
}

button.danger {
  color: var(--red);
}

button.small {
  --offset: 2px;
  min-height: 40px;
  padding: 6px 12px;
  font-size: 0.95rem;
  border-width: 2px;
  border-radius: 12px;
}

button.big {
  min-height: 60px;
  padding: 12px 40px;
  font-size: 1.35rem;
}

button.link,
button.link:hover,
button.link:active {
  min-height: 0;
  padding: 4px 6px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: underline;
  background: none;
  border: none;
  box-shadow: none;
  transform: none;
}

button.link:hover {
  color: var(--ink);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.row input {
  flex: 1 1 200px;
  width: auto;
  min-height: 48px;
  margin: 0;
}

form.row {
  margin-bottom: 12px;
}

/* ---------------------------------------------------------------------------
   Admin
   --------------------------------------------------------------------------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 2px dashed var(--line);
}

.list li:first-child {
  border-top: none;
}

.list li > span:first-child {
  font-weight: 800;
}

.list small {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.list .name {
  flex: 1 1 8em;
  min-width: 0;
}

.list input.family {
  flex: 0 1 9em;
  width: 9em;
  min-height: 40px;
  margin: 0;
  padding: 0 10px;
  font-size: 16px;
  border-width: 2px;
  border-radius: 12px;
  box-shadow: 2px 2px 0 var(--ink);
}

.actions {
  display: flex;
  gap: 8px;
}

.tag {
  display: inline-block;
  margin-left: 2px;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--mint);
  border: 2px solid var(--ink);
  border-radius: 99px;
  vertical-align: 2px;
}

.tag.warn {
  background: var(--gold);
}

.linkbox {
  margin-top: 16px;
  padding: 14px;
  border: 2px dashed var(--ink);
  border-radius: 14px;
  background: var(--bg);
}

.linkbox code {
  display: block;
  word-break: break-all;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

/* ---------------------------------------------------------------------------
   Meldungen
   --------------------------------------------------------------------------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border: var(--border);
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  box-shadow: 4px 4px 0 var(--red);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#toast.error {
  background: var(--red);
  box-shadow: 4px 4px 0 var(--ink);
}
