:root {
  --bg: #08080c;
  --panel: #101017;
  --panel-2: #16161f;
  --line: #2a2a35;
  --text: #f4f1e9;
  --muted: #a19c8c;
  --primary: #e0b34e;
  --primary-2: #c9963a;
  --danger: #ff6b6b;
  --ok: #34d399;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: radial-gradient(1200px 600px at 20% -10%, #1a1408 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

a { color: var(--primary); text-decoration: none; }

.hidden { display: none !important; }

/* ---------- top bar / nav ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(8, 8, 12, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1280px; margin: 0 auto; padding: 14px 22px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.logo {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 11px; font-size: 17px; color: #fff;
  background: linear-gradient(135deg, var(--primary), #b07d2a);
  box-shadow: 0 8px 22px rgba(224, 179, 78, .35);
}
.brand__name { font-weight: 800; font-size: 17px; letter-spacing: .2px; }

.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav__link {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 8px 15px; border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 600;
  text-decoration: none;
}
.nav__link:hover { color: var(--text); background: #17161d; }
.nav__link.active { color: #fff; background: #201d12; border-color: #3a3220; }

.search {
  margin-left: auto; display: flex; align-items: center;
  background: #0b0b10; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.search:focus-within { border-color: var(--primary); }
.search input {
  border: none; background: transparent; color: var(--text);
  padding: 9px 14px; font-size: 14px; outline: none; width: 210px;
}
.search button {
  border: none; background: transparent; color: var(--muted);
  padding: 0 13px; cursor: pointer; font-size: 17px;
}
.search button:hover { color: var(--primary); }

/* ---------- layout ---------- */
.shell { max-width: 1280px; margin: 0 auto; padding: 24px 22px 90px; }
.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.panel {
  background: linear-gradient(180deg, var(--panel), #0d0d12);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  margin-bottom: 20px;
}
.page-intro { margin: 6px 0 20px; }
.page-intro__eyebrow { margin: 0; color: var(--primary); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.page-intro__title { margin: 4px 0 0; font-size: 26px; font-weight: 800; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { margin: 0 0 14px; font-size: 17px; }
.section-head .section-title { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.empty { padding: 30px 4px; text-align: center; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 11px 17px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform .06s, background .15s, border .15s, opacity .15s;
  white-space: nowrap; text-decoration: none; display: inline-block;
}
.btn:hover { border-color: #3a3220; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(224, 179, 78, .28); }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.danger { border-color: #4a2630; color: var(--danger); background: transparent; }
.btn.copied { border-color: var(--ok); color: var(--ok); }
.btn-link {
  background: transparent; border: none; color: var(--text); font: inherit;
  font-weight: 700; font-size: 14px; padding: 0; cursor: pointer;
}
.btn-link:hover { color: var(--primary); }

.status { min-height: 18px; margin: 12px 2px 0; font-size: 13px; color: var(--muted); }
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }

input[type="text"], input[type="search"], input[type="password"], .ep-search {
  padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #0b0b10; color: var(--text); font-size: 14px; outline: none;
}
input[type="text"]:focus, .ep-search:focus, input[type="password"]:focus { border-color: var(--primary); }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ---------- grids / cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 16px; }

.show-card {
  background: #0b0b10; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: border .15s, transform .1s;
  display: flex; flex-direction: column;
}
.show-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.show-card__media { position: relative; aspect-ratio: 3 / 4.2; background: #050506 center/cover no-repeat; }
.show-card__badge {
  position: absolute; left: 8px; top: 8px; font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; background: rgba(0,0,0,.65);
  color: #f0e2bd; border: 1px solid rgba(224, 179, 78, .30);
}
.show-card__badge.downloaded { background: rgba(52,211,153,.92); color: #04261c; border-color: transparent; }
.show-card__body { padding: 10px 11px 13px; }
.show-card__title { margin: 0; font-size: 13px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 11.5px; color: var(--muted); }

/* ---------- series page ---------- */
.back-btn { margin-bottom: 16px; }
.series-hero {
  position: relative; display: grid; grid-template-columns: 210px 1fr; gap: 24px;
  background: linear-gradient(180deg, var(--panel), #0d0d12);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  margin-bottom: 20px; overflow: hidden;
}
.series-hero__bg { position: absolute; inset: 0; background-size: cover; background-position: center 18%; opacity: .16; z-index: 0; filter: saturate(.8); }
.series-hero__media, .series-hero__content { position: relative; z-index: 1; }
.series-hero__cover { width: 100%; aspect-ratio: 3/4.2; border-radius: 12px; object-fit: cover; background: #050506; }
.series-hero__title { margin: 0 0 10px; font-size: 26px; font-weight: 800; }
.series-hero__native { margin: -6px 0 12px; color: var(--muted); font-size: 13px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.meta-chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: #17171e; border: 1px solid var(--line); color: #cfc4a6; }
.meta-chip--accent { color: #ffd479; }
.lang-badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.lang-badge { font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.lang-badge--sub { background: #17171e; color: #f0d69a; border: 1px solid #2a2414; }
.lang-badge--dub { background: #2a2414; color: #f0d69a; border: 1px solid #3a3220; }
.genre-strip { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.genre-pill { font-size: 12px; padding: 4px 11px; border-radius: 999px; background: #1a1408; border: 1px solid #2a2414; color: #e6d3a3; }
.series-hero__desc { color: #d6cdb8; font-size: 13.5px; line-height: 1.6; max-height: 210px; overflow: auto; }

.ep-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.ep-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ep-search { width: 180px; }
.active-sort { border-color: var(--primary) !important; color: var(--primary) !important; }

.ep-list { display: flex; flex-direction: column; gap: 8px; }
.ep-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 10px; background: #0b0b10; padding: 10px 14px;
}
.ep-row__head { display: flex; align-items: center; gap: 10px; }
.ep-row__tags { display: flex; gap: 6px; }
.ep-row__tag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #17171e; border: 1px solid #2a2414; color: #e6d3a3; }
.ep-row__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- downloads / queues ---------- */
.jobs { display: flex; flex-direction: column; gap: 12px; }
.job { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; background: #0b0b10; }
.job-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.job-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-stage { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.job.error .job-stage { color: var(--danger); }
.job.done .job-stage { color: var(--ok); }
.bar { height: 8px; border-radius: 999px; background: #17171e; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #b07d2a); transition: width .3s; }
.job.error .bar > span { background: var(--danger); }
.job.done .bar > span { background: var(--ok); }
.job-sub { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.job-sub .bar { height: 5px; }

.resolve-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; }
.resolve-head h2 { margin: 0; font-size: 16px; }
.tag { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: #2a2414; color: #e6d3a3; border: 1px solid #3a3220; }
.lang-block { margin-bottom: 16px; }
.lang-block__label { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin-bottom: 8px; }
.servers { display: flex; flex-wrap: wrap; gap: 9px; }
.server {
  padding: 9px 15px; border-radius: 10px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--line); background: #0d0d12; color: var(--text);
  display: flex; align-items: center; gap: 7px;
}
.server:hover { border-color: var(--primary); }
.server .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.server .dot.warn { background: #f5b840; }
.sources-hint { color: var(--muted); font-size: 13px; padding: 10px 2px; }
.series-btn { width: 100%; margin-top: 12px; padding: 13px 16px; font-size: 14px; }

/* ---------- library (series rows) ---------- */
.series-list { display: flex; flex-direction: column; gap: 10px; }
.series-row { display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 12px; background: #0b0b10; padding: 12px 14px; }
.series-row__cover { width: 60px; height: 84px; border-radius: 8px; background: #050506 center/cover no-repeat; flex-shrink: 0; }
.series-row__body { flex: 1; min-width: 0; }
.series-row__title { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.series-row__title .lang-badge { font-size: 10px; padding: 2px 8px; vertical-align: middle; margin-left: 6px; }
.series-row__actions { flex-shrink: 0; display: flex; gap: 8px; }

#watch-status.ok { color: var(--ok); }
#watch-status.error { color: var(--danger); }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(6,6,9,.82); backdrop-filter: blur(4px); }
.modal-body { position: relative; width: min(960px, 96vw); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); max-height: 92vh; overflow: auto; }
.modal-body--sm { width: min(560px, 96vw); }
.modal-body--video { width: min(1000px, 96vw); padding: 12px; }
.modal-body--video .modal-head { margin-bottom: 8px; }
.modal-body--video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; background: #000; display: block; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.icon-btn { background: transparent; border: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.icon-btn:hover { background: #17171e; color: #fff; }

/* ---------- misc ---------- */
.url-row { display: flex; gap: 10px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 26px; }

@media (max-width: 720px) {
  .topbar__inner { flex-wrap: wrap; }
  .search { order: 3; width: 100%; margin-left: 0; }
  .search input { width: 100%; }
  .series-hero { grid-template-columns: 130px 1fr; gap: 16px; }
  .brand__name { display: none; }
}
.mgr-bar{font-size:12px;color:var(--muted);margin:2px 0 14px;letter-spacing:.02em}
.mgr-bar.warn{color:#e0a83a}


.show-card{text-decoration:none;color:inherit}
.series-row__title a{color:inherit;text-decoration:none}
.series-row__title a:hover{color:var(--primary)}


.mgr-row{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin:2px 0 14px}
.mgr-row .mgr-bar{margin:0;flex:1}


.cat-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:14px}
.catalog-panel .grid{min-height:120px}
.pager{display:flex;align-items:center;justify-content:center;gap:14px;margin-top:18px}

