/* ═══════════════════════════════════════════════════════════
   Bild-Wörterbuch SHK — Stylesheet

   Zwei Grundsätze:
   1. Grosse Touch-Ziele. In der Werkstatt wird die App mit
      Arbeitshandschuhen bedient, auch im Hochformat.
   2. Ruhe im Bild. Das Foto ist das Lernmaterial, alles andere
      tritt zurueck.
   ═══════════════════════════════════════════════════════════ */

:root {
  --grund: #f4f6f8;
  --flaeche: #ffffff;
  --flaeche-2: #eef1f4;
  --text: #16222e;
  --text-2: #5b6b7a;
  --rahmen: #d9dfe5;
  --blau: #0f2233;
  --blau-hell: #1d3a52;
  --orange: #e87830;
  --orange-hell: #f2a068;
  --gruen: #1f8a54;
  --rot: #c1392b;
  --radius: 16px;
  --schatten: 0 2px 10px rgba(15, 34, 51, .08);
  --safe: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #0d1620;
    --flaeche: #15222f;
    --flaeche-2: #1d2c3b;
    --text: #eaf0f5;
    --text-2: #9aabba;
    --rahmen: #2b3d4f;
    --blau: #0a1420;
    --blau-hell: #1b3247;
    --schatten: 0 2px 12px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--grund);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 17px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

body { min-height: 100dvh; }

.versteckt { display: none !important; }

.bild-ansicht {
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px calc(16px + var(--safe));
}

/* ─────────────── Start ─────────────── */

.start-kopf {
  text-align: center;
  padding: 28px 0 12px;
}
.start-kopf img { border-radius: 18px; box-shadow: var(--schatten); }
.start-kopf h1 { margin: 12px 0 2px; font-size: 26px; letter-spacing: -.3px; }
.start-unter { margin: 0; color: var(--text-2); font-size: 15px; letter-spacing: .6px; text-transform: uppercase; }

.start-block {
  background: var(--flaeche);
  border: 1px solid var(--rahmen);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--schatten);
}
.start-block h2 { margin: 0 0 6px; font-size: 18px; }
.start-hinweis { margin: 0 0 14px; color: var(--text-2); font-size: 15px; }

.sprachwahl { display: grid; gap: 10px; }
.sprachwahl.klein { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.sprach-knopf {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border: 2px solid var(--rahmen);
  border-radius: 12px;
  background: var(--flaeche-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.sprach-knopf .flagge { font-size: 26px; line-height: 1; }
.sprach-knopf.gewaehlt { border-color: var(--orange); background: var(--flaeche); }
.sprach-knopf.gewaehlt::after { content: "✓"; margin-left: auto; color: var(--orange); font-size: 20px; }

.niveauwahl { display: grid; gap: 10px; }
.niveauwahl.klein { gap: 8px; }
.kartenartwahl { display: grid; gap: 8px; }
.niveau {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 58px;
  padding: 10px 14px;
  border: 2px solid var(--rahmen);
  border-radius: 12px;
  background: var(--flaeche-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.niveau strong { font-size: 16px; }
.niveau span { font-size: 14px; color: var(--text-2); }
.niveau.gewaehlt { border-color: var(--orange); background: var(--flaeche); }

.haupt-knopf {
  display: block;
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: var(--radius);
  background: var(--orange);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--schatten);
}
.haupt-knopf:active { transform: translateY(1px); }

.start-fuss { text-align: center; padding: 18px 0 8px; }
.start-fuss a { color: var(--text-2); font-size: 15px; }

/* ─────────────── Menü ─────────────── */

.menue-kopf { padding: 28px 0 18px; }
.menue-kopf h1 { margin: 0 0 4px; font-size: 24px; }
.menue-kopf p { margin: 0; color: var(--text-2); }

.kachel-raster { display: grid; gap: 12px; }
.kachel {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--flaeche);
  border: 1px solid var(--rahmen);
  box-shadow: var(--schatten);
  color: var(--text);
  text-decoration: none;
}
.kachel strong { font-size: 17px; }
.kachel span { font-size: 14px; color: var(--text-2); }
.kachel-haupt { background: var(--blau); border-color: var(--blau); color: #fff; }
.kachel-haupt span { color: rgba(255, 255, 255, .72); }

.statuszeile {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--flaeche-2);
  color: var(--text-2);
  font-size: 14px;
}

/* ─────────────── Leiste ─────────────── */

.leisten {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 10px;
  background: var(--grund);
}
.leisten-mitte { flex: 1; text-align: center; font-weight: 700; font-size: 16px; }
.leisten-zahl { display: block; font-size: 13px; font-weight: 400; color: var(--text-2); }

.icon-knopf {
  width: 44px;
  height: 44px;
  border: 1px solid var(--rahmen);
  border-radius: 12px;
  background: var(--flaeche);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.fortschritts-leiste {
  height: 6px;
  border-radius: 3px;
  background: var(--flaeche-2);
  overflow: hidden;
  margin-bottom: 12px;
}
#fortschritts-balken, #offline-balken {
  height: 100%;
  width: 0;
  background: var(--orange);
  transition: width .25s ease;
}

/* ─────────────── Karte ─────────────── */

.karten-flaeche {
  display: flex;
  flex-direction: column;
  /* Der Fussleisten-Knopf klebt unten am Bildschirm und ueberdeckt sonst
     die Bewertungsstufen. Der Platz hier haelt die Stufen frei. */
  padding-bottom: 96px;
}

.karte {
  background: var(--flaeche);
  border: 1px solid var(--rahmen);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--schatten);
}

.karte-typ {
  font-size: 12px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 10px;
}

.frage-bild {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin-bottom: 14px;
}
.frage-bild img {
  max-width: 100%;
  max-height: 46vh;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}

.frage-text {
  font-size: 27px;
  font-weight: 700;
  text-align: center;
  margin: 8px 0 18px;
  letter-spacing: -.4px;
  line-height: 1.25;
}
.frage-text .klein { display: block; font-size: 15px; font-weight: 400; color: var(--text-2); margin-top: 8px; }

.optionen { display: grid; gap: 10px; }
.optionen.bild-auswahl { grid-template-columns: repeat(2, 1fr); gap: 8px; }
.bild-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-height: 0;
}
.bild-option img {
    width: 100%;
    height: 19vh;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
}
.bild-begriff {
    display: block;
    margin-top: 6px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}
.option {
  min-height: 60px;
  padding: 12px 16px;
  border: 2px solid var(--rahmen);
  border-radius: 12px;
  background: var(--flaeche-2);
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.option:active { border-color: var(--orange); }
.option.richtig { border-color: var(--gruen); background: rgba(31, 138, 84, .12); }
.option.falsch { border-color: var(--rot); background: rgba(193, 57, 43, .12); }

.antwort {
  text-align: center;
  padding: 14px 0 6px;
  border-top: 1px solid var(--rahmen);
  margin-top: 14px;
}
.antwort-begriff { font-size: 25px; font-weight: 700; letter-spacing: -.3px; }
.antwort-zeilen { margin-top: 10px; font-size: 16px; color: var(--text-2); }
.antwort-zeilen div { margin-top: 3px; }
.antwort-zeilen .mutter { font-size: 20px; color: var(--text); font-weight: 600; }

/* ─────────────── Bewertung ─────────────── */

.bewertung { margin-top: 18px; text-align: center; }
.bewertung-frage { margin: 0 0 12px; font-weight: 600; color: var(--text-2); }

.knopf-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.gross-knopf {
  min-height: 64px;
  padding: 12px;
  border: 0;
  border-radius: 14px;
  background: var(--gruen);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.gross-knopf.nein { background: var(--orange); }
.gross-knopf:active { transform: translateY(1px); }

.stufen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stufe {
  min-height: 76px;
  padding: 8px 4px;
  border: 0;
  border-radius: 12px;
  background: var(--flaeche-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.stufe .emoji { font-size: 24px; }
.stufe:active { transform: translateY(1px); }
.stufe-1 { background: rgba(31, 138, 84, .16); }
.stufe-2 { background: rgba(232, 120, 48, .16); }
.stufe-3 { background: rgba(150, 150, 60, .18); }
.stufe-4 { background: rgba(193, 57, 43, .16); }

/* ─────────────── Fuß ─────────────── */

.fussleiste {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 0 calc(12px + var(--safe));
  background: linear-gradient(to bottom, transparent, var(--grund) 28%);
}
.fuss-knopf {
  flex: 1;
  min-height: 56px;
  border: 1px solid var(--rahmen);
  border-radius: 14px;
  background: var(--flaeche);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
#knopf-aufdecken { background: var(--orange); border-color: var(--orange); color: #fff; flex: 2; }

.rueckmeldung {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--flaeche);
  border: 1px solid var(--rahmen);
  box-shadow: var(--schatten);
  text-align: center;
}
.rueckmeldung .gut { color: var(--gruen); font-weight: 700; }
.rueckmeldung .schlecht { color: var(--rot); font-weight: 700; }
.rueckmeldung .intervall { display: block; margin-top: 8px; color: var(--text-2); font-size: 14px; }

/* ─────────────── Kapitel ─────────────── */

.kapitel-liste { display: grid; gap: 10px; padding-bottom: 20px; }
.kapitel-kachel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--flaeche);
  border: 1px solid var(--rahmen);
  box-shadow: var(--schatten);
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--text);
}
.kapitel-kachel .zahl {
  width: 42px; height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  background: var(--blau);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.kapitel-kachel .name { flex: 1; font-weight: 600; }
.kapitel-kachel .stand { font-size: 13px; color: var(--text-2); }
.balken { height: 6px; border-radius: 3px; background: var(--flaeche-2); margin-top: 6px; overflow: hidden; }
.balken > div { height: 100%; background: var(--gruen); }

/* ─────────────── Statistik ─────────────── */

.statistik { display: grid; gap: 12px; padding-bottom: 20px; }
.stat-karte {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--flaeche);
  border: 1px solid var(--rahmen);
  box-shadow: var(--schatten);
}
.stat-karte h3 { margin: 0 0 10px; font-size: 16px; }
.stat-gross { font-size: 34px; font-weight: 700; letter-spacing: -.6px; }
.stat-gross span { font-size: 15px; font-weight: 400; color: var(--text-2); }
.stat-zeile { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--rahmen); font-size: 15px; }
.stat-zeile:last-child { border-bottom: 0; }
.stat-zeile .wert { font-weight: 700; }

/* ─────────────── Einstellungen ─────────────── */

.einstellungen { display: grid; gap: 14px; padding-bottom: 24px; }
.einst-block {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--flaeche);
  border: 1px solid var(--rahmen);
  box-shadow: var(--schatten);
}
.einst-block h2 { margin: 0 0 8px; font-size: 17px; }
.einst-hinweis { margin: 0 0 12px; font-size: 14px; color: var(--text-2); }

.breit-knopf {
  width: 100%;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--rahmen);
  border-radius: 12px;
  background: var(--flaeche-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.breit-knopf.gefahr { color: var(--rot); border-color: var(--rot); background: transparent; }

/* Datei-Auswahl fuer den Import. Sichtbar statt versteckt: ein verstecktes
   Datei-Input laesst sich weder per Tastatur bedienen noch vorlesen. */
.import-hinweis { margin: 16px 0 6px; }
.datei-wahl {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 10px;
  border: 1px dashed var(--rahmen);
  border-radius: 12px;
  background: var(--flaeche-2);
  color: var(--text);
  font-size: 15px;
}
.datei-wahl::file-selector-button {
  margin-right: 10px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--blau);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.zahlwahl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.zahl-knopf {
  min-height: 54px;
  border: 2px solid var(--rahmen);
  border-radius: 12px;
  background: var(--flaeche-2);
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.zahl-knopf.gewaehlt { border-color: var(--orange); background: var(--flaeche); }

/* ─────────────── Melder ─────────────── */

.melder {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe));
  transform: translateX(-50%);
  z-index: 90;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--blau);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--schatten);
  max-width: 90vw;
  text-align: center;
}

@media (max-width: 380px) {
  .frage-text { font-size: 23px; }
  .stufen { grid-template-columns: repeat(2, 1fr); }
  .knopf-paar { grid-template-columns: 1fr; }
}
