/* ============================================
   HentaiZ - Design System
   ============================================ */
:root {
  --bg: #09090b;
  --surface: #111118;
  --surface-2: #18181f;
  --accent: #ff2d7d;
  --secondary: #a855f7;
  --text: #ffffff;
  --muted: #9ca3af;
  --border: rgba(255,255,255,0.06);
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,0.45);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

html.light {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --text: #09090b;
  --muted: #52525b;
  --border: rgba(0,0,0,0.08);
  --shadow: 0 10px 30px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { background: none; border: none; color: inherit; cursor: pointer; font: inherit; }
input { font: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #27272a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3f3f46; }

/* ============================================
   Header
   ============================================ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(9,9,11,0.85);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
html.light .site-header { background: rgba(244,244,245,0.85); }

.header-inner {
  max-width: 1536px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; height: 64px;
}
.menu-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  color: var(--text); transition: var(--transition);
}
.menu-toggle:hover { background: var(--surface-2); }

.site-logo {
  display: flex; align-items: baseline; gap: 2px;
  font-weight: 900; font-size: 22px; letter-spacing: -0.5px;
  color: var(--text); white-space: nowrap;
}
.logo-dot { font-weight: 900; }

.header-nav {
  display: none; align-items: center; gap: 6px; margin-left: 12px;
}
.header-nav-link {
  padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 500;
  color: var(--muted); transition: var(--transition);
}
.header-nav-link:hover { color: var(--text); background: var(--surface-2); }

.header-actions {
  display: flex; align-items: center; gap: 6px; margin-left: auto;
}
.search-toggle, .theme-toggle, .profile-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  color: var(--muted); transition: var(--transition);
}
.search-toggle:hover, .theme-toggle:hover, .profile-btn:hover {
  color: var(--text); background: var(--surface-2);
}
.icon-sun { display: none; }
html.light .icon-moon { display: none; }
html.light .icon-sun { display: block; }

/* Search bar */
.search-bar {
  position: absolute; top: 64px; left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transform: translateY(-100%); opacity: 0; pointer-events: none;
  transition: var(--transition);
}
.search-bar.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.search-inner {
  max-width: 1536px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.search-inner input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 16px;
}
.search-inner input::placeholder { color: var(--muted); }

/* ============================================
   Drawer
   ============================================ */
.nav-drawer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.drawer-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.6); opacity: 0;
  transition: opacity var(--transition); pointer-events: none;
}
.nav-drawer.open { pointer-events: auto; }
.nav-drawer.open .drawer-overlay { opacity: 1; pointer-events: auto; }

.drawer-panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: min(320px, 85vw);
  background: var(--surface);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform var(--transition);
  display: flex; flex-direction: column;
}
.nav-drawer.open .drawer-panel { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border);
}
.drawer-logo { font-weight: 900; font-size: 20px; }
.drawer-close {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.drawer-close:hover { background: var(--surface-2); color: var(--text); }

.drawer-body { flex: 1; overflow-y: auto; padding: 12px; }
.drawer-section { margin-bottom: 16px; }
.drawer-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); padding: 8px 12px;
}
.drawer-section-items { display: flex; flex-direction: column; gap: 4px; }
.nav-drawer-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  font-size: 14px; font-weight: 500; color: var(--text);
  transition: var(--transition);
}
.nav-drawer-link:hover { background: var(--surface-2); }
.nav-drawer-icon { color: var(--muted); display: flex; }
.nav-drawer-link:hover .nav-drawer-icon { color: var(--accent); }

.badge-hot, .badge-new {
  margin-left: auto; font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: 999px; letter-spacing: 0.05em;
}
.badge-hot { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-new { background: rgba(168,85,247,0.15); color: var(--secondary); }

/* ============================================
   Bottom Nav (mobile)
   ============================================ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: center;
  height: 64px; background: rgba(9,9,11,0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
html.light .bottom-nav { background: rgba(255,255,255,0.92); }
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--muted); font-size: 11px; font-weight: 500;
  flex: 1; padding: 8px 0;
}
.bottom-nav-item:hover { color: var(--text); }
.bottom-nav-icon { display: flex; }

/* ============================================
   Announcement
   ============================================ */
.announcement-bar {
  background: linear-gradient(90deg, rgba(255,45,125,0.15), rgba(168,85,247,0.15));
  border-bottom: 1px solid var(--border);
}
.announcement-inner {
  max-width: 1536px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; font-size: 13px;
}
.announcement-text { flex: 1; }
.announcement-close {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1; color: var(--muted);
}
.announcement-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }

/* ============================================
   Layout
   ============================================ */
main { padding-bottom: 96px; }
.main-grid {
  max-width: 1536px; margin: 0 auto; padding: 24px 16px;
  display: grid; grid-template-columns: 1fr; gap: 24px;
}
.content-wrap { display: flex; flex-direction: column; gap: 32px; }

/* ============================================
   Hero
   ============================================ */
.hero-section {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  min-height: 420px;
}
.hero-carousel { position: relative; min-height: 420px; }
.hero-slide {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  transition: opacity 0.6s ease;
  display: grid; grid-template-columns: 1fr;
}
.hero-slide.active { opacity: 1; pointer-events: auto; position: relative; }

.hero-backdrop {
  position: absolute; inset: 0; z-index: 0;
}
.hero-backdrop-img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.6s;
}
.hero-backdrop-img.lazy-loaded { opacity: 1; }
.hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(9,9,11,0.95) 0%, rgba(9,9,11,0.4) 50%, rgba(9,9,11,0.2) 100%);
}

.hero-content {
  position: relative; z-index: 2; padding: 32px 24px;
  display: flex; flex-direction: column; gap: 12px;
  align-self: end;
}
.hero-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.hero-type {
  background: rgba(255,45,125,0.15); color: var(--accent);
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  padding: 4px 10px; border-radius: 8px; letter-spacing: 0.05em;
}
.hero-episode {
  background: var(--surface-2); color: var(--text);
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 8px;
}
.hero-views {
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.hero-title {
  font-size: clamp(24px, 4vw, 40px); font-weight: 900; line-height: 1.1;
  letter-spacing: -0.02em; max-width: 800px;
}
.hero-genres {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.hero-genre {
  font-size: 12px; color: var(--muted); background: rgba(255,255,255,0.06);
  padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border);
}
.hero-desc {
  color: var(--muted); font-size: 14px; max-width: 640px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-studios { font-size: 13px; color: var(--muted); font-weight: 500; }
.hero-actions {
  display: flex; gap: 12px; margin-top: 8px;
}
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; font-weight: 700; font-size: 14px;
  transition: var(--transition);
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 8px 24px rgba(255,45,125,0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(255,45,125,0.35); }
.btn-secondary {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.06); }

.hero-controls {
  position: absolute; bottom: 24px; right: 24px; z-index: 3;
  display: flex; align-items: center; gap: 12px;
}
.hero-arrow {
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--border);
  color: var(--text); display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.hero-arrow:hover { background: rgba(255,255,255,0.14); }
.hero-indicators { display: flex; gap: 8px; }
.hero-indicator {
  width: 32px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.15); position: relative; overflow: hidden;
}
.hero-indicator.active { background: rgba(255,255,255,0.35); }
.indicator-progress {
  position: absolute; inset: 0; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
}
.hero-indicator.active .indicator-progress {
  animation: progress 6s linear forwards;
}
@keyframes progress { to { transform: scaleX(1); } }

/* ============================================
   Sections & Grid
   ============================================ */
.content-section { display: flex; flex-direction: column; gap: 16px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.section-title {
  font-size: 20px; font-weight: 800; letter-spacing: -0.02em;
  position: relative; padding-left: 14px;
}
.section-title::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px;
  border-radius: 2px; background: linear-gradient(180deg, var(--accent), var(--secondary));
}
.section-more {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; color: var(--accent);
  transition: var(--transition);
}
.section-more:hover { gap: 8px; }

.movie-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* ============================================
   Movie Card
   ============================================ */
.movie-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.movie-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow);
  border-color: rgba(255,45,125,0.25);
}
.card-link { display: block; }
.card-poster {
  position: relative; aspect-ratio: 3/4; overflow: hidden;
  background: linear-gradient(135deg, #18181f, #0e0e14);
}
.card-img-wrap { position: absolute; inset: 0; }
.card-img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.5s, transform 0.6s;
}
.card-img.lazy-loaded { opacity: 1; }
.movie-card:hover .card-img { transform: scale(1.06); }

.card-badges {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.badge-type, .badge-ep {
  font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 8px;
  backdrop-filter: blur(8px);
}
.badge-type { background: rgba(168,85,247,0.2); color: #e9d5ff; border: 1px solid rgba(168,85,247,0.25); }
.badge-ep { background: rgba(255,45,125,0.2); color: #ffe4e6; border: 1px solid rgba(255,45,125,0.25); }

.card-overlay {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.25); opacity: 0;
  transition: opacity var(--transition);
}
.movie-card:hover .card-overlay { opacity: 1; }
.card-play {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(255,45,125,0.35);
  transform: scale(0.8); transition: transform var(--transition);
}
.movie-card:hover .card-play { transform: scale(1); }

.card-info { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card-title {
  font-size: 14px; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}
.card-views { display: flex; align-items: center; gap: 4px; }
.card-studio { font-weight: 500; }

/* ============================================
   Sidebar
   ============================================ */
.site-sidebar {
  display: flex; flex-direction: column; gap: 24px;
}
.sidebar-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.sidebar-title {
  font-size: 14px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 14px; color: var(--text);
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
  font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 10px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  transition: var(--transition);
}
.filter-chip:hover {
  color: var(--text); border-color: var(--accent);
  background: rgba(255,45,125,0.08);
}
.sidebar-more {
  display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 600;
  color: var(--accent);
}
.sidebar-more:hover { text-decoration: underline; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-item { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.stat-value { font-size: 18px; font-weight: 900; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }

/* ============================================
   Footer
   ============================================ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 48px 16px 24px;
}
.footer-inner {
  max-width: 1536px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: 32px;
}
.footer-logo { font-weight: 900; font-size: 22px; display: inline-block; margin-bottom: 10px; }
.footer-desc { color: var(--muted); font-size: 14px; max-width: 360px; line-height: 1.6; }
.footer-columns {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px;
}
.footer-col-title {
  font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 12px; color: var(--text);
}
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-link {
  font-size: 14px; color: var(--muted); transition: var(--transition);
}
.footer-link:hover { color: var(--accent); }

.footer-bottom {
  max-width: 1536px; margin: 32px auto 0; padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
  text-align: center;
}
.copyright { font-size: 13px; color: var(--muted); }
.footer-18 { font-size: 12px; color: #ef4444; font-weight: 700; }

/* ============================================
   Responsive
   ============================================ */
@media (min-width: 640px) {
  .movie-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-columns { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .header-nav { display: flex; }
  .bottom-nav { display: none; }
  main { padding-bottom: 24px; }
  .hero-section { min-height: 480px; }
  .hero-content { padding: 40px 32px; }
}
@media (min-width: 1024px) {
  .movie-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
  .main-grid { grid-template-columns: 1fr 300px; gap: 32px; padding: 32px 24px; }
  .hero-section { min-height: 520px; }
}
@media (min-width: 1280px) {
  .movie-grid { grid-template-columns: repeat(5, 1fr); }
  .footer-inner { grid-template-columns: 280px 1fr; }
  .footer-columns { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1536px) {
  .movie-grid { grid-template-columns: repeat(6, 1fr); }
  .main-grid { grid-template-columns: 1fr 340px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
