/* bildungssprit OER – Styles
   Brand-Regel: Buttons, Eingabefelder und Pills sind eckig (--r-md = 0).
   Größere Boxen und Karten ebenfalls (--r-md). */

:root {
  --ink: #f9f9f9;
  --muted: #b7d4d6;
  --paper: #072e3d;
  --surface: rgba(7, 46, 61, 0.82);
  --surface-strong: #031627;
  --line: rgba(8, 224, 207, 0.34);
  --edge: #ff4080;
  --blue: #08e0cf;
  --green: #019798;
  --rose: #ff4080;
  --yellow: #f6c83b;
  --soft-yellow: #fcebb7;
  --pink-soft: #fac0d7;
  --sand: #fdf0dd;
  --violet: #9d7bff;
  --r-sm: 12px;
  --r-md: 0;
  --r-pill: 999px;
  --glow-pink: 0 0 18px rgba(255, 64, 128, 0.16);
  --shadow: 0 0 0 1px rgba(255, 64, 128, 0.42), 0 0 28px rgba(255, 64, 128, 0.32), 0 0 48px rgba(8, 224, 207, 0.13);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  --ink: #031627;
  --muted: #3f6270;
  --paper: #f9f9f9;
  --surface: rgba(253, 240, 221, 0.92);
  --surface-strong: #f9f9f9;
  --line: rgba(1, 151, 152, 0.28);
  --edge: #019798;
  --glow-pink: 0 0 16px rgba(255, 64, 128, 0.12);
  --shadow: 0 18px 46px rgba(3, 22, 39, 0.12), 0 0 0 1px rgba(255, 64, 128, 0.18);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(8, 224, 207, 0.06) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(255, 64, 128, 0.05) 0 1px, transparent 1px 72px),
    linear-gradient(115deg, rgba(255, 64, 128, 0.2), transparent 24%, rgba(8, 224, 207, 0.14) 62%, transparent 78%),
    linear-gradient(135deg, #031627 0%, #031627 48%, #072e3d 100%);
  min-height: 100vh;
}

html[data-theme="light"] body {
  background:
    repeating-linear-gradient(90deg, rgba(1, 151, 152, 0.08) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(255, 64, 128, 0.06) 0 1px, transparent 1px 72px),
    linear-gradient(115deg, rgba(255, 64, 128, 0.08), transparent 28%, rgba(8, 224, 207, 0.1) 62%, transparent 78%),
    linear-gradient(135deg, #f9f9f9 0%, #fdf0dd 52%, #fcebb7 100%);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

/* Scroll-Fortschritt */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 6px;
  width: 0;
  background: var(--rose);
  box-shadow: 0 0 14px rgba(255, 64, 128, 0.7), 0 0 26px rgba(255, 64, 128, 0.35);
  z-index: 30;
  pointer-events: none;
}

/* Nach-oben-Pfeil */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  border: 1px solid var(--blue);
  background: var(--surface-strong);
  color: var(--blue);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 25;
  box-shadow: 0 0 18px rgba(8, 224, 207, 0.4), 0 6px 18px rgba(3, 22, 39, 0.5);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease, background 160ms ease;
}

.to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.to-top:hover {
  background: var(--rose);
  color: #031627;
  border-color: var(--rose);
}

.to-top:focus-visible {
  outline: 3px solid rgba(8, 224, 207, 0.55);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .to-top {
    right: 14px;
    bottom: 14px;
  }
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: var(--r-sm);
}

.brand:hover strong {
  color: var(--blue);
}

.mark {
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 0 10px rgba(255, 64, 128, 0.55));
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  letter-spacing: 0;
  font-size: 1rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.9rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  border: 1px solid var(--line);
  background: rgba(7, 46, 61, 0.62);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.pill:hover,
.pill:focus-visible {
  transform: translateY(-1px);
  border-color: var(--blue);
  outline: 3px solid rgba(8, 224, 207, 0.24);
}

.theme-toggle {
  border-color: var(--blue);
  color: var(--blue);
}

html[data-theme="light"] .pill {
  background: rgba(249, 249, 249, 0.78);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 26px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-main {
  min-height: 320px;
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  background:
    linear-gradient(120deg, rgba(255, 64, 128, 0.16), transparent 34%),
    linear-gradient(160deg, rgba(8, 224, 207, 0.12), transparent 58%),
    var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(24px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.hero-main::after {
  content: "";
  position: absolute;
  right: clamp(12px, 4vw, 42px);
  top: clamp(14px, 4vw, 44px);
  width: 170px;
  height: 170px;
  background:
    linear-gradient(90deg, var(--blue) 0 4px, transparent 4px 100%),
    linear-gradient(0deg, var(--rose) 0 4px, transparent 4px 100%);
  background-size: 32px 32px;
  opacity: 0.08;
  transform: rotate(-8deg);
  pointer-events: none;
}

.eyebrow {
  color: var(--blue);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin: 0 0 14px;
}

.eyebrow.gold {
  color: #ffd36b;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(2.35rem, 6vw, 5rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.48;
  margin: 22px 0 0;
}

.search-panel {
  margin-top: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  max-width: 800px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.search-panel input {
  width: 100%;
  min-height: 58px;
  border: 2px solid var(--blue);
  border-radius: var(--r-md);
  padding: 0 18px;
  background: rgba(3, 22, 39, 0.9);
  color: var(--ink);
  box-shadow: 0 0 24px rgba(8, 224, 207, 0.18);
}

html[data-theme="light"] .search-panel input {
  background: #f9f9f9;
}

:is(.search-panel input, .search-panel button, .chip, .switch, .filters input,
    .filters button, .card button, .card a, .drawer-close, .drawer-actions a, .drawer-actions button,
    .drawer-links a, .mini-dot, .active-chip, .filters-toggle, .sort select, .pill, .brand,
    .cloud-pause, .ticker-pause, .reset-btn, .like-btn, .merk-btn):focus-visible {
  outline: 3px solid rgba(8, 224, 207, 0.55);
  outline-offset: 3px;
}

.search-panel button {
  min-height: 58px;
  border: 2px solid var(--yellow);
  border-radius: var(--r-md);
  background: var(--yellow);
  color: #031627;
  padding: 0 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(246, 200, 59, 0.36);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.search-panel button:hover,
.search-panel button:focus-visible {
  border-color: var(--blue);
  background: #f8d44a;
  box-shadow: 0 0 26px rgba(246, 200, 59, 0.48), 0 0 14px rgba(8, 224, 207, 0.28);
  transform: translateY(-1px);
}

.hero-side {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background:
    linear-gradient(145deg, rgba(255, 64, 128, 0.18), transparent 34%),
    #031627;
  color: #f9f9f9;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  align-content: space-between;
  gap: 24px;
  overflow: hidden;
  position: relative;
}

.hero-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, transparent 0 58%, rgba(8, 224, 207, 0.18) 58% 59%, transparent 59% 100%),
    linear-gradient(118deg, transparent 0 66%, rgba(255, 64, 128, 0.24) 66% 67%, transparent 67% 100%);
  pointer-events: none;
}

.hero-side h2 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.12;
  letter-spacing: 0;
}

.spotlight {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.spot-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--glow-pink);
}

.spot-card strong {
  display: block;
  margin-bottom: 6px;
}

.spot-card span {
  color: rgba(248, 243, 233, 0.78);
  line-height: 1.45;
}

/* 3D-Tag-Wolke */
.tag-cloud-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.tag-cloud {
  position: relative;
  height: 290px;
  touch-action: pan-y;
  cursor: grab;
  overflow: hidden;
}

.tag-cloud:active {
  cursor: grabbing;
}

.tag-item {
  position: absolute;
  left: 50%;
  top: 50%;
  border: none;
  background: none;
  color: #f9f9f9;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
  white-space: nowrap;
  will-change: transform, opacity;
}

.tag-item:hover {
  color: var(--blue);
}

.tag-item.front {
  text-shadow: 0 0 12px rgba(8, 224, 207, 0.8), 0 0 22px rgba(255, 64, 128, 0.5);
}

.tag-item:focus-visible {
  outline: 3px solid rgba(8, 224, 207, 0.55);
  outline-offset: 2px;
  opacity: 1 !important;
}

.cloud-pause {
  justify-self: start;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
  color: #f9f9f9;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.cloud-pause:hover,
.cloud-pause:focus-visible {
  border-color: var(--blue);
  background: rgba(8, 224, 207, 0.14);
  box-shadow: 0 0 16px rgba(8, 224, 207, 0.28);
}

/* Ticker: Neu im Regal / Beliebt */
.ticker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 6px 12px 6px 6px;
  box-shadow: var(--glow-pink);
}

.ticker-pause {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.ticker-pause:hover,
.ticker-pause:focus-visible {
  border-color: var(--blue);
  background: rgba(8, 224, 207, 0.1);
  box-shadow: 0 0 14px rgba(8, 224, 207, 0.22);
}

.ticker-viewport {
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.ticker-track {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  white-space: nowrap;
  width: max-content;
  animation: ticker-scroll var(--ticker-duration, 30s) linear infinite;
}

.ticker.paused .ticker-track,
.ticker:hover .ticker-track,
.ticker:focus-within .ticker-track {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-item {
  border: none;
  background: none;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
}

.ticker-item:hover {
  color: var(--blue);
}

.ticker-tag {
  background: var(--blue);
  color: #031627;
  border-radius: var(--r-pill);
  padding: 2px 9px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ticker-tag.hot {
  background: var(--rose);
}

.ticker-sep {
  color: var(--rose);
  opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track {
    animation: none;
  }

  .ticker-viewport {
    overflow-x: auto;
  }
}

/* Ebene 0: Zweck-Tabs + Moodle-Schalter */
.zweck-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 22px;
}

.zweck-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(7, 46, 61, 0.68);
  color: var(--ink);
  padding: 10px 15px;
  cursor: pointer;
  box-shadow: var(--glow-pink);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

html[data-theme="light"] .chip {
  background: rgba(249, 249, 249, 0.82);
}

.chip:hover,
.chip:focus-visible {
  transform: translateY(-1px);
  border-color: var(--blue);
  box-shadow: 0 0 22px rgba(8, 224, 207, 0.22);
}

.chip.active {
  background: var(--rose);
  color: #031627;
  border-color: var(--rose);
  box-shadow: 0 0 24px rgba(255, 64, 128, 0.44);
  font-weight: 700;
}

.chip .count {
  opacity: 0.72;
  font-weight: 400;
  margin-left: 4px;
  font-size: 0.88em;
}

.moodle-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 10px 8px 16px;
  background: rgba(7, 46, 61, 0.68);
  box-shadow: var(--glow-pink);
}

html[data-theme="light"] .moodle-toggle {
  background: rgba(249, 249, 249, 0.82);
}

.moodle-toggle .label {
  font-weight: 700;
}

.moodle-toggle .count {
  color: var(--muted);
  font-size: 0.88em;
}

.switch {
  width: 52px;
  height: 30px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(3, 22, 39, 0.6);
  position: relative;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.switch:hover,
.switch:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 14px rgba(8, 224, 207, 0.28);
}

html[data-theme="light"] .switch {
  background: rgba(3, 22, 39, 0.14);
}

.switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: var(--r-md);
  background: var(--ink);
  transition: left 160ms ease, background 160ms ease;
}

.switch[aria-checked="true"] {
  background: var(--green);
  border-color: var(--blue);
  box-shadow: 0 0 18px rgba(8, 224, 207, 0.45);
}

.switch[aria-checked="true"] .knob {
  left: 25px;
  background: #031627;
}

/* Aktive Filter */
.active-filters {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
}

.active-filters.visible {
  display: flex;
}

.active-filters .label {
  color: var(--muted);
  font-size: 0.92rem;
}

.active-chip {
  min-height: 36px;
  border: 1px solid var(--blue);
  border-radius: var(--r-md);
  background: rgba(8, 224, 207, 0.12);
  color: var(--ink);
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.active-chip:hover,
.active-chip:focus-visible {
  border-color: var(--rose);
  background: rgba(255, 64, 128, 0.12);
  box-shadow: 0 0 14px rgba(255, 64, 128, 0.24);
}

.active-chip .x {
  font-weight: 800;
  color: var(--rose);
}

.active-chip.reset {
  border-color: var(--rose);
  background: rgba(255, 64, 128, 0.12);
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.filters-toggle {
  display: none;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 14px;
  box-shadow: var(--glow-pink);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.filters-toggle:hover,
.filters-toggle:focus-visible {
  border-color: var(--blue);
  background: rgba(8, 224, 207, 0.1);
  box-shadow: 0 0 18px rgba(8, 224, 207, 0.22);
}

.filters {
  position: sticky;
  top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background:
    linear-gradient(150deg, rgba(8, 224, 207, 0.1), transparent 42%),
    var(--surface);
  padding: 18px;
  box-shadow: var(--glow-pink), 0 0 28px rgba(8, 224, 207, 0.08);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.filters h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.filters .ebene-hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 10px;
}

.filter-group {
  border: none;
  border-top: 1px solid var(--line);
  padding: 14px 0 4px;
  margin: 12px 0 0;
}

.filter-group.first {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.filter-group legend {
  font-weight: 700;
  padding: 0;
  margin-bottom: 6px;
}

.filter-group label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
  padding: 7px 0;
  line-height: 1.35;
  cursor: pointer;
}

.filter-group label .count {
  margin-left: auto;
  font-size: 0.85em;
  opacity: 0.8;
  padding-left: 8px;
}

.filter-group input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  flex: 0 0 auto;
  cursor: pointer;
}

.filter-group.gated {
  border-top: none;
  border-left: 3px solid var(--yellow);
  background: rgba(246, 200, 59, 0.08);
  border-radius: var(--r-md);
  padding: 12px 12px 8px;
  margin-top: 14px;
}

.gated-note {
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
  margin: 0 0 6px;
}

.reset-btn {
  width: 100%;
  margin-top: 16px;
  min-height: 46px;
  border: 1px solid var(--rose);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.reset-btn:hover,
.reset-btn:focus-visible {
  background: rgba(255, 64, 128, 0.14);
  border-color: var(--blue);
  box-shadow: 0 0 16px rgba(255, 64, 128, 0.24);
}

.results-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.results-head h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  letter-spacing: 0;
}

.results-head p {
  color: var(--muted);
  margin: 8px 0 0;
}

.results-tools {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.pill.active {
  background: var(--rose);
  color: #031627;
  border-color: var(--rose);
  box-shadow: 0 0 22px rgba(255, 64, 128, 0.42);
  font-weight: 700;
}

.report-link {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.88rem;
}

.report-link a {
  color: var(--muted);
  text-underline-offset: 3px;
}

.report-link a:hover {
  color: var(--rose);
}

.sort {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.sort select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 0 12px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.sort select:hover {
  border-color: var(--blue);
  box-shadow: 0 0 12px rgba(8, 224, 207, 0.18);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.card {
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  background:
    linear-gradient(150deg, rgba(255, 64, 128, 0.1), transparent 32%),
    var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(8, 224, 207, 0.44), 0 0 34px rgba(255, 64, 128, 0.42), 0 0 54px rgba(8, 224, 207, 0.16);
}

.preview {
  height: 170px;
  border-bottom: 1px solid var(--edge);
  background: #031627;
  position: relative;
  padding: 16px;
  overflow: hidden;
}

.preview.has-image {
  padding: 0;
}

.preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 224, 207, 0.16) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 64, 128, 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.8;
  pointer-events: none;
}

.preview.has-image::before {
  display: none;
}

.mock-slide {
  position: relative;
  z-index: 1;
  height: 100%;
  border: 1px solid var(--blue);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, #031627, var(--paper));
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 0.7fr;
  gap: 10px;
  padding: 12px;
}

.mock-slide .line {
  height: 10px;
  border-radius: var(--r-sm);
  background: rgba(249, 249, 249, 0.2);
  margin-bottom: 10px;
}

.mock-slide .line:nth-child(1) {
  width: 72%;
  height: 18px;
  background: var(--blue);
  box-shadow: 0 0 12px rgba(8, 224, 207, 0.5);
}

.mock-slide .line:nth-child(2) {
  width: 94%;
}

.mock-slide .line:nth-child(3) {
  width: 64%;
}

.mock-art {
  border-radius: var(--r-md);
  background:
    linear-gradient(135deg, rgba(244, 185, 66, 0.9), rgba(45, 125, 90, 0.85)),
    var(--yellow);
  border: 1px solid rgba(249, 249, 249, 0.44);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.14);
}

.preview[data-kind="tool"] .mock-art {
  background: linear-gradient(135deg, var(--rose), var(--yellow));
}

.preview[data-kind="moodle"] .mock-art {
  background: linear-gradient(135deg, #f28c28, #155c7a);
}

.preview[data-kind="h5p"] .mock-art {
  background: linear-gradient(135deg, var(--violet), #78b7d0);
}

.format-tag {
  position: absolute;
  z-index: 2;
  left: 12px;
  bottom: 10px;
  background: rgba(3, 22, 39, 0.86);
  color: var(--blue);
  border: 1px solid var(--blue);
  border-radius: var(--r-pill);
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

/* Werkzeuge auf der Kartenvorschau: Like + Merken */
.card-tools {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}

.like-btn,
.merk-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  min-width: 36px;
  justify-content: center;
  padding: 4px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(3, 22, 39, 0.78);
  color: #f9f9f9;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
}

.like-btn:hover,
.like-btn:focus-visible {
  border-color: var(--rose);
  box-shadow: 0 0 14px rgba(255, 64, 128, 0.35);
}

.merk-btn:hover,
.merk-btn:focus-visible {
  border-color: var(--yellow);
  box-shadow: 0 0 14px rgba(246, 200, 59, 0.35);
}

.like-btn.liked {
  color: var(--rose);
  border-color: var(--rose);
  box-shadow: 0 0 14px rgba(255, 64, 128, 0.45);
}

.merk-btn.marked {
  color: var(--yellow);
  border-color: var(--yellow);
  box-shadow: 0 0 14px rgba(246, 200, 59, 0.4);
}

.like-count:empty {
  display: none;
}

.drawer-like.liked {
  color: var(--rose);
  border-color: var(--rose);
}

.drawer-merk.marked {
  color: var(--yellow);
  border-color: var(--yellow);
}

/* Herzchen-Belohnung */
.heart-particle {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  color: var(--rose);
  text-shadow: 0 0 10px rgba(255, 64, 128, 0.8);
  animation: heart-rise 900ms ease-out forwards;
}

@keyframes heart-rise {
  from {
    opacity: 1;
    transform: translate(0, 0) scale(0.7);
  }
  to {
    opacity: 0;
    transform: translate(var(--dx, 0), -110px) scale(1.7);
  }
}

.mini-dots {
  position: absolute;
  z-index: 2;
  right: 14px;
  bottom: 12px;
  display: flex;
  gap: 6px;
}

.mini-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--blue);
  background: rgba(3, 22, 39, 0.7);
  padding: 0;
  cursor: pointer;
}

.mini-dot.active {
  background: var(--rose);
  box-shadow: 0 0 10px rgba(255, 64, 128, 0.72);
}

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  border-radius: var(--r-pill);
  background: rgba(8, 224, 207, 0.12);
  color: var(--blue);
  padding: 5px 9px;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge.license {
  background: rgba(246, 200, 59, 0.14);
  color: var(--yellow);
}

html[data-theme="light"] .badge {
  background: rgba(1, 151, 152, 0.12);
  color: var(--green);
}

html[data-theme="light"] .badge.license {
  background: rgba(246, 200, 59, 0.28);
  color: #7a5c00;
}

.badge.new {
  background: var(--yellow);
  color: #031627;
}

html[data-theme="light"] .badge.new {
  background: var(--yellow);
  color: #031627;
}

.badge.moodle {
  background: rgba(255, 64, 128, 0.14);
  color: var(--rose);
}

html[data-theme="light"] .badge.moodle {
  background: rgba(255, 64, 128, 0.14);
  color: #b00043;
}

.card h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.card .updated {
  color: var(--muted);
  font-size: 0.84rem;
}

.card-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.card-actions a,
.card-actions button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.card-actions a:not(.primary):hover,
.card-actions a:not(.primary):focus-visible,
.card-actions button:hover,
.card-actions button:focus-visible {
  border-color: var(--blue);
  background: rgba(8, 224, 207, 0.12);
  box-shadow: 0 0 18px rgba(8, 224, 207, 0.22);
  transform: translateY(-1px);
}

.card-actions a.primary {
  background: var(--rose);
  color: #031627;
  border-color: var(--rose);
  box-shadow: 0 0 18px rgba(255, 64, 128, 0.36);
}

.card-actions a.primary:hover,
.card-actions a.primary:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 26px rgba(255, 64, 128, 0.52), 0 0 14px rgba(8, 224, 207, 0.28);
  transform: translateY(-1px);
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(500px, 100%);
  background:
    linear-gradient(150deg, rgba(255, 64, 128, 0.14), transparent 36%),
    linear-gradient(210deg, rgba(8, 224, 207, 0.12), transparent 48%),
    var(--surface-strong);
  border-left: 1px solid var(--edge);
  box-shadow: -24px 0 60px rgba(3, 22, 39, 0.62), 0 0 34px rgba(255, 64, 128, 0.22);
  transform: translateX(105%);
  transition: transform 220ms ease;
  z-index: 20;
  padding: 22px;
  overflow-y: auto;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 22, 39, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 19;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.drawer h2 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.drawer-close {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.4rem;
  flex: 0 0 auto;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.drawer-close:hover,
.drawer-close:focus-visible {
  border-color: var(--blue);
  background: rgba(8, 224, 207, 0.12);
  box-shadow: 0 0 14px rgba(8, 224, 207, 0.22);
}

.drawer-preview {
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  background: #031627;
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: var(--glow-pink);
}

.drawer-preview img {
  width: 100%;
  display: block;
}

.drawer-preview .placeholder {
  min-height: 150px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 64, 128, 0.4), rgba(8, 224, 207, 0.2)),
    repeating-linear-gradient(90deg, rgba(246, 200, 59, 0.18) 0 2px, transparent 2px 20px),
    #031627;
  font-weight: 800;
  color: #f9f9f9;
  text-align: center;
  padding: 20px;
}

.drawer .summary {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 16px;
}

.facts {
  display: grid;
  gap: 10px;
}

.fact {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
}

.fact strong {
  color: var(--muted);
  font-weight: 700;
}

.facts h3 {
  margin: 16px 0 0;
  font-size: 1rem;
  color: var(--yellow);
}

.drawer-links {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.drawer-links h3 {
  margin: 0 0 2px;
  font-size: 1rem;
  color: var(--yellow);
}

.drawer-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.drawer-links a:hover,
.drawer-links a:focus-visible {
  border-color: var(--blue);
  background: rgba(8, 224, 207, 0.1);
  box-shadow: 0 0 14px rgba(8, 224, 207, 0.2);
}

.drawer-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.drawer-actions a {
  min-height: 48px;
  border: 1px solid var(--yellow);
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  text-decoration: none;
  font-weight: 800;
  background: var(--yellow);
  color: #031627;
  box-shadow: 0 0 20px rgba(246, 200, 59, 0.36);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.drawer-actions a:hover,
.drawer-actions a:focus-visible {
  border-color: var(--blue);
  background: #f8d44a;
  box-shadow: 0 0 24px rgba(246, 200, 59, 0.48), 0 0 12px rgba(8, 224, 207, 0.24);
  transform: translateY(-1px);
}

.drawer-actions .share-btn {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.drawer-actions .share-btn:hover,
.drawer-actions .share-btn:focus-visible {
  border-color: var(--blue);
  background: rgba(8, 224, 207, 0.1);
  box-shadow: 0 0 14px rgba(8, 224, 207, 0.2);
}

.support-link {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(8, 224, 207, 0.08);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  line-height: 1.35;
  box-shadow: var(--glow-pink);
}

.support-link a {
  color: var(--blue);
  font-weight: 800;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  white-space: nowrap;
}

html[data-theme="light"] .drawer {
  background:
    linear-gradient(150deg, rgba(255, 64, 128, 0.1), transparent 36%),
    linear-gradient(210deg, rgba(8, 224, 207, 0.1), transparent 48%),
    var(--surface-strong);
  box-shadow: -24px 0 60px rgba(3, 22, 39, 0.18), 0 0 28px rgba(1, 151, 152, 0.12);
}

.empty-note {
  display: none;
  border: 2px dashed var(--line);
  border-radius: var(--r-md);
  padding: 24px;
  background: var(--surface);
  color: var(--muted);
  line-height: 1.5;
  box-shadow: var(--glow-pink);
}

.empty-note.visible {
  display: block;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 40px 20px 30px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

@media (max-width: 1120px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .filters-toggle {
    display: block;
  }

  .filters {
    display: none;
    position: static;
    max-height: none;
  }

  .filters.open {
    display: block;
    margin-bottom: 16px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 14px;
  }

  .topbar,
  .results-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .hero-main {
    min-height: auto;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .zweck-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .moodle-toggle {
    justify-content: space-between;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .fact {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .support-link {
    align-items: flex-start;
    flex-direction: column;
  }
}
