[hidden] { display: none !important; }
:root {
  --nacht: #0d1730;
  --nacht-2: #13213f;
  --flaeche: #182a4f;
  --flaeche-2: #1f3561;
  --linie: #2d4677;
  --text: #eef2fb;
  --text-2: #aab6d3;
  --gold: #e8b84a;
  --gold-2: #f6d98a;
  --rot: #c8453c;
  --gruen: #4fae7e;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background: radial-gradient(ellipse at top, #1d3266 0%, var(--nacht) 55%) fixed, var(--nacht);
  line-height: 1.5;
}
#schnee { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
header, main, footer { position: relative; z-index: 1; }

.kopf { text-align: center; padding: 48px 16px 24px; }
.kopf-stern { width: 44px; height: 44px; fill: var(--gold); filter: drop-shadow(0 0 14px rgba(232,184,74,.55)); }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 6vw, 46px); margin: 8px 0 6px; letter-spacing: .01em; }
.unterzeile { color: var(--text-2); margin: 0 auto; max-width: 34em; }

main { max-width: 960px; margin: 0 auto; padding: 0 16px 40px; }
.abschnitt { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 36px 0 14px; }

.vorschau { background: #3a2a07; border: 1px solid var(--gold); color: var(--gold-2); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.vorschau a { color: inherit; }

/* Gutscheinkarte */
.gutschein {
  background: linear-gradient(135deg, #8f1f2a 0%, #b8343a 45%, #7e1b25 100%);
  border-radius: 18px;
  padding: 20px 22px 24px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.12);
  position: relative;
  overflow: hidden;
}
.gutschein::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 62%; width: 22px;
  background: linear-gradient(90deg, #d8a73e, #f6d98a 50%, #d8a73e); opacity: .9;
}
.gutschein > * { position: relative; z-index: 1; }
.gutschein-kopf { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--serif); font-size: 20px; margin-bottom: 14px; }
.gutschein-fortschritt { font-family: var(--sans); font-size: 13px; background: rgba(0,0,0,.28); padding: 3px 10px; border-radius: 99px; }
.gutschein-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: #ffd9d4; margin: 10px 0 6px; }
.slots { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.slot-ziffern { display: flex; gap: 2px; }
.ziffer {
  width: 24px; height: 34px; display: grid; place-items: center;
  background: rgba(0,0,0,.32); border-radius: 6px;
  font: 600 19px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: rgba(255,255,255,.35);
}
.slot.voll .ziffer { background: #fff7e6; color: #5a1018; box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.slot.neu .ziffer { animation: auf .6s ease both; }
.slot-tag { font-size: 10px; color: #ffd9d4; opacity: .8; }
@keyframes auf { from { transform: rotateX(90deg); } to { transform: none; } }

/* Türen */
.tueren { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 720px) { .tueren { grid-template-columns: repeat(3, 1fr); } .tuer { aspect-ratio: 1 / 1.05; } }
@media (max-width: 440px) { .tueren { grid-template-columns: repeat(2, 1fr); } }
.tuer {
  aspect-ratio: 5 / 4; border-radius: var(--radius); border: 1px solid var(--linie);
  background: linear-gradient(160deg, var(--flaeche-2), var(--flaeche));
  color: var(--text); font: inherit; cursor: pointer; padding: 12px;
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tuer:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.tuer:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.tuer-nr { font-family: var(--serif); font-size: clamp(34px, 7vw, 46px); line-height: 1; color: var(--gold); }
.tuer-info { font-size: 13px; color: var(--text-2); }
.tuer:disabled { cursor: default; opacity: .55; background: var(--nacht-2); }
.tuer:disabled .tuer-nr { color: var(--text-2); }
.tuer.geloest { border-color: rgba(79,174,126,.6); }
.tuer.geloest .tuer-info { color: #9fe0bd; }
.tuer.heute { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 24px rgba(232,184,74,.25); }

/* Fertig */
.fertig { margin-top: 24px; background: var(--flaeche); border: 1px solid var(--gold); border-radius: var(--radius); padding: 20px 22px; text-align: center; }
.fertig h2 { font-family: var(--serif); color: var(--gold-2); margin: 0 0 6px; font-size: 28px; }
.code-liste { margin: 16px 0 0; display: grid; gap: 12px; }
.code-liste dt { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-2); }
.code-liste dd { margin: 4px 0 0; display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.code-liste code { font: 600 clamp(18px, 5vw, 26px)/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; word-break: break-all; }

/* Knöpfe */
.knopf {
  font: 600 15px var(--sans); border: 0; border-radius: 10px; padding: 10px 18px; cursor: pointer;
  background: var(--gold); color: #2a1d02;
}
.knopf:hover { background: var(--gold-2); }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf.klein { padding: 5px 10px; font-size: 13px; }
.knopf.leise { background: transparent; color: var(--gold-2); border: 1px solid var(--linie); }
.knopf.leise:hover { border-color: var(--gold); }

/* Dialog */
dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  border: 1px solid var(--linie); border-radius: 18px; padding: 26px 24px 22px;
  background: var(--nacht-2); color: var(--text);
}
dialog.breit { width: min(1180px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5,10,24,.7); backdrop-filter: blur(3px); }
.d-schliessen { position: absolute; top: 10px; right: 12px; margin: 0; }
.d-schliessen button { background: none; border: 0; color: var(--text-2); font-size: 28px; cursor: pointer; line-height: 1; padding: 4px 8px; }
.d-nummer { font-family: var(--serif); color: var(--gold); font-size: 15px; letter-spacing: .08em; text-transform: uppercase; }
dialog h2 { font-family: var(--serif); font-weight: 600; margin: 4px 0 12px; font-size: 26px; }
.frage { font-weight: 600; color: var(--gold-2); }
.antwort { display: flex; gap: 8px; margin: 16px 0 6px; }
.antwort input, .rad input {
  flex: 1; min-width: 0; font: 500 18px var(--sans); padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--linie); background: var(--nacht); color: var(--text);
}
.antwort input:focus, .rad input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.meldung { min-height: 1.5em; margin: 8px 0 0; font-weight: 600; }
.meldung.ok { color: #9fe0bd; }
.meldung.falsch { color: #ff9c92; }
.meldung.hinweis { color: var(--gold, #e8b84a); }
.geloest-box { background: rgba(79,174,126,.15); border: 1px solid rgba(79,174,126,.5); border-radius: 10px; padding: 10px 14px; margin-top: 14px; }

.versuche { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.versuche li { display: flex; gap: 12px; align-items: flex-start; background: var(--flaeche); border-radius: 10px; padding: 8px 12px; }
.versuche code { font: 700 18px ui-monospace, Menlo, monospace; letter-spacing: .2em; color: var(--gold-2); white-space: nowrap; }

.tipps { margin-top: 18px; border-top: 1px solid var(--linie); padding-top: 14px; }
.tipps ol { margin: 0 0 10px; padding-left: 20px; color: var(--text-2); }
.tipps ol:empty { display: none; }
.tipps li + li { margin-top: 6px; }

/* Tresor */
.tresor { margin-top: 16px; text-align: center; }
.raeder { display: flex; justify-content: center; gap: 10px; margin-bottom: 14px; }
.rad { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rad button { width: 54px; height: 32px; border-radius: 8px; border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); font-size: 15px; cursor: pointer; }
.rad button:hover { border-color: var(--gold); }
.rad input { width: 54px; height: 62px; flex: none; text-align: center; font: 700 32px ui-monospace, Menlo, monospace; padding: 0; background: #0a1226; color: var(--gold-2); }
.protokoll { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; }
.protokoll li { display: flex; justify-content: center; gap: 14px; align-items: center; }
.protokoll code { font: 700 18px ui-monospace, Menlo, monospace; letter-spacing: .2em; }
.stern { font-size: 18px; }
.stern.gold { color: var(--gold); }
.stern.silber { color: #c9d2e6; }
.stern.leer { color: var(--linie); }
.legende { font-size: 13px; color: var(--text-2); margin-top: 12px; }
.tresor.offen .raeder input { background: #15351f; color: #9fe0bd; }

.fuss { text-align: center; color: var(--text-2); font-size: 13px; padding: 10px 16px 40px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  .slot.neu .ziffer { animation: none; }
  .tuer { transition: none; }
}

@media (max-width: 600px) {
  .gutschein { padding-right: 46px; }
  .gutschein::after { left: auto; right: 16px; width: 12px; }
}

/* Rätsel-Extras auf der Webseite */
.extras { margin: 4px 0 6px; }
.extras .sudoku { color: var(--text); }
.su-zelle input, .py-stein input {
  width: 100%; height: 100%; border: 0; background: transparent; color: var(--gold-2); text-align: center;
  font: 600 1em/1 ui-monospace, Menlo, monospace; padding: 0;
}
.su-zelle input:focus, .py-stein input:focus { outline: 2px solid var(--gold); outline-offset: -2px; }
.su-fest { color: var(--text); }
.py-stein input { font-size: 17px; }
.chiffre { background: var(--flaeche); border-radius: 10px; padding: 10px 12px; color: var(--gold-2); }
.aussagen b { color: var(--gold-2); }

/* Lichterkette */
.lichter { margin-top: 12px; text-align: center; }
.lampen { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 10px; max-width: 300px; margin: 0 auto; padding: 16px; border-radius: 14px; background: #0a1226; }
.lampe { aspect-ratio: 1; border-radius: 50% 50% 45% 45%; border: 2px solid #2a3554; background: #1b2440; cursor: pointer; transition: background .15s, box-shadow .15s; }
.lampe.an { background: var(--farbe); border-color: var(--farbe); box-shadow: 0 0 14px var(--farbe); }
.lampe:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lampe:disabled { cursor: default; }
.lichter-info { color: var(--text-2); font-size: 14px; margin: 10px 0 0; }
@media (prefers-reduced-motion: reduce) { .lampe { transition: none; } }
.su-zelle input::placeholder, .py-stein input::placeholder { color: var(--gold); opacity: .8; }

/* Passwortseite */
.zugang { max-width: 420px; }

/* Nonogramm + Logiktabelle */
.extras .nono, .extras .logik { color: var(--text); }
.nn-feld[data-nono], .lg-feld[data-logik] { cursor: pointer; user-select: none; -webkit-user-select: none; }
.nn-feld[data-nono]:hover, .lg-feld[data-logik]:hover { background: rgba(232,184,74,.15); }
.nn-feld[data-zustand="voll"] { background: var(--gold); }
.nn-feld[data-zustand="x"] { color: #ff9c92; font-size: 13px; }
.lg-feld[data-zustand="x"] { color: #ff9c92; }
.lg-feld[data-zustand="ok"] { color: #9fe0bd; background: rgba(79,174,126,.18); }
.nn-feld:focus-visible, .lg-feld:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* Thalia-Gutschein: Karte dreht sich um, wenn alles gelöst ist */
.karten-flip { display: grid; perspective: 1400px; }
.karten-flip > * { grid-area: 1 / 1; } /* Vorder- und Rückseite übereinander, Höhe = die größere */
.karten-flip .gutschein, .thalia-karte { backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 1.2s cubic-bezier(.2,.7,.2,1); }
.thalia-karte {
  transform: rotateY(180deg); border-radius: 18px; overflow: hidden;
  background: #0b5b33; color: #fff; box-shadow: 0 18px 40px rgba(0,0,0,.45); display: flex; flex-direction: column;
}
.karten-flip.offen .gutschein { transform: rotateY(-180deg); }
.karten-flip.offen .thalia-karte { transform: rotateY(0); }
.thalia-oben { background: #fff; padding: 14px 22px; display: flex; align-items: center; }
.thalia-logo { height: 38px; width: auto; display: block; }
.thalia-unten { padding: 12px 22px 18px; flex: 1; }
.thalia-titel { font-family: var(--serif); font-size: 22px; margin-bottom: 2px; }
.thalia-karte .gutschein-label { color: #cfe9da; margin: 8px 0 3px; }
.thalia-nummer { font: 700 clamp(18px, 4.2vw, 26px)/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; }
@media (prefers-reduced-motion: reduce) { .karten-flip .gutschein, .thalia-karte { transition: none; } }
.fertig a.knopf { display: inline-block; text-decoration: none; margin-top: 6px; }
