:root {
  --bg: #0e0f13;
  --bg-alt: #16181f;
  --card: #1c1f28;
  --text: #eceef2;
  --muted: #9198a8;
  --accent: #7c5cff;
  --accent-2: #ff5c8a;
  --radius: 10px;
  --maxw: 1280px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  scroll-behavior: smooth;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* Header */

header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(14, 15, 19, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #ffffff12;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

header form {
  display: flex;
  align-items: center;
  background: var(--bg-alt);
  border: 1px solid #ffffff1a;
  border-radius: 999px;
  padding: 6px 6px 6px 16px;
  min-width: 260px;
  flex: 0 1 420px;
}

header input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  flex: 1;
  font-size: 14px;
}

header button {
  background: var(--accent);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-link {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

/* Sections */

section { padding: 32px 0 0; }

h2.section-title {
  font-size: 20px;
  margin: 0 0 16px;
  padding-left: 24px;
}

/* Poster grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  padding: 0 24px 8px;
}

.poster-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease;
}

.poster-card:hover { transform: translateY(-4px); }

.poster-card .thumb {
  aspect-ratio: 2 / 3;
  background: #22242e;
  overflow: hidden;
}

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

.poster-card .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #000000b0;
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
}

.poster-card .badge.right { left: auto; right: 8px; background: var(--accent); }

.poster-card .info { padding: 8px 10px 10px; }

.poster-card .info h3 {
  font-size: 13px;
  margin: 0;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.poster-card .info .meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Hero slider */

.hero {
  position: relative;
  height: 46vh;
  min-height: 320px;
  max-height: 520px;
  overflow: hidden;
  border-radius: 0 0 var(--radius) var(--radius);
}

.hero-slide {
  position: absolute;
  inset: 0;
  display: none;
  background-size: cover;
  background-position: center;
}

.hero-slide.active { display: block; }

.hero-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, var(--bg) 0%, rgba(14,15,19,0.35) 55%, rgba(14,15,19,0.05) 100%);
}

.hero-info {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 28px;
  max-width: 640px;
  z-index: 2;
}

.hero-info .spot { color: var(--accent-2); font-weight: 700; font-size: 13px; text-transform: uppercase; }
.hero-info h1 { font-size: clamp(22px, 4vw, 40px); margin: 6px 0 10px; }
.hero-info p { color: var(--muted); font-size: 14px; max-height: 4.5em; overflow: hidden; }

.hero-actions { margin-top: 14px; display: flex; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn.secondary { background: #ffffff1a; }

.hero-nav {
  position: absolute;
  bottom: 28px;
  right: 24px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.hero-nav button {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid #ffffff40;
  background: #00000060;
  color: #fff;
  cursor: pointer;
}

/* Loader */

.loader {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid #ffffff22;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Detail page */

.detail-hero {
  position: relative;
  padding: 32px 24px;
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, #1a1c25 0%, var(--bg) 100%);
}

.detail-poster {
  width: 220px;
  flex: 0 0 220px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  aspect-ratio: 2/3;
}

.detail-poster img { width: 100%; height: 100%; object-fit: cover; }

.detail-main { flex: 1 1 380px; min-width: 260px; }
.detail-main h1 { font-size: 30px; margin: 0 0 10px; }

.detail-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-tags span {
  background: #ffffff14; color: var(--muted); font-size: 12px;
  padding: 4px 10px; border-radius: 999px;
}

.synopsis { color: #c7cbd6; line-height: 1.6; font-size: 14px; max-width: 640px; }

.detail-side {
  flex: 0 0 260px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
}

.detail-side .item { margin-bottom: 10px; }
.detail-side .item .label { color: var(--muted); display: block; margin-bottom: 2px; }
.detail-side .genres a {
  display: inline-block; background: #ffffff14; padding: 3px 9px;
  border-radius: 999px; margin: 2px 4px 0 0; font-size: 11px;
}

.ep-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  padding: 0 24px 8px;
}

.ep-btn {
  background: var(--card);
  border-radius: 8px;
  padding: 10px 0;
  text-align: center;
  font-size: 13px;
  border: 1px solid transparent;
}

.ep-btn:hover { border-color: var(--accent); }
.ep-btn.playing { background: var(--accent); color: #fff; }

/* Watch page */

.player-wrap {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 24px;
}

video { width: 100%; max-height: 75vh; display: block; background: #000; }

.watch-title { padding: 18px 24px 0; }
.watch-title h1 { font-size: 20px; margin: 0; }
.watch-title .muted { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Error / empty states */

.state-msg {
  text-align: center;
  color: var(--muted);
  padding: 60px 24px;
}

/* Admin */

.admin-box {
  max-width: 640px;
  margin: 60px auto;
  padding: 28px;
  background: var(--card);
  border-radius: var(--radius);
}

.admin-box h1 { margin-top: 0; font-size: 20px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field textarea,
.field select {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid #ffffff1f;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

.field textarea { min-height: 80px; resize: vertical; }
.field input[type="file"] { color: var(--muted); font-size: 13px; }
.field.inline { display: flex; align-items: center; gap: 8px; }
.field.inline label { margin: 0; }

.admin-titles-list { max-width: 900px; margin: 0 auto 60px; }
.admin-title-row {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
}
.admin-title-row img { width: 46px; height: 66px; object-fit: cover; border-radius: 6px; }
.admin-title-row .grow { flex: 1; }
.admin-title-row .muted { color: var(--muted); font-size: 12px; }
.admin-title-row button, .admin-ep-row button {
  background: #ffffff14; border: none; color: var(--text);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.admin-title-row button.danger, .admin-ep-row button.danger { background: #ff3b5c33; color: #ff8ba0; }

.admin-ep-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #ffffff10; font-size: 13px;
}
.admin-ep-row .grow { flex: 1; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 40px 24px 60px;
}

@media (max-width: 640px) {
  header { flex-wrap: wrap; }
  header form { order: 3; flex-basis: 100%; }
  .detail-hero { padding: 20px 16px; }
  .detail-poster { width: 140px; flex-basis: 140px; }
}
