* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

main {
    margin-top: 5px;
    padding: 2rem 3rem 3rem;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

/* Horizontal scroll and card styling */
.category-section {
  margin-bottom: 3rem;
}
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 1rem 0.5rem 1rem;
}
.category-title {
  font-size: 1.5rem;
  font-weight: bold;
}
.films-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 180px);
  gap: 1.5rem;
  padding: 1rem;
  justify-content: center;
}
.film-card {
  min-width: 180px;
  width: 180px;
  height: 300px;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  background-color: #111;
  color: #fff;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease;
}
.film-card:hover {
  transform: scale(1.05);
}
.film-poster {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  position: relative;
}
.insight-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background-color: rgba(255,255,255,0.8);
  color: #000;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: bold;
}
.film-info {
  display: none;
}

.film-info.is-one-line {
  min-height: 32%;
}

.film-info.is-two-lines {
  min-height: 48%;
}
.film-title {
  font-weight: bold;
  margin-bottom: 0.2rem;
}
.film-meta {
  font-size: 0.85rem;
  color: #ccc;
}

.film-meta-sep {
  margin-right: 0.2rem;
}

/* Sort bar styling */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1rem;
  padding: 0.75rem 1rem;
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4);
}
.sort-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffffff;
  font-weight: bold;
}
.sort-select {
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  background: #141414;
  color: #ffffff;
  font-weight: 600;
}

.sort-select:focus {
  outline: none;
  border-color: #F04030;
  box-shadow: 0 0 0 2px rgba(240, 64, 48, 0.2);
}

.films-load-more {
  display: flex;
  justify-content: center;
  padding: 1.2rem 1rem 0.6rem;
}

.films-load-more[hidden] {
  display: none;
}

.films-load-more-btn {
  width: 42px;
  height: 42px;
  border: 1px solid #2f2f2f;
  background: rgba(16, 16, 16, 0.95);
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  color: #cfcfcf;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.films-load-more-btn:hover {
  border-color: #3a3a3a;
  transform: translateY(-1px);
}

.films-load-more-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.films-load-more-icon {
  width: 18px;
  height: 12px;
  display: block;
}

.content-section {
  margin: 0 1rem 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.section-subtitle {
  color: #808080;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.ranking-meta {
  color: #808080;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ranking-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.7rem;
}

.ranking-header h3 {
  font-size: 1.1rem;
  margin: 0;
}

.top-movies-grid {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.top-movies-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, 180px);
  gap: 1rem;
  justify-content: center;
}

.top-movies-cards .content-card {
  width: 180px;
  height: 300px;
}

.top-movies-more-btn {
  display: none;
}

.content-card {
  min-width: 0;
  height: 300px;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.content-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.22);
}

.card-image {
  height: 100%;
  background: none;
  padding: 0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
}

.card-meta,
.card-insights {
  font-size: 0.85rem;
  color: #ccc;
}

.card-insights {
  text-decoration: none;
}

.weekly-rewatch .section-subtitle {
  margin-bottom: 1.1rem;
}

.rewatch-card {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 1.25rem;
  background: #141414;
  border: 1px solid #222;
  border-radius: 20px;
  padding: 1.5rem;
  align-items: center;
}

.rewatch-media {
  width: 100%;
  max-width: 200px;
}

.rewatch-media img {
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
  border-radius: 14px;
  display: block;
  object-fit: cover;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.4);
}

.rewatch-media img.is-empty {
  display: none;
}

.rewatch-kicker {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.7rem;
  color: #F04030;
  margin-bottom: 0.6rem;
}

.rewatch-inline-timer {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #b0b0b0;
  white-space: nowrap;
}

.rewatch-inline-timer span {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin: 0 0.1rem;
}

.rewatch-content h3 {
  margin: 0 0 0.6rem 0;
  font-size: 1.6rem;
}

.rewatch-meta {
  color: #9a9a9a;
  margin-bottom: 1rem;
}

.rewatch-description {
  color: #cfcfcf;
  line-height: 1.6;
  margin-bottom: 1.4rem;
  max-width: 850px;
}

.rewatch-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.explore-btn {
  padding: 0;
  background: transparent;
  color: #ffffff;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-underline-offset: 4px;
}

.explore-btn:hover {
  text-decoration: underline;
}

.rewatch-view-film {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(240, 64, 48, 0.95);
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  background: linear-gradient(135deg, #f04030, #ff6b4a);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.rewatch-view-film:hover {
  background: #d43325;
  border-color: #d43325;
}

.rewatch-reminder {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f2f2f2;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(12, 12, 12, 0.55);
  transition: all 0.25s ease;
}

.rewatch-reminder:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
}

.rewatch-reminder.is-set {
  opacity: 0.75;
  cursor: pointer;
}

.insights-count,
.comments-count {
  color: #b0b0b0;
  font-size: 1rem;
}

.home-nav-notification {
  display: block;
  color: #e6e6e6;
  text-decoration: none;
  font-size: 0.86rem;
  line-height: 1.4;
  padding: 0.45rem 0;
}

.home-nav-notification:hover {
  color: #ffffff;
}

@media (max-width: 768px) {
  main {
    padding: 1rem 1rem 2rem;
  }

  .category-header {
    margin: 0 0 0.5rem;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
  }

  .sort-bar {
    margin: 0.8rem 0;
    padding: 0.65rem 0.75rem;
    flex-wrap: wrap;
  }

  .sort-select {
    width: 100%;
  }

  .content-section {
    margin: 0 0 1.5rem;
  }

  .section-header h2 {
    font-size: 1.5rem;
  }

  .ranking-meta {
    font-size: 0.74rem;
  }

  .rewatch-card {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .rewatch-media {
    max-width: 180px;
    margin: 0 auto;
  }

  .rewatch-media img {
    width: 100%;
  }

  .rewatch-actions {
    gap: 0.75rem;
  }

  .rewatch-reminder,
  .rewatch-view-film {
    min-height: 44px;
    width: 100%;
    justify-content: center;
  }

  .top-movies-cards {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(72px, 1fr)) !important;
    gap: 0.7rem;
    justify-content: stretch;
    align-items: stretch;
  }

  .content-card {
    min-width: 0;
    width: 100%;
    height: 262px;
  }

  .top-movies-cards .content-card {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto !important;
    aspect-ratio: 2 / 3;
  }

  .top-movies-cards .card-image {
    height: 100%;
  }

  .new-releases-row.is-mobile-collapsed #top-movies-weekly .content-card:nth-child(n + 9) {
    display: none;
  }

  .top-movies-more-btn:not([hidden]) {
    display: inline-flex;
    margin: 0.75rem auto 0;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(20, 20, 20, 0.8);
    color: #f0f0f0;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    cursor: pointer;
  }

  .films-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 0.45rem;
    justify-content: stretch;
    padding: 0.4rem 0;
  }

  .film-card {
    min-width: 0;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
  }

  .films-load-more-btn {
    min-width: 44px;
    min-height: 44px;
  }
}
