:root {
  --bg0: #e8eef5;
  --bg1: #d9e5ef;
  --ink: #122033;
  --muted: #4d6075;
  --line: rgba(18, 32, 51, 0.12);
  --brand: #10384f;
  --accent: #0f766e;
  --card: rgba(248, 251, 253, 0.82);
  --ok: #176b4a;
  --warn: #9a6b16;
  --danger: #9b2c2c;
  --shadow: 0 18px 40px rgba(18, 32, 51, 0.1);
  --radius: 18px;
  --font-display: "Newsreader", Georgia, serif;
  --font-ui: "Outfit", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg0), var(--bg1) 55%, #cfdce8);
  line-height: 1.45;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -12%, rgba(15, 118, 110, 0.18), transparent 60%),
    radial-gradient(700px 480px at 92% 0%, rgba(16, 56, 79, 0.16), transparent 55%),
    repeating-linear-gradient(
      -12deg,
      rgba(18, 32, 51, 0.02) 0 2px,
      transparent 2px 8px
    );
  z-index: 0;
}

.topbar, .shell { position: relative; z-index: 1; }

.topbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  background: rgba(232, 238, 245, 0.72);
  animation: drop 0.6s ease both;
}

.brand {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.search {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  max-width: 640px;
}

.search input {
  flex: 1;
  border: 1px solid var(--line);
  background: rgba(248, 251, 253, 0.95);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  font: inherit;
  color: var(--ink);
}

.search button {
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  background: var(--brand);
  color: #eef6fa;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.search button:hover { transform: translateY(-1px); background: #0d2f42; }

.shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.intro {
  margin-bottom: 1.4rem;
  animation: rise 0.7s ease both;
}

.intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  letter-spacing: -0.03em;
  color: var(--brand);
}

.intro p {
  margin: 0.4rem 0 0.9rem;
  color: var(--muted);
  max-width: 42rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.meta-row span,
.chips span,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(248, 251, 253, 0.75);
  font-size: 0.86rem;
}

.ok { color: var(--ok); }
.warn { color: var(--warn); }

.cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.4rem;
  animation: rise 0.8s ease both;
}

.cats a {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(248, 251, 253, 0.7);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-size: 0.92rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.cats a em {
  font-style: normal;
  color: var(--muted);
  margin-left: 0.25rem;
}

.cats a.active,
.cats a:hover {
  background: var(--brand);
  color: #eef6fa;
  border-color: transparent;
}

.cats a.active em,
.cats a:hover em { color: rgba(238, 246, 250, 0.8); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transform: translateY(8px);
  opacity: 0;
  animation: rise 0.55s ease both;
  animation-delay: calc(var(--i, 0) * 30ms);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px rgba(23, 32, 24, 0.12);
}

.poster {
  aspect-ratio: 2 / 3;
  background: #d7ddd8;
  overflow: hidden;
}

.poster img,
.detail-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--brand);
  background: linear-gradient(145deg, #d5e3ec, #eef4f8);
}

.poster-fallback.large { min-height: 420px; font-size: 5rem; }

.card-body { padding: 0.8rem 0.85rem 1rem; }
.card-body h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 700;
}
.card-body p {
  margin: 0.35rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.muted { color: var(--muted); }

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.8rem;
}

.pager a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.banner {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
}

.banner.error {
  background: rgba(143, 45, 45, 0.08);
  color: var(--danger);
}

.empty {
  padding: 2.5rem 0;
  text-align: center;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 1.5rem;
  margin-top: 0.6rem;
  animation: rise 0.65s ease both;
}

.detail-poster {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #d7ddd8;
  min-height: 380px;
}

.detail-copy h1 {
  margin: 0.15rem 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -0.03em;
  color: var(--brand);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
}

.original { margin: 0 0 0.8rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.8rem 0 1rem; }
.plot {
  font-size: 1.05rem;
  max-width: 62ch;
  margin: 0 0 1rem;
}
.crew { margin: 0.25rem 0; color: var(--muted); }
.crew strong { color: var(--ink); }
.ext a { color: var(--accent); font-weight: 600; }
.back {
  display: inline-block;
  margin-bottom: 0.8rem;
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.links {
  margin-top: 2rem;
  animation: rise 0.8s ease both;
}

.links h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin: 0 0 0.8rem;
}

.link-section {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  margin-bottom: 0.7rem;
  overflow: hidden;
}

.link-section summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  font-weight: 700;
}

.link-section summary em {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
}

.episode-stack {
  padding: 0 0.75rem 0.9rem;
  display: grid;
  gap: 0.45rem;
}

.episode-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(248, 251, 253, 0.9);
  overflow: hidden;
}

.episode-section summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.85rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.episode-section summary em {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
}

.host-stack { padding: 0 0.85rem 0.85rem; }
.host-block { margin-top: 0.8rem; }
.host-block h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  color: var(--brand);
}
.quality-block h4 {
  margin: 0.55rem 0 0.35rem;
  font-size: 0.92rem;
  color: var(--accent);
}
.quality-block ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.quality-block li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(16, 56, 79, 0.05);
}
.quality-block a {
  color: #eef6fa;
  background: var(--brand);
  text-decoration: none;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-weight: 600;
  font-size: 0.88rem;
}
.status-alive { color: var(--ok); }
.status-dead { color: var(--danger); }
.status-limit, .status-unknown { color: var(--warn); }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes drop {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 800px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .search { max-width: none; }
  .detail-hero { grid-template-columns: 1fr; }
  .detail-poster { max-width: 260px; }
}
