:root {
  --nacht: #0b1d2a; --nacht2: #16324a; --gold: #f0c85a; --rot: #b3203a; --gruen: #1f6b4a;
  --text: #f6f1e7; --leise: #b9c4cf; --karte: rgba(255,255,255,.08);
  --safe-oben: env(safe-area-inset-top, 0px); --safe-unten: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(ellipse at top, var(--nacht2) 0%, var(--nacht) 60%, #050e16 100%) fixed;
  color: var(--text); overflow-x: hidden;
  padding: calc(var(--safe-oben) + 8px) 16px calc(var(--safe-unten) + 16px);
  -webkit-user-select: none; user-select: none;
}
a { color: var(--gold); }
h1, h2 { margin: 0 0 6px; font-weight: 700; letter-spacing: .2px; }
.leise { color: var(--leise); margin: 0; font-size: 15px; }
.kosename { font-family: "Snell Roundhand", "Savoye LET", "Brush Script MT", cursive; font-size: 1.35em; color: var(--gold); }
.kopf { text-align: center; padding: 14px 0 10px; }
.kopf h1 { font-size: 28px; }
.vorschau-hinweis { color: var(--gold); font-size: 13px; margin: 6px 0 0; }
.fuss { text-align: center; font-size: 13px; color: var(--leise); margin-top: 22px; }
.fuss a, .link { color: var(--leise); }
.inline { display: inline; }
.link { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; color: var(--gold); }

/* Schnee */
#schnee { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
#schnee i { position: absolute; top: -10px; width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: .8;
  animation: fallen linear infinite; filter: blur(.3px); }
@keyframes fallen { to { transform: translate3d(var(--drift, 20px), 110vh, 0) rotate(360deg); } }

/* Kalender-Gitter */
.kalender { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 520px; margin: 0 auto; }
@media (min-width: 600px) { .kalender { gap: 14px; } body { padding-left: 24px; padding-right: 24px; } }

.tuer { position: relative; aspect-ratio: 1 / 1.08; border: 0; background: transparent; padding: 0; cursor: pointer;
  perspective: 700px; -webkit-perspective: 700px; border-radius: 12px; }
.tuer .innen { position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #3a2a10 0%, #1b1508 70%); box-shadow: inset 0 0 18px rgba(0,0,0,.8);
  border: 1px solid rgba(240,200,90,.25); }
.tuer .innen-symbol { font-size: 30px; opacity: 0; transform: scale(.4); transition: opacity .4s .35s, transform .5s .35s cubic-bezier(.2,1.4,.4,1); filter: drop-shadow(0 0 8px var(--gold)); }
.tuer .blatt { position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center;
  transform-origin: left center; transform-style: preserve-3d; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform .9s cubic-bezier(.3,.9,.3,1), box-shadow .9s;
  box-shadow: 0 4px 10px rgba(0,0,0,.45), inset 0 0 0 2px rgba(255,255,255,.12), inset 0 0 0 6px rgba(0,0,0,.08);
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 2px, transparent 2px 9px); }
.tuer.farbe-1 .blatt { background-color: #b3203a; }
.tuer.farbe-2 .blatt { background-color: #1f6b4a; }
.tuer.farbe-3 .blatt { background-color: #2d4f7a; }
.tuer.farbe-4 .blatt { background-color: #8e2a5a; }
.tuer.farbe-5 .blatt { background-color: #4a6a2a; }
.tuer.gold .blatt { background-color: #c9962d; background-image: linear-gradient(135deg, rgba(255,255,255,.35), transparent 50%, rgba(0,0,0,.15)); }
.tuer .zahl { font-family: Georgia, "Times New Roman", serif; font-size: clamp(26px, 8vw, 40px); font-weight: 700; color: #fff8e6;
  text-shadow: 0 2px 4px rgba(0,0,0,.6); }
.tuer.gold .zahl { color: #fff; }
.tuer .schloss { position: absolute; right: 7px; bottom: 6px; font-size: 13px; opacity: .85; }
.tuer.zu .blatt { filter: saturate(.55) brightness(.75); }
.tuer.offen-anim .blatt, .tuer.geoeffnet .blatt { transform: rotateY(-108deg); box-shadow: -8px 6px 16px rgba(0,0,0,.5); }
.tuer.offen-anim .innen-symbol, .tuer.geoeffnet .innen-symbol { opacity: 1; transform: scale(1); }
.tuer.geoeffnet .innen { animation: leuchten 3s ease-in-out infinite; }
@keyframes leuchten { 50% { box-shadow: inset 0 0 18px rgba(0,0,0,.8), 0 0 14px rgba(240,200,90,.45); } }
.tuer.wackeln { animation: wackeln .5s; }
@keyframes wackeln { 20%,60% { transform: translateX(-5px) rotate(-2deg); } 40%,80% { transform: translateX(5px) rotate(2deg); } }
.tuer.geloest .innen { background: radial-gradient(circle at 50% 40%, #5a3a10 0%, #2a1c08 70%); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-unten) + 24px); transform: translateX(-50%);
  background: rgba(20,30,40,.95); color: var(--text); padding: 12px 18px; border-radius: 14px; font-size: 15px;
  box-shadow: 0 6px 20px rgba(0,0,0,.5); z-index: 50; max-width: 90vw; text-align: center; border: 1px solid rgba(240,200,90,.35); }

/* Rätsel-Blatt */
.schleier { position: fixed; inset: 0; background: rgba(3,10,16,.7); z-index: 20; backdrop-filter: blur(3px); }
.blatt-dialog { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fbf5e8; color: #2b2118;
  border-radius: 22px 22px 0 0; padding: 18px 20px calc(var(--safe-unten) + 22px); max-height: 88vh; overflow: auto;
  transform: translateY(100%); transition: transform .45s cubic-bezier(.2,.9,.3,1); box-shadow: 0 -10px 40px rgba(0,0,0,.5);
  -webkit-user-select: text; user-select: text; }
.blatt-dialog.sichtbar { transform: translateY(0); }
.blatt-dialog .leise { color: #7a6a58; }
.blatt-innen { max-width: 520px; margin: 0 auto; }
.blatt-dialog h2 { font-size: 22px; color: #7b1a2b; margin-top: 2px; }
.schliessen { position: absolute; right: 12px; top: 10px; border: 0; background: #e8dfd0; width: 34px; height: 34px; border-radius: 50%; font-size: 15px; cursor: pointer; }
.raetsel { font-size: 17px; line-height: 1.5; font-style: italic; margin: 10px 0 16px; padding-left: 12px; border-left: 3px solid var(--gold); }
#antwort-form { display: flex; gap: 8px; }
#antwort-form input { flex: 1; font-size: 17px; padding: 12px 14px; border-radius: 12px; border: 1px solid #c9bda9; background: #fff; }
.knopf { background: var(--rot); color: #fff; border: 0; border-radius: 12px; padding: 12px 18px; font-size: 16px; font-weight: 600; cursor: pointer; box-shadow: 0 3px 0 #7b1a2b; }
.knopf:active { transform: translateY(2px); box-shadow: none; }
.rueckmeldung { min-height: 22px; margin: 12px 0 4px; font-weight: 600; color: #7b1a2b; }
.rueckmeldung.gut { color: var(--gruen); }
.tipp { background: #fff3c4; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
#aufgeben { display: block; margin-top: 8px; color: #7a6a58; }
.geschenk-symbol { font-size: 64px; text-align: center; animation: huepfen 1.2s ease-in-out infinite; }
@keyframes huepfen { 50% { transform: translateY(-8px) rotate(-4deg); } }
.geschenk-text { font-size: 17px; line-height: 1.55; }
#geschenk-fertig { display: block; margin: 14px auto 0; }
#konfetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }

/* Install-Hinweis */
.install { position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-unten) + 12px); z-index: 15; background: #fbf5e8; color: #2b2118;
  padding: 12px 14px; border-radius: 14px; font-size: 14px; display: flex; gap: 10px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.install .link { color: #7a6a58; text-decoration: none; font-size: 16px; }

/* Login */
.login { min-height: 80vh; display: grid; place-items: center; position: relative; z-index: 1; }
.login-karte { background: #fbf5e8; color: #2b2118; border-radius: 22px; padding: 28px 24px; width: min(380px, 100%); box-shadow: 0 16px 40px rgba(0,0,0,.5); text-align: center; }
.login-karte h1 { color: #7b1a2b; font-size: 30px; }
.login-karte .leise { color: #7a6a58; margin-bottom: 14px; }
.login-stern { color: var(--gold); font-size: 30px; }
.login label, .admin label { display: block; text-align: left; font-size: 13px; color: #7a6a58; margin: 10px 0 4px; }
.login input, .admin input, .admin textarea, .admin select { width: 100%; font-size: 17px; padding: 11px 12px; border-radius: 10px; border: 1px solid #c9bda9; background: #fff; margin-top: 4px; font-family: inherit; color: #2b2118; }
.login .knopf { width: 100%; margin-top: 16px; }
.fehler { color: #b3203a; font-weight: 600; }
.ok { color: #9ae6b4; }

/* Admin */
.admin { -webkit-user-select: text; user-select: text; }
.admin-liste { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; display: grid; gap: 10px; }
.admin-karte { background: #fbf5e8; color: #2b2118; border-radius: 14px; padding: 10px 14px; }
.admin-karte.erledigt { opacity: .85; }
.admin-karte.heute { outline: 3px solid var(--gold); }
.admin-karte summary { display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 600; list-style: none; }
.admin-karte summary::-webkit-details-marker { display: none; }
.admin-zahl { background: var(--rot); color: #fff; border-radius: 8px; min-width: 32px; text-align: center; padding: 4px 0; font-family: Georgia, serif; }
.admin-titel { flex: 1; }
.admin-status { font-size: 12px; color: #7a6a58; font-weight: 400; text-align: right; }
.admin-karte form { margin-top: 8px; }
.admin-karte .knopf { margin-top: 12px; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .zwei { grid-template-columns: 1fr; } }
.haken { display: flex !important; align-items: center; gap: 8px; font-size: 15px !important; color: #2b2118 !important; }
.haken input { width: auto; }
.hilfe ul { padding-left: 18px; font-size: 14px; line-height: 1.5; }
code { background: #eee4d2; padding: 1px 5px; border-radius: 4px; }
