.tdg-gallery {
    /* ---- Zentrale Stellschrauben — lassen sich in WordPress unter
       Design → Customizer → Zusätzliches CSS überschreiben, ohne dass du
       den Widget-Code anfassen musst. Beispiel dort:
         .tdg-gallery { --gallery-bg: #111; --gallery-ink: #eee;
                         }
       ---- */
    --gallery-bg: #efeee8;
    --gallery-ink: #141414;
    --pill-bg: rgba(239, 238, 232, 0.7);
    --pill-border: rgba(20, 20, 20, 0.25);
    position: relative;
    width: 100%;
    height: var(--tdg-height, 100vh);
    background: var(--gallery-bg);
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  }
  .tdg-gallery.dragging { cursor: grabbing; }
  .tdg-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }


  /* Beitrags-Infos, erscheinen neben dem fokussierten Beitrag */
  .tdg-info {
    position: absolute;
    z-index: 4;
    width: min(300px, 42vw);
    opacity: 0;
    pointer-events: none;
    color: var(--gallery-ink);
    transform: translateY(6px);
    transition: opacity 0.28s ease, transform 0.28s ease;
  }
  .tdg-info.visible { opacity: 1; transform: translateY(0); }

  .tdg-info-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 4px;
  }
  .tdg-info-meta {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.55;
    margin-bottom: 8px;
  }
  .tdg-info-text {
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.8;
  }
  .tdg-info-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 10px;
  }
  .thumb-slot {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 2px;
    flex: 0 0 auto;
    display: block;
  }
  /* Ladeanzeige: dezent pulsierende Fläche, solange das Bild noch kommt */
  .thumb-slot.loading {
    background: rgba(20, 20, 20, 0.07);
    animation: thumbPulse 1.1s ease-in-out infinite;
  }
  .thumb-slot.loading::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 14px; height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid rgba(20, 20, 20, 0.18);
    border-top-color: rgba(20, 20, 20, 0.55);
    border-radius: 50%;
    animation: thumbSpin 0.7s linear infinite;
  }
  @keyframes thumbSpin { to { transform: rotate(360deg); } }
  @keyframes thumbPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

  .tdg-info-thumbs img {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.4s ease;
    display: block;
  }
  .tdg-info-thumbs img.loaded { opacity: 0.9; }

  /* Steuerungs-Legende unten: so klein und knapp wie möglich, mit Symbolen */
  .tdg-controls {
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 18px;
    z-index: 3;
    color: var(--gallery-ink);
    opacity: 0.45;
    pointer-events: none;
    transition: opacity 0.5s ease;
    font-size: 11px;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }
  .tdg-controls .ctrl { display: flex; align-items: center; gap: 6px; }
  .tdg-controls svg { width: 15px; height: 15px; flex: 0 0 auto; }
  @media (max-width: 640px) {
    .tdg-controls { gap: 12px; font-size: 10px; bottom: 14px; }
    .tdg-controls svg { width: 13px; height: 13px; }
  }


  .tdg-filters {
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    z-index: 3;
  }
  .filter-pill {
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 0.03em;
    padding: 7px 14px;
    border-radius: 100px;
    border: 1px solid var(--pill-border);
    background: var(--pill-bg);
    -webkit-backdrop-filter: blur(6px); /* Safari */
    backdrop-filter: blur(6px);
    color: var(--gallery-ink);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  }
  .filter-pill:hover { border-color: rgba(20,20,20,0.5); }
  .filter-pill.active { background: #141414; color: #efeee8; border-color: #141414; }

  /* Responsive: Tablet */
  @media (max-width: 1024px) {
    .tdg-filters { top: 16px; left: 16px; right: 16px; gap: 6px; }
    .filter-pill { font-size: 11px; padding: 6px 12px; }
  }
  /* Responsive: Mobile */
  @media (max-width: 640px) {
    .tdg-filters {
      top: 10px; left: 0; right: 0;
      gap: 5px;
      padding: 0 10px;
      /* Bei vielen Kategorien horizontal scrollen statt umbrechen —
         sonst frisst die Filterleiste den halben Bildschirm. */
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .tdg-filters::-webkit-scrollbar { display: none; }
    .filter-pill { font-size: 11px; padding: 6px 12px; flex: 0 0 auto; }

    /* Info-Panel wird auf dem Handy zur festen Leiste unten angedockt.
       Frei neben dem Finger schwebend wäre es halb verdeckt und würde
       über den Bildrand hinauslaufen. */
    .tdg-info {
      left: 10px;
      right: 10px;
      bottom: 44px;
      top: auto;
      width: auto;
      padding: 12px 14px;
      border-radius: 10px;
      background: var(--gallery-bg);
      background: color-mix(in srgb, var(--gallery-bg) 88%, transparent);
      -webkit-backdrop-filter: blur(8px);
      backdrop-filter: blur(8px);
      box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
      transform: translateY(10px);
    }
    .tdg-info.visible { transform: translateY(0); }
    .tdg-info-title { font-size: 14px; }
    .tdg-info-text {
      font-size: 11px;
      /* auf zwei Zeilen begrenzen, damit die Leiste flach bleibt */
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .tdg-info-thumbs { margin-top: 8px; }
    .tdg-info-thumbs img,
    .thumb-slot { width: 44px; height: 44px; }
  }

  /* Sehr flache Fenster (Handy quer): Panel kompakter halten */
  @media (max-height: 480px) {
    .tdg-info-text { display: none; }
    .tdg-controls { bottom: 8px; }
  }

  @media (prefers-reduced-motion: reduce) {
    /* Legende bleibt sichtbar — sie erklärt die Bedienung. Nur die
       Lade-Animationen werden ruhiggestellt. */
    .tdg-controls { transition: none; }
    .thumb-slot.loading,
    .thumb-slot.loading::after { animation: none; }
  }
