:root {
  --bg: #0f1115;
  --karte: #181c24;
  --rand: #262c38;
  --text: #e8eaef;
  --leise: #949cad;
  --gold: #e3b873;
  --gut: #4ccf7f;
  --fast: #e9b949;
  --falsch: #ef6a6a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

.screen { max-width: 560px; margin: 0 auto; }
.hidden { display: none; }

.brand { text-align: center; padding: 18px 0 6px; }
.brand-ar { font-size: 68px; color: var(--gold); font-family: "Amiri", "Scheherazade New", "Geeza Pro", "Al Bayan", "Traditional Arabic", serif; line-height: 1.5; }
.brand h1 { margin: 4px 0 6px; font-size: 26px; letter-spacing: .01em; }
.sub { margin: 0; color: var(--leise); font-size: 15px; line-height: 1.5; }

.stats { display: flex; gap: 10px; margin: 22px 0 18px; }
.stat {
  flex: 1; background: var(--karte); border: 1px solid var(--rand);
  border-radius: 14px; padding: 12px 10px; text-align: center;
}
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--leise); }

.levels { display: grid; gap: 10px; }
.level {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--karte); color: var(--text);
  border: 1px solid var(--rand); border-radius: 14px; padding: 15px 16px;
  font-size: 16px; font-family: inherit;
}
.level:active { background: #1f242e; }
.level .titel { font-weight: 600; }
.level .klein { display: block; font-size: 13px; color: var(--leise); font-weight: 400; margin-top: 3px; }
.level .ar { font-size: 26px; color: var(--gold); font-family: "Amiri", "Scheherazade New", "Geeza Pro", serif; }

.hinweis { margin: 22px 2px 0; font-size: 13px; line-height: 1.6; color: var(--leise); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 14px; }
.zaehler { font-size: 13px; color: var(--leise); }

.karte {
  background: var(--karte); border: 1px solid var(--rand); border-radius: 18px;
  padding: 26px 18px; text-align: center; min-height: 168px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.arabisch {
  font-family: "Amiri", "Scheherazade New", "Geeza Pro", "Al Bayan", "Traditional Arabic", serif;
  font-size: 58px; line-height: 1.75; color: var(--gold);
  word-spacing: .12em; overflow-wrap: anywhere;
}
.arabisch.lang { font-size: 40px; }
.arabisch.text { font-size: 30px; line-height: 2.1; text-align: center; }
.arabisch .w { border-radius: 6px; padding: 0 2px; }
.arabisch .w.gut { color: var(--gut); }
.arabisch .w.fast { color: var(--fast); }
.arabisch .w.falsch { color: var(--falsch); }

.karte.text { min-height: 210px; padding: 22px 14px; }
.bedeutung { font-size: 14px; color: var(--leise); min-height: 20px; }

form { margin: 0; }
#eingabe {
  width: 100%; font-size: 20px; font-family: inherit; text-align: center;
  padding: 15px 14px; border-radius: 14px;
  background: #11141a; color: var(--text); border: 1px solid var(--rand);
}
#eingabeLang {
  width: 100%; font-size: 17px; font-family: inherit; line-height: 1.6;
  padding: 13px 14px; border-radius: 14px; resize: vertical;
  background: #11141a; color: var(--text); border: 1px solid var(--rand);
}
#eingabe:focus, #eingabeLang:focus { outline: none; border-color: var(--gold); }
#eingabe::placeholder, #eingabeLang::placeholder { color: #5d6575; }

/* Loesung eines Textes: jedes Wort in seiner eigenen Farbe */
.wortliste { font-size: 16px; line-height: 1.9; }
.wortliste .w { padding: 1px 4px; border-radius: 5px; }
.wortliste .w.gut { color: var(--gut); }
.wortliste .w.fast { color: var(--fast); }
.wortliste .w.falsch { color: var(--falsch); background: rgba(239, 106, 106, .12); }

.knoepfe { display: flex; gap: 10px; margin-top: 12px; }
button { font-family: inherit; font-size: 16px; border-radius: 12px; cursor: pointer; }
.haupt {
  flex: 1; padding: 14px; border: none; font-weight: 600;
  background: var(--gold); color: #1a1408;
}
.ghost {
  padding: 14px 16px; background: transparent; color: var(--leise);
  border: 1px solid var(--rand);
}
.ghost:active { color: var(--text); }

/* Steht ueber dem Eingabefeld: auf dem Handy verdeckt die Tastatur sonst
   genau die Zeile, die man lesen will. Feste Hoehe, damit nichts springt. */
.antwort { margin: 16px 2px; min-height: 96px; font-size: 15px; line-height: 1.6; }
.antwort .zeile { display: flex; align-items: baseline; gap: 10px; }
.antwort .kopf { font-weight: 700; font-size: 17px; }
.antwort.gut .kopf { color: var(--gut); }
.antwort.fast .kopf { color: var(--fast); }
.antwort.falsch .kopf { color: var(--falsch); }
.antwort .loesung { font-size: 22px; letter-spacing: .01em; margin: 8px 0 2px; }
.antwort .sagt { color: var(--leise); font-size: 14px; }
