/* ---------- Schriften: Fraunces (Überschriften) + Inter (Text), lokal ausgeliefert ---------- */

@font-face { font-family: 'Inter'; src: url('/fonts/inter-400-latin.woff2') format('woff2'); font-weight: 400; font-display: swap; 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: 'Inter'; src: url('/fonts/inter-500-latin.woff2') format('woff2'); font-weight: 500; font-display: swap; 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: 'Inter'; src: url('/fonts/inter-600-latin.woff2') format('woff2'); font-weight: 600 700; font-display: swap; 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: 'Fraunces'; src: url('/fonts/fraunces-500-latin.woff2') format('woff2'); font-weight: 400 500; font-display: swap; 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: 'Fraunces'; src: url('/fonts/fraunces-600-latin.woff2') format('woff2'); font-weight: 600 700; font-display: swap; 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: 'Fraunces'; src: url('/fonts/fraunces-500-italic-latin.woff2') format('woff2'); font-weight: 400 600; font-style: italic; font-display: swap; 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: 'Inter'; src: url('/fonts/inter-400-latin-ext.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-500-latin-ext.woff2') format('woff2'); font-weight: 500; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-600-latin-ext.woff2') format('woff2'); font-weight: 600 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-500-latin-ext.woff2') format('woff2'); font-weight: 400 500; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-600-latin-ext.woff2') format('woff2'); font-weight: 600 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-500-italic-latin-ext.woff2') format('woff2'); font-weight: 400 600; font-style: italic; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* Nacht */
  --night-1: #111D2B;
  --night-2: #1B2C3F;
  --night-3: #2A4258;
  /* Weihnachtsfarben, bewusst gedeckt */
  --berry: #A8423F;
  --berry-deep: #923634;
  --berry-dark: #7A2C2B;
  --pine: #2F5B4D;
  --pine-light: #3E7363;
  --gold: #C9994A;
  --gold-soft: #EBD2A0;
  /* Papier */
  --cream: #FAF5EC;
  --paper: #FFFDF9;
  --sand: #F2EADF;
  --sand-dark: #E3D7C6;
  --line: #E9E0D3;
  --blush: #E7B3A9;
  /* Schrift */
  --ink: #2A2420;
  --text: #4D443D;
  --muted: #857A70;
  --ok: #3E7363;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -28px rgba(6, 12, 20, 0.6), 0 2px 6px rgba(6, 12, 20, 0.08);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
}

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

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

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  color: var(--text);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--ink); margin: 0; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; line-height: 1.55; }
b, strong { font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }

.eyebrow { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */

.btn {
  --btn-bg: var(--berry);
  --btn-bg-hover: var(--berry-deep);
  --btn-fg: #fff;
  --btn-border: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 50px; padding: 0 1.4em;
  border: 1px solid var(--btn-border); border-radius: var(--radius-sm);
  background: var(--btn-bg); color: var(--btn-fg);
  box-shadow: 0 1px 2px rgba(30, 20, 15, 0.12);
  font-size: 1rem; font-weight: 600;
  cursor: pointer; text-decoration: none; user-select: none;
  transition: background-color 0.15s, transform 0.1s, opacity 0.2s;
}
.btn:hover { background: var(--btn-bg-hover); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 0 1em; font-size: 0.92rem; border-radius: 10px; }
.btn.pine { --btn-bg: var(--pine-light); --btn-bg-hover: var(--pine); }
.btn.gold { --btn-bg: var(--gold-soft); --btn-bg-hover: #E3C385; --btn-fg: #3E2C14; }
.btn.soft { --btn-bg: var(--sand); --btn-bg-hover: var(--sand-dark); --btn-fg: var(--ink); box-shadow: none; }
.btn.white { --btn-bg: #fff; --btn-bg-hover: var(--cream); --btn-fg: var(--ink); --btn-border: var(--line); }

.link-btn {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.4em 0.2em; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-weight: 500; text-decoration: none;
}
.link-btn:hover { color: var(--ink); }
.link-btn:focus-visible { outline: 2px solid var(--gold); border-radius: 6px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--sand); color: var(--ink); }
.icon-btn.danger:hover { background: #F6E3E0; color: var(--berry-deep); }
.icon-btn:focus-visible { outline: 2px solid var(--gold); }

/* ---------- Formulare ---------- */

.field { display: grid; gap: 6px; }
.field > span { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.input {
  width: 100%; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--sand-dark); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: #B3A79B; }
.input:focus { outline: none; border-color: var(--berry); box-shadow: 0 0 0 3px rgba(168, 66, 63, 0.14); }

.error-msg {
  display: flex; gap: 0.5em; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: #F8E6E3; color: var(--berry-dark); font-size: 0.93rem; text-align: left;
  animation: fade-in 0.25s ease-out;
}
.error-msg .icon { margin-top: 0.15em; }

/* ---------- Nachtszene ---------- */

body.night {
  background: linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 60%, var(--night-3) 100%) fixed;
  color: var(--cream);
  overflow-x: hidden;
}

.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.moon {
  position: absolute; top: max(6vh, 32px); right: max(9vw, 28px);
  width: 56px; height: 56px; border-radius: 50%;
  background: #F6EBD3;
  box-shadow: 0 0 60px 12px rgba(246, 225, 180, 0.14);
}
.star-dot {
  position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: 0.55;
  animation: twinkle var(--d, 5s) ease-in-out var(--delay, 0s) infinite;
}

canvas.snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

.hills {
  position: fixed; left: 0; right: 0; bottom: 0; height: min(26vh, 220px);
  pointer-events: none; z-index: 1;
}
.hills svg { width: 100%; height: 100%; }

/* ---------- Ton an/aus ---------- */

.sound-toggle {
  position: fixed; top: max(14px, env(safe-area-inset-top)); left: 14px; z-index: 30;
  display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); color: rgba(250, 245, 236, 0.8); cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.sound-toggle:hover { background: rgba(255, 255, 255, 0.14); color: var(--cream); }
.sound-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.sound-toggle[aria-pressed=false] { color: rgba(250, 245, 236, 0.45); }

/* ---------- Wichteldorf ---------- */

.village {
  position: relative; margin: 2px 0 0; padding: 14px 10px 12px;
  border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 100%);
  color: var(--cream); text-align: center;
}
.village figcaption { position: relative; display: flex; justify-content: center; align-items: baseline; gap: 8px; padding: 0 6px 12px; font-size: 0.85rem; }
.village figcaption span { color: rgba(250, 245, 236, 0.6); }
.village figcaption b { font-weight: 600; }
.village ul { position: relative; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; }
.vh { width: 66px; display: grid; justify-items: center; gap: 3px; }
.vh svg { width: 54px; overflow: visible; }
.vh span { max-width: 100%; font-size: 0.72rem; color: rgba(250, 245, 236, 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vh .win { fill: #3A4A5C; transition: fill 0.4s; }
.vh .win.on { fill: #F3D592; animation: win-on 0.8s ease-out both; }
.vh.done span { color: var(--gold-soft); }
@keyframes win-on { 0% { fill: #3A4A5C; } 100% { fill: #F3D592; } }

canvas.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ---------- Toast & Dialog ---------- */

.toast-wrap {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: grid; gap: 8px; z-index: 100; width: min(92vw, 420px);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--cream); font-size: 0.95rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.3s var(--ease-out);
}
.toast.error { background: var(--berry-dark); }
.toast.out { animation: toast-out 0.25s ease-in forwards; }

dialog.sheet {
  width: min(92vw, 440px); padding: 0; border: 0; border-radius: var(--radius);
  background: var(--paper); color: var(--text); box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(10, 18, 28, 0.5); }
dialog.sheet[open] { animation: fade-in 0.2s ease-out; }
dialog.sheet form { display: grid; gap: 16px; padding: 26px; }
dialog.sheet h3 { font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
dialog.sheet h3 .icon { color: var(--berry); }
dialog.sheet .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.sheet-text { color: var(--text); font-size: 0.95rem; line-height: 1.55; }

/* ---------- Animationen ---------- */

@keyframes twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.8; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block; width: 1.1em; height: 1.1em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
