/* ═══════════════════════════════════════════════════════
   HUNTING BACON — Global Stylesheet
   Inspired by waidwissen.com design language
   ═══════════════════════════════════════════════════════ */

:root {
  --bg: #111418;
  --bg-card: #1a1f24;
  --bg-dark: #000;
  --forest: #1a3328;
  --forest-mid: #234530;
  --forest-light: #2e5a3c;
  --brand: #3cb878;
  --brand-dark: #52d490;
  --brand-light: #70edaa;
  --gold: #c9a227;
  --gold-light: #e8c55a;
  --gold-dim: rgba(201,162,39,0.12);
  --bark: #5c3d1e;
  --bark-light: #8b6240;
  --red: #c0392b;
  --orange: #d4850a;
  --cream: #1a1f24;
  --cream-dark: #111418;
  --text: #f0f2ee;
  --text-mid: #c8ccc4;
  --text-muted: #909890;
  --text-light: #707870;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 270px;
  --topbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Suppress the default mobile-browser blue tap highlight everywhere — we provide
   our own hover/active styles. Applied to anything tap-able. */
a, button, [onclick], [role="button"], .agenda-row, .gear-btn, .topbar-left, .agenda-audio-play {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);          /* Match body bg so any letterbox/overscroll area is invisible */
  overscroll-behavior-y: none;    /* Disables iOS rubber-band bounce that shows html bg */
  overflow-x: clip;               /* Belt + braces — prevents horizontal scroll at the root */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;               /* Prevents horizontal scroll/zoom-out without breaking sticky topbar */
}

/* ─── Site-wide mobile safety nets ─── */
img, video { max-width: 100%; height: auto; }

/* Long URLs / German compound words shouldn't blow out narrow viewports */
.lesson-summary,
.bib-content,
.bib-article-inline,
.lesson-detail-modal,
.fc-card,
.quiz-question,
.lk-session {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Content tables become horizontally scrollable instead of overflowing the page */
.lesson-summary table,
.bib-content table,
.lesson-detail-modal table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Noise texture overlay like waidwissen */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ─── TOPBAR ─── */
.topbar {
  background: var(--forest);
  color: white;
  padding: 0 1.5rem;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 3px solid var(--brand);
  backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: white;
  cursor: pointer;
}

.logo {
  width: 42px; height: 42px;
  flex-shrink: 0;
}

.topbar-brand {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar-brand span { color: var(--brand-light); }

.topbar-nav {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0;
  justify-content: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
}

.topbar-nav a {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  padding: 0 1.2rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: all 0.2s;
  white-space: nowrap;
}
.topbar-nav a:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.05);
}
.topbar-nav a.active {
  color: white;
  border-bottom-color: var(--brand-light);
  background: rgba(58,170,112,0.1);
}
.topbar-nav a .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.75;
}
.topbar-nav a .nav-icon svg { width: 20px; height: 20px; }
.topbar-nav a:hover .nav-icon,
.topbar-nav a.active .nav-icon { opacity: 1; }

.search-box {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 38px;
  gap: 8px;
  transition: all 0.2s;
}
.search-box:focus-within {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.25);
}
.search-box input {
  background: transparent;
  background-color: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color: white;
  font-family: inherit;
  font-size: 13.5px;
  width: 200px;
  box-shadow: none;
}
.search-box input::placeholder { color: rgba(255,255,255,0.4); }
/* Suppress Chrome's autofill yellow/dark-grey background that paints a visible
   inner box on the search field. */
.search-box input:-webkit-autofill,
.search-box input:-webkit-autofill:hover,
.search-box input:-webkit-autofill:focus {
  -webkit-text-fill-color: white;
  -webkit-box-shadow: 0 0 0 1000px transparent inset;
  box-shadow: 0 0 0 1000px transparent inset;
  transition: background-color 9999s ease-in-out 0s;
}
.search-icon { color: rgba(255,255,255,0.4); }

/* ─── PAGES ─── */
.page { display: none; position: relative; z-index: 1; }
.page.active { display: block; }

/* ─── HOME / LANDING ─── */
/* Home page hero — taller + centred version of .law-hero */
#home-page .law-hero {
  text-align: center;
  padding: 4rem 2rem 3.5rem;
}
#home-page .law-hero h1 {
  font-size: 2.6rem;
  letter-spacing: -0.02em;
}
#home-page .law-hero .hero-desc {
  max-width: 600px;
  margin: 0 auto;
  font-size: 1rem;
  color: rgba(255,255,255,0.72);
}

.home-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  max-width: 1040px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
}

.home-card {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.18s, box-shadow 0.18s;
  flex: 0 1 300px;
}
.home-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.home-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(58,170,112,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--brand);
}
.home-card-icon svg { width: 22px; height: 22px; }
.home-card:hover .home-card-icon { background: rgba(58,170,112,0.2); }

.home-card-body { flex: 1; min-width: 0; }
.home-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
  line-height: 1.2;
}
.home-card-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.home-card-tag {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--brand-dark);
  letter-spacing: 0.02em;
}

.home-card-arrow {
  font-size: 1.1rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
  transition: color 0.15s, transform 0.15s;
}
.home-card:hover .home-card-arrow { color: var(--brand); transform: translateX(4px); }

/* legacy — kept for any remaining references */
.section-card .card-tag {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.72rem;
  background: rgba(58,170,112,0.2);
  color: var(--brand-light);
  border: 1px solid rgba(58,170,112,0.3);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ─── SHARED LAYOUT: SIDEBAR + MAIN ─── */
.page-layout {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 0.75rem 0 2rem;
  z-index: 10;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.sidebar:hover { scrollbar-color: rgba(128,128,128,0.2) transparent; }
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; transition: background 0.2s; }
.sidebar:hover::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.2); }

.sb-section { padding: 0.1rem 0; }

.sb-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 1rem 1rem 0.35rem;
  opacity: 0.7;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0.75rem;
  margin: 1px 0.5rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.sb-link:hover {
  color: var(--text-mid);
  background: rgba(128,128,128,0.07);
}
.sb-link.active {
  color: var(--brand-dark);
  background: rgba(58,170,112,0.13);
  font-weight: 600;
}

.sb-num {
  font-size: 10px;
  color: var(--brand);
  font-weight: 600;
  min-width: 54px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.sb-icon {
  font-size: 13px;
  min-width: 18px;
  text-align: center;
  opacity: 0.8;
}

/* ─── MAIN CONTENT AREA ─── */
.main-content {
  flex: 1;
  padding: 2rem 2.5rem 3rem;
  max-width: 900px;
  min-width: 0;
}
/* Lessons page: let the week-grid use all available space */
#lessons-page .main-content { max-width: none; }

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--forest);
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ─── LAW SECTION ─── */
.law-hero {
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-mid) 100%);
  padding: 2.5rem 2.5rem 2rem;
  color: white;
}
.law-hero .eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-light);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.law-hero h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.law-hero .hero-desc {
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem;
  max-width: 700px;
  line-height: 1.6;
}
.law-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.law-tag {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}
.law-tag.highlight {
  background: rgba(58,170,112,0.2);
  border-color: rgba(58,170,112,0.4);
  color: var(--brand-light);
}

.law-info-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 1rem 1.25rem;
  background: rgba(58,170,112,0.06);
  border: 1px solid rgba(58,170,112,0.15);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.5;
}

.teil-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--brand);
  color: white;
  padding: 3px 10px;
  border-radius: 4px;
  margin-right: 10px;
  vertical-align: middle;
}

.section-heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--forest);
  margin: 2rem 0 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.section-heading:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }

.section-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

/* Paragraph cards */
.para-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  overflow: hidden;
  transition: all 0.2s;
}
.para-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.para-header {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.25rem;
  cursor: pointer;
  gap: 1rem;
  user-select: none;
}

.para-num {
  background: var(--forest);
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  min-width: 44px;
  text-align: center;
  flex-shrink: 0;
}

.para-info { flex: 1; min-width: 0; }
.para-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.para-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.para-toggle {
  color: var(--text-light);
  font-size: 0.7rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.para-card.open .para-toggle { transform: rotate(180deg); }

.para-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  padding-left: calc(1.25rem + 44px + 1rem);
  color: var(--text-mid);
  font-size: 0.93rem;
  line-height: 1.8;
}
.para-card.open .para-body { display: block; }

.para-body p { margin-bottom: 0.5rem; }
.para-body ol, .para-body ul {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}
.para-body li { margin-bottom: 0.2rem; }

.abs-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-top: 0.75rem;
  margin-bottom: 0.2rem;
}

.note-box {
  background: rgba(58,170,112,0.06);
  border-left: 3px solid var(--brand);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  color: var(--text-mid);
}

.search-hidden { display: none !important; }

/* ─── ENCYCLOPEDIA ─── */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.5rem;
}

.filter-chip {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-mid);
  font-weight: 500;
}
.filter-chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.filter-chip.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.enc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.animal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}
.animal-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.animal-img {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  position: relative;
  overflow: hidden;
}

.animal-status {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-jagdbar { background: var(--brand); color: white; }
.status-geschuetzt { background: var(--red); color: white; }
.status-schonzeit { background: var(--orange); color: white; }

.animal-body {
  padding: 0.9rem 1rem;
}
.animal-body h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1px;
}
.animal-latin {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.animal-meta {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.animal-meta span {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Animal detail view */
.animal-detail {
  display: none;
}
.animal-detail.active {
  display: block;
}
.animal-detail-header {
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-mid) 100%);
  padding: 2rem 2.5rem;
  color: white;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.animal-detail-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
}
.animal-detail-header .latin {
  color: rgba(255,255,255,0.6);
  font-style: italic;
  margin-bottom: 0.75rem;
}
.animal-detail-header .summary {
  color: rgba(255,255,255,0.8);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 600px;
}

.detail-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
}
.detail-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--forest);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-section p, .detail-section li {
  color: var(--text-mid);
  font-size: 0.9rem;
  line-height: 1.7;
}
.detail-section ul { padding-left: 1.25rem; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}
.detail-stat {
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.detail-stat .label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.detail-stat .value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand-dark);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 1rem;
  cursor: pointer;
}
.back-link:hover { color: var(--brand); }

/* ─── LESSONS ─── */
.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.1rem;
}
@media (max-width: 640px) {
  .week-grid { grid-template-columns: 1fr; }
}

/* ─── Fach dots in sidebar ─── */
.fach-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 2px;
}
.fach-dot[data-fach="waffen"]      { background: #4a7ab8; }
.fach-dot[data-fach="jagdrecht"]   { background: #b84040; }
.fach-dot[data-fach="jagdbetrieb"] { background: #9a6030; }
.fach-dot[data-fach="tierarten"]   { background: #3a9060; }
.fach-dot[data-fach="behandlung"]  { background: #c86030; }
.fach-dot[data-fach="tierschutz"]  { background: #30909e; }
.fach-dot[data-fach="pruefung"]    { background: #7060b8; }

/* ─── Agenda View ─── */
.agenda-month {
  margin-bottom: 2rem;
}
.agenda-month-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0 0.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}
.agenda-rows { display: flex; flex-direction: column; }

.agenda-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 0.75rem 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 0 6px 6px 0;
  margin: 1px 0;
  transition: background 0.1s;
  min-height: 56px;
  position: relative;          /* anchor for the absolute fach bar */
}
.agenda-row:hover { background: rgba(128,128,128,0.06); }
.agenda-row.agenda-today { background: rgba(58,170,112,0.07); }
.agenda-row.agenda-today:hover { background: rgba(58,170,112,0.12); }
.agenda-row.agenda-past { opacity: 0.5; }
.agenda-row.agenda-past:hover { opacity: 0.75; }

/* Absolute-positioned so it always spans the full row height — including the
   wrapped audio line on mobile, making it clear which lesson the audio belongs to. */
.agenda-fach-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 2px 2px 0;
}

/* Left arm — grows equally with right arm, keeping audio centred */
.agenda-left {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Right arm — mirrors left arm width */
.agenda-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.agenda-date {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 0 54px;
}
.agenda-day {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.agenda-dnum {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-mid);
  font-variant-numeric: tabular-nums;
}
.agenda-today .agenda-dnum { color: var(--brand-dark); }

.agenda-num {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'Consolas', monospace;
  text-align: right;
  flex: 0 0 28px;
  opacity: 0.7;
}

.agenda-main { flex: 1; min-width: 0; }
.agenda-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.agenda-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}
.agenda-tag {
  font-size: 0.62rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(128,128,128,0.1);
  color: var(--text-muted);
  font-weight: 500;
}

.agenda-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(58,170,112,0.2);
}
.agenda-dot-empty {
  background: transparent;
  box-shadow: none;
}

.agenda-instructor {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
  min-width: 80px;
}

/* Agenda compact audio player — centred between equal left/right arms */
.agenda-audio {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: default;
  flex: 0 0 360px;
  align-self: stretch;
  min-height: 44px;
  box-sizing: border-box;
}
.agenda-audio-spacer { flex: 0 0 360px; }
.agenda-audio-play {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s;
}
.agenda-audio-play:hover { background: var(--brand-dark); }
.agenda-audio-play svg { width: 13px; height: 13px; }
.agenda-audio-scrubber {
  flex: 1;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
  min-width: 50px;
}
.agenda-audio-scrubber:hover { height: 6px; }
.agenda-audio-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--brand);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}
.agenda-audio-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand-dark);
  left: 0%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.agenda-audio-scrubber:hover .agenda-audio-thumb { opacity: 1; }
.agenda-audio-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .agenda-row {
    flex-wrap: wrap;
    min-height: 0;
    gap: 0.5rem 0.75rem;
    padding: 0.7rem 0.5rem 0.8rem 0.85rem;
  }
  .agenda-audio-spacer { display: none; }
  .agenda-tags { display: none; }   /* topic chips redundant — filter UI is desktop-only */
  .agenda-right { flex: 0 0 auto; gap: 0.5rem; }
  /* Show teacher name on phones — drop the desktop min-width so it stays compact. */
  .agenda-instructor {
    display: block;
    min-width: 0;
    font-size: 0.7rem;
  }

  /* Audio drops onto its own full-width line beneath the title */
  .agenda-audio {
    order: 99;
    flex: 1 1 100%;
    margin-top: 0.15rem;
    padding: 0.5rem 0.6rem;
    min-height: 42px;
    gap: 0.5rem;
  }
  .agenda-audio-play  { width: 32px; height: 32px; }
  .agenda-audio-play svg { width: 15px; height: 15px; }
  .agenda-audio-time  { font-size: 0.7rem; }
  .agenda-audio-scrubber { height: 5px; }
  .agenda-audio-scrubber:hover { height: 6px; }
}

.week-card {
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.week-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
}
/* Subtle ring on has-content cards */
.week-card.has-content {
  box-shadow: 0 2px 8px rgba(0,0,0,0.10), 0 0 0 2px var(--brand);
}
.week-card.has-content:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.16), 0 0 0 2px var(--brand);
}
/* Content indicator dot */
.week-card.has-content::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 14px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 2.5px var(--brand);
}

.week-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 1.4rem 1.35rem 1.25rem;
  gap: 0.75rem;
  user-select: none;
  flex: 1;
  min-height: 130px;
  /* Default — overridden per fach below */
  background: linear-gradient(145deg, #2A5040, #1A3328);
}

/* ── Per-fach coloured header gradients (muted, earthy tones) ── */
.week-card[data-fach="waffen"]      .week-header { background: linear-gradient(145deg, #2E5278, #1C3450); }
.week-card[data-fach="jagdrecht"]   .week-header { background: linear-gradient(145deg, #7A2828, #4E1818); }
.week-card[data-fach="jagdbetrieb"] .week-header { background: linear-gradient(145deg, #6B3D20, #46270F); }
.week-card[data-fach="tierarten"]   .week-header { background: linear-gradient(145deg, #2A6040, #1A3D28); }
.week-card[data-fach="behandlung"]  .week-header { background: linear-gradient(145deg, #8A4520, #5E2D0E); }
.week-card[data-fach="tierschutz"]  .week-header { background: linear-gradient(145deg, #22606E, #153E48); }
.week-card[data-fach="pruefung"]    .week-header { background: linear-gradient(145deg, #4A3070, #2E1C4A); }

.week-left {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  min-width: 0;
  flex: 1;
}

.week-info { flex: 1; min-width: 0; }

/* Week number badge */
.week-num {
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 7px 12px;
  border-radius: 8px;
  min-width: 48px;
  text-align: center;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.3);
  letter-spacing: 0.02em;
}

.week-info h4 {
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255,255,255,0.97);
  line-height: 1.35;
  margin-bottom: 0.3rem;
}
.week-date {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.68);
  display: block;
}

.week-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.topic-tag {
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.25);
  font-weight: 500;
}

.week-toggle {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.35);
  font-size: 0;
  flex-shrink: 0;
  pointer-events: none;
}
.week-toggle::before { content: "›"; font-size: 1.5rem; }
.week-card:hover .week-toggle { color: rgba(255,255,255,0.9); }

/* ── Compact audio player inside week-card header ── */
.week-audio {
  margin-top: 0.5rem;
  padding: 0.55rem 0.7rem 0.6rem;
  background: rgba(0,0,0,0.28);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  user-select: none;
  cursor: default;
}
.week-audio-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.week-audio-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.week-audio-play {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.28);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s;
}
.week-audio-play:hover { background: rgba(255,255,255,0.32); }
.week-audio-play svg { width: 14px; height: 14px; }
.week-audio-scrubber {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}
.week-audio-scrubber:hover { height: 6px; margin-top: -1px; }
.week-audio-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(255,255,255,0.75);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}
.week-audio-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
  left: 0%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.week-audio-scrubber:hover .week-audio-thumb { opacity: 1; }
.week-audio-time {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.6);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Per-tile admin buttons (✏️ / 🗑️) — only visible in edit mode ── */
.week-card-admin {
  position: absolute;
  top: 8px;
  right: 36px;      /* leave room for the › arrow at right:12px */
  display: flex;
  gap: 4px;
  z-index: 2;
}
.week-card-admin button {
  background: rgba(0,0,0,0.42);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 5px;
  color: white;
  width: 28px;
  height: 28px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}
.week-card-admin button:hover { background: rgba(0,0,0,0.68); }
.week-card-admin button.danger:hover { background: rgba(180,30,30,0.78); }

/* Hidden — body content is shown in the detail overlay only */
.week-body { display: none; }

.week-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
  font-size: 0.74rem;
  color: var(--text-muted);
}
.week-card-meta .meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-soft);
  font-weight: 600;
}
.week-card-meta .meta-pill.has {
  background: rgba(58, 170, 112, 0.12);
  color: var(--brand-dark);
}

/* ─── Lesson detail overlay (full-screen page-style) ─── */
/* ─── Lesson detail overlay ─── */
.lesson-detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  overflow-y: auto;
  padding: 2rem 1.25rem;
}
.lesson-detail-overlay.open { display: flex; justify-content: center; }

.lesson-detail-modal {
  background: var(--bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 780px;
  margin: auto 0;
  padding: 2.5rem 3rem 4rem;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}
@media (max-width: 700px) {
  .lesson-detail-modal { padding: 1.5rem 1.25rem 3rem; }
  .lesson-detail-overlay { padding: 0.5rem; }
}

/* Back link */
.lesson-detail-modal .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.82rem;
  margin-bottom: 2rem;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
}
.lesson-detail-modal .back-link:hover { color: var(--brand); }

/* Header */
.lesson-detail-head {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.lesson-detail-head .week-num {
  font-size: 0.95rem;
  padding: 10px 14px;
  min-width: 54px;
  flex-shrink: 0;
}
.lesson-detail-head h1 {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.5rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.lesson-detail-head .lesson-meta {
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  line-height: 1.6;
}
.lesson-detail-head .lesson-meta strong { color: var(--text-mid); font-weight: 600; }
.lesson-detail-head .week-tags { margin-top: 0.6rem; }

.lesson-detail-empty {
  border: 1px dashed var(--border);
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
}

/* Materials section */
.lesson-detail-modal .lesson-summary { font-size: 0.95rem; }
.lesson-detail-modal .lesson-materials {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ─── Lesson summary body ─── */
.lesson-summary {
  color: var(--text-mid);
  font-size: 0.93rem;
  line-height: 1.85;
}

/* Section headers — h5 = major section, h6 = sub-section */
.lesson-summary h5 {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}
.lesson-summary h5:first-child { margin-top: 0; }
.lesson-summary h6 {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  margin: 1.4rem 0 0.5rem;
  opacity: 0.9;
}

/* Body text */
.lesson-summary p { margin: 0.7rem 0; }
.lesson-summary ul, .lesson-summary ol {
  padding-left: 1.4rem;
  margin: 0.6rem 0 1rem;
}
.lesson-summary li { margin-bottom: 0.4rem; line-height: 1.7; }
.lesson-summary strong { color: var(--text); font-weight: 600; }
.lesson-summary em { font-style: italic; color: var(--text-mid); }

/* Intro block */
.lesson-summary .ls-intro {
  background: rgba(58,170,112,0.07);
  border-left: 3px solid var(--brand);
  padding: 1rem 1.1rem;
  border-radius: 6px;
  margin: 0 0 1.5rem;
  font-style: italic;
  color: var(--text-mid);
}

/* Callout boxes */
.lesson-summary .ls-callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  background: #f5f9f5;
  padding: 0.85rem 1.1rem;
  border-radius: 6px;
  margin: 1rem 0;
  font-size: 0.89rem;
}
.lesson-summary .ls-callout-title {
  display: block;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-dark);
  margin-bottom: 0.35rem;
}
.lesson-summary .ls-callout.exam   { border-left-color: #c07010; background: #fef7ed; }
.lesson-summary .ls-callout.exam   .ls-callout-title { color: #915408; }
.lesson-summary .ls-callout.warn   { border-left-color: #c04040; background: #fef2f2; }
.lesson-summary .ls-callout.warn   .ls-callout-title { color: #962020; }
.lesson-summary .ls-callout.mnemo  { border-left-color: #6050c8; background: #f5f3fd; }
.lesson-summary .ls-callout.mnemo  .ls-callout-title { color: #483890; }
.lesson-summary .ls-callout.note   { border-left-color: #4090c0; background: #f0f7fd; }
.lesson-summary .ls-callout.note   .ls-callout-title { color: #28608a; }

/* Tables */
.lesson-summary table.ls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin: 0.75rem 0 1.25rem;
  border-radius: 6px;
  overflow: hidden;
}
.lesson-summary table.ls-table th,
.lesson-summary table.ls-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}
.lesson-summary table.ls-table th {
  background: var(--bg-card);
  font-weight: 700;
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}
.lesson-summary table.ls-table tr:nth-child(even) td { background: rgba(128,128,128,0.03); }

/* Fact grid */
.lesson-summary .ls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
  margin: 0.75rem 0 1.25rem;
}
.lesson-summary .ls-fact {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  font-size: 0.84rem;
}
.lesson-summary .ls-fact b {
  display: block;
  color: var(--brand);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
  font-weight: 700;
}

.lesson-materials {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.material-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  padding: 5px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--bark);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s;
}
.material-link:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.placeholder-card {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

/* ─── AUTH / LOGIN ─── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.login-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2.5rem 2rem 2rem;
  width: 380px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-box .login-logo {
  width: 56px; height: 56px;
  margin: 0 auto 1rem;
}
.login-box h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--forest);
  margin-bottom: 0.25rem;
}
.login-box p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.login-box input {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  background: var(--bg);
}
.login-box input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(58,170,112,0.15);
}
.login-box .login-btn {
  display: block;
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: opacity 0.2s;
}
.login-box .login-btn:hover { opacity: 0.9; }
.login-box .login-error {
  color: var(--red);
  font-size: 0.82rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* ─── USER MENU ─── */
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  color: rgba(255,255,255,0.8);
  font-size: 0.78rem;
  font-weight: 500;
}
.user-badge .role-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand-light);
}
.user-badge .role-dot.reader { background: var(--gold-light); }
/* ─── ADMIN CONTROLS ─── */
.admin-only { display: none !important; }
body.is-admin .admin-only { display: flex !important; }
body.is-admin .admin-only-inline { display: inline-flex !important; }

/* Admin gear icon + dropdown */
.admin-gear {
  position: relative;
}
.gear-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: rgba(255,255,255,0.85);   /* match the nav-icon brightness */
  transition: all 0.2s;
}
.gear-btn svg { color: inherit; opacity: 0.9; }
@media (hover: hover) and (pointer: fine) {
  .gear-btn:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
    color: #fff;
    transform: rotate(30deg);
  }
  .gear-btn:hover svg { opacity: 1; }
}
.admin-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
}
.admin-dropdown.open { display: block; }
.admin-dropdown-header {
  padding: 0.7rem 1rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.admin-dropdown-item {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
}
.admin-dropdown-item:hover {
  background: rgba(58,170,112,0.06);
  color: var(--brand-dark);
}
.admin-dropdown-divider {
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}
.admin-dropdown-info {
  padding: 0.7rem 1rem 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.admin-dropdown-logout {
  color: var(--red);
  font-weight: 600;
}
.admin-dropdown-logout:hover {
  background: rgba(192,57,43,0.08);
  color: var(--red);
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid var(--brand);
  background: rgba(58,170,112,0.08);
  color: var(--brand-dark);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.admin-btn:hover { background: var(--brand); color: white; }

.admin-btn-danger {
  border-color: var(--red);
  color: var(--red);
  background: rgba(192,57,43,0.06);
}
.admin-btn-danger:hover { background: var(--red); color: white; }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  width: 520px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--forest);
  margin-bottom: 1rem;
}
.modal label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 0.25rem;
  margin-top: 0.75rem;
}
.modal input, .modal textarea, .modal select {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.88rem;
  background: var(--bg);
}
.modal textarea { min-height: 100px; resize: vertical; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.modal-cancel {
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}
.modal-submit {
  padding: 8px 20px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ─── SEARCH RESULTS ─── */
.search-results {
  position: absolute;
  top: calc(var(--topbar-h) - 4px);
  right: 1.5rem;
  width: 420px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: none;
}
.search-results.active { display: block; }
.search-results-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}
.search-result-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.search-result-item:hover { background: rgba(58,170,112,0.05); }
.search-result-item:last-child { border-bottom: none; }
.search-result-type {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}
.search-result-body h4 { font-size: 0.88rem; color: var(--text); font-weight: 600; }
.search-result-body p { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; margin-top: 2px; }
.search-result-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-animal { background: rgba(58,170,112,0.15); color: var(--brand-dark); }
.badge-lesson { background: rgba(201,162,39,0.15); color: #8b6e00; }
.badge-library { background: rgba(100,100,200,0.15); color: #4040a0; }
.badge-law { background: rgba(90,60,30,0.15); color: var(--bark); }

/* ─── RESPONSIVE ─── */
@media (max-width: 960px) {
  .sidebar { display: none; }
  .main-content { padding: 1.5rem; }
  .topbar-nav a { padding: 0 0.75rem; font-size: 13px; }
  .search-box { display: none; }
}

@media (max-width: 600px) {
  .home-hero { padding: 3rem 1.5rem; }
  .home-hero h1 { font-size: 2rem; }
  .topbar-nav a .nav-label { display: none; }
  .enc-grid { grid-template-columns: 1fr; }

  /* ── Mobile topbar: tight, icon-only, no wrap ── */
  :root { --topbar-h: 54px; }
  .topbar {
    padding: 0 0.6rem;
    gap: 0.4rem;
    grid-template-columns: auto 1fr auto;   /* nav stretches, ends sit tight */
  }
  .logo { width: 32px; height: 32px; }
  .topbar-brand { display: none; }          /* logo alone is enough on phones */
  .topbar-nav { gap: 0; justify-content: space-around; }
  .topbar-nav a { padding: 0 0.5rem; }
  .topbar-nav a .nav-icon svg { width: 18px; height: 18px; }
  .topbar-right { gap: 0.35rem; }
  .user-menu { gap: 0.35rem; }
  .user-badge { display: none; }            /* you know who you're logged in as */
  .gear-btn { width: 34px; height: 34px; }
}

/* Extra tight at very narrow widths (older/smaller phones, split-screen) */
@media (max-width: 380px) {
  .topbar-nav a { padding: 0 0.35rem; }
}

body { background: var(--bg); color: var(--text); }
.topbar { background: var(--bg-dark); border-bottom-color: var(--brand); }
.login-box { background: var(--bg-card); }
.login-box h2 { color: var(--brand-light); }
.login-box input { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.modal { background: var(--bg-card); }
.modal h3 { color: var(--brand-light); }
.modal input, .modal textarea { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.admin-dropdown { background: var(--bg-card); border-color: var(--border-strong); }
.admin-dropdown-item { color: var(--text); }
.search-results { background: var(--bg-card); border-color: var(--border-strong); }
.search-result-item:hover { background: rgba(58,170,112,0.08); }
.detail-section { background: var(--bg-card); }
.detail-stat { background: var(--bg); }
.modal-cancel { background: var(--bg); color: var(--text); border-color: var(--border-strong); }

/* topbar-nav scrollable on narrow screens */
.topbar-nav { overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.topbar-nav::-webkit-scrollbar { display: none; }

/* ─── QUIZ / PRÜFUNGSFRAGEN ─── */
.quiz-page-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 2rem;
}
.quiz-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: center;
}
.quiz-filter-select {
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.quiz-start-btn {
  padding: 8px 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.quiz-start-btn:hover { opacity: 0.88; }

.quiz-all-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.2rem 1.5rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  margin-bottom: 1.5rem;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 2px 8px rgba(58,170,112,0.25);
}
.quiz-all-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.quiz-all-btn-title { font-size: 1.1rem; font-weight: 700; }
.quiz-all-btn-sub { font-size: 0.8rem; opacity: 0.82; margin-top: 2px; }
.quiz-all-btn-arrow { font-size: 1.4rem; flex-shrink: 0; margin-left: 1rem; }
.quiz-sg-section-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.quiz-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.quiz-progress-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1rem;
}
.question-card { background: var(--bg-card); border-color: rgba(58,170,112,0.15); }

.question-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.question-sachgebiet {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(58,170,112,0.1);
  color: var(--brand-dark);
  font-weight: 600;
}
.question-multi-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(201,162,39,0.1);
  color: var(--gold);
  font-weight: 600;
}
.question-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.option-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  text-align: left;
  transition: all 0.15s;
  width: 100%;
}
.option-btn { background: var(--bg); border-color: rgba(58,170,112,0.2); }
.option-btn:hover:not(:disabled) { border-color: var(--brand); background: rgba(58,170,112,0.06); }
.option-btn.selected { border-color: var(--brand); background: rgba(58,170,112,0.08); }
.option-btn.correct { border-color: #2e7d44; background: rgba(46,125,68,0.15); color: var(--text); }
.option-btn.wrong { border-color: var(--red); background: rgba(192,57,43,0.12); color: var(--text); }
.option-btn:disabled { cursor: default; }

.option-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-mid);
  transition: all 0.15s;
}
.option-btn.correct .option-label { background: #2e7d44; color: white; }
.option-btn.wrong .option-label { background: var(--red); color: white; }
.option-btn.selected:not(.correct):not(.wrong) .option-label { background: var(--brand); color: white; }

.quiz-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.quiz-check-btn, .quiz-next-btn, .quiz-skip-btn {
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}
.quiz-check-btn { background: var(--brand); color: white; }
.quiz-check-btn:hover { background: var(--brand-dark); }
.quiz-check-btn:disabled { opacity: 0.5; cursor: default; }
.quiz-next-btn { background: var(--forest); color: white; }
.quiz-next-btn:hover { background: var(--forest-mid); }
.quiz-skip-btn { background: var(--bg); border: 1px solid var(--border-strong); color: var(--text-muted); }
.quiz-skip-btn:hover { color: var(--text); }

.explanation-panel {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(58,170,112,0.06);
  border: 1px solid rgba(58,170,112,0.2);
  border-radius: var(--radius-sm);
  display: none;
}
.explanation-panel { background: rgba(58,170,112,0.08); }
.explanation-panel.visible { display: block; }
.explanation-panel p { font-size: 0.9rem; color: var(--text-mid); line-height: 1.7; }
.explanation-panel strong { color: var(--brand-dark); }

.quiz-score-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}
.quiz-score-bar { background: var(--bg-card); }
.score-correct { color: #2e7d44; font-weight: 700; }
.score-wrong { color: var(--red); font-weight: 700; }
.quiz-exit-btn {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.quiz-exit-btn:hover { color: var(--red); border-color: var(--red); }

.quiz-summary {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.quiz-summary { background: var(--bg-card); }
.quiz-summary h2 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.quiz-summary .final-score { font-size: 3rem; font-weight: 800; color: var(--brand); margin: 1rem 0; }
.quiz-summary p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ─── LERNKARTEN (FLASHCARDS) ─── */
.lernkarten-inner {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
}
@media (max-width: 700px) {
  .lernkarten-inner { padding: 1.5rem 1rem; }
}

/* Lernkarten landing */
.lk-overall {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.lk-overall { background: var(--bg-card); }
.lk-overall-circle {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: conic-gradient(var(--brand) 0deg, var(--border) 0deg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; color: var(--brand);
  flex-shrink: 0;
  position: relative;
}
.lk-overall-circle::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--bg-card);
}
.lk-overall-circle span { position: relative; z-index: 1; }
.lk-overall-circle::before { background: var(--bg-card); }
.lk-overall-stats { flex: 1; }
.lk-overall-stats h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.lk-overall-stats p { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

/* Tri-color stat chips (overall row) */
.lk-stat-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.lk-stat-chip { display: flex; flex-direction: column; align-items: center; padding: 0.35rem 0.7rem; border-radius: 8px; min-width: 68px; }
.lk-stat-correct { background: rgba(58,170,112,0.12); }
.lk-stat-wrong   { background: rgba(192,57,43,0.10); }
.lk-stat-unseen  { background: rgba(128,128,128,0.08); }
.lk-stat-num { font-size: 1.25rem; font-weight: 800; line-height: 1; }
.lk-stat-lbl { font-size: 0.62rem; color: var(--text-muted); margin-top: 2px; white-space: nowrap; }
.lk-stat-correct .lk-stat-num { color: var(--brand-dark); }
.lk-stat-wrong   .lk-stat-num { color: var(--red); }
.lk-stat-unseen  .lk-stat-num { color: var(--text-muted); }

/* Tri-color stacked bar (per-SG cards) */
.lk-tribar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: rgba(128,128,128,0.12); margin: 0.5rem 0 0.25rem; gap: 1px; }
.lk-tribar-correct { background: var(--brand); min-width: 0; transition: width 0.4s; }
.lk-tribar-wrong   { background: var(--red);   min-width: 0; transition: width 0.4s; }
.lk-tribar-unseen  { flex: 1; background: rgba(128,128,128,0.15); }
.lk-tribar-legend { display: flex; gap: 0.4rem; font-size: 0.68rem; margin-bottom: 0.3rem; }
.lk-tl-c { color: var(--brand-dark); font-weight: 600; }
.lk-tl-w { color: var(--red); font-weight: 600; }
.lk-tl-u { color: var(--text-muted); margin-left: auto; }

/* SG cards on landing */
.lk-sg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.1rem;
}
/* ── SG topic card: image-on-top, info-below (mirrors Bibliothek card style) ── */
.lk-sg-card {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}
.lk-sg-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }

.lk-sg-card-img-wrap {
  position: relative;
  height: 155px;
  overflow: hidden;
  flex-shrink: 0;
}
.lk-sg-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.lk-sg-card:hover .lk-sg-card-img { transform: scale(1.05); }
/* Colour-tinted gradient over the image — identity even before load */
.lk-sg-card-img-tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* Fallback shown when img fails to load */
.lk-sg-card-img-fallback {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.lk-sg-card-info {
  padding: 0.95rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}
.lk-sg-card-label {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-dark);
}
.lk-sg-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.25;
}
.lk-sg-card-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin: 5px 0 2px;
}
.lk-sg-card-progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.lk-sg-card-stats {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lk-sg-card-btn {
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
  transition: background 0.15s;
  align-self: flex-start;
}
.lk-sg-card-btn:hover { background: var(--brand-dark); }

/* Flashcard session */
.lk-session-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.lk-session-title { font-size: 1rem; font-weight: 700; color: var(--text); flex: 1; }
.lk-session-counter { font-size: 0.82rem; color: var(--text-muted); }
.lk-session-reset {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 3px 10px;
  font-family: inherit;
}
.lk-session-reset:hover { color: var(--red); border-color: var(--red); }
.lernkarten-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.lernkarten-stat { font-size: 0.82rem; color: var(--text-muted); margin-left: auto; }
.lk-repeat-btn {
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lk-repeat-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.lk-repeat-btn-on { background: rgba(58,170,112,0.12); color: var(--brand-dark); border-color: var(--brand); }
.lk-repeat-badge {
  background: rgba(58,170,112,0.13);
  color: var(--brand-dark);
  border-radius: 5px;
  padding: 2px 9px;
  font-size: 0.78rem;
  font-weight: 600;
}
.lk-score-pass-info {
  font-size: 0.76rem;
  color: var(--brand-dark);
  background: rgba(58,170,112,0.1);
  border-radius: 5px;
  padding: 3px 10px;
  margin-top: 0.25rem;
}

/* Score screen */
.lk-score-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-top: 0.5rem;
}
.lk-score-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.lk-score-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lk-score-circle-inner {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.lk-score-num { font-size: 1.3rem; font-weight: 800; color: var(--text); line-height: 1; }
.lk-score-pct { font-size: 0.75rem; color: var(--text-muted); }
.lk-score-verdict { font-size: 1rem; font-weight: 700; color: var(--text); }
.lk-score-results {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  max-height: 280px;
  overflow-y: auto;
}
.lk-score-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}
.lk-score-item:last-child { border-bottom: none; }
.lk-score-icon {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  padding-top: 1px;
}
.lk-score-correct { color: var(--brand-dark); }
.lk-score-wrong   { color: var(--red); }
.lk-score-item-text { flex: 1; line-height: 1.4; }
.lk-score-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.lk-score-btn {
  padding: 0.55rem 1.4rem;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: none;
  transition: background 0.15s, transform 0.1s;
}
.lk-score-btn:active { transform: scale(0.97); }
.lk-score-btn-primary { background: var(--brand); color: #fff; }
.lk-score-btn-primary:hover { background: var(--brand-dark); }
.lk-score-btn-secondary { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border-strong); }
.lk-score-btn-secondary:hover { background: var(--border); }

/* Constrain the session to a readable column width */
.lk-session-content {
  max-width: 680px;
  margin: 0 auto;
}

.flashcard-wrap {
  perspective: 1200px;
  margin-bottom: 1.5rem;
  min-height: 360px;
}
.flashcard {
  width: 100%;
  min-height: 360px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  width: 100%;
  min-height: 360px;
  backface-visibility: hidden;
  border-radius: var(--radius);
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.flashcard-front {
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-mid) 100%);
  color: white;
}
.flashcard-front { background: linear-gradient(135deg, #0f1a14 0%, var(--forest) 100%); }
.flashcard-back {
  background: var(--bg-card);
  border: 2px solid var(--brand);
  color: var(--text);
  transform: rotateY(180deg);
}
.flashcard-back { background: var(--bg-card); }
.flashcard-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}
.flashcard-front .flashcard-eyebrow { color: rgba(255,255,255,0.7); }
.flashcard-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.fc-card-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
}
.flashcard-front .flashcard-title { color: white; }
.flashcard-hint {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  opacity: 0.45;
  text-align: center;
}
.flashcard-front .flashcard-hint { color: white; }
.flashcard-content {
  font-size: 1rem;
  color: var(--text-mid);
  line-height: 1.8;
  margin-top: 0.5rem;
  white-space: pre-line;
  flex: 1;
}
.flashcard-source {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 0.75rem;
}

.flashcard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.fc-btn {
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  transition: all 0.15s;
}
.fc-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.fc-btn:disabled { opacity: 0.4; cursor: default; }
.fc-counter { font-size: 0.82rem; color: var(--text-muted); }
.fc-shuffle-btn {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-mid);
  transition: all 0.15s;
}
.fc-shuffle-btn:hover { color: var(--brand-dark); border-color: var(--brand); }

/* ─── JAGDZEITEN KALENDER ─── */
/* ─── Jagdzeiten — timeline layout ─── */
.jagdzeiten-hero {
  max-width: 1060px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}

.jagdzeiten-outer {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  max-width: 1060px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
}

.jz-main {
  flex: 1;
  min-width: 0;
}

.jz-sidebar {
  width: 160px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--topbar-h) + 1.5rem);
}

.jz-legend {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.8rem;
}
.jz-legend-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1rem 1.1rem;
}
.jz-legend-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.jz-legend-item { display: flex; align-items: center; gap: 8px; color: var(--text-muted); line-height: 1.3; }
.jz-legend-dot { width: 20px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.jz-dot-jagdbar { background: var(--brand); }
.jz-dot-schonzeit { background: rgba(128,128,128,0.18); }

/* Category group */
.jz-group {
  margin-bottom: 2.5rem;
}
.jz-group-header {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

/* Month label row — sticks to top while scrolling within its group */
.jz-month-labels {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.4rem 0 0.2rem;
  margin-bottom: 0.1rem;
  position: sticky;
  top: var(--topbar-h);
  background: var(--bg);
  z-index: 5;
  border-bottom: 1px solid var(--border);
}
.jz-name-col { width: 170px; flex-shrink: 0; }
.jz-month-label {
  flex: 1;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.jz-dates-col { width: 160px; flex-shrink: 0; }

/* Species row */
.jz-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.jz-row:hover { background: rgba(128,128,128,0.04); border-radius: 6px; }
.jz-row:last-child { border-bottom: none; }
.jz-row-grouped { border-top: none; padding-top: 0.2rem; }
.jz-row-grouped .jz-name { padding-top: 0; }

.jz-name {
  width: 170px;
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  padding-right: 1rem;
  line-height: 1.3;
}
.jz-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 1px;
}

/* The timeline bar */
.jz-bar {
  flex: 1;
  display: flex;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
}
.jz-seg {
  flex: 1;
  border-radius: 2px;
  transition: opacity 0.15s;
  position: relative;
}
.jz-seg::after {
  content: attr(data-month);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: #d4d4d4;
  text-shadow: 0 0 3px rgba(0,0,0,0.7);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  letter-spacing: 0.02em;
}
.jz-seg:hover::after { opacity: 1; }
.jz-hunt   { background: var(--brand); opacity: 0.85; }
.jz-closed { background: rgba(128,128,128,0.12); }
.jz-bar:hover .jz-hunt   { opacity: 1; }
.jz-bar-allyear .jz-hunt { opacity: 0.6; }
.jz-bar-allyear:hover .jz-hunt { opacity: 0.9; }
.jz-row-dim .jz-bar { opacity: 0.25; transition: opacity 0.15s; }

.jz-dates {
  width: 160px;
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-mid);
  padding-left: 1rem;
  font-variant-numeric: tabular-nums;
}

/* Protected species */
.jz-protected-group .jz-group-header { color: var(--text-muted); }
.jz-protected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem 0 0.75rem;
}
.jz-protected-chip {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(128,128,128,0.1);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.jz-protected-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  padding: 0.75rem 1rem;
  background: rgba(128,128,128,0.05);
  border-radius: 6px;
  border-left: 3px solid var(--border-strong);
}

@media (max-width: 780px) {
  .jagdzeiten-hero { padding: 1.5rem 1rem 0; }
  .jagdzeiten-outer {
    flex-direction: column;
    align-items: stretch;        /* override desktop's flex-start so .jz-main fills width */
    padding: 1rem 1rem 3rem;
    gap: 1rem;
  }
  .jz-sidebar { position: static; width: 100%; }
  .jz-main { width: 100%; }
  .jz-legend { flex-direction: row; flex-wrap: wrap; gap: 0.75rem; }
  .jz-legend-card { padding: 0.75rem 1rem; }
  .jz-legend-title { display: none; }

  /* Both Jagdzeiten- and Biologie-tab share these rows: name + dates inline,
     full-width bar on row 2 — no fixed-px columns so we always use full screen width. */
  .jz-row {
    flex-wrap: wrap;
    padding: 0.65rem 0;
    row-gap: 0.35rem;
  }
  .jz-name, .jz-name-col {
    order: 1;
    width: auto;
    flex: 1 1 auto;
    padding-right: 0.5rem;
    min-width: 0;
    font-size: 0.85rem;
  }
  .jz-name .jz-sub { display: inline; margin-left: 0.25rem; }
  .jz-dates, .jz-dates-col {
    order: 2;
    width: auto;
    flex: 0 0 auto;
    margin-left: auto;
    padding-left: 0;
    text-align: right;
    font-size: 0.74rem;
    white-space: nowrap;
    color: var(--text-mid);
  }
  .jz-bar { order: 3; flex: 1 1 100%; height: 16px; }
  .jz-month-labels {
    flex-wrap: wrap;
    row-gap: 0.2rem;
    padding-bottom: 0.35rem;
  }
  .jz-month-labels .jz-name-col,
  .jz-month-labels .jz-dates-col { display: none; }
  .jz-month-label { flex: 1 1 calc(100% / 12); font-size: 0.55rem; }
}

/* Tab toggle */
.jz-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.jz-tab-btn {
  padding: 0.4rem 1.1rem;
  border-radius: 20px;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: inherit;
}
.jz-tab-btn:hover { border-color: var(--brand); color: var(--brand); }
.jz-tab-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Bio legend dots */
.jz-dot-brunft   { background: #C0392B; }
.jz-dot-setzzeit { background: #D4860A; }
.jz-dot-abwurf   { background: #7D5A2F; }
.jz-dot-schieben { background: #1A8C7A; }
.jz-dot-fegen    { background: #3A6DB5; }

/* Bio bar segment colors */
.jz-bio-brunft   { background: #C0392B; opacity: 0.82; }
.jz-bio-setzzeit { background: #D4860A; opacity: 0.82; }
.jz-bio-abwurf   { background: #7D5A2F; opacity: 0.85; }
.jz-bio-schieben { background: #1A8C7A; opacity: 0.82; }
.jz-bio-fegen    { background: #3A6DB5; opacity: 0.82; }
.jz-bar:hover .jz-bio-brunft,
.jz-bar:hover .jz-bio-setzzeit,
.jz-bar:hover .jz-bio-abwurf,
.jz-bar:hover .jz-bio-schieben,
.jz-bar:hover .jz-bio-fegen { opacity: 1; }

/* Geweih group separator */
.jz-geweih-group { border-top: 2px solid var(--border-strong); padding-top: 0.5rem; }

/* ─── BIBLIOTHEK ─── */
.bibliothek-outer {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--topbar-h));
}
.bibliothek-inner {
  flex: 1;
  min-width: 0;
  padding: 2rem 1.5rem;
}

/* Bibliothek sidebar */
.bib-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  padding: 0.75rem 0 2rem;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.bib-sidebar:hover { scrollbar-color: rgba(128,128,128,0.2) transparent; }
.bib-sidebar { background: var(--bg); border-color: var(--border); }
.bib-sidebar::-webkit-scrollbar { width: 3px; }
.bib-sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
.bib-sidebar:hover::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.2); }

.bib-nav-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 0.75rem 0.6rem;
  margin: 0 0.5rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-mid);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color 0.12s;
}
.bib-nav-header:hover { color: var(--brand-dark); }

.bib-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0.75rem;
  margin: 1px 0.5rem;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  text-decoration: none;
  line-height: 1.3;
}
.bib-nav-item:hover { color: var(--text-mid); background: rgba(128,128,128,0.07); }
.bib-nav-item.active { color: var(--brand-dark); background: rgba(58,170,112,0.13); font-weight: 700; }
.bib-nav-item.active { color: var(--brand-light); background: rgba(58,170,112,0.15); }

.bib-nav-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0.75rem 5px 1.75rem;
  margin: 1px 0.5rem;
  border-radius: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  line-height: 1.3;
  opacity: 0.85;
}
.bib-nav-sub:hover { color: var(--text-mid); background: rgba(128,128,128,0.06); opacity: 1; }
.bib-nav-sub.active { color: var(--brand-dark); background: rgba(58,170,112,0.1); font-weight: 600; opacity: 1; }
.bib-nav-sub.active { color: var(--brand-light); background: rgba(58,170,112,0.12); }

.bib-nav-sub2 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0.75rem 4px 2.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s, color 0.1s;
  opacity: 0.8;
}
.bib-nav-sub2:hover { color: var(--text-mid); background: rgba(128,128,128,0.06); opacity: 1; }
.bib-nav-sub2.active { color: var(--brand-dark); background: rgba(58,170,112,0.08); font-weight: 600; opacity: 1; }
.bib-nav-sub2.active { color: var(--brand-light); background: rgba(58,170,112,0.1); }

.bib-nav-sub3 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0.75rem 3px 3.6rem;
  font-size: 0.69rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s, color 0.1s;
  opacity: 0.78;
  line-height: 1.3;
}
.bib-nav-sub3:hover { color: var(--text-mid); background: rgba(128,128,128,0.05); opacity: 1; }
.bib-nav-sub3.active { color: var(--brand-dark); background: rgba(58,170,112,0.08); font-weight: 600; opacity: 1; }
.bib-nav-sub3.active { color: var(--brand-light); background: rgba(58,170,112,0.1); }

.bib-nav-sub4 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0.75rem 3px 4.4rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s, color 0.1s;
  opacity: 0.75;
  line-height: 1.3;
}
.bib-nav-sub4:hover { color: var(--text-mid); background: rgba(128,128,128,0.05); opacity: 1; }
.bib-nav-sub4.active { color: var(--brand-dark); background: rgba(58,170,112,0.08); font-weight: 600; opacity: 1; }
.bib-nav-sub4.active { color: var(--brand-light); background: rgba(58,170,112,0.1); }

.bib-nav-article {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.bib-nav-count {
  margin-left: auto;
  font-size: 0.62rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(128,128,128,0.1);
  color: var(--text-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Lernkarten sidebar */
.lernkarten-outer {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--topbar-h));
}
.lk-sidebar {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  padding: 0.75rem 0 2rem;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.lk-sidebar:hover { scrollbar-color: rgba(128,128,128,0.2) transparent; }
.lk-sidebar { background: var(--bg); }
.lk-sidebar-title {
  padding: 0.5rem 0.75rem 0.6rem;
  margin: 0 0.5rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  opacity: 0.8;
}
.lk-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0.75rem;
  margin: 1px 0.5rem;
  border-radius: 7px;
  font-size: 0.79rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.lk-nav-item:hover { color: var(--text-mid); background: rgba(128,128,128,0.07); }
.lk-nav-item.active { color: var(--brand-dark); background: rgba(58,170,112,0.13); font-weight: 700; }
.lk-nav-item.active { color: var(--brand-light); background: rgba(58,170,112,0.15); }

@media (max-width: 960px) {
  .bib-sidebar, .lk-sidebar { display: none; }
  .bibliothek-outer, .lernkarten-outer { display: block; }
}

/* Sachgebiet landing cards */
.bib-sg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
  align-items: stretch;
  grid-auto-rows: 320px;
}
.bib-sg-cards-compact {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.9rem;
  grid-auto-rows: 290px;
}
.bib-sg-cards-compact .bib-sg-card-img,
.bib-sg-cards-compact .bib-sg-card-img-placeholder { height: 130px; }
.bib-sg-cards-compact .bib-sg-card-img-placeholder { font-size: 2.75rem; }
.bib-sg-cards-compact .bib-sg-card-body { padding: 0.95rem 0.95rem 0.8rem; gap: 0.35rem; }
.bib-sg-cards-compact .bib-sg-card-title { font-size: 0.92rem; }
.bib-sg-card-head { display: flex; align-items: center; gap: 0.4rem; }
.bib-sg-card-highlight { border-color: var(--brand); box-shadow: 0 0 0 1px rgba(58,170,112,0.2) inset; }
.bib-sg-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.bib-sg-card { background: var(--bg-card); }
.bib-sg-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.bib-sg-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--forest), var(--forest-mid));
}
.bib-sg-card-img-placeholder {
  width: 100%;
  height: 160px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.5);
  font-family: 'SF Mono', 'Consolas', monospace;
}
.bib-sg-card-body {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.bib-sg-card-icon {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--brand);
  opacity: 0.8;
}
.bib-sg-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--forest);
  line-height: 1.2;
}
.bib-sg-card-title { color: var(--brand-light); }
.bib-sg-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}
.bib-sg-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
}
.bib-sg-card-count {
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 10px;
  background: rgba(58,170,112,0.1);
  color: var(--brand-dark);
  font-weight: 600;
}
.bib-sg-card-arrow {
  color: var(--brand);
  font-size: 1.1rem;
  font-weight: 700;
}

/* Category group within sachgebiet */
.bib-category-group { margin-bottom: 2rem; }
.bib-category-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

/* Breadcrumb + back in sachgebiet detail */
.bib-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.bib-breadcrumb a {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 600;
}
.bib-breadcrumb a:hover { color: var(--brand); }
.bib-breadcrumb-sep { color: var(--border-strong); }
.bib-breadcrumb-current { color: var(--text-mid); font-weight: 600; }

/* Sachgebiet detail header */
.bib-sg-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}
.bib-sg-detail-icon {
  font-size: 0.7rem;
  font-weight: 800;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--brand);
  background: rgba(58,170,112,0.12);
  border-radius: 6px;
  padding: 6px 10px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.bib-sg-detail-title { font-size: 1.3rem; font-weight: 800; color: var(--forest); }
.bib-sg-detail-title { color: var(--brand-light); }
.bib-sg-detail-count { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

/* Section within sachgebiet */
.bib-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 1.5rem 0 0.75rem;
}
.bib-section-title:first-child { margin-top: 0; }

.bib-law-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  background: rgba(58,170,112,0.08);
  border: 1px solid rgba(58,170,112,0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  cursor: pointer;
  transition: background 0.15s;
}
.bib-law-banner:hover { background: rgba(58,170,112,0.13); }

/* Article/animal card grid */
.bib-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
  align-items: stretch;
  grid-auto-rows: 280px;
}
.bib-article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  height: 280px;
}
.bib-article-card { background: var(--bg-card); }
.bib-article-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.bib-article-card-media {
  position: relative;
  width: 100%;
  height: 130px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--forest), var(--forest-mid));
  overflow: hidden;
}
.bib-article-card-img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}
.bib-article-card-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: rgba(255,255,255,0.7);
  background: linear-gradient(135deg, var(--forest), var(--forest-mid));
}
.bib-article-card-body {
  padding: 0.75rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 0;
}
.bib-sg-cards-divider {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 1.5rem 0 0.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.bib-article-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}
.bib-article-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bib-article-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.bib-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(58,170,112,0.1);
  color: var(--brand-dark);
  font-weight: 500;
}

/* Animal filter chips inside Bibliothek */
.bib-animal-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.bib-chip {
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-mid);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
}
.bib-chip:hover, .bib-chip.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* Detail overlay */
.bib-article-detail {
  display: none;
  width: 100%;
}
.bib-article-detail.active { display: block; }
.bib-article-modal {
  max-width: 780px;
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}
.bib-article-modal { background: var(--bg-card); }
.bib-modal-meta { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.bib-free-tag { font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(58,170,112,0.15); color: var(--brand-dark); }
.bib-free-tag { color: var(--brand-light); }
.bib-article-modal h2 { font-size: 1.3rem; font-weight: 800; color: var(--forest); margin-bottom: 1rem; line-height: 1.3; }
.bib-article-inline { max-width: 820px; margin: 1rem 0 3rem; }
.bib-article-inline-title { font-size: 1.5rem; font-weight: 800; color: var(--forest); margin: 0.4rem 0 1rem; line-height: 1.25; }
.bib-article-inline-title { color: var(--brand-light); }

/* Article audio player — standalone version of the lesson agenda player */
.bib-audio-wrap {
  margin: 0.75rem 0 1.5rem;
}
.bib-audio-wrap .bib-audio-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand-dark);
  margin-bottom: 0.4rem;
}
.bib-audio-wrap .bib-audio-label { color: var(--brand-light); }

.bib-audio-player {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 46px;
  box-sizing: border-box;
}
.bib-audio-player audio { display: none; }
.bib-audio-player .agenda-audio-play  { width: 34px; height: 34px; }
.bib-audio-player .agenda-audio-play svg { width: 15px; height: 15px; }
.bib-audio-player .agenda-audio-scrubber { flex: 1; height: 5px; min-width: 50px; }
.bib-audio-player .agenda-audio-time { font-size: 0.7rem; }

@media (max-width: 600px) {
  .bib-audio-player {
    padding: 0.55rem 0.65rem;
    min-height: 44px;
    gap: 0.5rem;
  }
  .bib-audio-player .agenda-audio-play  { width: 36px; height: 36px; }
  .bib-audio-player .agenda-audio-play svg { width: 16px; height: 16px; }
}

/* ─── legacy .bib-audio (kept for any existing references; can be removed later) ─── */
.bib-audio {
  margin: 0.75rem 0 1.5rem;
  padding: 0.85rem 1rem 0.95rem;
  background: linear-gradient(135deg, rgba(58,170,112,0.10) 0%, rgba(58,170,112,0.04) 100%);
  border: 1px solid rgba(58,170,112,0.25);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.bib-audio {
  background: linear-gradient(135deg, rgba(58,170,112,0.13) 0%, rgba(58,170,112,0.05) 100%);
  border-color: rgba(58,170,112,0.30);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.bib-audio audio { display: none; }

.bib-audio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}
.bib-audio-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand-dark);
}
.bib-audio-label { color: var(--brand-light); }

.bib-audio-spd-group {
  display: inline-flex;
  background: rgba(255,255,255,0.4);
  border-radius: 999px;
  padding: 2px;
  gap: 0;
}
.bib-audio-spd-group { background: rgba(0,0,0,0.25); }
.bib-audio-spd {
  border: none;
  background: transparent;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.bib-audio-spd:hover { color: var(--text); }
.bib-audio-spd.is-active {
  background: var(--brand);
  color: #fff;
}

.bib-audio-body {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.bib-audio-play {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(58,170,112,0.35);
}
.bib-audio-play:hover { background: var(--brand-dark); transform: scale(1.05); box-shadow: 0 3px 10px rgba(58,170,112,0.5); }
.bib-audio-play:active { transform: scale(0.96); }
.bib-audio-play svg { width: 22px; height: 22px; }
.bib-audio-icon-play  { margin-left: 2px; } /* visually center triangle */

.bib-audio-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.bib-audio-scrubber {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(128,128,128,0.25);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  outline: none;
}
.bib-audio-scrubber:focus-visible { box-shadow: 0 0 0 2px rgba(58,170,112,0.5); }
.bib-audio-buffered {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: rgba(128,128,128,0.4);
  border-radius: 999px;
}
.bib-audio-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: 999px;
  transition: width 0.1s linear;
}
.bib-audio-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  background: var(--brand);
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  pointer-events: none;
  transition: width 0.15s, height 0.15s;
}
.bib-audio-thumb { border-color: var(--bg-card); }
.bib-audio-scrubber:hover .bib-audio-thumb,
.bib-audio-scrubber:active .bib-audio-thumb { width: 16px; height: 16px; }

.bib-audio-times {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.bib-audio-skip {
  flex: 0 0 auto;
  position: relative;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,0.4);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-mid);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.bib-audio-skip { background: rgba(0,0,0,0.25); }
.bib-audio-skip:hover { background: rgba(58,170,112,0.2); color: var(--brand-dark); }
.bib-audio-skip:hover { color: var(--brand-light); }
.bib-audio-skip svg { width: 18px; height: 18px; }
.bib-audio-skip span {
  position: absolute;
  font-size: 0.55rem;
  font-weight: 700;
  bottom: 5px;
  pointer-events: none;
}

@media (max-width: 540px) {
  .bib-audio-spd-group { display: none; }
  .bib-audio-skip { display: none; }
  .bib-audio-play { width: 40px; height: 40px; }
}
.bib-article-modal h2 { color: var(--brand-light); }

/* Rich HTML content from Waidwissen scraper */
.bib-content { font-size: 0.91rem; color: var(--text-mid); line-height: 1.8; margin: 0.5rem 0 1rem; }
.bib-content h2, .bib-content .ww-section-title { font-size: 1.05rem; font-weight: 800; color: var(--forest); margin: 1.5rem 0 0.5rem; padding-top: 0.25rem; border-top: 1px solid var(--border); }
.bib-content h2, .bib-content .ww-section-title { color: var(--brand-light); }
.bib-content h3 { font-size: 0.95rem; font-weight: 700; color: var(--text); margin: 1rem 0 0.4rem; }
.bib-content p { margin-bottom: 0.75rem; }
.bib-content ul, .bib-content ol { padding-left: 1.4rem; margin-bottom: 0.75rem; }
.bib-content li { margin-bottom: 0.3rem; }
.bib-content table.ww-table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.84rem; }
.bib-content table.ww-table th, .bib-content table.ww-table td { padding: 0.45rem 0.7rem; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.bib-content table.ww-table th { background: rgba(58,170,112,0.08); font-weight: 700; }
.bib-content figure { margin: 0.75rem 0; }
.bib-content figure img { max-width: 100%; border-radius: var(--radius-sm); display: block; }
.bib-content figcaption { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; font-style: italic; }
.bib-content .ww-callout { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin: 0.75rem 0; font-size: 0.86rem; line-height: 1.6; }
.bib-content .ww-important, .bib-content .ww-cave { background: rgba(200,80,60,0.08); border-left: 3px solid #c84c3c; }
.bib-content .ww-note { background: rgba(58,130,200,0.08); border-left: 3px solid #3a82c8; }
.bib-content .ww-tip { background: rgba(58,170,112,0.08); border-left: 3px solid var(--brand); }
.bib-content .ww-mnemonic { background: rgba(130,80,200,0.08); border-left: 3px solid #8250c8; }
.bib-content .ww-important, .bib-content .ww-cave { background: rgba(200,80,60,0.12); }
.bib-content .ww-note { background: rgba(58,130,200,0.12); }
.bib-content .ww-tip { background: rgba(58,170,112,0.12); }
.bib-content details.ww-explanation { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 0.5rem 0; }
.bib-content details.ww-explanation summary { padding: 0.5rem 0.75rem; font-size: 0.84rem; font-weight: 600; cursor: pointer; color: var(--brand-dark); }
.bib-content details.ww-explanation summary { color: var(--brand-light); }
.bib-content details.ww-explanation[open] summary { border-bottom: 1px solid var(--border); }
.bib-content details.ww-explanation > *:not(summary) { padding: 0.75rem; }
.bib-content .ww-video { margin: 0.75rem 0; position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.bib-content .ww-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.bib-content .ww-video-thumb { display: block; position: relative; border-radius: var(--radius-sm); overflow: hidden; }
.bib-content .ww-video-thumb img { width: 100%; display: block; border-radius: var(--radius-sm); }
.bib-content .ww-video-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.35); color: white; font-weight: 700; font-size: 0.9rem; border-radius: var(--radius-sm); }
.bib-content .ww-video-title { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.bib-content section { margin-bottom: 0.5rem; }
.bib-content a.bib-internal-link {
  color: var(--brand-dark);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(58,170,112,0.4);
  text-underline-offset: 2px;
  cursor: pointer;
}
.bib-content a.bib-internal-link:hover {
  color: var(--brand);
  text-decoration-color: var(--brand);
  background: rgba(58,170,112,0.08);
}
.bib-content a.bib-internal-link { color: var(--brand-light); }
.bib-content .bib-dead-link { color: inherit; }

.bib-keyfacts { background: var(--bg); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin-top: 1rem; }
.bib-keyfacts { background: var(--bg); }
.bib-keyfacts h4 { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.5rem; }
.bib-keyfacts ul { padding-left: 1.25rem; }
.bib-keyfacts li { font-size: 0.85rem; color: var(--text-mid); line-height: 1.7; margin-bottom: 0.2rem; }

/* ═══════════════════════════════════════════════════════
   DARK MODE — comprehensive overrides
   ═══════════════════════════════════════════════════════ */

/* ── Page title — was using --forest (near-invisible on dark bg) ── */
.page-title { color: var(--text); }
.page-subtitle { color: var(--text-muted); }

/* ── Topbar ── */
.topbar { background: #0d1014; border-bottom-color: rgba(255,255,255,0.08); }

/* ── Hero sections — vivid green gradient, clearly separate from slate bg ── */
.law-hero {
  background: linear-gradient(135deg, #1a3328 0%, #224030 100%);
}
.law-hero h1 { color: #fff; }
.law-hero .hero-desc { color: rgba(255,255,255,0.75); }
.law-hero .eyebrow { color: var(--brand-light); }
.animal-detail-header {
  background: linear-gradient(135deg, #1a3328 0%, #224030 100%);
}

/* ── Sidebar ── */
.sidebar { background: #0d1014; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
.sb-link.active { color: var(--brand-light); }

/* ── Week cards & lesson overlay ── */
.week-card.has-content::after { background: var(--brand-light); }
.week-card { border-color: transparent; }
.week-card.has-content { box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 0 2px var(--brand); }
.lesson-detail-modal { background: var(--bg-card); border-color: var(--border); box-shadow: 0 24px 72px rgba(0,0,0,0.7); }
.week-card-meta .meta-pill { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.week-card-meta .meta-pill.has { background: rgba(58,170,112,0.18); color: var(--brand-light); }
.lesson-detail-modal .lesson-files a { color: var(--brand-light); }

/* ── Lesson callouts (hardcoded light colours) ── */
/* Lesson summary dark mode */
.lesson-summary { color: var(--text-mid); }
.lesson-summary h5 { color: var(--text); border-color: var(--border); }
.lesson-summary h6 { color: var(--text); }
.lesson-summary strong { color: var(--text); }
.lesson-summary .ls-intro { background: rgba(58,170,112,0.08); color: var(--text-mid); }
.lesson-summary .ls-callout { background: rgba(255,255,255,0.03); border-color: var(--border); }
.lesson-summary .ls-callout.exam   { background: rgba(192,112,16,0.1); border-left-color: #d08028; }
.lesson-summary .ls-callout.exam   .ls-callout-title { color: #e89848; }
.lesson-summary .ls-callout.warn   { background: rgba(192,64,64,0.1); border-left-color: #c86060; }
.lesson-summary .ls-callout.warn   .ls-callout-title { color: #e07878; }
.lesson-summary .ls-callout.mnemo  { background: rgba(96,80,200,0.1); border-left-color: #8878d8; }
.lesson-summary .ls-callout.mnemo  .ls-callout-title { color: #a898e8; }
.lesson-summary .ls-callout.note   { background: rgba(64,144,192,0.1); border-left-color: #60a8d8; }
.lesson-summary .ls-callout.note   .ls-callout-title { color: #80c0e8; }
.lesson-summary table.ls-table th { background: var(--bg); color: var(--text); }
.lesson-summary table.ls-table td,
.lesson-summary table.ls-table th { border-color: var(--border); }
.lesson-summary table.ls-table tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.lesson-summary .ls-fact { background: var(--bg); border-color: var(--border); }
.lesson-summary .ls-fact b { color: var(--brand-light); }

/* ── Search & back-link ── */
.back-link { color: var(--brand-light); }
.back-link:hover { color: var(--brand); }
.search-result-item { border-color: var(--border); }

/* ── Badge text colours (hardcoded) ── */
.badge-lesson  { color: #d4aa30; }
.badge-library { color: #9898d8; }

/* ── Filter chips (animal/wildtier page) ── */
.filter-chip { background: var(--bg-card); border-color: var(--border-strong); color: var(--text-muted); }
.filter-chip.active { background: rgba(58,170,112,0.15); border-color: var(--brand); color: var(--brand-light); }

/* ── Lernkarten SG cards ── */
.lk-sg-card { background: var(--bg-card); border-color: var(--border); }
.lk-sg-card-info { background: var(--bg-card); }
.lk-sg-card-label { color: var(--brand-light); }
.lk-sg-card-title { color: var(--text); }
.lk-sg-card-stats { color: var(--text-muted); }
.lk-sg-card-progress-bar { background: rgba(58,170,112,0.12); }
.lk-sg-card-btn { background: rgba(58,170,112,0.15); color: var(--brand-light); }
.lk-sg-card:hover { border-color: var(--border-strong); }

/* ── Quiz ── */
.score-correct { color: #4dcc88; }
.quiz-exit-btn { border-color: var(--border-strong); color: var(--text-muted); }
.quiz-exit-btn:hover { color: #e07878; border-color: #e07878; }
.quiz-sg-section-label { color: var(--text-muted); }

/* ── Generic form controls ── */
select,
input:not([type="file"]):not(#global-search),
textarea {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
  color-scheme: dark;
}
select option { background: var(--bg); color: var(--text); }
input::placeholder,
textarea::placeholder { color: var(--text-muted); }
/* Search bar input must stay transparent so it blends into its pill wrapper. */
.topbar .search-box #global-search,
.topbar .search-box input {
  background: transparent !important;
  color: white;
}

/* ── Bibliothek breadcrumb & law banner ── */
.bib-breadcrumb { color: var(--text-muted); }
.bib-breadcrumb a { color: var(--brand-light); }
.bib-law-banner { background: rgba(58,170,112,0.08); border-color: rgba(58,170,112,0.2); }
.bib-law-banner:hover { background: rgba(58,170,112,0.14); }
.bib-sg-cards-divider { color: var(--text-muted); border-color: var(--border); }

/* ── Flashcard card image ── */
.fc-card-img { box-shadow: 0 2px 8px rgba(0,0,0,0.4); }

/* ── Home page cards ── */
.home-card { background: var(--bg-card); border-color: var(--border); }
.home-card:hover { border-color: var(--border-strong); }
.home-card-icon { background: rgba(58,170,112,0.1); }

/* ── ww-table in bib content ── */
.bib-content table.ww-table th { background: var(--bg-card); color: var(--text); }
.bib-content table.ww-table tr:nth-child(even) td { background: rgba(58,170,112,0.04); }

/* ── Global Now-Playing Bar ── */
.global-player {
  position: fixed;
  left: 0; right: 0;
  bottom: env(safe-area-inset-bottom);   /* Sit ABOVE the iOS/Android home indicator, not inside it */
  height: 58px;
  padding: 0 1.25rem;
  background: #18181b;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 9000;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.45);
}
.gp-play {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.gp-play:hover { background: var(--brand-dark); transform: scale(1.06); }
.gp-play svg { width: 16px; height: 16px; }
.gp-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}
.gp-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255,255,255,0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  transition: color 0.12s;
}
.gp-title:hover { color: #fff; text-decoration: underline; }
.gp-title::after { content: " →"; font-size: 0.72rem; opacity: 0.5; }
.gp-scrubber {
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
  transition: height 0.12s;
}
.gp-scrubber:hover { height: 5px; }
.gp-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--brand);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
  transition: width 0.25s linear;
}
.gp-time {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.gp-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
  transition: background 0.12s, color 0.12s;
}
.gp-close:hover { background: rgba(255,255,255,0.18); color: #fff; }
/* Push page content up so nothing hides behind the bar */
body.has-global-player .page.active { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }

/* Make the unused area between the player and the home indicator match the player bg
   (avoids a "weird stripe" of body-color showing under the player) */
body.has-global-player::after {
  content: '';
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: env(safe-area-inset-bottom);
  background: #18181b;
  z-index: 9000;
  pointer-events: none;
}

/* Bigger touch-friendly bottom player on phones */
@media (max-width: 600px) {
  .global-player {
    height: 64px;
    padding: 0 1rem;
    gap: 0.6rem;
  }
  .gp-play  { width: 44px; height: 44px; }
  .gp-play svg { width: 19px; height: 19px; }
  .gp-title { font-size: 0.92rem; }
  .gp-time  { font-size: 0.72rem; }
  .gp-scrubber { height: 4px; }
  .gp-close { width: 40px; height: 40px; font-size: 1rem; flex-shrink: 0; }
  body.has-global-player .page.active { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* ─── RESPONSIVE additions ─── */
@media (max-width: 960px) {
  .quiz-page-inner, .lernkarten-inner, .bibliothek-inner { padding: 1.5rem 1rem; }
  .jz-table th:first-child { min-width: 120px; }
  /* Wrap the Jagdzeiten table so it scrolls horizontally instead of overflowing the page */
  .jz-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 600px) {
  .question-text { font-size: 0.95rem; }
  .option-btn { font-size: 0.85rem; }
  .bib-articles-grid { grid-template-columns: 1fr; }
  /* Tighter page-level padding so cards and tables get more usable width */
  .main-content { padding: 1rem 0.85rem; }
  .quiz-page-inner, .lernkarten-inner, .bibliothek-inner { padding: 1rem 0.85rem; }
  /* Article body smaller margins so the audio bar isn't crowded */
  .bib-article-inline { padding: 0; }

  /* ── Lernkarten session header: stack rows so nothing gets squished ── */
  .lk-session-header {
    gap: 0.5rem 0.75rem;
    align-items: flex-start;
  }
  .lk-session-header .back-link { flex-basis: 100%; font-size: 0.85rem; }
  .lk-session-title {
    flex: 1 1 100%;
    font-size: 1.05rem;
    line-height: 1.25;
    order: 1;
  }
  .lk-session-counter { order: 2; }
  .lk-session-reset { order: 3; margin-left: auto; }
  .lernkarten-controls { gap: 0.5rem; }
  .lernkarten-stat { font-size: 0.78rem; }
  .lk-repeat-btn { font-size: 0.74rem; padding: 4px 10px; }

  /* ── Flashcard: drop 3D flip on phones, let content grow vertically ── */
  .flashcard-wrap { perspective: none; min-height: 0; margin-bottom: 1rem; }
  .flashcard {
    transform: none !important;
    transform-style: flat;
    min-height: 0;
    cursor: pointer;
  }
  .flashcard-face {
    position: relative;
    width: 100%;
    min-height: 0;
    backface-visibility: visible;
    transform: none !important;
    padding: 1.25rem 1.1rem;
    border-radius: var(--radius);
  }
  .flashcard:not(.flipped) .flashcard-back { display: none; }
  .flashcard.flipped .flashcard-front { display: none; }
  .flashcard-content { font-size: 0.92rem; line-height: 1.55; }
  .flashcard-title { font-size: 1.05rem; }

  /* Flashcard nav: stack so the ✓/✗ row gets full width */
  .flashcard-nav { flex-wrap: wrap; gap: 0.6rem; justify-content: space-between; }
  .flashcard-nav > div { flex: 1 1 100%; order: 2; }
  .flashcard-nav > .fc-btn { flex: 1 1 calc(50% - 0.3rem); }
  .fc-btn { font-size: 0.8rem; padding: 0.55rem 0.6rem; }

  /* Score view: keep the result list inside the card without horizontal cut-off */
  .lk-score-card { padding: 1.25rem 1rem; }
  .lk-score-results { max-height: none; overflow: visible; }
  .lk-score-item { font-size: 0.85rem; }
  .lk-score-actions .lk-score-btn { flex: 1 1 calc(50% - 0.4rem); padding: 0.6rem 0.4rem; font-size: 0.85rem; }

  /* Jagdzeiten / Biologie row layout lives in the 780px block above so it covers
     both narrow phones and large phones / portrait tablets uniformly. */
}
