/* ============================================================
   For You — vertical video feed (app/index.html)
   Mobile: full-viewport snap-scroll. Desktop: centered viewer
   with contest / top-entries rails on the sides.

   Bottom clearance: --feed-bottom keeps the info overlay and
   the action rail above the fixed bottom navigation on mobile
   (dynamic viewport + safe-area aware).
   ============================================================ */

.feed-stage { position: relative; }
.feed-rail { display: none; }

.feed {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.slide {
  --feed-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px);
  position: relative;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #050403;
}
.slide-media { position: absolute; inset: 0; }
.slide-ken {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.03);
  animation: ken 26s ease-in-out infinite alternate;
}
@keyframes ken { to { transform: scale(1.12) translateY(-1.5%); } }
.slide-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.slide.is-active .slide-video { opacity: 1; }

/* readability overlay — present but restrained */
.slide-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(5, 4, 3, 0.45) 0%,
    rgba(5, 4, 3, 0) 18%,
    rgba(5, 4, 3, 0) 58%,
    rgba(5, 4, 3, 0.72) 100%);
  pointer-events: none;
}

/* top overlay — discreet For You label + tiny contest link */
.slide-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 0;
}
.feed-foru {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 239, 230, 0.9);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}
.feed-foru::after {
  content: "";
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--gold);
}
.feed-contest-link {
  padding: 5px;
  margin: -5px;
  min-width: 44px; min-height: 44px;
  width: auto; height: auto;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 8, 5, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(244, 239, 230, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.feed-contest-link:hover { border-color: rgba(244, 176, 33, 0.5); color: var(--gold); }
.feed-contest-link svg { width: 16px; height: 16px; }

.slide-top-side { display: inline-flex; align-items: center; gap: 10px; }

/* feed sound toggle — subtle, readable on light and dark video */
.feed-sound {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 8, 5, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(244, 239, 230, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.feed-sound svg { width: 20px; height: 20px; }
.feed-sound:hover { border-color: rgba(255, 255, 255, 0.38); color: #fff; }
.feed-sound:active { transform: scale(0.94); }
.feed-sound.on { background: rgba(12, 8, 5, 0.64); color: #fff; border-color: rgba(255, 255, 255, 0.24); }

/* bottom info — participant, city, title, description, subtle stats */
.slide-info {
  position: absolute;
  left: 16px;
  right: 78px;
  bottom: var(--feed-bottom);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.slide-participant {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
}
.slide-participant img {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(244, 176, 33, 0.55);
  flex: none;
  object-fit: cover;
}
.slide-p-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.slide-p-city {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: rgba(244, 239, 230, 0.68);
}
.slide-title {
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.slide-desc {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(244, 239, 230, 0.8);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* hostile/long input robustness (stage #023 §10): no-spaces word
     sequences wrap instead of overflowing horizontally */
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}
/* expanded: full text but BOUNDED — never covers the whole video or
   the action rail; long text scrolls inside the block */
.slide-info.expanded .slide-desc {
  display: block;
  -webkit-line-clamp: unset;
  max-height: 30dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.slide-more {
  display: inline-block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  -webkit-tap-highlight-color: transparent;
}
.slide-stats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(244, 239, 230, 0.62);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}
.slide-stats svg { width: 11px; height: 11px; color: var(--gold); }
.slide-stats .rank { color: rgba(244, 239, 230, 0.72); }

/* right action rail — Vote, Share, profile */
.slide-actions {
  position: absolute;
  right: 10px;
  bottom: var(--feed-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; }
.act-circle {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(12, 8, 5, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s, border-color 0.2s, background 0.2s, color 0.2s;
}
.act-circle svg { width: 21px; height: 21px; }
.act:active .act-circle { transform: scale(0.9); }
.act.vote.on .act-circle { background: rgba(244, 176, 33, 0.16); border-color: rgba(244, 176, 33, 0.7); color: var(--gold); }
.act.vote.on svg { fill: var(--gold); }
.act.vote.pop .act-circle { animation: heart-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
@keyframes heart-pop { 40% { transform: scale(1.18); } }
.act-count, .act-label { font-size: 12px; font-weight: 700; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }
.act-profile { margin-top: 2px; padding: 3px; margin-right: -3px; margin-bottom: -3px; }
.act-profile img {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(244, 176, 33, 0.6);
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

/* skeleton slides */
.skeleton-slide {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 78px calc(var(--nav-h) + env(safe-area-inset-bottom) + 34px) 16px;
}
.sk-media { position: absolute; inset: 0; border-radius: 0; }
.sk-av { width: 40px; height: 40px; border-radius: 50%; }
.sk-title { width: 70%; height: 17px; }
.sk-sub { width: 90%; height: 12px; }
.sk-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  position: absolute;
  right: 10px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 34px);
}

/* ---------- desktop rails ---------- */
.rail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rail-head .more { font-size: 13px; font-weight: 700; color: var(--gold); }
.rail-title { margin-top: 10px; }
.rail-prize { font-size: 30px; font-weight: 900; letter-spacing: -0.01em; color: var(--gold); margin-top: 12px; }
.rail-prize span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }
.rail-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.rail-facts > div {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 8px;
  text-align: center;
  display: flex; flex-direction: column; gap: 2px;
}
.rail-facts b { font-size: 14.5px; font-weight: 800; }
.rail-facts span { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.rail-list { display: flex; flex-direction: column; gap: 2px; }
.rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--r-sm);
  transition: background 0.2s;
}
.rail-item:hover { background: rgba(255, 255, 255, 0.05); }
.rail-item img { width: 34px; height: 34px; border-radius: 50%; }
.rail-rank {
  width: 22px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
  flex: none;
}
.rail-rank-top { color: var(--gold); }
.rail-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; }
.rail-votes { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--muted); }
.rail-votes svg { width: 12px; height: 12px; color: var(--gold); }

/* ---------- desktop layout ----------
   #017B recomposition: the feed is the emotional centre; the two
   rails are related support modules — same card grammar, aligned
   on the stage's vertical axis, no accidental dead bands. */
@media (min-width: 1024px) {
  .slide { --feed-bottom: 26px; }
  .slide-top { padding: 16px 18px 0; }
  .feed-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(400px, 470px) minmax(0, 1fr);
    gap: 28px;
    height: calc(100dvh - var(--topbar-h));
    padding: 14px 36px 18px;
    max-width: 1680px;
    margin: 0 auto;
    /* rails top-align with the stage so no dead band sits above them */
    align-items: start;
  }
  .feed {
    height: 100%;
    max-height: calc(100dvh - var(--topbar-h) - 32px);
    border-radius: var(--r-lg);
    border: 1px solid rgba(244, 176, 33, 0.22);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), 0 0 60px rgba(244, 176, 33, 0.08);
  }
  .slide { height: 100%; border-radius: var(--r-lg); }
  .feed-rail { display: flex; flex-direction: column; gap: 14px; justify-content: center; min-width: 0; }
  .rail-card { padding: 20px 22px; }
  .rail-more {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--muted);
    transition: color 0.2s;
  }
  .rail-more svg { width: 13px; height: 13px; color: var(--gold); }
  .rail-more:hover { color: var(--txt); }
}
