:root {
  --bg: #ffffff;
  --fg: #16181d;
  --gedaempft: #5c6370;
  --rand: #d5d9e0;
  --feld: #f6f7f9;
  --akzent: #2f6feb;
  --gut: #17794c;
  --schlecht: #c0392b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1116;
    --fg: #e6e8ec;
    --gedaempft: #949cab;
    --rand: #2a2e37;
    --feld: #171a21;
    --akzent: #5b8dfa;
    --gut: #3fbf85;
    --schlecht: #ef6b5e;
  }
}

* { box-sizing: border-box; }

/* Muss vor allen display-Regeln stehen und sie schlagen: sonst übersteuert
   etwa .kopf { display: flex } das hidden-Attribut, und vermeintlich
   ausgeblendete Bereiche bleiben sichtbar. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 2rem 1rem 4rem;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.55;
}

main {
  max-width: 44rem;
  margin: 0 auto;
}

h1 {
  font-size: 1.5rem;
  margin: 0;
}

h2 {
  font-size: 1.05rem;
  margin: 2rem 0 0.5rem;
}

.kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

/* Sprachwahl und Infolink stehen zusammen rechts in der Kopfzeile. Ohne
   diesen Rahmen würde die Sprachwahl bei schmalen Fenstern zwischen Titel und
   Link rutschen. */
.kopfrechts {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
}

.sprachen {
  display: flex;
  gap: 0.25rem;
}

.sprachen button {
  font: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.4rem;
  color: var(--gedaempft);
  background: none;
  border: 1px solid var(--rand);
  border-radius: 3px;
  cursor: pointer;
}

.sprachen button:hover {
  color: var(--fg);
  border-color: var(--gedaempft);
}

/* Die aktive Sprache wird nicht nur farblich hervorgehoben: Farbe allein
   unterscheidet für manche Augen zu wenig, deshalb zusätzlich das Gewicht.
   aria-pressed sagt es Vorlesewerkzeugen ohnehin. */
.sprachen button.aktiv {
  color: var(--fg);
  font-weight: 600;
  border-color: var(--gedaempft);
  background: var(--feld);
}

.infoknopf {
  color: var(--akzent);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

ul { padding-left: 1.2rem; }
li { margin-bottom: 0.6rem; }

pre {
  padding: 0.9rem;
  background: var(--feld);
  border: 1px solid var(--rand);
  border-radius: 8px;
  overflow-x: auto;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.4;
}

.teil-id { color: var(--gedaempft); }
.teil-key { color: var(--gut); font-weight: 600; }

label {
  display: block;
  margin: 1.25rem 0 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}

textarea, input[type=text], select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  background: var(--feld);
  color: var(--fg);
  border: 1px solid var(--rand);
  border-radius: 8px;
  font: inherit;
}

textarea {
  resize: vertical;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

button, .knopflink {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.7rem 1.2rem;
  background: var(--akzent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.leise {
  background: transparent;
  color: var(--akzent);
  border: 1px solid var(--rand);
}

.linkfeld {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.5rem;
}

.linkfeld input {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.linkfeld button { margin-top: 0; white-space: nowrap; }

.hinweis {
  color: var(--gedaempft);
  font-size: 0.9rem;
}

.zaehler {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--gedaempft);
}

.zaehler.zuviel { color: var(--schlecht); font-weight: 600; }

.gut { color: var(--gut); font-weight: 600; }
.fehler { color: var(--schlecht); font-weight: 600; }

code {
  background: var(--feld);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

pre#klartext {
  margin: 1rem 0 0;
  padding: 1rem;
  background: var(--feld);
  border: 1px solid var(--rand);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

@media (max-width: 30rem) {
  .linkfeld { flex-direction: column; }
  .linkfeld button { margin-top: 0.5rem; }
}
