/**
 * Home-Feed: Stories-Streifen + vertikales Reel-Scrollen (TikTok-ähnlich).
 */

#ansicht-home {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #000;
  position: relative;
  /** Stories-Streifen unten: Höhe für Reel-Text-Abstand */
  --home-story-streifen-hoehe: clamp(88px, 22vmin, 118px);
  --home-story-ring-groesse: clamp(48px, 13vmin, 68px);
  --home-story-bubble-breite: clamp(54px, 15vmin, 76px);
  --home-story-streifen-luecke: clamp(8px, 2.4vw, 14px);
  --home-story-titel-schrift: clamp(10px, 2.75vw, 13px);
  --home-story-name-schrift: clamp(9px, 2.45vw, 12px);
}

#ansicht-home .home-feed-huelle {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/** Rechts oben: Glaspille (Anzeigename) + Profil-Glaskreis — Material wie #home-kopf-menue */
#ansicht-home .home-kopf-nutzer-leiste {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  inset-inline-end: max(12px, env(safe-area-inset-right, 0px));
  z-index: 10;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: min(58vw, 300px);
  pointer-events: auto;
}

#ansicht-home .home-kopf-nutzer-name {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  padding: 10px 14px;
  margin: 0;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.2;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  text-align: end;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#ansicht-home .home-kopf-profil-knopf {
  flex-shrink: 0;
  position: relative;
}

#ansicht-home .home-kopf-profil-knopf .home-kopf-profil-punkt {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live, #3ddc84);
  box-shadow: 0 0 0 2px rgba(5, 5, 5, 0.85);
  pointer-events: none;
}

#ansicht-home .home-kopf-profil-knopf.home-kopf-profil-knopf--getrennt .home-kopf-profil-punkt {
  background: rgba(120, 120, 120, 0.9);
}

#home-kopf-menue {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  z-index: 10;
  pointer-events: auto;
}

/** Story-Streifen unten: Icons oben, Beschriftung „Stories“ darunter */
.home-story-streifen-wrap {
  position: absolute;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(4px, 1vmin, 8px);
  padding: 10px max(12px, env(safe-area-inset-right, 0px))
    max(8px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.45) 55%, transparent 100%);
  pointer-events: none;
}

.home-story-streifen-wrap * {
  pointer-events: auto;
}

.home-story-streifen {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--home-story-streifen-luecke);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  order: 1;
}

.home-story-streifen::-webkit-scrollbar {
  display: none;
}

.home-story-streifen-titel {
  order: 2;
  font-size: var(--home-story-titel-schrift);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
  padding: 0 6px;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.2;
}

.home-story-bubble {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 1vmin, 6px);
  width: var(--home-story-bubble-breite);
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.home-story-ring {
  width: var(--home-story-ring-groesse);
  height: var(--home-story-ring-groesse);
  border-radius: 50%;
  padding: clamp(2px, 0.55vmin, 3px);
  background: linear-gradient(135deg, #ff2d55, #ff8a00, #ff2d55);
  box-sizing: border-box;
  flex-shrink: 0;
}

.home-story-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: clamp(1.5px, 0.4vmin, 2px) solid #000;
  overflow: hidden;
  background: #1a1f2e;
}

.home-story-ring-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-story-ring-inner video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-story-bubble-name {
  font-size: var(--home-story-name-schrift);
  max-width: var(--home-story-bubble-breite);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.9;
  line-height: 1.15;
}

@media (min-width: 600px) {
  #ansicht-home {
    --home-story-ring-groesse: clamp(54px, 10vmin, 72px);
    --home-story-bubble-breite: clamp(60px, 11vmin, 80px);
    --home-story-streifen-hoehe: clamp(96px, 18vmin, 124px);
  }
}

@media (min-width: 1024px) {
  #ansicht-home {
    --home-story-ring-groesse: clamp(58px, 8vmin, 76px);
    --home-story-bubble-breite: clamp(64px, 9vmin, 84px);
    --home-story-streifen-hoehe: clamp(100px, 14vmin, 128px);
    --home-story-streifen-luecke: clamp(10px, 1.4vw, 18px);
  }
}

.home-feed-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.home-feed-scroll::-webkit-scrollbar {
  display: none;
}

.home-feed-karte {
  position: relative;
  width: 100%;
  min-height: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #0a0a0f;
}

.home-feed-karte-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #0a0a0f;
  z-index: 0;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.home-feed-karte-bild {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #0a0a0f;
  z-index: 0;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.home-reel-ton-knopf {
  position: absolute;
  top: max(52px, calc(env(safe-area-inset-top) + 40px));
  right: max(12px, env(safe-area-inset-right));
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--glas-chrome-kreis, rgba(255, 255, 255, 0.14));
  backdrop-filter: var(--glas-chrome-unschaerfe, blur(12px));
  -webkit-backdrop-filter: var(--glas-chrome-unschaerfe, blur(12px));
  color: #fff;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--glas-chrome-schatten, 0 2px 14px rgba(0, 0, 0, 0.16));
  -webkit-tap-highlight-color: transparent;
}

.home-reel-ton-knopf:active {
  transform: scale(0.96);
}

.home-feed-karte-verlauf {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.15) 0%,
    rgba(0, 0, 0, 0.05) 35%,
    rgba(0, 0, 0, 0.55) 72%,
    rgba(0, 0, 0, 0.88) 100%
  );
  pointer-events: none;
}

.home-feed-karte-inhalt {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 14px calc(var(--home-story-streifen-hoehe, 100px) + 20px) 18px;
  box-sizing: border-box;
  pointer-events: none;
}

.home-feed-karte-inhalt > * {
  pointer-events: auto;
}

.home-feed-text-spalte {
  flex: 1;
  min-width: 0;
  padding-right: 12px;
}

.home-feed-thema {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 45, 85, 0.75);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  text-shadow: none;
}

.home-feed-nutzer {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.home-feed-beschreibung {
  font-size: 14px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-feed-musik {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  align-items: center;
  gap: 6px;
}

.home-feed-aktionen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.home-feed-aktion-knopf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  min-width: 48px;
}

.home-feed-aktion-symbol {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
}

.home-feed-aktion-knopf:active .home-feed-aktion-symbol {
  transform: scale(0.94);
}

/* Schwebender +-Knopf: stets sichtbar (auch bei Vollbild-Video), Steuerung über mobil-huelle.js */
#inhalt-schwebe-erstellen {
  position: fixed;
  z-index: 45;
  left: 50%;
  right: auto;
  bottom: calc(62px + env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(135deg, var(--navigation-fab-start), var(--navigation-fab-ende));
  color: #fff;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(255, 60, 130, 0.45);
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
  transform: translateX(-50%);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

#inhalt-schwebe-erstellen:active {
  transform: translateX(-50%) scale(0.94);
}

#inhalt-schwebe-erstellen:focus-visible {
  outline: 2px solid var(--kontur-fokus-akzent);
  outline-offset: 2px;
}

#inhalt-schwebe-erstellen[hidden] {
  display: none !important;
}

#app-huelle.schwebe-erstellen-aus #inhalt-schwebe-erstellen {
  display: none !important;
}
