:root {
  --bg: #0b0b12; --bg2: #14141f; --card: #1c1c2a; --line: #2a2a3c;
  --text: #f1f1f6; --muted: #a3a3b8; --accent: #7c5cff; --accent2: #ff4d8d;
  --grad: linear-gradient(90deg, var(--accent), var(--accent2));
  --pad: clamp(16px, 4vw, 56px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; z-index: 50; display: flex; align-items: center; gap: 28px;
  padding: 14px var(--pad); background: linear-gradient(#000c, #0000); transition: background .25s; }
.topbar.solid { background: #0b0b12f2; backdrop-filter: blur(8px); }
.logo { font-weight: 800; font-size: 24px; letter-spacing: -.5px; }
.logo b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: 20px; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a.on, .nav a:hover { color: var(--text); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.icon-btn:hover { background: #ffffff14; }
.icon-btn svg, .bnav svg { width: 22px; height: 22px; }
.avatar { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; }

/* ---------- Bottom nav (mobile) ---------- */
.bnav { display: none; }
@media (max-width: 760px) {
  .nav { display: none; }
  .bnav { display: flex; position: fixed; inset: auto 0 0 0; z-index: 50; background: #0b0b12f5;
    border-top: 1px solid var(--line); padding: 6px 0 calc(6px + var(--safe-b)); backdrop-filter: blur(8px); }
  .bnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
  .bnav a.on { color: var(--text); }
  main { padding-bottom: calc(70px + var(--safe-b)); }
  .top-search { display: none; }
}

/* ---------- Hero ---------- */
.hero { position: relative; min-height: min(78vh, 720px); display: flex; align-items: flex-end; padding: 0 var(--pad) 64px; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.hero::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, #0b0b12ee 0%, #0b0b1288 45%, #0000 75%), linear-gradient(0deg, var(--bg) 0%, #0000 40%); }
.hero-body { position: relative; z-index: 1; max-width: 560px; }
.kicker { display: inline-flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #fff; }
.kicker i { width: 18px; height: 18px; border-radius: 4px; background: var(--grad); display: inline-block; }
.hero h1 { font-size: clamp(34px, 6vw, 64px); line-height: 1; margin: 12px 0; letter-spacing: -1px; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; }
.pill { border: 1px solid #ffffff55; border-radius: 4px; padding: 0 6px; font-size: 12px; color: var(--text); }
.hero p { color: #dcdce6; font-size: 16px; margin: 12px 0 20px; max-width: 52ch; }
.btns { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border-radius: 6px; font-weight: 600; font-size: 16px; }
.btn svg { width: 20px; height: 20px; }
.btn-play { background: #fff; color: #000; }
.btn-play:hover { background: #ffffffd9; }
.btn-ghost { background: #6d6d8a66; color: #fff; }
.btn-ghost:hover { background: #6d6d8a99; }
.btn-grad { background: var(--grad); color: #fff; }

/* ---------- Rows ---------- */
main { min-height: 100vh; }
.rows { position: relative; z-index: 2; margin-top: -40px; }
.page-pad { padding-top: 84px; }
.row { margin: 0 0 28px; }
.row h2 { font-size: 19px; margin: 0 var(--pad) 10px; }
.row-wrap { position: relative; }
.track { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px var(--pad) 8px; scrollbar-width: none; scroll-padding: 0 var(--pad); }
.track::-webkit-scrollbar { display: none; }
.arrow { position: absolute; top: 4px; bottom: 8px; width: calc(var(--pad) - 6px); z-index: 3; background: #0b0b12aa; font-size: 28px; opacity: 0; transition: opacity .2s; }
.row-wrap:hover .arrow { opacity: 1; }
.arrow.l { left: 0; } .arrow.r { right: 0; }
@media (hover: none) { .arrow { display: none; } }

.card { flex: 0 0 auto; width: clamp(118px, 15vw, 190px); scroll-snap-align: start; border-radius: 8px; overflow: hidden; position: relative; background: var(--card); transition: transform .2s; }
.card:hover { transform: scale(1.05); z-index: 2; }
.card img { aspect-ratio: 2/3; width: 100%; object-fit: cover; }
.card.wide { width: clamp(220px, 26vw, 320px); }
.card.wide img { aspect-ratio: 16/9; }
.card .cap { position: absolute; inset: auto 0 0 0; padding: 22px 10px 8px; background: linear-gradient(#0000, #000d); font-size: 13px; }
.card .cap small { display: block; color: var(--muted); }
.bar { height: 4px; background: #ffffff33; }
.bar > i { display: block; height: 100%; background: var(--accent2); }
.rank { position: absolute; top: 6px; left: 6px; background: var(--grad); font-weight: 800; font-size: 12px; padding: 1px 7px; border-radius: 4px; }
.badge { position: absolute; top: 6px; right: 6px; background: #000a; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; letter-spacing: .5px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; padding: 0 var(--pad); }
.grid .card { width: auto; }
.page-title { margin: 0 var(--pad) 16px; font-size: 28px; }
.empty { color: var(--muted); padding: 40px var(--pad); text-align: center; }

/* ---------- Search ---------- */
.search-box { margin: 0 var(--pad) 14px; display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; }
.search-box input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 17px; padding: 13px 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 var(--pad) 20px; }
.chip { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.chip.on { background: var(--text); color: #000; border-color: var(--text); }

/* ---------- Detail ---------- */
.detail-hero { min-height: min(70vh, 620px); }
.detail-info { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; padding: 0 var(--pad) 24px; color: #dcdce6; }
.detail-info .muted { color: var(--muted); }
@media (max-width: 760px) { .detail-info { grid-template-columns: 1fr; gap: 8px; } }
.seasons-head { display: flex; justify-content: space-between; align-items: center; margin: 8px var(--pad) 12px; }
.seasons-head h2 { margin: 0; font-size: 22px; }
select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; font: inherit; }
.eps { padding: 0 var(--pad) 24px; }
.ep { display: grid; grid-template-columns: 28px 160px 1fr; gap: 16px; align-items: center; padding: 14px; border-bottom: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.ep:hover { background: var(--bg2); }
.ep .num { font-size: 22px; color: var(--muted); text-align: center; }
.ep img { aspect-ratio: 16/9; border-radius: 6px; width: 100%; object-fit: cover; }
.ep h3 { margin: 0 0 4px; font-size: 16px; display: flex; justify-content: space-between; gap: 10px; }
.ep h3 span { color: var(--muted); font-weight: 400; font-size: 14px; }
.ep p { margin: 0; color: var(--muted); font-size: 14px; }
.ep .bar { margin-top: 6px; border-radius: 2px; }
@media (max-width: 560px) { .ep { grid-template-columns: 120px 1fr; } .ep .num { display: none; } }

/* ---------- Profiles ---------- */
.profiles { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 24px; text-align: center; }
.profiles h1 { font-size: clamp(26px, 5vw, 44px); margin: 0; font-weight: 600; }
.plist { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.prof { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.prof .avatar { width: clamp(84px, 14vw, 128px); height: clamp(84px, 14vw, 128px); font-size: clamp(32px, 5vw, 48px); border-radius: 12px; border: 3px solid transparent; transition: border-color .15s; }
.prof:hover { color: var(--text); }
.prof:hover .avatar { border-color: var(--text); }
.prof .add { background: var(--bg2); color: var(--muted); }
.prof small { color: var(--muted); }
.acct { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.acct.small { color: var(--muted); font-size: 13px; gap: 6px; }
.acct.small button { color: var(--text); text-decoration: underline; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 24px;
  background: radial-gradient(ellipse at top, #2b1a5c 0%, var(--bg) 60%); }
.login .logo { font-size: 34px; }
.login-box { width: min(400px, 100%); background: #000a; border: 1px solid var(--line); border-radius: 12px; padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.login-box h1 { margin: 0 0 6px; font-size: 28px; }
.login-box input { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 13px 14px; color: var(--text); font: inherit; outline: none; }
.login-box input:focus { border-color: var(--accent); }
.login-box .btn { justify-content: center; }
.login-box .muted { color: var(--muted); margin: 0; font-size: 14px; }
.login-box .muted a { color: var(--text); text-decoration: underline; }
.err { color: #ff6b6b; margin: 0; min-height: 1em; font-size: 14px; }
.btn[disabled] { opacity: .6; cursor: default; }

/* ---------- Player ---------- */
.player { position: fixed; inset: 0; background: #000; z-index: 100; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.ptop { position: absolute; inset: 0 0 auto 0; display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: linear-gradient(#000c, #0000); transition: opacity .3s; }
.ptop .t { font-weight: 600; } .ptop .t small { color: var(--muted); font-weight: 400; margin-left: 8px; }
.player.idle .ptop { opacity: 0; pointer-events: none; }
.player.idle { cursor: none; }
.next-ep { position: absolute; right: 24px; bottom: 90px; }
.skip-intro { position: absolute; left: 24px; bottom: 90px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: var(--text); color: #000; padding: 10px 18px; border-radius: 8px; font-weight: 600; z-index: 200; animation: fade 2.2s forwards; }
@keyframes fade { 0%, 80% { opacity: 1 } 100% { opacity: 0 } }

footer { color: var(--muted); font-size: 13px; padding: 24px var(--pad) 40px; }
