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

:root {
  --bg:           #0f0f0f;
  --surface:      #1a1a1a;
  --surface2:     #242424;
  --border:       #2e2e2e;
  --accent:       #00c9ff;
  --accent2:      #0099cc;
  --accent-glow:  rgba(0,201,255,0.18);
  --text:         #f0f0f0;
  --text-dim:     #bbbbbb;
  --text-muted:   #777777;
  --nav-h:        64px;
  --radius:       8px;
  --radius-sm:    4px;
  --ease:         0.2s ease;
  --shadow:       0 8px 32px rgba(0,0,0,0.6);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

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

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ─── Navbar ─────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #141414;
  border-bottom: 1px solid #1f1f1f;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0 24px;
  height: 58px;
  gap: 16px;
}
.nav-logo {
  font-size: 22px;
  font-weight: 900;
  color: #e50914;
  letter-spacing: -1px;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  gap: 2px;
  list-style: none;
}
.nav-links a {
  color: #999;
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 14px;
  transition: color var(--ease), background var(--ease);
}
.nav-links a:hover,
.nav-links a.active { color: #fff; background: #252525; }
.nav-spacer { flex: 1; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e1e1e;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  padding: 8px 14px;
  width: 210px;
  transition: border-color var(--ease), background var(--ease);
}
.search-box:focus-within {
  border-color: #555;
  background: #252525;
}
.search-box svg { color: #666; flex-shrink: 0; }
.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  width: 100%;
}
.search-box input::placeholder { color: #666; }

/* Hamburger button — hidden on desktop */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: .25s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .nav { position: relative; height: 52px; padding: 0 14px; gap: 10px; flex-wrap: nowrap; }
  .nav-toggle { display: flex; }
  .search-box { width: 130px; }

  /* Hide links by default on mobile; show as dropdown when .open */
  .nav-links {
    display: none;
    position: absolute;
    top: 52px;
    left: 0; right: 0;
    z-index: 500;
    flex-direction: column;
    background: #181818;
    border-bottom: 2px solid #e50914;
    box-shadow: 0 12px 32px rgba(0,0,0,.85);
    padding: 6px 0 14px;
    gap: 0;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    padding: 14px 20px;
    border-radius: 0;
    font-size: 15px;
    color: #ccc;
    border-bottom: 1px solid #222;
  }
  .nav-links li:last-child a { border-bottom: none; }
  .nav-links a:hover,
  .nav-links a.active { color: #fff; background: #1e1e1e; }
}

/* ─── Search Overlay ─────────────────────────────────────── */
.search-overlay {
  position: sticky;
  top: 58px;
  left: 0; right: 0;
  background: rgba(12,12,12,0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 20px 40px;
  z-index: 99;
  max-height: 72vh;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.search-overlay.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
.search-overlay-title {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}
.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  max-width: 1000px;
}
.search-no-results {
  color: var(--text-muted);
  font-size: 14px;
  padding: 16px 0;
}

/* ─── Hero ───────────────────────────────────────────────── */
.hero {
  position: relative;
  height: 600px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 0 60px 60px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  filter: brightness(0.45) saturate(1.1);
  transition: background-image 0.4s ease;
}
.hero-gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(15,15,15,0.95) 35%, rgba(15,15,15,0.3) 70%, transparent 100%),
    linear-gradient(to top, var(--bg) 0%, rgba(15,15,15,0.5) 30%, transparent 60%);
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 540px;
}
.hero-badge {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 3px;
  margin-bottom: 14px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.hero-title {
  font-size: 44px;
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}
.hero-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
}
.hero-score { color: #ffd700; font-weight: 700; }
.hero-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.65;
  margin-bottom: 26px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--ease);
  text-decoration: none;
  line-height: 1;
}
.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-secondary {
  background: rgba(255,255,255,0.12);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.15);
}
.btn-secondary:hover { background: rgba(255,255,255,0.2); }

/* ─── Content / Rows ─────────────────────────────────────── */
.content {
  padding: 0 40px 60px;
  margin-top: -30px;
  position: relative;
  z-index: 1;
}
.section { margin-bottom: 40px; }
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dim);
}
.section-link {
  font-size: 12px;
  color: var(--accent);
  margin-left: auto;
  transition: color var(--ease);
}
.section-link:hover { color: var(--accent2); text-decoration: underline; }

.row-wrap { position: relative; }
.row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 4px 0 10px;
}
.row::-webkit-scrollbar { display: none; }
.row-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 80px;
  background: rgba(10,10,10,0.9);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3;
  border-radius: var(--radius-sm);
  font-size: 18px;
  transition: background var(--ease), color var(--ease);
}
.row-btn:hover { background: var(--surface2); color: var(--text); }
.row-btn.prev { left: -38px; }
.row-btn.next { right: -38px; }
.row-wrap:hover .row-btn { display: flex; }

/* ─── Card ───────────────────────────────────────────────── */
.card {
  flex-shrink: 0;
  width: 152px;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: transform var(--ease), box-shadow var(--ease);
  position: relative;
}
.card:hover {
  transform: scale(1.07) translateY(-4px);
  box-shadow: var(--shadow);
  z-index: 2;
}
.card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--surface2);
}
.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter var(--ease);
}
.card:hover .card-poster { filter: brightness(0.55); }
.card-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--ease);
}
.card:hover .card-play-icon { opacity: 1; }
.card-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #000;
  box-shadow: 0 0 16px var(--accent-glow);
}
.card-body {
  padding: 8px 10px 10px;
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  color: var(--text);
}
.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
  gap: 4px;
}
.card-score { color: #ffd700; font-weight: 600; }
.card-remarks {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Browse Page ────────────────────────────────────────── */
.page-header {
  padding: 28px 40px 0;
  margin-bottom: 24px;
}
.page-title { font-size: 30px; font-weight: 900; margin-bottom: 24px; }
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 7px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--ease);
}
.tab:hover { border-color: rgba(0,201,255,0.4); color: var(--text); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }
.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--ease);
}
.filter-select:focus { border-color: var(--accent); }
.filter-spacer { flex: 1; }
.result-count { font-size: 12px; color: var(--text-muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 16px;
  padding: 0 40px;
}
.grid .card { width: 100%; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 36px 40px;
  flex-wrap: wrap;
}
.pg-btn {
  min-width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  transition: all var(--ease);
}
.pg-btn:hover:not(:disabled):not(.active) { border-color: var(--accent); color: var(--accent); }
.pg-btn.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }
.pg-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ─── Detail Page ────────────────────────────────────────── */
.detail-hero {
  position: relative;
  min-height: 500px;
  padding-top: var(--nav-h);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.detail-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 15%;
  filter: brightness(0.3) saturate(0.9);
}
.detail-gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(15,15,15,1) 40%, rgba(15,15,15,0.7) 65%, transparent 100%),
    linear-gradient(to top, var(--bg) 0%, transparent 60%);
}
.detail-info {
  position: relative;
  z-index: 1;
  padding: 48px 60px 52px;
  max-width: 680px;
}
.detail-title {
  font-size: 42px;
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 14px;
  letter-spacing: -0.5px;
}
.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}
.badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
}
.badge.accent-badge {
  background: var(--accent-glow);
  border-color: rgba(0,201,255,0.3);
  color: var(--accent);
}
.detail-score {
  font-size: 30px;
  font-weight: 900;
  color: #ffd700;
  margin-bottom: 4px;
}
.detail-score small { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.detail-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 20px;
  max-width: 560px;
}
.detail-meta-row {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.detail-meta-row strong { color: var(--text-dim); font-weight: 600; }

/* Player */
.player-section {
  padding: 0 60px 32px;
  position: relative;
  z-index: 1;
}
.player-wrap {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 960px;
  aspect-ratio: 16/9;
  position: relative;
  box-shadow: var(--shadow);
}
.player-wrap video {
  width: 100%;
  height: 100%;
  display: block;
}
.player-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  cursor: pointer;
  background: var(--surface);
  transition: background var(--ease);
}
.player-placeholder:hover { background: var(--surface2); }
.play-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #000;
  transition: transform var(--ease), box-shadow var(--ease);
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.player-placeholder:hover .play-ring {
  transform: scale(1.08);
  box-shadow: 0 0 32px var(--accent-glow);
}
.player-placeholder p { color: var(--text-muted); font-size: 13px; }
.player-loading {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.player-loading.show { display: flex; }
.player-error {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #ff6b6b;
  font-size: 14px;
}
.player-error.show { display: flex; }
.player-error button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

/* Audio / Episode controls */
.player-controls-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  max-width: 960px;
  flex-wrap: wrap;
}
.controls-label { font-size: 12px; color: var(--text-muted); }
.audio-btn {
  padding: 5px 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all var(--ease);
}
.audio-btn:hover { border-color: var(--accent); color: var(--text); }
.audio-btn.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }

.episodes-section {
  padding: 0 60px 60px;
  position: relative;
  z-index: 1;
}
.eps-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.eps-title { font-size: 18px; font-weight: 700; }
.eps-count { font-size: 13px; color: var(--text-muted); }
.eps-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ep-btn {
  width: 58px;
  height: 38px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ep-btn:hover { border-color: var(--accent); color: var(--text); background: var(--surface2); }
.ep-btn.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }

/* ─── Skeleton ───────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-card { flex-shrink: 0; width: 152px; }
.skel-poster { aspect-ratio: 2/3; width: 100%; border-radius: var(--radius); }
.skel-line { height: 11px; margin-top: 9px; }
.skel-line.short { width: 55%; }

/* ─── Empty / Error ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 32px;
  color: var(--text-muted);
}
.empty-icon { font-size: 52px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; color: var(--text-dim); margin-bottom: 8px; font-weight: 600; }
.empty-state p { font-size: 14px; }

/* ─── Spinner ────────────────────────────────────────────── */
.spin {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .nav { padding: 0 20px; gap: 16px; }
  .nav-links { display: none; }
  .search-box { width: 180px; }
  .search-box:focus-within { width: 230px; }

  .hero { height: 460px; padding: 0 24px 44px; }
  .hero-title { font-size: 30px; }
  .hero-gradient {
    background:
      linear-gradient(to right, rgba(15,15,15,0.98) 100%, transparent),
      linear-gradient(to top, var(--bg) 0%, transparent 50%);
  }

  .content { padding: 0 20px 40px; }
  .card { width: 130px; }
  .skel-card { width: 130px; }

  .search-overlay { padding: 16px 20px; }
  .page-header { padding: 16px 20px 0; }
  .grid { padding: 0 20px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .pagination { padding: 24px 20px; }

  .detail-info { padding: 32px 20px 40px; }
  .detail-title { font-size: 26px; }
  .player-section { padding: 0 20px 24px; }
  .episodes-section { padding: 0 20px 40px; }
  .player-controls-bar { max-width: 100%; }
}
