@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Dancing Script";
  src: url("/assets/wichtel-titel.woff2?v=2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Wichtel Systemschrift";
  src: local("Segoe Script Bold"), local("Snell Roundhand Bold"), local("Apple Chancery"),
    local("Dancing Script Bold"), local("Georgia Bold"), local("Times New Roman Bold"), local("Roboto Bold");
  font-weight: 700;
  size-adjust: 78%;
}

:root {
  color-scheme: light;
  --background: #f0f3ee;
  --paper: #fbfaf6;
  --text: #172a22;
  --muted: #4b5e55;
  --line: #d7dfd6;
  --control-line: #839489;
  --green: #214b39;
  --green-hover: #17392b;
  --green-wash: #e9efe8;
  --red: #883d37;
  --red-wash: #f9efeb;
  font-family: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-block-size: 100svh; }
h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid #28654b; outline-offset: 4px; }
.shell {
  inline-size: min(1120px, calc(100% - clamp(32px, 7vw, 112px)));
  margin-inline: auto;
}
.muted { color: var(--muted); }
.skip-link {
  position: fixed;
  z-index: 5;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  translate: 0 calc(-100% - 20px);
  padding: 10px 16px;
  color: white;
  background: var(--green);
  border-radius: 5px;
}
.skip-link:focus { translate: 0; }

.site-header {
  display: flex;
  min-block-size: 69px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  min-block-size: 44px;
  min-inline-size: 0;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}
.gift-icon {
  flex: 0 0 21px;
  inline-size: 21px;
  block-size: 21px;
  background: currentColor;
  mask: url("/assets/geschenk.svg") center / contain no-repeat;
}
.brand-icon { color: var(--green); }

.header-actions, .button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.subtle {
  display: inline-flex;
  min-block-size: 44px;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-weight: 600;
  font-size: .9375rem;
  text-decoration: none;
}
.subtle:hover { color: var(--green-hover); text-decoration: underline; text-underline-offset: 4px; }

.primary, .secondary, .danger {
  display: inline-flex;
  min-block-size: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: .9375rem;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.primary { color: white; background: var(--green); }
.primary:hover:not(:disabled) { background: var(--green-hover); }
.primary:disabled { color: #526659; background: #e2e9e1; }
.secondary { color: var(--green); background: var(--paper); border-color: var(--control-line); }
.secondary:hover:not(:disabled) { background: var(--green-wash); }
.danger { color: var(--red); background: var(--red-wash); border-color: #b47c72; }
.danger:hover:not(:disabled) { background: #f2dfd8; }

.home {
  color-scheme: dark;
  --night-text: #f5f3ee;
  --night-muted: #c3cdd1;
  --night-accent: #f1d5a5;
  color: var(--night-text);
  background: #0d1c27;
}
.home :focus-visible { outline-color: var(--night-accent); }
.winter-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: 1fr auto;
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
  min-block-size: 100vh;
  min-block-size: 100svh;
}
.winter-background {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.winter-background::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(ellipse 56% 54% at 50% 42%, rgb(7 17 25 / .57), transparent 93%),
    linear-gradient(180deg, rgb(7 15 23 / .38), rgb(7 15 23 / .14) 61%, rgb(7 15 23 / .53));
}
.winter-image {
  position: absolute;
  inset: -11px;
  inline-size: calc(100% + 22px);
  block-size: calc(100% + 22px);
  object-fit: cover;
  object-position: 58% 63%;
  filter: blur(3px) saturate(.85);
}

.winter-snow {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
}
.winter-snow span {
  position: absolute;
  inset-block: -6px 0;
  inset-inline-start: var(--left);
  inline-size: 0;
  animation: snowfall var(--duration, 22s) var(--delay) linear infinite;
}
.winter-snow span::before {
  display: block;
  inline-size: var(--size, 3px);
  block-size: var(--size, 3px);
  border-radius: 50%;
  background: #eef6ff;
  box-shadow: 0 0 5px rgb(223 240 255 / .4);
  opacity: var(--opacity, .56);
  content: "";
}
.winter-snow span:nth-child(1) { --left: 5%; --delay: -17s; --rest: 76%; }
.winter-snow span:nth-child(2) { --left: 12%; --delay: -7s; --rest: 31%; --size: 2px; }
.winter-snow span:nth-child(3) { --left: 21%; --delay: -12s; --rest: 56%; --duration: 24s; }
.winter-snow span:nth-child(4) { --left: 28%; --delay: -2s; --rest: 12%; --opacity: .42; }
.winter-snow span:nth-child(5) { --left: 36%; --delay: -19s; --rest: 85%; --size: 4px; }
.winter-snow span:nth-child(6) { --left: 45%; --delay: -9s; --rest: 39%; --duration: 25s; }
.winter-snow span:nth-child(7) { --left: 54%; --delay: -3s; --rest: 16%; --size: 2px; }
.winter-snow span:nth-child(8) { --left: 62%; --delay: -14s; --rest: 68%; --duration: 20s; }
.winter-snow span:nth-child(9) { --left: 70%; --delay: -7s; --rest: 28%; --size: 4px; }
.winter-snow span:nth-child(10) { --left: 78%; --delay: -20s; --rest: 91%; --duration: 26s; }
.winter-snow span:nth-child(11) { --left: 86%; --delay: -11s; --rest: 48%; --size: 2px; }
.winter-snow span:nth-child(12) { --left: 94%; --delay: -4s; --rest: 21%; --opacity: .7; }

@keyframes snowfall {
  from { transform: translate(0, 0); }
  52% { transform: translate(10px, 52%); }
  to { transform: translate(-7px, 102%); }
}

.draw-layout {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(26px, 4.5svh, 42px);
  padding-block: max(clamp(37px, 9svh, 98px), env(safe-area-inset-top, 0px)) clamp(24px, 5svh, 56px);
}
.draw-intro {
  container-type: inline-size;
  inline-size: 100%;
  text-align: center;
}
.draw-intro h1 {
  margin-inline: auto;
  color: #fff6e6;
  font-family: "Dancing Script", "Wichtel Systemschrift", cursive;
  font-size: min(6.6rem, 8.9vw);
  font-size: min(6.6rem, 10.5cqi);
  font-weight: 700;
  line-height: 1.08;
  hyphens: auto;
  text-shadow: 0 3px 9px rgb(3 10 17 / .64), 0 0 30px rgb(227 177 104 / .18);
}
.draw-intro p {
  max-inline-size: 38ch;
  margin: 16px auto 0;
  color: #e1e8ea;
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.5;
  text-wrap: pretty;
  text-shadow: 0 2px 10px rgb(3 10 17 / .55);
}
.draw-area {
  inline-size: min(100%, 680px);
  min-inline-size: 0;
  text-align: center;
  text-shadow: 0 2px 10px #06111a;
}
.state-tag {
  display: inline-flex;
  inline-size: fit-content;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
}
.state-tag::before {
  content: "";
  flex: 0 0 6px;
  block-size: 6px;
  background: currentColor;
  border-radius: 50%;
}
.state-tag[data-state="active"], .state-tag[data-state="drawn"] { color: var(--green); }
.draw-feedback > p {
  max-inline-size: 37ch;
  margin: 0 auto 12px;
  color: var(--night-text);
  text-wrap: pretty;
}
.draw-form {
  display: grid;
  gap: 12px;
  inline-size: min(100%, 330px);
  margin-inline: auto;
  text-align: start;
}
.draw-field { display: grid; gap: 6px; }
.draw-field input[type="text"] {
  min-block-size: 48px;
  padding-inline: 12px;
  color: var(--night-text);
  background: rgb(9 22 32 / .78);
  border-color: #9caaae;
  border-radius: 8px;
}
.draw-area .draw-button {
  min-block-size: 50px;
  color: #1e2428;
  background: var(--night-accent);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
}
.draw-area .draw-button:hover:not(:disabled) { background: #f9e4c0; }
.draw-area .draw-button:disabled {
  color: #c1cacd;
  background: #30414a;
  border-color: #52626a;
}
.draw-area :is(.subtle, noscript p) { color: var(--night-muted); }
.draw-area .subtle:hover { color: var(--night-text); }
.result {
  display: grid;
  justify-items: center;
  gap: 3px;
}
.result > p {
  color: #eed9b7;
  font-size: clamp(1rem, 2.3vw, 1.15rem);
}
.result strong {
  color: #fff6e6;
  font-family: Georgia, serif;
  font-size: clamp(2rem, 6vw, 4.15rem);
  font-weight: 400;
  letter-spacing: -.025em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.result.revealed { animation: reveal 280ms ease-out both; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }

.home-footer {
  display: flex;
  justify-content: flex-end;
  padding-block-end: max(5px, env(safe-area-inset-bottom, 0px));
}
.home-footer a {
  display: inline-flex;
  min-block-size: 44px;
  align-items: center;
  color: #e0e7e9;
  font-size: .875rem;
  font-weight: 600;
  text-shadow: 0 1px 6px #081521;
  text-underline-offset: 4px;
}
.home-footer a:hover { color: var(--night-accent); }

@media (max-width: 680px) {
  .draw-layout {
    gap: clamp(21px, 4svh, 32px);
    padding-block: max(clamp(30px, 6svh, 48px), env(safe-area-inset-top, 0px)) clamp(28px, 8svh, 76px);
  }
  .draw-intro p { max-inline-size: 27ch; margin-block-start: 13px; }
  .winter-image { object-position: 75% 63%; }
  .winter-background::after {
    background:
      radial-gradient(ellipse 80% 38% at 50% 40%, rgb(7 17 25 / .46), transparent),
      linear-gradient(180deg, rgb(7 17 25 / .55), rgb(7 17 25 / .32) 53%, rgb(7 17 25 / .43));
  }
  .home-footer { justify-content: center; }
}

@media (max-width: 680px) and (max-height: 620px) {
  .draw-layout { padding-block-end: clamp(24px, 5svh, 34px); }
}
@media (max-width: 680px) and (min-height: 700px) {
  .draw-layout {
    align-content: start;
    padding-block-start: max(clamp(60px, 12svh, 105px), env(safe-area-inset-top, 0px));
  }
}

.login-page, .admin-page { background: var(--background); }
.login-page .site-header, .admin-page .site-header { border-block-end: 1px solid var(--line); }
.login-layout {
  display: grid;
  justify-items: center;
  padding-block: clamp(27px, 8vh, 80px);
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.login-card {
  inline-size: min(100%, 460px);
  padding: clamp(23px, 5vw, 40px);
}
.login-card h1 {
  margin-block-end: 8px;
  font-size: clamp(1.95rem, 4.5vw, 2.65rem);
  font-weight: 670;
  letter-spacing: -.05em;
  line-height: 1.09;
}
.login-card form { display: grid; gap: 7px; margin-block-start: 22px; }
.login-card input + label { margin-block-start: 7px; }
.login-card form button { margin-block-start: 9px; }
.login-card noscript p { margin-block-start: 13px; }
#password-hint { margin-block-end: 6px; font-size: .875rem; }

label { font-size: .9375rem; font-weight: 610; }
input:not([type="checkbox"]), textarea, select {
  inline-size: 100%;
  min-block-size: 44px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--control-line);
  border-radius: 6px;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #65746a; }
input[type="checkbox"] { inline-size: 19px; block-size: 19px; flex: none; accent-color: var(--green); }
select {
  appearance: none;
  padding-inline-end: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--green) 50%),
    linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position: calc(100% - 16px) 51%, calc(100% - 11px) 51%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
@media (forced-colors: active) {
  select { appearance: auto; background-image: none; }
  .gift-icon, .state-tag::before { forced-color-adjust: none; }
}

.admin-layout { padding-block: clamp(27px, 5vw, 56px); }
.admin-heading, .section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.admin-heading { margin-block-end: 20px; }
.admin-heading h1 {
  font-size: clamp(2.15rem, 5vw, 3.5rem);
  font-weight: 670;
  line-height: 1.05;
  letter-spacing: -.055em;
}
.filter { display: grid; gap: 4px; min-inline-size: 0; }
#no-current p, .archive > p { margin-block-start: 7px; }
#archive-list { margin: 12px 0 0; padding: 0; list-style: none; }
#archive-list:empty { display: none; }
#archive-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 9px 16px;
  padding-block: 12px;
  border-block-start: 1px solid var(--line);
}
#archive-list li p { font-size: .875rem; }
#archive-list .secondary[aria-current="true"] { border-color: var(--green); }
.admin-layout .panel { padding: clamp(15px, 3vw, 27px); margin-block-end: 16px; }
.admin-layout h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 665;
  line-height: 1.1;
  letter-spacing: -.04em;
}
.overview h2 { margin-block-start: 6px; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-block: 21px 19px;
  border-block: 1px solid var(--line);
}
.stats div { padding: 12px clamp(7px, 2vw, 19px); }
.stats div:first-child { padding-inline-start: 0; }
.stats div + div { border-inline-start: 1px solid var(--line); }
.stats dt { color: var(--muted); font-size: .875rem; line-height: 1.3; }
.stats dd {
  margin-block-start: 4px;
  color: var(--green);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.progress-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-block-end: 7px;
}
.progress-heading span { color: var(--green); font-size: .875rem; }
progress {
  display: block;
  inline-size: 100%;
  block-size: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: var(--green-wash);
  accent-color: var(--green);
}
progress::-webkit-progress-bar { background: var(--green-wash); }
progress::-webkit-progress-value { background: var(--green); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--green); border-radius: 99px; }

.roster .section-heading { margin-block-end: 18px; }
.roster .section-heading p { margin-block-start: 4px; }
.add-forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-block-end: 20px;
}
.add-forms form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.table-wrap { overflow-x: auto; }
table { inline-size: 100%; border-collapse: collapse; text-align: start; }
th, td {
  padding: 9px 10px;
  border-block-end: 1px solid var(--line);
  font-size: .9375rem;
  overflow-wrap: anywhere;
}
th { color: var(--muted); background: var(--green-wash); font-weight: 620; }
td:first-child { min-inline-size: 100px; font-weight: 610; }
.table-actions { white-space: nowrap; }
.table-button { padding-inline: 7px; }
.text-drawn { color: #246245; }
.table-empty { padding: 11px 0 2px; }
.draw-by:empty::before, .draw-time:empty::before { content: "—"; }
.draw-by-label { display: none; }

.notice {
  margin-block-end: 12px;
  padding: 9px 11px;
  color: var(--red);
  background: var(--red-wash);
  border-inline-start: 2px solid var(--red);
  border-radius: 5px;
  line-height: 1.4;
}
.notice[data-type="success"] { color: var(--green); background: var(--green-wash); border-color: var(--green); }
#load-message { margin-block-end: 12px; }
dialog {
  inline-size: min(470px, calc(100% - 28px));
  max-block-size: calc(100% - 28px);
  overflow: auto;
  padding: clamp(18px, 5vw, 27px);
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 42px rgb(20 43 31 / .19);
}
dialog::backdrop { background: rgb(17 43 29 / .48); }
dialog p { margin-block: 9px 13px; }
dialog input:not([type="checkbox"]) { margin-block-start: 5px; }
.checkbox { display: flex; min-block-size: 44px; align-items: center; gap: 7px; }
.dialog-actions { justify-content: flex-end; margin-block-start: 16px; }

@media (max-width: 680px) {
  .site-header { min-block-size: 61px; }
  .brand { gap: 7px; }
  .brand-icon { inline-size: 19px; block-size: 19px; flex-basis: 19px; }
  .header-actions { justify-content: flex-end; gap: 4px 9px; }
  .header-actions .secondary { padding-inline: 8px; }
  .overview .button-row { inline-size: 100%; }
}
@media (max-width: 520px) {
  .add-forms { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .add-forms form { padding: 12px; }
  .table-wrap { overflow: visible; }
  table, tbody { display: block; }
  thead {
    position: absolute;
    inset-inline-start: 0;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(78px, auto);
    gap: 4px 8px;
    padding: 12px 0;
    border-block-end: 1px solid var(--line);
  }
  tbody tr:first-child { border-block-start: 1px solid var(--line); }
  td { padding: 0; border: 0; }
  td:first-child { min-inline-size: 0; }
  td:nth-child(2) { justify-self: end; text-align: end; font-size: .875rem; }
  .draw-by, .draw-time { grid-column: 1 / -1; font-size: .875rem; }
  .draw-by-label { display: inline; }
  .draw-by-label, .draw-time { color: var(--muted); }
  .draw-by:empty, .draw-time:empty { display: none; }
  .table-actions { grid-column: 1 / -1; display: flex; gap: 11px; white-space: normal; }
  .table-button { padding-inline: 0; }
}
@media (max-width: 350px) {
  .brand { font-size: .95rem; }
  .admin-page .site-header { align-items: flex-start; padding-block: 5px; }
  .admin-page .header-actions { flex-direction: column; align-items: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  .winter-snow span {
    inset-block-start: var(--rest);
    animation: none;
  }
  .result.revealed { animation: none; }
}
