.suggestions-grid {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.media-section {
  position: relative;
  timeline-scope: --media-scroll;
}

posters-row,
.poster-grid {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
}

posters-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  touch-action: pan-x;
  padding-right: 32px;
  scroll-timeline: --media-scroll inline;
}

posters-row::-webkit-scrollbar {
  display: none;
}

.row-item {
  flex-shrink: 0;
  width: calc((min(100vw, 680px) - 68px) / 2.6);
}

.row-item .item-card {
  width: 100%;
  aspect-ratio: 2/3;
  height: auto;
}

.add-more-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  aspect-ratio: 2/3;
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.add-more-card:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(34, 197, 94, 0.08);
}

.add-more-plus {
  font-size: 2.4rem;
  font-weight: 300;
  line-height: 1;
}

.add-more-label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.poster-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--rows, 2), auto);
  grid-auto-columns: calc((min(100vw, 680px) - 68px) / 2.6);
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  touch-action: pan-x;
  scroll-snap-type: x mandatory;
  padding-right: 64px;
  align-content: start;
}

.poster-grid::-webkit-scrollbar {
  display: none;
}

.poster-grid .row-item {
  width: 100%;
  height: auto;
  scroll-snap-align: start;
}

.poster-grid .row-item .item-card {
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
}

@media (max-width: 680px) {
  .suggestions-grid {
    flex: 1;
    min-height: 0;
    height: auto;
    gap: 10px;
  }

  .media-section {
    flex: 1;
    min-height: 0;
    overflow: clip;
  }

  posters-row {
    height: 100%;
  }

  .row-item {
    height: 100%;
    width: auto;
  }

  .row-item .item-card {
    width: auto;
    height: 100%;
    aspect-ratio: 2/3;
  }

  #tvRow .row-item,
  #movieRow .row-item,
  #trendingGrid .row-item {
    flex-shrink: 0;
    width: max(140px, calc((100vw - 44px) / 2.6));
    height: 100%;
  }

  #tvRow .row-item .item-card,
  #movieRow .row-item .item-card,
  #trendingGrid .row-item .item-card {
    width: 100%;
    height: 100%;
  }
}

@media (hover: hover) and (pointer: fine) {
  .item-card .trending-badge {
    opacity: 0;
  }

  .item-card:hover .trending-badge {
    opacity: 1;
  }
}

/* Trending period badge (posters in Next and AI views).
   Visual weight climbs with period length: today (subtle) < week < month (boldest). */
.trending-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #fff;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 999px;
  align-self: flex-start;
  margin-top: 2px;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.15s;
}

.trending-badge--today {
  background: rgba(120, 113, 108, 0.55);
  font-size: 0.55rem;
  font-weight: 500;
}

.trending-badge--week {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.78), rgba(217, 119, 6, 0.78));
  font-size: 0.6rem;
  font-weight: 700;
}

.trending-badge--month {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(217, 70, 239, 0.95));
  font-size: 0.65rem;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.45);
}

.item-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  background: #0b1220;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease, opacity 0.45s ease;
  touch-action: pan-x;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  transform: translateY(0);
  will-change: transform, box-shadow, filter;
  user-select: none;
  -webkit-user-select: none;
}
.item-card {
  --hover-accent: #e879c6;
}
.item-card[data-type="movie"] {
  --hover-accent: var(--accent);
}
.item-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--hover-accent) 55%, white 45%),
    inset 0 0 0 3px color-mix(in srgb, var(--hover-accent) 18%, transparent);
  transition: opacity 0.22s ease;
}
@media (hover: hover) and (pointer: fine) {
  .item-card:hover {
    box-shadow: 0 18px 36px rgba(0,0,0,0.42);
    filter: brightness(1.03);
    z-index: 2;
  }
  .item-card:hover::after { opacity: 1; }
  .item-card:hover .poster-status { opacity: 1; }
}

.poster-episode.one-left {
  font-weight: 700;
  color: #fff;
  opacity: 1;
  text-shadow:
    0 0 6px rgba(232, 121, 198, 0.95),
    0 0 14px rgba(232, 121, 198, 0.75),
    0 1px 3px rgba(0, 0, 0, 0.85);
}

.poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 10px;
  user-select: none;
  -webkit-user-select: none;
  draggable: false;
  -webkit-user-drag: none;
  pointer-events: none;
  transform: scale(1);
  transition: transform 0.24s ease, filter 0.24s ease;
}
.poster-anchor { display: block; width: 100%; height: 100%; -webkit-user-drag: none; user-drag: none; }
.poster--placeholder {
  background:
    radial-gradient(circle at 30% 20%, rgba(139, 92, 246, 0.22), transparent 55%),
    radial-gradient(circle at 75% 80%, rgba(34, 197, 94, 0.14), transparent 55%),
    linear-gradient(145deg, #1a2340 0%, #0b1220 100%);
  pointer-events: none;
}

.poster-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px 18px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.65) 60%, rgba(0,0,0,0.2) 85%, transparent);
  border-radius: 10px 10px 0 0;
  pointer-events: none;
}
.poster-top > * { pointer-events: auto; }
.poster-top-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.poster-top-text > * { pointer-events: auto; }
.poster-top-text .poster-status { margin-top: 6px; }

.poster-bottom {
  position: absolute;
  inset: auto 0 0 0;
  height: 60%;
  border-radius: 0 0 10px 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 2px;
  padding: 10px;
  padding-right: 64px;
  pointer-events: none;
  overflow: hidden;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 60%);
  transition: background 0.22s ease;
}
.item-card:hover .poster-bottom {
  background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.4) 30%, transparent 65%);
}
.poster-bottom > * { pointer-events: auto; }
.item-card:not(:has(.add-watchlist-btn)):not(:has(.more-like-btn)) .poster-bottom {
  padding-right: 10px;
}

.poster-title {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  color: #f9fafb;
  text-shadow: 0 1px 6px rgba(0,0,0,0.9), 0 0 12px rgba(0,0,0,0.7);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0.7;
}
.poster-title-link {
  color: inherit;
  text-decoration: none;
}
.poster-title-meta {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.1;
  color: rgba(255,255,255,0.62);
  text-shadow: 0 1px 4px rgba(0,0,0,0.85);
  letter-spacing: 0.04em;
  pointer-events: none;
}
.poster-episode {
  align-self: flex-start;
  max-width: 100%;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.poster-episode:hover { opacity: 1; }
.finale-tag {
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(232, 121, 198, 0.85);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}
.poster-status {
  align-self: flex-start;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
  text-shadow: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  transition: opacity 0.15s;
}
.poster-status-icon { flex-shrink: 0; }
.poster-status--watched { background: rgba(20,83,45,0.8); color: #dcfce7; box-shadow: 0 2px 6px rgba(0,0,0,0.35); opacity: 0.75; }
posters-row:not(.discovery) .item-card .poster-status--watched,
.poster-grid:not(.discovery) .item-card .poster-status--watched { font-size: 0.95rem; padding: 6px 14px; font-weight: 700; opacity: 0.9; pointer-events: auto; }
posters-row:not(.discovery) .item-card .poster-status--watched .poster-status-icon,
.poster-grid:not(.discovery) .item-card .poster-status--watched .poster-status-icon { width: 18px; height: 18px; }
posters-row:not(.discovery) .item-card:hover .poster-status--watched,
.poster-grid:not(.discovery) .item-card:hover .poster-status--watched { opacity: 1; }
.poster-status--watchlist { background: rgba(30,58,138,0.8); color: #dbeafe; box-shadow: 0 2px 6px rgba(0,0,0,0.35); opacity: 0.75; }
.poster-status--rating { padding: 0; opacity: 0.8; color: rgba(255,255,255,0.85); text-shadow: 0 1px 4px rgba(0,0,0,0.85); }

.poster-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(0,0,0,0.55);
  pointer-events: none;
  z-index: 3;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.item-card:hover .poster-progress { opacity: 1; }
.poster-progress-fill {
  height: 100%;
  background: color-mix(in srgb, var(--hover-accent) 55%, white 45%);
  transition: width 0.3s ease;
}

.add-watchlist-btn,
.more-like-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 48px;
  height: 48px;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: unset;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
  z-index: 5;
}
.item-card:has(.poster-progress) .poster-bottom {
  padding-bottom: 14px;
}
.item-card:has(.poster-progress) .add-watchlist-btn,
.item-card:has(.poster-progress) .more-like-btn {
  bottom: 14px;
}
.add-watchlist-btn { background: rgba(30,58,138,0.6); color: rgba(255,255,255,0.7); font-size: 1.8rem; line-height: 1; }
.add-watchlist-btn:hover { background: rgba(59,130,246,0.4); border-color: #3b82f6; color: #fff; }
.more-like-btn { background: rgba(120,53,15,0.6); }
.more-like-btn:hover { background: rgba(245,158,11,0.4); border-color: #f59e0b; }
.more-like-btn:hover svg { fill: #fff; }
.item-card .add-watchlist-btn,
.item-card .more-like-btn { opacity: 1; transition: opacity 0.2s ease; }
.item-card:has(.add-watchlist-btn) .more-like-btn { right: 64px; }

.discovery .item-card.trending-watched .poster,
.discovery .item-card.trending-watched .poster-top-text { opacity: 0.35; transition: opacity 0.2s; }
.discovery .item-card.trending-watched:hover .poster,
.discovery .item-card.trending-watched:hover .poster-top-text { opacity: 0.75; }
.discovery .item-card.trending-watchlisted .poster,
.discovery .item-card.trending-watchlisted .poster-top-text { opacity: 0.55; transition: opacity 0.2s; }
.discovery .item-card.trending-watchlisted:hover .poster,
.discovery .item-card.trending-watchlisted:hover .poster-top-text { opacity: 0.85; }

.similar-grid .more-like-btn { width: 56px; height: 56px; }
.similar-grid .more-like-btn svg { width: 24px; height: 24px; }
