:root {
  --nacht: #0b1d2a;
  --nacht2: #12324a;
  --tanne: #1f5c3a;
  --tanne-dunkel: #143f27;
  --rot: #b3202a;
  --rot-dunkel: #7e1219;
  --gold: #e8b64c;
  --creme: #fff6e5;
  --gruen-ok: #3a9a5b;
  --gelb-ok: #d6a531;
  --grau: #56606a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background-color: var(--nacht);
  background-image: radial-gradient(ellipse at top, var(--nacht2), var(--nacht) 70%);
  background-attachment: fixed;
  color: var(--creme);
  font-family: Georgia, 'Times New Roman', serif;
  -webkit-tap-highlight-color: transparent;
}

button, .knopf, .taste, .status, .anleitung, .hinweis, .label, .reiter-knopf, .zurueck { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }

#schnee { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#app { position: relative; z-index: 10; }
.laden { text-align: center; padding: 4rem 1rem; opacity: 0.7; }

header { text-align: center; padding: 2rem 1rem 1rem; }
h1 {
  font-size: clamp(1.9rem, 6vw, 3.4rem);
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.03em;
  text-shadow: 0 2px 0 var(--rot-dunkel), 0 0 24px rgba(232, 182, 76, 0.35);
}
.untertitel { margin: 0.5rem 0 0; opacity: 0.85; font-style: italic; }
.leiste { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; align-items: center; margin-top: 1rem; }
.vorschau { background: var(--gold); color: var(--nacht); padding: 0.2rem 0.7rem; border-radius: 999px; font: 600 0.8rem system-ui, sans-serif; }

main { max-width: 980px; margin: 0 auto; padding: 1rem 1rem 3rem; }
footer { text-align: center; opacity: 0.5; font-size: 0.85rem; padding-bottom: 2rem; }

.knopf {
  display: inline-block;
  border: 2px solid var(--gold);
  background: rgba(11, 29, 42, 0.6);
  color: var(--creme);
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
}
.knopf:hover { background: rgba(232, 182, 76, 0.18); }
.knopf:active { transform: scale(0.97); }
.knopf.klein { padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.knopf.aktiv { background: var(--gold); color: var(--nacht); }

.karte {
  max-width: 560px; margin: 2rem auto; text-align: center;
  background: rgba(31, 92, 58, 0.55); border: 3px solid var(--gold); border-radius: 16px; padding: 1.5rem;
}
.karte.privat .gross { font-size: 3rem; margin: 0; }
.mitte { text-align: center; }

/* ----- Kalender ----- */
.kalender {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(90px, 1fr);
  grid-auto-flow: dense;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.025) 0 12px, transparent 12px 24px),
    linear-gradient(160deg, var(--tanne), var(--tanne-dunkel));
  border: 4px solid var(--gold);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 0 40px rgba(0,0,0,0.35);
}
@media (max-width: 700px) { .kalender { grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(78px, 1fr); gap: 9px; padding: 12px; } }
@media (max-width: 420px) { .kalender { grid-template-columns: repeat(3, 1fr); } }
.breit { grid-column: span 2; }
.hoch { grid-row: span 2; }

.tuer { position: relative; perspective: 900px; border-radius: 10px; background: rgba(0,0,0,0.45); box-shadow: inset 0 0 18px rgba(0,0,0,0.7); }
.tuer button {
  all: unset; position: absolute; inset: 0; cursor: pointer; border-radius: 10px;
  transform-origin: left center; transition: transform 0.6s cubic-bezier(.3,.7,.3,1), box-shadow 0.2s;
  display: flex; align-items: center; justify-content: center;
  background: var(--farbe, var(--rot)); border: 2px dashed rgba(255, 246, 229, 0.55);
  box-shadow: 0 4px 10px rgba(0,0,0,0.35); overflow: hidden;
}
.tuer button::before { content: ''; position: absolute; inset: 0; background: var(--muster, none); opacity: 0.18; }
.tuer button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.nummer { position: relative; font-size: clamp(1.4rem, 4vw, 2.3rem); font-weight: bold; color: var(--creme); text-shadow: 0 2px 3px rgba(0,0,0,0.5); }
.stern { position: absolute; top: 4px; right: 8px; color: var(--gold); font-size: 1.1rem; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.tuer.offen button:hover { transform: rotateY(-12deg); box-shadow: 6px 6px 16px rgba(0,0,0,0.5); }
.tuer.zu button { cursor: not-allowed; filter: saturate(0.75) brightness(0.85); }
.tuer.zu .nummer::after { content: ' 🔒'; font-size: 0.5em; vertical-align: middle; }
.tuer.geloest button { transform: rotateY(-32deg); }
.tuer.aufgehen button { transform: rotateY(-105deg); }

.wackeln { animation: wackeln 0.4s; }
@keyframes wackeln {
  0%, 100% { translate: 0; }
  25% { translate: -6px 0; }
  75% { translate: 6px 0; }
}

.hinweis {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px);
  background: var(--creme); color: var(--nacht); padding: 0.8rem 1.2rem; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); transition: transform 0.35s, opacity 0.35s;
  opacity: 0; visibility: hidden; z-index: 60; font-size: 0.95rem; max-width: 92vw; text-align: center;
}
.hinweis.zeigen { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }

/* ----- Türchen-Seite ----- */
.tuerseite { max-width: 640px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }
.tuerseite header { padding: 1rem 0 0.5rem; }
.tuerseite h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); }
.tag { margin: 0 0 0.3rem; text-transform: uppercase; letter-spacing: 0.15em; font: 600 0.8rem system-ui, sans-serif; opacity: 0.75; }
.zurueck { color: var(--gold); text-decoration: none; font-size: 0.95rem; }
.zurueck:hover { text-decoration: underline; }
.label { margin: 0 0 0.4rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.8; }
.anleitung { text-align: center; opacity: 0.88; font-size: 0.95rem; line-height: 1.45; }
.status { text-align: center; min-height: 1.4em; font-size: 0.95rem; opacity: 0.9; }
.werkzeuge { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin: 0.8rem 0; }

.nachricht {
  margin: 1rem 0; padding: 1rem 1.2rem; border-radius: 14px;
  background: var(--creme); color: var(--nacht); box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  font-size: 1.05rem; line-height: 1.5; transform: rotate(-0.6deg);
}
.nachricht p:last-child { margin-bottom: 0; white-space: pre-line; }

.belohnung {
  margin: 1rem 0 1.5rem; padding: 1.3rem; text-align: center; border-radius: 16px;
  border: 3px solid var(--gold); background: linear-gradient(160deg, rgba(31,92,58,0.85), rgba(20,63,39,0.85));
}
.belohnung h2 { margin: 0 0 0.8rem; color: var(--gold); }
.zeile { font-size: 1.35rem; font-style: italic; margin: 0.4rem 0 1rem; line-height: 1.4; }
.zeile.leer, .leer { font-size: 1rem; opacity: 0.75; }

.reiter { display: flex; gap: 0.4rem; justify-content: center; flex-wrap: wrap; margin-bottom: 0.8rem; }
.reiter-knopf { border: 1px solid rgba(255,246,229,0.4); background: transparent; color: var(--creme); padding: 0.35rem 0.8rem; border-radius: 999px; cursor: pointer; font-size: 0.85rem; }
.reiter-knopf.aktiv { background: var(--creme); color: var(--nacht); }
.reiter-knopf.erledigt { border-color: var(--gruen-ok); }

/* ----- Sudoku ----- */
.sudoku {
  display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr);
  width: min(100%, 460px); aspect-ratio: 1; margin: 0.8rem auto;
  background: var(--creme); border: 3px solid var(--nacht); border-radius: 8px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}
.zelle {
  border: 0; border-right: 1px solid #c9bfa9; border-bottom: 1px solid #c9bfa9;
  background: transparent; color: #24506e; font: 600 clamp(1.05rem, 5vw, 1.6rem) system-ui, sans-serif;
  padding: 0; cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center;
}
.zelle:nth-child(9n) { border-right: 0; }
.zelle:nth-last-child(-n+9) { border-bottom: 0; }
.zelle.rand-r { border-right: 2px solid var(--nacht); }
.zelle.rand-u { border-bottom: 2px solid var(--nacht); }
.zelle.vorgabe { color: var(--nacht); font-weight: 800; }
.zelle.bereich { background: #efe3c8; }
.zelle.gleich { background: #f3d58e; }
.zelle.gewaehlt { background: var(--gold); }
.zelle.konflikt { color: var(--rot); }
.sudoku.geloest .zelle { background: #d8efd9; }
.notizen { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; font-size: clamp(0.45rem, 2vw, 0.65rem); color: #6b6b6b; font-weight: 500; }
.notizen span { display: flex; align-items: center; justify-content: center; }
.ziffern { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: min(100%, 460px); margin: 0 auto; }
.ziffer { border: 0; border-radius: 10px; background: var(--creme); color: var(--nacht); font: 700 1.35rem system-ui, sans-serif; padding: 0.6rem 0; cursor: pointer; box-shadow: 0 3px 0 #b9ab8c; }
.ziffer:active { transform: translateY(2px); box-shadow: 0 1px 0 #b9ab8c; }
.ziffer.loeschen { background: #e9dcc0; }

/* ----- Wordle ----- */
.wordle { display: grid; gap: 6px; justify-content: center; margin: 1rem auto; }
.wordle .reihe { display: grid; grid-template-columns: repeat(var(--laenge, 5), clamp(46px, 13vw, 58px)); gap: 6px; }
.wordle .feld {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,246,229,0.3); border-radius: 6px; font: 800 1.6rem system-ui, sans-serif; text-transform: uppercase;
}
.wordle .feld.voll { border-color: var(--creme); }
.f-g { background: var(--gruen-ok) !important; border-color: var(--gruen-ok) !important; color: #fff !important; }
.f-y { background: var(--gelb-ok) !important; border-color: var(--gelb-ok) !important; color: #fff !important; }
.f-x { background: var(--grau) !important; border-color: var(--grau) !important; color: #fff !important; }
.mini { padding: 0 0.35rem; border-radius: 4px; color: #fff; font-weight: 600; }
.tastatur { display: grid; gap: 6px; margin: 1rem auto 0; max-width: 520px; }
.tasten-reihe { display: flex; gap: 5px; justify-content: center; }
.taste {
  flex: 1; max-width: 44px; min-width: 0; height: 52px; border: 0; border-radius: 6px;
  background: #d9cfbb; color: var(--nacht); font: 700 1rem system-ui, sans-serif; cursor: pointer; padding: 0;
}
.taste.breit { max-width: 64px; flex: 1.5; font-size: 0.85rem; }

/* ----- Schach ----- */
.schachbrett {
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: min(100%, 480px); aspect-ratio: 1; margin: 0.6rem auto; border: 4px solid #5b3a1e; border-radius: 6px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.schachbrett .feld, .umwandlung .feld { min-width: 0; min-height: 0; border: 0; padding: 0; position: relative; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.feld.hell { background: #f0d9b5; }
.feld.dunkel { background: #b58863; }
.feld.letzter { background-image: linear-gradient(rgba(232, 182, 76, 0.55), rgba(232, 182, 76, 0.55)); }
.feld.auswahl { box-shadow: inset 0 0 0 4px rgba(31, 92, 58, 0.9); }
.feld.schach { background-image: radial-gradient(circle, rgba(220, 30, 30, 0.9) 0%, rgba(220, 30, 30, 0.35) 55%, transparent 75%); }
.feld.tipp { box-shadow: inset 0 0 0 4px #1e7bd8; }
.feld.ziel::after { content: ''; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(31, 92, 58, 0.55); }
.feld.ziel-schlag::after { content: ''; position: absolute; inset: 4%; border-radius: 50%; border: 5px solid rgba(31, 92, 58, 0.55); }
.figur { width: 86%; height: 86%; position: relative; z-index: 1; pointer-events: none; }
.figur.weiss g { fill: #fffaf0; stroke: #1d1d1d; }
.figur.schwarz g { fill: #2b2b2b; stroke: #0d0d0d; }
.figur.schwarz .auge { fill: #fffaf0; stroke: none; }
.figur.weiss .auge { fill: #1d1d1d; stroke: none; }
.koord { position: absolute; font: 700 0.62rem system-ui, sans-serif; opacity: 0.75; pointer-events: none; }
.koord.reihe { top: 2px; left: 3px; }
.koord.linie { bottom: 1px; right: 3px; }
.feld.hell .koord { color: #b58863; }
.feld.dunkel .koord { color: #f0d9b5; }
.umwandlung { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 0.6rem 0; }
.umwandlung[hidden] { display: none; }
.umwandlung p { margin: 0; }
.umwandlung .feld { width: 56px; height: 56px; border-radius: 8px; }

/* ----- Gedicht ----- */
.gedicht {
  margin: 1.5rem auto; padding: 1.5rem 1.4rem; border-radius: 6px; max-width: 520px;
  background: var(--creme); color: #3a2a1a; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  font-size: 1.15rem; line-height: 1.55;
}
.strophe { margin-bottom: 1.3rem; }
.strophe:last-child { margin-bottom: 0; }
.strophe p { margin: 0.1rem 0; font-style: italic; }
.strophe p.fehlt { height: 1.3em; border-bottom: 1px dashed #c9b89a; font-style: normal; }
.strophe p.fehlt span { font: 0.7rem system-ui, sans-serif; color: #b3a283; }
.hinweistext { opacity: 0.8; font-style: italic; }

/* ----- Konfetti ----- */
.konfetti { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 70; border-radius: 2px; animation: fallen linear forwards; pointer-events: none; }
@keyframes fallen { to { top: 105vh; rotate: 720deg; } }
