:root {
  --ink: #17151f;
  --ink-soft: #232030;
  --paper: #f3efe4;
  --line: #2c2838;

  --coral: #ff6b4a;
  --gold: #ffc93c;
  --teal: #2fbf9f;
  --violet: #8b7cf6;

  --font-display: 'Fredoka', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;

  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
}

/* ---------- Topbar ---------- */
.topbar {
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
}
.brand {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
}
.brand-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.5px;
  text-transform: lowercase;
}
.brand-dot { color: var(--coral); }

.view { padding: 32px 28px 64px; max-width: 1080px; margin: 0 auto; }
.hidden { display: none; }

/* ---------- Hero carousel (full-bleed, Netflix-style) ---------- */
.hero-carousel {
  position: relative;
  width: 100%;
  height: 62vh;
  min-height: 340px;
  max-height: 620px;
  overflow: hidden;
  background: var(--ink-soft);
}

.hero-slides { position: absolute; inset: 0; }
.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.hero-slide.active { opacity: 1; }

.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(23,21,31,0.35) 0%, rgba(23,21,31,0.15) 35%, rgba(23,21,31,0.95) 92%),
    linear-gradient(90deg, rgba(23,21,31,0.85) 0%, rgba(23,21,31,0.15) 45%);
}

.hero-content {
  position: absolute;
  left: 0; right: 0; bottom: 56px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px;
}
.hero-content h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  margin: 0 0 8px;
  max-width: 640px;
}
.hero-content p {
  margin: 0 0 18px;
  opacity: 0.8;
  max-width: 520px;
}
.hero-play {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  background: var(--paper);
  color: var(--ink);
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.hero-play:hover { transform: scale(1.04); }

.hero-dots {
  position: absolute;
  right: 28px;
  bottom: 60px;
  display: flex;
  gap: 8px;
}
.hero-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(243,239,228,0.35);
  border: none;
  cursor: pointer;
  padding: 0;
}
.hero-dot.active { background: var(--gold); }

/* ---------- Show grid section (below hero) ---------- */
.show-grid-view { padding-top: 40px; }
.section-label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0 0 20px;
  text-align: center;
}

.show-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
  gap: 24px;
  justify-content: center;
}

.show-card {
  --accent: var(--coral);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: none;
  border: none;
  color: var(--paper);
  cursor: pointer;
  padding: 0;
}
.show-card .card-poster {
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--line);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.show-card .card-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.show-card:hover .card-poster {
  transform: translateY(-4px);
  border-color: var(--accent);
}
.show-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 12px 0 6px;
}
.show-card .season-count {
  display: inline-block;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
}

.color-coral { --accent: var(--coral); }
.color-gold  { --accent: var(--gold); }
.color-teal  { --accent: var(--teal); }
.color-violet{ --accent: var(--violet); }

/* ---------- Show view ---------- */
.back-btn {
  background: none;
  border: none;
  color: var(--paper);
  opacity: 0.7;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  font-size: 0.95rem;
}
.back-btn:hover { opacity: 1; }

.tagline { margin: 4px 0 0; opacity: 0.65; }

.control-group { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; }
.control-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}

/* Browse layout: sidebar (poster/title/seasons) + episode list */
.show-browse {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  align-items: start;
}

.show-sidebar { display: flex; flex-direction: column; }
.show-sidebar h1 {
  font-family: var(--font-display);
  margin: 18px 0 0;
  font-size: 1.5rem;
}

.poster-frame {
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--line);
  background: var(--ink-soft);
}
.poster-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.season-list { display: flex; flex-direction: column; gap: 8px; }
.season-tab {
  font-family: var(--font-display);
  font-weight: 500;
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--ink-soft);
  color: var(--paper);
  cursor: pointer;
}
.season-tab.active {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}
.ongoing-badge {
  font-family: var(--font-body);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
  margin-left: 4px;
}

.episode-panel { display: flex; flex-direction: column; gap: 10px; }
.episode-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.episode-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--paper);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.episode-item:hover { border-color: var(--teal); transform: translateX(2px); }

.episode-item .episode-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--ink-soft) 55%, rgba(35,32,48,0.4) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
  pointer-events: none;
}
.episode-item:hover .episode-scrim { opacity: 1; }

.episode-item .ep-main {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
}
.episode-item .ep-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}
.episode-item .ep-num {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--teal);
  min-width: 34px;
}
.episode-item .ep-title { font-weight: 500; }

/* Grid-rows trick: animates from 0 height to fit-content with no fixed value needed */
.episode-item .ep-desc-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s ease;
}
.episode-item:hover .ep-desc-wrap { grid-template-rows: 1fr; }
.episode-item .ep-desc {
  overflow: hidden;
  margin: 0;
  padding-top: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  opacity: 0.7;
  text-align: left;
}

.episode-item .ep-thumb-wrap {
  position: relative;
  z-index: 2;
  width: 128px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  align-self: flex-start;
  margin-left: auto;
  background: var(--ink);
}
.episode-item .ep-thumb-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Sharp copy: fully visible at the top, fades out toward the bottom */
.episode-item .ep-thumb-base {
  mask-image: linear-gradient(to bottom, black 35%, transparent 95%);
  -webkit-mask-image: linear-gradient(to bottom, black 35%, transparent 95%);
}
/* Blurred copy: invisible at the top, fades in through the middle */
.episode-item .ep-thumb-blur {
  filter: blur(7px);
  mask-image: linear-gradient(to bottom, transparent 25%, black 80%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 25%, black 80%);
}
/* Final pass: melts the very bottom into the card's own background color */
.episode-item .ep-thumb-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 55%, var(--ink-soft) 100%);
}

/* ---------- Episode player screen ---------- */
.player-episode-title {
  font-family: var(--font-display);
  margin: 4px 0 0;
  font-size: 1.3rem;
}
.episode-desc {
  margin: 0;
  opacity: 0.7;
  line-height: 1.5;
  max-width: 640px;
}

/* ---------- Player ---------- */
.player-stage { display: flex; flex-direction: column; gap: 12px; }
.player-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  border-radius: var(--radius);
  overflow: hidden;
  border: 3px solid var(--line);
  background: #000;
}
.player-frame iframe {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  border: none;
}
.now-playing {
  font-family: var(--font-display);
  opacity: 0.75;
  margin: 0;
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .show-browse { grid-template-columns: 1fr; }
  .poster-frame { max-width: 220px; }
}

@media (max-width: 560px) {
  .view { padding: 24px 16px 48px; }
  .hero-carousel { height: 48vh; min-height: 280px; }
  .hero-content { bottom: 40px; }
  .hero-dots { bottom: 44px; right: 16px; }
}
