/* ── VARIABLES ──────────────────────────────────────────────────────────── */
:root {
  --bg: #0d0d0d;
  --bg2: #141414;
  --bg3: #1a1a1a;
  --surface: #1e1e1e;
  --border: #2a2a2a;
  --accent: #00b4d8;
  --accent2: #0077b6;
  --red: #e63946;
  --green: #2dc653;
  --text: #e8e8e8;
  --muted: #888;
  --navy: #0d1117;
}

/* ── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.6; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ── NAVBAR ─────────────────────────────────────────────────────────────── */
#navbar {
  background: var(--navy);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 999;
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; height: 54px;
}
.site-logo {
  font-size: 1.3rem; font-weight: 800; color: var(--accent);
  letter-spacing: -0.5px; white-space: nowrap;
  text-shadow: 0 0 20px rgba(0,180,216,.4);
}
.site-logo span { color: #fff; }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  color: #aaa; font-size: .78rem; font-weight: 600;
  padding: 6px 10px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .3px;
  transition: all .15s; white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color: #fff; background: rgba(255,255,255,.07); }
.nav-links a.active { color: var(--accent); }
.nav-search {
  flex: 1; max-width: 300px; margin-left: auto;
  display: flex; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden; transition: border-color .2s;
}
.nav-search:focus-within { border-color: var(--accent); }
.nav-search input {
  flex: 1; background: none; border: none; color: var(--text);
  padding: 7px 12px; font-size: .82rem; outline: none; font-family: inherit;
}
.nav-search input::placeholder { color: #555; }
.nav-search button {
  background: var(--accent); border: none; color: #fff;
  padding: 0 12px; cursor: pointer; font-size: .85rem;
  transition: background .15s;
}
.nav-search button:hover { background: var(--accent2); }

/* ── SEARCH DROPDOWN ────────────────────────────────────────────────────── */
.search-wrap { position: relative; }
#search-results {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 6px 6px;
  max-height: 400px; overflow-y: auto; display: none; z-index: 999;
}
#search-results.show { display: block; }
.sr-item {
  display: flex; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s;
}
.sr-item:hover { background: var(--bg3); }
.sr-item img { width: 36px; height: 50px; object-fit: cover; border-radius: 3px; flex-shrink: 0; }
.sr-info .sr-title { font-size: .8rem; font-weight: 600; }
.sr-info .sr-meta { font-size: .7rem; color: var(--muted); margin-top: 2px; }

/* ── LAYOUT ─────────────────────────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; padding: 20px 16px; max-width: 1280px; margin: 0 auto; }
@media(max-width:900px) { .layout { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ── SECTION HEADING ────────────────────────────────────────────────────── */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}
.section-title h2 {
  font-size: .88rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .5px; color: var(--accent);
  display: flex; align-items: center; gap: 7px;
}
.section-title h2::before {
  content: ''; width: 3px; height: 16px;
  background: var(--accent); border-radius: 2px;
}
.see-all { font-size: .72rem; color: var(--accent); font-weight: 700; }
.see-all:hover { text-decoration: underline; }

/* ── CARDS GRID ─────────────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px; margin-bottom: 24px;
}
.cards-grid.ep-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ── CARD ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: 6px; overflow: hidden;
  cursor: pointer; transition: transform .2s, box-shadow .2s;
  position: relative;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,180,216,.2); }
.card-thumb {
  position: relative; aspect-ratio: 2/3; background: #111;
  overflow: hidden;
}
.card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s;
}
.card:hover .card-thumb img { transform: scale(1.05); }
.card-thumb .overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.8) 0%, transparent 50%);
}
.badge {
  position: absolute; top: 5px; left: 5px;
  font-size: .6rem; font-weight: 800; padding: 2px 6px;
  border-radius: 3px; text-transform: uppercase;
}
.badge.sub { background: var(--accent); color: #fff; }
.badge.dub { background: #f77f00; color: #fff; }
.badge.ep  { background: var(--red); color: #fff; }
.badge.type { background: rgba(0,0,0,.7); color: #ccc; border: 1px solid #444; }
.views-badge {
  position: absolute; top: 5px; right: 5px;
  font-size: .6rem; color: #ccc; background: rgba(0,0,0,.7);
  padding: 1px 5px; border-radius: 3px;
}
.card-info { padding: 7px 8px 9px; }
.card-title {
  font-size: .74rem; font-weight: 700; line-height: 1.35;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  color: var(--text);
}
.card-meta { font-size: .68rem; color: var(--muted); margin-top: 3px; }
.card-ep { font-size: .7rem; color: var(--accent); font-weight: 700; margin-top: 2px; }
.card-time { font-size: .65rem; color: var(--muted); }
.card-rating { color: #ffc107; font-size: .7rem; margin-top: 2px; }

/* ── TABS ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab-btn {
  padding: 5px 14px; border-radius: 20px; font-size: .75rem; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.tab-btn:hover, .tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── PAGINATION ─────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 5px; flex-wrap: wrap; padding: 16px 0; }
.pagination a, .pagination span {
  padding: 6px 12px; border-radius: 4px; font-size: .78rem; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: all .15s;
}
.pagination a:hover, .pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── SIDEBAR ────────────────────────────────────────────────────────────── */
.sidebar-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden; margin-bottom: 16px;
}
.sidebar-box-title {
  background: var(--navy); padding: 10px 14px;
  font-size: .78rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .4px; color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
.top-item {
  display: flex; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid var(--border); transition: background .1s;
  cursor: pointer;
}
.top-item:last-child { border-bottom: none; }
.top-item:hover { background: var(--bg3); }
.top-rank {
  background: var(--accent); color: #fff; font-size: .65rem;
  font-weight: 800; min-width: 22px; height: 22px;
  border-radius: 3px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.top-rank.gold { background: #ffc107; color: #000; }
.top-rank.silver { background: #aaa; color: #000; }
.top-rank.bronze { background: #cd7f32; }
.top-info .top-title { font-size: .76rem; font-weight: 700; line-height: 1.3; }
.top-info .top-meta { font-size: .67rem; color: var(--muted); margin-top: 2px; }
.sidebar-pop-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; padding: 8px; }
.sidebar-pop-item { aspect-ratio: 2/3; border-radius: 4px; overflow: hidden; cursor: pointer; }
.sidebar-pop-item img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.sidebar-pop-item:hover img { opacity: .8; }

/* ── SINGLE ANIME PAGE ──────────────────────────────────────────────────── */
.anime-hero {
  background: linear-gradient(to right, rgba(0,0,0,.95) 40%, transparent);
  padding: 30px 0; margin-bottom: 24px;
  position: relative;
}
.anime-hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background-size: cover; background-position: center;
  filter: blur(8px) brightness(.3);
}
.anime-detail { display: flex; gap: 24px; align-items: flex-start; }
.anime-poster { width: 180px; flex-shrink: 0; border-radius: 8px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,.6); }
.anime-poster img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.anime-meta-list { list-style: none; margin: 12px 0; }
.anime-meta-list li { font-size: .78rem; color: var(--muted); padding: 4px 0; border-bottom: 1px solid var(--border); }
.anime-meta-list li span { color: var(--text); font-weight: 600; float: right; }
.genre-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.genre-tag {
  font-size: .7rem; padding: 3px 10px; border-radius: 3px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--muted);
  transition: all .15s;
}
.genre-tag:hover { border-color: var(--accent); color: var(--accent); }
.anime-title { font-size: 1.5rem; font-weight: 900; margin-bottom: 6px; }
.anime-title-alt { font-size: .82rem; color: var(--muted); margin-bottom: 10px; }
.status-badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 3px; margin-bottom: 10px;
}
.status-badge.airing { background: rgba(45,198,83,.15); color: var(--green); border: 1px solid var(--green); }
.status-badge.finished { background: rgba(0,180,216,.1); color: var(--accent); border: 1px solid var(--accent); }

/* ── EPISODE LIST ───────────────────────────────────────────────────────── */
.ep-list-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.ep-list-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ep-list-header h3 { font-size: .85rem; font-weight: 800; }
.ep-search-input {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 4px;
  padding: 5px 10px; color: var(--text); font-size: .75rem; outline: none; width: 150px;
}
.ep-search-input:focus { border-color: var(--accent); }
.ep-grid { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 16px; max-height: 220px; overflow-y: auto; }
.ep-btn {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 4px;
  padding: 5px 13px; font-size: .75rem; font-weight: 700; color: var(--text);
  cursor: pointer; transition: all .1s; font-family: inherit;
}
.ep-btn:hover { border-color: var(--accent); color: var(--accent); }
.ep-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── PLAYER ─────────────────────────────────────────────────────────────── */
.player-outer { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.player-wrap { background: #000; aspect-ratio: 16/9; position: relative; }
.player-wrap iframe { width: 100%; height: 100%; border: none; display: block; }
.player-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); gap: 10px; font-size: .85rem;
}
.player-placeholder .play-icon { font-size: 3rem; opacity: .3; }
.server-bar {
  display: none; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 10px 14px; background: var(--bg3); border-top: 1px solid var(--border);
}
.srv-label { font-size: .67rem; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.srv-btn {
  font-size: .72rem; font-weight: 700; padding: 4px 12px; border-radius: 3px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: all .15s;
}
.srv-btn:hover, .srv-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.srv-btn.sh { border-color: #f77f00; color: #f77f00; }
.dl-label { font-size: .67rem; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-left: 8px; }
.dl-btn {
  font-size: .7rem; padding: 4px 10px; border-radius: 3px;
  border: 1px solid var(--green); color: var(--green); background: transparent;
  cursor: pointer; transition: all .15s; text-decoration: none;
}
.dl-btn:hover { background: var(--green); color: #000; }

/* ── SYNOPSIS ───────────────────────────────────────────────────────────── */
.synopsis-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; margin-top: 12px; }
.synopsis-wrap h4 { font-size: .78rem; font-weight: 800; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.synopsis-text { font-size: .8rem; line-height: 1.7; color: #bbb; }
.synopsis-text.clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.read-more { font-size: .72rem; color: var(--accent); cursor: pointer; margin-top: 6px; display: inline-block; font-weight: 700; }

/* ── SKELETON ───────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--bg3) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── BREADCRUMB ─────────────────────────────────────────────────────────── */
.breadcrumb { font-size: .72rem; color: var(--muted); padding: 8px 0; }
.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 5px; }

/* ── FOOTER ─────────────────────────────────────────────────────────────── */
footer {
  background: var(--navy); border-top: 1px solid var(--border);
  margin-top: 40px; padding: 24px 0 16px;
}
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 0 16px; text-align: center; }
.footer-logo { font-size: 1.2rem; font-weight: 900; color: var(--accent); margin-bottom: 8px; }
.footer-links { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.footer-links a { font-size: .75rem; color: var(--muted); transition: color .15s; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: .72rem; color: #555; }
.footer-disclaimer { font-size: .68rem; color: #444; margin-top: 8px; max-width: 600px; margin-left: auto; margin-right: auto; line-height: 1.5; }

/* ── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 50px 0; color: var(--muted); font-size: .88rem; }

/* ── LOAD MORE ──────────────────────────────────────────────────────────── */
.load-more-wrap { text-align: center; padding: 16px 0; }
.load-more-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 9px 28px; border-radius: 4px; cursor: pointer; font-size: .82rem;
  font-weight: 700; transition: all .15s; font-family: inherit;
}
.load-more-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── INFO TICKER ────────────────────────────────────────────────────────── */
.info-ticker {
  background: rgba(0,180,216,.1); border-bottom: 1px solid rgba(0,180,216,.2);
  padding: 6px 16px; font-size: .72rem; color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}
.info-ticker strong { font-weight: 700; }

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media(max-width:600px) {
  .nav-links { display: none; }
  .cards-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .anime-detail { flex-direction: column; }
  .anime-poster { width: 120px; }
}
