/* ---------- Base ---------- */
:root {
  --bg: #08090d;
  --sidebar: #0c0d13;
  --surface: #12141c;
  --surface-hover: #1b1d27;
  --text: #f4f4f7;
  --muted: #999cac;
  --red: #e81740;
  --red-dark: #a80d2b;
  --border: rgba(255, 255, 255, 0.08);
}

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

html {
  scroll-behavior: auto;
  scroll-padding-top: 90px;
  overflow-anchor: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-anchor: none;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

::selection {
  background: var(--red);
  color: white;
}

/* ---------- Main layout ---------- */
.app {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 248px;
  padding: 28px 18px 20px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  transition: width 0.3s ease, transform 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 30px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.brand-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 39px;
  height: 39px;
  border-radius: 13px;
  background: linear-gradient(135deg, #ff3158, #9c0627);
  box-shadow: 0 0 24px rgba(232, 23, 64, 0.22);
}

.brand-name {
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 1px;
}

.brand-name span {
  display: block;
  color: #f35a76;
  font-size: 10px;
  letter-spacing: 4px;
}

.collapse-btn {
  position: absolute;
  top: 48%;
  right: -15px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #292c38;
  border-radius: 50%;
  background: #171923;
  color: #c7cad4;
  font-size: 23px;
  transition: background 0.2s;
}

.collapse-btn:hover,
.arrow-btn:hover {
  background: #292c38;
}

.nav-group {
  margin-top: 30px;
}

.nav-heading {
  margin: 0 10px 12px;
  color: #666b80;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  white-space: nowrap;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  margin: 4px 0;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #b6b9c7;
  font-size: 13px;
  transition: 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  background: #171923;
  color: white;
}

.nav-link.active {
  border-color: rgba(232, 23, 64, 0.34);
  background: linear-gradient(100deg, rgba(232, 23, 64, 0.17), #171019);
  color: white;
}

.nav-link.active::before {
  position: absolute;
  left: -1px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--red);
  content: "";
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 19px;
  flex-shrink: 0;
  color: #a2a8ba;
  font-size: 21px;
}

.nav-link.active .nav-icon {
  color: #ff365a;
}

.sidebar-bottom {
  margin-top: auto;
}

.sidebar-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px 10px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #11131a;
  font-size: 11px;
}

.note-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #f02b50;
  box-shadow: 0 0 12px #f02b5070;
}

.sidebar-note p {
  margin-top: 5px;
  color: var(--muted);
}

.main-content {
  min-width: 0;
  margin-left: 248px;
  transition: margin-left 0.3s ease;
}

/* ---------- Collapsed sidebar ---------- */
body.sidebar-collapsed .sidebar {
  width: 78px;
  padding-right: 12px;
  padding-left: 12px;
}

body.sidebar-collapsed .main-content {
  margin-left: 78px;
}

body.sidebar-collapsed .brand {
  justify-content: center;
  padding-right: 0;
  padding-left: 0;
}

body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .nav-heading,
body.sidebar-collapsed .sidebar-note,
body.sidebar-collapsed .collapse-btn {
  display: none;
}

body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .nav-icon {
  font-size: 23px;
}

/* ---------- Top navigation ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 78px;
  padding: 14px 36px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 9, 13, 0.9);
  backdrop-filter: blur(18px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 510px);
  height: 44px;
  padding: 0 15px;
  border: 1px solid #282a35;
  border-radius: 30px;
  background: #13151d;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: #b51b3a;
  box-shadow: 0 0 0 3px rgba(232, 23, 64, 0.08);
}

.search-icon {
  color: #aab0c1;
  font-size: 25px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: white;
  font-size: 13px;
  scroll-margin-block: 0;
}

.search-box input::placeholder {
  color: #85899b;
}

.search-box kbd {
  display: grid;
  place-items: center;
  min-width: 23px;
  height: 25px;
  border: 1px solid #383b48;
  border-radius: 7px;
  color: #b5b8c5;
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.top-link {
  color: #b8bbc8;
  font-size: 12px;
  white-space: nowrap;
}

.top-link:hover {
  color: white;
}

.profile-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #48404b;
  border-radius: 50%;
  background: linear-gradient(135deg, #3a202e, #161923);
  font-weight: 700;
}

.mobile-menu {
  display: none;
  border: 0;
  background: transparent;
  font-size: 22px;
}

/* ---------- Page content ---------- */
.page-content {
  width: 100%;
  max-width: 1700px;
  margin: 0 auto;
  padding: 30px 36px 0;
}

/* ==================================================
   CINEMATIC HERO
   Clear artwork by default; information on hover.
   ================================================== */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 470px;
  margin: 0 0 38px;
  overflow: hidden;
  isolation: isolate;
  border: none;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;

  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 7%,
    black 76%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 7%,
    black 76%,
    transparent 100%
  );
}

.hero-background {
  position: absolute;
  inset: -2px;
  z-index: -2;
  background-position: center 35%;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.02);
  filter: brightness(1);
  transition: filter 0.35s ease;
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(620px, 80%);
  padding: 48px 42px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    transform 0.35s ease,
    visibility 0.35s ease;
}

.hero:hover .hero-content,
.hero:focus-within .hero-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.hero:hover .hero-background,
.hero:focus-within .hero-background {
  filter: brightness(0.72);
}

.hero:hover .hero-shade,
.hero:focus-within .hero-shade {
  opacity: 1;
  background: linear-gradient(
    90deg,
    rgba(8, 9, 13, 0.94) 0%,
    rgba(8, 9, 13, 0.66) 38%,
    rgba(8, 9, 13, 0.12) 78%,
    rgba(8, 9, 13, 0.08) 100%
  );
}

.hero-tags,
.hero-details,
.hero-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.featured-tag {
  color: #ff4264;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
}

.hero-meta {
  color: #d2d1da;
  font-size: 10px;
  letter-spacing: 1.5px;
}

.hero h1 {
  max-width: 600px;
  margin: 18px 0 14px;
  color: #fff;
  font-size: clamp(36px, 4vw, 58px);
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -2px;
}

.hero-details {
  gap: 14px;
  color: #d1d2dc;
  font-size: 12px;
}

.rating {
  color: #ffca58;
  font-weight: 800;
}

.hero-content > p {
  max-width: 470px;
  margin-top: 16px;
  color: #e0e0e8;
  font-size: 13px;
  line-height: 1.9;
}

.hero-buttons {
  margin-top: 24px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 750;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(120deg, #ff3157, #d90032);
  box-shadow: 0 7px 24px rgba(232, 23, 64, 0.23);
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 9px 30px rgba(232, 23, 64, 0.4);
}

.btn-secondary {
  border-color: #42434d;
  background: rgba(25, 26, 34, 0.86);
  color: white;
}

.btn-secondary:hover {
  background: #282a35;
}

/* Hero slider indicators */
.hero-pagination {
  position: absolute;
  right: 28px;
  bottom: 32px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.hero-dot {
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: 10px;
  background: #777784;
  transition: width 0.2s, background 0.2s;
}

.hero-dot.active {
  width: 24px;
  background: var(--red);
}

/* Touchscreens have no hover, so keep information visible */
@media (hover: none) {
  .hero-content {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }

  .hero-shade {
    opacity: 1;
    background: linear-gradient(
      90deg,
      rgba(8, 9, 13, 0.92) 0%,
      rgba(8, 9, 13, 0.65) 55%,
      rgba(8, 9, 13, 0.18) 100%
    );
  }
}

/* ---------- Anime collections ---------- */
.anime-section {
  margin-top: 43px;
  scroll-margin-top: 100px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 19px;
}

.section-kicker {
  color: #f15a75;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2px;
}

.section-heading h2 {
  margin-top: 4px;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.5px;
}

.carousel-controls {
  display: flex;
  gap: 9px;
}

.arrow-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #292c37;
  border-radius: 50%;
  background: #14161e;
  color: #d3d5de;
  font-size: 24px;
  transition: background 0.2s;
}

.arrow-btn:hover {
  background: #292c38;
}

/* Horizontal scrolling poster row */
.anime-row {
  display: grid;
  grid-template-rows: auto;
  grid-auto-columns: 160px;
  grid-auto-flow: column;
  align-items: start;
  gap: 17px;
  min-height: 260px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 3px 2px 16px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #36303a transparent;
}

.anime-row::-webkit-scrollbar {
  height: 5px;
}

.anime-row::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background: #36303a;
}

.anime-card {
  width: 100%;
  min-width: 0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.anime-card:hover {
  transform: translateY(-4px);
}

/* Poster */
.poster-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: #191b25;
  transition: transform 0.3s ease, border-color 0.3s, box-shadow 0.3s;
}

.anime-card:hover .poster-wrap {
  transform: translateY(-5px) scale(1.025);
  border-color: rgba(232, 23, 64, 0.75);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.4),
    0 0 18px rgba(232, 23, 64, 0.08);
}

.poster-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.anime-card:hover .poster-wrap img {
  transform: scale(1.06);
}

/* Poster badges */
.poster-rating {
  position: absolute;
  top: 9px;
  right: 8px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 202, 88, 0.28);
  border-radius: 7px;
  background: rgba(10, 10, 14, 0.86);
  color: #ffca58;
  font-size: 10px;
  font-weight: 800;
}

.poster-type {
  position: absolute;
  top: 9px;
  left: 8px;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(10, 10, 14, 0.82);
  color: #e7e7ed;
  font-size: 9px;
  font-weight: 700;
}

/* Card hover controls */
.card-overlay {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: center;
  padding: 18px 8px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.92));
  opacity: 0;
  transition: opacity 0.2s;
}

.anime-card:hover .card-overlay,
.anime-card:focus-within .card-overlay {
  opacity: 1;
}

.quick-add {
  width: 33px;
  height: 33px;
  border: 1px solid #ffffff55;
  border-radius: 50%;
  background: #171923;
  color: white;
  font-size: 19px;
}

.quick-add.saved {
  border-color: var(--red);
  background: var(--red);
}

.card-title {
  margin-top: 11px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

/* Watch progress indicator */
.progress-track {
  height: 4px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 5px;
  background: #30313a;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--red);
}

/* ---------- Genres, empty state and footer ---------- */
.genre-list {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
}

.genre-chip {
  padding: 10px 16px;
  border: 1px solid #2c2e39;
  border-radius: 25px;
  background: #12141c;
  color: #c9cad5;
  font-size: 12px;
  transition: 0.2s;
}

.genre-chip:hover,
.genre-chip.selected {
  border-color: #b71a3b;
  background: rgba(232, 23, 64, 0.13);
  color: white;
}

.empty-state {
  padding: 65px 20px;
  text-align: center;
}

.empty-state > span {
  color: #f15a75;
  font-size: 38px;
}

.empty-state h2 {
  margin: 12px 0 8px;
}

.empty-state p {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 65px;
  padding: 30px 0 28px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.footer-brand {
  color: white;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 2px;
}

.footer p {
  margin: 7px 0;
}

/* ---------- Toast notifications ---------- */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 13px 18px;
  transform: translateY(20px);
  border: 1px solid #343642;
  border-radius: 12px;
  background: #191b25;
  box-shadow: 0 12px 40px #0008;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ---------- Large screens ---------- */
@media (min-width: 1450px) {
  .anime-row {
    grid-auto-columns: 175px;
    gap: 20px;
  }

  .hero {
    min-height: 490px;
  }
}

/* ---------- Tablet layout ---------- */
@media (max-width: 1100px) {
  .sidebar {
    width: 78px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .main-content {
    margin-left: 78px;
  }

  .brand {
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
  }

  .brand-name,
  .nav-text,
  .nav-heading,
  .sidebar-note,
  .collapse-btn {
    display: none;
  }

  .nav-link {
    justify-content: center;
    padding: 0;
  }

  .topbar {
    gap: 14px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .page-content {
    padding-right: 24px;
    padding-left: 24px;
  }
}

/* ---------- Mobile layout ---------- */
@media (max-width: 700px) {
  .sidebar {
    width: 248px;
    padding: 25px 18px;
    transform: translateX(-100%);
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  body.mobile-nav-open::after {
    position: fixed;
    inset: 0;
    z-index: 15;
    background: #0009;
    content: "";
  }

  .brand {
    justify-content: flex-start;
    padding: 0 8px 25px;
  }

  .brand-name,
  .nav-text,
  .nav-heading,
  .sidebar-note {
    display: initial;
  }

  .nav-link {
    justify-content: flex-start;
    padding: 0 12px;
  }

  .main-content,
  body.sidebar-collapsed .main-content {
    margin-left: 0;
  }

  .mobile-menu {
    display: block;
    flex-shrink: 0;
  }

  .topbar {
    min-height: 68px;
    gap: 12px;
    padding: 12px 15px;
  }

  .top-actions {
    gap: 12px;
  }

  .top-link,
  .search-box kbd {
    display: none;
  }

  .search-box {
    height: 40px;
    padding: 0 11px;
  }

  .page-content {
    padding: 18px 15px 0;
  }

  .hero {
    min-height: 390px;
    margin-bottom: 28px;
  }

  .hero-background {
    background-position: 58% center;
  }

  .hero-content {
    width: 100%;
    padding: 32px 21px 42px;
  }

  .hero h1 {
    font-size: 36px;
  }

  .hero-content > p {
    font-size: 12px;
  }

  .hero-pagination {
    right: 18px;
    bottom: 18px;
  }

  .anime-section {
    margin-top: 34px;
  }

  .section-heading h2 {
    font-size: 18px;
  }

  .section-kicker {
    font-size: 8px;
  }

  .anime-row {
    grid-auto-columns: 135px;
    gap: 13px;
    margin-right: -15px;
    padding-right: 15px;
  }

  .arrow-btn {
    width: 32px;
    height: 32px;
  }
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ==========================================
   FINAL FIX: one full-width page
   ========================================== */

.app,
.main-content,
.page-content {
  width: 100%;
  max-width: none;
  margin: 0;
}

.main-content {
  min-width: 0;
}

.page-content {
  padding: 0 0 35px;
}

/* Full-width cinematic hero */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: clamp(480px, 52vw, 680px);
  margin: 0 0 25px;
  overflow: hidden;
  border-radius: 0;
  background: #08090d;
  isolation: isolate;
  -webkit-mask-image: none;
  mask-image: none;
}

.hero-background {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-repeat: no-repeat;
  background-position: center 30%;
  background-size: cover;
  opacity: 1;
  filter: none;
  transition: transform 0.5s ease;
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      #08090d 0%,
      rgba(8, 9, 13, 0.92) 22%,
      rgba(8, 9, 13, 0.62) 43%,
      rgba(8, 9, 13, 0.08) 75%,
      transparent 100%
    ),
    linear-gradient(
      0deg,
      #08090d 0%,
      transparent 30%,
      transparent 85%,
      rgba(8, 9, 13, 0.2) 100%
    );
  opacity: 1;
}

/* Restore the hero text */
.hero-content {
  position: relative;
  z-index: 2;
  display: block;
  width: min(540px, 48%);
  padding: 45px 0;
  margin-left: clamp(24px, 4.5vw, 72px);
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.hero-tags,
.hero-details,
.hero-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.hero h1 {
  margin: 20px 0 16px;
  color: #fff;
  font-size: clamp(38px, 4.5vw, 66px);
  font-weight: 850;
  line-height: 1.04;
  letter-spacing: -1.8px;
}

.hero-details {
  margin-bottom: 18px;
  color: #e1e1e7;
  font-size: 13px;
}

.hero-details .rating {
  color: #ffc34d;
  font-weight: 800;
}

#heroDescription {
  display: -webkit-box;
  max-width: 490px;
  margin: 0;
  overflow: hidden;
  color: #d0d0d8;
  font-size: 14px;
  line-height: 1.85;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.hero-buttons {
  margin-top: 25px;
}

.hero-pagination {
  position: absolute;
  right: 35px;
  bottom: 32px;
  z-index: 3;
}

/* Keep each catalogue section under its own heading */
.anime-section {
  display: block;
  width: 100%;
  margin: 30px 0 42px;
  padding: 0 clamp(20px, 4.5vw, 70px);
  scroll-margin-top: 95px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 5px 0 0;
  color: #f5f5f8;
  font-size: 25px;
  font-weight: 800;
}

.section-kicker {
  color: #ff4566;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.5px;
}

/* Poster cards flow horizontally, not in one stretched row */
.anime-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(145px, 13vw, 195px);
  grid-template-rows: auto;
  gap: 18px;
  align-items: start;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 16px;
  scroll-behavior: smooth;
}

.anime-card {
  width: 100%;
  min-width: 0;
}

.poster-wrap {
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 9px;
  background: #171820;
}

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

/* Navbar should be the only top navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Responsive hero */
@media (max-width: 760px) {
  .hero {
    min-height: 540px;
    align-items: flex-end;
  }

  .hero-background {
    background-position: 60% center;
  }

  .hero-shade {
    background: linear-gradient(
      0deg,
      #08090d 0%,
      rgba(8, 9, 13, 0.85) 42%,
      rgba(8, 9, 13, 0.15) 100%
    );
  }

  .hero-content {
    width: 100%;
    padding: 30px 20px 65px;
    margin: 0;
  }

  .hero h1 {
    font-size: 38px;
    letter-spacing: -1px;
  }

  #heroDescription {
    font-size: 12px;
    -webkit-line-clamp: 4;
  }

  .anime-row {
    grid-auto-columns: 140px;
    gap: 13px;
  }

  .section-heading h2 {
    font-size: 21px;
  }
}

/* ==========================================
   CRIMSON ANIME — FINAL CATALOGUE LAYOUT
   ========================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

body {
  margin: 0;
  background: #08090d;
  color: #f4f4f7;
}

.app,
.main-content,
.page-content {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
}

.sidebar {
  display: none !important;
}

/* One horizontal navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 28px;
  width: 100%;
  min-height: 76px;
  padding: 0 3%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(8, 9, 13, 0.96);
  backdrop-filter: blur(18px);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  white-space: nowrap;
}

.main-nav .top-link {
  display: flex;
  align-items: center;
  min-height: 76px;
  color: #bfc0cb;
  font-size: 13px;
  text-decoration: none;
}

.main-nav .top-link:hover,
.main-nav .top-link.active {
  color: white;
}

.topbar .search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(320px, 28vw);
  height: 42px;
  margin-left: auto;
  padding: 0 14px;
  border: 1px solid #30313b;
  border-radius: 24px;
  background: #15161e;
}

.topbar .search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: white;
}

.topbar .search-box input::placeholder {
  color: #9294a2;
}

.profile-button {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid #49404b;
  border-radius: 50%;
  background: #251b28;
  color: white;
}

/* Hero banner */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: clamp(460px, 48vw, 650px);
  margin: 0 0 24px;
  overflow: hidden;
  border-radius: 0;
  background: #08090d;
  isolation: isolate;
}

.hero-background {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-position: center 30%;
  background-size: cover;
  background-repeat: no-repeat;
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      #08090d 0%,
      rgba(8, 9, 13, 0.92) 22%,
      rgba(8, 9, 13, 0.6) 43%,
      rgba(8, 9, 13, 0.08) 78%,
      transparent 100%
    ),
    linear-gradient(
      0deg,
      #08090d 0%,
      transparent 28%,
      transparent 88%,
      rgba(8, 9, 13, 0.12) 100%
    );
}

.hero-content {
  position: relative;
  z-index: 2;
  display: block;
  width: min(540px, 48%);
  padding: 42px 0;
  margin-left: clamp(24px, 4.5vw, 72px);
  opacity: 1;
  visibility: visible;
  transform: none;
}

.hero h1 {
  margin: 18px 0;
  color: #fff;
  font-size: clamp(38px, 4.5vw, 66px);
  font-weight: 850;
  line-height: 1.04;
  letter-spacing: -1.8px;
}

.hero-details,
.hero-tags,
.hero-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-details {
  margin-bottom: 16px;
  color: #e1e1e8;
  font-size: 13px;
}

.hero-details .rating {
  color: #ffc34d;
  font-weight: 800;
}

#heroDescription {
  display: -webkit-box;
  max-width: 490px;
  overflow: hidden;
  color: #d0d0d8;
  font-size: 14px;
  line-height: 1.85;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.hero-buttons {
  margin-top: 24px;
}

.hero-pagination {
  position: absolute;
  right: 35px;
  bottom: 30px;
  z-index: 3;
  display: flex;
  gap: 8px;
}

/* Separate catalogue sections */
.anime-section {
  display: block;
  width: 100%;
  margin: 0 0 44px;
  padding: 0 clamp(20px, 4.5vw, 70px);
  scroll-margin-top: 100px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 6px 0 0;
  color: #f4f4f7;
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 800;
}

.section-kicker {
  color: #ff4566;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.3px;
}

/* Horizontal scrolling cards */
.anime-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(145px, 13vw, 195px);
  grid-template-rows: auto;
  align-items: start;
  gap: 18px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 18px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #3b3540 transparent;
}

.anime-row:empty {
  display: none;
}

.anime-row::-webkit-scrollbar {
  height: 5px;
}

.anime-row::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background: #3b3540;
}

.anime-card {
  width: 100%;
  min-width: 0;
  cursor: pointer;
}

.poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: #171820;
}

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

.anime-card:hover .poster-wrap {
  border-color: #e81740;
}

.card-title {
  margin-top: 10px;
  overflow: hidden;
  color: white;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  margin-top: 4px;
  color: #a5a6b0;
  font-size: 10px;
  line-height: 1.5;
}

.poster-rating,
.poster-type {
  position: absolute;
  top: 8px;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(10, 10, 14, 0.9);
  font-size: 10px;
  font-weight: 750;
}

.poster-rating {
  right: 7px;
  color: #ffca58;
}

.poster-type {
  left: 7px;
  color: white;
}

.progress-track {
  height: 4px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 5px;
  background: #30313a;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: #e81740;
}

.carousel-controls {
  display: flex;
  gap: 9px;
}

.arrow-btn {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid #30313b;
  border-radius: 50%;
  background: #15161e;
  color: #eee;
  font-size: 23px;
  cursor: pointer;
}

.arrow-btn:hover {
  background: #292a34;
}

/* Genre chips */
.genre-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.genre-chip {
  padding: 10px 17px;
  border: 1px solid #30313b;
  border-radius: 24px;
  background: #15161e;
  color: #d0d0d8;
  cursor: pointer;
}

.genre-chip:hover,
.genre-chip.selected {
  border-color: #e81740;
  background: #e8174020;
  color: white;
}

/* Helpful empty states */
.catalogue-empty {
  padding: 20px 0;
  color: #a5a6b0;
  font-size: 13px;
}

/* Mobile */
@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px 0;
  }

  .main-nav {
    order: 3;
    width: 100%;
    gap: 20px;
    overflow-x: auto;
  }

  .main-nav .top-link {
    min-height: 38px;
    font-size: 12px;
  }

  .topbar .search-box {
    width: 38px;
    height: 38px;
    padding: 0 10px;
  }

  .topbar .search-box input {
    width: 0;
  }

  .topbar .search-box:focus-within {
    position: absolute;
    right: 58px;
    left: 16px;
    width: auto;
    background: #15161e;
  }

  .topbar .search-box:focus-within input {
    width: 100%;
  }

  .hero {
    min-height: 520px;
    align-items: flex-end;
  }

  .hero-background {
    background-position: 60% center;
  }

  .hero-shade {
    background: linear-gradient(
      0deg,
      #08090d 0%,
      rgba(8, 9, 13, 0.8) 42%,
      rgba(8, 9, 13, 0.08) 100%
    );
  }

  .hero-content {
    width: 100%;
    padding: 30px 20px 65px;
    margin: 0;
  }

  .hero h1 {
    font-size: 38px;
    letter-spacing: -1px;
  }

  #heroDescription {
    font-size: 12px;
    -webkit-line-clamp: 4;
  }

  .anime-section {
    margin-bottom: 35px;
    padding: 0 18px;
  }

  .anime-row {
    grid-auto-columns: 140px;
    gap: 13px;
  }

  .section-heading h2 {
    font-size: 20px;
  }
}

/* Keep the page stable when search results change. */
html {
  overflow-anchor: none;
}

body {
  overflow-anchor: none;
}

/* Reserve space for anime rows so empty/loading messages
   do not make the document suddenly shorter. */
#trendingRow,
#recentRow,
#continueRow {
  min-height: 280px;
  overflow-anchor: none;
}

/* Keep search input interactions from causing layout changes. */
.search-box {
  flex-shrink: 0;
}

/* ==========================================
   CRIMSON ANIME — SEARCH BAR & SCROLL FIX
   Works with the existing index.html markup
   ========================================== */

/* Prevent dynamic search results from shifting the page */
html,
body {
  overflow-anchor: none;
}

header,
.search-box,
.search-box input,
#trendingRow,
#recentRow,
#continueRow {
  overflow-anchor: none;
}

/* Reserve space while catalogue rows update */
#trendingRow,
#recentRow,
#continueRow {
  min-height: 280px;
}

/* Keep input interactions from causing layout changes */
.search-box input {
  min-width: 0;
  scroll-margin: 0;
}

/* ==========================================
   DESKTOP NAVIGATION AND SEARCH
   ========================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 28px;
  width: 100%;
  min-height: 76px;
  padding: 0 3%;
  box-sizing: border-box;
}

/* Search bar: one unified rounded field */
.topbar .search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 320px;
  width: min(320px, 28vw);
  min-width: 190px;
  height: 44px;
  gap: 10px;
  margin-left: auto;
  padding: 0 14px;
  box-sizing: border-box;
  border: 1px solid #30313b;
  border-radius: 999px;
  background: #15161e;
  overflow: hidden;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

/* Highlight the complete search field */
.topbar .search-box:focus-within {
  border-color: #b51b3a;
  box-shadow: 0 0 0 3px rgba(232, 23, 64, 0.08);
}

/* Magnifying-glass symbol stays inside the bar */
.topbar .search-box .search-icon {
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 24px;
  color: #aab0c1;
  font-size: 23px;
  line-height: 1;
  cursor: text;
}

/* Input fills the remaining space, not the entire page */
.topbar .search-box input[type="search"] {
  display: block;
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  color: #f5f5fa;
  font: inherit;
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
}

.topbar .search-box input[type="search"]::placeholder {
  color: #9294a2;
  opacity: 1;
}

/* Remove browser-specific search decorations */
.topbar .search-box input[type="search"]::-webkit-search-decoration,
.topbar .search-box input[type="search"]::-webkit-search-cancel-button,
.topbar .search-box input[type="search"]::-webkit-search-results-button,
.topbar .search-box input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* Keep the profile button at a fixed size */
.topbar .profile-button {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
}

/* ==========================================
   TABLET
   ========================================== */

@media (max-width: 1100px) {
  .topbar {
    gap: 18px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .topbar .search-box {
    flex: 0 1 300px;
    width: min(300px, 30vw);
    min-width: 170px;
  }

  .main-nav {
    gap: 14px;
  }
}

/* ==========================================
   MOBILE
   Keep the search bar visible and usable.
   Do not turn it into an icon-only button.
   ========================================== */

@media (max-width: 760px) {
  .topbar {
    position: sticky;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 0;
    padding: 12px 16px 0;
  }

  .main-nav {
    order: 3;
    display: flex;
    width: 100%;
    gap: 20px;
    overflow-x: auto;
  }

  .main-nav .top-link {
    flex: 0 0 auto;
    min-height: 38px;
    font-size: 12px;
  }

  .topbar .search-box {
    position: relative;
    right: auto;
    left: auto;
    order: 2;
    flex: 1 1 180px;
    width: auto;
    min-width: 150px;
    max-width: none;
    height: 40px;
    margin-left: auto;
    padding: 0 12px;
    background: #15161e;
  }

  .topbar .search-box .search-icon {
    display: inline-flex;
    flex: 0 0 18px;
    font-size: 21px;
  }

  .topbar .search-box input[type="search"] {
    display: block;
    flex: 1 1 0;
    width: 0;
    min-width: 0;
  }

  .topbar .profile-button {
    flex: 0 0 36px;
  }
}

/* Smaller phones */
@media (max-width: 380px) {
  .topbar {
    gap: 10px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .topbar .search-box {
    flex-basis: 145px;
    min-width: 120px;
  }

  .main-nav {
    gap: 16px;
  }
}