:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #151922;
  --muted: #687382;
  --line: #dbe1ea;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --chip: #eef2f6;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
h1 { margin: 0; font-size: 22px; line-height: 1.1; letter-spacing: 0; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.tabs { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.tab {
  border: 0;
  padding: 8px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  cursor: pointer;
}
.tab.active { background: var(--ink); color: #fff; }

main { min-height: calc(100vh - 72px); }
.view { display: none; }
.view.active { display: block; }
#galleryView.active { display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.filters {
  position: sticky;
  top: 73px;
  height: calc(100vh - 73px);
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #fff;
  overflow: auto;
}
.filters label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.filters input, .filters select {
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-transform: none;
}
.content { padding: 18px; }
.cards { display: grid; gap: 18px; }
.card {
  display: grid;
  grid-template-columns: minmax(280px, 38%) minmax(0, 1fr);
  min-height: 430px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.cover {
  position: relative;
  background: #101216;
  min-height: 430px;
  cursor: zoom-in;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cardBody { padding: 16px 18px 18px; min-width: 0; }
.cardHead { display: flex; gap: 12px; justify-content: space-between; align-items: start; }
.card h2 { margin: 0; font-size: 21px; line-height: 1.18; letter-spacing: 0; }
.meta { color: var(--muted); font-size: 13px; margin: 8px 0; }
.premise { margin: 10px 0 12px; line-height: 1.5; color: #2c3440; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.chip { padding: 4px 7px; border-radius: 999px; background: var(--chip); color: #3e4754; font-size: 12px; line-height: 1.1; }
.confidence { color: #fff; background: #334155; }
.confidence.low { background: #a15c07; }
.confidence.medium { background: #2563eb; }
.confidence.high { background: #047857; }
.episodes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 9px;
}
.episode {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #101216;
}
.episode .preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.episode img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; display: block; }
.epBar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.76));
  color: #fff;
  font-size: 12px;
}
.playBadge {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: #111;
  font-weight: 800;
}
.episode.playing .playBadge { background: var(--accent); color: var(--accent-ink); }
.zoomBtn {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255,255,255,.36);
  border-radius: 5px;
  background: rgba(0,0,0,.46);
  color: #fff;
  cursor: zoom-in;
  font-size: 14px;
  line-height: 1;
}

.report {
  max-width: 1080px;
  margin: 0 auto;
  padding: 30px 24px 70px;
  background: #fff;
  min-height: calc(100vh - 72px);
}
.report h1, .report h2, .report h3 { letter-spacing: 0; }
.report h1 { font-size: 30px; }
.report h2 { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line); }
.report p, .report li { line-height: 1.65; }
.report table { width: 100%; border-collapse: collapse; margin: 14px 0 22px; font-size: 14px; }
.report th, .report td { border: 1px solid var(--line); padding: 8px 9px; text-align: left; vertical-align: top; }
.report th { background: #f8fafc; }
.report code { background: #eef2f6; padding: 1px 4px; border-radius: 4px; }

.lightbox {
  width: min(1180px, 94vw);
  height: min(900px, 92vh);
  padding: 0;
  border: 0;
  background: #05070a;
  color: #fff;
}
.lightbox::backdrop { background: rgba(0, 0, 0, .82); }
.lightbox figure {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
}
.lightbox img {
  max-width: 100%;
  max-height: calc(100% - 64px);
  object-fit: contain;
}
.lightbox figcaption {
  min-height: 44px;
  padding: 10px 72px 16px;
  color: #d7dde7;
  text-align: center;
}
.icon {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.09);
  color: #fff;
  cursor: pointer;
}
.close { top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; font-size: 28px; line-height: 1; }
.nav { top: 50%; width: 44px; height: 70px; border-radius: 8px; font-size: 44px; transform: translateY(-50%); }
.prev { left: 14px; }
.next { right: 14px; }

@media (max-width: 900px) {
  .topbar { align-items: stretch; flex-direction: column; }
  #galleryView.active { display: block; }
  .filters { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .card { grid-template-columns: 1fr; }
  .cover { min-height: 340px; }
}
