:root {
  --bg: #0f1218;
  --surface: #181d26;
  --surface-2: #212836;
  --text: #e9edf3;
  --muted: #8c96a6;
  --accent: #f97316;
  --accent-2: #fb923c;
  --radius: 10px;
  --container: 1240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }

/* ---------- header & footer ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: #0f1218ee; backdrop-filter: blur(8px); border-bottom: 1px solid #ffffff12; }
.header-inner { display: flex; align-items: center; gap: 28px; height: 68px; }
.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand img { display: block; height: 52px; width: auto; }
.nav { display: flex; gap: 18px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover, .nav a[aria-current] { color: var(--text); }
.nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--accent); }

main { flex: 1; padding-top: 20px; padding-bottom: 48px; }

.site-footer { padding: 36px 0 24px; color: var(--muted); font-size: .9rem; border-top: 1px solid #ffffff12; background: #0c0f14; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) 1fr 1fr; gap: 32px; }
.footer-about p { margin: 12px 0 0; line-height: 1.7; max-width: 460px; }
.footer-brand img { display: block; height: 40px; width: auto; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links h2 { margin: 0 0 4px; color: var(--text); font-size: .95rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent-2); }
.footer-copy { margin-top: 28px; padding-top: 18px; border-top: 1px solid #ffffff0d; font-size: .82rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- umum ---------- */
.state { text-align: center; padding: 80px 0; color: var(--muted); }
.state h1 { color: var(--text); margin: 0 0 8px; }

.btn {
  display: inline-block;
  padding: 9px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--accent-2); }
.btn-ghost { background: var(--surface-2); }
.btn-ghost:hover { background: #2c3546; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 10px; border-radius: 999px; background: #ffffff14; font-size: .8rem; }
.badge { padding: 1px 8px; border-radius: 4px; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; }

.spinner {
  width: 36px; height: 36px; margin: 0 auto;
  border: 3px solid #ffffff22; border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- hero slider ---------- */
.hero { position: relative; height: 380px; border-radius: 16px; overflow: hidden; background: var(--surface); }
.hero-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .6s, visibility .6s; }
.hero-slide.is-active { opacity: 1; visibility: visible; }
.hero-bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(22px) brightness(.4); transform: scale(1.1); }
.hero-body { position: relative; display: flex; align-items: center; gap: 32px; height: 100%; padding: 32px 64px; }
.hero-poster img { width: 212px; height: 300px; object-fit: cover; border-radius: var(--radius); box-shadow: 0 12px 40px #0008; }
.hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.hero-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .9rem; }
.hero-title { margin: 0; font-size: 1.9rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-title a { text-decoration: none; }
.hero-synopsis { margin: 0; color: #c9d0db; max-width: 640px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-text .btn { align-self: flex-start; }

.hero-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: #0007; color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.hero-nav:hover { background: var(--accent); }
.hero-prev { left: 12px; }
.hero-next { right: 12px; }
.hero-dots { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; z-index: 2; }
.hero-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: #ffffff55; cursor: pointer; transition: width .3s; }
.hero-dot[aria-current="true"] { width: 24px; background: var(--accent); }

/* ---------- rak ---------- */
.shelf { margin-top: 36px; }
.shelf-title { margin: 0 0 16px; font-size: 1.25rem; padding-left: 12px; border-left: 4px solid var(--accent); }
.shelf-title small { color: var(--muted); font-weight: 400; font-size: .9rem; }

.poster { position: relative; aspect-ratio: 5 / 7; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.ep-badge { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px; background: #000c; font-size: .78rem; font-weight: 600; }
.end-badge { position: absolute; right: 8px; top: 8px; padding: 1px 7px; border-radius: 4px; background: var(--accent); font-size: .72rem; font-weight: 700; }
.card-title { margin: 8px 0 0; font-size: .9rem; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.card, .trend-card { text-decoration: none; }
.card:hover .poster img, .trend-card:hover .poster img { transform: scale(1.05); }
.card:hover .card-title, .trend-card:hover .card-title { color: var(--accent-2); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: 20px 16px; }

.trend-row { display: grid; grid-auto-flow: column; grid-auto-columns: 170px; gap: 16px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: #3a4456 transparent; }
.trend-card { position: relative; scroll-snap-align: start; padding-left: 26px; }
.trend-rank {
  position: absolute; left: 0; bottom: 34px; z-index: 1;
  font-size: 3.2rem; font-weight: 900; line-height: 1;
  color: var(--bg); -webkit-text-stroke: 2px var(--accent);
}

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; }
.pager-now { color: var(--muted); }

/* ---------- jadwal ---------- */
.shelf-first { margin-top: 8px; }
h1.shelf-title { font-size: 1.5rem; }
.page-note { margin: -8px 0 18px; color: var(--muted); font-size: .9rem; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: thin; scrollbar-color: #3a4456 transparent; }
.tab {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid #ffffff14; border-radius: 999px;
  background: var(--surface); color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
}
.tab small { font-weight: 400; font-size: .78rem; }
.tab em { font-style: normal; font-size: .75rem; padding: 0 7px; border-radius: 999px; background: #ffffff12; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab[aria-selected="true"] em { background: #ffffff33; }

.sched-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.sched-item { display: flex; gap: 14px; padding: 10px; border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.sched-item:hover { background: var(--surface-2); }
.sched-item img { flex: 0 0 64px; width: 64px; height: 90px; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.sched-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.sched-title { margin: 0; font-size: .95rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sched-item:hover .sched-title { color: var(--accent-2); }
.sched-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .85rem; }
.sched-time { color: var(--text); font-weight: 600; }
.sched-status { align-self: flex-start; padding: 1px 8px; border-radius: 4px; font-size: .75rem; font-weight: 700; }
.sched-status.is-out { background: #16a34a33; color: #4ade80; }
.sched-status.is-soon { background: #f9731633; color: var(--accent-2); }

/* ---------- genre ---------- */
.genre-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.genre-tools .tabs { margin: 0; padding: 0; }
.input {
  flex: 1 1 240px; max-width: 360px; padding: 9px 16px;
  border: 1px solid #ffffff1f; border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit;
}
.input:focus { outline: none; border-color: var(--accent); }
.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.genre-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 11px 14px; border-radius: var(--radius); background: var(--surface);
  text-decoration: none; font-weight: 600;
}
.genre-item em { font-style: normal; font-weight: 400; font-size: .8rem; color: var(--muted); }
.genre-item:hover { background: var(--surface-2); color: var(--accent-2); }
a.chip { text-decoration: none; }
a.chip:hover { background: var(--accent); }

.crumbs { margin-bottom: 10px; color: var(--muted); font-size: .88rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-2); }
.crumbs span { margin: 0 4px; opacity: .6; }

/* Sumber per-genre selalu mengirim 10 judul: 5 kolom (desktop) / 2 kolom (ponsel) = baris penuh. */
@media (min-width: 900px) { .grid-10 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.status-badge { position: absolute; right: 8px; top: 8px; padding: 1px 7px; border-radius: 4px; background: #000b; font-size: .72rem; font-weight: 700; }
.status-badge.is-ongoing { background: #16a34a; }

.pager-num { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 32px; }
.pg {
  min-width: 38px; height: 38px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--surface); text-decoration: none; font-weight: 600;
}
a.pg:hover { background: var(--surface-2); color: var(--accent-2); }
.pg-now { background: var(--accent); color: #fff; }
.pg-gap { color: var(--muted); padding: 0 2px; }

/* ---------- daftar A–Z ---------- */
.az-bar {
  position: sticky; top: 68px; z-index: 5;
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px 0 12px; margin-bottom: 8px;
  background: var(--bg); border-bottom: 1px solid #ffffff12;
}
.az-bar .input { flex: none; width: 100%; }
.az-letters { display: flex; flex-wrap: wrap; gap: 4px; }
.az-letters button {
  min-width: 32px; height: 32px; padding: 0 6px;
  border: 0; border-radius: 6px; background: var(--surface);
  color: var(--text); font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer;
}
.az-letters button:hover:not(:disabled) { background: var(--accent); color: #fff; }
.az-letters button:disabled { opacity: .3; cursor: default; }
.az-group { scroll-margin-top: 190px; padding-top: 18px; }
.az-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-size: 1.4rem; color: var(--accent); }
.az-head small { font-size: .8rem; font-weight: 400; color: var(--muted); }
.az-list { list-style: none; margin: 0; padding: 0; columns: 3 280px; column-gap: 28px; }
.az-list li { break-inside: avoid; padding: 5px 0; border-bottom: 1px solid #ffffff0a; }
.az-list a { text-decoration: none; font-size: .92rem; }
.az-list a:hover { color: var(--accent-2); }

/* ---------- layar muat ---------- */
.slow-note { margin: 16px 0 0; font-size: .9rem; opacity: 0; animation: reveal .3s 3s forwards; }
@keyframes reveal { to { opacity: 1; } }

/* ---------- detail anime ---------- */
.muted { color: var(--muted); }
.badge-green { background: #16a34a; }
.rating { color: #fbbf24; font-weight: 700; }

.anime-hero {
  position: relative; overflow: hidden; border-radius: 16px;
  display: flex; gap: 28px; align-items: flex-end;
  padding: 28px; background: var(--surface);
}
.anime-hero-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(30px) brightness(.35); transform: scale(1.1); }
.anime-poster { position: relative; flex: 0 0 auto; width: 230px; height: 325px; object-fit: cover; border-radius: var(--radius); box-shadow: 0 12px 40px #0009; background: var(--surface-2); }
.anime-head { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.anime-title { margin: 0; font-size: 2rem; line-height: 1.2; }
.anime-aka { margin: -6px 0 0; color: var(--muted); font-size: .9rem; }
.anime-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.anime-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

.anime-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; margin-top: 28px; }
.sub-title { margin: 0 0 12px; font-size: 1.15rem; }
.sub-title small { color: var(--muted); font-weight: 400; font-size: .85rem; margin-left: 4px; }
.anime-main .sub-title + .synopsis { margin-top: 0; }
.synopsis { margin: 0; color: #c9d0db; line-height: 1.7; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.synopsis.is-open { display: block; }
.link-btn { margin: 6px 0 0; padding: 0; border: 0; background: none; color: var(--accent-2); font: inherit; font-weight: 600; cursor: pointer; }
.anime-main > .sub-title:not(:first-child) { margin-top: 28px; }

.meta { margin: 0; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); display: grid; gap: 10px; }
.meta div { display: grid; grid-template-columns: 80px 1fr; gap: 10px; }
.meta dt { color: var(--muted); font-size: .88rem; }
.meta dd { margin: 0; font-weight: 600; font-size: .92rem; }

.tabs-sm .tab { padding: 5px 12px; font-size: .85rem; }
.input-sm { display: block; max-width: 260px; margin: 0 0 14px; padding: 7px 14px; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ep-item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; padding: 8px 6px; border-radius: 8px; background: var(--surface);
  text-decoration: none; text-align: center;
}
.ep-item strong { font-size: 1rem; }
.ep-item small { color: var(--muted); font-size: .7rem; }
.ep-item:hover { background: var(--accent); }
.ep-item:hover small { color: #fff; }
.ep-end { position: absolute; top: 3px; right: 4px; font-size: .58rem; font-weight: 800; color: var(--accent-2); }
.ep-item:hover .ep-end { color: #fff; }
@media (min-width: 900px) { .grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---------- nonton ---------- */
.watch { max-width: 1040px; margin: 0 auto; }
.watch-title { margin: 0 0 16px; font-size: 1.5rem; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.player video, .player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.player-note { margin: 10px 0 0; padding: 10px 14px; border-radius: 8px; background: #f9731622; color: #fed7aa; font-size: .9rem; }
.player-note .link-btn { margin: 0 0 0 6px; }

.servers { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.servers-label { color: var(--muted); font-size: .9rem; margin-right: 2px; }
.server-btn {
  padding: 7px 14px; border: 1px solid #ffffff1a; border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer;
}
.server-btn em { font-style: normal; font-weight: 500; font-size: .72rem; margin-left: 4px; padding: 1px 6px; border-radius: 4px; background: #16a34a33; color: #4ade80; }
.server-btn em.em-ads { background: #ffffff14; color: var(--muted); }
.server-btn:hover { border-color: var(--accent); }
.server-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.server-btn[aria-pressed="true"] em { background: #ffffff33; color: #fff; }

.watch-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 22px; }
.watch-nav > :first-child { justify-self: start; }
.watch-nav > :last-child { justify-self: end; }

.downloads { margin-top: 32px; }
.dl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #ffffff0d; }
.dl-q { min-width: 60px; }
.dl-links { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- ponsel ---------- */
@media (max-width: 720px) {
  .hero { height: 440px; }
  .hero-body { flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 14px; padding: 20px 20px 40px; }
  .hero-poster { display: none; }
  .hero-bg { filter: blur(6px) brightness(.35); }
  .hero-title { font-size: 1.4rem; }
  .hero-nav { display: none; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; }
  .card-title { font-size: .82rem; }
  .trend-row { grid-auto-columns: 130px; }
  .header-inner { gap: 16px; }
  .nav { min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; gap: 14px; }
  .brand img { height: 40px; }
  .header-inner { height: 60px; }
  .az-bar { top: 60px; }
  .grid-10 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Bilah huruf menggulir ke samping supaya tidak memakan setengah layar. */
  .az-letters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .az-letters button { flex: 0 0 auto; }
  .az-group { scroll-margin-top: 170px; }
  .anime-hero { flex-direction: column; align-items: center; text-align: center; padding: 24px 16px; gap: 18px; }
  .anime-poster { width: 170px; height: 240px; }
  .anime-title { font-size: 1.45rem; }
  .anime-badges, .anime-head .chips, .anime-cta { justify-content: center; }
  .anime-body { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .anime-side { order: -1; }
  .ep-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .watch-title { font-size: 1.2rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-about { grid-column: 1 / -1; }
  .player { margin: 0 -16px; border-radius: 0; }
  .watch-nav { grid-template-columns: 1fr 1fr; }
  .watch-nav .btn { padding: 8px 14px; font-size: .88rem; white-space: nowrap; }
  .watch-nav > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; text-align: center; }
  .watch-nav > :nth-child(2):empty { display: none; }
  .pg-far { display: none; }
  .pg { min-width: 34px; height: 34px; padding: 0 8px; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
