:root {
  --night: #0c1626;
  --night-2: #16284a;
  --head: #f4ecda;
  --head-2: #e4d6b8;
  --ink: #2a1d12;
  --red: #c8243a;
  --gold: #e8b64c;
  --gold-2: #b8832a;
  --text: #f5efe3;
  --muted: #a9b6cc;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 50% -10%, #284a7e 0%, transparent 60%),
    radial-gradient(800px 600px at 100% 100%, #3a1b2c 0%, transparent 60%),
    linear-gradient(180deg, var(--night-2), var(--night) 55%);
  background-attachment: fixed;
  overflow-x: hidden;
}

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

.top, main, .foot { position: relative; z-index: 1; }

/* ---------- Kopf ---------- */
.top {
  text-align: center;
  padding: clamp(28px, 6vw, 64px) 16px 12px;
}
.kicker {
  margin: 0;
  letter-spacing: .32em;
  text-transform: uppercase;
  font-size: .78rem;
  color: var(--gold);
}
h1 {
  margin: .15em 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 9vw, 5.2rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -.01em;
  text-shadow: 0 4px 24px rgba(0,0,0,.45);
}
h1 span { color: var(--red); font-style: italic; }
.sub {
  margin: .4em 0 0;
  font-family: Georgia, serif;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-style: italic;
  color: var(--head);
}
.hint {
  margin: 1em auto 0;
  max-width: 34em;
  color: var(--muted);
  font-size: .98rem;
}
.hint strong { color: var(--gold); }

.sound {
  position: absolute;
  top: 14px; right: 14px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
}
.sound:hover { background: rgba(255,255,255,.12); }

/* ---------- Raster ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(10px, 2.2vw, 26px);
  max-width: 1040px;
  margin: 18px auto 0;
  padding: 12px clamp(12px, 3vw, 28px) 32px;
}
@media (max-width: 860px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Türchen = Trommelfell ---------- */
.door {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  transition: transform .2s ease, filter .2s ease;
}
.door:nth-child(odd)  { transform: rotate(-2deg); }
.door:nth-child(3n)   { transform: rotate(2.5deg); }
.door:hover:not(.locked), .door:focus-visible { transform: translateY(-4px) rotate(0); }
.door:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; border-radius: 50%; }

.door svg { width: 100%; height: 100%; display: block; overflow: visible;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.45)); }

.door .num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 4.6vw, 2.6rem);
  line-height: 1;
  pointer-events: none;
}
.door .tag {
  position: absolute; left: 50%; bottom: 25%;
  transform: translateX(-50%);
  font-size: clamp(.55rem, 1.5vw, .72rem);
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--red);
  font-weight: 700;
  pointer-events: none;
}

/* Gesperrt */
.door.locked { cursor: not-allowed; filter: saturate(.25) brightness(.62); }
.door.locked .tag { color: #6c5b45; }

/* Heute */
.door.today::before {
  content: "";
  position: absolute; inset: -7%;
  border-radius: 50%;
  border: 3px solid var(--gold);
  box-shadow: 0 0 24px 4px rgba(232,182,76,.55);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .55; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.04); }
}

/* Schon geöffnet */
.door.opened .num { color: #5c4a32; }
.door.opened .sticks { opacity: .35; }
.sticks { opacity: 0; transition: opacity .3s; }

/* Schlag-Animation */
.door.hit .headgroup { animation: hit .38s cubic-bezier(.2,.8,.3,1); transform-origin: 50% 50%; transform-box: fill-box; }
@keyframes hit {
  0% { transform: scale(1); }
  25% { transform: scale(.9); }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.door .ripple {
  position: absolute; inset: 18%;
  border-radius: 50%;
  border: 2px solid rgba(200,36,58,.75);
  opacity: 0;
  pointer-events: none;
}
.door.hit .ripple { animation: ripple .6s ease-out; }
@keyframes ripple {
  from { opacity: 1; transform: scale(.4); }
  to   { opacity: 0; transform: scale(1.5); }
}
.door.shake { animation: shake .4s; }
@keyframes shake {
  0%, 100% { translate: 0; }
  20% { translate: -6px; } 40% { translate: 6px; }
  60% { translate: -4px; } 80% { translate: 4px; }
}

/* ---------- Dialog mit Notenblatt ---------- */
dialog {
  width: min(980px, 96vw);
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: #fffdf8;
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(6,10,20,.72); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .28s cubic-bezier(.2,.9,.3,1.2); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }

.sheet-inner { padding: clamp(16px, 3vw, 28px); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-day {
  margin: 0; color: var(--red); font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; font-size: .8rem;
}
.sheet-head h2 { margin: .15em 0 0; font-family: Georgia, serif; font-size: clamp(1.4rem, 3.6vw, 2rem); }
.close {
  flex: none;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid #ddd2bd; background: #f6efe1; color: var(--ink);
  font-size: 1.1rem; cursor: pointer;
}
.close:hover { background: #efe3cc; }
.sheet-text { margin: .6em 0 0; color: #5a4a36; white-space: pre-line; }
.sheet-text:empty { display: none; }

.sheet-body { margin-top: 16px; display: grid; gap: 18px; }
.sheet-body img {
  display: block; width: 100%; height: auto;
  border-radius: 10px; border: 1px solid #eee4d1; background: #fff;
}
.sheet-body iframe {
  width: 100%; height: 72vh; border: 1px solid #eee4d1; border-radius: 10px; background: #fff;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .6em 1em; border-radius: 999px;
  background: var(--red); color: #fff; text-decoration: none; font-weight: 600; font-size: .95rem;
}
.btn.secondary { background: #efe3cc; color: var(--ink); }
.btn:hover { filter: brightness(1.08); }
.empty {
  padding: 28px; text-align: center; border: 2px dashed #e4d6b8; border-radius: 12px; color: #7a6648;
}

/* ---------- Sonstiges ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 10;
  transform: translate(-50%, 140%);
  opacity: 0; visibility: hidden;
  max-width: 92vw;
  padding: .8em 1.2em;
  border-radius: 999px;
  background: rgba(20,30,50,.95);
  border: 1px solid rgba(232,182,76,.5);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  transition: transform .3s cubic-bezier(.2,.9,.3,1.2), opacity .2s, visibility .3s;
  text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

.error { text-align: center; color: #ffb4b4; }

.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 10px 16px 32px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
