/* ─── Design tokens ─────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;
  --bg:        #0b0c0f;
  --surface:   #13151a;
  --surface-2: #1c1f28;
  --surface-3: #252936;
  --text:      #f0f1f5;
  --muted:     #8b92a8;
  --subtle:    #3d4259;
  --accent:    #e63946;
  --accent-2:  #c1121f;
  --gold:      #f4c430;
  --line:      rgba(255,255,255,0.08);
  --radius:    10px;
  --radius-sm: 6px;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.55);
  --shadow-glow: 0 0 40px rgba(230,57,70,0.18);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ─── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 clamp(16px, 4vw, 56px);
  height: 62px;
  background: rgba(11,12,15,0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  flex-shrink: 0;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
}

.search-form {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.search-form input {
  width: 220px;
  height: 38px;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  transition: border-color 0.15s, width 0.2s;
}

.search-form input:focus {
  outline: none;
  border-color: var(--accent);
  width: 280px;
}

.search-form button {
  height: 38px;
  padding: 0 16px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.search-form button:hover { background: var(--accent-2); }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px clamp(16px, 4vw, 56px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 48px;
}

.footer-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-extra {
  font-size: 0.8rem;
  color: var(--subtle);
}

hr.separator {
    margin-top: 6rem;
    border: 3px solid var(--gold);
    text-align: center;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* ─── Home body content ──────────────────────────────────────────────────── */
.home-body-content {
  max-width: 960px;
  color: var(--text);
  line-height: 1.75;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  margin-top: 6rem;
}

.home-body-content h1,
.home-body-content h2,
.home-body-content h3,
.home-body-content h4 {
  color: var(--text);
  margin: 1.4em 0 0.5em;
  font-weight: 700;
}

.home-body-content h2 { font-size: 1.2rem; }
.home-body-content h3 { font-size: 1rem; }

.home-body-content p { margin-bottom: 0.9em; }

.home-body-content a { color: var(--gold); font-weight:bold; }
.home-body-content a:hover { text-decoration: underline; }

.home-body-content ul,
.home-body-content ol {
  padding-left: 1.4em;
  margin-bottom: 0.9em;
}

.home-body-content li { margin-bottom: 0.3em; }

.home-body-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.6em 0;
}

.home-body-content code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}

/* ─── Breadcrumbs ────────────────────────────────────────────────────────── */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 14px clamp(16px, 4vw, 56px) 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.breadcrumbs a:hover { color: var(--text); }

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 52vh;
  display: flex;
  align-items: center;
  padding: clamp(56px, 10vw, 100px) clamp(16px, 4vw, 56px);
  background: var(--surface);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 80% at 10% 60%, rgba(230,57,70,0.14) 0%, transparent 65%),
    radial-gradient(ellipse 50% 60% at 80% 20%, rgba(100,80,200,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}

.hero-inner {
  position: relative;
  max-width: 680px;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 5px 12px;
  background: rgba(230,57,70,0.12);
  border: 1px solid rgba(230,57,70,0.25);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #fff 40%, rgba(255,255,255,0.55));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 20px rgba(230,57,70,0.35);
}

.btn-primary:hover { background: var(--accent-2); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-ghost:hover { background: var(--surface-3); }

/* ─── Section ────────────────────────────────────────────────────────────── */
.section {
  padding: 40px clamp(16px, 4vw, 56px);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-heading h1,
.section-heading h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  position: relative;
  padding-left: 14px;
}

.section-heading h1::before,
.section-heading h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.section h1,
.section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

.section-title-accent {
  position: relative;
  padding-left: 14px;
}

.section-title-accent::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.section-heading a {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.section-heading a:hover {
  color: var(--text);
  border-color: var(--subtle);
}

.section-heading p,
.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ─── Poster grid ────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 18px;
  align-items: start;
}

.poster-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.poster-card-link {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-card);
  /* Force the link box to the poster's natural 2:3 ratio */
  aspect-ratio: 2 / 3;
}

.poster-card-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, opacity 0.2s;
}

.poster-card-link:hover img {
  transform: scale(1.04);
  opacity: 0.85;
}

.poster-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.25s;
  display: flex;
  align-items: flex-end;
  padding: 12px;
}

.poster-card-link:hover .poster-card-overlay {
  opacity: 1;
}

.poster-card-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 4px;
  box-shadow: 0 2px 12px rgba(230,57,70,0.5);
}

.poster-card-play svg {
  width: 14px;
  height: 14px;
  fill: #fff;
  margin-left: 2px;
}

.rating {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  border: 1px solid rgba(244,196,48,0.2);
}

.poster-card h3 {
  margin: 10px 0 3px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.poster-card h3 a:hover { color: var(--accent); }

.poster-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ─── Filters ────────────────────────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.filters select,
.filters input,
input,
select {
  height: 40px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  transition: border-color 0.15s;
}

.filters select:focus,
.filters input:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

.filters select { min-width: 160px; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover, .button:hover { background: var(--accent-2); border-color: var(--accent-2); }

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 32px;
}

.pagination a {
  display: inline-flex;
  min-width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.88rem;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.pagination a:hover { color: var(--text); background: var(--surface-2); }

.pagination a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

/* ─── Detail hero ────────────────────────────────────────────────────────── */
.detail-hero {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: end;
  min-height: 60vh;
  padding: clamp(48px, 8vw, 96px) clamp(16px, 4vw, 56px) clamp(36px, 5vw, 56px);
  background-position: center top;
  background-size: cover;
  position: relative;
}

.detail-poster {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  position: relative;
  z-index: 1;
}

.detail-copy {
  position: relative;
  z-index: 1;
}

.detail-copy h1 {
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 10px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tagline {
  color: var(--muted);
  font-size: 1rem;
  font-style: italic;
  margin-bottom: 4px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.meta-row span {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  font-size: 0.82rem;
  color: var(--text);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.badges a {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 0.82rem;
  transition: color 0.15s, background 0.15s;
}

.badges a:hover {
  color: var(--text);
  background: var(--surface-3);
}

.watch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.watch-button {
  min-width: 140px;
  height: 46px;
  padding: 0 22px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(230,57,70,0.35);
  transition: background 0.15s, transform 0.1s;
}

.watch-button:hover { background: var(--accent-2); }
.watch-button:active { transform: scale(0.97); }

/* ─── Detail grid ────────────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 480px);
  gap: 36px;
}

.detail-grid p {
  color: var(--muted);
  line-height: 1.7;
}

.detail-grid h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 22px 0 8px;
  color: var(--text);
}

.detail-grid h2:first-child { margin-top: 0; }

/* ─── Video ──────────────────────────────────────────────────────────────── */
.video {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-tabs { display: grid; gap: 14px; }

.tab-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-buttons button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  height: 36px;
  padding: 0 14px;
  font-size: 0.85rem;
}

.tab-buttons button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Episodes ───────────────────────────────────────────────────────────── */
.episode-accordion { display: grid; gap: 10px; }

.season-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.season-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  padding: 0 20px;
  list-style: none;
  cursor: pointer;
  transition: background 0.15s;
}

.season-panel summary:hover { background: var(--surface-2); }
.season-panel summary::-webkit-details-marker { display: none; }

.season-panel summary strong {
  margin-right: 10px;
  color: var(--accent);
}

.season-panel summary span:last-child {
  color: var(--muted);
  font-size: 0.85rem;
}

.episode-list {
  display: grid;
  gap: 2px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
}

.episode-row {
  display: grid;
  grid-template-columns: 32px 88px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 68px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  padding: 8px 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.episode-row:hover, .episode-row.active { background: var(--surface-2); }

.episode-number { color: var(--muted); text-align: right; font-size: 0.85rem; }

.episode-thumb {
  display: block;
  width: 88px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 5px;
  background: var(--surface-3);
}

.episode-thumb img { width: 100%; height: 100%; object-fit: cover; }

.episode-copy { display: grid; gap: 2px; overflow: hidden; }

.episode-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.episode-copy small { color: var(--muted); font-size: 0.8rem; }

.episode-play {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(230,57,70,0.15);
  flex-shrink: 0;
}

.episode-play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 53%;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--accent);
  transform: translate(-50%, -50%);
}

/* ─── Accordion (generic) ────────────────────────────────────────────────── */
details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 18px;
}

summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
}

summary span { color: var(--muted); font-weight: 500; }

/* ─── Search ─────────────────────────────────────────────────────────────── */
.search-large input { flex: 1 1 280px; }

/* ─── 404 ────────────────────────────────────────────────────────────────── */
.not-found {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

/* ─── Admin (public-side remnants kept for safety) ───────────────────────── */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px clamp(16px, 4vw, 56px) 0;
}

.admin-nav a,
.admin-message {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 9px 12px;
  color: var(--muted);
}

.admin-nav a:hover { color: var(--text); }

.admin-message {
  margin: 12px clamp(16px, 4vw, 56px) 0;
  color: var(--gold);
}

.admin-section h1 { margin-top: 0; }

.admin-stats,
.admin-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.admin-stats article,
.admin-columns article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.admin-stats strong { display: block; font-size: 1.7rem; }
.admin-stats span, .admin-columns p { color: var(--muted); }

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  background: var(--surface);
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.admin-table th { color: var(--muted); font-size: 0.86rem; }
.admin-table small { display: block; color: var(--muted); }

.admin-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.admin-actions button, .admin-actions .button { height: 34px; padding: 0 10px; }

.admin-form { display: grid; max-width: 900px; gap: 14px; }
.admin-form.compact { max-width: none; }
.admin-form label { display: grid; gap: 6px; color: var(--muted); }
.admin-form input, .admin-form select, .admin-form textarea { width: 100%; }

.inline-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.inline-check input { width: auto; }

.admin-output {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #08090b;
  padding: 14px;
  color: var(--muted);
  white-space: pre-wrap;
}

.muted { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.danger { background: #8f1f1f; border-color: #8f1f1f; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .detail-hero,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-poster { max-width: 200px; }

  .episode-row {
    grid-template-columns: 28px 72px minmax(0, 1fr) 30px;
    gap: 10px;
  }

  .episode-thumb { width: 72px; }
}

@media (max-width: 640px) {
  .site-header {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 10px;
  }

  .search-form { margin-left: 0; width: 100%; }
  .search-form input { flex: 1; width: auto; }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
  }

  .hero { min-height: 44vh; }
}
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem auto;
}

td, th {
  border: 1px solid #ddd;
  padding: 8px;
}

tr:nth-child(1){background-color: var(--gold);color:#000;font-weight:bold;}

tr:hover {background-color: #f0f1f5;color:#000;}

th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  background-color: #e63946;
  color: white;
}