:root {
  --bg: #0e0e12;
  --surface: #16161e;
  --surface2: #1e1e29;
  --border: #2a2a38;
  --border-strong: #3a3a4e;
  --accent: #a78bfa;
  --accent-deep: #7c6cf0;        /* single-family partner for the one intentional gradient (logo mark) */
  --accent-strong: #8b5cf6;      /* hover / active / press */
  --accent-soft: rgba(167,139,250,0.12);
  --accent2: #f472b6;            /* retained for back-compat; no longer painted on UI chrome */
  --text: #ececf4;
  --muted: #9a9ab8;              /* lightened from #7878a0 so nav/secondary text clears WCAG AA */
  --rating: #fbbf24;
  --max-w: 1400px;
  --px: 1.5rem;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--px);
}

.icon { display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }

/* ── NAV ───────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14, 14, 18, 0.8);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--px);
  height: 64px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

/* Logo lockup: wordmark + CSS-drawn play mark (the one intentional gradient) */
.logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-left: 36px;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.logo::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), var(--accent-deep));
  box-shadow: 0 3px 12px rgba(124,108,240,0.45), inset 0 1px 0 rgba(255,255,255,0.3);
}
.logo::after {
  content: '';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #fff;
}

.nav-links { display: flex; align-items: center; gap: 0.2rem; list-style: none; }
.nav-links > li { position: relative; }
.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease;
}
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.045); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: -3px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  width: 210px;
  transition: width 0.25s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  width: 250px;
}
.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.88rem;
  width: 100%;
}
.search-bar input::placeholder { color: var(--muted); }
.search-icon { color: var(--muted); flex-shrink: 0; display: block; transition: color 0.18s ease; }
.search-bar:focus-within .search-icon { color: var(--accent); }

/* Sign In — ghost button (no gradient) */
.btn-login {
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1.05rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.1s ease;
}
.btn-login:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-login:active { transform: translateY(1px); }

.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 6px; flex-shrink: 0; background: none; border: none; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.25s ease, opacity 0.25s ease; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu { display: none; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0.85rem var(--px) 1.1rem; gap: 0.1rem; }
.mobile-menu.open { display: flex; }
.mobile-search {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.6rem 0.8rem; margin-bottom: 0.7rem;
}
.mobile-search input { background: none; border: none; outline: none; color: var(--text); font-size: 0.95rem; width: 100%; }
.mobile-search input::placeholder { color: var(--muted); }
.mobile-menu a { color: var(--muted); text-decoration: none; font-size: 0.98rem; font-weight: 500; padding: 0.7rem 0.55rem; border-radius: 8px; transition: color 0.18s ease, background 0.18s ease; }
.mobile-menu a:hover, .mobile-menu a.active { color: var(--text); background: rgba(255,255,255,0.045); }
.mobile-menu a.active { box-shadow: inset 2px 0 0 var(--accent); }

/* Collapse to hamburger early enough that the full bar never wraps */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .search-bar, .btn-login { display: none; }
}

main { padding: 2rem 0 4rem; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.page-title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.page-subtitle { color: var(--muted); font-size: 0.86rem; margin-top: 0.35rem; }

.tool-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 20px;
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
  text-decoration: none;
}

.filter-pill:hover, .filter-pill.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(167,139,250,0.12);
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.card:hover { transform: translateY(-3px); border-color: rgba(167,139,250,0.35); }

.poster {
  width: 100%;
  aspect-ratio: 2/3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: rgba(255,255,255,0.14);
  overflow: hidden;
}

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

.score {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.72);
  border-radius: 5px;
  color: var(--rating);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
}

.card-body { padding: 0.7rem 0.75rem 0.8rem; }
.card-title { font-size: 0.9rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.35rem; }
.card-meta { color: var(--muted); font-size: 0.76rem; display: flex; justify-content: space-between; gap: 0.5rem; }

.rank-list { display: grid; gap: 0.75rem; }
.rank-card {
  display: grid;
  grid-template-columns: 52px 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem;
  color: inherit;
  text-decoration: none;
}

.rank-num { font-size: 1.8rem; font-weight: 900; color: var(--accent); text-align: center; }
.rank-poster { width: 56px; height: 84px; border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; font-weight: 800; color: rgba(255,255,255,0.14); }
.rank-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rank-title { font-weight: 800; margin-bottom: 0.2rem; }
.rank-meta { color: var(--muted); font-size: 0.78rem; }
.rank-score { color: var(--rating); font-weight: 800; }

.actor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.9rem;
}

.actor-card {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  color: inherit;
  text-decoration: none;
}

.actor-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: rgba(255,255,255,0.82);
  flex-shrink: 0;
  overflow: hidden;
}

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

.actor-name { font-weight: 800; margin-bottom: 0.18rem; }
.actor-meta { color: var(--muted); font-size: 0.78rem; line-height: 1.4; }

.empty-state {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  padding: 1rem;
  font-size: 0.88rem;
}

footer {
  border-top: 1px solid var(--border);
  padding: 2rem var(--px);
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

@media (max-width: 700px) {
  :root { --px: 1rem; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .series-grid { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
  .rank-card { grid-template-columns: 42px 50px minmax(0, 1fr); }
  .rank-score { display: none; }
}

@media (max-width: 420px) {
  .series-grid { grid-template-columns: repeat(2, 1fr); }
}
