/* Türchenzauber – Empfänger-Seite. Systemschriften, keine externen Ressourcen. */
:root {
  --bg1: #14213D; --bg2: #24365E; --door: #1E2F55; --door2: #2A3F6E; --edge: #E3A92B; --num: #F6E7C1;
  --ink: #FFF7EE; --muted: rgba(255, 247, 238, .72); --accent: #E3A92B; --red: #A61E2D;
  --serif: Georgia, "Times New Roman", "DejaVu Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body[data-theme="rot"] { --bg1: #6E141E; --bg2: #A61E2D; --door: #8A1A27; --door2: #A82535; --edge: #F2C46B; --num: #FFF1D6; --accent: #F2C46B; }
body[data-theme="tanne"] { --bg1: #143426; --bg2: #1F4D3A; --door: #1C4535; --door2: #275C47; --edge: #E3A92B; --num: #F6E7C1; --accent: #E3A92B; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans); color: var(--ink); line-height: 1.45;
  background: radial-gradient(120% 70% at 50% 0%, var(--bg2) 0%, var(--bg1) 62%) fixed, var(--bg1);
  -webkit-font-smoothing: antialiased;
}
body.noscroll { overflow: hidden; }
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.wrap { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 16px 16px 40px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; opacity: .9; }
.brand svg { width: 22px; height: 22px; color: var(--accent); }

.hero { text-align: center; padding: 22px 0 18px; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 700; color: var(--accent); }
h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(30px, 7vw, 52px); line-height: 1.08; margin: 8px 0 6px; overflow-wrap: anywhere; }
.names { margin: 0; font-size: 17px; color: var(--muted); overflow-wrap: anywhere; }
.status { margin: 14px auto 0; display: inline-block; padding: 8px 16px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); font-weight: 600; font-size: 15px; max-width: 100%; }
.status:empty { display: none; }
.demo-banner { text-align: center; margin: 0 auto 14px; padding: 8px 14px; border-radius: 12px; background: var(--accent); color: #2A1A14; font-weight: 700; font-size: 14px; max-width: 520px; }

/* --- Türchen --- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; perspective: 900px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(6, 1fr); gap: 14px; } }
.door {
  position: relative; aspect-ratio: 1 / 1; border: 0; padding: 0; margin: 0; cursor: pointer; border-radius: 14px;
  background: rgba(0,0,0,.28); color: var(--num); font: inherit; overflow: visible;
  -webkit-tap-highlight-color: transparent;
}
.door:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.inside { position: absolute; inset: 0; border-radius: 14px; overflow: hidden; background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; }
.inside img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inside-star svg { width: 42%; height: 42%; color: var(--accent); opacity: .85; }
.leaf {
  position: absolute; inset: 0; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(155deg, var(--door2), var(--door));
  border: 2px solid color-mix(in srgb, var(--edge) 70%, transparent);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.04), 0 6px 16px rgba(0,0,0,.28);
  transform-origin: left center; transition: transform .75s cubic-bezier(.3,.7,.2,1), opacity .75s;
  backface-visibility: hidden;
}
.leaf::after { content: ""; position: absolute; right: 9px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--edge); opacity: .9; }
.num { font-family: var(--serif); font-weight: 700; font-size: clamp(24px, 7vw, 40px); line-height: 1; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.d24 .leaf { background: linear-gradient(155deg, #F2C46B, #C98A12); border-color: #FFF1D6; }
.d24 .num { color: #3A2408; text-shadow: none; }
.d6 .leaf::before { content: ""; position: absolute; inset: 6px; border-radius: 9px; border: 1px dashed color-mix(in srgb, var(--edge) 60%, transparent); }
.lock { position: absolute; bottom: 7px; right: 7px; width: 15px; height: 15px; opacity: .6; }
.lock svg { width: 100%; height: 100%; }
.locked .leaf { filter: saturate(.75) brightness(.92); }
.locked .num { opacity: .78; }
.openme { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.d24 .openme { color: #3A2408; }
.ready .leaf { box-shadow: 0 0 0 2px var(--accent), 0 0 22px color-mix(in srgb, var(--accent) 60%, transparent), 0 6px 16px rgba(0,0,0,.3); }
.today .leaf { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.045); } }
.opening .leaf, .seen .leaf { transform: rotateY(-108deg); opacity: .0; }
.opening .leaf { opacity: 1; animation: none; }
.seen .leaf { transition: none; }
.badge { position: absolute; top: 6px; left: 6px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 800; display: none; align-items: center; justify-content: center; }
.seen .badge { display: inline-flex; }
.shake { animation: shake .45s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* --- Meldungen --- */
.msg { text-align: center; padding: 36px 18px; border-radius: 18px; background: rgba(255,255,255,.08); }
.msg svg { width: 42px; height: 42px; color: var(--accent); }
.msg h2 { font-family: var(--serif); margin: 10px 0 6px; font-size: 24px; }
.msg p { margin: 0 0 14px; color: var(--muted); }
.btn { border: 0; border-radius: 999px; padding: 12px 22px; font: inherit; font-weight: 700; background: var(--accent); color: #2A1A14; cursor: pointer; }

/* --- Fuß --- */
.foot { margin-top: 30px; text-align: center; font-size: 14px; color: var(--muted); }
.cta { display: inline-block; padding: 12px 18px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); color: var(--ink); text-decoration: none; font-weight: 700; }
.cta:hover { background: rgba(255,255,255,.2); }
.del { margin: 14px 0 6px; }
.legal a { color: var(--muted); }
.langsel select { margin-top: 10px; background: rgba(255,255,255,.1); color: var(--ink); border: 1px solid rgba(255,255,255,.25); border-radius: 10px; padding: 6px 10px; font: inherit; }
.langsel option { color: #222; }

/* --- Modal --- */
.modal { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5, 8, 20, .72); opacity: 0; transition: opacity .2s; }
.modal.show { opacity: 1; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; border-radius: 20px; background: #FFF7EE; color: #2A1A14; padding: 18px 18px 14px; box-shadow: 0 24px 60px rgba(0,0,0,.45); transform: translateY(14px) scale(.97); transition: transform .25s; }
.modal.show .sheet { transform: none; }
.x { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(42,26,20,.08); color: #2A1A14; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.x svg { width: 20px; height: 20px; }
.m-num { margin: 4px 48px 12px 2px; font-family: var(--serif); font-weight: 700; font-size: 20px; color: var(--red); }
.m-fig { margin: 0 0 12px; border-radius: 14px; overflow: hidden; background: #EFE3D3; }
.m-fig img { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: contain; background: #EFE3D3; }
.m-text { margin: 0 2px 12px; font-size: 18px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.m-nav { display: flex; justify-content: space-between; gap: 10px; }
.nav { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--red); font: inherit; font-weight: 700; padding: 10px 6px; cursor: pointer; }
.nav:disabled { opacity: .3; cursor: default; }
.nav svg { width: 18px; height: 18px; }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 20; transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: #FFF7EE; color: #2A1A14; font-weight: 700; box-shadow: 0 12px 30px rgba(0,0,0,.35); opacity: 0; transition: opacity .25s, transform .25s; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .leaf { transition: none; } .today .leaf { animation: none; } .shake { animation: none; }
}
