/* Adventskalender 2026 – Nachthimmel-Design */
:root {
  --nacht-1: #0b1d3a;
  --nacht-2: #17315c;
  --nacht-3: #24437a;
  --gold: #ffd54f;
  --text: #f4f7ff;
  --glas: rgba(255, 255, 255, .08);
  --glas-rand: rgba(255, 255, 255, .18);
  --schrift: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--schrift);
  line-height: 1.6;
  color: var(--text);
  background: linear-gradient(180deg, var(--nacht-1) 0%, var(--nacht-2) 70%, var(--nacht-3) 100%) fixed;
  overflow-x: hidden;
}
a { color: var(--gold); }

/* ---------- Dekoration (Schnee + Sterne, per deko.js) ---------- */
.deko-schnee, .deko-sterne { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.flocke { position: absolute; top: -10vh; color: #fff; opacity: .8; animation: fallen linear infinite; user-select: none; }
@keyframes fallen {
  from { transform: translate3d(0, -10vh, 0) rotate(0deg); }
  to   { transform: translate3d(var(--drift, 30px), 110vh, 0) rotate(360deg); }
}
.stern { position: absolute; width: 3px; height: 3px; background: var(--gold); border-radius: 50%; animation: funkeln 3s ease-in-out infinite; }
@keyframes funkeln { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

/* ---------- Layout ---------- */
.topbar { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; padding: 18px 16px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.topbar a { color: var(--text); text-decoration: none; font-weight: 700; padding: 8px 16px; border-radius: 999px; background: var(--glas); border: 1px solid var(--glas-rand); }
.topbar a:hover, .topbar a:focus-visible { background: rgba(255, 255, 255, .18); outline: none; }
main { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; padding: 24px 16px 80px; }
.zentriert { text-align: center; }

/* ---------- Startseite ---------- */
h1 { margin: 0 0 12px; font-size: clamp(32px, 7vw, 56px); line-height: 1.15; text-shadow: 0 3px 12px rgba(0, 0, 0, .4); }
h1 span { color: var(--gold); }
.girlande { font-size: 28px; letter-spacing: 8px; margin-bottom: 8px; }
.einleitung { max-width: 640px; margin: 0 auto 36px; font-size: 18px; opacity: .95; }

/* Handy: 4 Spalten x 6 Zeilen, größere Bildschirme: 6 Spalten x 4 Zeilen */
.tuerchen-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 2.5vw, 14px); max-width: 600px; margin: 0 auto; }
@media (min-width: 640px) { .tuerchen-grid { grid-template-columns: repeat(6, 1fr); max-width: 760px; } }
.tuerchen {
  position: relative; overflow: hidden;
  aspect-ratio: 1; border: 0; border-radius: 22px; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #fff; font: inherit; cursor: pointer;
  background: var(--bg);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.tuerchen::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255, 255, 255, .28) 0%, transparent 45%); pointer-events: none; }
.tuerchen:hover, .tuerchen:focus-visible { transform: translateY(-5px) rotate(-1.5deg); box-shadow: 0 14px 24px rgba(0, 0, 0, .45); outline: none; }
.tuerchen .nr { font-size: clamp(22px, 6.5vw, 34px); font-weight: 800; line-height: 1; text-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.tuerchen .motiv { font-size: clamp(16px, 5vw, 24px); }
.tuerchen.gesperrt { filter: saturate(.5) brightness(.75); }
.tuerchen.heute { outline: 3px solid var(--gold); outline-offset: 3px; animation: puls 1.8s ease-in-out infinite; }
@keyframes puls {
  0%, 100% { box-shadow: 0 8px 18px rgba(0, 0, 0, .35), 0 0 0 0 rgba(255, 213, 79, .6); }
  50% { box-shadow: 0 8px 18px rgba(0, 0, 0, .35), 0 0 0 12px rgba(255, 213, 79, 0); }
}
.c0 { --bg: linear-gradient(145deg, #e8334a, #ff6b6b); }
.c1 { --bg: linear-gradient(145deg, #12a37f, #3ddc97); }
.c2 { --bg: linear-gradient(145deg, #7c4dff, #c084fc); }
.c3 { --bg: linear-gradient(145deg, #ff9100, #ffd54f); }
.c4 { --bg: linear-gradient(145deg, #1e88e5, #64b5f6); }

.bonus-wrapper { display: flex; justify-content: center; margin-top: 28px; }
.bonus-wrapper.hidden { display: none; }
.tuerchen.bonus { width: 150px; --bg: linear-gradient(145deg, #b8860b, #ffd54f 55%, #fff1a8); color: #5b3b00; border: 2px solid #fff3b0; }
.tuerchen.bonus .nr { text-shadow: none; }

/* ---------- Türchen-Seiten ---------- */
.tag-kopf { text-align: center; margin: 8px 0 24px; }
.tag-nummer { display: inline-grid; place-items: center; width: 96px; height: 96px; border-radius: 28px; font-size: 52px; font-weight: 800; color: #fff; background: linear-gradient(145deg, #e8334a, #ff6b6b); box-shadow: 0 10px 24px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .4); transform: rotate(-4deg); }
.tag-monat { display: block; margin-top: 10px; font-size: 18px; letter-spacing: .2em; text-transform: uppercase; opacity: .85; }
.karte { background: var(--glas); border: 1px solid var(--glas-rand); border-radius: 24px; padding: 28px; margin-bottom: 24px; backdrop-filter: blur(6px); box-shadow: 0 10px 24px rgba(0, 0, 0, .25); }
.karte h2 { margin: 0 0 14px; font-size: 22px; color: var(--gold); }
.geschichte p { font-size: 18px; line-height: 1.8; margin: 0 0 1em; }
.geschichte p:last-child { margin-bottom: 0; }
.raetsel { border-color: rgba(255, 213, 79, .45); }
.tag-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tag-nav a { color: var(--text); text-decoration: none; font-weight: 700; padding: 10px 18px; border-radius: 999px; background: var(--glas); border: 1px solid var(--glas-rand); }
.tag-nav a:hover, .tag-nav a:focus-visible { background: rgba(255, 255, 255, .18); outline: none; }
.tag-nav .weiter { margin-left: auto; }

/* ---------- Bausteine für Rätsel ---------- */
.btn { font: inherit; font-weight: 700; color: #fff; border: 0; border-radius: 999px; padding: 10px 22px; cursor: pointer; background: linear-gradient(145deg, #12a37f, #3ddc97); box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }
.btn:hover, .btn:focus-visible { filter: brightness(1.1); outline: none; }
.btn.zweit { background: var(--glas); border: 1px solid var(--glas-rand); box-shadow: none; }
input[type="text"], input[type="number"], input[type="password"] {
  font: inherit; width: 100%; padding: 10px 14px; border-radius: 14px; color: var(--text);
  border: 1px solid var(--glas-rand); background: rgba(0, 0, 0, .25);
}
input::placeholder { color: rgba(244, 247, 255, .55); }

/* ---------- Popups (per popup.js) ---------- */
.popup-overlay { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(5, 12, 28, .7); backdrop-filter: blur(3px); }
.popup-overlay.offen { display: flex; }
.popup { width: 100%; max-width: 440px; text-align: center; padding: 28px 24px; border-radius: 24px; background: linear-gradient(180deg, #1d3a6b, #142a4f); border: 1px solid var(--glas-rand); box-shadow: 0 20px 40px rgba(0, 0, 0, .5); animation: aufpoppen .2s ease-out; }
@keyframes aufpoppen { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.popup h3 { margin: 0 0 10px; font-size: 24px; }
.popup p { margin: 0 0 18px; }
.popup .knoepfe { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.popup .fehler { color: #ff8a80; margin: -8px 0 12px; font-size: 15px; }
.popup input { margin-bottom: 14px; text-align: center; }
.hinweis-schrift { font-family: ui-monospace, Consolas, monospace; letter-spacing: .08em; }

@media (prefers-reduced-motion: reduce) {
  .flocke, .stern, .tuerchen.heute, .popup { animation: none; }
  .tuerchen { transition: none; }
}

/* ---------- PHP-Version: Sammlung, gelöste Türchen, Testhinweis ---------- */
.sammlung { max-width: 820px; margin: 0 auto 20px; padding: 10px 18px; border-radius: 999px; background: var(--glas); border: 1px solid var(--glas-rand); }
.sammlung .stueck { font-size: 26px; margin: 0 3px; }
.tuerchen.geloest { box-shadow: 0 8px 18px rgba(0, 0, 0, .35), 0 0 0 3px rgba(61, 220, 151, .8), inset 0 1px 0 rgba(255, 255, 255, .35); }
.testhinweis { margin-top: 40px; font-size: 14px; opacity: .7; }
.testhinweis code { background: rgba(0, 0, 0, .3); padding: 1px 6px; border-radius: 6px; }

/* ---------- Anleitung, Variante wählen, Spielstand ---------- */
.anleitung { max-width: 640px; margin: 0 auto 24px; text-align: left; background: var(--glas); border: 1px solid var(--glas-rand); border-radius: 18px; padding: 4px 18px; }
.anleitung summary { cursor: pointer; font-weight: 700; padding: 12px 0; text-align: center; }
.anleitung ul { margin: 0 0 12px; padding-left: 20px; }
.anleitung li { margin-bottom: 8px; }
.steuerung { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; margin: 0 auto 24px; }
.modus-wahl { display: inline-flex; border-radius: 999px; background: var(--glas); border: 1px solid var(--glas-rand); padding: 4px; }
.modus-wahl button { font: inherit; font-weight: 700; color: var(--text); background: transparent; border: 0; border-radius: 999px; padding: 8px 18px; cursor: pointer; }
.modus-wahl button[aria-pressed="true"] { background: linear-gradient(145deg, #12a37f, #3ddc97); color: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }
.tuerchen.symbol-modus .nr { font-size: clamp(28px, 9vw, 44px); text-shadow: none; }
.tuerchen.symbol-modus .motiv { font-size: clamp(14px, 4.5vw, 20px); min-height: 1.2em; }
.popup .code { font-family: ui-monospace, Consolas, monospace; font-size: 26px; font-weight: 700; letter-spacing: .1em; color: var(--gold); user-select: all; }
