/* Latein im Advent - Gestaltung. Mobile first, keine externen Schriften, keine Tracker. */

:root {
  --nacht: #12212e;
  --nacht-tief: #0c1720;
  --karte: #1b3040;
  --karte-hell: #244054;
  --rand: #35576e;
  --gold: #e8b84b;
  --gold-tief: #b88c22;
  --tanne: #2f6b4f;
  --tanne-hell: #3f8a66;
  --rot: #b4443c;
  --schrift: #f2ece0;
  --schrift-leise: #b3c3ce;
  --radius: 14px;
  --tippflaeche: 48px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--nacht-tief);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(232, 184, 75, 0.10), transparent 42%),
    radial-gradient(circle at 88% 4%, rgba(232, 184, 75, 0.07), transparent 38%),
    linear-gradient(180deg, var(--nacht) 0%, var(--nacht-tief) 100%);
  background-attachment: fixed;
  color: var(--schrift);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

.huelle {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

/* ------------------------------------------------------------------ Kopf */

.kopf {
  text-align: center;
  padding-block: 20px 12px;
}

.kopf h1 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: 0.02em;
  color: var(--gold);
}

.kopf p {
  margin: 4px 0 0;
  color: var(--schrift-leise);
  font-size: 0.95rem;
}

.kennung {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--schrift-leise);
}

.kennung .marke {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: 999px;
  padding: 4px 12px;
}

.kennung .marke.test {
  background: var(--rot);
  border-color: var(--rot);
  color: #fff;
}

/* ------------------------------------------------------------------ Bausteine */

.karte {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

h2 { font-size: 1.2rem; margin: 0 0 12px; color: var(--gold); }
h3 { font-size: 1rem; margin: 20px 0 8px; color: var(--schrift); }

.geschichte {
  font-size: 1.02rem;
  line-height: 1.65;
  border-left: 3px solid var(--gold-tief);
  padding-left: 14px;
  margin: 0 0 18px;
}

.aufgabe { margin: 0 0 16px; color: var(--schrift-leise); }

.leise { color: var(--schrift-leise); font-size: 0.9rem; }

.hilfen {
  background: var(--nacht);
  border: 1px dashed var(--rand);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
  font-size: 0.92rem;
}

.hilfen b { color: var(--gold); font-weight: 600; }
.hilfen ul { margin: 6px 0 0; padding-left: 18px; }

/* ------------------------------------------------------------------ Knöpfe */

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--rand);
  background: var(--karte-hell);
  min-height: var(--tippflaeche);
  padding: 10px 16px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

button:hover:not(:disabled) { background: var(--rand); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

button:focus-visible,
select:focus-visible,
input:focus-visible,
.zelle:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.knopf-haupt {
  background: var(--tanne);
  border-color: var(--tanne-hell);
  font-weight: 600;
  width: 100%;
}

.knopf-haupt:hover:not(:disabled) { background: var(--tanne-hell); }

.knopf-leise {
  background: transparent;
  border-color: var(--rand);
  color: var(--schrift-leise);
}

.knopf-reihe { display: flex; gap: 10px; flex-wrap: wrap; }
.knopf-reihe > * { flex: 1 1 140px; }

/* ------------------------------------------------------------------ Formulare */

label { display: block; margin-bottom: 6px; font-weight: 600; }

select, input[type="text"], input[type="number"] {
  font: inherit;
  width: 100%;
  min-height: var(--tippflaeche);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--rand);
  background: var(--nacht);
  color: var(--schrift);
}

.feld { margin-bottom: 16px; }

/* ------------------------------------------------------------------ Kalender */

.kalender {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (min-width: 480px) {
  .kalender { grid-template-columns: repeat(6, 1fr); }
}

.tuer {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--rand);
  background: var(--karte-hell);
  font-size: 1.35rem;
  font-weight: 600;
  min-height: 0;
}

.tuer .datum { font-size: 0.6rem; font-weight: 400; color: var(--schrift-leise); }
.tuer .zeichen { font-size: 0.8rem; }

.tuer.zu { opacity: 0.4; }
.tuer.offen { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-tief) inset; }
.tuer.geloest { background: var(--tanne); border-color: var(--tanne-hell); }
.tuer.verbraucht { background: #3a2b2b; border-color: var(--rot); }

/* ------------------------------------------------------------------ Lösungssatz */

.satz {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin: 10px 0;
}

.satz .zeichen {
  width: 26px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid var(--rand);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
}

.satz .zeichen.gefunden { color: var(--gold); border-bottom-color: var(--gold-tief); }
.satz .zeichen.luecke { color: var(--rand); }
.satz .zeichen.pause { border-bottom: none; width: 12px; }

/* ------------------------------------------------------------------ Rätselteile */

.zeile-paar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rand);
}

.zeile-paar:last-child { border-bottom: none; }

.zeile-paar .vorgabe {
  font-weight: 600;
  font-size: 1.05rem;
}

.zeile-paar .vorgabe.latein { font-style: italic; color: var(--gold); }
.zeile-paar .vorgabe.bild { font-size: 2.2rem; font-style: normal; }

.wahlgruppe { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }

.wahl {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  min-height: var(--tippflaeche);
  background: var(--nacht);
}

.wahl .punkt {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--rand);
}

.wahl[aria-pressed="true"] { border-color: var(--gold); background: var(--karte-hell); }
.wahl[aria-pressed="true"] .punkt { border-color: var(--gold); background: var(--gold); }

.frage { font-weight: 600; margin: 18px 0 8px; }
.frage:first-child { margin-top: 0; }

.lateinsatz {
  font-style: italic;
  color: var(--gold);
  font-size: 1.08rem;
  margin: 18px 0 10px;
}

/* Wortsalat */

.kachelreihe { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }

.kachel {
  min-width: var(--tippflaeche);
  min-height: var(--tippflaeche);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 8px;
  background: var(--karte-hell);
}

.kachel.benutzt { opacity: 0.25; }

.gebaut {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 52px;
  align-items: center;
  padding: 8px;
  border: 1px dashed var(--rand);
  border-radius: 10px;
  background: var(--nacht);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.gebaut .leerer-hinweis { font-size: 0.85rem; font-weight: 400; letter-spacing: 0; color: var(--schrift-leise); }

/* Zahlenschloss */

.schloss { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }

.rad { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.rad .wert {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--nacht);
  border: 1px solid var(--rand);
  border-radius: 10px;
  color: var(--gold);
}

.rad button { min-width: 56px; min-height: 40px; padding: 4px; }

/* Lückentext */

.lueckentext { font-size: 1.05rem; line-height: 2.4; }
.lueckentext select { width: auto; display: inline-block; min-width: 120px; min-height: 40px; padding: 4px 8px; }

/* Kreuzworträtsel */

.gitter { display: grid; gap: 2px; justify-content: center; margin: 12px 0; }

.zelle {
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 1rem;
  font-weight: 700;
  background: var(--schrift);
  color: var(--nacht);
  border: 1px solid var(--rand);
  border-radius: 3px;
}

.zelle.leer { background: transparent; border-color: transparent; cursor: default; }
.zelle.gewaehlt { background: var(--gold); }
.zelle .nummer {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 0.5rem;
  font-weight: 400;
  color: var(--nacht);
}

.tastatur { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 12px 0; }
.tastatur button { min-height: 42px; min-width: 0; padding: 4px; font-weight: 600; }

.hinweisliste { font-size: 0.92rem; }
.hinweisliste li { margin-bottom: 4px; }
.hinweisliste li.fertig { color: var(--schrift-leise); }

/* Lied */

.lied { display: grid; gap: 14px; }

@media (min-width: 520px) {
  .lied { grid-template-columns: 1fr 1fr; }
}

.lied .text { font-style: italic; line-height: 2.2; }
.lied .uebersetzung { color: var(--schrift-leise); font-size: 0.95rem; line-height: 1.7; }
.lied select { width: auto; display: inline-block; min-width: 110px; min-height: 40px; padding: 4px 8px; }

.luecke-knopf {
  min-width: 110px;
  min-height: 40px;
  padding: 4px 10px;
  border-style: dashed;
  font-style: normal;
}

.luecke-knopf.gefuellt { border-style: solid; border-color: var(--gold); font-style: italic; }

/* ------------------------------------------------------------------ Rückmeldung */

.rueckmeldung {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 600;
  text-align: center;
}

.rueckmeldung.falsch { background: #40282a; border: 1px solid var(--rot); }
.rueckmeldung.richtig { background: #24452f; border: 1px solid var(--tanne-hell); }
.rueckmeldung.ende { background: var(--nacht); border: 1px solid var(--rand); color: var(--schrift-leise); }

.pruefcode {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.3rem;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-align: center;
  padding: 12px;
  background: var(--nacht);
  border: 1px solid var(--rand);
  border-radius: 10px;
  margin: 12px 0;
  user-select: all;
}

.fehlerkasten {
  background: #40282a;
  border: 1px solid var(--rot);
  border-radius: var(--radius);
  padding: 16px;
}

.fehlerkasten code {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--nacht-tief);
  border-radius: 6px;
  font-size: 0.9rem;
  overflow-x: auto;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Gitterzellen schrumpfen auf schmalen Bildschirmen mit, damit nichts überläuft. */
.gitter .zelle { font-size: clamp(0.55rem, 2.8vw, 1.05rem); }
.gitter .zelle .nummer { font-size: clamp(0.35rem, 1.5vw, 0.55rem); }
