:root {
  --bg: #0b0f18;
  --fg: #eef2ff;
  --text: #cbd5e1;
  --muted: rgba(226, 232, 240, 0.7);
  --card: rgba(255, 255, 255, 0.06);
  --card-bg: rgba(255, 255, 255, 0.06);
  --border: rgba(148, 163, 184, 0.2);
  --primary: #7c3aed;
  --accent: #7c3aed;
  --accent-soft: rgba(124, 58, 237, 0.18);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --fg: #1e293b;
  --text: #334155;
  --muted: #64748b;
  --card: #f8fafc;
  --border: #e2e8f0;
  --primary: #8b5cf6;
  --accent: #a78bfa;
  --accent-soft: #c4b5fd;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, rgba(124, 58, 237, 0.18), transparent 55%),
    var(--bg);
  color: var(--fg);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

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

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid !important;
  place-items: center;
  font-size: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.brand-title {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.nav-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.content-type-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

.content-type-btn {
  padding: 10px 20px;
  white-space: nowrap;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.content-type-btn:hover {
  background: var(--card);
  color: var(--fg);
}

.content-type-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.nav-link {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  background: var(--accent-soft);
  color: var(--fg);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  transition: border 0.2s ease;
}

.search input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font-weight: 600;
  width: 200px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
}

.pill-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.page {
  padding: 26px 20px 60px;
  max-width: 1280px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 800;
}

.page-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.page-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.82rem;
}

.grid, #movie-container {
  margin-top: 22px;
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  transform-style: preserve-3d;
  will-change: transform;
  position: relative;
}

.card:hover {
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(124,58,237,0.25);
}

/* Glare overlay for 3D tilt */
.card-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: screen;
  background: transparent;
  transition: background 0.05s;
}

.card-link {
  display: block;
  position: relative;
}

.poster {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
  background: #111827;
}

.poster.big {
  height: auto;
  border-radius: var(--radius);
}

.card-meta {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 42px;
}

.card-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-weight: 600;
}

.rating {
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg);
  font-weight: 700;
}

.loader {
  margin: 32px auto 0;
  text-align: center;
  color: var(--muted);
  display: none;
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-weight: 700;
  display: none;
  z-index: 50;
}

.toast.show {
  display: block;
}

.toast-error {
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  border-color: rgba(220, 38, 38, 0.8);
}

.detail {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 20px 80px;
}

.detail-grid {
  display: grid !important;
  grid-template-columns: 340px 1fr;
  gap: 26px;
  align-items: start;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-title {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 800;
}

.detail-tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-overview {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 500;
}

.trailer-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trailer-block h2 {
  margin: 0;
  font-size: 1.2rem;
}

.trailer iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
}

.muted {
  color: var(--muted);
}

/* ─── nav-search & nav-controls (desktop) ─────────── */
.nav-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.nav-search .search { width: 100%; }
.nav-search .search input { width: 100%; min-width: 0; }

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Hide scrollbars on horizontal navs ─────────── */
.nav-tabs,
.content-type-tabs {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav-tabs::-webkit-scrollbar,
.content-type-tabs::-webkit-scrollbar { display: none; }

/* ─── 1200px ─────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid, #movie-container {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ─── 1024px ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .nav-tabs,
  .content-type-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .grid, #movie-container {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Footer Styles */
.footer {
  margin-top: 4rem;
  padding: 2rem 1rem;
  background: var(--card);
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.footer-content p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.footer-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer-links span {
  color: var(--muted);
}
/* ─── Tap targets (>= 44px) and visible keyboard focus ───────────── */
.pill-btn,
.icon-btn,
.nav-link,
.content-type-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search {
  min-height: 48px;           /* 44px Search button + 2px padding + 1px border each side */
  padding: 2px 2px 2px 14px;
}
.search input { min-height: 44px; }
.search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent);
}
/* The tab strips scroll horizontally (overflow-x:auto also clips vertically), so give the
   focus ring room inside them instead of letting it be cut off at the strip edge. */
.nav-tabs,
.content-type-tabs { padding: 4px; }
.home-hero__search:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.pill-btn:focus-visible,
.icon-btn:focus-visible,
.nav-link:focus-visible,
.content-type-btn:focus-visible,
.nav-brand-link:focus-visible,
.home-card:focus-visible,
.card-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ─── Discover navbar, desktop (>= 901px) ───────────
   Row 1: brand | search | theme/auth controls.
   Row 2: content-type tabs + category links.
   A flex row let the tab groups claim the width and squeezed .nav-search to 0px,
   so its Search button overflowed and painted over the Dark toggle. */
.nav-subrow { display: contents; } /* transparent wrapper below 901px */

@media (min-width: 901px) {
  .navbar--discover {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto;
    grid-template-areas:
      "brand search controls"
      "sub   sub    sub";
    align-items: center;
    gap: 10px 18px;
  }
  .navbar--discover .nav-brand    { grid-area: brand; min-width: 0; }
  .navbar--discover .nav-search   { grid-area: search; }
  .navbar--discover .nav-controls { grid-area: controls; justify-self: end; }
  .navbar--discover .nav-subrow {
    grid-area: sub;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; /* category links drop to their own line instead of overlapping the tabs */
    gap: 8px 16px;
    min-width: 0;
  }
  .navbar--discover .nav-subrow .content-type-tabs {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }
  .navbar--discover .nav-subrow .nav-tabs {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
  }
}

/* Narrow phones: let the brand shrink (ellipsis) instead of running under the
   theme/auth controls, and drop the "Hi, name" greeting that has no room. */
.brand-text { min-width: 0; }
@media (max-width: 768px) {
  .nav-brand-link { min-width: 0; }
  .brand-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-brand { min-width: 0; }
}
@media (max-width: 600px) {
  .auth-greeting { display: none !important; }
}

/* ─── Home navbar (<= 1100px) ────────────────────────
   Brand + controls on row 1, scrollable Home/Movies/TV/Anime links on row 2.
   A single flex row squeezed the brand text into a sliver and clipped the links. */
@media (max-width: 1100px) {
  .navbar--home {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand controls"
      "links links";
    gap: 8px 10px;
    padding: 12px 16px;
    align-items: center;
  }
  .navbar--home .nav-brand    { grid-area: brand; min-width: 0; }
  .navbar--home .nav-tabs     { grid-area: links; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; min-width: 0; }
  .navbar--home .nav-controls { grid-area: controls; gap: 6px; }
  .navbar--home .brand-subtitle { display: none; }
  .navbar--home .nav-controls .pill-btn { padding: 6px 10px; font-size: 0.8rem; }
}

/* ─── 900px (small tablet / large phone landscape) ── */
@media (max-width: 900px) {
  /* Detail pages: keep brand + actions on one row */
  .navbar--detail {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    justify-content: space-between;
  }
  .navbar--detail .nav-brand {
    min-width: 0;
    flex: 1 1 auto;
  }
  .navbar--detail .nav-actions {
    flex-shrink: 0;
  }

  /* Discover page: stack to column */
  .navbar--discover {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px;
  }
  .navbar--discover .nav-brand { min-width: 0; }

  /* Detail page poster / grid */
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-poster {
    max-width: 260px;
    margin: 0 auto;
  }
}

/* ─── 768px (phone landscape / small tablet) ──────── */
@media (max-width: 768px) {
  /* Discover navbar: grid so brand+controls share one row */
  .navbar--discover {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand    controls"
      "types    types"
      "links    links"
      "search   search";
    gap: 8px 10px;
    padding: 12px 14px;
    align-items: center;
  }
  .navbar--discover .nav-brand        { grid-area: brand;    min-width: 0; }
  .navbar--discover .content-type-tabs { grid-area: types; }
  .navbar--discover .nav-tabs         { grid-area: links; }
  .navbar--discover .nav-search       { grid-area: search; }
  .navbar--discover .nav-controls     { grid-area: controls; gap: 6px; }

  .navbar--discover .brand-subtitle   { display: none; }
  .navbar--discover .nav-controls .pill-btn { padding: 6px 10px; font-size: 0.8rem; }

  /* Detail navbar: single row, compact */
  .navbar--detail {
    padding: 10px 14px;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
  }
  .navbar--detail .nav-brand { flex: 1; min-width: 0; }
  .navbar--detail .brand-subtitle { display: none; }
  .navbar--detail .nav-actions { gap: 6px; flex-shrink: 0; }
  .navbar--detail .pill-btn { padding: 6px 10px; font-size: 0.8rem; gap: 4px; }

  /* Grid */
  .grid, #movie-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .poster { height: 230px; }

  /* Page */
  .page { padding: 16px 14px 48px; }
  .page-title { font-size: 1.65rem; }
  .page-hint  { font-size: 0.88rem; }

  /* Detail page */
  .detail { padding: 20px 14px 60px; }
  .detail-title { font-size: 1.75rem; }
  .detail-poster { max-width: 220px; }

  /* Cards */
  .card-title { font-size: 0.9rem; min-height: 36px; }
  .card-meta  { padding: 10px 11px 13px; gap: 8px; }
  .card-sub   { font-size: 0.82rem; }
}

/* ─── Discover navbar on phones and small tablets (<= 900px) ─────────
   The stacked header is 220-250px tall, so it scrolls away with the page instead of
   sticking. position:relative (not static) keeps the z-index, so the search dropdown
   still paints above the cards. The category strip used `justify-content:center`
   while overflowing, which pushed "Discover" off the left edge where scrolling cannot
   reach it; start-align it. */
@media (max-width: 900px) {
  .navbar--discover { position: relative; }
  .navbar--discover .nav-tabs { justify-content: flex-start; }
}
/* Phones: fit all four content-type tabs and wrap the category links, so nothing
   hides behind a scroll strip (For You and Now Playing used to sit offscreen). */
@media (max-width: 600px) {
  .navbar--discover .content-type-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }
  .navbar--discover .content-type-btn { padding: 0 4px; font-size: 13px; }
  .navbar--discover .nav-tabs { flex-wrap: wrap; overflow: visible; white-space: normal; gap: 4px 6px; }
  .navbar--discover .nav-link { padding: 8px 12px; }
}
@media (max-width: 380px) {
  .navbar--discover .content-type-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ─── 480px (phone portrait) ──────────────────────── */
@media (max-width: 480px) {
  .navbar--discover { padding: 10px 12px; gap: 6px; }
  .navbar--detail   { padding: 10px 12px; }

  /* Keep 2 columns — 1 column is too sparse on phones */
  .grid, #movie-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .poster       { height: 195px; }
  .card-meta    { padding: 8px 10px 12px; gap: 6px; }
  .card-title   { font-size: 0.85rem; min-height: 32px; }
  .rating       { font-size: 0.78rem; padding: 4px 8px; }

  .page         { padding: 12px 12px 48px; }
  .page-title   { font-size: 1.35rem; }
  .page-hint    { font-size: 0.82rem; }
  .page-header  { gap: 10px; }
  .page-meta    { display: none; } /* hide "Updated weekly" chips on tiny screens */

  .detail       { padding: 16px 12px 60px; }
  .detail-title { font-size: 1.4rem; }
  .detail-poster { max-width: 160px; }
  .detail-overview { font-size: 0.9rem; }

  /* Auth modal: slide up from bottom as a sheet */
  .modal-overlay { align-items: flex-end; }
  .modal {
    border-radius: 1.25rem 1.25rem 0 0;
    max-width: 100%;
    padding: 1.5rem 1.25rem 2.5rem;
    animation: modal-sheet-up 0.32s cubic-bezier(0.25, 1, 0.5, 1);
  }
}

@keyframes modal-sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ─── Auth Modal ─────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 100;
  place-items: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open {
  display: grid;
  animation: modal-fade-in 0.22s ease;
}
@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  animation: modal-slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modal-slide-up {
  from { opacity: 0; transform: translateY(32px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.modal h2 {
  margin: 0 0 1.5rem;
  font-size: 1.45rem;
  font-weight: 800;
}
.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--card); }
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.modal-field label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.4px;
}
.modal-field input {
  padding: 0.7rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* password field wrapper */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrapper input {
  flex: 1;
  padding-right: 3rem;
}
.password-toggle {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.6;
  padding: 0;
  line-height: 1;
}
.password-toggle:hover { opacity: 1; }
/* strength bar */
.strength-container {
  margin-bottom: 0.75rem;
}
.strength-track {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}
.strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #ef4444;
  transition: width 0.35s ease, background 0.35s ease;
}
.strength-label {
  font-size: 0.78rem;
  font-weight: 700;
}
/* error */
.modal-error {
  color: #ef4444;
  font-size: 0.84rem;
  min-height: 1.1rem;
  margin-bottom: 0.4rem;
}
/* submit */
.modal-submit {
  width: 100%;
  padding: 0.8rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.65rem;
  font-weight: 700;
  font-size: 0.97rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  margin-top: 0.25rem;
}
.modal-submit:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}
.modal-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* toggle link */
.modal-toggle {
  margin-top: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.modal-toggle button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  margin-left: 4px;
}
.modal-toggle button:hover { text-decoration: underline; }

/* Legal Pages Styling */
.legal-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.legal-container h1 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.legal-container .last-updated {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.legal-container section {
    margin-bottom: 2rem;
}

.legal-container h2 {
    color: var(--fg);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.legal-container p {
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 1rem;
}

.legal-container ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.legal-container li {
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 0.5rem;
}

/* ─── Auth greeting ──────────────────────────────────────────────────────── */
.auth-greeting {
    font-size: .85rem;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    padding: .35rem .6rem;
}

/* ─── Profile page ───────────────────────────────────────────────────────── */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem 0 1.5rem;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.profile-name {
    margin: 0 0 .25rem;
    font-size: 1.5rem;
    font-weight: 800;
}

.profile-email {
    margin: 0;
    font-size: .85rem;
    color: var(--muted);
}

.profile-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    text-align: center;
    min-width: 100px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.stat-label {
    font-size: .8rem;
    color: var(--muted);
    margin-top: .3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.profile-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.profile-tab {
    padding: .6rem 1.2rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    margin-bottom: -1px;
}

.profile-tab:hover  { color: var(--fg); }
.profile-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.profile-card .card-meta {
    padding: .6rem .75rem .75rem;
}

.type-badge {
    display: inline-block;
    font-size: .65rem;
    font-weight: 700;
    padding: .15rem .45rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .05em;
    flex-shrink: 0;
}
.type-badge.movie  { background: rgba(124,58,237,.25); color: #a78bfa; }
.type-badge.tv     { background: rgba(16,185,129,.2);  color: #34d399; }
.type-badge.anime  { background: rgba(239,68,68,.2);   color: #f87171; }

.remove-btn {
    margin-top: .45rem;
    width: 100%;
    padding: .4rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: .5rem;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.remove-btn:hover {
    background: rgba(239,68,68,.12);
    color: #f87171;
    border-color: rgba(239,68,68,.4);
}
.remove-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Centered success popup ─────────────────────────────────────────────── */
.success-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.75);
    background: var(--card);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 1.5rem;
    padding: 2rem 2.5rem;
    text-align: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(34,197,94,0.15);
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 220px;
}
.success-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}
.success-popup-icon {
    font-size: 2.8rem;
    line-height: 1;
    margin-bottom: 0.6rem;
}
.success-popup-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--fg);
}

/* ─── Dynamic poster background (detail pages) ──────────────────────────── */
.dynamic-bg {
    position: fixed;
    inset: -8%;
    width: 116%;
    height: 116%;
    z-index: -1;
    background-size: cover;
    background-position: center top;
    filter: blur(90px) brightness(0.18) saturate(2.5);
    opacity: 0;
    transition: opacity 1.2s ease;
    pointer-events: none;
}

html[data-theme="light"] .dynamic-bg {
    opacity: 0 !important;
}

/* ============================================================
   HOME PAGE
   ============================================================ */

/* Brand link reset */
.nav-brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}

/* Hero */
.home-hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6rem 1.5rem 4rem;
}

.home-hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  filter: blur(0px) brightness(0.28) saturate(1.6);
  transition: background-image 1.2s ease;
  z-index: 0;
}

.home-hero__inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 640px;
}

.home-hero__title {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.home-hero__accent {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-hero__sub {
  color: var(--text);
  font-size: 1.05rem;
  margin: 0 0 2rem;
  line-height: 1.6;
}

.home-hero__search {
  display: flex;
  gap: 0.5rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.35rem 0.35rem 1.2rem;
  backdrop-filter: blur(12px);
}

.home-hero__search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-size: 1rem;
  min-width: 0;
}

.home-hero__search input::placeholder {
  color: var(--muted);
}

.pill-btn--primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.pill-btn--primary:hover {
  opacity: 0.88;
}

/* Sections */
.home-section {
  padding: 2.5rem 1.5rem 0.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.home-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.home-section__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.home-section__link {
  font-size: 0.85rem;
  color: var(--accent);
  opacity: 0.85;
  transition: opacity 0.2s;
}

.home-section__link:hover {
  opacity: 1;
}

/* Horizontal scrolling row */
.home-row {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.home-row::-webkit-scrollbar {
  height: 4px;
}

.home-row::-webkit-scrollbar-track {
  background: transparent;
}

.home-row::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.home-row__loading {
  color: var(--muted);
  padding: 1rem 0;
  font-size: 0.9rem;
}

/* Home card */
.home-card {
  flex: 0 0 140px;
  scroll-snap-align: start;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.home-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}

.home-card__poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
}

.home-card__info {
  padding: 0.5rem 0.55rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.home-card__title {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-card__meta {
  font-size: 0.72rem;
  color: var(--muted);
}

/* Type badge on home cards */
.home-card__badge {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}

.home-card__badge--movie {
  background: rgba(124, 58, 237, 0.82);
  color: #fff;
}

.home-card__badge--tv {
  background: rgba(16, 185, 129, 0.82);
  color: #fff;
}

.home-card__badge--anime {
  background: rgba(239, 68, 68, 0.82);
  color: #fff;
}

/* Type badge on browse cards (global search results) */
.card-type-badge {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(6px);
}

.card-type-badge--movie {
  background: rgba(124, 58, 237, 0.82);
  color: #fff;
}

.card-type-badge--tv {
  background: rgba(16, 185, 129, 0.82);
  color: #fff;
}

.card-type-badge--anime {
  background: rgba(239, 68, 68, 0.82);
  color: #fff;
}

/* ===== Cast Section ===== */
.cast-section { margin-top: 2rem; }
.cast-section h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.cast-grid { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: .5rem; scrollbar-width: thin; }
.cast-card { flex: 0 0 90px; text-align: center; text-decoration: none; color: inherit; transition: transform .18s; }
.cast-card:hover { transform: translateY(-3px); }
.cast-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); background: var(--card); display: block; margin: 0 auto .5rem; }
.cast-name { font-size: .72rem; font-weight: 700; color: var(--fg); margin: 0 0 .2rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cast-character { font-size: .68rem; color: var(--fg-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }

/* ===== More Like This Section ===== */
.more-like-section { margin-top: 2rem; }
.more-like-section h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.more-like-grid { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: .5rem; scrollbar-width: thin; }
.more-like-card { flex: 0 0 130px; text-decoration: none; color: var(--fg); background: var(--card); border: 1px solid var(--border); border-radius: .75rem; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.more-like-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.more-like-card img { width: 100%; height: 190px; object-fit: cover; display: block; }
.more-like-card-title { padding: .4rem .5rem; font-size: .72rem; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== Star Rating Widget ===== */
.star-rating-widget { display: none; align-items: center; gap: .5rem; padding: .5rem 0; flex-wrap: wrap; }
.star-rating-widget.visible { display: flex; }
.star-rating-widget > span { font-size: .85rem; font-weight: 600; color: var(--fg-muted); }
.star-rating-widget .stars { display: flex; gap: .2rem; }
.star-btn { font-size: 1.6rem; cursor: pointer; color: var(--border); transition: color .1s, transform .1s; background: none; border: none; padding: 0; line-height: 1; }
.star-btn:hover, .star-btn.hovered { color: #f59e0b; transform: scale(1.15); }

/* ===== Genre Filter Bar ===== */
.genre-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0 .5rem; }
.genre-chip { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--fg); font-size: .78rem; font-weight: 600; cursor: pointer; transition: all .2s; white-space: nowrap; }
.genre-chip:hover { background: var(--accent-soft); border-color: var(--accent); }
.genre-chip.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ===== For You / Suggestions Tab ===== */
.suggestions-section { padding: 1rem 0; }
.suggestions-section .suggestions-empty { text-align: center; padding: 3rem 1rem; color: var(--fg-muted); }
.suggestions-section .suggestions-empty p { margin: .5rem 0; }
.suggestions-group { margin-bottom: 2rem; }
.suggestions-group h3 { font-size: 1rem; font-weight: 700; margin: 0 0 .75rem; color: var(--fg-muted); }

/* ===== Search Autocomplete Dropdown ===== */
.search-wrapper { position: relative; }
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  /* --card is 6% white in dark mode, so results and the page header showed through. */
  background: color-mix(in srgb, var(--bg) 92%, var(--fg)); border: 1px solid var(--border);
  border-radius: .9rem; box-shadow: 0 12px 40px rgba(0,0,0,.55);
  z-index: 9999; overflow: hidden;
  opacity: 0; visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.search-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
@keyframes sdi-in { from { opacity:0; transform:translateX(-4px); } to { opacity:1; transform:none; } }
.search-dropdown-item { animation: sdi-in .15s ease both; }
.search-spell-hint {
  padding: .55rem .85rem; font-size: .78rem; color: var(--fg-muted);
  border-bottom: 1px solid var(--border); background: var(--accent-soft);
}
.search-spell-hint strong { color: var(--accent); cursor: pointer; font-weight: 700; }
.search-dropdown-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .85rem; cursor: pointer; text-decoration: none;
  color: var(--fg); transition: background .12s; border-bottom: 1px solid var(--border);
}
.search-dropdown-item:last-child { border-bottom: none; }
.search-dropdown-item:hover { background: var(--accent-soft); }
.search-dropdown-thumb {
  width: 34px; height: 50px; object-fit: cover; border-radius: .35rem;
  flex-shrink: 0; background: var(--bg);
}
.search-dropdown-info { flex: 1; min-width: 0; }
.search-dropdown-title {
  font-size: .83rem; font-weight: 700;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.search-dropdown-sub { font-size: .7rem; color: var(--fg-muted); margin-top: .1rem; }
.search-dropdown-badge {
  font-size: .6rem; font-weight: 700; padding: .1rem .45rem;
  border-radius: 999px; flex-shrink: 0; text-transform: uppercase; letter-spacing: .04em;
}
.sdb--movie  { background: rgba(124,58,237,.18); color: #a78bfa; }
.sdb--tv     { background: rgba(16,185,129,.18);  color: #6ee7b7; }
.sdb--anime  { background: rgba(239,68,68,.18);   color: #fca5a5; }

/* ===== Genre tags on browse cards ===== */
.card-genres { display: flex; flex-wrap: wrap; gap: .3rem; padding: .35rem .5rem .1rem; }
.card-genre-tag {
  font-size: .6rem; font-weight: 700; padding: .15rem .42rem; border-radius: 999px;
  background: rgba(124,58,237,.14); color: var(--accent);
  border: 1px solid rgba(124,58,237,.28); cursor: pointer;
  text-transform: uppercase; letter-spacing: .03em; transition: background .15s;
  white-space: nowrap; line-height: 1.4;
}
.card-genre-tag:hover { background: rgba(124,58,237,.32); }

/* ===== For You full page ===== */
.foryou-page { padding: .5rem 0 3rem; }
.foryou-hero { padding: 1.5rem 0 2rem; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.foryou-hero h2 { font-size: 1.7rem; font-weight: 800; margin: 0 0 .45rem; }
.foryou-hero p { color: var(--fg-muted); margin: 0; font-size: .95rem; }
.foryou-section { margin-bottom: 2.5rem; }
.foryou-section-header { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .9rem; flex-wrap: wrap; }
.foryou-section-header h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.foryou-section-header .foryou-count { font-size: .78rem; color: var(--fg-muted); }
.foryou-section-header a { font-size: .78rem; color: var(--accent); margin-left: auto; text-decoration: none; }
.foryou-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
@media (max-width: 480px) {
  .foryou-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: .6rem; }
}
.foryou-card {
  background: var(--card); border: 1px solid var(--border); border-radius: .85rem;
  overflow: hidden; text-decoration: none; color: var(--fg);
  transition: transform .15s, box-shadow .15s; display: block;
}
.foryou-card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px rgba(0,0,0,.45); }
.foryou-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.foryou-card-info { padding: .45rem .5rem .5rem; }
.foryou-card-title {
  font-size: .75rem; font-weight: 700; margin: 0 0 .25rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.foryou-card-meta { font-size: .65rem; color: var(--fg-muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.foryou-type-badge {
  font-size: .55rem; font-weight: 700; padding: .1rem .35rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em;
}
.foryou-type-badge.movie  { background: rgba(124,58,237,.2); color: #a78bfa; }
.foryou-type-badge.tv     { background: rgba(16,185,129,.2);  color: #6ee7b7; }
.foryou-type-badge.anime  { background: rgba(239,68,68,.2);   color: #fca5a5; }
.foryou-empty { text-align: center; padding: 4rem 1rem; color: var(--fg-muted); }
.foryou-empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.foryou-empty h3 { margin: 0 0 .5rem; font-size: 1.15rem; color: var(--fg); }
.foryou-empty p { margin: 0 0 1.25rem; }

/* ===== Person badge + round thumb ===== */
.sdb--person { background: rgba(251,191,36,.18); color: #fbbf24; }
.search-dropdown-thumb--round { border-radius: 50%; object-fit: cover; }

/* ===== Reviews section ===== */
.reviews-section { margin-top: 2rem; }
.reviews-section h2 { margin: 0 0 .75rem; font-size: 1.2rem; }
.review-card {
  background: var(--card); border: 1px solid var(--border); border-radius: .9rem;
  padding: 1rem 1.1rem; margin-bottom: .85rem;
}
.review-card-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .45rem; flex-wrap: wrap; }
.review-author { font-weight: 700; font-size: .88rem; }
.review-rating { font-size: .78rem; color: #f59e0b; }
.review-date { font-size: .72rem; color: var(--fg-muted); margin-left: auto; }
.review-content { font-size: .85rem; line-height: 1.55; color: var(--fg-muted); }
.review-content.collapsed { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.review-toggle { background: none; border: none; color: var(--accent); font-size: .78rem; cursor: pointer; padding: .2rem 0 0; display: block; }

/* ===== Comments section ===== */
.comments-section { margin-top: 2rem; }
.comments-section h2 { margin: 0 0 .75rem; font-size: 1.2rem; }
.comment-form { display: flex; gap: .5rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.comment-input {
  flex: 1; min-width: 160px; padding: .6rem .85rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: .5rem;
  color: var(--fg); font-family: inherit; font-size: .88rem; resize: none;
}
.comment-input:focus { outline: none; border-color: var(--accent); }
.comment-submit { padding: .6rem 1.2rem; background: var(--accent); color: white; border: none; border-radius: .5rem; font-weight: 700; cursor: pointer; font-size: .85rem; }
.comment-submit:hover { opacity: .9; }
.comment-submit:disabled { opacity: .5; cursor: not-allowed; }
.comment-card { display: flex; gap: .65rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.comment-card:last-child { border-bottom: none; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: white; font-size: .85rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-username { font-weight: 700; font-size: .82rem; margin-bottom: .2rem; }
.comment-text { font-size: .83rem; color: var(--fg-muted); line-height: 1.5; word-break: break-word; }
.comment-time { font-size: .7rem; color: var(--fg-muted); margin-top: .2rem; }
.comments-list { max-height: 440px; overflow-y: auto; }
.comment-empty { font-size: .85rem; color: var(--fg-muted); padding: .5rem 0; }

/* ===== Person detail page ===== */
.person-detail { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.person-hero { display: grid; grid-template-columns: 200px 1fr; gap: 2rem; margin-bottom: 2.5rem; }
@media (max-width: 600px) { .person-hero { grid-template-columns: 1fr; } }
.person-photo { width: 100%; border-radius: 1rem; object-fit: cover; aspect-ratio: 2/3; background: var(--card); }
.person-photo-placeholder { width: 200px; height: 300px; border-radius: 1rem; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.person-name { font-size: 2rem; font-weight: 800; margin: 0 0 .35rem; }
.person-dept { font-size: .88rem; color: var(--accent); font-weight: 600; margin-bottom: .75rem; }
.person-meta { font-size: .82rem; color: var(--fg-muted); margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.person-bio { font-size: .88rem; line-height: 1.65; color: var(--fg-muted); }
.person-bio.collapsed { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.person-filmography h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 1rem; }
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); gap: 1rem; }
.person-card { text-decoration: none; color: var(--fg); }
.person-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: .6rem; display: block; transition: transform .2s; }
.person-card:hover img { transform: scale(1.04); }
.person-card-title { font-size: .73rem; font-weight: 600; margin: .35rem 0 .15rem; }
.person-card-sub { font-size: .67rem; color: var(--fg-muted); }

/* ===== Cast popularity + person card rating ===== */
.cast-pop { display: block; font-size: .62rem; color: var(--fg-muted); margin-top: .15rem; }
.person-card-rating { color: #f59e0b; font-size: .65rem; font-weight: 700; }
.show-more-btn { display: block; margin: 1.5rem auto 0; padding: .6rem 2rem; background: var(--accent); color: #fff; border: none; border-radius: 8px; font-size: .9rem; font-weight: 600; cursor: pointer; transition: opacity .2s; }
.show-more-btn:hover { opacity: .85; }

/* ─── Home nav fit and small text-link tap targets ───────────────────
   The four home links (Home, Movies, TV Shows, Anime) needed ~373px, so "Anime" sat
   behind a scroll strip on phones. Tighten them so all four fit at 320px and up.
   "See all" and footer links were 18-19px tall; give them a 44px hit area. */
@media (max-width: 900px) {
  /* 129px of two-row header should not stay pinned on a phone held sideways. */
  .navbar--home { position: relative; }
}
@media (max-width: 480px) {
  .navbar--home .nav-tabs { gap: 2px; padding-inline: 2px; }
  .navbar--home .nav-link { padding: 8px 10px; }
}
@media (max-width: 380px) {
  .navbar--home .nav-link { padding: 8px 7px; font-size: 0.88rem; }
}
.home-section__link,
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.footer-links a { padding-inline: 6px; }
.footer-links a:focus-visible,
.home-section__link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Person page: "Read more" and "Show more" were 17px and 35px tall. */
#bioToggle { min-height: 44px; padding: .5rem 0; }
.show-more-btn { min-height: 44px; }
/* Brand link on every page that uses it was 42px. */
.nav-brand-link { min-height: 44px; }

/* ─── Reduced motion ─────────────────────────────────────────────────
   The site had no prefers-reduced-motion handling (smooth scroll, hover lifts, modal and
   dropdown entrance animations). Keep state changes (colour, outline), drop the movement. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .modal, .modal-overlay, .search-dropdown, .search-dropdown-item { animation: none !important; }
  .search-dropdown { transform: none; transition: opacity .01s, visibility .01s; }
  .icon-btn:hover, .pill-btn:hover { transform: none; }
}

/* Light theme: the pastel dropdown badge text was 2.3:1 on the light list; darken to >= 4.5:1. */
html[data-theme="light"] .sdb--movie { color: #6d28d9; }
html[data-theme="light"] .sdb--tv    { color: #047857; }
html[data-theme="light"] .sdb--anime { color: #b91c1c; }

/* ─── Accent as text colour ──────────────────────────────────────────
   --accent (#7c3aed dark, #a78bfa light) is a fill colour: as small text it measured
   2.7-3.0:1 on dark and 2.1-2.6:1 on light. This text-only token clears 4.5:1 on both
   themes; fills keep using --accent. */
:root { --accent-text: #a78bfa; }
html[data-theme="light"] { --accent-text: #6d28d9; }
.home-section__link,
.footer-links a,
.card-genre-tag { color: var(--accent-text); }
.footer-links a:hover { color: var(--fg); }
