/* Jagd-Lernapp Saarland – gemeinsames Styling (mobile-first) */
:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --text: #1d231c;
  --muted: #5a6357;
  --border: #d6d2c6;
  --accent: #2f5d3a;
  --accent-text: #ffffff;
  --ok: #1e7b34;
  --ok-bg: #dff3e3;
  --bad: #b3261e;
  --bad-bg: #fbe3e1;
  --warn-bg: #fff4d6;
  --radius: 14px;
  --tap: 48px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121612;
    --surface: #1c221c;
    --text: #eef1ea;
    --muted: #a8b2a4;
    --border: #344033;
    --accent: #7fbf8c;
    --accent-text: #0d1a10;
    --ok: #7ee08f;
    --ok-bg: #173b20;
    --bad: #ff8f86;
    --bad-bg: #4a1714;
    --warn-bg: #3b3214;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopf */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.1rem; margin: 0; flex: 1; }
.topbar .stat { font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--muted); }

main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 1rem .75rem 6rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); min-width: var(--tap);
  padding: .6rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-ghost { background: transparent; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.ok[disabled], .btn.bad[disabled] { opacity: 1; }
.btn.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--text); }
.btn.bad { background: var(--bad-bg); border-color: var(--bad); color: var(--text); }
.btn.missed { border-style: dashed; border-color: var(--ok); }
.btn.selected { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }

/* Startseite */
.hero { margin: .5rem 0 1.25rem; }
.hero h2 { margin: 0 0 .25rem; font-size: 1.5rem; }
.hero p { margin: 0; color: var(--muted); }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.menu-tile {
  min-height: 120px; flex-direction: column; gap: .35rem; text-align: center;
  font-size: 1.05rem;
}
.menu-tile .icon { font-size: 2rem; line-height: 1; }
.menu-tile small { font-weight: 400; color: var(--muted); }
.menu-tile.active { border-color: var(--accent); }

/* Quiz-Karte */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.figure {
  position: relative; margin: 0; aspect-ratio: 4 / 3; background: #888;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  touch-action: none; cursor: pointer;
}
.figure img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: filter .15s ease;
  -webkit-user-drag: none; pointer-events: none;
}
.figure.reveal img { filter: blur(14px) brightness(.7); }
.figure .reveal-name {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 1rem; text-align: center; font-size: 1.6rem; font-weight: 800; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.8); opacity: 0; transition: opacity .15s ease;
}
.figure.reveal .reveal-name { opacity: 1; }
.figure .hold-hint {
  position: absolute; left: .5rem; bottom: .5rem; padding: .2rem .6rem; border-radius: 999px;
  background: rgba(0,0,0,.6); color: #fff; font-size: .8rem;
}

.question { padding: 1rem; border-top: 1px solid var(--border); }
.question h3 { margin: 0 0 .6rem; font-size: 1rem; }
.question .qnum { color: var(--muted); font-weight: 400; }
.options { display: grid; gap: .5rem; }
.options.chips { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.options .btn { width: 100%; text-align: left; justify-content: flex-start; }
.options.chips .btn { justify-content: center; text-align: center; }
.feedback { margin: .5rem 0 0; font-weight: 600; min-height: 1.5em; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }
.note { font-size: .9rem; color: var(--muted); margin: .5rem 0 0; }
.warn { background: var(--warn-bg); padding: .5rem .75rem; border-radius: 10px; font-size: .9rem; margin: .5rem 0 0; }

/* Lösungen */
.solution { padding: 1rem; border-top: 1px solid var(--border); }
.solution h3 { margin-top: 0; }
.solution dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .75rem; margin: 0 0 1rem; }
.solution dt { color: var(--muted); }
.solution dd { margin: 0; font-weight: 600; }
.exam { border: 1px solid var(--border); border-radius: 10px; padding: .75rem; margin-bottom: .75rem; }
.exam h4 { margin: 0 0 .4rem; }
.exam ul { margin: .2rem 0 .5rem 1.1rem; padding: 0; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge.yes { background: var(--ok-bg); color: var(--ok); }
.badge.no { background: var(--bad-bg); color: var(--bad); }
.badge.unsure { background: var(--warn-bg); color: var(--text); }

/* Untere Aktionsleiste: einhändig erreichbar */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: .5rem; padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.actionbar .btn { flex: 1; }

.progress { height: 6px; background: var(--border); }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.center { text-align: center; padding: 2rem 1rem; }
footer.small { text-align: center; font-size: .8rem; color: var(--muted); padding: 1rem; }

/* Statusleiste Bilder-Cache (ganz oben) */
.cachebar {
  display: flex; align-items: center; gap: .5rem;
  padding: .3rem .75rem; font-size: .8rem; line-height: 1.3;
  background: var(--surface); color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.cachebar .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--muted); flex: none; }
.cachebar .txt { flex: 1; }
.cachebar.ok .dot { background: var(--ok); }
.cachebar.busy .dot { background: #d9a400; animation: pulse 1s infinite alternate; }
.cachebar.warn .dot { background: var(--bad); }
.cachebar.off .dot { background: var(--muted); }
.cachebar-btn {
  font: inherit; font-weight: 600; color: var(--accent); background: none;
  border: 1px solid var(--border); border-radius: 999px; padding: .15rem .6rem; min-height: 32px; cursor: pointer;
}
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }

/* Einwilligung: blockiert den ganzen Bildschirm */
html.locked, html.locked body { overflow: hidden; }
.consent {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(10, 14, 10, .82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.consent-box {
  width: 100%; max-width: 460px; max-height: 100%; overflow: auto;
  background: var(--surface); color: var(--text);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.consent-box h2 { margin-top: 0; }
.consent-box ul { padding-left: 1.2rem; }
.consent-actions { display: grid; gap: .5rem; margin-top: 1rem; }
.consent-msg { color: var(--bad); font-weight: 600; margin-bottom: 0; }

@media (min-width: 560px) {
  .menu-grid { gap: 1rem; }
  .menu-tile { min-height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ===== Hundeprüfungen (Lernen + Quiz) ===== */
.modetabs {
  display: flex; gap: .25rem; padding: .4rem .75rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.modetab {
  flex: 1; min-height: 44px; border: 2px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.modetab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.modetab:focus-visible, .chip:focus-visible, .jump:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.chiprow { display: flex; gap: .4rem; overflow-x: auto; padding: .1rem 0 .6rem; scrollbar-width: thin; }
.chipwrap { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  flex: none; min-height: 44px; padding: .35rem .9rem; border-radius: 999px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; touch-action: manipulation;
}
.chip small { font-weight: 400; color: var(--muted); }
.chip.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip.selected small { color: inherit; opacity: .85; }

.lerntools { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 .75rem; }
.btn-small { min-height: 44px; padding: .35rem .8rem; font-size: .9rem; }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; padding: .5rem 0; min-height: 44px; cursor: pointer; }

.pcard .phead { padding: 1rem 1rem .5rem; }
.pcard .phead h2 { margin: 0 0 .4rem; font-size: 1.5rem; }
.pcard .phead h2 small { display: block; font-size: 1rem; font-weight: 600; color: var(--muted); }
.pbody { padding: 0 1rem 1rem; }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .4rem; }
.badge.neutral { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.badge.vor { background: #dbe9ff; color: #1a3f7a; }
.badge.nach { background: #ffe6cc; color: #7a3d00; }
@media (prefers-color-scheme: dark) {
  .badge.vor { background: #1d3354; color: #b9d3ff; }
  .badge.nach { background: #4a2b0d; color: #ffd3a3; }
}
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .75rem; margin: .25rem 0 .75rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.zweck { margin: 0 0 .75rem; }

.jumprow { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 .75rem; }
.jump {
  min-height: 44px; padding: .3rem .8rem; border-radius: 999px; border: 2px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.jump span { font-weight: 400; color: var(--muted); }

.bereich { border: 1px solid var(--border); border-left: 6px solid var(--border); border-radius: 10px; padding: .6rem .75rem; margin: 0 0 .75rem; scroll-margin-top: 4.5rem; }
.bereich h3 { margin: 0 0 .4rem; font-size: 1.1rem; }
.bereich h3 small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.b-feld { border-left-color: #c9a227; }
.b-wald { border-left-color: #2f7d3a; }
.b-wasser { border-left-color: #2a6fb5; }
.b-gehorsam { border-left-color: #8a4fb0; }
.jump.b-feld { border-color: #c9a227; } .jump.b-wald { border-color: #2f7d3a; }
.jump.b-wasser { border-color: #2a6fb5; } .jump.b-gehorsam { border-color: #8a4fb0; }
.seite { margin: .5rem 0 .25rem; font-size: .95rem; }
.seite.vor { color: #2a6fb5; } .seite.nach { color: #b0600f; }

.fachlist { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.fachlist li { padding: .45rem .6rem; border-radius: 8px; background: var(--bg); }
.fachlist .fach { font-weight: 700; }
.fdetail { display: block; color: var(--muted); font-size: .85rem; margin-top: .15rem; }

/* Abdecken-Modus: Einträge verschwommen, Antippen deckt auf */
.coverable { cursor: pointer; position: relative; min-height: 44px; -webkit-user-select: none; user-select: none; }
.coverable .cover-inner { filter: blur(7px); transition: filter .15s ease; }
.coverable::after {
  content: "Tippen zum Aufdecken"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: var(--muted);
}
.coverable.shown .cover-inner { filter: none; }
.coverable.shown::after { content: none; }

.merk { background: var(--warn-bg); padding: .5rem .75rem; border-radius: 10px; font-size: .95rem; margin: .5rem 0; }
.hinweise { margin: .25rem 0 .5rem 1.1rem; padding: 0; }
.karte { border: 1px solid var(--border); border-radius: 10px; padding: .5rem .75rem; margin-bottom: .4rem; background: var(--bg); }
.karte summary { font-weight: 700; cursor: pointer; min-height: 32px; }
.karte p { margin: .4rem 0 0; }

.lbl { font-size: 1rem; margin: 1rem 0 .4rem; }
.frage { font-size: 1.15rem; }
.erklaerung { margin-top: .5rem; padding: .6rem .75rem; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); }
.erklaerung p { margin: 0; }
.statrow { display: grid; grid-template-columns: 9rem 1fr auto; align-items: center; gap: .5rem; font-size: .9rem; margin: .25rem 0; }
.statrow .bar { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; }
.statrow .bar > span { display: block; height: 100%; background: var(--accent); }
.statrow .num { font-variant-numeric: tabular-nums; color: var(--muted); }
.actionbar .btn[hidden] { display: none; }
.b-saar { border-left-color: #0b5aa8; }
.abw { display: grid; gap: .4rem; }
.abw-row { display: grid; gap: .1rem; padding: .45rem .6rem; border-radius: 8px; background: var(--bg); }
.abw-buch { color: var(--muted); font-size: .9rem; }
.abw-sl { font-weight: 600; }

/* Jagdhunde: „eine Rasse zurück“ unter dem Startseiten-Pfeil */
.navstack { display: flex; flex-direction: column; gap: .25rem; align-items: stretch; }
.btn-back-card { min-height: 44px; padding: .2rem .5rem; font-size: .8rem; white-space: nowrap; }
