:root {
  --feed-bg: #f7f7f5;
  --feed-surface: #ffffff;
  --feed-text: #111111;
  --feed-text-soft: rgba(0, 0, 0, 0.72);
  --feed-overlay-bg: rgba(0, 0, 0, 0.45);
  --feed-overlay-bg-hover: rgba(0, 0, 0, 0.65);
}

@media (prefers-color-scheme: dark) {
  :root {
    --feed-bg: #000000;
    --feed-surface: #000000;
    --feed-text: #ffffff;
    --feed-text-soft: rgba(255, 255, 255, 0.92);
    --feed-overlay-bg: rgba(0, 0, 0, 0.45);
    --feed-overlay-bg-hover: rgba(0, 0, 0, 0.65);
  }
}


/* =============================================
   FEED
   Bild-, Reel- und Longvideo-Ansicht
   ============================================= */

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--feed-bg);
  color: var(--feed-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.feed-page {
  background: var(--feed-bg);
  color: var(--feed-text);
}

/* =============================================
   GRUNDSTRUKTUR
   ============================================= */

#feed {
  width: 100%;
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-y: contain;
}
  
.feed-entry {
  width: 100%;
  box-sizing: border-box;
  min-height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

#feed-empty {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--feed-bg);
  color: var(--feed-text);
  font-size: 1rem;
}

#feed-end {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 1000;
  display: none;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
  pointer-events: none;
}

/* =============================================
   TOAST
   ============================================= */

.feed-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.feed-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* =============================================
   BUTTONS
   ============================================= */

.feed-back-button,
.feed-share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 999px;
  background: var(--feed-overlay-bg);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.feed-back-button:hover,
.feed-share-button:hover {
  background: var(--feed-overlay-bg-hover);
}

.feed-back-button:active,
.feed-share-button:active {
  transform: scale(0.96);
}

.feed-back-button i,
.feed-share-button i {
  font-size: 20px;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

.feed-inline-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.feed-back-button--overlay,
.feed-share-button--overlay {
  position: absolute;
  z-index: 20;
}

/* =============================================
   TYPOGRAFIE
   ============================================= */

.feed-title {
  margin: 0 0 14px;
  font-size: 1.25rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--feed-text);
}

.feed-caption {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--feed-text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

/* =============================================
   BILDER
   Mobil: Caption unter dem Bild
   Desktop: Caption rechts daneben
   ============================================= */

.feed-entry--image {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 48px;
  background: var(--feed-bg);
  box-sizing: border-box;
}

.feed-image-layout {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}

.feed-image-media {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--feed-surface);
  overflow: hidden;
}

.feed-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: transparent;
}

.feed-image-meta {
  width: 100%;
  max-width: 760px;
}

/* =============================================
   LONGVIDEOS
   ============================================= */

.feed-entry--longvideo {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 48px;
  background: var(--feed-bg);
  box-sizing: border-box;
}

.feed-longvideo-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feed-longvideo-player {
  display: block;
  width: 100%;
  max-width: 800px;
  background: #000;
  aspect-ratio: 16 / 9;
  height: auto;
}

.feed-longvideo-meta {
  width: 100%;
  max-width: 800px;
  margin-top: 18px;
}

/* =============================================
   REELS
   Vollbildartige Sektionen
   ============================================= */

.feed-page--reel,
.feed-page--reel body {
  background: #000;
}

.feed-page--reel #feed {
  scroll-snap-type: y mandatory;
}

.feed-entry--reel {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  padding: 0;
  margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #000;
  overflow: hidden;
}

.feed-entry--reel,
.feed-entry--longvideo,
.feed-entry--image {
  min-height: 100svh;
}

.reel-stage {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

.reel-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 35%;
  pointer-events: none;
  z-index: 10;

  background: linear-gradient(
    to top,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.35) 35%,
    rgba(0,0,0,0.15) 60%,
    rgba(0,0,0,0) 100%
  );
}

.reel-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.reel-sound-indicator {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: 25;
  width: 60px;
  height: 60px;
  font-size: 1.5rem;
  border-radius: 50%;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.reel-sound-indicator i {
  transform: scale(0.8);
}

.reel-sound-indicator.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.08);
}

.reel-overlay-controls {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(32px + env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.reel-overlay-controls .feed-back-button,
.reel-overlay-controls .feed-share-button {
  pointer-events: auto;
}

.feed-back-button--overlay,
.feed-share-button--overlay {
  position: static;
}

/* =============================================
   DESKTOP-ANPASSUNGEN
   ============================================= */

@media (min-width: 900px) {
  .feed-entry--image {
    padding: 40px 32px 56px;
  }

  .feed-image-layout {
    display: grid;
    grid-template-columns: minmax(0, 760px) 320px;
    align-items: start;
    justify-content: center;
    gap: 36px;
  }
  
  .feed-image-meta {
    width: 320px;
    max-width: 320px;
  }

  .feed-entry--longvideo {
    padding: 40px 32px 56px;
  }

  .feed-longvideo-meta {
    margin-top: 22px;
  }

  .feed-title {
    font-size: 1.4rem;
  }

  .feed-caption {
    font-size: 1.02rem;
  }
}

/* =============================================
   MOBILE-FEINHEITEN
   ============================================= */

@media (max-width: 768px) {
  #feed-end {
    bottom: 14px;
    padding: 9px 14px;
    font-size: 13px;
  }

  .feed-toast:not(.feed-toast--sound) {
    bottom: 72px;
    font-size: 13px;
    padding: 9px 14px;
  }

  .feed-entry--image,
  .feed-entry--longvideo {
    padding: 20px 14px 40px;
  }

  .feed-title {
    font-size: 1.08rem;
    margin-bottom: 10px;
  }

  .feed-caption {
    font-size: 0.96rem;
    line-height: 1.55;
  }

  .feed-inline-controls {
    margin-top: 16px;
    gap: 10px;
  }

  .feed-back-button,
  .feed-share-button {
    width: 48px;
    height: 48px;
  }

  .reel-overlay-controls {
    left: 12px;
    right: 12px;
    bottom: calc(28px + env(safe-area-inset-bottom));
  }
}

/* =============================================
   SEHR KLEINE GERÄTE
   ============================================= */

@media (max-width: 420px) {
  .feed-entry--image,
  .feed-entry--longvideo {
    padding-left: 10px;
    padding-right: 10px;
  }

  .feed-caption {
    font-size: 0.93rem;
  }
}