/**
 * Vokabelfuchs – Gestaltung.
 *
 * Mobile-first: Die Basisregeln gelten für das Smartphone, größere Displays
 * bekommen ab 640 px bzw. 960 px mehr Raum. Alle Bedienelemente sind
 * mindestens 44 px hoch (Touch-Ziel).
 */

:root {
    --akzent: #b5651d;
    --akzent-hell: #d98b45;
    --papier: #fdf8ef;
    --karte: #ffffff;
    --tinte: #33281c;
    --tinte-leise: #7a6a56;
    --linie: #e6dccb;
    --gruen: #2e7d4f;
    --rot: #c0392b;
    --gelb: #c58a16;
    --radius: 12px;
    --schatten: 0 1px 3px rgba(0, 0, 0, .08);
}

html.dunkel {
    --papier: #1b1813;
    --karte: #262119;
    --tinte: #f0e9dd;
    --tinte-leise: #a89c88;
    --linie: #3b332a;
    --schatten: 0 1px 3px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

[x-cloak] { display: none !important; }

body {
    margin: 0;
    background: var(--papier);
    color: var(--tinte);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

h1, h2 { line-height: 1.25; }
h2 { font-size: 18px; margin: 22px 0 10px; }

small { color: var(--tinte-leise); }

/* ===================== Kopfzeile ===================== */

.kopf {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px
             max(12px, env(safe-area-inset-left));
    background: var(--akzent);
    color: #fff;
    box-shadow: var(--schatten);
}

.kopf-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    padding: 6px 0;
    cursor: pointer;
}

.fuchs { font-size: 24px; }
.kopf-titel { font-weight: 600; letter-spacing: .3px; }

.kopf-rechts { display: flex; align-items: center; gap: 6px; }

.symbol {
    min-width: 44px;
    min-height: 44px;
    background: rgba(255, 255, 255, .14);
    border: 0;
    border-radius: 10px;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
}

.plakette {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .2);
    font-size: 12px;
    white-space: nowrap;
}
.plakette.warnung { background: #8e2f20; }

/* ===================== Grundlayout ===================== */

.inhalt {
    max-width: 760px;
    margin: 0 auto;
    padding: 14px max(12px, env(safe-area-inset-left))
             calc(24px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
}

.seitentitel { font-size: 22px; margin: 4px 0 16px; }

.leer {
    padding: 18px;
    border: 1px dashed var(--linie);
    border-radius: var(--radius);
    color: var(--tinte-leise);
    text-align: center;
}

.zurueck {
    background: none;
    border: 0;
    color: var(--akzent);
    font: inherit;
    padding: 10px 0;
    cursor: pointer;
}

.meldung {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 15px;
}
.meldung.fehler { background: #fdecea; color: #8e2f20; }
.meldung.erfolg { background: #e7f4ec; color: #1f5c3a; }
html.dunkel .meldung.fehler { background: #4a211a; color: #ffd9d2; }
html.dunkel .meldung.erfolg { background: #1d3a2a; color: #cdeedb; }

/* ===================== Bedienelemente ===================== */

.knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--akzent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.knopf:disabled { opacity: .45; cursor: not-allowed; }
.knopf.gross { width: 100%; margin-top: 12px; font-size: 17px; }
.knopf.klein { min-height: 36px; padding: 6px 12px; font-size: 14px; margin-top: 8px; }
.knopf.zweitrangig { background: transparent; color: var(--akzent); border: 1px solid var(--akzent); }
.knopf.test { background: var(--gruen); }
.knopf.gefahr { background: var(--rot); width: 100%; }

input[type="text"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--linie);
    border-radius: 10px;
    background: var(--karte);
    color: var(--tinte);
    /* 16px verhindert das Auto-Zoom von iOS */
    font-size: 16px;
    font-family: inherit;
}
input:focus, select:focus { outline: 2px solid var(--akzent-hell); outline-offset: 1px; }

label { display: block; margin: 12px 0 4px; font-size: 14px; font-weight: 600; }

.formular {
    padding: 14px;
    margin-bottom: 16px;
    background: var(--karte);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
}
.formular .knopf { width: 100%; margin-top: 16px; }

.versionszeile { display: block; margin-top: 12px; text-align: center; }
.versionszeile a { color: var(--akzent); }

/* ===================== Anmeldung ===================== */

.login {
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}
.login-karte {
    width: 100%;
    max-width: 380px;
    padding: 26px 22px calc(26px + env(safe-area-inset-bottom));
    background: var(--karte);
    border: 1px solid var(--linie);
    border-radius: 16px;
    box-shadow: var(--schatten);
    text-align: center;
}
.login-fuchs { font-size: 54px; line-height: 1; }
.login-karte h1 { margin: 6px 0 2px; color: var(--akzent); }
.unterzeile { margin: 0 0 18px; color: var(--tinte-leise); font-size: 14px; }
.login-karte label { text-align: left; }

/* ===================== Kacheln ===================== */

.kacheln {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.kachel {
    padding: 14px 12px;
    background: var(--karte);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    text-align: center;
}
.kachel.anklickbar { cursor: pointer; }
.kachel-wert { display: block; font-size: 26px; font-weight: 700; color: var(--akzent); }
.kachel-text { display: block; font-size: 12px; color: var(--tinte-leise); }

/* ===================== Listen ===================== */

.listenkarte {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    padding: 14px;
    background: var(--karte);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--schatten);
}
.listenkarte.statisch { cursor: default; }

.listenkarte-kopf { display: flex; align-items: center; gap: 12px; }
.listenkarte-kopf strong { display: block; font-size: 16px; }
.listenkarte-kopf small { display: block; font-size: 13px; }

.flagge { font-size: 26px; }

.lektionsnummer {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--akzent);
    color: #fff;
    font-weight: 700;
}

.urkundensymbol { margin-left: auto; font-size: 22px; }

.balken {
    height: 10px;
    margin-top: 10px;
    background: var(--linie);
    border-radius: 999px;
    overflow: hidden;
}
.balken.schlank { height: 6px; }
.balken-fuellung {
    height: 100%;
    background: linear-gradient(90deg, var(--akzent), var(--akzent-hell));
    transition: width .3s ease;
}
.balken-text { display: block; margin-top: 4px; font-size: 12px; }

.knopfzeile { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.knopfzeile .knopf { flex: 1 1 100px; }

.hinweiszeile { display: block; margin-top: 6px; font-size: 12px; }
.urkundenlink { display: inline-block; margin-top: 8px; color: var(--akzent); font-size: 14px; }

/* ===================== Vokabelliste ===================== */

.filterzeile {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}
.filterknopf {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 6px 14px;
    border: 1px solid var(--linie);
    border-radius: 999px;
    background: var(--karte);
    color: var(--tinte);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}
.filterknopf.aktiv { background: var(--akzent); border-color: var(--akzent); color: #fff; }

.vokabelzeile {
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--karte);
    border: 1px solid var(--linie);
    border-left-width: 4px;
    border-radius: var(--radius);
}
.vokabelzeile.war-richtig { border-left-color: var(--gruen); }
.vokabelzeile.war-falsch { border-left-color: var(--rot); }
.vokabelzeile-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.uebersetzung { color: var(--tinte-leise); }
.beispiel { display: block; margin-top: 4px; font-style: italic; font-size: 13px; }

.status {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    white-space: nowrap;
    background: var(--linie);
    color: var(--tinte-leise);
}
.status-aktiv { background: #fdf0d5; color: #8a5d00; }
.status-gelernt { background: #e2eefc; color: #1c4e80; }
.status-sicher, .status-getestet { background: #e7f4ec; color: #1f5c3a; }

.wortzeile { display: inline-flex; align-items: center; gap: 6px; }

.lautsprecher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--linie);
    border-radius: 50%;
    background: var(--karte);
    color: var(--akzent);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    touch-action: manipulation;
}
.lautsprecher:active { background: var(--akzent-hell); }

/* ===================== Üben und Test ===================== */

.uebung-kopf { display: flex; align-items: center; justify-content: space-between; }
.zaehler { font-variant-numeric: tabular-nums; color: var(--tinte-leise); font-size: 14px; }

.richtungswahl { margin-bottom: 16px; }

.testhinweis {
    margin: 10px 0 14px;
    padding: 10px 12px;
    background: #e7f4ec;
    border-radius: var(--radius);
    color: #1f5c3a;
    font-size: 14px;
}
html.dunkel .testhinweis { background: #1d3a2a; color: #cdeedb; }

.fragekarte {
    margin-top: 14px;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    background: var(--karte);
    border: 1px solid var(--linie);
    border-radius: 16px;
    box-shadow: var(--schatten);
    text-align: center;
}
.richtungshinweis { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.frage { margin: 14px 0 6px; font-size: 28px; font-weight: 700; word-break: break-word; }
.wortart { display: block; margin-top: 4px; font-size: 12px; }

.antwort { margin-top: 18px; text-align: center; font-size: 18px; }
.antwort.richtig { border-color: var(--gruen); background: #f2fbf6; }
.antwort.falsch { border-color: var(--rot); background: #fdf3f2; }
html.dunkel .antwort.richtig { background: #1d3a2a; }
html.dunkel .antwort.falsch { background: #3a211d; }

.rueckmeldung { margin-top: 14px; }
.treffer { color: var(--gruen); font-weight: 600; font-size: 18px; }
.daneben { color: var(--rot); font-size: 16px; }
.fast { color: var(--gelb); font-size: 16px; }
.statuszeile { display: block; margin-top: 8px; font-size: 12px; }

.geschafft {
    margin-top: 24px;
    padding: 26px 18px;
    background: var(--karte);
    border: 1px solid var(--linie);
    border-radius: 16px;
    text-align: center;
}
.gross-emoji { font-size: 56px; line-height: 1; }

.ergebniskarte {
    padding: 24px 18px;
    background: var(--karte);
    border: 1px solid var(--linie);
    border-radius: 16px;
    text-align: center;
}
.ergebnis-prozent { font-size: 42px; font-weight: 700; color: var(--akzent); }
.bestanden { color: var(--gruen); font-weight: 600; }
.nichtbestanden { color: var(--tinte-leise); }

/* ===================== Größere Displays ===================== */

@media (min-width: 640px) {
    .kacheln { grid-template-columns: repeat(4, 1fr); }
    .frage { font-size: 34px; }
    .knopf.gross { width: auto; min-width: 220px; }
    .formular .knopf { width: auto; min-width: 200px; }
    .knopf.gefahr { width: auto; min-width: 200px; }
}

@media (min-width: 960px) {
    .inhalt { padding-top: 22px; }
    .seitentitel { font-size: 26px; }
}

/* Keine Animationen, wenn das System sie abbestellt hat. */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
