@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;600&display=swap");

:root {
  --primary-color: #22254b;
  --secondary-color: #373b69;
  --text-color: #eee;
  --accent-green: #4ade80;
  --accent-orange: #fb923c;
  --accent-red: #f87171;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  margin: 0;
  background-color: var(--primary-color);
  min-height: 100vh;
}

/* Accessibility - visually hidden but screen reader accessible */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
header {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--secondary-color);
  flex-wrap: wrap;
  gap: 1rem;
}

header h1 {
  margin: 0;
  color: white;
  font-size: 1.5rem;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

/* App Tabs (Movies/YouTube) */
.app-tabs {
  display: flex;
  /* Wrap on narrow screens — a nowrap pill pushes the tail tabs (Basket, YouTube)
     off-screen on phones with no way to scroll to them. */
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  background-color: var(--primary-color);
  padding: 0.25rem;
  border-radius: 25px;
}

.app-tab {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.app-tab:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

.app-tab.active {
  background-color: var(--accent-green);
  color: #1a1a2e;
}

.app-tab:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

.top250-btn {
  background-color: var(--primary-color);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.top250-btn:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background-color: rgba(255, 255, 255, 0.1);
}

.top250-btn:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

.top250-btn.active {
  background-color: var(--accent-green);
  border-color: var(--accent-green);
  color: var(--primary-color);
  font-weight: 600;
}

/* Filters */
.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-group {
  position: relative;
}

.filter-select {
  appearance: none;
  background-color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 2rem 0.5rem 1rem;
  cursor: pointer;
  min-width: 140px;
  transition: border-color 0.2s, background-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.filter-select:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.filter-select:focus {
  outline: 2px solid white;
  outline-offset: 2px;
  border-color: rgba(255, 255, 255, 0.5);
}

.filter-select option {
  background-color: var(--primary-color);
  color: white;
  padding: 0.5rem;
}

/* Exclude Genres Dropdown */
.exclude-dropdown {
  position: relative;
}

.exclude-btn {
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.exclude-btn.has-selections {
  color: var(--accent-green);
}

.exclude-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background-color: var(--primary-color);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.5rem;
  z-index: 100;
  min-width: 160px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.exclude-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  color: white;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: background-color 0.15s;
}

.exclude-option:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.exclude-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-green);
  cursor: pointer;
}

/* Actor Filter */
.actor-filter {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-input {
  background-color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 2rem 0.5rem 1rem;
  min-width: 160px;
  transition: border-color 0.2s, background-color 0.2s;
}

.filter-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.filter-input:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.filter-input:focus {
  outline: 2px solid white;
  outline-offset: 2px;
  border-color: rgba(255, 255, 255, 0.5);
}

.filter-input.has-value {
  background-color: rgba(74, 222, 128, 0.2);
  border-color: var(--accent-green);
}

.actor-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--primary-color);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.actor-suggestions.show {
  display: block;
}

.actor-suggestion {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.actor-suggestion:hover {
  background-color: var(--secondary-color);
}

.actor-suggestion img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--secondary-color);
}

.actor-suggestion-info {
  display: flex;
  flex-direction: column;
}

.actor-suggestion-name {
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
}

.actor-suggestion-known {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
}

.clear-actor-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.clear-actor-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Search Input */
.search {
  background-color: transparent;
  border: 2px solid var(--primary-color);
  border-radius: 50px;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  color: white;
  min-width: 200px;
  transition: background-color 0.2s, border-color 0.2s;
}

.search::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search:focus {
  outline: 2px solid white;
  outline-offset: 2px;
  background-color: var(--primary-color);
}

/* Loading State */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: white;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading p {
  margin-top: 1rem;
  font-size: 1.1rem;
}

/* Load More Indicator */
.load-more-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.spinner.small {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

/* Error State */
.error {
  background-color: rgba(248, 113, 113, 0.2);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  padding: 1rem 2rem;
  margin: 2rem;
  border-radius: 8px;
  text-align: center;
  font-size: 1.1rem;
}

/* No Results */
.no-results {
  color: white;
  text-align: center;
  padding: 4rem;
  font-size: 1.2rem;
  width: 100%;
}

/* Main Container */
main {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 1rem;
}

/* Movie Card */
.movie {
  width: 300px;
  margin: 1rem;
  background-color: var(--secondary-color);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.movie:hover,
.movie:focus {
  transform: scale(1.05);
  z-index: 1;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.movie:focus {
  outline: 3px solid white;
  outline-offset: 2px;
}

.movie:hover .overview,
.movie:focus .overview {
  transform: translateY(0%);
}

/* Movie Image */
.movie .image {
  aspect-ratio: 2/3;
  overflow: hidden;
  background-color: var(--primary-color);
}

.movie img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Movie Info */
.movie-info {
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem 1rem;
  letter-spacing: 0.3px;
  gap: 0.5rem;
}

.movie-info .title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.movie-info .title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-info .title h6 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.7;
  text-transform: uppercase;
}

.movie-info p {
  margin: 0 0 0.25rem 0;
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Votes Section */
.votes {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.votes > div {
  text-align: center;
}

/* Rating Badges */
.movie-info span {
  display: inline-block;
  background-color: var(--primary-color);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.875rem;
}

.movie-info span.green {
  color: var(--accent-green);
}

.movie-info span.orange {
  color: var(--accent-orange);
}

.movie-info span.red {
  color: var(--accent-red);
}

.movie-info span.vote-count {
  color: var(--text-color);
  font-weight: 500;
}

.movie-info span.director {
  color: #a5b4fc;
  font-style: italic;
}

/* Genre Tags */
.genre-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.25rem 0;
}

.genre-tag {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: #c4b5fd;
  padding: 0.15rem 0.5rem !important;
  border-radius: 12px;
  font-size: 0.7rem !important;
  font-weight: 500 !important;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.genre-tag:nth-child(2) {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(16, 185, 129, 0.3));
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.genre-tag:nth-child(3) {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.3), rgba(245, 158, 11, 0.3));
  border-color: rgba(251, 146, 60, 0.5);
  color: #fdba74;
}

.genre-tag:nth-child(4) {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.3), rgba(14, 165, 233, 0.3));
  border-color: rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
}

/* Streaming Providers */
.providers {
  display: flex;
  gap: 2px;
  margin: 0.15rem 0;
  align-items: center;
}

.provider-logo {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  border-radius: 6px;
  object-fit: cover;
}

/* Overview Overlay */
.overview {
  background-color: rgba(255, 255, 255, 0.98);
  padding: 1rem;
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  max-height: 100%;
  overflow-y: auto;
  transform: translateY(101%);
  transition: transform 0.3s ease-in-out;
}

.overview h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: var(--primary-color);
}

.overview p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #333;
}

/* Video Player Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  width: 100%;
  max-width: 1200px;
  background-color: var(--primary-color);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.player-header {
  padding: 1rem 3rem 1rem 1.5rem;
  background-color: var(--secondary-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.player-header h2 {
  margin: 0;
  color: white;
  font-size: 1.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.source-select {
  appearance: none;
  background-color: var(--primary-color);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.source-select:hover {
  border-color: rgba(255, 255, 255, 0.6);
}

.source-select:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

.player-tabs {
  display: flex;
  gap: 0.5rem;
}

.tab-btn {
  background-color: transparent;
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.7);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  border-color: rgba(255, 255, 255, 0.6);
  color: white;
}

.tab-btn.active {
  background-color: white;
  border-color: white;
  color: var(--primary-color);
  font-weight: 600;
}

.tab-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Episode Controls */
.episode-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.episode-select {
  appearance: none;
  background-color: var(--primary-color);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.episode-select:hover {
  border-color: rgba(255, 255, 255, 0.6);
}

.episode-select:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

.nav-btn {
  background-color: var(--primary-color);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
  background-color: white;
  color: var(--primary-color);
  border-color: white;
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* App-level fullscreen button (player-fullscreen.js). Pushed to the right edge
   of the controls row, away from the source/episode selects. */
.fullscreen-btn {
  margin-left: auto;
}

.fullscreen-btn svg {
  display: block;
}

.player-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background-color: #000;
}

.player-container iframe,
.player-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.player-container video {
  background-color: #000;
}

/* YTS torrent stream status overlay */
.yts-status {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: #fff;
  background-color: rgba(10, 10, 25, 0.85);
  font-size: 1.05rem;
  line-height: 1.5;
  white-space: pre-line;
  pointer-events: none;
  z-index: 2;
}

.yts-status.error {
  color: #ff9b9b;
}

/* Responsive Design */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    text-align: center;
  }

  .filters {
    width: 100%;
    justify-content: center;
  }

  .filter-select {
    min-width: 120px;
  }

  .search {
    width: 100%;
  }

  .movie {
    width: calc(50% - 1rem);
    margin: 0.5rem;
  }
}

@media (max-width: 480px) {
  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-select {
    width: 100%;
  }

  .movie {
    width: 100%;
    margin: 0.5rem 0;
  }

  main {
    padding: 0.5rem;
  }
}

/* ==================== */
/* YouTube Video Cards  */
/* ==================== */

.youtube-card {
  position: relative;
  background-color: var(--secondary-color);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  width: calc(25% - 1.5rem);
  margin: 0.75rem;
}

.youtube-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.youtube-card:focus {
  outline: 3px solid var(--accent-green);
  outline-offset: 2px;
}

.yt-thumbnail-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.yt-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.youtube-card:hover .yt-thumbnail {
  transform: scale(1.05);
}

.yt-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.yt-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  background-color: var(--accent-green);
  color: #1a1a2e;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.yt-info {
  padding: 1rem;
}

.yt-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: white;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yt-channel {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}

.yt-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
}

.yt-views {
  color: rgba(255, 255, 255, 0.8);
}

.yt-like-ratio {
  color: var(--accent-green);
}

.yt-comment-ratio {
  color: var(--accent-orange);
}

.yt-gem-score {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.yt-gem-score.gem-high {
  background: linear-gradient(135deg, #ffd700, #ffb700);
  color: #1a1a2e;
}

.yt-gem-score.gem-medium {
  background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
  color: #1a1a2e;
}

.yt-gem-score.gem-low {
  background-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

.gem-icon {
  font-size: 1rem;
}

/* No results message */
.no-results {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  padding: 3rem;
  font-size: 1.1rem;
}

/* YouTube Landing Page */
.yt-landing-header {
  text-align: center;
  padding: 2rem 1rem;
  color: white;
}

.yt-landing-header h2 {
  margin: 0 0 0.5rem;
  font-size: 1.8rem;
}

.yt-landing-header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
}

.yt-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 1rem;
}

/* Quick Search Cards */
.yt-quick-search {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  width: calc(33.333% - 1.5rem);
  min-width: 280px;
}

.yt-quick-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.yt-quick-info {
  flex: 1;
}

.yt-quick-info .yt-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.yt-quick-info .yt-channel {
  margin: 0;
  font-size: 0.8rem;
}

/* YouTube responsive */
@media (max-width: 1200px) {
  .youtube-card {
    width: calc(33.333% - 1.5rem);
  }
}

@media (max-width: 900px) {
  .youtube-card {
    width: calc(50% - 1rem);
    margin: 0.5rem;
  }
}

@media (max-width: 600px) {
  .youtube-card {
    width: 100%;
    margin: 0.5rem 0;
  }

  /* Tabs get their own full-width row above the title so all six stay
     on screen; without this the nowrap header row clips Basket/YouTube. */
  .header-top {
    flex-wrap: wrap;
  }

  .app-tabs {
    order: -1;
    flex-basis: 100%;
  }
}

/* ============================================================
   Recommendations rail — "Curated for you"
   A cinematic, poster-forward carousel set apart from the cold
   browse grid by a warm gold accent and an editorial serif head.
   ============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&display=swap");

.recommendations-row {
  --rec-gold: #e9b955;
  --rec-gold-soft: #f3d089;
  --rec-ink: #0f1130;
  position: relative;
  max-width: 1500px;
  margin: 1.25rem auto 0.5rem;
  padding: 1.4rem 1.5rem 1.5rem;
  border-radius: 18px;
  /* Warm-tinted panel that lifts the rail off the navy page. */
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(233, 185, 85, 0.10), transparent 45%),
    radial-gradient(120% 160% at 100% 0%, rgba(123, 97, 255, 0.10), transparent 50%),
    linear-gradient(180deg, #262a55 0%, #1d2046 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 24px 50px -28px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
/* Thin gold hairline along the top edge. */
.recommendations-row::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--rec-gold), transparent);
  opacity: 0.7;
}

/* ---- Editorial header ---- */
.rec-header {
  position: relative;      /* anchors the row-dismiss control */
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 0.9rem;
  row-gap: 0.1rem;
  margin-bottom: 1.15rem;
}
.rec-kicker {
  grid-column: 1 / -1;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rec-gold);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.rec-kicker::after {
  content: "";
  height: 1px;
  flex: 0 0 38px;
  background: linear-gradient(90deg, var(--rec-gold), transparent);
}
.rec-heading {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: #fff;
}
.rec-subline {
  font-size: 0.78rem;
  color: #b9bce0;
  white-space: nowrap;
  align-self: center;
  justify-self: start;
}

/* ---- Edge-faded scroll rail ---- */
.rec-rail {
  position: relative;
  margin: 0 -0.4rem;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 2.5%, #000 97.5%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 2.5%, #000 97.5%, transparent);
}
.rec-scroller {
  display: flex;
  gap: 1.1rem;
  padding: 0.4rem 0.4rem 0.9rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--rec-gold) transparent;
}
.rec-scroller::-webkit-scrollbar { height: 6px; }
.rec-scroller::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.06); border-radius: 99px; }
.rec-scroller::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--rec-gold), var(--rec-gold-soft));
  border-radius: 99px;
}

/* ---- Dedicated Recommendation page (stacked rails) ---- */
.rec-page {
  /* Re-declare the gold accent vars the rails/cards reference; on the home row
     these come from .recommendations-row, which the page intentionally omits. */
  --rec-gold: #e9b955;
  --rec-gold-soft: #f3d089;
  --rec-ink: #0f1130;
  max-width: 1500px;
  margin: 1.25rem auto 3rem;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}
.rec-rail-section { position: relative; }
.rec-page .rec-header { margin-bottom: 0.85rem; }
.rec-page .rec-heading { font-size: 1.5rem; }
.rec-empty { margin: 3rem auto; text-align: center; color: #b9bce0; }

/* ---- Card ---- */
.rec-card {
  flex: 0 0 182px;
  width: 182px;
  scroll-snap-align: start;
  cursor: pointer;
  outline: none;
  /* Staggered entrance on first paint. */
  opacity: 0;
  transform: translateY(14px);
  animation: recIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i) * 55ms);
}
@keyframes recIn {
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .rec-card { animation: none; opacity: 1; transform: none; }
}

.rec-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 13px;
  overflow: hidden;
  background: var(--rec-ink);
  box-shadow: 0 12px 26px -14px rgba(0, 0, 0, 0.85);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.32s ease;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.rec-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), filter 0.32s ease;
}

/* Rank numeral, ghosted top-left. */
.rec-rank {
  position: absolute;
  top: 0.5rem;
  left: 0.6rem;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
  letter-spacing: -0.02em;
  z-index: 2;
}
/* Type tag, top-right. */
.rec-type {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 2;
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rec-ink);
  background: var(--rec-gold-soft);
  padding: 0.18rem 0.4rem;
  border-radius: 5px;
}

/* Bottom scrim with title + rating/year. */
.rec-scrim {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.8rem 0.7rem 0.65rem;
  background: linear-gradient(transparent, rgba(8, 9, 26, 0.55) 40%, rgba(8, 9, 26, 0.94));
  z-index: 1;
}
.rec-title {
  margin: 0 0 0.18rem;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rec-sub {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.72rem;
  color: #cdd0f0;
}
.rec-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  font-weight: 600;
  color: var(--rec-gold-soft);
}
.rec-year { color: #9fa3cf; }

/* Center play affordance, hidden until hover. */
.rec-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--rec-ink);
  background: var(--rec-gold);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  box-shadow: 0 8px 22px -6px rgba(233, 185, 85, 0.7);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}
.rec-play svg { margin-left: 2px; }

/* Hover / focus state. */
.rec-card:hover .rec-poster,
.rec-card:focus-visible .rec-poster {
  transform: translateY(-6px);
  box-shadow: 0 22px 40px -16px rgba(0, 0, 0, 0.9), 0 0 0 2px var(--rec-gold);
}
.rec-card:hover .rec-art,
.rec-card:focus-visible .rec-art {
  transform: scale(1.07);
  filter: brightness(0.82);
}
.rec-card:hover .rec-play,
.rec-card:focus-visible .rec-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ---- The "why" caption — the hero of a recommendation ---- */
.rec-because {
  margin: 0.6rem 0.15rem 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #aeb2dc;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}
.rec-spark {
  flex: 0 0 auto;
  color: var(--rec-gold);
  transform: translateY(1px);
}
.rec-because b {
  color: var(--rec-gold-soft);
  font-weight: 600;
}

/* Per-row evidence kicker reuses .rec-kicker; explore row gets a distinct accent. */
.rec-explore .rec-kicker {
  color: var(--rec-gold);
}
.rec-explore .rec-heading::before {
  content: '✦ ';
  color: var(--rec-gold-soft);
  font-size: 0.85em;
}
.rec-row-explore { position: relative; }
.rec-row-explore .rec-rail::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(214, 178, 92, 0.18);
}

/* Per-card collaborative evidence label emphasis. */
.rec-because[data-rec-source] {
  color: var(--rec-gold-soft);
}
.rec-because[data-rec-source] .rec-spark {
  color: var(--rec-gold);
}

/* Cold-start "Trending to get started" page tint. */
.rec-cold-start .rec-row-top .rec-heading {
  letter-spacing: 0.01em;
}

@media (max-width: 640px) {
  .recommendations-row { padding: 1.1rem 1rem 1.2rem; border-radius: 14px; }
  .rec-heading { font-size: 1.6rem; }
  .rec-subline { display: none; }
  .rec-card { flex-basis: 150px; width: 150px; }
}

/* Star toggle */
.star-btn {
  position: absolute;
  top: 0.45rem;
  left: 0.5rem;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: rgba(8, 9, 26, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.movie:hover .star-btn,
.rec-card:hover .star-btn,
.star-btn:focus-visible,
.star-btn.starred {
  opacity: 1;
  transform: scale(1);
}
.star-btn.starred { color: #e9b955; background: rgba(8, 9, 26, 0.75); }
.star-btn:hover { color: #f3d089; }
/* The rec card already uses top-left for the rank; offset its star to top-right. */
.rec-card .star-btn { left: auto; right: 0.5rem; }
/* Player-header star sits inline, always visible. */
.player-title-row { display: flex; align-items: center; gap: 0.6rem; }
.player-star {
  position: static;
  opacity: 1;
  transform: none;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.08);
}

/* Like ('liked' tier) + Seen toggles — same overlay chip as the star, stepped rightward.
   Row order on cards: star 0.5 / like 2.7 / seen 4.9 / down 7.1 (2.2rem pitch). */
.like-btn,
.seen-btn {
  position: absolute;
  top: 0.45rem;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: rgba(8, 9, 26, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.like-btn { left: 2.7rem; }
.seen-btn { left: 4.9rem; }
/* The like button reuses the thumbs-down glyph rotated into a thumbs-up. */
.like-btn svg { transform: rotate(180deg); }
.movie:hover .like-btn, .rec-card:hover .like-btn, .like-btn:focus-visible, .like-btn.liked,
.movie:hover .seen-btn, .rec-card:hover .seen-btn, .seen-btn:focus-visible, .seen-btn.seen {
  opacity: 1;
  transform: scale(1);
}
.like-btn.liked { color: #7dd97d; background: rgba(8, 9, 26, 0.75); }
.like-btn:hover { color: #a6e8a6; }
.seen-btn.seen { color: #8ab8ff; background: rgba(8, 9, 26, 0.75); }
.seen-btn:hover { color: #b3d1ff; }
/* Rec card anchors its chips top-right (rank owns top-left): mirror the pitch. */
.rec-card .like-btn { left: auto; right: 2.7rem; }
.rec-card .seen-btn { left: auto; right: 4.9rem; }

/* Downvote toggle — last in the signal row on cards. */
.down-btn {
  position: absolute;
  top: 0.45rem;
  left: 7.1rem;            /* after star 0.5 / like 2.7 / seen 4.9 */
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: rgba(8, 9, 26, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.movie:hover .down-btn,
.rec-card:hover .down-btn,
.down-btn:focus-visible,
.down-btn.downvoted {
  opacity: 1;
  transform: scale(1);
}
.down-btn.downvoted { color: #ff6b6b; background: rgba(8, 9, 26, 0.75); }
.down-btn:hover { color: #ff9b9b; }
/* On the rec card the chips anchor top-right; the downvote sits last in the row. */
.rec-card .down-btn { left: auto; right: 7.1rem; }
/* Player-header downvote sits inline beside the title star, always visible. */
.player-down {
  position: static;
  opacity: 1;
  transform: none;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.08);
}

/* Basket | Downvoted segmented toggle. */
.basket-toggle {
  display: flex;
  gap: 0.4rem;
  margin: 0 auto 1.25rem;
  max-width: 1500px;
  padding: 0 0.4rem;
}
.basket-seg {
  padding: 0.45rem 0.9rem;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #b9bce0;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.basket-seg.active { background: #e9b955; color: #1a1a2e; border-color: transparent; font-weight: 600; }

/* ---- Skeleton rails + shimmer (perceived-speed loading state) ---- */
@keyframes recShimmer {
  to { background-position: -200% 0; }
}
.rec-skeleton .rec-skel-line,
.rec-skel-card {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.12) 37%,
    rgba(255, 255, 255, 0.05) 63%);
  background-size: 200% 100%;
  animation: recShimmer 1.4s ease-in-out infinite;
  border-radius: 10px;
}
.rec-skel-line { height: 0.85rem; width: 7rem; margin-bottom: 0.5rem; }
.rec-skel-line--wide { height: 1.4rem; width: 16rem; }
.rec-skel-card { flex: 0 0 182px; width: 182px; aspect-ratio: 2 / 3; }
/* Reserve a below-the-fold rail's height so hydration causes no layout shift. */
.rec-scroller--reserved { min-height: 273px; }
@media (prefers-reduced-motion: reduce) {
  .rec-skeleton .rec-skel-line,
  .rec-skel-card { animation: none; }
}

/* ---- Cross-fade on recompute (stale-while-revalidate) ---- */
.rec-page { transition: opacity 0.32s ease; }
.rec-page--incoming { opacity: 0; }
.rec-page--fading { opacity: 0; position: absolute; left: 0; right: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .rec-page, .rec-page--incoming, .rec-page--fading { transition: none; }
}

/* Row-level "not interested" — a quiet ✕ on each rec row header, visible on hover. */
.rec-dismiss {
  position: absolute;
  right: 0;
  top: 0.1rem;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}
.rec-rail-section:hover .rec-dismiss,
.rec-dismiss:focus-visible { opacity: 1; }
.rec-dismiss:hover { color: #ff9b9b; background: rgba(255, 255, 255, 0.1); }

/* Wildcard row — a subtle cool accent to mark the deliberate leap outside the profile. */
.rec-row-wildcard .rec-kicker { color: #8ab8ff; }
