/* ─── Theme Variables ─── */
:root {
  --bg: #ffffff;
  --surface: #f0f0f0;
  --border: #d8d8d8;
  --text: #080808;
  --text-muted: #505050;
  --green: #ff0000;
  --card-overlay: rgba(0,0,0,0.78);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 28px rgba(0,0,0,0.16);
  --radius: 0px;
  --font-mono: 'Space Mono', 'Courier New', Courier, monospace;
  --font-sans: 'Barlow', system-ui, -apple-system, sans-serif;
  --rating-green: #00a832;
  --rating-yellow: #d4a000;
  --rating-red: #d63030;
}

[data-theme="dark"] {
  --bg: #141414;
  --surface: #222222;
  --border: #3d3d3d;
  --text: #ffffff;
  --text-muted: #b3b3b3;
  --green: #ff0000;
  --card-overlay: rgba(0,0,0,0.80);
  --shadow: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-hover: 0 8px 28px rgba(255,0,0,0.18);
  --rating-green: #00e83a;
  --rating-yellow: #f0c000;
  --rating-red: #ff3333;
}

/* ─── Accessibility ─── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 700;
  transition: background 0.2s, color 0.2s;
  min-height: 100vh;
}
button { cursor: pointer; border: none; background: none; color: inherit; font-family: inherit; }
select, input { font-family: inherit; color: inherit; }
a { color: inherit; }

/* ─── Header ─── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.header-inner {
  max-width: 2400px;
  margin: 0 auto;
  padding: 0 16px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}
.logo-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
}
.logo-accent { color: var(--green); }
[data-theme="dark"] .logo-text { text-shadow: 0 0 18px rgba(255,0,0,0.3); }

/* ─── Site Nav ─── */
.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}
.nav-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 10px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); border-bottom-color: var(--green); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── Hamburger ─── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.nav-toggle:hover { border-color: var(--green); color: var(--green); }
.nav-toggle span {
  display: block;
  width: 14px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 46px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    z-index: 99;
    gap: 0;
  }
  .site-nav.open { display: flex; }
  .nav-link {
    padding: 10px 20px;
    font-size: 0.8rem;
    width: 100%;
    border-bottom: none;
    border-left: 2px solid transparent;
  }
  .nav-link:hover { border-left-color: var(--green); }
  .nav-link.active { border-left-color: var(--green); border-bottom: none; }
}

/* ─── Static page content ─── */
.page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}
.page-content h1 {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text);
  margin-bottom: 8px;
}
.page-content .page-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  margin-bottom: 40px;
}
.page-content h2 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  margin: 36px 0 12px;
}
.page-content p {
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.page-content a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.page-content a:hover { color: var(--green); }
.page-content ul {
  list-style: none;
  padding: 0;
  margin-bottom: 14px;
}
.page-content ul li {
  color: var(--text-muted);
  line-height: 1.75;
  font-size: 0.95rem;
  padding-left: 18px;
  position: relative;
  margin-bottom: 4px;
}
.page-content ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--green);
}
.page-content .contact-email {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 20px;
  text-decoration: none;
}
.page-content .contact-email:hover { border-color: var(--green); color: var(--green); }
.page-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}
.page-footer {
  border-top: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  justify-content: center;
}
.page-footer-inner {
  max-width: 800px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.page-footer-inner a { color: var(--text-muted); text-decoration: none; }
.page-footer-inner a:hover { color: var(--text); }

.theme-toggle {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--green); color: var(--green); }
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ─── Tabs ─── */
.tabs {
  max-width: 2400px;
  margin: 0 auto;
  padding: 10px 16px 0;
  display: flex;
  gap: 6px;
}
.tab-btn {
  padding: 5px 16px;
  border: 1px solid var(--border);
  border-radius: 0;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: all 0.15s;
  background: transparent;
}
.tab-btn:hover { border-color: var(--green); color: var(--green); }
.tab-btn.active {
  background: var(--green);
  color: var(--bg);
  border-color: var(--green);
}

/* ─── Filter Bar ─── */
.filter-bar {
  max-width: 2400px;
  margin: 0 auto;
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
}

.filter-top-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filter-search {
  min-width: 0;
}
.filter-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}
.filter-toggle-btn:hover,
.filter-toggle-btn[aria-expanded="true"] { border-color: var(--green); color: var(--green); }
.filter-count {
  background: var(--green);
  color: var(--bg);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 900;
  border-radius: 0;
  padding: 1px 5px;
  line-height: 1.4;
}

/* Collapsible advanced panel — collapsed by default on all sizes */
.filter-advanced {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease, margin-top 0.28s ease;
  margin-top: 0;
}
.filter-advanced.open {
  max-height: 500px;
  margin-top: 8px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filter-year-pair {
  display: flex;
  gap: 8px;
}
.filter-input, .filter-select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.filter-input:focus, .filter-select:focus { border-color: var(--green); }
.filter-input { min-width: 140px; }
.filter-year { min-width: 90px; max-width: 110px; }
.filter-year::-webkit-inner-spin-button,
.filter-year::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.filter-year { -moz-appearance: textfield; }
.filter-select { min-width: 130px; }

.filter-rating-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
}
.filter-label {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filter-slider {
  width: 80px;
  accent-color: var(--green);
  cursor: pointer;
}
.filter-mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green);
  min-width: 32px;
}

/* ─── Filter Chips ─── */
.filter-chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  min-height: 24px;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 0;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--green);
  background: var(--surface);
}
.chip-remove {
  font-size: 0.9rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 0 2px;
  transition: color 0.1s;
}
.chip-remove:hover { color: var(--green); }
.clear-btn {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.clear-btn:hover { border-color: var(--rating-red); color: var(--rating-red); }

/* ─── Main Grid (Masonry via CSS columns) ─── */
.main {
  max-width: 2400px;
  margin: 0 auto;
  padding: 14px;
}
.grid {
  columns: 2;
  column-gap: 10px;
}
@media (min-width: 500px)  { .grid { columns: 3; } }
@media (min-width: 900px)  { .grid { columns: 4; } }
@media (min-width: 1200px) { .grid { columns: 5; } }
@media (min-width: 1500px) { .grid { columns: 6; } }
@media (min-width: 1800px) { .grid { columns: 7; } }
@media (min-width: 2100px) { .grid { columns: 8; } }

/* ─── Cards ─── */
.card {
  break-inside: avoid;
  display: block;
  position: relative;
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 10px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  background: var(--surface);
}
.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--green);
}
.card-img-wrap {
  display: block;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.card-img-wrap.loading {
  padding-top: 150%;
  background: var(--surface);
}
.card-img-wrap.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
[data-theme="light"] .card-img-wrap.loading::after {
  background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.06) 50%, transparent 100%);
  background-size: 200% 100%;
}
.card-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s;
}
.card-img-wrap:not(.loading) img {
  opacity: 1;
}
.card-img-wrap:not(.loading) {
  padding-top: 0;
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.card-placeholder {
  width: 100%;
  padding-top: 150%;
  background: hsl(calc(var(--hue) * 1deg), 18%, 16%);
  position: relative;
}
[data-theme="light"] .card-placeholder {
  background: hsl(calc(var(--hue) * 1deg), 12%, 86%);
}
.card-placeholder::after {
  content: attr(data-initials);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 900;
  color: rgba(255,0,0,0.5);
  letter-spacing: 0.08em;
}
[data-theme="light"] .card-placeholder::after {
  color: rgba(0,0,0,0.3);
}

.card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 8px 7px;
  background: linear-gradient(transparent, var(--card-overlay));
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.card-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-year {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
}
.card-rating {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 0;
  background: rgba(0,0,0,0.5);
}
.rating-green { color: var(--rating-green); }
.rating-yellow { color: var(--rating-yellow); }
.rating-red { color: var(--rating-red); }

/* ─── Sentinel / Loading / Empty / Error ─── */
.sentinel {
  display: flex;
  justify-content: center;
  padding: 24px 0;
  min-height: 64px;
}
.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.end-message {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.1em;
  align-self: center;
}
.empty-state, .error-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-family: var(--font-mono);
  width: 100%;
}
.error-state button {
  margin-top: 12px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 0;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 700;
  transition: all 0.15s;
  cursor: pointer;
}
.error-state button:hover { border-color: var(--green); color: var(--green); }

/* ─── Go-to-Top ─── */
.go-top {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: var(--bg);
  border-radius: 0;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
}
.go-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.go-top:hover { opacity: 0.85; }

/* ─── Modal ─── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
}
.modal-box {
  position: relative;
  z-index: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-hover);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 1.5rem;
  font-family: var(--font-mono);
  font-weight: 900;
  color: var(--text-muted);
  z-index: 2;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 0;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--green); }

@media (max-width: 640px) {
  .modal-close {
    font-size: 2rem;
    padding: 10px 12px;
    top: 6px;
    right: 8px;
  }
}

.modal-content {
  display: flex;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.modal-left {
  width: 210px;
  flex-shrink: 0;
  padding: 18px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.modal-poster {
  width: 100%;
  height: auto;
  border-radius: 0;
  display: block;
  border: 1px solid var(--border);
}
.modal-show-title {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.3;
}
.modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-year {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}
.modal-rating {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 0;
  background: var(--surface);
}
.modal-overview {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.modal-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.modal-seasons {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.season-label {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.season-select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  outline: none;
  min-width: 130px;
}
.season-select:focus { border-color: var(--green); }

.modal-episodes {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.episode-list { display: flex; flex-direction: column; }
.episode-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  font-size: 0.8rem;
}
.episode-item:hover { background: var(--surface); }
.episode-item:hover .ep-num { color: var(--green); }
.episode-item:last-child { border-bottom: none; }
.ep-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--text-muted);
  min-width: 34px;
  flex-shrink: 0;
  transition: color 0.1s;
}
.ep-title {
  flex: 1;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}
.ep-dl-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.1s, transform 0.1s;
  cursor: pointer;
  padding: 4px;
  margin: -4px;
}
.ep-dl-icon:hover { color: var(--green); transform: scale(1.2); }
.episode-item:hover .ep-dl-icon { color: var(--green); }
.ep-date {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.modal-error {
  padding: 16px 18px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ─── Search debounce dot ─── */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.search-wrap .filter-search {
  width: 100%;
}
.search-dot {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.search-dot.active {
  opacity: 1;
  animation: pulse-dot 0.6s ease-in-out infinite alternate;
}
@keyframes pulse-dot {
  from { opacity: 0.4; transform: translateY(-50%) scale(0.8); }
  to   { opacity: 1;   transform: translateY(-50%) scale(1.2); }
}

/* ─── Card badge (always-visible rating) ─── */
.card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 900;
  padding: 2px 5px;
  background: rgba(0,0,0,0.72);
  border-radius: 0;
  line-height: 1.4;
  z-index: 2;
  letter-spacing: 0.03em;
}

/* ─── Skeleton card (no overlay, just shimmer) ─── */
.skeleton-card .card-img-wrap.loading {
  min-height: 180px;
}

/* ─── Active episode highlight ─── */
.episode-item.active {
  background: var(--surface);
}
.episode-item.active .ep-num {
  color: var(--green);
}

/* ─── Season keyboard hint ─── */
.season-hint {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-left: auto;
  opacity: 0.6;
}

/* ─── Share chip ─── */
.share-chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.share-chip:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ─── Mobile styles ─── */
@media (max-width: 640px) {
  .tabs { padding: 8px 10px 0; }
  .tab-btn { padding: 5px 13px; font-size: 0.76rem; }
  .filter-bar { padding: 8px 10px 6px; }
  .main { padding: 8px; }
  .grid { column-gap: 7px; }
  .card { margin-bottom: 7px; }

  /* Mobile filter — stack full width */
  .filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .filter-year-pair { gap: 6px; }
  .filter-input, .filter-select {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  /* iOS zoom prevention — font-size must be ≥16px on any focused input */
  input, select, textarea, .filter-input, .filter-select, .season-select {
    font-size: 16px !important;
  }
  .filter-year { max-width: none; }
  .filter-year-pair .filter-year { flex: 1; }
  .filter-rating-wrap { height: auto; padding: 4px 0; }
  .filter-slider { flex: 1; width: auto; }

  /* Mobile modal — full screen */
  .modal-box {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
  .modal-content { flex-direction: column; }

  /* Compact header row in modal */
  .modal-left {
    width: 100%;
    flex-direction: row;
    align-items: flex-start;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    gap: 12px;
    overflow-y: visible;
    flex-shrink: 0;
  }
  .modal-poster {
    width: 64px;
    min-width: 64px;
    flex-shrink: 0;
  }
  .modal-left-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    flex: 1;
    padding-right: 28px; /* room for close btn */
  }
  .modal-show-title { font-size: 0.85rem; }
  /* Hide details only for non-TV modals (TV overrides below) */
  .modal-overview { display: none; }
  .tv-modal-extra { display: none; }

  /* TV modal mobile — full column layout showing all details */
  .tv-modal-box .modal-left {
    position: static;
    max-height: none;
    overflow-y: visible;
    flex-direction: column;
    align-items: flex-start;
    padding: 44px 16px 16px;
    gap: 12px;
    flex-shrink: 0;
  }
  .tv-modal-box .modal-poster {
    width: 110px;
    min-width: 110px;
    align-self: center;
  }
  .tv-modal-box .modal-left-text {
    padding-right: 0;
    width: 100%;
  }
  .tv-modal-box .modal-show-title { font-size: 1rem; }
  .tv-modal-box .modal-overview {
    display: block;
    -webkit-line-clamp: 6;
  }
  .tv-modal-box .tv-modal-extra { display: flex; }
}

/* ─── Focus visible ─── */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ─── NEW badge ─── */
.card-new-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 2px 5px;
  background: var(--green);
  color: #fff;
  border-radius: 0;
  z-index: 2;
  line-height: 1.4;
}

/* ─── Empty state Google fallback ─── */
.empty-google-link {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}
.empty-google-link:hover { opacity: 0.8; }

/* ─── Footer ─── */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 28px 16px 24px;
  background: var(--bg);
}
.footer-inner {
  max-width: 2400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 28px 48px;
  align-items: flex-start;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}
.footer-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-right: 4px;
}
.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--green); }
.footer-copy {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}
.footer-tmdb { display: flex; align-items: center; }
.footer-tmdb-logo {
  height: 13px;
  width: auto;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.footer-tmdb:hover .footer-tmdb-logo { opacity: 1; }

/* ─── Movie Modal ─── */
.movie-modal-box {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  position: relative;
  z-index: 1;
}
.movie-modal-info {
  display: flex;
  gap: 20px;
  padding: 40px 20px 20px;
  flex: 1;
}
.movie-modal-poster {
  width: 130px;
  min-width: 130px;
  height: auto;
  object-fit: cover;
  border: 1px solid var(--border);
  align-self: center;
  flex-shrink: 0;
}
.movie-modal-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.movie-modal-title {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.2;
}
.movie-modal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.movie-modal-year {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}
.movie-modal-runtime {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}
.movie-modal-rating {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 900;
  padding: 1px 6px;
  background: var(--surface);
  border-radius: 0;
}
.movie-modal-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.movie-genre-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.movie-modal-overview {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cast-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.cast-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding-bottom: 4px;
}
.cast-item {
  flex-shrink: 0;
  width: 68px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.cast-item img {
  width: 68px;
  height: 92px;
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
}
.cast-photo-ph {
  width: 68px;
  height: 92px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-muted);
}
.cast-name {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cast-char {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.movie-download-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.movie-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: none;
  transition: border-color 0.15s, color 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.movie-dl-btn:hover { border-color: var(--green); color: var(--green); }
.movie-dl-primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.movie-dl-primary:hover { opacity: 0.85; color: #fff; }

/* ─── Movie card context menu ─── */
.movie-ctx-menu {
  position: fixed;
  z-index: 500;
  display: none;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 140px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
.movie-ctx-menu.open { display: flex; }
.movie-ctx-opt {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.12s, background 0.12s;
}
.movie-ctx-opt:last-child { border-bottom: none; }
.movie-ctx-opt:hover { color: var(--text); background: var(--bg); }

/* ─── Episode mirror popover ─── */
.ep-mirror-popover {
  position: fixed;
  z-index: 500;
  display: none;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 140px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
.ep-mirror-popover.open { display: flex; }
.ep-mirror-opt {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.12s, background 0.12s;
}
.ep-mirror-opt:last-child { border-bottom: none; }
.ep-mirror-opt:hover { color: var(--text); background: var(--bg); }

@media (max-width: 640px) {
  .movie-modal-box {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border: none;
  }
  .movie-modal-info {
    flex-direction: column;
    padding: 14px;
    gap: 14px;
  }
  .movie-modal-poster {
    width: 100px;
    min-width: 100px;
  }
  .movie-modal-title { font-size: 0.95rem; }
  .movie-modal-overview { -webkit-line-clamp: 4; }
}

/* ─── Theme cross-fade transition ─── */
.theme-transitioning *:not(img):not(video):not(svg):not(path):not(line):not(polyline):not(circle) {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
}

/* ─── Genre pills on cards ─── */
.card-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}
.card-genre-pill {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  border-radius: 0;
  cursor: pointer;
  transition: background 0.12s;
  line-height: 1.5;
}
.card-genre-pill:hover {
  background: var(--green);
  color: #fff;
}

/* ─── Season progress ─── */
.season-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.season-progress-text {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.season-progress-track {
  width: 60px;
  height: 3px;
  background: var(--border);
  flex-shrink: 0;
}
.season-progress-fill {
  height: 100%;
  background: var(--green);
  transition: width 0.3s;
}

/* ─── Similar shows in modal ─── */
.modal-similar {
  border-top: 1px solid var(--border);
  padding: 10px 0 0;
  flex-shrink: 0;
}
.similar-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 18px 8px;
}
.similar-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 18px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.similar-card {
  flex-shrink: 0;
  width: 64px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.similar-card img {
  width: 64px;
  height: 96px;
  object-fit: cover;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
  display: block;
}
.similar-card:hover img { border-color: var(--green); }
.similar-name {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ─── Print styles ─── */
@media print {
  .header, .tabs, .filter-bar, .go-top, .modal,
  .footer, #sentinel { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .main { padding: 0; max-width: 100%; }
  .grid { columns: 4; column-gap: 8px; }
  .card { break-inside: avoid; border: 1px solid #ccc; margin-bottom: 8px; }
  .card-img-wrap img { max-height: 160px; width: auto; margin: 0 auto; display: block; }
  .card-overlay { position: static; background: none; padding: 4px; }
  .card-title { color: #000; font-size: 8pt; -webkit-line-clamp: 1; }
  .card-year, .card-badge { color: #555; font-size: 7pt; }
  .card-new-badge { background: #000; }
  a[href]::after { content: none; }
}

/* ─── Clickable cast items ─── */
.clickable-cast {
  cursor: pointer;
  transition: opacity 0.15s;
}
.clickable-cast:hover { opacity: 0.75; }
.clickable-cast img,
.clickable-cast .cast-photo-ph {
  outline: 2px solid transparent;
  transition: outline-color 0.15s;
}
.clickable-cast:hover img,
.clickable-cast:hover .cast-photo-ph { outline-color: var(--green); }

/* ─── Movie modal similar section ─── */
.movie-modal-similar {
  padding: 0 20px 18px;
}

/* ─── TV modal — full episode list, whole modal scrolls ─── */
.tv-modal-box {
  overflow-y: auto;
  overflow-x: hidden;
}
.tv-modal-box .modal-content {
  flex: none;
  overflow: visible;
  min-height: 0;
}
.tv-modal-box .modal-left {
  overflow-y: visible;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.tv-modal-box .modal-right {
  overflow: visible;
  min-height: 0;
}
.tv-modal-box .modal-seasons {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.tv-modal-box .modal-episodes {
  flex: none;
  overflow-y: visible;
  height: auto;
}

/* ─── TV modal extra (genres, status, cast) ─── */
.tv-modal-extra {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.tv-modal-status {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.tv-modal-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* ─── Person Modal ─── */
.person-modal-box {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  position: relative;
  z-index: 1;
}
.person-modal-header {
  display: flex;
  gap: 20px;
  padding: 48px 20px 16px;
}
.person-modal-photo {
  width: 120px;
  min-width: 120px;
  height: 180px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.person-modal-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.person-modal-name {
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1.2;
}
.person-modal-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
}
.person-modal-bio {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.person-credits-section {
  padding: 0 20px 20px;
}
.person-credits-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.person-modal-credits { overflow: hidden; }
.person-credits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}
.person-credit-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: opacity 0.15s;
}
.person-credit-card:hover { opacity: 0.75; }
.person-credit-img-wrap {
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s;
  position: relative;
}
.person-credit-img-wrap.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 25%, var(--border) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.person-credit-card:hover .person-credit-img-wrap { border-color: var(--green); }
.person-credit-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.person-credit-name {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 640px) {
  .person-modal-box {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border: none;
  }
  .person-modal-header {
    padding: 44px 14px 14px;
    gap: 12px;
  }
  .person-modal-photo {
    width: 80px;
    min-width: 80px;
    height: 120px;
  }
  .person-modal-name { font-size: 1rem; }
  .person-credits-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
  }
  .tv-modal-box .modal-left {
    position: static;
    overflow-y: visible;
    max-height: none;
  }
  .tv-modal-box .modal-seasons {
    position: sticky;
    top: 0;
  }
}

/* ─── Scrollbar (Webkit) ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--green); }
